"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["node_modules_mermaid_dist_chunks_mermaid_core_diagram-GUPCWM2R_mjs"],{"./node_modules/mermaid/dist/chunks/mermaid.core/chunk-ANTBXLJU.mjs":function(P,w,m){m.d(w,{S:function(){return v}});var C=m("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-VIW5F6AA.mjs");function v(k,a){k.accDescr&&a.setAccDescription?.(k.accDescr),k.accTitle&&a.setAccTitle?.(k.accTitle),k.title&&a.setDiagramTitle?.(k.title)}(0,C.K2)(v,"populateCommonDb")},"./node_modules/mermaid/dist/chunks/mermaid.core/diagram-GUPCWM2R.mjs":function(P,w,m){var b;m.d(w,{diagram:function(){return F}});var C=m("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-ANTBXLJU.mjs"),v=m("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.mjs"),k=m("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-T57MJCP2.mjs"),a=m("./node_modules/mermaid/dist/chunks/mermaid.core/chunk-VIW5F6AA.mjs"),D=m("./node_modules/@mermaid-js/parser/dist/mermaid-parser.core.mjs"),x=a.UI.packet,B=(b=class{constructor(){this.packet=[],this.setAccTitle=a.SV,this.getAccTitle=a.iN,this.setDiagramTitle=a.ke,this.getDiagramTitle=a.ab,this.getAccDescription=a.m7,this.setAccDescription=a.EI}getConfig(){const t=(0,v.$t)({...x,...(0,a.zj)().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){(0,a.IU)(),this.packet=[]}},(0,a.K2)(b,"PacketDB"),b),y=1e4,$=(0,a.K2)((e,t)=>{(0,C.S)(e,t);let s=-1,o=[],c=1;const{bitsPerRow:d}=t.getConfig();for(let{start:r,end:n,bits:h,label:l}of e.blocks){if(r!==void 0&&n!==void 0&&n<r)throw new Error(`Packet block ${r} - ${n} is invalid. End must be greater than start.`);if(r??(r=s+1),r!==s+1)throw new Error(`Packet block ${r} - ${n??r} is not contiguous. It should start from ${s+1}.`);if(h===0)throw new Error(`Packet block ${r} is invalid. Cannot have a zero bit field.`);for(n??(n=r+(h??1)-1),h??(h=n-r+1),s=n,a.Rm.debug(`Packet block ${r} - ${s} with label ${l}`);o.length<=d+1&&t.getPacket().length<y;){const[u,i]=A({start:r,end:n,bits:h,label:l},c,d);if(o.push(u),u.end+1===c*d&&(t.pushWord(o),o=[],c++),!i)break;({start:r,end:n,bits:h,label:l}=i)}}t.pushWord(o)},"populate"),A=(0,a.K2)((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const o=t*s-1,c=t*s;return[{start:e.start,end:o,label:e.label,bits:o-e.start},{start:c,end:e.end,label:e.label,bits:e.end-c}]},"getNextFittingBlock"),E={parser:{yy:void 0},parse:(0,a.K2)(async e=>{const t=await(0,D.qg)("packet",e),s=E.parser?.yy;if(!(s instanceof B))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.");a.Rm.debug(t),$(t,s)},"parse")},T=(0,a.K2)((e,t,s,o)=>{const c=o.db,d=c.getConfig(),{rowHeight:r,paddingY:n,bitWidth:h,bitsPerRow:l}=d,u=c.getPacket(),i=c.getDiagramTitle(),_=r+n,p=_*(u.length+1)-(i?0:r),f=h*l+2,g=(0,k.D)(t);g.attr("viewbox",`0 0 ${f} ${p}`),(0,a.a$)(g,p,f,d.useMaxWidth);for(const[U,I]of u.entries())W(g,I,U,d);g.append("text").text(i).attr("x",f/2).attr("y",p-_/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),W=(0,a.K2)((e,t,s,{rowHeight:o,paddingX:c,paddingY:d,bitWidth:r,bitsPerRow:n,showBits:h})=>{const l=e.append("g"),u=s*(o+d)+d;for(const i of t){const _=i.start%n*r+1,p=(i.end-i.start+1)*r-c;if(l.append("rect").attr("x",_).attr("y",u).attr("width",p).attr("height",o).attr("class","packetBlock"),l.append("text").attr("x",_+p/2).attr("y",u+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(i.label),!h)continue;const f=i.end===i.start,g=u-2;l.append("text").attr("x",_+(f?p/2:0)).attr("y",g).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",f?"middle":"start").text(i.start),f||l.append("text").attr("x",_+p).attr("y",g).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(i.end)}},"drawWord"),j={draw:T},M={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},S=(0,a.K2)(({packet:e}={})=>{const t=(0,v.$t)(M,e);return`
	.packetByte {
		font-size: ${t.byteFontSize};
	}
	.packetByte.start {
		fill: ${t.startByteColor};
	}
	.packetByte.end {
		fill: ${t.endByteColor};
	}
	.packetLabel {
		fill: ${t.labelColor};
		font-size: ${t.labelFontSize};
	}
	.packetTitle {
		fill: ${t.titleColor};
		font-size: ${t.titleFontSize};
	}
	.packetBlock {
		stroke: ${t.blockStrokeColor};
		stroke-width: ${t.blockStrokeWidth};
		fill: ${t.blockFillColor};
	}
	`},"styles"),F={parser:E,get db(){return new B},renderer:j,styles:S}}}]);
