1var t;import{_ as e,F as r,K as a,e as s,l as o,b as i,a as n,q as l,t as d,g as c,s as p,G as h,H as b,z as k}from"./index-C16DHWFp.js";import{p as m}from"./chunk-4BX2VUAB-CJu338GO.js";import{p as g}from"./treemap-KZPCXAKY-DdCrRx6w.js";import"./vendor-react-DejgYtBM.js";import"./vendor-semi-D8d7bTtM.js";import"./index-BeIIFw6E.js";import"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./vendor-katex-BuQuj6Fv.js";import"./dayjs.min-CASHsil8.js";import"./purify.es-Bm-lHtoJ.js";import"./index-DcbB2zxU.js";import"./vendor-highlight-CaHTjBxz.js";import"./index-B_PxGnmD.js";import"./_baseUniq-BjWlgG8Y.js";import"./_basePickBy-bVyxPQRR.js";import"./clone-VMOlTGG7.js";var f=h.packet,u=(e(t=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=n,this.setDiagramTitle=l,this.getDiagramTitle=d,this.getAccDescription=c,this.setAccDescription=p}getConfig(){const t=r({...f,...b().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){k(),this.packet=[]}},"PacketDB"),t),w=e((t,e)=>{m(t,e);let r=-1,a=[],s=1;const{bitsPerRow:i}=e.getConfig();for(let{start:n,end:l,bits:d,label:c}of t.blocks){if(void 0!==n&&void 0!==l&&l<n)throw new Error(`Packet block ${n} - ${l} is invalid. End must be greater than start.`);if(n??(n=r+1),n!==r+1)throw new Error(`Packet block ${n} - ${l??n} is not contiguous. It should start from ${r+1}.`);if(0===d)throw new Error(`Packet block ${n}
1 is invalid. Cannot have a zero bit field.`);for(l??(l=n+(d??1)-1),d??(d=l-n+1),r=l,o.debug(`Packet block ${n} - ${r} with label ${c}`);a.length<=i+1&&e.getPacket().length<1e4;){const[t,r]=x({start:n,end:l,bits:d,label:c},s,i);if(a.push(t),t.end+1===s*i&&(e.pushWord(a),a=[],s++),!r)break;({start:n,end:l,bits:d,label:c}=r)}}e.pushWord(a)},"populate"),x=e((t,e,r)=>{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*r)return[t,void 0];const a=e*r-1,s=e*r;return[{start:t.start,end:a,label:t.label,bits:a-t.start},{start:s,end:t.end,label:t.label,bits:t.end-s}]},"getNextFittingBlock"),y={parser:{yy:void 0},parse:e(async t=>{const e=await g("packet",t),r=y.parser?.yy;if(!(r instanceof u))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");o.debug(e),w(e,r)},"parse")},$=e((t,e,r,o)=>{const i=o.db,n=i.getConfig(),{rowHeight:l,paddingY:d,bitWidth:c,bitsPerRow:p}=n,h=i.getPacket(),b=i.getDiagramTitle(),k=l+d,m=k*(h.length+1)-(b?0:l),g=c*p+2,f=a(e);f.attr("viewBox",`0 0 ${g} ${m}`),s(f,m,g,n.useMaxWidth);for(const[a,s]of h.entries())B(f,s,a,n);f.append("text").text(b).attr("x",g/2).attr("y",m-k/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),B=e((t,e,r,{rowHeight:a,paddingX:s,paddingY:o,bitWidth:i,bitsPerRow:n,showBits:l})=>{const d=t.append("g"),c=r*(a+o)+o;for(const p of e){const t=p.start%n*i+1,e=(p.end-p.start+1)*i-s;if(d.append("rect").attr("x",t).attr("y",c).attr("width",e).attr("height",a).attr("class","packetBlock"),d.append("text").attr("x",t+e/2).attr("y",c+a/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(p.label),!l)continue;const r=p.end===p.start,o=c-2;d.append("text").attr("x",t+(r?e/2:0)).attr("y",o).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",r?"middle":"start").text(p.start),r||d.append("text").attr("x",t+e).attr("y",o).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(p.end)}},"drawWord"),v={draw:$},j={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},C=e(({packet:t}={})=>{const e=r(j,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"),P={parser:y,get db(){return new u},renderer:v,styles:C};export{P as diagram};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.