export const id=220;export const ids=[220];export const modules={64379:(t,e,a)=>{function r(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}a.d(e,{S:()=>r}),(0,a(54759).K2)(r,"populateCommonDb")},19220:(t,e,a)=>{a.d(e,{diagram:()=>$});var r=a(64379),o=a(71510),n=a(27983),i=a(54759),l=a(88465),s={packet:[]},c=structuredClone(s),d=i.UI.packet,b=(0,i.K2)((()=>{const t=(0,o.$t)({...d,...(0,i.zj)().packet});return t.showBits&&(t.paddingY+=10),t}),"getConfig"),p=(0,i.K2)((()=>c.packet),"getPacket"),k={pushWord:(0,i.K2)((t=>{t.length>0&&c.packet.push(t)}),"pushWord"),getPacket:p,getConfig:b,clear:(0,i.K2)((()=>{(0,i.IU)(),c=structuredClone(s)}),"clear"),setAccTitle:i.SV,getAccTitle:i.iN,setDiagramTitle:i.ke,getDiagramTitle:i.ab,getAccDescription:i.m7,setAccDescription:i.EI},h=(0,i.K2)((t=>{(0,r.S)(t,k);let e=-1,a=[],o=1;const{bitsPerRow:n}=k.getConfig();for(let{start:r,end:l,bits:s,label:c}of t.blocks){if(void 0!==r&&void 0!==l&&l<r)throw new Error(`Packet block ${r} - ${l} is invalid. End must be greater than start.`);if(r??=e+1,r!==e+1)throw new Error(`Packet block ${r} - ${l??r} is not contiguous. It should start from ${e+1}.`);if(0===s)throw new Error(`Packet block ${r} is invalid. Cannot have a zero bit field.`);for(l??=r+(s??1)-1,s??=l-r+1,e=l,i.Rm.debug(`Packet block ${r} - ${e} with label ${c}`);a.length<=n+1&&k.getPacket().length<1e4;){const[t,e]=g({start:r,end:l,bits:s,label:c},o,n);if(a.push(t),t.end+1===o*n&&(k.pushWord(a),a=[],o++),!e)break;({start:r,end:l,bits:s,label:c}=e)}}k.pushWord(a)}),"populate"),g=(0,i.K2)(((t,e,a)=>{if(void 0===t.start)throw new Error("start should have been set during first phase");if(void 0===t.end)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*a)return[t,void 0];const r=e*a-1,o=e*a;return[{start:t.start,end:r,label:t.label,bits:r-t.start},{start:o,end:t.end,label:t.label,bits:t.end-o}]}),"getNextFittingBlock"),f={parse:(0,i.K2)((async t=>{const e=await(0,l.qg)("packet",t);i.Rm.debug(e),h(e)}),"parse")},u=(0,i.K2)(((t,e,a,r)=>{const o=r.db,l=o.getConfig(),{rowHeight:s,paddingY:c,bitWidth:d,bitsPerRow:b}=l,p=o.getPacket(),k=o.getDiagramTitle(),h=s+c,g=h*(p.length+1)-(k?0:s),f=d*b+2,u=(0,n.D)(e);u.attr("viewbox",`0 0 ${f} ${g}`),(0,i.a$)(u,g,f,l.useMaxWidth);for(const[t,e]of p.entries())w(u,e,t,l);u.append("text").text(k).attr("x",f/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")}),"draw"),w=(0,i.K2)(((t,e,a,{rowHeight:r,paddingX:o,paddingY:n,bitWidth:i,bitsPerRow:l,showBits:s})=>{const c=t.append("g"),d=a*(r+n)+n;for(const t of e){const e=t.start%l*i+1,a=(t.end-t.start+1)*i-o;if(c.append("rect").attr("x",e).attr("y",d).attr("width",a).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",e+a/2).attr("y",d+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(t.label),!s)continue;const n=t.end===t.start,b=d-2;c.append("text").attr("x",e+(n?a/2:0)).attr("y",b).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",n?"middle":"start").text(t.start),n||c.append("text").attr("x",e+a).attr("y",b).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(t.end)}}),"drawWord"),x={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},$={parser:f,db:k,renderer:{draw:u},styles:(0,i.K2)((({packet:t}={})=>{const e=(0,o.$t)(x,t);return`\n\t.packetByte {\n\t\tfont-size: ${e.byteFontSize};\n\t}\n\t.packetByte.start {\n\t\tfill: ${e.startByteColor};\n\t}\n\t.packetByte.end {\n\t\tfill: ${e.endByteColor};\n\t}\n\t.packetLabel {\n\t\tfill: ${e.labelColor};\n\t\tfont-size: ${e.labelFontSize};\n\t}\n\t.packetTitle {\n\t\tfill: ${e.titleColor};\n\t\tfont-size: ${e.titleFontSize};\n\t}\n\t.packetBlock {\n\t\tstroke: ${e.blockStrokeColor};\n\t\tstroke-width: ${e.blockStrokeWidth};\n\t\tfill: ${e.blockFillColor};\n\t}\n\t`}),"styles")}}};
//# sourceMappingURL=https://main.vscode-cdn.net/sourcemaps/146732d0c28fe6d8f982f1ebf7ab4101ece88c63/extensions/windsurf/out/220.chat.js.map