You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
3.7 KiB
1 line
3.7 KiB
"use strict";(self.webpackChunkjupyter_web=self.webpackChunkjupyter_web||[]).push([[6669],{76669:(N,m,d)=>{d.r(m),d.d(m,{diagram:()=>L});var y=d(53420),B=d(23854),C=d(62477),E=d(39624),a=d(3685),W=d(32928),x={packet:[]},v=structuredClone(x),P=a.vZ.packet,$=(0,a.eW)(()=>{const t=(0,C.Rb)({...P,...(0,a.iE)().packet});return t.showBits&&(t.paddingY+=10),t},"getConfig"),D=(0,a.eW)(()=>v.packet,"getPacket"),u={pushWord:(0,a.eW)(t=>{t.length>0&&v.packet.push(t)},"pushWord"),getPacket:D,getConfig:$,clear:(0,a.eW)(()=>{(0,a.ZH)(),v=structuredClone(x)},"clear"),setAccTitle:a.GN,getAccTitle:a.eu,setDiagramTitle:a.g2,getDiagramTitle:a.Kr,getAccDescription:a.Mx,setAccDescription:a.U$},O=(0,a.eW)(t=>{(0,B.A)(t,u);let e=-1,o=[],s=1;const{bitsPerRow:i}=u.getConfig();for(let{start:r,end:n,label:k}of t.blocks){if(n&&n<r)throw new Error(`Packet block ${r} - ${n} is invalid. End must be greater than start.`);if(r!==e+1)throw new Error(`Packet block ${r} - ${n??r} is not contiguous. It should start from ${e+1}.`);for(e=n??r,a.cM.debug(`Packet block ${r} - ${e} with label ${k}`);o.length<=i+1&&u.getPacket().length<1e4;){const[h,c]=A({start:r,end:n,label:k},s,i);if(o.push(h),h.end+1===s*i&&(u.pushWord(o),o=[],s++),!c)break;({start:r,end:n,label:k}=c)}}u.pushWord(o)},"populate"),A=(0,a.eW)((t,e,o)=>{if(void 0===t.end&&(t.end=t.start),t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);return t.end+1<=e*o?[t,void 0]:[{start:t.start,end:e*o-1,label:t.label},{start:e*o,end:t.end,label:t.label}]},"getNextFittingBlock"),F={parse:(0,a.eW)(function(){var t=(0,y.Z)(function*(e){const o=yield(0,W.Qc)("packet",e);a.cM.debug(o),O(o)});return function(e){return t.apply(this,arguments)}}(),"parse")},S=(0,a.eW)((t,e,o,s)=>{const i=s.db,r=i.getConfig(),{rowHeight:n,paddingY:k,bitWidth:h,bitsPerRow:c}=r,b=i.getPacket(),l=i.getDiagramTitle(),g=n+k,p=g*(b.length+1)-(l?0:n),_=h*c+2,f=(0,E.P)(e);f.attr("viewbox",`0 0 ${_} ${p}`),(0,a.v2)(f,p,_,r.useMaxWidth);for(const[R,K]of b.entries())U(f,K,R,r);f.append("text").text(l).attr("x",_/2).attr("y",p-g/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),U=(0,a.eW)((t,e,o,{rowHeight:s,paddingX:i,paddingY:r,bitWidth:n,bitsPerRow:k,showBits:h})=>{const c=t.append("g"),b=o*(s+r)+r;for(const l of e){const g=l.start%k*n+1,p=(l.end-l.start+1)*n-i;if(c.append("rect").attr("x",g).attr("y",b).attr("width",p).attr("height",s).attr("class","packetBlock"),c.append("text").attr("x",g+p/2).attr("y",b+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(l.label),!h)continue;const _=l.end===l.start,f=b-2;c.append("text").attr("x",g+(_?p/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",_?"middle":"start").text(l.start),_||c.append("text").attr("x",g+p).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(l.end)}},"drawWord"),j={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},L={parser:F,db:u,renderer:{draw:S},styles:(0,a.eW)(({packet:t}={})=>{const e=(0,C.Rb)(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")}}}]); |