@diagrammo/dgmo 0.44.0 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auto.js CHANGED
@@ -208,7 +208,7 @@ Task
208
208
  `);for(let n of e){let r=n.trim();if(!r||r.startsWith("//"))continue;let o=Ve(r);if(o)return o.chartType;break}return A0(t)?"sequence":Y0(t)?"flowchart":U0(t)?"class":j0(t)?"er":z0(t)?"state":J0(t)?"sitemap":K0(t)?"org":JA(t)?"c4":QA(t)?"gantt":iw(t)?"pert":null}function tE(t){return Jw.get(t.toLowerCase())?.category??null}function M9(t){let e=Jw.get(t.toLowerCase());return e?jA(e.parse):!1}function T9(){return sw.map(t=>t.id)}function nE(t){let e=A9(t);return{diagnostics:VL(e.diagnostics),chartType:e.chartType}}function A9(t){let e=tR(t);if(!e){let o=R9(t);if(o){let a=lo(t).diagnostics;return{diagnostics:[o,...a],chartType:null}}return{diagnostics:lo(t).diagnostics,chartType:null}}let n=_9.get(e);return n?{diagnostics:[...n(t).diagnostics,...ZA(t)],chartType:e}:{diagnostics:[...lo(t).diagnostics,...ZA(t)],chartType:e}}function R9(t){let e=t.split(`
209
209
  `);for(let n=0;n<e.length;n++){let r=e[n].trim();if(!r||r.startsWith("#")||r.startsWith("//"))continue;let o=r.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(!o)return null;let a=o[1].toLowerCase(),i=o[2].trim();if(KA.has(a)){let l=i?`${a} ${i}`:a;return Pt(n+1,`Remove the colon \u2014 use '${l}' instead of '${r}'. DGMO chart types don't use colons.`)}let s=be(a,[...KA]);return s?Pt(n+1,`Unknown chart type: ${a}. ${s} Also, DGMO chart types don't use colons.`):null}return null}function ZA(t){return t.split(`
210
210
  `).filter(r=>r.trim()&&!r.trim().startsWith("#")&&!r.trim().startsWith("//")).length<=1?[Pt(1,"No content after chart type declaration.","warning")]:[]}var k9,L9,N9,C9,eE,eR,_9,KA,rE=st(()=>{"use strict";Dc();Ku();Zu();Qu();Ju();tf();ef();sf();Ki();Gn();hn();h2();qA();k9=/^\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h)(?:\?)?\s+/,L9=/^\d{4}-\d{2}-\d{2}(?:\s\d{2}:\d{2})?\s+/;N9=/\bis\s+an?\s+(person|system|container|component)\b/i;C9=Object.fromEntries(sw.map(t=>[t.id,t.description])),eE=Qw.map(t=>[t.id,t.parse]),eR=eE.map(([t])=>t),_9=new Map(eE),KA=new Set(eR)});function Qr(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function I9(t,e,n,r){let o=[],a=t.pill;o.push(`<rect width="${t.width}" height="${t.height}" rx="${Se/2}" fill="${Qr(n)}"/>`),o.push(`<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" rx="${a.height/2}" fill="${Qr(e.bg)}"/>`,`<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" rx="${a.height/2}" fill="none" stroke="${Qr(r)}" stroke-width="0.75"/>`),o.push(`<text x="${a.x+a.width/2}" y="${Se/2+sr/2-2}" font-size="${sr}" font-weight="500" fill="${Qr(e.text)}" text-anchor="middle" font-family="${Qr(It)}">${Qr(t.groupName)}</text>`);for(let i of t.entries){let s=i.displayValue??i.value,l=i.width!=null?`<rect x="${i.x}" y="${i.y}" width="${i.width}" height="${Se}" fill="transparent"/>`:"";o.push(`<g data-legend-entry="${Qr(i.value.toLowerCase())}" data-series-name="${Qr(i.value)}" style="cursor:pointer">`+l+`<circle cx="${i.dotCx}" cy="${i.dotCy}" r="${wr}" fill="${Qr(i.color)}"/><text x="${i.textX}" y="${i.dotCy+Vn/2-1}" font-size="${Vn}" fill="${Qr(e.textMuted)}" font-family="${Qr(It)}">${Qr(s)}</text></g>`)}return`<g transform="translate(${t.x},${t.y})" data-legend-group="${Qr(qt(t.groupName))}" style="cursor:pointer">${o.join("")}</g>`}function P9(t,e,n){return`<g transform="translate(${t.x},${t.y})" data-legend-group="${Qr(qt(t.groupName))}" style="cursor:pointer"><rect width="${t.width}" height="${t.height}" rx="${t.height/2}" fill="${Qr(n)}"/><text x="${t.width/2}" y="${t.height/2+sr/2-2}" font-size="${sr}" font-weight="500" fill="${Qr(e.textMuted)}" text-anchor="middle" font-family="${Qr(It)}">${Qr(t.groupName)}</text></g>`}function rR(t,e){if(t.length===0)return{svg:"",height:0,width:0};let{palette:n,isDark:r,containerWidth:o,activeGroup:a,className:i}=e,s=o>0?o:1200,d=Rl({groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},{activeGroup:a??null},s);if(!d.activeCapsule&&d.pills.length===0)return{svg:"",height:0,width:0};let u=r?Gt(n.surface,n.bg,50):Gt(n.surface,n.bg,30),f=Gt(n.textMuted,n.bg,50),p=[],m=0,h=1/0,g=0,E=(x,L,v,A)=>{h=Math.min(h,x),g=Math.max(g,x+v),m=Math.max(m,L+A)};if(d.activeCapsule){let x=d.activeCapsule;p.push(I9(x,n,u,f)),E(x.x,x.y,x.width,x.height)}for(let x of d.pills)p.push(P9(x,n,u)),E(x.x,x.y,x.width,x.height);let y=i?` class="${Qr(i)}"`:"",b=a?` data-legend-active="${Qr(a.toLowerCase())}"`:"";return{svg:`<g${y}${b}>${p.join("")}</g>`,height:m,width:g-(h===1/0?0:h)}}var oR=st(()=>{"use strict";Ke();Mr();To();tn();on()});function ln(t){return isFinite(t)?Math.abs(t)>=1e3?t.toLocaleString("en-US"):String(Math.round(t*100)/100):""}function Ih(t,e,n,r,o,a,i){return hf(t,dh(e,n),r,o,a,i)}function hf(t,e,n,r,o,a){let i=o?40:0;if(e.length===0)return o?i+12:24;let s=8+i,{svg:l,height:c}=rR(e,{palette:n,isDark:r,containerWidth:a,activeGroup:e[0].name,className:"chart-legend"}),d=t.node();return d&&l&&d.insertAdjacentHTML("beforeend",`<g transform="translate(0,${s})">${l}</g>`),s+c+14}function is(t,e){let r=t?22:0,o=e.length?Math.max(...e.map(a=>_t(a,So))):0;return Math.max(56,16+r+o+14)}function Zs(t,e,n,r,o){e&&t.append("text").attr("x",n).attr("y",r).attr("text-anchor","middle").attr("fill",o).attr("font-size",aR).attr("font-family",It).attr("font-weight",600).text(e)}function ss(t,e,n,r,o){e&&t.append("text").attr("transform",`translate(${r},${n}) rotate(-90)`).attr("text-anchor","middle").attr("fill",o).attr("font-size",aR).attr("font-family",It).attr("font-weight",600).text(e)}function Yr(t,e){let n=(t.attr("class")??"").split(/\s+/).filter(Boolean);return n.includes("dgmo-datum")||n.push("dgmo-datum"),t.attr("class",n.join(" ")),e.line!=null&&t.attr("data-line-number",e.line),e.key!=null&&t.attr("data-emph-key",e.key),e.name!=null&&t.attr("data-name",e.name),e.value!=null&&t.attr("data-value",String(e.value)),e.color!=null&&t.attr("data-color",e.color),t}function Wl(t,e,n,r,o,a="middle"){t.append("text").attr("x",n).attr("y",r).attr("text-anchor",a).attr("fill",o).attr("font-size",D9).attr("font-family",It).text(e)}var aR,So,D9,ra=st(()=>{"use strict";on();en();lf();oR();aR=13,So=12,D9=12});function iR(t,e){let n=[t.value];for(let r=1;r<e;r++)n.push(t.extraValues?.[r-1]??0);return n}function sR(t,e,n,r,o,a,i,s,l,c){let d=e.data,u=e.seriesNames?.length?e.seriesNames:[e.series??""],f=e.barLayout==="stack",p=e.barLayout==="group",m=f||p?Math.max(1,u.length,1+Math.max(0,...d.map(H=>H.extraValues?.length??0))):1,h=e.orientation==="horizontal",g=m>1,E=e.solidFill===!0,y=(H,O,D)=>D||(g?o[H%o.length]:o[O%o.length]),b=H=>E?H:ie(a,H,i),S=Ih(t,e,o,a,i,c,n),x=d.map(H=>iR(H,m)),L=f?Sc(x,H=>H.reduce((O,D)=>O+D,0))??0:Sc(x,H=>Sc(H)??0)??0,v=L===0?1:L,A=h?d.map(H=>H.label):[ln(v),ln(v/2)],C={top:S+8,right:32,bottom:64,left:is(e.ylabel,A)},M=n-C.left-C.right,w=r-C.top-C.bottom,k=h,N=k?[C.top,C.top+w]:[C.left,C.left+M],_=Sl().domain(d.map(H=>H.label)).range(N).padding(.3),T=k?[C.left,C.left+M]:[C.top+w,C.top],R=or().domain([0,v]).nice().range(T);for(let H of R.ticks(6))if(k){let O=R(H);t.append("line").attr("x1",O).attr("x2",O).attr("y1",C.top).attr("y2",C.top+w).attr("stroke",l).attr("stroke-opacity",H===0?.6:.25),t.append("text").attr("x",O).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",So).attr("font-family",It).text(ln(H))}else{let O=R(H);t.append("line").attr("x1",C.left).attr("x2",C.left+M).attr("y1",O).attr("y2",O).attr("stroke",l).attr("stroke-opacity",H===0?.6:.25),t.append("text").attr("x",C.left-10).attr("y",O+4).attr("text-anchor","end").attr("fill",s).attr("font-size",So).attr("font-family",It).text(ln(H))}for(let H of d){let O=(_(H.label)??0)+_.bandwidth()/2;k?t.append("text").attr("x",C.left-10).attr("y",O+4).attr("text-anchor","end").attr("fill",s).attr("font-size",So).attr("font-family",It).text(H.label):t.append("text").attr("x",O).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",So).attr("font-family",It).text(H.label)}let G=R(0),I=f?null:Sl().domain(u.map((H,O)=>O)).range([0,_.bandwidth()]).padding(.12);d.forEach((H,O)=>{let D=_(H.label)??0,W=iR(H,m),z=0;W.forEach((P,B)=>{let Y=y(B,O,m===1?H.color:void 0),V=b(Y),j=u[B]??"",K={line:H.lineNumber,key:g?j:H.label,name:g?`${H.label} \xB7 ${j}`:H.label,value:P,color:Y};if(f){if(k){let $=R(z),U=R(z+P);Ph(t,Math.min($,U),D,Math.abs(U-$),_.bandwidth(),V,Y,K),Math.abs(U-$)>26&&Wl(t,ln(P),($+U)/2,D+_.bandwidth()/2+4,s)}else{let $=R(z),U=R(z+P);Ph(t,D,Math.min($,U),_.bandwidth(),Math.abs(U-$),V,Y,K),Math.abs(U-$)>18&&Wl(t,ln(P),D+_.bandwidth()/2,($+U)/2+4,s)}z+=P}else{let $=I(B)??0,U=I.bandwidth();if(k){let X=R(P);Ph(t,Math.min(G,X),D+$,Math.abs(X-G),U,V,Y,K),Wl(t,ln(P),X+6,D+$+U/2+4,s,"start")}else{let X=R(P);Ph(t,D+$,Math.min(G,X),U,Math.abs(G-X),V,Y,K),Wl(t,ln(P),D+$+U/2,X-6,s)}}})}),Zs(t,e.xlabel,C.left+M/2,C.top+w+46,s),ss(t,e.ylabel,C.top+w/2,20,s)}function Ph(t,e,n,r,o,a,i,s){let l=t.append("rect").attr("x",e).attr("y",n).attr("width",r).attr("height",o).attr("fill",a).attr("stroke",i).attr("stroke-width",1.5);Yr(l,s)}var lR=st(()=>{"use strict";qa();No();on();tn();ra()});function cR(t,e){return e===0?t.value:t.extraValues?.[e-1]??0}function dR(t,e,n,r,o,a,i,s,l,c,d){let u=e.data,f=e.fill===!0,p=e.seriesNames?.length?e.seriesNames:[e.series??""],m=Math.max(1,p.length,1+Math.max(0,...u.map(I=>I.extraValues?.length??0))),h=I=>e.seriesNameColors?.[I]??o[I%o.length],g=I=>e.seriesAxes?.[I]??"left",E=(e.seriesAxes??[]).includes("right"),y=I=>{let H=[];for(let O=0;O<m;O++)g(O)===I&&H.push(O);return H.length===1?h(H[0]):void 0},b=Ih(t,e,o,a,i,d,n),S=I=>{let H=1/0,O=-1/0;for(let D of u)for(let W=0;W<m;W++)if(g(W)===I){let z=cR(D,W);H=Math.min(H,z),O=Math.max(O,z)}return isFinite(H)?(H>0&&(H=0),H===O&&(O=H+1),[H,O]):[0,1]},[x,L]=S("left"),[v,A]=E?S("right"):[0,1],C={top:b+8,right:E?is(e.yrlabel,[ln(A),ln(v)]):32,bottom:64,left:is(e.ylabel,[ln(L),ln(x)])},M=n-C.left-C.right,w=r-C.top-C.bottom,k=Ts().domain(u.map(I=>I.label)).range([C.left,C.left+M]).padding(.5),N=or().domain([x,L]).nice().range([C.top+w,C.top]),_=E?or().domain([v,A]).nice().range([C.top+w,C.top]):null,T=I=>E&&g(I)==="right"&&_?_:N,R=E?y("left"):void 0,G=y("right");e.eras?.length&&e.eras.forEach((I,H)=>{let O=k(I.start),D=k(I.end);if(O==null||D==null)return;let W=I.color??o[H%o.length];t.append("rect").attr("x",Math.min(O,D)).attr("y",C.top).attr("width",Math.abs(D-O)).attr("height",w).attr("fill",Gt(W,c,12)),t.append("text").attr("x",(O+D)/2).attr("y",C.top+14).attr("text-anchor","middle").attr("fill",s).attr("font-size",So).attr("font-family",It).attr("opacity",.8).text(I.label)});for(let I of N.ticks(6)){let H=N(I);t.append("line").attr("x1",C.left).attr("x2",C.left+M).attr("y1",H).attr("y2",H).attr("stroke",l).attr("stroke-opacity",I===0?.6:.25),t.append("text").attr("class","dgmo-tick").attr("x",C.left-10).attr("y",H+4).attr("text-anchor","end").attr("fill",R??s).attr("font-size",So).attr("font-family",It).text(ln(I))}if(E&&_)for(let I of _.ticks(6))t.append("text").attr("class","dgmo-tick").attr("x",C.left+M+10).attr("y",_(I)+4).attr("text-anchor","start").attr("fill",G??s).attr("font-size",So).attr("font-family",It).text(ln(I));for(let I of u)t.append("text").attr("class","dgmo-tick").attr("x",k(I.label)??0).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",So).attr("font-family",It).text(I.label);t.append("rect").attr("class","dgmo-plot-rect").attr("x",C.left).attr("y",C.top).attr("width",M).attr("height",w).attr("fill","transparent");for(let I=0;I<m;I++){let H=h(I),O=T(I),D=p[I]??`Series ${I+1}`,W=u.map((V,j)=>({label:V.label,v:cR(V,I),xIndex:j,lineNumber:V.lineNumber})),z=t.append("g").attr("class","dgmo-series").attr("data-series-index",I).attr("data-series-name",D).attr("data-axis",g(I)).attr("data-color",H),P=e.seriesNameLineNumbers?.[I];if(P!==void 0&&z.attr("data-line-number",P),f){let V=Bu().x(j=>k(j.label)??0).y0(O(Math.max(O.domain()[0],0))).y1(j=>O(j.v));z.append("path").attr("class","dgmo-series-area").attr("d",V(W)??"").attr("fill",ie(a,H,i)).attr("stroke","none")}let B=Kn().x(V=>k(V.label)??0).y(V=>O(V.v));z.append("path").attr("class","dgmo-series-line").attr("d",B(W)??"").attr("fill","none").attr("stroke",H).attr("stroke-width",2.5).attr("stroke-linejoin","round").attr("stroke-linecap","round");let Y=Gt(H,s,60);for(let V of W)z.append("circle").attr("class","dgmo-pt").attr("data-series-index",I).attr("data-series-name",D).attr("data-color",H).attr("data-x-index",V.xIndex).attr("data-x-label",V.label).attr("data-value",V.v).attr("data-line-number",V.lineNumber).attr("cx",k(V.label)??0).attr("cy",O(V.v)).attr("r",3.5).attr("fill",c).attr("stroke",H).attr("stroke-width",2),e.noValue||Wl(t,ln(V.v),k(V.label)??0,O(V.v)-10,Y)}Zs(t,e.xlabel,C.left+M/2,C.top+w+46,s),ss(t,e.ylabel,C.top+w/2,20,R??s),E&&(ss(t,e.yrlabel,C.top+w/2,n-18,G??s),t.append("rect").attr("class","dgmo-axis-legend").attr("data-axis-legend","left").attr("x",0).attr("y",C.top).attr("width",C.left).attr("height",w).attr("fill","transparent").attr("style","cursor:pointer"),t.append("rect").attr("class","dgmo-axis-legend").attr("data-axis-legend","right").attr("x",C.left+M).attr("y",C.top).attr("width",C.right).attr("height",w).attr("fill","transparent").attr("style","cursor:pointer"))}var uR=st(()=>{"use strict";qa();Eo();on();tn();ra()});function fR(t,e,n,r,o,a,i,s){let l=e.data.filter(L=>L.value>0);if(l.length===0)return;let c=e.hole,d=c!==void 0,u=e.solidFill===!0,f=l.reduce((L,v)=>L+v.value,0),p=n/2,m=s+12,h=m+(r-m)/2,g=Math.min(n/2-220,(r-m)/2-40),E=xc(o,l.length),y=(L,v)=>v??E[L%E.length],b=a0().sort(null).value(L=>L.value)(l.map(L=>({value:L.value}))),S=_l().innerRadius(d?g*c:0).outerRadius(g),x=t.append("g").attr("transform",`translate(${p},${h})`);b.forEach((L,v)=>{let A=y(v,l[v].color),C=u?A:ie(o,A,a),M=Math.round(l[v].value/f*100),w=x.append("path").attr("d",S(L)??"").attr("fill",C).attr("stroke",A).attr("stroke-width",1.5);Yr(w,{line:l[v].lineNumber,key:l[v].label,name:l[v].label,value:`${ln(l[v].value)} (${M}%)`,color:A});let k=(L.startAngle+L.endAngle)/2-Math.PI/2,N=Math.cos(k)>=0,_=Math.cos(k)*g,T=Math.sin(k)*g,R=Math.cos(k)*(g+16),G=Math.sin(k)*(g+16),I=R+(N?28:-28),H=e.noName?"":l[v].label,O=[e.noValue?"":ln(l[v].value),e.noPercent?"":`(${M}%)`].filter(Boolean).join(" "),D=[H,O].filter(Boolean).join(" \u2014 ");D&&(x.append("polyline").attr("points",`${_},${T} ${R},${G} ${I},${G}`).attr("fill","none").attr("stroke",A).attr("stroke-width",1),x.append("text").attr("x",I+(N?4:-4)).attr("y",G+4).attr("text-anchor",N?"start":"end").attr("fill",i).attr("font-size",O9).attr("font-family",It).text(D))}),d&&!e.noCenterTotal&&x.append("text").attr("text-anchor","middle").attr("y",8).attr("fill",i).attr("font-size",26).attr("font-weight",700).attr("font-family",It).text(ln(f))}var O9,pR=st(()=>{"use strict";Eo();tn();on();ra();O9=14});function oE(t,e){return e===0?t.value:t.extraValues?.[e-1]??0}function hR(t,e,n,r,o,a,i,s,l,c){let d=e.data,u=d.length;if(u<3)return;let f=e.solidFill===!0,p=e.seriesNames?.length?e.seriesNames:[e.series??""],m=Math.max(1,p.length,1+Math.max(0,...d.map(C=>C.extraValues?.length??0))),h=m>1,g=C=>h?e.seriesNameColors?.[C]??o[C%o.length]:e.color??e.seriesNameColors?.[0]??a.primary,E=[];for(let C of d)for(let M=0;M<m;M++)E.push(oE(C,M));let y=Math.max(...E)*1.15||1,b=n/2,S=c+8,x=S+(r-S)/2,L=Math.min(n/2-130,(r-S)/2-50),v=C=>-Math.PI/2+C*2*Math.PI/u,A=(C,M)=>[b+Math.cos(v(C))*M,x+Math.sin(v(C))*M];for(let C=1;C<=mR;C++){let M=L*C/mR,w=d.map((k,N)=>A(N,M).join(",")).join(" ");t.append("polygon").attr("points",w).attr("fill","none").attr("stroke",l).attr("stroke-opacity",.4)}d.forEach((C,M)=>{let[w,k]=A(M,L);t.append("line").attr("x1",b).attr("y1",x).attr("x2",w).attr("y2",k).attr("stroke",l).attr("stroke-opacity",.4);let[N,_]=A(M,L+18),T=Math.cos(v(M));t.append("text").attr("x",N).attr("y",_+4).attr("text-anchor",Math.abs(T)<.3?"middle":T>0?"start":"end").attr("fill",s).attr("font-size",14).attr("font-family",It).text(d[M].label)});for(let C=0;C<m;C++){let M=g(C),w=p[C]??`Series ${C+1}`,k=t.append("g").attr("class","dgmo-series").attr("data-series-index",C).attr("data-series-name",w).attr("data-color",M),N=e.seriesNameLineNumbers?.[C];N!==void 0&&k.attr("data-line-number",N);let _=d.map((T,R)=>A(R,oE(T,C)/y*L).join(",")).join(" ");k.append("polygon").attr("points",_).attr("fill",f||h?M:ie(a,M,i)).attr("fill-opacity",f?.6:h?.2:1).attr("stroke",M).attr("stroke-width",2),d.forEach((T,R)=>{let G=oE(T,C),[I,H]=A(R,G/y*L),O=k.append("circle").attr("cx",I).attr("cy",H).attr("r",4).attr("fill",M);Yr(O,{line:T.lineNumber,key:h?`${w}\0${T.label}`:T.label,name:h?`${w} \u2014 ${T.label}`:T.label,value:ln(G),color:M}),e.noValue||k.append("text").attr("x",I).attr("y",H-8).attr("text-anchor","middle").attr("fill",s).attr("font-size",12).attr("font-family",It).text(ln(G))})}}var mR,gR=st(()=>{"use strict";on();tn();ra();mR=5});function yR(t,e,n,r,o,a,i,s){let l=e.data.filter(x=>x.value>0),c=l.length;if(c===0)return;let d=e.solidFill===!0,u=l.reduce((x,L)=>x+L.value,0),f=Math.max(...l.map(x=>x.value))||1,p=n/2,m=s+8,h=m+(r-m)/2,g=Math.min(n/2-200,(r-m)/2-40),E=g*.14,y=xc(o,c),b=t.append("g").attr("transform",`translate(${p},${h})`),S=2*Math.PI/c;l.forEach((x,L)=>{let v=x.color??y[L%y.length],A=E+x.value/f*(g-E),C=L*S,M=C+S,w=_l().innerRadius(E).outerRadius(A).startAngle(C).endAngle(M),k=Math.round(x.value/u*100),N=b.append("path").attr("d",w({})??"").attr("fill",d?v:ie(o,v,a)).attr("stroke",v).attr("stroke-width",2);Yr(N,{line:x.lineNumber,key:x.label,name:x.label,value:`${ln(x.value)} (${k}%)`,color:v});let _=C+S/2-Math.PI/2,T=Math.cos(_)>=0,R=Math.cos(_)*(g+14),G=Math.sin(_)*(g+14),I=e.noName?"":x.label,H=[e.noValue?"":ln(x.value),e.noPercent?"":`(${k}%)`].filter(Boolean).join(" "),O=[I,H].filter(Boolean).join(" \u2014 ");O&&b.append("text").attr("x",R+(T?4:-4)).attr("y",G+4).attr("text-anchor",T?"start":"end").attr("fill",i).attr("font-size",13).attr("font-family",It).text(O)})}var bR=st(()=>{"use strict";Eo();on();tn();ra()});function xR(t,e,n,r,o,a,i,s,l){let c=[...e.data].sort((L,v)=>v.value-L.value),d=c.length;if(d===0)return;let u=e.solidFill===!0,f=n*.2,p=n*.6,m=n/2,h=l+8,y=(r-30-h)/d,b=c[0].value||1,S=p*.08,x=L=>Math.max(S,L/b*p);c.forEach((L,v)=>{let A=L.color??o[e.data.indexOf(L)%o.length],C=u?A:ie(a,A,i),M=x(L.value),w=v<d-1?x(c[v+1].value):S,k=h+v*y,N=k+y,_=t.append("polygon").attr("points",`${m-M/2},${k} ${m+M/2},${k} ${m+w/2},${N} ${m-w/2},${N}`).attr("fill",C).attr("stroke",A).attr("stroke-width",2);Yr(_,{line:L.lineNumber,key:L.label,name:L.label,value:ln(L.value),color:A});let T=(k+N)/2;e.noName||(t.append("line").attr("x1",f-8).attr("y1",T).attr("x2",m-M/2).attr("y2",T).attr("stroke",s).attr("stroke-opacity",.3),t.append("text").attr("x",f-12).attr("y",T+4).attr("text-anchor","end").attr("fill",s).attr("font-size",13).attr("font-family",It).text(L.label)),e.noValue||(t.append("line").attr("x1",m+M/2).attr("y1",T).attr("x2",f+p+8).attr("y2",T).attr("stroke",s).attr("stroke-opacity",.3),t.append("text").attr("x",f+p+12).attr("y",T+4).attr("text-anchor","start").attr("fill",s).attr("font-size",13).attr("font-family",It).text(ln(L.value)))})}var wR=st(()=>{"use strict";on();tn();ra()});function ER(t,e,n,r,o,a,i,s,l){let c=e.heatmapRows??[];if(c.length===0)return;let d=Math.max(e.columns?.length??0,...c.map(_=>_.values.length)),u=c.length,f=e.columns??[],p=1/0,m=-1/0;for(let _ of c)for(let T of _.values)p=Math.min(p,T),m=Math.max(m,T);let h=e.solidFill===!0,g=[ie(o,o.primary,a,{solid:h}),ie(o,o.colors.cyan,a,{solid:h}),ie(o,o.colors.yellow,a,{solid:h}),ie(o,o.colors.orange,a,{solid:h})],E=_=>{let T=Math.max(0,Math.min(1,_)),R=1/(g.length-1),G=Math.min(g.length-2,Math.floor(T/R)),I=(T-G*R)/R;return Gt(g[G+1],g[G],I*100)},y=_=>{let{h:T,s:R}=Su(_),G=Math.min(75,Math.max(R+25,50));return tm(T,G,a?72:30)},S=20+(Math.max(0,...c.map(_=>_t(_.label,13)))+16),x=l+28,L=24,v=24,A=n-S-L,C=r-x-v,M=A/d,w=C/u,k=Math.max(11,Math.min(18,Math.min(M,w)*.28)),N=f.some(_=>_t(_,12)>M*.85);f.forEach((_,T)=>{let R=S+T*M+M/2,G=t.append("text").attr("fill",i).attr("font-size",12).attr("font-family",It).text(_);N?G.attr("transform",`translate(${R},${x-8}) rotate(-40)`).attr("text-anchor","start"):G.attr("x",R).attr("y",x-8).attr("text-anchor","middle")}),c.forEach((_,T)=>{t.append("text").attr("x",S-10).attr("y",x+T*w+w/2+4).attr("text-anchor","end").attr("fill",i).attr("font-size",13).attr("font-family",It).text(_.label),_.values.forEach((R,G)=>{let I=m===p?.5:(R-p)/(m-p),H=E(I),O=f[G]??`Col ${G+1}`,D=t.append("rect").attr("x",S+G*M).attr("y",x+T*w).attr("width",M).attr("height",w).attr("fill",H).attr("stroke",s).attr("stroke-width",2);Yr(D,{line:_.lineNumber,key:_.label,name:`${_.label} \xB7 ${O}`,value:ln(R),color:H}),e.noValue||t.append("text").attr("x",S+G*M+M/2).attr("y",x+T*w+w/2+k/3).attr("text-anchor","middle").attr("fill",y(H)).attr("font-size",k).attr("font-weight",600).attr("font-family",It).text(ln(R))})})}var SR=st(()=>{"use strict";on();tn();en();ra()});function kR(t,e,n,r,o,a,i,s,l,c){let d=e.scatterPoints??[];if(d.length===0)return;let u=e.solidFill===!0,f=d.some(N=>N.size!==void 0),p=[...new Set(d.map(N=>N.category).filter(Boolean))],m=(N,_)=>e.categoryColors?.[N]??o[_%o.length],h=new Map(p.map((N,_)=>[N,_])),g=d.map(N=>N.x),E=d.map(N=>N.y),y=Math.min(...g),b=Math.max(...g),S=Math.min(...E),x=Math.max(...E),L=(b-y)*.1||1,v=(x-S)*.1||1,A={top:c+8,right:32,bottom:64,left:is(e.ylabel,[ln(Math.ceil(x+v)),ln(Math.floor(S-v))])},C=n-A.left-A.right,M=r-A.top-A.bottom,w=or().domain([Math.floor(y-L),Math.ceil(b+L)]).range([A.left,A.left+C]),k=or().domain([Math.floor(S-v),Math.ceil(x+v)]).range([A.top+M,A.top]);t.append("rect").attr("class","dgmo-plot-rect").attr("x",A.left).attr("y",A.top).attr("width",C).attr("height",M).attr("fill","transparent").attr("pointer-events","none");for(let N of k.ticks(6)){let _=k(N);t.append("line").attr("x1",A.left).attr("x2",A.left+C).attr("y1",_).attr("y2",_).attr("stroke",l).attr("stroke-opacity",.25),t.append("text").attr("class","dgmo-tick").attr("x",A.left-10).attr("y",_+4).attr("text-anchor","end").attr("fill",s).attr("font-size",So).attr("font-family",It).text(ln(N))}for(let N of w.ticks(6)){let _=w(N);t.append("line").attr("x1",_).attr("x2",_).attr("y1",A.top).attr("y2",A.top+M).attr("stroke",l).attr("stroke-opacity",.25),t.append("text").attr("class","dgmo-tick").attr("x",_).attr("y",A.top+M+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",So).attr("font-family",It).text(ln(N))}d.forEach((N,_)=>{let T=N.color??(N.category?m(N.category,h.get(N.category)??0):o[_%o.length]),R=(f?N.size??vR:vR)/2,G=t.append("circle").attr("cx",w(N.x)).attr("cy",k(N.y)).attr("r",R).attr("fill",u?T:ie(a,T,i)).attr("fill-opacity",G9).attr("stroke",T).attr("stroke-width",2);Yr(G,{line:N.lineNumber,key:N.name,name:N.category?`${N.name} \xB7 ${N.category}`:N.name,value:`(${ln(N.x)}, ${ln(N.y)})`,color:T}),G.attr("data-axval-x",ln(N.x)).attr("data-axval-y",ln(N.y)),N.category&&G.attr("data-category",N.category),e.noName||t.append("text").attr("x",w(N.x)).attr("y",k(N.y)-R-5).attr("text-anchor","middle").attr("fill",s).attr("font-size",11).attr("font-family",It).text(N.name)}),Zs(t,e.xlabel,A.left+C/2,A.top+M+46,s),ss(t,e.ylabel,A.top+M/2,20,s)}var G9,vR,LR=st(()=>{"use strict";qa();on();tn();ra();G9=.65,vR=15});function NR(t,e,n,r,o,a,i,s){let l=e.links??[];if(l.length===0)return;let c=e.solidFill===!0,d=Array.from(new Set(l.flatMap(C=>[C.source,C.target]))),u=new Map;d.forEach((C,M)=>u.set(C,{name:C,rank:0,value:0,order:M,x:0,y:0,h:0,raw:e.nodeColors?.[C]??o[M%o.length]}));for(let C=0;C<d.length;C++){let M=!1;for(let w of l){let k=u.get(w.source),N=u.get(w.target);N.rank<k.rank+1&&(N.rank=k.rank+1,M=!0)}if(!M)break}for(let C of u.values()){let M=l.filter(k=>k.source===C.name).reduce((k,N)=>k+N.value,0),w=l.filter(k=>k.target===C.name).reduce((k,N)=>k+N.value,0);C.value=Math.max(M,w,1)}let f=Math.max(...[...u.values()].map(C=>C.rank)),p=Array.from({length:f+1},()=>[]);for(let C of u.values())p[C.rank].push(C);let m=16,h=s+8,g=n-m-16-_t("M",14),E=r-h-24,y=1/0;for(let C of p){let M=C.reduce((k,N)=>k+N.value,0),w=E-(C.length-1)*aE;M>0&&(y=Math.min(y,w/M))}isFinite(y)||(y=1);let b=C=>m+(f===0?0:C*(g-Dh)/f),S=C=>{C.sort((k,N)=>k.order-N.order);let M=C.reduce((k,N)=>k+N.value*y,0)+(C.length-1)*aE,w=h+(E-M)/2;for(let k of C)k.h=k.value*y,k.x=b(k.rank),k.y=w,w+=k.h+aE};p.forEach(S);let x=C=>C.y+C.h/2;for(let C=0;C<6;C++){let M=C%2===0,w=M?[...p.keys()]:[...p.keys()].reverse();for(let k of w){for(let N of p[k]){let _=M?l.filter(T=>T.target===N.name).map(T=>u.get(T.source)):l.filter(T=>T.source===N.name).map(T=>u.get(T.target));N.order=_.length?_.reduce((T,R)=>T+x(R),0)/_.length:x(N)}S(p[k])}}let L=new Map,v=new Map;for(let C of u.values())L.set(C.name,C.y),v.set(C.name,C.y);let A=[...l].sort((C,M)=>{let w=u.get(C.source),k=u.get(M.source);return w.y!==k.y?w.y-k.y:u.get(C.target).y-u.get(M.target).y});for(let C of A){let M=u.get(C.source),w=u.get(C.target),k=C.value*y,N=L.get(M.name),_=v.get(w.name);L.set(M.name,N+k),v.set(w.name,_+k);let T=M.x+Dh,R=w.x,G=T+(R-T)*.5,I=C.color??M.raw,H=c?I:Gt(I,a,45),O=t.append("path").attr("d",`M${T},${N} C${G},${N} ${G},${_} ${R},${_} L${R},${_+k} C${G},${_+k} ${G},${N+k} ${T},${N+k} Z`).attr("fill",H).attr("fill-opacity",.6);Yr(O,{line:C.lineNumber,key:`link:${M.name}\0${w.name}`,name:`${M.name} \u2192 ${w.name}`,value:String(C.value),color:M.raw})}for(let C of u.values()){let M=l.find(N=>N.source===C.name||N.target===C.name)?.lineNumber,w=t.append("rect").attr("x",C.x).attr("y",C.y).attr("width",Dh).attr("height",Math.max(1,C.h)).attr("fill",c?C.raw:Gt(C.raw,a,75)).attr("stroke",C.raw).attr("stroke-width",1);Yr(w,{...M!==void 0&&{line:M},key:`node:${C.name}`,name:C.name,value:String(C.value),color:C.raw});let k=C.rank===f;t.append("text").attr("x",k?C.x-6:C.x+Dh+6).attr("y",C.y+C.h/2+4).attr("text-anchor",k?"end":"start").attr("fill",i).attr("font-size",13).attr("font-family",It).text(C.name)}}var Dh,aE,MR=st(()=>{"use strict";on();tn();en();ra();Dh=20,aE=14});function TR(t,e,n,r,o,a,i,s,l){let c=e.links??[];if(c.length===0)return;let d=e.solidFill===!0,u=Array.from(new Set(c.flatMap(v=>[v.source,v.target]))),f=u.length,p=new Map(u.map((v,A)=>[v,A])),m=v=>o[v%o.length],h=l+8,g=n/2,E=h+(r-h)/2,y=Math.max(0,...u.map(v=>_t(v,14))),b=Math.min(n/2-y-60,(r-h)/2-50),S=v=>-Math.PI/2+v*2*Math.PI/f,x=v=>[g+Math.cos(S(v))*b,E+Math.sin(S(v))*b],L=new Set;for(let v of c)c.some(A=>A.source===v.target&&A.target===v.source&&A!==v)&&L.add(`${v.source}\0${v.target}`);for(let v of c){let A=p.get(v.source),C=p.get(v.target),[M,w]=x(A),[k,N]=x(C),_=L.has(`${v.source}\0${v.target}`),T=.3,R=_?v.source<v.target?T+.15:T-.15:T,G=(M+k)/2,I=(w+N)/2,H=G+(g-G)*R*2,O=I+(E-I)*R*2,D=Math.max(1,Math.min(v.value/20,10)),W=m(A),z=t.append("path").attr("d",`M${M},${w} Q${H},${O} ${k},${N}`).attr("fill","none").attr("stroke",W).attr("stroke-width",D).attr("stroke-opacity",.6);if(Yr(z,{line:v.lineNumber,key:`edge:${v.source} ${v.target}`,name:`${v.source} \u2192 ${v.target}`,value:String(v.value),color:W}),v.directed){let P=Math.atan2(N-O,k-H),B=11,Y=k-Math.cos(P)*10,V=N-Math.sin(P)*10,j=P+Math.PI-.4,K=P+Math.PI+.4;t.append("polygon").attr("points",`${Y},${V} ${Y+Math.cos(j)*B},${V+Math.sin(j)*B} ${Y+Math.cos(K)*B},${V+Math.sin(K)*B}`).attr("fill",W).attr("fill-opacity",.7)}}u.forEach((v,A)=>{let[C,M]=x(A),w=m(A),k=t.append("circle").attr("cx",C).attr("cy",M).attr("r",10).attr("fill",d?w:ie(a,w,i)).attr("stroke",w).attr("stroke-width",2);Yr(k,{key:`node:${v}`,name:v,color:w});let N=Math.cos(S(A)),_=C+N*16,T=M+Math.sin(S(A))*16;t.append("text").attr("x",_).attr("y",T+4).attr("text-anchor",Math.abs(N)<.3?"middle":N>0?"start":"end").attr("fill",s).attr("font-size",14).attr("font-family",It).text(v)})}var CR=st(()=>{"use strict";on();tn();en();ra()});function _R(t,e){try{let n=t.replace(/\bpi\b/gi,String(Math.PI)).replace(/\be\b/g,String(Math.E)).replace(/\bsin\s*\(/gi,"Math.sin(").replace(/\bcos\s*\(/gi,"Math.cos(").replace(/\btan\s*\(/gi,"Math.tan(").replace(/\bln\s*\(/gi,"Math.log(").replace(/\blog\s*\(/gi,"Math.log10(").replace(/\bexp\s*\(/gi,"Math.exp(").replace(/\bsqrt\s*\(/gi,"Math.sqrt(").replace(/\babs\s*\(/gi,"Math.abs(").replace(/\bx\b/gi,`(${e})`).replace(/\^/g,"**"),r=new Function(`return ${n}`)();return typeof r=="number"&&isFinite(r)?r:NaN}catch{return NaN}}var AR=st(()=>{"use strict"});function IR(t,e,n,r,o,a,i,s){let l=e.functions??[];if(l.length===0)return;let c=e.xRange??{min:-10,max:10},d=(c.max-c.min)/RR,u=[];for(let x=0;x<=RR;x++)u.push(c.min+x*d);let f=l.map((x,L)=>({color:x.color??o[L%o.length],name:x.name,line:x.lineNumber,pts:u.map(v=>[v,_R(x.expression,v)])})),p=1/0,m=-1/0;for(let x of f)for(let[,L]of x.pts)isFinite(L)&&(p=Math.min(p,L),m=Math.max(m,L));isFinite(p)||(p=-1,m=1),p===m&&(m=p+1);let h={top:s+8,right:32,bottom:64,left:is(e.ylabel,[ln(m),ln(p)])},g=n-h.left-h.right,E=r-h.top-h.bottom,y=or().domain([c.min,c.max]).range([h.left,h.left+g]),b=or().domain([p,m]).nice().range([h.top+E,h.top]);for(let x of b.ticks(8)){let L=b(x);t.append("line").attr("x1",h.left).attr("x2",h.left+g).attr("y1",L).attr("y2",L).attr("stroke",i).attr("stroke-opacity",x===0?.6:.2),t.append("text").attr("class","dgmo-tick").attr("x",h.left-10).attr("y",L+4).attr("text-anchor","end").attr("fill",a).attr("font-size",So).attr("font-family",It).text(ln(x))}for(let x of y.ticks(10)){let L=y(x);t.append("line").attr("x1",L).attr("x2",L).attr("y1",h.top).attr("y2",h.top+E).attr("stroke",i).attr("stroke-opacity",x===0?.6:.2),t.append("text").attr("class","dgmo-tick").attr("x",L).attr("y",h.top+E+18).attr("text-anchor","middle").attr("fill",a).attr("font-size",So).attr("font-family",It).text(ln(x))}let S=Kn().defined(x=>isFinite(x[1])&&x[1]>=p-1&&x[1]<=m+1).x(x=>y(x[0])).y(x=>b(x[1]));for(let x of f){let L=t.append("path").attr("d",S(x.pts)??"").attr("fill","none").attr("stroke",x.color).attr("stroke-width",2.5).attr("stroke-linejoin","round");Yr(L,{line:x.line,key:x.name,name:x.name,color:x.color})}Zs(t,e.xlabel,h.left+g/2,h.top+E+46,a),ss(t,e.ylabel,h.top+E/2,20,a)}var RR,PR=st(()=>{"use strict";qa();Eo();on();AR();ra();RR=200});var GR={};ye(GR,{D3_DATA_CHART_TYPES:()=>OR,renderDataChartD3:()=>sE,supportsD3DataChart:()=>$9});function $9(t){return OR.has(t)}function H9(t){for(let e of t.split(`
211
- `)){let n=e.trim();if(!(!n||n.startsWith("//")))return n.split(/\s+/)[0].toLowerCase()}return""}async function sE(t,e,n,r){let o=await Yn(e,n),a=e==="dark",i=r?.width&&r.width>0?Math.round(r.width):ur,s=r?.height&&r.height>0?Math.round(r.height):yr,l=rr(i,s),c=Xa(l,o,{width:i,height:s});if(!c)return document.body.removeChild(l),"";let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:h,colors:g}=c;return W9(d,t,o,a,u,f,p,m,h,g)?zn(l,e,o):(document.body.removeChild(l),"")}function W9(t,e,n,r,o,a,i,s,l,c){let d=H9(e),f=iE.has(d)?null:zs(e,n);if(f&&!f.error&&f.data.length>0&&DR.has(f.type)){let g=!f.noTitle&&!!f.title;switch(g&&co(t,f.title,f.titleLineNumber,o,i),f.type){case"bar":return sR(t,f,o,a,c,n,r,i,s,g),!0;case"line":return dR(t,f,o,a,c,n,r,i,s,l,g),!0;case"pie":return fR(t,f,o,a,n,r,i,g?52:24),!0;case"radar":{let E=dh(f,c),y=hf(t,E,n,r,g,o);return hR(t,f,o,a,c,n,r,i,s,y),!0}case"polar-area":return yR(t,f,o,a,n,r,i,g?52:24),!0}}let p=Vs(e,n);if(p.error||!iE.has(p.type))return!1;let m=ir(n),h=!p.noTitle&&!!p.title;switch(h&&co(t,p.title,p.titleLineNumber,o,i),p.type){case"funnel":return xR(t,p,o,a,m,n,r,i,h?52:24),!0;case"heatmap":return ER(t,p,o,a,n,r,i,l,h?52:24),!0;case"scatter":{let g=fw(p,m),E=hf(t,g,n,r,h,o);return kR(t,p,o,a,m,n,r,i,s,E),!0}case"sankey":return NR(t,p,o,a,m,l,i,h?52:24),!0;case"chord":return TR(t,p,o,a,m,n,r,i,h?52:24),!0;case"function":{let g=fw(p,m),E=hf(t,g,n,r,h,o);return IR(t,p,o,a,m,i,s,E),!0}default:return!1}}var DR,iE,OR,lE=st(()=>{"use strict";lh();lf();lf();tn();Zi();ra();lR();uR();pR();gR();bR();wR();SR();LR();MR();CR();PR();DR=new Set(["bar","line","pie","radar","polar-area"]),iE=new Set(["funnel","heatmap","scatter","sankey","chord","function"]),OR=new Set([...DR,...iE])});function od(t,e){let n=t.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("rx",e.rx).attr("fill",e.fill).attr("stroke",e.stroke).attr("stroke-width",e.strokeWidth);e.dashed&&n.attr("stroke-dasharray","6 3"),t.append("text").attr("x",e.width/2).attr("y",e.headerHeight/2+e.labelFontSize/2-2).attr("text-anchor","middle").attr("fill",e.labelColor).attr("font-size",e.labelFontSize).attr("font-weight","bold").text(e.label);let r=e.meta;if(!r||r.rows.length===0)return;t.append("line").attr("x1",0).attr("y1",e.headerHeight).attr("x2",e.width).attr("y2",e.headerHeight).attr("stroke",r.separatorColor).attr("stroke-opacity",.3).attr("stroke-width",1);let o=r.keyX??10,a=Math.max(...r.rows.map(([l])=>_t(`${l}: `,r.fontSize))),i=o+a,s=e.headerHeight+r.separatorGap+r.fontSize;for(let l=0;l<r.rows.length;l++){let[c,d]=r.rows[l],u=s+l*r.lineHeight;t.append("text").attr("x",o).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(`${c}: `),t.append("text").attr("x",i).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(d)}}function cE(t,e){t.append("clipPath").attr("id",e.clipId).append("rect").attr("width",e.width).attr("height",e.height).attr("rx",e.rx),t.append("rect").attr("x",e.inset).attr("y",e.height-e.barHeight).attr("width",e.width-e.inset*2).attr("height",e.barHeight).attr("fill",e.fill).attr("clip-path",`url(#${e.clipId})`).attr("class",e.className)}var Oh=st(()=>{"use strict";en()});var KR={};ye(KR,{clearEventLineMuted:()=>ej,focusEventLine:()=>qR,renderEventLine:()=>yE,renderEventLineForExport:()=>cj});function yE(t,e,n,r,o,a,i){if(e.events.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let s=a?.width??t.clientWidth,l=a?.height??t.clientHeight;if(s<=0||l<=0)return;let c=!!a,d=c?new Set:bE(t),f=ir(n)[0],p=Hr(e.tagGroups,void 0,i),m=!!e.title&&!e.options.noTitle,h=e.tagGroups.length>0&&p!==null&&!e.options.noLegend,g=m?B9:0,y=g+(h?F9:0),b=new Map(e.eras.map(rt=>[rt.name,rt])),S=new Set(e.eras.filter(rt=>rt.collapsed).map(rt=>rt.name)),x=e.events.some(rt=>rt.era&&b.has(rt.era)),L=e.events.some(rt=>rt.era&&b.has(rt.era)&&!S.has(rt.era)),v=e.options.side,A=v==="alternate",C=A||v==="above"?"below":"above",M=[],w=new Set;for(let rt of e.events){let pt=rt.era;pt&&S.has(pt)?w.has(pt)||(w.add(pt),M.push({kind:"era",era:b.get(pt),members:e.events.filter(ht=>ht.era===pt)})):M.push({kind:"event",event:rt})}let k=Math.max(8,Math.floor((oo-Bl*2)/(Fl*Bo))),N=(rt,pt)=>28+(pt?$R:0)+(rt.length>0?6+rt.length*XR:0)+(rt.length>0?Bl:6),_=rt=>{if(!p)return f;let pt=ar(rt.metadata,e.tagGroups,p);return pt&&pt!==j9?Dn(pt,n)??pt:f},T=0,R=M.map(rt=>{let pt=A?T++%2===0?"above":"below":v;if(rt.kind==="event"){let $t=rt.event,ft=_($t),Wt=ie(n,ft,r,{solid:!1}),he=ve(Wt,n.textOnFillLight,n.textOnFillDark),ne=VR($t.description,k);return{kind:"event",event:$t,era:null,members:[],label:$t.label,date:$t.date,dateValue:$t.dateValue,future:$t.future,futureSpan:$t.futureSpan,lineNumber:$t.lineNumber,eraName:$t.era,color:ft,cardFill:Wt,titleColor:he,lines:ne,bulletColors:[],bulletMeta:[],cardH:N(ne,!!$t.date),x:0,side:pt,lane:0,left:0,spanHalf:0}}let ht=rt.era,dt=rt.members.map(_),ut=p!=null&&dt.length>0&&dt.every($t=>$t===dt[0])&&dt[0]!==f,yt=ht.color?Dn(ht.color,n)??n.text:ut?dt[0]:n.text,kt=Gt(yt,nr(n,r),10),Ot=ve(kt,n.textOnFillLight,n.textOnFillDark),Xt=null,bt=null;for(let $t of rt.members)$t.dateValue!==null&&((Xt===null||$t.dateValue<Xt)&&(Xt=$t.dateValue),(bt===null||$t.dateValue>bt)&&(bt=$t.dateValue));let Nt=Xt!==null&&bt!==null?(Xt+bt)/2:null,Vt=rt.members.filter($t=>!rj($t.metadata,d)),xt=Vt.map($t=>`\u2022 ${$t.date?`${$t.future?"TBD":ts($t.date)} `:""}${$t.label}`),Lt=Vt.map(_),Dt=Vt.map($t=>$t.metadata),zt=VR(xt,k);return{kind:"era",event:null,era:ht,members:rt.members,label:ht.name,date:null,dateValue:Nt,future:!1,futureSpan:null,lineNumber:ht.lineNumber,eraName:ht.name,color:yt,cardFill:kt,titleColor:Ot,lines:zt,bulletColors:Lt,bulletMeta:Dt,cardH:N(zt,!1),x:0,side:pt,lane:0,left:0,spanHalf:0}}),G=e.options.scale&&R.every(rt=>rt.dateValue!==null),I=s-Gh*2,H=16,O=8,D=64,W=16,z=[],P=[],B=()=>{if(!P.length)return;let rt=P.map(pt=>pt.dateValue);z.push({kind:"run",events:P,lo:Math.min(...rt),hi:Math.max(...rt)}),P=[]};for(let rt of R)rt.kind==="era"?(B(),z.push({kind:"capsule",p:rt})):P.push(rt);B();let Y=z.reduce((rt,pt)=>rt+(pt.kind==="run"?pt.hi-pt.lo:0),0),V=rt=>{if(G){let pt=Y>0?I*rt/Y:0,ht={above:-1/0,below:-1/0},dt=Gh;for(let kt of z)if(kt.kind==="capsule"){let Ot=dt+D/2,Xt=Math.max(oo/2+6,ht[kt.p.side]+$h+oo/2);Ot<Xt&&(dt+=Xt-Ot,Ot=Xt),kt.p.x=Ot,kt.p.spanHalf=D/2,ht[kt.p.side]=Ot+oo/2,dt+=D+W}else{for(let Ot of kt.events)Ot.x=dt+(Ot.dateValue-kt.lo)*pt,Ot.spanHalf=0;dt+=(kt.hi-kt.lo)*pt+W}let ut=-1/0,yt=null;for(let kt of[...R].sort((Ot,Xt)=>Ot.x-Xt.x)){if(kt.kind==="era"){ut=kt.x+kt.spanHalf,yt=null;continue}if(kt.dateValue===yt){kt.x=ut;continue}kt.x<ut+H&&(kt.x=ut+H),ut=kt.x,yt=kt.dateValue}}else{R.forEach(dt=>{dt.spanHalf=0});let pt=R.length,ht=pt>1?Math.max(U9,I/(pt-1)):0;R.forEach((dt,ut)=>{dt.x=Gh+ut*ht})}if(G){let pt=oo+$h;for(let ht=0;ht<8;ht++){let dt=!1;for(let ut of["above","below"]){let yt=R.filter(kt=>kt.side===ut).sort((kt,Ot)=>kt.x-Ot.x);for(let kt=1;kt<yt.length;kt++){let Ot=yt[kt];if(Ot.kind!=="event")continue;let Xt=yt[kt-1];if(Xt.kind==="event"&&Ot.dateValue===Xt.dateValue)continue;let bt=Xt.x+pt;if(bt<=Ot.x)continue;let Nt=yt[kt+1],Vt=Nt?.kind==="era"?Nt.x-pt:1/0,xt=Math.min(bt,Vt);xt>Ot.x+.5&&(Ot.x=xt,dt=!0)}}if(!dt)break}}for(let pt of["above","below"]){let ht=R.filter(ut=>ut.side===pt).sort((ut,yt)=>ut.x-yt.x),dt=[];for(let ut=0;ut<ht.length;ut++){let yt=ht[ut],kt=ht[ut+1],Xt=yt.kind!=="era"&&!!kt&&kt.x-yt.x<oo+$h?yt.x-oo+dE:yt.x-oo/2,bt=yt.x-dE,Nt=yt.x-oo+dE,Vt=dt.length,xt=Math.max(Xt,Nt);for(let Lt=0;Lt<dt.length;Lt++){let Dt=Math.max(Xt,dt[Lt]+$h,Nt);if(Dt<=bt){Vt=Lt,xt=Dt;break}}yt.lane=Vt,yt.left=Math.max(6,xt),dt[Vt]=yt.left+oo}}},j=()=>{let rt=Math.max(s,Math.max(...R.map(Dt=>Dt.x+Dt.spanHalf))+Gh,Math.max(...R.map(Dt=>Dt.left+oo))+6),pt={above:[],below:[]};for(let Dt of["above","below"]){let zt=[];for(let Wt of R)Wt.side===Dt&&(zt[Wt.lane]=Math.max(zt[Wt.lane]??0,Wt.cardH));let $t=[],ft=0;for(let Wt=0;Wt<zt.length;Wt++)$t[Wt]=ft,ft+=(zt[Wt]??0)+X9;pt[Dt]=$t}let ht=Dt=>(Dt.side==="above"?Y9:z9)+(pt[Dt.side][Dt.lane]??0),dt=Dt=>Math.max(0,...R.filter(zt=>zt.side===Dt).map(zt=>ht(zt)+zt.cardH)),ut=dt("above"),yt=dt("below"),kt=ut+(L&&C==="above"?HR:0),Ot=yt+(L&&C==="below"?HR:0),Xt=14,bt=14,Nt=y+Xt+kt,Vt=C==="above"?Nt-(ut+14):Nt+(yt+14),xt=Nt+Ot+bt,Lt=c?xt:Math.max(l,xt);return{contentW:rt,contentH:xt,totalH:Lt,spineY:Nt,eraBaseY:Vt,laneNear:ht}},K=Number(globalThis.process?.env?.DGMO_EVT_STRETCH),$;if(Number.isFinite(K)&&K>0)V(K),$=j();else{V(1),$=j();let rt=s/l,pt=ht=>ht.contentW/ht.contentH;if(G&&$.contentH>l&&pt($)<rt){V(O);let ht=j();if(pt(ht)<=rt)$=ht;else{let dt=1,ut=O;for(let yt=0;yt<8;yt++){let kt=(dt+ut)/2;V(kt),pt(j())>=rt?ut=kt:dt=kt}V(ut),$=j()}}}let{contentW:U,totalH:X,spineY:q,eraBaseY:et,laneNear:tt}=$,F=Rt(t).append("svg").attr("width",U).attr("height",X).attr("viewBox",`0 0 ${U} ${X}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c||F.append("style").text(Q9),F.append("rect").attr("width",U).attr("height",X).attr("fill",n.bg),m){let rt=F.append("text").attr("class","chart-title").attr("x",U/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber){let pt=e.titleLineNumber;rt.style("cursor","pointer").on("click",()=>o(pt))}}if(h){let rt=F.append("g").attr("transform",`translate(0, ${g})`),pt=e.tagGroups.map(ht=>({name:ht.name,entries:ht.entries.map(dt=>({value:dt.value,color:Dn(dt.color,n)??dt.color}))}));fn(rt,{groups:pt,palette:n,isDark:r,width:U,mode:c?"export":"preview",activeGroup:p}),c||nj(rt)}let Q=Math.min(...R.map(rt=>rt.x-rt.spanHalf)),ot=Math.max(...R.map(rt=>rt.x+rt.spanHalf)),Z=Q-20,lt=ot+20,nt=G&&R.some(rt=>rt.future&&!rt.futureSpan),J=R.length?Math.max(Z,...R.filter(rt=>!rt.future).map(rt=>rt.x+rt.spanHalf)):lt,at=nt?J:lt;F.append("line").attr("x1",Z).attr("y1",q).attr("x2",at).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round"),nt&&F.append("line").attr("x1",at).attr("y1",q).attr("x2",lt).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round").attr("stroke-opacity",.45).attr("stroke-dasharray","2 6");let it=R.map(rt=>{let pt=rt.side==="above"?q-tt(rt):q+tt(rt),ht=rt.side==="above"?pt-rt.cardH:pt;return{p:rt,near:pt,top:ht}}),vt=(rt,pt)=>{let ht=Math.min(q,pt),dt=Math.max(q,pt);return it.some(ut=>ut.p!==rt&&rt.x>ut.p.left&&rt.x<ut.p.left+oo&&dt>ut.top&&ht<ut.top+ut.p.cardH)},Tt=rt=>q+Z9*(rt.side==="above"?-1:1);for(let{p:rt,near:pt}of it){let ht=rt.kind==="era"?Tt(rt):q,dt=F.append("line").attr("class","dgmo-event-leader").attr("x1",rt.x).attr("y1",ht).attr("x2",rt.x).attr("y2",pt).attr("stroke",rt.color).attr("stroke-width",1.5).attr("stroke-opacity",vt(rt,pt)?.18:rt.future?.4:.65);fE(dt,rt)}let At=0;for(let{p:rt,top:pt}of it){let ht=rt.left,dt=F.append("g").attr("class","dgmo-event-card").attr("transform",`translate(${ht}, ${pt})`).attr("data-line-number",rt.lineNumber);if(fE(dt,rt),rt.kind==="era"&&dt.attr("data-era",rt.era.name).attr("data-era-collapsed","true"),o){let kt=rt.lineNumber;dt.style("cursor","pointer").on("click",()=>o(kt)),dt.append("rect").attr("x",0).attr("y",0).attr("width",oo).attr("height",rt.cardH).attr("fill","transparent").attr("pointer-events","all")}let ut=rt.kind==="event"&&rt.date?rt.future?"TBD":ts(rt.date):null,yt=ut?$R:0;if(e.options.noBox){let kt=rt.side==="below",Ot=kt?0:rt.cardH-28,Xt=kt?0:rt.cardH-28-yt,bt=28+yt,Nt=`dgmo-evt-shelf-${At++}`;dt.append("clipPath").attr("id",Nt).append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("rx",uE),dt.append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("clip-path",`url(#${Nt})`).attr("fill",Gt(rt.color,nr(n,r),q9));let Vt=kt?Xt:Xt+bt-uE;if(dt.append("rect").attr("x",0).attr("y",Vt).attr("width",oo).attr("height",uE).attr("clip-path",`url(#${Nt})`).attr("fill",rt.color).attr("fill-opacity",rt.future?.4:1),dt.append("text").attr("x",Bl).attr("y",Ot+28/2+13/2-2).attr("fill",rt.color).attr("font-family",It).attr("font-size",13).attr("font-weight",700).text(rt.label),ut&&dt.append("text").attr("x",Bl).attr("y",(kt?28:Ot-yt)+Hh+2).attr("fill",Gt(n.text,n.bg,55)).attr("font-family",It).attr("font-size",Hh).attr("font-weight",600).text(ut),rt.lines.length>0){let xt=kt?pE+yt+Fl:Bl+Fl;UR(dt,rt.lines,n.text,n,xt,rt.bulletColors,rt.bulletMeta)}}else od(dt,{width:oo,height:rt.cardH,rx:6,fill:rt.cardFill,stroke:rt.color,strokeWidth:1.5,label:rt.label,labelColor:rt.titleColor,labelFontSize:13,headerHeight:28}),ut&&dt.append("text").attr("x",oo/2).attr("y",28+Hh+1).attr("text-anchor","middle").attr("fill",Gt(rt.titleColor,rt.cardFill,60)).attr("font-family",It).attr("font-size",Hh).attr("font-weight",600).text(ut),rt.lines.length>0&&(dt.append("line").attr("x1",0).attr("y1",28+yt).attr("x2",oo).attr("y2",28+yt).attr("stroke",rt.titleColor).attr("stroke-opacity",.3).attr("stroke-width",1),UR(dt,rt.lines,rt.titleColor,n,pE+yt+Fl,rt.bulletColors,rt.bulletMeta))}for(let rt of R){if(rt.kind==="era"){let ht=rt.color,dt=Math.max(16,rt.spanHalf),ut=Q-20,yt=ot+20,kt=Math.max(ut,rt.x-dt),Ot=Math.min(yt,rt.x+dt),Xt=Tt(rt),bt=F.append("g").attr("class","dgmo-event-era").attr("data-era",rt.era.name).attr("data-era-collapsed","true").attr("data-line-number",rt.lineNumber);if(o){let Vt=Math.min(Xt,q)-4,xt=Math.max(Xt,q)+8;bt.append("rect").attr("x",kt).attr("y",Vt).attr("width",Ot-kt).attr("height",xt-Vt).attr("fill","transparent").attr("pointer-events","all")}bt.append("path").attr("d",`M${kt},${q} L${kt},${Xt} L${Ot},${Xt} L${Ot},${q}`).attr("fill","none").attr("stroke",ht).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round");let Nt=(kt+Ot)/2;bt.append("line").attr("x1",Nt-Fh/2).attr("y1",q).attr("x2",Nt+Fh/2).attr("y2",q).attr("stroke",n.bg).attr("stroke-width",5).attr("stroke-linecap","butt");for(let Vt of dj(Nt,q))bt.append("path").attr("d",Vt).attr("fill","none").attr("stroke",n.text).attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round");if(o){let Vt=rt.lineNumber;bt.style("cursor","pointer").on("click",()=>o(Vt))}continue}let pt=F.append("circle").attr("class","dgmo-event-dot").attr("cx",rt.x).attr("cy",q).attr("r",V9).attr("fill",rt.future?n.bg:rt.color).attr("stroke",rt.future?rt.color:n.bg).attr("stroke-width",2).attr("data-line-number",rt.lineNumber);fE(pt,rt)}if(x){let rt=[],pt=null;for(let yt of R){let kt=yt.eraName;if(kt&&b.has(kt)){if(pt===kt&&rt.length>0){let Ot=rt[rt.length-1];Ot.firstX=Math.min(Ot.firstX,yt.x),Ot.lastX=Math.max(Ot.lastX,yt.x)}else rt.push({era:b.get(kt),collapsed:yt.kind==="era",firstX:yt.x,lastX:yt.x});pt=kt}else pt=null}let ht=yt=>Math.max(4,Math.min(U-4,yt)),dt=C==="above"?1:-1,ut=rt.filter(yt=>!yt.collapsed).map(yt=>({run:yt,x0:ht(yt.firstX-BR),x1:ht(yt.lastX+BR)})).sort((yt,kt)=>yt.run.firstX-kt.run.firstX);for(let yt=1;yt<ut.length;yt++){let kt=ut[yt-1],Ot=ut[yt];if(kt.x1<=Ot.x0)continue;let Xt=(kt.run.lastX+Ot.run.firstX)/2;kt.x1=Math.max(kt.run.lastX,Math.min(kt.x1,Xt-FR)),Ot.x0=Math.min(Ot.run.firstX,Math.max(Ot.x0,Xt+FR))}for(let{run:yt,x0:kt,x1:Ot}of ut){let Xt=!yt.era.color,bt=Xt?n.text:Dn(yt.era.color,n)??n.text,Nt=Xt?.5:.85,Vt=et,xt=F.append("g").attr("class","dgmo-event-era").attr("data-era",yt.era.name).attr("data-era-collapsed",String(yt.collapsed)).attr("data-line-number",yt.era.lineNumber);if(xt.append("path").attr("d",`M${kt},${Vt+WR*dt} L${kt},${Vt} L${Ot},${Vt} L${Ot},${Vt+WR*dt}`).attr("fill","none").attr("stroke",bt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",Nt),xt.append("text").attr("x",(yt.firstX+yt.lastX)/2).attr("y",C==="above"?Vt-6:Vt+zR+4).attr("text-anchor","middle").attr("font-family",It).attr("font-size",zR).attr("font-weight",700).attr("fill",bt).attr("fill-opacity",Xt?.85:1).text(yt.era.name),o){let Lt=yt.era.lineNumber;xt.style("cursor","pointer").on("click",()=>o(Lt))}}}if(!c){let rt=F.node();lj(rt),rt&&(sj(t,rt,()=>yE(t,e,n,r,o,a,i)),oj(t,rt))}}function fE(t,e){if(t.attr("data-evt",e.lineNumber),e.eraName&&t.attr("data-evt-era",e.eraName),e.event)for(let[n,r]of Object.entries(e.event.metadata))t.attr(`data-tag-${n.toLowerCase()}`,String(r).toLowerCase())}function tj(t){t.querySelectorAll(`.${Qs},.${Yl},.${Yh}`).forEach(e=>e.classList.remove(Qs,Yl,Yh))}function ad(t,e){if(tj(t),!e)return;let n=[...t.querySelectorAll(J9)];if(e.kind==="event"){let l=c=>c.getAttribute("data-evt")===e.id;if(!n.some(l))return;n.forEach(c=>c.classList.add(l(c)?Qs:Yl));return}if(e.kind==="era"){let l=c=>c.getAttribute("data-evt-era")===e.name||c.classList.contains("dgmo-event-era")&&c.getAttribute("data-era")===e.name;if(!n.some(l))return;n.forEach(c=>{l(c)?c.classList.contains("dgmo-event-era")&&c.classList.add(Yh):c.classList.add(Yl)});return}let r=`data-tag-${e.group}`,o=l=>l.getAttribute(r)===e.value,a=[...t.querySelectorAll(".dgmo-evt-bullet")],i=new Set;for(let l of a){if(!o(l))continue;let c=l.closest(".dgmo-event-card"),d=c?.getAttribute("data-era")??c?.getAttribute("data-evt-era");d&&i.add(d)}if(!n.some(o)&&i.size===0)return;let s=l=>{let c=l.getAttribute("data-era")??l.getAttribute("data-evt-era");return!!c&&i.has(c)};n.forEach(l=>{!o(l)&&!s(l)&&l.classList.add(Yl)});for(let l of a)o(l)||l.classList.add(Yl)}function Bh(t){let e=t.getAttribute(mE);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ej(t){t.removeAttribute(gE)}function qR(t,e){let n=t.querySelector("svg");n&&(e?n.setAttribute(mE,JSON.stringify(e)):n.removeAttribute(mE),ad(n,e))}function bE(t){let e=t.getAttribute(gE);if(!e)return new Set;try{return new Set(JSON.parse(e))}catch{return new Set}}function nj(t){t.selectAll("[data-legend-entry]").each(function(){let r;try{r=this.getBBox()}catch{return}!r.width||!r.height||Rt(this).insert("rect",":first-child").attr("x",r.x-6).attr("y",r.y-7).attr("width",r.width+12).attr("height",r.height+14).attr("fill","transparent").attr("data-legend-hit","")})}function rj(t,e){if(e.size===0)return!1;for(let[n,r]of Object.entries(t))if(e.has(`${n.toLowerCase()}:${String(r).toLowerCase()}`))return!0;return!1}function oj(t,e){let n=bE(t),r=o=>{for(let a of n){let i=a.indexOf(":");if(i<0)continue;let s=a.slice(0,i),l=a.slice(i+1);if(o.getAttribute(`data-tag-${s}`)===l)return!0}return!1};e.querySelectorAll(".dgmo-event-card,.dgmo-event-leader").forEach(o=>o.classList.toggle(gf,r(o))),e.querySelectorAll("[data-legend-entry]").forEach(o=>{let a=o.closest("[data-legend-group]")?.getAttribute("data-legend-group"),i=o.getAttribute("data-legend-entry");aj(o,!!a&&n.has(`${a}:${i}`))})}function aj(t,e){t.classList.toggle(jR,e);let n=t.querySelector("circle");if(n)if(e)n.hasAttribute("data-fill0")||n.setAttribute("data-fill0",n.getAttribute("fill")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",n.getAttribute("data-fill0")||"currentColor"),n.setAttribute("stroke-width","1.5");else{let r=n.getAttribute("data-fill0");r!==null&&n.setAttribute("fill",r),n.removeAttribute("stroke"),n.removeAttribute("stroke-width")}}function ij(t,e,n){let r=bE(t),o=`${e}:${n}`;r.has(o)?r.delete(o):r.add(o),t.setAttribute(gE,JSON.stringify([...r]))}function sj(t,e,n){e.addEventListener("click",r=>{let o=r.target;if(!o||typeof o.closest!="function")return;let a=o.closest("[data-legend-entry]");if(!a)return;let i=a.getAttribute("data-legend-entry"),s=a.closest("[data-legend-group]")?.getAttribute("data-legend-group");if(!s||!i)return;ij(t,s,i);let l=Bh(e);n(),l&&qR(t,l),typeof CustomEvent<"u"&&t.dispatchEvent(new CustomEvent("dgmo-event-line-rerender"))})}function lj(t){t&&(t.addEventListener("mouseover",e=>{let n=e.target;if(!n||typeof n.closest!="function")return;let r=n.closest("[data-legend-entry]");if(r){let i=r.getAttribute("data-legend-entry"),s=r.closest("[data-legend-group]")?.getAttribute("data-legend-group");ad(t,s&&i?{kind:"tag",group:s,value:i}:Bh(t));return}let o=n.closest(".dgmo-event-era");if(o){ad(t,{kind:"era",name:o.getAttribute("data-era")??""});return}let a=n.closest("[data-evt]");if(a){let i=a.getAttribute("data-era");ad(t,i?{kind:"era",name:i}:{kind:"event",id:a.getAttribute("data-evt")??""});return}ad(t,Bh(t))}),t.addEventListener("mouseout",e=>{let n=e.relatedTarget;(!n||!t.contains(n))&&ad(t,Bh(t))}))}function cj(t,e,n,r,o,a){yE(t,e,n,r,void 0,o,a)}function dj(t,e){let o=a=>{let i="";for(let s=0;s<=48;s++){let l=s/48,c=e-YR+l*2*YR,d=a+K9*Math.sin(l*Math.PI*2);i+=`${s===0?"M":"L"}${d.toFixed(2)},${c.toFixed(2)}`,s<48&&(i+=" ")}return i};return[o(t-Fh/2),o(t+Fh/2)]}function VR(t,e){let n=[];for(let r of t){if(r===""){n.push({text:"",kind:"plain"});continue}n.push(...Ko([r],e))}return n}function UR(t,e,n,r,o=pE+Fl,a=[],i=[]){let s=o,l=0,c=n,d=null,u=f=>{if(d){f.attr("class","dgmo-evt-bullet");for(let[p,m]of Object.entries(d))f.attr(`data-tag-${p.toLowerCase()}`,String(m).toLowerCase())}};for(let f of e){let p=f.kind==="bullet-first"||f.kind==="bullet-cont",m=Bl+(p?12:0);if(f.kind==="bullet-first"){c=a[l]??n,d=i[l]??null,l++;let g=t.append("text").attr("x",Bl).attr("y",s).attr("text-anchor","start").attr("fill",c).attr("font-family",It).attr("font-size",Fl).attr("font-weight",700).text("\u2022");u(g)}else p||(c=n,d=null);let h=t.append("text").attr("x",m).attr("y",s).attr("text-anchor","start").attr("fill",p?c:n).attr("font-family",It).attr("font-size",Fl);p&&u(h),gn(h,f.text,r),s+=XR}}var oo,Gh,B9,F9,Y9,z9,Fl,XR,Bl,pE,V9,U9,X9,j9,dE,$h,$R,Hh,q9,uE,HR,WR,BR,FR,YR,K9,Fh,Z9,zR,Qs,Yl,Yh,gf,jR,gE,Q9,J9,mE,ZR=st(()=>{"use strict";Xn();on();tn();xr();Oh();_o();en();Hs();Br();w0();Ke();oo=210,Gh=58,B9=48,F9=34,Y9=46,z9=46,Fl=11.5,XR=16,Bl=9,pE=34,V9=5.5,U9=96,X9=16,j9="#999999",dE=18,$h=6,$R=15,Hh=10,q9=13,uE=4,HR=30,WR=8,BR=14,FR=3,YR=6,K9=2.6,Fh=5,Z9=13,zR=11.5,Qs="dgmo-evt-hl",Yl="dgmo-evt-dim",Yh="dgmo-evt-era-hl",gf="dgmo-evt-collapsed",jR="dgmo-evt-off",gE="data-evt-hidden",Q9=`.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${Yl}{opacity:.2}.dgmo-event-dot.${Qs}{transform:scale(1.55)}.dgmo-event-leader.${Qs}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${Qs}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${Yh}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${gf},.dgmo-event-leader.${gf}{opacity:0;pointer-events:none}.dgmo-event-card.${gf}.${Qs},.dgmo-event-leader.${gf}.${Qs}{opacity:1;pointer-events:auto}[data-legend-entry].${jR} text{text-decoration:line-through;opacity:.5}`;J9=".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era",mE="data-evt-pin"});var eI={};ye(eI,{renderVersionControl:()=>tI,renderVersionControlForExport:()=>hj});function fj(t,e){return t.length>e?t.slice(0,e-1)+"\u2026":t}function EE(t,e,n,r,o,a,i){let s=Math.hypot(n-t,r-e),l=Math.hypot(o-n,a-r),c=Math.max(2,Math.min(i,s-1,l-1)),d=(n-t)/(s||1),u=(r-e)/(s||1),f=(o-n)/(l||1),p=(a-r)/(l||1);return`M${t},${e} L${n-d*c},${r-u*c} Q${n},${r} ${n+f*c},${r+p*c} L${o},${a}`}function tI(t,e,n,r,o,a){if(e.nodes.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.nodes,s=e.options.direction!=="LR",l=new Map(e.branches.map(D=>[D.name,D])),c=ir(n),d=D=>D.colorToken?Dn(D.colorToken,n)??c[D.lane%c.length]:c[D.lane%c.length],u=D=>d(l.get(D.branch)),f=D=>i[D],p=D=>D.kind==="cherry"?"\u21E0 ":D.kind==="merge"?"\u21F2 ":"",m=new Map;for(let D of i){let W=D.id,z=p(D)+fj(D.message||"(empty)",26),P=(W?W.length*6.6+8:0)+z.length*6.9+8;m.set(D.key,{sha:W,msg:z,lw:P})}let h=Math.max(0,...[...m.values()].map(D=>D.lw)),g=new Map,E=(D,W)=>{g.has(D)||g.set(D,[]),g.get(D).push(W)};if(!e.options.noLabels)for(let D of i)D.tag&&E(D.key,{kind:"tag",label:D.tag,w:D.tag.length*6.6+16});for(let D of e.refs)D.atKey!=null&&(D.head?E(D.atKey,{kind:"head",label:"HEAD",w:46}):E(D.atKey,{kind:"ref",label:D.name,remote:D.remote,w:D.name.length*6.2+18}));for(let D of e.notes)D.anchorKey!=null&&E(D.anchorKey,{kind:"note",label:JR[D.num-1]??`#${D.num}`,w:19});let y=Math.max(0,...[...g.values()].map(D=>D.length)),b=e.branches.length,S=i.length,x=new Map,L=[],v,A,C,M,w=0,k=Math.cos(SE*Math.PI/180),N=Math.sin(SE*Math.PI/180);if(s){C=24;let D=C+32,W=52,z=96;M=78;for(let B of i)x.set(B.key,{x:M+B.lane*z,y:D+B.seq*W});let P=M+(b-1)*z+28;for(let B of i){let Y=x.get(B.key);L.push({node:B,kind:"msg",diag:!1,x:P,y:Y.y,anchor:"start",leader:{x1:Y.x+Zo+2,y1:Y.y,x2:P-6,y2:Y.y}}),(g.get(B.key)??[]).forEach((j,K)=>L.push({node:B,kind:j.kind,label:j.label,remote:j.remote,w:j.w,x:Y.x-Zo-12-j.w/2-K*4,y:Y.y,anchor:"middle"}))}v=P+h+16,A=D+(S-1)*W+22}else{C=Math.max(4,...e.branches.map(V=>V.name.length))*7.5+18;let W=C+34,z=86,P=54;M=16+y*QR+14;for(let V of i)x.set(V.key,{x:W+V.seq*z,y:M+V.lane*P});let Y=M+(b-1)*P+26;for(let V of i){let j=x.get(V.key);L.push({node:V,kind:"msg",diag:!0,x:j.x,y:Y,anchor:"start",leader:{x1:j.x,y1:j.y+Zo,x2:j.x,y2:Y-3}}),(g.get(V.key)??[]).forEach(($,U)=>L.push({node:V,kind:$.kind,label:$.label,remote:$.remote,w:$.w,x:j.x,y:j.y-Zo-12-U*QR,anchor:"middle"}))}for(let V of e.branches){if(!V.ab||V.ab.ahead+V.ab.behind===0||V.tip==null)continue;let j=x.get(V.tip);L.push({node:f(V.tip),kind:"ab",label:pj(V.ab),x:j.x+Zo+10,y:j.y,anchor:"start"})}v=Math.max(W+(S-1)*z+Zo+70,...[...x.entries()].map(([V,j])=>j.x+m.get(V).lw*k))+18,A=Y+h*N+12*k+16,e.notes.length&&(w=A+4,A+=8+e.notes.length*16+8)}let _=!!e.title,T=_?uj:0,R=Math.round(v),G=Math.round(A+T),I=!!a,H=Rt(t).append("svg").attr("width",R).attr("height",G).attr("viewBox",`0 0 ${R} ${G}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(H.append("rect").attr("width",R).attr("height",G).attr("fill",n.bg),_){let D=H.append("text").attr("class","chart-title").attr("x",R/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber&&!I){let W=e.titleLineNumber;D.style("cursor","pointer").on("click",()=>o(W))}}let O=H.append("g").attr("transform",`translate(0, ${T})`);mj(O,e,n,s,x,L,m,u,f,C,M,w,o&&!I?o:void 0)}function pj(t){let e=[];return t.ahead&&e.push("\u2191"+t.ahead),t.behind&&e.push("\u2193"+t.behind),e.join(" ")}function mj(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=e.nodes,m=S=>o.get(S),h=(S,x)=>r?{x:m(x.key).x,y:m(S.key).y}:{x:m(S.key).x,y:m(x.key).y},g=(S,x)=>r?{x:m(S.key).x,y:m(x.key).y}:{x:m(x.key).x,y:m(S.key).y},E=S=>S.ghost?.32:1,y=(S,x,L,v)=>{let A=m(S.key),C=m(x.key),M=g(S,x);if(t.append("path").attr("d",EE(A.x,A.y,M.x,M.y,C.x,C.y,wE)).attr("fill","none").attr("stroke",L).attr("stroke-width",2).attr("stroke-dasharray","2 4").attr("opacity",.8),v){let w=C.x-M.x,k=C.y-M.y,N=Math.hypot(w,k)||1,_=w/N,T=k/N,R=-T,G=_,I=4;t.append("path").attr("d",`M${C.x},${C.y} L${C.x-_*I*2+R*I},${C.y-T*I*2+G*I} L${C.x-_*I*2-R*I},${C.y-T*I*2-G*I} Z`).attr("fill",L).attr("opacity",.8)}};for(let S of p){let x=s(S),L=E(S),v=m(S.key);if(S.prev!=null){let A=m(S.prev),C=t.append("line").attr("x1",A.x).attr("y1",A.y).attr("x2",v.x).attr("y2",v.y).attr("stroke",x).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",L);S.ghost&&C.attr("stroke-dasharray","5 5")}if(S.parent!=null){let A=l(S.parent),C=h(A,S),M=m(A.key),w=t.append("path").attr("d",EE(M.x,M.y,C.x,C.y,v.x,v.y,wE)).attr("fill","none").attr("stroke",x).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",L);S.ghost&&w.attr("stroke-dasharray","5 5")}if(S.mergeFrom!=null){let A=l(S.mergeFrom),C=g(A,S),M=m(A.key);t.append("path").attr("d",EE(M.x,M.y,C.x,C.y,v.x,v.y,wE)).attr("fill","none").attr("stroke",s(A)).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",.92*L)}S.cherryFrom!=null&&y(l(S.cherryFrom),S,s(l(S.cherryFrom)),!1),S.revertFrom!=null&&y(l(S.revertFrom),S,x,!1),S.squashFrom!=null&&y(l(S.squashFrom),S,n.textMuted,!0),S.movedTo!=null&&y(S,l(S.movedTo),n.textMuted,!0)}if(!e.options.noLanes)for(let S of e.branches){let x=null;for(let A of p)A.branch===S.name&&(x===null||A.seq<x.seq)&&(x=A);if(!x)continue;let L=m(x.key),v=s(x);r?t.append("text").attr("x",L.x).attr("y",14).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",800).attr("fill",v).text(S.name):t.append("text").attr("x",c).attr("y",L.y+4).attr("text-anchor","end").attr("font-size",12.5).attr("font-weight",800).attr("fill",v).text(S.name)}for(let S of p){let x=s(S),L=m(S.key),v=A=>{A.attr("data-line-number",S.lineNumber),A.attr("data-branch",S.branch),f&&A.style("cursor","pointer").on("click",()=>f(S.lineNumber))};if(S.ghost){v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo-1).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",2).attr("opacity",.4));continue}S.type==="highlight"?v(t.append("rect").attr("x",L.x-Zo).attr("y",L.y-Zo).attr("width",Zo*2).attr("height",Zo*2).attr("rx",3.5).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3)):S.type==="reverse"?(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),v(t.append("path").attr("d",`M${L.x-3.6},${L.y-3.6} L${L.x+3.6},${L.y+3.6} M${L.x+3.6},${L.y-3.6} L${L.x-3.6},${L.y+3.6}`).attr("stroke",x).attr("stroke-width",2).attr("stroke-linecap","round").attr("fill","none"))):S.kind==="merge"?(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",3).attr("fill",x))):v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3))}let b=(S,x,L,v,A,C,M,w,k=700)=>{let N=t.append("rect").attr("x",S-L/2).attr("y",x-8.5).attr("width",L).attr("height",17).attr("rx",8.5).attr("fill",A);M&&(N.attr("stroke",M).attr("stroke-width",1.3),w&&N.attr("stroke-dasharray","3 2")),t.append("text").attr("x",S).attr("y",x+4).attr("text-anchor","middle").attr("font-size",10.5).attr("font-weight",k).attr("fill",C).text(v)};for(let S of a){let x=S.node,L=s(x);if(S.leader&&t.append("line").attr("x1",S.leader.x1).attr("y1",S.leader.y1).attr("x2",S.leader.x2).attr("y2",S.leader.y2).attr("stroke",L).attr("stroke-width",1).attr("opacity",.34*E(x)),S.kind==="tag")b(S.x,S.y,S.w,S.label,L,n.bg);else if(S.kind==="head")b(S.x,S.y,S.w,"HEAD",n.text,n.bg,void 0,!1,800);else if(S.kind==="ref")b(S.x,S.y,S.w,S.label,n.bg,L,L,S.remote);else if(S.kind==="note")t.append("circle").attr("cx",S.x).attr("cy",S.y).attr("r",8.5).attr("fill",L),t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor","middle").attr("font-size",11).attr("fill",n.bg).text(S.label);else if(S.kind==="ab")t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor","start").attr("font-size",11).attr("font-weight",700).attr("fill",L).text(S.label);else{let v=i.get(x.key),A=x.ghost,C=A?n.textMuted:L,M=S.diag?t.append("text").attr("transform",`translate(${S.x},${S.y}) rotate(${SE})`).attr("font-size",12).attr("opacity",A?.55:1):t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor",S.anchor).attr("font-size",12).attr("opacity",A?.55:1);v.sha&&M.append("tspan").attr("font-family","ui-monospace, monospace").attr("font-size",11).attr("fill",n.textMuted).text(v.sha+" "),M.append("tspan").attr("fill",C).attr("font-weight",x.kind==="cherry"?400:700).attr("font-style",x.kind==="cherry"?"italic":"normal").text(v.msg)}}if(u&&e.notes.length){let S=u+14;for(let x of e.notes){let L=t.append("text").attr("x",12).attr("y",S).attr("font-size",11.5);L.append("tspan").attr("fill",n.text).attr("font-weight",800).text((JR[x.num-1]??`#${x.num}`)+" "),L.append("tspan").attr("fill",n.textMuted).text(x.text),S+=16}}}function hj(t,e,n,r,o){tI(t,e,n,r,void 0,o)}var xE,Zo,wE,SE,QR,JR,uj,nI=st(()=>{"use strict";Xn();on();tn();xr();xE=5.5,Zo=8,wE=13,SE=32,QR=19,JR="\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468",uj=40});function gj(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function rI(){return this.eachAfter(gj)}var oI=st(()=>{"use strict"});function aI(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}var iI=st(()=>{"use strict"});function sI(t,e){for(var n=this,r=[n],o,a,i=-1;n=r.pop();)if(t.call(e,n,++i,this),o=n.children)for(a=o.length-1;a>=0;--a)r.push(o[a]);return this}var lI=st(()=>{"use strict"});function cI(t,e){for(var n=this,r=[n],o=[],a,i,s,l=-1;n=r.pop();)if(o.push(n),a=n.children)for(i=0,s=a.length;i<s;++i)r.push(a[i]);for(;n=o.pop();)t.call(e,n,++l,this);return this}var dI=st(()=>{"use strict"});function uI(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}var fI=st(()=>{"use strict"});function pI(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}var mI=st(()=>{"use strict"});function hI(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}var gI=st(()=>{"use strict"});function yI(t){for(var e=this,n=yj(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function yj(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}var bI=st(()=>{"use strict"});function xI(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}var wI=st(()=>{"use strict"});function EI(){return Array.from(this)}var SI=st(()=>{"use strict"});function vI(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}var kI=st(()=>{"use strict"});function LI(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}var NI=st(()=>{"use strict"});function*MI(){var t=this,e,n=[t],r,o,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,a=r.length;o<a;++o)n.push(r[o]);while(n.length)}var TI=st(()=>{"use strict"});function Ri(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=wj)):e===void 0&&(e=xj);for(var n=new zl(t),r,o=[n],a,i,s,l;r=o.pop();)if((i=e(r.data))&&(l=(i=Array.from(i)).length))for(r.children=i,s=l-1;s>=0;--s)o.push(a=i[s]=new zl(i[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Sj)}function bj(){return Ri(this).eachBefore(Ej)}function xj(t){return t.children}function wj(t){return Array.isArray(t)?t[1]:null}function Ej(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Sj(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function zl(t){this.data=t,this.depth=this.height=0,this.parent=null}var vE=st(()=>{"use strict";oI();iI();lI();dI();fI();mI();gI();bI();wI();SI();kI();NI();TI();zl.prototype=Ri.prototype={constructor:zl,count:rI,each:aI,eachAfter:cI,eachBefore:sI,find:uI,sum:pI,sort:hI,path:yI,ancestors:xI,descendants:EI,leaves:vI,links:LI,copy:bj,[Symbol.iterator]:MI}});function CI(t){if(typeof t!="function")throw new Error;return t}var _I=st(()=>{"use strict"});function id(){return 0}function sd(t){return function(){return t}}var AI=st(()=>{"use strict"});function zh(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}var kE=st(()=>{"use strict"});function Vh(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)i=a[s],i.y0=n,i.y1=o,i.x0=e,i.x1=e+=i.value*c}var LE=st(()=>{"use strict"});function NE(){var t=1,e=1,n=0,r=!1;function o(i){var s=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/s,i.eachBefore(a(e,s)),r&&i.eachBefore(zh),i}function a(i,s){return function(l){l.children&&Vh(l,l.x0,i*(l.depth+1)/s,l.x1,i*(l.depth+2)/s);var c=l.x0,d=l.y0,u=l.x1-n,f=l.y1-n;u<c&&(c=u=(c+u)/2),f<d&&(d=f=(d+f)/2),l.x0=c,l.y0=d,l.x1=u,l.y1=f}}return o.round=function(i){return arguments.length?(r=!!i,o):r},o.size=function(i){return arguments.length?(t=+i[0],e=+i[1],o):[t,e]},o.padding=function(i){return arguments.length?(n=+i,o):n},o}var RI=st(()=>{"use strict";kE();LE()});function vj(t,e){return t.parent===e.parent?1:2}function ME(t){var e=t.children;return e?e[0]:t.t}function TE(t){var e=t.children;return e?e[e.length-1]:t.t}function kj(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Lj(t){for(var e=0,n=0,r=t.children,o=r.length,a;--o>=0;)a=r[o],a.z+=e,a.m+=e,e+=a.s+(n+=a.c)}function Nj(t,e,n){return t.a.parent===e.parent?t.a:n}function Uh(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Mj(t){for(var e=new Uh(t,0),n,r=[e],o,a,i,s;n=r.pop();)if(a=n._.children)for(n.children=new Array(s=a.length),i=s-1;i>=0;--i)r.push(o=n.children[i]=new Uh(a[i],i)),o.parent=n;return(e.parent=new Uh(null,0)).children=[e],e}function CE(){var t=vj,e=1,n=1,r=null;function o(c){var d=Mj(c);if(d.eachAfter(a),d.parent.m=-d.z,d.eachBefore(i),r)c.eachBefore(l);else{var u=c,f=c,p=c;c.eachBefore(function(y){y.x<u.x&&(u=y),y.x>f.x&&(f=y),y.depth>p.depth&&(p=y)});var m=u===f?1:t(u,f)/2,h=m-u.x,g=e/(f.x+m+h),E=n/(p.depth||1);c.eachBefore(function(y){y.x=(y.x+h)*g,y.y=y.depth*E})}return c}function a(c){var d=c.children,u=c.parent.children,f=c.i?u[c.i-1]:null;if(d){Lj(c);var p=(d[0].z+d[d.length-1].z)/2;f?(c.z=f.z+t(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+t(c._,f._));c.parent.A=s(c,f,c.parent.A||u[0])}function i(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function s(c,d,u){if(d){for(var f=c,p=c,m=d,h=f.parent.children[0],g=f.m,E=p.m,y=m.m,b=h.m,S;m=TE(m),f=ME(f),m&&f;)h=ME(h),p=TE(p),p.a=c,S=m.z+y-f.z-g+t(m._,f._),S>0&&(kj(Nj(m,c,u),c,S),g+=S,E+=S),y+=m.m,g+=f.m,b+=h.m,E+=p.m;m&&!TE(p)&&(p.t=m,p.m+=y-E),f&&!ME(h)&&(h.t=f,h.m+=g-b,u=c)}return u}function l(c){c.x*=e,c.y=c.depth*n}return o.separation=function(c){return arguments.length?(t=c,o):t},o.size=function(c){return arguments.length?(r=!1,e=+c[0],n=+c[1],o):r?null:[e,n]},o.nodeSize=function(c){return arguments.length?(r=!0,e=+c[0],n=+c[1],o):r?[e,n]:null},o}var II=st(()=>{"use strict";vE();Uh.prototype=Object.create(zl.prototype)});function PI(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(o-n)/t.value;++s<l;)i=a[s],i.x0=e,i.x1=r,i.y0=n,i.y1=n+=i.value*c}var DI=st(()=>{"use strict"});function Cj(t,e,n,r,o,a){for(var i=[],s=e.children,l,c,d=0,u=0,f=s.length,p,m,h=e.value,g,E,y,b,S,x,L;d<f;){p=o-n,m=a-r;do g=s[u++].value;while(!g&&u<f);for(E=y=g,x=Math.max(m/p,p/m)/(h*t),L=g*g*x,S=Math.max(y/L,L/E);u<f;++u){if(g+=c=s[u].value,c<E&&(E=c),c>y&&(y=c),L=g*g*x,b=Math.max(y/L,L/E),b>S){g-=c;break}S=b}i.push(l={value:g,dice:p<m,children:s.slice(d,u)}),l.dice?Vh(l,n,r,o,h?r+=m*g/h:a):PI(l,n,r,h?n+=p*g/h:o,a),h-=g,d=u}return i}var Tj,yf,_E=st(()=>{"use strict";LE();DI();Tj=(1+Math.sqrt(5))/2;yf=(function t(e){function n(r,o,a,i,s){Cj(e,r,o,a,i,s)}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Tj)});function AE(){var t=yf,e=!1,n=1,r=1,o=[0],a=id,i=id,s=id,l=id,c=id;function d(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(u),o=[0],e&&f.eachBefore(zh),f}function u(f){var p=o[f.depth],m=f.x0+p,h=f.y0+p,g=f.x1-p,E=f.y1-p;g<m&&(m=g=(m+g)/2),E<h&&(h=E=(h+E)/2),f.x0=m,f.y0=h,f.x1=g,f.y1=E,f.children&&(p=o[f.depth+1]=a(f)/2,m+=c(f)-p,h+=i(f)-p,g-=s(f)-p,E-=l(f)-p,g<m&&(m=g=(m+g)/2),E<h&&(h=E=(h+E)/2),t(f,m,h,g,E))}return d.round=function(f){return arguments.length?(e=!!f,d):e},d.size=function(f){return arguments.length?(n=+f[0],r=+f[1],d):[n,r]},d.tile=function(f){return arguments.length?(t=CI(f),d):t},d.padding=function(f){return arguments.length?d.paddingInner(f).paddingOuter(f):d.paddingInner()},d.paddingInner=function(f){return arguments.length?(a=typeof f=="function"?f:sd(+f),d):a},d.paddingOuter=function(f){return arguments.length?d.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):d.paddingTop()},d.paddingTop=function(f){return arguments.length?(i=typeof f=="function"?f:sd(+f),d):i},d.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:sd(+f),d):s},d.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:sd(+f),d):l},d.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:sd(+f),d):c},d}var OI=st(()=>{"use strict";kE();_E();_I();AI()});var Xh=st(()=>{"use strict";vE();RI();II();OI();_E()});var UI={};ye(UI,{layoutOrg:()=>DE});function Kh(t,e){let n=0;for(let r of t.children){n+=(r.isContainer?0:1)+Kh(r,e);let o=e?.get(r.id);o&&(n+=o)}return n}function bf(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function Oj(t,e){let n=_t(t,_j);for(let[r,o]of Object.entries(e)){let a=_t(`${r}: ${o}`,Aj);a>n&&(n=a)}return Math.max(Dj,Math.ceil(n)+Pj*2)}function Gj(t){let e=Object.keys(t).length;return e===0?GI+$I:GI+Ij+e*Rj+$I}function qh(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n,t.isContainer)}function YI(t,e,n,r,o){return t.map(a=>{let i=bf(a.metadata,n),s=e?.get(a.id);if(!a.isContainer&&o&&!(s!=null&&s>0)){let l=Kh(a,e);l>0&&(i[r??"Sub-node Count"]=String(l))}return{orgNode:a,children:YI(a.children,e,n,r,o),width:Oj(a.label,i),height:Gj(i)}})}function zI(t){let e=0;for(let n of t.children)e+=1+zI(n);return e}function VI(t){for(let i of t.children)VI(i);if(t.children.length<=2)return;let e=t.children.map(i=>({child:i,weight:zI(i)})).sort((i,s)=>s.weight-i.weight),n=new Array(e.length),r=Math.floor((e.length-1)/2),o=r,a=r;for(let i=0;i<e.length;i++){let s=e[i];i===0?n[r]=s.child:i%2===1?(a++,n[a]=s.child):(o--,n[o]=s.child)}t.children=n}function FI(t,e,n){let r=[];for(let o of t){if(o.entries.length===0)continue;let a=n?.get(qt(o.name)),i=a?o.entries.filter(f=>a.has(f.value.toLowerCase())):o.entries;if(i.length===0)continue;let s=We(o.name,sr)+po,l=s,c=0;for(let f of i)c+=wr*2+Nr+We(f.value,Vn)+Kr;let d=e?Mo+Ei:0,u=Rn*2+s+4+d+c;r.push({name:o.name,...o.alias!==void 0&&{alias:o.alias},entries:i.map(f=>({value:f.value,color:f.color})),x:0,y:0,width:u,height:Se,minifiedWidth:l,minifiedHeight:Se})}return r}function $j(t,e){let n=[],r=o=>{n.push(o);for(let a of o.children)r(a)};for(let o of t)r(o);Ea(n,e,o=>o.isContainer)}function DE(t,e,n,r,o){if(t.roots.length===0){let $=r!==void 0,U=FI(t.tagGroups,$);if(U.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let X=ei,q=0;for(let et of U)et.x=ei,et.y=X,X+=Se+Wn,et.width>q&&(q=et.width);return{nodes:[],edges:[],containers:[],legend:U,width:q+ei*2,height:X-Wn+ei}}$j(t.roots,t.tagGroups);let a=t.options["sub-node-label"]??void 0,i=["yes","on"].includes(t.options["show-sub-node-count"]?.toLowerCase()??""),s=YI(t.roots,e,r,a,i),l;s.length===1?l=s[0]:l={orgNode:{id:"__virtual_root__",label:"",metadata:{},children:t.roots,parentId:null,isContainer:!1,lineNumber:0},children:s,width:0,height:0};let c=0,d=0,u=[],f=$=>{$.orgNode.id!=="__virtual_root__"&&(u.push($),$.width>c&&(c=$.width),$.height>d&&(d=$.height));for(let U of $.children)f(U)};f(l);for(let $ of u)$.width=c;let p=new Map,m=$=>{for(let U of $.children)m(U);if($.orgNode.isContainer&&$.children.length>0&&$.children.every(U=>U.children.length===0)){let U=`__stack_${$.orgNode.id}`;p.set($.orgNode.id,{children:[...$.children],placeholderId:U});let X=Math.max(...$.children.map(et=>et.width));for(let et of $.children)et.width=X;let q=$.children.reduce((et,tt)=>et+tt.height,0)+($.children.length-1)*BI;$.children=[{orgNode:{id:U,label:"",metadata:{},children:[],parentId:$.orgNode.id,isContainer:!1,lineNumber:0},children:[],width:X,height:q}]}};m(l),VI(l);let h=Ri(l,$=>$.children);CE().nodeSize([c+HI,d+RE])(h);{let $=h.descendants().filter(tt=>tt.data.orgNode.id!=="__virtual_root__"),U=new Map;for(let tt of $){if(tt.data.orgNode.id.startsWith("__stack_"))continue;let F=U.get(tt.depth)??0;tt.data.height>F&&U.set(tt.depth,tt.data.height)}let X=Math.max(...U.keys(),0),q=new Map,et=s.length===1?0:1;q.set(et,0);for(let tt=et+1;tt<=X;tt++){let F=U.get(tt-1)??d,Q=q.get(tt-1)??0;q.set(tt,Q+F+RE)}for(let tt of h.descendants())tt.data.orgNode.id!=="__virtual_root__"&&(tt.y=q.get(tt.depth)??tt.y)}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.isContainer||!$.children||$.children.length===0)continue;let X=$.children[0].y-$.y,q=Object.keys($.data.orgNode.metadata).length,tt=IE+q*PE+15,F=X-tt;if(F<=0)continue;let Q=ot=>{if(ot.children)for(let Z of ot.children)Z.y-=F,Q(Z)};Q($)}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.isContainer||!$.children||$.children.length===0||!$.children.every(Q=>Q.data.orgNode.isContainer))continue;let U=$.y+$.data.height,q=Math.min(...$.children.map(Q=>Q.y))-U,et=RE*.6,tt=q-et;if(tt<=0)continue;let F=Q=>{if(Q.y-=tt,Q.children)for(let ot of Q.children)F(ot)};for(let Q of $.children)F(Q)}{let $=q=>{let et=q.x-q.data.width/2,tt=q.x+q.data.width/2;if(q.children)for(let F of q.children){let Q=$(F);Q.minX<et&&(et=Q.minX),Q.maxX>tt&&(tt=Q.maxX)}return q.data.orgNode.isContainer&&(et-=jh,tt+=jh),{minX:et,maxX:tt}},U=(q,et)=>{q.x+=et,q.children&&q.children.forEach(tt=>U(tt,et))},X=h.descendants().filter(q=>q.children&&q.children.length>=2).sort((q,et)=>et.depth-q.depth);for(let q of X){let et=q.children,tt=et.map(lt=>{let nt=$(lt);return{relLeft:nt.minX-lt.x,relRight:nt.maxX-lt.x}}),F=(et[0].x+et[et.length-1].x)/2,Q=[0];for(let lt=1;lt<et.length;lt++){let nt=Q[lt-1]+tt[lt-1].relRight;Q[lt]=nt+HI-tt[lt].relLeft}let ot=(Q[0]+Q[Q.length-1])/2,Z=F-ot;for(let lt=0;lt<et.length;lt++){let J=Q[lt]+Z-et[lt].x;Math.abs(J)>.001&&U(et[lt],J)}}}{let $=h.descendants().filter(U=>U.children&&U.children.length>=1&&U.data.orgNode.id!=="__virtual_root__").sort((U,X)=>X.depth-U.depth);for(let U of $){let X=U.children.map(et=>et.x),q=(Math.min(...X)+Math.max(...X))/2;U.x=q}}let E=[],y=[],b=1/0,S=-1/0,x=1/0,L=-1/0,v=[];for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode.id.replace("__stack_",""),X=p.get(U);if(!X)continue;let q=$.y;for(let et of X.children)v.push({orgNode:et.orgNode,width:et.width,height:et.height,cx:$.x,cy:q}),q+=et.height+BI}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.width,X=$.data.height,q=$.x,et=$.y;q-U/2<b&&(b=q-U/2),q+U/2>S&&(S=q+U/2),et<x&&(x=et),et+X>L&&(L=et+X)}for(let $ of v)$.cx-$.width/2<b&&(b=$.cx-$.width/2),$.cx+$.width/2>S&&(S=$.cx+$.width/2),$.cy<x&&(x=$.cy),$.cy+$.height>L&&(L=$.cy+$.height);let A=-b+ei,C=-x+ei,M=a??"Sub-node Count";for(let $ of v){let U=e?.get($.orgNode.id),X=bf($.orgNode.metadata,r);if(!$.orgNode.isContainer&&i&&!(U!=null&&U>0)){let tt=Kh($.orgNode,e);tt>0&&(X[M]=String(tt))}let q=qh($.orgNode,t.tagGroups,n??null),et=$.orgNode.children.length>0||U!=null&&U>0||void 0;E.push({id:$.orgNode.id,label:$.orgNode.label,metadata:X,tagMetadata:{...$.orgNode.metadata},isContainer:$.orgNode.isContainer,lineNumber:$.orgNode.lineNumber,...q!==void 0&&{color:q},x:$.cx+A,y:$.cy+C,width:$.width,height:$.height,...U!==void 0&&{hiddenCount:U},...et!==void 0&&{hasChildren:et}})}let w=new Map;for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode,X=$.data.width,q=$.data.height,et=$.x+A,tt=$.y+C,F=e?.get(U.id),Q=bf(U.metadata,r);if(!U.isContainer&&i&&!(F!=null&&F>0)){let nt=Kh(U,e);nt>0&&(Q[M]=String(nt))}let ot=qh(U,t.tagGroups,n??null),Z=$.children!=null&&$.children.length>0||F!=null&&F>0||void 0;E.push({id:U.id,label:U.label,metadata:Q,tagMetadata:{...U.metadata},isContainer:U.isContainer,lineNumber:U.lineNumber,...ot!==void 0&&{color:ot},x:et,y:tt,width:X,height:q,...F!==void 0&&{hiddenCount:F},...Z!==void 0&&{hasChildren:Z}});let lt=$.parent?.data.orgNode.isContainer&&$.parent.children&&$.parent.children.length>0;if($.parent&&$.parent.data.orgNode.id!=="__virtual_root__"&&!lt){let nt=$.parent.data.orgNode.id;if(!w.has(nt)){let J=$.parent.x+A,at=$.parent.y+C,it=$.parent.data.height;w.set(nt,{parentX:J,parentBottomY:at+it,children:[]})}w.get(nt).children.push({id:U.id,x:et,topY:tt})}}for(let[$,U]of w){let{parentX:X,parentBottomY:q,children:et}=U;if(et.length===1){let tt=et[0],F=(q+tt.topY)/2;y.push({sourceId:$,targetId:tt.id,points:[{x:X,y:q},{x:X,y:F},{x:tt.x,y:F},{x:tt.x,y:tt.topY}]})}else{let tt=(q+et[0].topY)/2,F=et.map(Z=>Z.x),Q=Math.min(...F),ot=Math.max(...F);y.push({sourceId:$,targetId:$,points:[{x:X,y:q},{x:X,y:tt}]}),y.push({sourceId:$,targetId:$,points:[{x:Q,y:tt},{x:ot,y:tt}]});for(let Z of et)y.push({sourceId:$,targetId:Z.id,points:[{x:Z.x,y:tt},{x:Z.x,y:Z.topY}]})}}let k=h.descendants().filter($=>$.data.orgNode.id!=="__virtual_root__"&&$.data.orgNode.isContainer),N=new Map,_=[],T=60;for(let $ of k){if($.children&&$.children.length>0)continue;let U=$.x+A,X=$.y+C,q=Object.keys($.data.orgNode.metadata).length,et=IE+q*PE,tt=$.data.width,F=Math.max(et+WI,T),Q=U-tt/2,ot=X;N.set($.data.orgNode.id,{minX:Q,maxX:Q+tt,minY:ot,maxY:ot+F});let Z=e?.get($.data.orgNode.id),lt=bf($.data.orgNode.metadata,r),nt=qh($.data.orgNode,t.tagGroups,n??null),J=Z!=null&&Z>0||void 0;_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...nt!==void 0&&{color:nt},metadata:lt,tagMetadata:{...$.data.orgNode.metadata},x:Q,y:ot,width:tt,height:F,labelHeight:et,...Z!==void 0&&{hiddenCount:Z},...J!==void 0&&{hasChildren:J}})}let R=k.filter($=>$.children&&$.children.length>0);R.sort(($,U)=>U.depth-$.depth);for(let $ of R){let U=[],X=pt=>{if(pt.children)for(let ht of pt.children)U.push(ht),X(ht)};if(X($),U.length===0)continue;let q=1/0,et=-1/0,tt=-1/0;for(let pt of U){let ht=N.get(pt.data.orgNode.id);if(ht)ht.minX<q&&(q=ht.minX),ht.maxX>et&&(et=ht.maxX),ht.maxY>tt&&(tt=ht.maxY);else if(pt.data.orgNode.id.startsWith("__stack_")){let dt=pt.data.orgNode.id.replace("__stack_","");if(p.get(dt))for(let yt of v){if(yt.orgNode.parentId!==dt)continue;let kt=yt.cx+A,Ot=yt.cy+C;kt-yt.width/2<q&&(q=kt-yt.width/2),kt+yt.width/2>et&&(et=kt+yt.width/2),Ot+yt.height>tt&&(tt=Ot+yt.height)}}else{let dt=pt.data.width,ut=pt.data.height,yt=pt.x+A,kt=pt.y+C;yt-dt/2<q&&(q=yt-dt/2),yt+dt/2>et&&(et=yt+dt/2),kt+ut>tt&&(tt=kt+ut)}}let F=$.x+A,Q=$.y+C,ot=Object.keys($.data.orgNode.metadata).length,Z=IE+ot*PE,lt=Q,nt=tt-Q+WI,J=q-jh,at=et-q+jh*2,it=Math.max(at,$.data.width),vt=it>at?F-it/2:J;N.set($.data.orgNode.id,{minX:vt,maxX:vt+it,minY:lt,maxY:lt+nt});let Tt=e?.get($.data.orgNode.id),At=bf($.data.orgNode.metadata,r),rt=qh($.data.orgNode,t.tagGroups,n??null);_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...rt!==void 0&&{color:rt},metadata:At,tagMetadata:{...$.data.orgNode.metadata},x:vt,y:lt,width:it,height:nt,labelHeight:Z,...Tt!==void 0&&{hiddenCount:Tt},hasChildren:!0})}_.reverse();let G=b,I=S,H=L;for(let $ of _){let U=$.x-A,X=U+$.width,q=$.y-C+$.height;U<G&&(G=U),X>I&&(I=X),q>H&&(H=q)}let O=I-G+ei*2,D=H-x+ei*2,W=new Map;for(let $ of t.tagGroups){let U=qt($.name),X=new Set,q=et=>{!et.isContainer&&et.metadata[U]&&X.add(et.metadata[U].toLowerCase());for(let tt of et.children)q(tt)};for(let et of t.roots)q(et);W.set(U,X)}let z=r!==void 0,P=FI(t.tagGroups,z,W),B=O,Y=D,V=n!=null?P.filter($=>$.name.toLowerCase()===n.toLowerCase()):P,j=o&&n==null,K=$=>n!=null||j?$.width:$.minifiedWidth;if(V.length>0){let $=Se+Wn;for(let et of E)et.y+=$;for(let et of _)et.y+=$;for(let et of y)for(let tt of et.points)tt.y+=$;let U=V.reduce((et,tt)=>et+K(tt),0)+(V.length-1)*Wn,X=ei;for(let et of V)et.x=X,et.y=ei,X+=K(et)+Wn;Y+=$;let q=U+ei*2;q>B&&(B=q)}return{nodes:E,edges:y,containers:_,legend:P,width:B,height:Y}}var _j,Aj,Rj,GI,Ij,Pj,$I,Dj,HI,RE,ei,jh,WI,IE,PE,BI,OE=st(()=>{"use strict";Ke();Xh();Ke();Mr();en();_j=13,Aj=11,Rj=16,GI=28,Ij=6,Pj=20,$I=10,Dj=140,HI=30,RE=50,ei=40,jh=24,WI=24,IE=28,PE=16,BI=20});function XI(t,e){let n=0;for(let r of e.getChildren(t))n+=(e.countsAsHidden(r)?1:0)+XI(r,e);return n}function jI(t,e,n,r){for(let o of t){let a=r.getChildren(o);e.has(r.getId(o))&&a.length>0&&n.set(r.getId(o),XI(o,r)),jI(a,e,n,r)}}function qI(t,e,n){for(let r of n.getChildren(t))qI(r,e,n);e.has(n.getId(t))&&n.getChildren(t).length>0&&n.setChildren(t,[])}function ld(t,e,n){let r=new Map;jI(t,e,r,n);let o=t.map(a=>n.clone(a));for(let a of o)qI(a,e,n);return{roots:o,hiddenCounts:r}}function KI(t,e){let n=new Set,r=o=>{for(let a of o)n.add(e.getId(a)),r(e.getChildren(a))};return r(t),n}var xf=st(()=>{"use strict"});var QI={};ye(QI,{collapseOrgTree:()=>Wj,focusOrgTree:()=>Bj});function Zh(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(Zh),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function Wj(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=ld(t.roots,e,Hj);return{parsed:{...t,roots:n},hiddenCounts:r}}function ZI(t,e,n){for(let r of t){if(r.id===e)return{node:r,path:n};let o=ZI(r.children,e,[...n,{id:r.id,label:r.label,lineNumber:r.lineNumber,...r.color!==void 0&&{color:r.color},metadata:{...r.metadata},isContainer:r.isContainer}]);if(o)return o}return null}function Bj(t,e){let n=ZI(t.roots,e,[]);if(!n)return null;if(t.roots.some(a=>a.id===e))return{parsed:{...t,roots:[Zh(n.node)]},ancestorPath:[]};let o=Zh(n.node);return o.parentId=null,{parsed:{...t,roots:[o]},ancestorPath:n.path}}var Hj,JI=st(()=>{"use strict";xf();Hj={getId:t=>t.id,getChildren:t=>t.children,clone:Zh,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer}});function cd(t,e,n){let r=document.createElement("div");r.style.width=`${t}px`,r.style.height=`${e}px`,r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);try{return n(r)}finally{document.body.removeChild(r)}}function dd(t,e){let n=t.querySelector("svg");return n?(e==="transparent"&&(n.style.background="none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.fontFamily=It,n.querySelectorAll("[data-export-ignore]").forEach(r=>r.remove()),n.outerHTML):""}var Qh=st(()=>{"use strict";on()});var aP={};ye(aP,{renderOrg:()=>oP,renderOrgForExport:()=>Jj});function Zj(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function tP(t,e){return e??t.primary}function Qj(t,e,n){return n?Gt(n,nr(t,e),10):Gt(t.surface,t.bg,40)}function eP(t,e){return e??t.textMuted}function oP(t,e,n,r,o,a,i,s,l,c,d){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let u=i?.width??t.clientWidth,f=i?.height??t.clientHeight;if(u<=0||f<=0)return;let p=Ee.identity(),m=p.aesthetic(GE),h=p.structural(rP),g=p.text(13),E=p.text(11),y=p.structural(16),b=p.structural(28),S=p.structural(6),x=p.structural(1.5),L=p.structural(1.5),v=p.structural(6),A=p.structural(8),C=p.text(13),M=p.text(11),w=p.structural(16),k=p.structural(28),N=p.structural(6),_=p.structural(0),T=p.structural(Uj),R=p.text(Xj),G=p.structural(jj),I=p.structural(qj),H=p.aesthetic(Kj),O=!!e.title&&e.options["no-title"]!=="on",D=O?h:0,W=n.nodes.length===0,z=n.legend.length>0,P=Se+Wn,B=!i&&z&&!W,Y=B?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Mo+Ei},u)+H:0,V=!i&&O,j=V?h:0,K=!i&&c&&c.length>0,$=K?c.length*G+I:0,U=n.width,X=n.height+(V?0:D)+$;B&&(X-=P);let q=f-m*2-Y-j,et=(u-m*2)/U,tt=q/X,F=Math.min(Vj,et,tt),Q=U*F,ot=(u-Q)/2,Z=B?m+Y+j:m+j,lt=Rt(t).append("svg").attr("width",u).attr("height",f).attr("viewBox",`0 0 ${u} ${f}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);p.isBelowFloor&&lt.attr("width","100%");let nt=lt.append("g").attr("transform",`translate(${ot}, ${Z}) scale(${F})`);if(O){let rt=V?lt:nt,pt=V?u/2:U/2,ht=V?m+20:20,dt=rt.append("text").attr("x",pt).attr("y",ht).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",20).attr("font-weight","700").attr("class","org-title chart-title").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(dt.attr("data-line-number",e.titleLineNumber),a&&dt.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let J=(V?0:D)+$,at=nt.append("g").attr("transform",`translate(0, ${J})`),it=new Map;for(let rt of e.tagGroups)it.set(qt(rt.name),rt.name);let vt=new Set(e.roots.map(rt=>rt.id)),Tt=e.options?.color==="off";for(let rt of n.containers){let pt=at.append("g").attr("transform",`translate(${rt.x}, ${rt.y})`).attr("class","org-container").attr("data-line-number",String(rt.lineNumber));if(s){let yt=qt(s),kt=rt.tagMetadata[yt];kt&&pt.attr(`data-tag-${yt}`,kt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let ht=Qj(r,o,Tt?void 0:rt.color),dt=eP(r,Tt?void 0:rt.color);pt.append("rect").attr("x",0).attr("y",0).attr("width",rt.width).attr("height",rt.height).attr("rx",A).attr("fill",ht).attr("stroke",dt).attr("stroke-opacity",.35).attr("stroke-width",L),pt.append("text").attr("x",rt.width/2).attr("y",k/2+C/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",C).attr("font-weight","bold").text(rt.label);let ut=Object.entries(rt.metadata);if(ut.length>0){let yt=ut.map(([bt])=>it.get(bt)??bt),Ot=10+Math.max(...yt.map(bt=>_t(`${bt}: `,M))),Xt=k+M-2;for(let bt=0;bt<ut.length;bt++){let[,Nt]=ut[bt],Vt=yt[bt],xt=Xt+bt*w;pt.append("text").attr("x",10).attr("y",xt).attr("fill",r.textMuted).attr("font-size",M).text(`${Vt}: `),pt.append("text").attr("x",Ot).attr("y",xt).attr("fill",r.text).attr("font-size",M).text(Nt)}}if(!i&&rt.hiddenCount&&rt.hiddenCount>0&&cE(pt,{width:rt.width,height:rt.height,barHeight:N,inset:_,rx:A,fill:eP(r,Tt?void 0:rt.color),clipId:`clip-${rt.nodeId}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!vt.has(rt.nodeId)){let Ot=rt.width-14-5,bt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.nodeId).attr("data-export-ignore","true").attr("transform",`translate(${Ot}, 5)`);bt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let Nt=ve(ht,r.textOnFillLight,r.textOnFillDark),Vt=14/2,xt=14/2;bt.append("circle").attr("cx",Vt).attr("cy",xt).attr("r",14/2-1).attr("fill","none").attr("stroke",Nt).attr("stroke-width",1.5),bt.append("circle").attr("cx",Vt).attr("cy",xt).attr("r",2).attr("fill",Nt)}}for(let rt of n.edges){if(rt.points.length<2)continue;let pt=[];pt.push(`M ${rt.points[0].x} ${rt.points[0].y}`);for(let ht=1;ht<rt.points.length;ht++)pt.push(`L ${rt.points[ht].x} ${rt.points[ht].y}`);at.append("path").attr("d",pt.join(" ")).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",x).attr("class","org-edge").attr("data-from",rt.sourceId).attr("data-to",rt.targetId)}let At=new Set(n.containers.map(rt=>rt.nodeId));for(let rt of n.nodes){if(At.has(rt.id))continue;let pt=at.append("g").attr("transform",`translate(${rt.x-rt.width/2}, ${rt.y})`).attr("class","org-node").attr("data-line-number",String(rt.lineNumber)).attr("data-node-id",rt.id);if(s){let Ot=qt(s),Xt=rt.tagMetadata[Ot];Xt&&pt.attr(`data-tag-${Ot}`,Xt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let ht=e.options["solid-fill"]==="on",dt=Zj(r,o,Tt?void 0:rt.color,ht),ut=tP(r,Tt?void 0:rt.color),yt=ve(dt,r.textOnFillLight,r.textOnFillDark),kt=Object.entries(rt.metadata);if(od(pt,{width:rt.width,height:rt.height,rx:v,fill:dt,stroke:ut,strokeWidth:L,...rt.isContainer&&{dashed:!0},label:rt.label,labelColor:yt,labelFontSize:g,headerHeight:b,...kt.length>0&&{meta:{rows:kt.map(([Ot,Xt])=>[it.get(Ot)??Ot,Xt]),fontSize:E,lineHeight:y,separatorGap:S,separatorColor:ht?yt:ut,textColor:yt}}}),!i&&rt.hiddenCount&&rt.hiddenCount>0&&cE(pt,{width:rt.width,height:rt.height,barHeight:N,inset:_,rx:v,fill:ht?yt:tP(r,Tt?void 0:rt.color),clipId:`clip-${rt.id}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!vt.has(rt.id)){let bt=rt.width-14-5,Vt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.id).attr("data-export-ignore","true").attr("transform",`translate(${bt}, 5)`);Vt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let xt=yt,Lt=14/2,Dt=14/2;Vt.append("circle").attr("cx",Lt).attr("cy",Dt).attr("r",14/2-1).attr("fill","none").attr("stroke",xt).attr("stroke-width",1.5),Vt.append("circle").attr("cx",Lt).attr("cy",Dt).attr("r",2).attr("fill",xt)}}if(K){let rt=n.nodes.find(ut=>vt.has(ut.id)),pt=rt?null:n.containers.find(ut=>vt.has(ut.nodeId)),ht=rt?rt.x:pt?pt.x+pt.width/2:null,dt=rt?rt.y:pt?pt.y:null;if(ht!==null&&dt!==null){let ut=dt-I,yt=at.append("g").attr("class","org-ancestor-trail"),kt=c.length,Ot=[];for(let bt=0;bt<kt;bt++){let Nt=kt-1-bt;Ot.push(ut-Nt*G)}let Xt=Ot[0];yt.append("line").attr("x1",ht).attr("y1",Xt).attr("x2",ht).attr("y2",dt).attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.4);for(let bt=0;bt<kt;bt++){let Nt=c[bt],Vt=Ot[bt],Lt=Nt.color??ar(Nt.metadata,[...e.tagGroups],s??null,Nt.isContainer)??r.textMuted,Dt=yt.append("g").attr("class","org-ancestor-node").attr("data-focus-ancestor",Nt.id).style("cursor","pointer").attr("transform",`translate(${ht}, ${Vt})`);Dt.append("rect").attr("x",-T-2).attr("y",-T-2).attr("width",120).attr("height",T*2+4).attr("fill","transparent"),Dt.append("circle").attr("cx",0).attr("cy",0).attr("r",T).attr("fill",Lt),Dt.append("text").attr("x",T+6).attr("y",R*.35).attr("fill",r.textMuted).attr("font-size",R).text(Nt.label),Dt.on("mouseenter",function(){Rt(this).select("circle").attr("r",T+1),Rt(this).select("text").attr("fill",r.text)}).on("mouseleave",function(){Rt(this).select("circle").attr("r",T),Rt(this).select("text").attr("fill",r.textMuted)})}}}if(B||W||i&&z){let rt=n.legend.map(ut=>({name:ut.name,entries:ut.entries.map(yt=>({value:yt.value,color:yt.color}))})),pt=B?Mo+Ei:0,ht=B?lt.append("g").attr("class","org-legend-fixed").attr("transform",`translate(0, ${m+j})`):at.append("g"),dt;if(W){for(let ut of n.legend){let yt={groups:[{name:ut.name,entries:ut.entries.map(Ot=>({value:Ot.value,color:Ot.color}))}],position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview"},kt=ht.append("g").attr("transform",`translate(${ut.x}, ${ut.y})`);fn(kt,{...yt,palette:r,isDark:o,width:ut.width,activeGroup:ut.name}),kt.selectAll("[data-legend-group]").classed("org-legend-group",!0)}dt=null}else dt=fn(ht,{...{groups:rt,position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview",capsulePillAddonWidth:pt},palette:r,isDark:o,width:B?u:n.width,activeGroup:s??null}),ht.selectAll("[data-legend-group]").classed("org-legend-group",!0);if(B&&dt){let ut=dt.getLayout();if(ut.activeCapsule?.addonX!=null){let yt=ut.activeCapsule,kt=qt(yt.groupName),Ot=l?.has(kt)??!1,Xt=ht.select(`[data-legend-group="${kt}"]`);if(!Xt.empty()){let bt=yt.addonX,Nt=(Se-Mo)/2,Vt=6,xt=Xt.append("g").attr("class","org-legend-eye").attr("data-legend-visibility",kt).style("cursor","pointer").attr("opacity",Ot?.4:.7);xt.append("rect").attr("x",bt-Vt).attr("y",Nt-Vt).attr("width",Mo+Vt*2).attr("height",Mo+Vt*2).attr("fill","transparent").attr("pointer-events","all"),xt.append("path").attr("d",Ot?Gm:Om).attr("transform",`translate(${bt}, ${Nt})`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}}function Jj(t,e,n){let r=Vc(t,n);if(r.error)return"";let o=r.options?.hide,a=o?new Set(o.split(",").map(u=>u.trim().toLowerCase())):void 0,i=DE(r,void 0,void 0,a),s=e==="dark",l=r.title&&r.options["no-title"]!=="on"?rP:0,c=i.width+GE*2,d=i.height+GE*2+l;return cd(c,d,u=>(oP(u,r,i,n,s,void 0,{width:c,height:d}),dd(u,e)))}var GE,Vj,rP,Uj,Xj,jj,qj,Kj,iP=st(()=>{"use strict";Ke();Xn();on();Qh();fr();tn();Ke();tf();OE();Mr();Br();Oh();en();To();GE=20,Vj=3,rP=30,Uj=4,Xj=11,jj=22,qj=16,Kj=8});function sP(t,e){t[e]?t[e]++:t[e]=1}function lP(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function wf(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let i=o;o=a,a=i}return o+""+a+""+(r===void 0?"\0":r)}function oq(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let s=o;o=a,a=s}let i={v:o,w:a};return r&&(i.name=r),i}function WE(t,e){return wf(t,e.v,e.w,e.name)}function iq(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:sq(t),edges:lq(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function sq(t){return t.nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function lq(t){return t.edges().map(e=>{let n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function cq(t){let e=new Na(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}function kP(t,e,n,r){return uq(t,String(e),n||dq,r||function(o){return t.outEdges(o)})}function uq(t,e,n,r){let o={},a,i=0,s=t.nodes(),l=function(u){let f=n(u);o[u.v].distance+f<o[u.w].distance&&(o[u.w]={distance:o[u.v].distance+f,predecessor:u.v},a=!0)},c=function(){s.forEach(function(u){r(u).forEach(function(f){let p=f.v===u?f.v:f.w,m=p===f.v?f.w:f.v;l({v:p,w:m})})})};s.forEach(function(u){let f=u===e?0:Number.POSITIVE_INFINITY;o[u]={distance:f,predecessor:""}});let d=s.length;for(let u=1;u<d&&(a=!1,i++,c(),!!a);u++);if(i===d-1&&(a=!1,c(),a))throw new Error("The graph contains a negative weight cycle");return o}function fq(t){let e={},n=[],r;function o(a){a in e||(e[a]=!0,r.push(a),t.successors(a).forEach(o),t.predecessors(a).forEach(o))}return t.nodes().forEach(function(a){r=[],o(a),r.length&&n.push(r)}),n}function tg(t,e,n,r){let o=function(a){return t.outEdges(a)};return mq(t,String(e),n||pq,r||o)}function mq(t,e,n,r){let o={},a=new LP,i,s,l=function(c){let d=c.v!==i?c.v:c.w,u=o[d],f=n(c),p=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+c+" Weight: "+f);p<u.distance&&(u.distance=p,u.predecessor=i,a.decrease(d,p))};for(t.nodes().forEach(function(c){let d=c===e?0:Number.POSITIVE_INFINITY;o[c]={distance:d,predecessor:""},a.add(c,d)});a.size()>0&&(i=a.removeMin(),s=o[i],s.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}function hq(t,e,n){return t.nodes().reduce(function(r,o){return r[o]=tg(t,o,e,n),r},{})}function NP(t){let e=0,n=[],r={},o=[];function a(i){let s=r[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(l){l in r?r[l].onStack&&(s.lowlink=Math.min(s.lowlink,r[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,r[l].lowlink))}),s.lowlink===s.index){let l=[],c;do c=n.pop(),r[c].onStack=!1,l.push(c);while(i!==c);o.push(l)}}return t.nodes().forEach(function(i){i in r||a(i)}),o}function gq(t){return NP(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}function bq(t,e,n){return xq(t,e||yq,n||function(r){return t.outEdges(r)})}function xq(t,e,n){let r={},o=t.nodes();return o.forEach(function(a){r[a]={},r[a][a]={distance:0,predecessor:""},o.forEach(function(i){a!==i&&(r[a][i]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(i){let s=i.v===a?i.w:i.v,l=e(i);r[a][s]={distance:l,predecessor:a}})}),o.forEach(function(a){let i=r[a];o.forEach(function(s){let l=r[s];o.forEach(function(c){let d=l[a],u=i[c],f=l[c],p=d.distance+u.distance;p<f.distance&&(f.distance=p,f.predecessor=u.predecessor)})})}),r}function MP(t){let e={},n={},r=[];function o(a){if(a in n)throw new eg;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(o),delete n[a],r.push(a))}if(t.sinks().forEach(o),Object.keys(e).length!==t.nodeCount())throw new eg;return r}function wq(t){try{MP(t)}catch(e){if(e instanceof eg)return!1;throw e}return!0}function Eq(t,e,n,r,o){Array.isArray(e)||(e=[e]);let a=(s=>{var l;return(l=t.isDirected()?t.successors(s):t.neighbors(s))!=null?l:[]}),i={};return e.forEach(function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);o=TP(t,s,n==="post",i,a,r,o)}),o}function TP(t,e,n,r,o,a,i){return e in r||(r[e]=!0,n||(i=a(i,e)),o(e).forEach(function(s){i=TP(t,s,n,r,o,a,i)}),n&&(i=a(i,e))),i}function CP(t,e,n){return Eq(t,e,n,function(r,o){return r.push(o),r},[])}function Sq(t,e){return CP(t,e,"post")}function vq(t,e){return CP(t,e,"pre")}function kq(t,e){let n=new Na,r={},o=new LP,a;function i(l){let c=l.v===a?l.w:l.v,d=o.priority(c);if(d!==void 0){let u=e(l);u<d&&(r[c]=a,o.decrease(c,u))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(l){o.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),o.decrease(t.nodes()[0],0);let s=!1;for(;o.size()>0;){if(a=o.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(a).forEach(i)}return n}function Lq(t,e,n,r){return Nq(t,e,n,r??(o=>{let a=t.outEdges(o);return a??[]}))}function Nq(t,e,n,r){if(n===void 0)return tg(t,e,n,r);let o=!1,a=t.nodes();for(let i=0;i<a.length;i++){let s=r(a[i]);for(let l=0;l<s.length;l++){let c=s[l],d=c.v===a[i]?c.v:c.w,u=d===c.v?c.w:c.v;n({v:d,w:u})<0&&(o=!0)}if(o)return kP(t,e,n,r)}return tg(t,e,n,r)}function md(t,e,n,r){let o=r;for(;t.hasNode(o);)o=jE(r);return n.dummy=e,t.setNode(o,n),o}function Mq(t){let e=new Na().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},o=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),e}function _P(t){let e=new Na({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function cP(t,e){let n=t.x,r=t.y,o=e.x-n,a=e.y-r,i=t.width/2,s=t.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let l,c;return Math.abs(a)*i>Math.abs(o)*s?(a<0&&(s=-s),l=s*o/a,c=s):(o<0&&(i=-i),l=i,c=i*a/o),{x:n+l,y:r+c}}function Sf(t){let e=Ef(RP(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),o=r.rank;o!==void 0&&(e[o]||(e[o]=[]),e[o][r.order]=n)}),e}function Tq(t){let e=t.nodes().map(r=>{let o=t.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Ii(Math.min,e);t.nodes().forEach(r=>{let o=t.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Cq(t){let e=t.nodes().map(i=>t.node(i).rank).filter(i=>i!==void 0),n=Ii(Math.min,e),r=[];t.nodes().forEach(i=>{let s=t.node(i).rank-n;r[s]||(r[s]=[]),r[s].push(i)});let o=0,a=t.graph().nodeRankFactor;Array.from(r).forEach((i,s)=>{i===void 0&&s%a!==0?--o:i!==void 0&&o&&i.forEach(l=>t.node(l).rank+=o)})}function dP(t,e,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),md(t,"border",o,e)}function _q(t,e=AP){let n=[];for(let r=0;r<t.length;r+=e){let o=t.slice(r,r+e);n.push(o)}return n}function Ii(t,e){if(e.length>AP){let n=_q(e);return t(...n.map(r=>t(...r)))}else return t(...e)}function RP(t){let e=t.nodes().map(n=>{let r=t.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Ii(Math.max,e)}function Aq(t,e){let n={lhs:[],rhs:[]};return t.forEach(r=>{e(r)?n.lhs.push(r):n.rhs.push(r)}),n}function IP(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function PP(t,e){return e()}function jE(t){let e=++Rq;return t+(""+e)}function Ef(t,e,n=1){e==null&&(e=t,t=0);let r=a=>a<e;n<0&&(r=a=>e<a);let o=[];for(let a=t;r(a);a+=n)o.push(a);return o}function ng(t,e){let n={};for(let r of e)t[r]!==void 0&&(n[r]=t[r]);return n}function rg(t,e){let n;return typeof e=="string"?n=r=>r[e]:n=e,Object.entries(t).reduce((r,[o,a])=>(r[o]=n(a,o),r),{})}function Iq(t,e){return t.reduce((n,r,o)=>(n[r]=e[o],n),{})}function uP(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Oq(t,e){if(t!=="_next"&&t!=="_prev")return e}function Hq(t,e){if(t.nodeCount()<=1)return[];let n=Bq(t,e||$q);return Wq(n.graph,n.buckets,n.zeroIdx).flatMap(r=>t.outEdges(r.v,r.w)||[])}function Wq(t,e,n){var r;let o=[],a=e[e.length-1],i=e[0],s;for(;t.nodeCount();){for(;s=i.dequeue();)BE(t,e,n,s);for(;s=a.dequeue();)BE(t,e,n,s);if(t.nodeCount()){for(let l=e.length-2;l>0;--l)if(s=(r=e[l])==null?void 0:r.dequeue(),s){o=o.concat(BE(t,e,n,s,!0)||[]);break}}}return o}function BE(t,e,n,r,o){let a=[],i=o?a:void 0;return(t.inEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=t.node(s.v);o&&a.push({v:s.v,w:s.w}),c.out-=l,UE(e,n,c)}),(t.outEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=s.w,d=t.node(c);d.in-=l,UE(e,n,d)}),t.removeNode(r.v),i}function Bq(t,e){let n=new Na,r=0,o=0;t.nodes().forEach(s=>{n.setNode(s,{v:s,in:0,out:0})}),t.edges().forEach(s=>{let l=n.edge(s.v,s.w)||0,c=e(s),d=l+c;n.setEdge(s.v,s.w,d);let u=n.node(s.v),f=n.node(s.w);o=Math.max(o,u.out+=c),r=Math.max(r,f.in+=c)});let a=Fq(o+r+3).map(()=>new Gq),i=r+1;return n.nodes().forEach(s=>{UE(a,i,n.node(s))}),{graph:n,buckets:a,zeroIdx:i}}function UE(t,e,n){var r,o,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(o=t[t.length-1])==null||o.enqueue(n):(r=t[0])==null||r.enqueue(n)}function Fq(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function Yq(t){(t.graph().acyclicer==="greedy"?Hq(t,e(t)):zq(t)).forEach(n=>{let r=t.edge(n);t.removeEdge(n),r.forwardName=n.name,r.reversed=!0,t.setEdge(n.w,n.v,r,jE("rev"))});function e(n){return r=>n.edge(r).weight}}function zq(t){let e=[],n={},r={};function o(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,t.outEdges(a).forEach(i=>{Object.hasOwn(n,i.w)?e.push(i):o(i.w)}),delete n[a])}return t.nodes().forEach(o),e}function Vq(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}function Uq(t){t.graph().dummyChains=[],t.edges().forEach(e=>Xq(t,e))}function Xq(t,e){let n=e.v,r=t.node(n).rank,o=e.w,a=t.node(o).rank,i=e.name,s=t.edge(e),l=s.labelRank;if(a===r+1)return;t.removeEdge(e);let c,d,u;for(u=0,++r;r<a;++u,++r)s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:r},c=md(t,"edge",d,"_d"),r===l&&(d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos),t.setEdge(n,c,{weight:s.weight},i),u===0&&t.graph().dummyChains.push(c),n=c;t.setEdge(n,o,{weight:s.weight},i)}function jq(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeLabel,o;for(t.setEdge(n.edgeObj,r);n.dummy;)o=t.successors(e)[0],t.removeNode(e),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),e=o,n=t.node(e)})}function qE(t){let e={};function n(r){let o=t.node(r);if(Object.hasOwn(e,r))return o.rank;e[r]=!0;let a=t.outEdges(r),i=a?a.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-t.edge(l).minlen):[],s=Ii(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}t.sources().forEach(n)}function pd(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function qq(t){let e=new Na({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=t.nodeCount();e.setNode(r,{});let a,i;for(;Kq(e,t)<o&&(a=Zq(e,t),!!a);)i=e.hasNode(a.v)?pd(t,a):-pd(t,a),Qq(e,t,i);return e}function Kq(t,e){function n(r){let o=e.nodeEdges(r);o&&o.forEach(a=>{let i=a.v,s=r===i?a.w:i;!t.hasNode(s)&&!pd(e,a)&&(t.setNode(s,{}),t.setEdge(r,s,{}),n(s))})}return t.nodes().forEach(n),t.nodeCount()}function Zq(t,e){return e.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(o=pd(e,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function Qq(t,e,n){t.nodes().forEach(r=>e.node(r).rank+=n)}function Vl(t){t=Mq(t),qE(t);let e=DP(t);ZE(e),KE(e,t);let n,r;for(;n=$P(e);)r=HP(e,t,n),WP(e,t,n,r)}function KE(t,e){let n=tK(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(r=>nK(t,e,r))}function nK(t,e,n){let r=t.node(n).parent,o=t.edge(n,r);o.cutvalue=OP(t,e,n)}function OP(t,e,n){let r=t.node(n).parent,o=!0,a=e.edge(n,r),i=0;a||(o=!1,a=e.edge(r,n)),i=a.weight;let s=e.nodeEdges(n);return s&&s.forEach(l=>{let c=l.v===n,d=c?l.w:l.v;if(d!==r){let u=c===o,f=e.edge(l).weight;if(i+=u?f:-f,oK(t,n,d)){let p=t.edge(n,d).cutvalue;i+=u?-p:p}}}),i}function ZE(t,e){arguments.length<2&&(e=t.nodes()[0]),GP(t,{},1,e)}function GP(t,e,n,r,o){let a=n,i=t.node(r);e[r]=!0;let s=t.neighbors(r);return s&&s.forEach(l=>{Object.hasOwn(e,l)||(n=GP(t,e,n,l,r))}),i.low=a,i.lim=n++,o?i.parent=o:delete i.parent,n}function $P(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function HP(t,e,n){let r=n.v,o=n.w;e.hasEdge(r,o)||(r=n.w,o=n.v);let a=t.node(r),i=t.node(o),s=a,l=!1;return a.lim>i.lim&&(s=i,l=!0),e.edges().filter(c=>l===fP(t,t.node(c.v),s)&&l!==fP(t,t.node(c.w),s)).reduce((c,d)=>pd(e,d)<pd(e,c)?d:c)}function WP(t,e,n,r){let o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),ZE(t),KE(t,e),rK(t,e)}function rK(t,e){let n=t.nodes().find(o=>!t.node(o).parent);if(!n)return;let r=Jq(t,[n]);r=r.slice(1),r.forEach(o=>{let a=t.node(o).parent,i=e.edge(o,a),s=!1;i||(i=e.edge(a,o),s=!0),e.node(o).rank=e.node(a).rank+(s?i.minlen:-i.minlen)})}function oK(t,e,n){return t.hasEdge(e,n)}function fP(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function iK(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":pP(t);break;case"tight-tree":lK(t);break;case"longest-path":sK(t);break;case"none":break;default:pP(t)}}function lK(t){qE(t),DP(t)}function pP(t){eK(t)}function dK(t){let e=fK(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),o=r.edgeObj,a=uK(t,e,o.v,o.w),i=a.path,s=a.lca,l=0,c=i[l],d=!0;for(;n!==o.w;){if(r=t.node(n),d){for(;(c=i[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(i[l+1]).minRank<=r.rank;)l++;c=i[l]}c!==void 0&&t.setParent(n,c),n=t.successors(n)[0]}})}function uK(t,e,n,r){let o=[],a=[],i=Math.min(e[n].low,e[r].low),s=Math.max(e[n].lim,e[r].lim),l;l=n;do l=t.parent(l),o.push(l);while(l&&(e[l].low>i||s>e[l].lim));let c=l,d=r;for(;(d=t.parent(d))!==c;)a.push(d);return{path:o.concat(a.reverse()),lca:c}}function fK(t){let e={},n=0;function r(o){let a=n;t.children(o).forEach(r),e[o]={low:a,lim:n++}}return t.children(og).forEach(r),e}function pK(t){let e=md(t,"root",{},"_root"),n=mK(t),r=Object.values(n),o=Ii(Math.max,r)-1,a=2*o+1;t.graph().nestingRoot=e,t.edges().forEach(s=>t.edge(s).minlen*=a);let i=hK(t)+1;t.children(og).forEach(s=>BP(t,e,a,i,o,n,s)),t.graph().nodeRankFactor=a}function BP(t,e,n,r,o,a,i){var s;let l=t.children(i);if(!l.length){i!==e&&t.setEdge(e,i,{weight:0,minlen:n});return}let c=dP(t,"_bt"),d=dP(t,"_bb"),u=t.node(i);t.setParent(c,i),u.borderTop=c,t.setParent(d,i),u.borderBottom=d,l.forEach(f=>{var p;BP(t,e,n,r,o,a,f);let m=t.node(f),h=m.borderTop?m.borderTop:f,g=m.borderBottom?m.borderBottom:f,E=m.borderTop?r:2*r,y=h!==g?1:o-((p=a[i])!=null?p:0)+1;t.setEdge(c,h,{weight:E,minlen:y,nestingEdge:!0}),t.setEdge(g,d,{weight:E,minlen:y,nestingEdge:!0})}),t.parent(i)||t.setEdge(e,c,{weight:0,minlen:o+((s=a[i])!=null?s:0)})}function mK(t){let e={};function n(r,o){let a=t.children(r);a&&a.length&&a.forEach(i=>n(i,o+1)),e[r]=o}return t.children(og).forEach(r=>n(r,1)),e}function hK(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function gK(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}function bK(t){function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let a=o.minRank,i=o.maxRank+1;a<i;++a)mP(t,"borderLeft","_bl",n,o,a),mP(t,"borderRight","_br",n,o,a)}}t.children(og).forEach(e)}function mP(t,e,n,r,o,a){let i={width:0,height:0,rank:a,borderType:e},s=o[e][a-1],l=md(t,"border",i,n);o[e][a]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function xK(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&FP(t)}function wK(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&EK(t),(n==="lr"||n==="rl")&&(SK(t),FP(t))}function FP(t){t.nodes().forEach(e=>hP(t.node(e))),t.edges().forEach(e=>hP(t.edge(e)))}function hP(t){let e=t.width;t.width=t.height,t.height=e}function EK(t){t.nodes().forEach(e=>FE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(FE),Object.hasOwn(r,"y")&&FE(r)})}function FE(t){t.y=-t.y}function SK(t){t.nodes().forEach(e=>YE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(YE),Object.hasOwn(r,"x")&&YE(r)})}function YE(t){let e=t.x;t.x=t.y,t.y=e}function vK(t){let e={},n=t.nodes().filter(s=>!t.children(s).length),r=n.map(s=>t.node(s).rank),o=Ii(Math.max,r),a=Ef(o+1).map(()=>[]);function i(s){if(e[s])return;e[s]=!0;let l=t.node(s);a[l.rank].push(s);let c=t.successors(s);c&&c.forEach(i)}return n.sort((s,l)=>t.node(s).rank-t.node(l).rank).forEach(i),a}function kK(t,e){let n=0;for(let r=1;r<e.length;++r)n+=LK(t,e[r-1],e[r]);return n}function LK(t,e,n){let r=Iq(n,n.map((c,d)=>d)),o=e.flatMap(c=>{let d=t.outEdges(c);return d?d.map(u=>({pos:r[u.w],weight:t.edge(u).weight})).sort((u,f)=>u.pos-f.pos):[]}),a=1;for(;a<n.length;)a<<=1;let i=2*a-1;a-=1;let s=new Array(i).fill(0),l=0;return o.forEach(c=>{let d=c.pos+a;s[d]+=c.weight;let u=0;for(;d>0;)d%2&&(u+=s[d+1]),d=d-1>>1,s[d]+=c.weight;l+=c.weight*u}),l}function NK(t,e=[]){return e.map(n=>{let r=t.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((a,i)=>{let s=t.edge(i),l=t.node(i.v);return{sum:a.sum+s.weight*l.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function MK(t,e){let n={};t.forEach((o,a)=>{let i={indegree:0,in:[],out:[],vs:[o.v],i:a};o.barycenter!==void 0&&(i.barycenter=o.barycenter,i.weight=o.weight),n[o.v]=i}),e.edges().forEach(o=>{let a=n[o.v],i=n[o.w];a!==void 0&&i!==void 0&&(i.indegree++,a.out.push(i))});let r=Object.values(n).filter(o=>!o.indegree);return TK(r)}function TK(t){let e=[];function n(o){return a=>{a.merged||(a.barycenter===void 0||o.barycenter===void 0||a.barycenter>=o.barycenter)&&CK(o,a)}}function r(o){return a=>{a.in.push(o),--a.indegree===0&&t.push(a)}}for(;t.length;){let o=t.pop();e.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return e.filter(o=>!o.merged).map(o=>ng(o,["vs","i","barycenter","weight"]))}function CK(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}function _K(t,e){let n=Aq(t,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,u)=>u.i-d.i),a=[],i=0,s=0,l=0;r.sort(AK(!!e)),l=gP(a,o,l),r.forEach(d=>{l+=d.vs.length,a.push(d.vs),i+=d.barycenter*d.weight,s+=d.weight,l=gP(a,o,l)});let c={vs:a.flat(1)};return s&&(c.barycenter=i/s,c.weight=s),c}function gP(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}function AK(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function YP(t,e,n,r){let o=t.children(e),a=t.node(e),i=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};i&&(o=o.filter(f=>f!==i&&f!==s));let c=NK(t,o);c.forEach(f=>{if(t.children(f.v).length){let p=YP(t,f.v,n,r);l[f.v]=p,Object.hasOwn(p,"barycenter")&&IK(f,p)}});let d=MK(c,n);RK(d,l);let u=_K(d,r);if(i&&s){u.vs=[i,u.vs,s].flat(1);let f=t.predecessors(i);if(f&&f.length){let p=t.node(f[0]),m=t.predecessors(s),h=t.node(m[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+h.order)/(u.weight+2),u.weight+=2}}return u}function RK(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(r=>e[r]?e[r].vs:r)})}function IK(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function PK(t,e,n,r){r||(r=t.nodes());let o=DK(t),a=new Na({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(i=>t.node(i));return r.forEach(i=>{let s=t.node(i),l=t.parent(i);if(s.rank===e||s.minRank<=e&&e<=s.maxRank){a.setNode(i),a.setParent(i,l||o);let c=t[n](i);c&&c.forEach(d=>{let u=d.v===i?d.w:d.v,f=a.edge(u,i),p=f!==void 0?f.weight:0;a.setEdge(u,i,{weight:t.edge(d).weight+p})}),Object.hasOwn(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]})}}),a}function DK(t){let e;for(;t.hasNode(e=jE("_root")););return e}function OK(t,e,n){let r={},o;n.forEach(a=>{let i=t.parent(a),s,l;for(;i;){if(s=t.parent(i),s?(l=r[s],r[s]=i):(l=o,o=i),l&&l!==i){e.setEdge(l,i);return}i=s}})}function zP(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,zP);return}let n=RP(t),r=yP(t,Ef(1,n+1),"inEdges"),o=yP(t,Ef(n-1,-1,-1),"outEdges"),a=vK(t);if(bP(t,a),e.disableOptimalOrderHeuristic)return;let i=Number.POSITIVE_INFINITY,s,l=e.constraints||[];for(let c=0,d=0;d<4;++c,++d){GK(c%2?r:o,c%4>=2,l),a=Sf(t);let u=kK(t,a);u<i?(d=0,s=Object.assign({},a),i=u):u===i&&(s=structuredClone(a))}bP(t,s)}function yP(t,e,n){let r=new Map,o=(a,i)=>{r.has(a)||r.set(a,[]),r.get(a).push(i)};for(let a of t.nodes()){let i=t.node(a);if(typeof i.rank=="number"&&o(i.rank,a),typeof i.minRank=="number"&&typeof i.maxRank=="number")for(let s=i.minRank;s<=i.maxRank;s++)s!==i.rank&&o(s,a)}return e.map(function(a){return PK(t,a,n,r.get(a)||[])})}function GK(t,e,n){let r=new Na;t.forEach(function(o){n.forEach(s=>r.setEdge(s.left,s.right));let a=o.graph().root,i=YP(o,a,r,e);i.vs.forEach((s,l)=>o.node(s).order=l),OK(o,r,i.vs)})}function bP(t,e){Object.values(e).forEach(n=>n.forEach((r,o)=>t.node(r).order=o))}function $K(t,e){let n={};function r(o,a){let i=0,s=0,l=o.length,c=a[a.length-1];return a.forEach((d,u)=>{let f=WK(t,d),p=f?t.node(f).order:l;(f||d===c)&&(a.slice(s,u+1).forEach(m=>{let h=t.predecessors(m);h&&h.forEach(g=>{let E=t.node(g),y=E.order;(y<i||p<y)&&!(E.dummy&&t.node(m).dummy)&&VP(n,g,m)})}),s=u+1,i=p)}),a}return e.length&&e.reduce(r),n}function HK(t,e){let n={};function r(a,i,s,l,c){Ef(i,s).forEach(d=>{let u=a[d];if(u!==void 0&&t.node(u).dummy){let f=t.predecessors(u);f&&f.forEach(p=>{if(p===void 0)return;let m=t.node(p);m.dummy&&(m.order<l||m.order>c)&&VP(n,p,u)})}})}function o(a,i){let s=-1,l=-1,c=0;return i.forEach((d,u)=>{if(t.node(d).dummy==="border"){let f=t.predecessors(d);if(f&&f.length){let p=f[0];if(p===void 0)return;l=t.node(p).order,r(i,c,u,s,l),c=u,s=l}}r(i,c,i.length,l,a.length)}),i}return e.length&&e.reduce(o),n}function WK(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(r=>t.node(r).dummy)}}function VP(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];r||(t[e]=r={}),r[n]=!0}function BK(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];return r!==void 0&&Object.hasOwn(r,n)}function FK(t,e,n,r){let o={},a={},i={};return e.forEach(s=>{s.forEach((l,c)=>{o[l]=l,a[l]=l,i[l]=c})}),e.forEach(s=>{let l=-1;s.forEach(c=>{let d=r(c);if(d&&d.length){let u=d.sort((p,m)=>{let h=i[p],g=i[m];return(h!==void 0?h:0)-(g!==void 0?g:0)}),f=(u.length-1)/2;for(let p=Math.floor(f),m=Math.ceil(f);p<=m;++p){let h=u[p];if(h===void 0)continue;let g=i[h];if(g!==void 0&&a[c]===c&&l<g&&!BK(n,c,h)){let E=o[h];E!==void 0&&(a[h]=c,a[c]=o[c]=E,l=g)}}}})}),{root:o,align:a}}function YK(t,e,n,r,o=!1){let a={},i=zK(t,e,n,o),s=o?"borderLeft":"borderRight";function l(p,m){let h=i.nodes().slice(),g={},E=h.pop();for(;E;){if(g[E])p(E);else{g[E]=!0,h.push(E);for(let y of m(E))h.push(y)}E=h.pop()}}function c(p){let m=i.inEdges(p);m?a[p]=m.reduce((h,g)=>{var E;let y=(E=a[g.v])!=null?E:0,b=i.edge(g);return Math.max(h,y+(b!==void 0?b:0))},0):a[p]=0}function d(p){let m=i.outEdges(p),h=Number.POSITIVE_INFINITY;m&&(h=m.reduce((E,y)=>{let b=a[y.w],S=i.edge(y);return Math.min(E,(b!==void 0?b:0)-(S!==void 0?S:0))},Number.POSITIVE_INFINITY));let g=t.node(p);h!==Number.POSITIVE_INFINITY&&g.borderType!==s&&(a[p]=Math.max(a[p]!==void 0?a[p]:0,h))}function u(p){return i.predecessors(p)||[]}function f(p){return i.successors(p)||[]}return l(c,u),l(d,f),Object.keys(r).forEach(p=>{var m;let h=n[p];h!==void 0&&(a[p]=(m=a[h])!=null?m:0)}),a}function zK(t,e,n,r){let o=new Na,a=t.graph(),i=qK(a.nodesep,a.edgesep,r);return e.forEach(s=>{let l;s.forEach(c=>{let d=n[c];if(d!==void 0){if(o.setNode(d),l!==void 0){let u=n[l];if(u!==void 0){let f=o.edge(u,d);o.setEdge(u,d,Math.max(i(t,c,l),f||0))}}l=c}})}),o}function VK(t,e){return Object.values(e).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,l])=>{let c=KK(t,s)/2;o=Math.max(l+c,o),a=Math.min(l-c,a)});let i=o-a;return i<n[0]&&(n=[i,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function UK(t,e){let n=Object.values(e),r=Ii(Math.min,n),o=Ii(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(i=>{let s=a+i,l=t[s];if(!l||l===e)return;let c=Object.values(l),d=r-Ii(Math.min,c);i!=="l"&&(d=o-Ii(Math.max,c)),d&&(t[s]=rg(l,u=>u+d))})})}function XK(t,e=void 0){let n=t.ul;return n?rg(n,(r,o)=>{var a,i;if(e){let l=e.toLowerCase(),c=t[l];if(c&&c[o]!==void 0)return c[o]}let s=Object.values(t).map(l=>{let c=l[o];return c!==void 0?c:0}).sort((l,c)=>l-c);return(((a=s[1])!=null?a:0)+((i=s[2])!=null?i:0))/2}):{}}function jK(t){let e=Sf(t),n=Object.assign($K(t,e),HK(t,e)),r={},o;["u","d"].forEach(i=>{o=i==="u"?e:Object.values(e).reverse(),["l","r"].forEach(s=>{s==="r"&&(o=o.map(d=>Object.values(d).reverse()));let l=FK(t,o,n,d=>(i==="u"?t.predecessors(d):t.successors(d))||[]),c=YK(t,o,l.root,l.align,s==="r");s==="r"&&(c=rg(c,d=>-d)),r[i+s]=c})});let a=VK(t,r);return UK(r,a),XK(r,t.graph().align)}function qK(t,e,n){return(r,o,a)=>{let i=r.node(o),s=r.node(a),l=0,c;if(l+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":c=-i.width/2;break;case"r":c=i.width/2;break}if(c&&(l+=n?c:-c),c=void 0,l+=(i.dummy?e:t)/2,l+=(s.dummy?e:t)/2,l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=s.width/2;break;case"r":c=-s.width/2;break}return c&&(l+=n?c:-c),l}}function KK(t,e){return t.node(e).width}function ZK(t){t=_P(t),QK(t),Object.entries(jK(t)).forEach(([e,n])=>t.node(e).x=n)}function QK(t){let e=Sf(t),n=t.graph(),r=n.ranksep,o=n.rankalign,a=0;e.forEach(i=>{let s=i.reduce((l,c)=>{var d;let u=(d=t.node(c).height)!=null?d:0;return l>u?l:u},0);i.forEach(l=>{let c=t.node(l);o==="top"?c.y=a+c.height/2:o==="bottom"?c.y=a+s-c.height/2:c.y=a+s/2}),a+=s+r})}function JK(t,e={}){let n=e.debugTiming?IP:PP;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>c7(t));return n(" runLayout",()=>t7(r,n,e)),n(" updateInputGraph",()=>e7(t,r)),r})}function t7(t,e,n){e(" makeSpaceForEdgeLabels",()=>d7(t)),e(" removeSelfEdges",()=>x7(t)),e(" acyclic",()=>Yq(t)),e(" nestingGraph.run",()=>pK(t)),e(" rank",()=>aK(_P(t))),e(" injectEdgeLabelProxies",()=>u7(t)),e(" removeEmptyRanks",()=>Cq(t)),e(" nestingGraph.cleanup",()=>gK(t)),e(" normalizeRanks",()=>Tq(t)),e(" assignRankMinMax",()=>f7(t)),e(" removeEdgeLabelProxies",()=>p7(t)),e(" normalize.run",()=>Uq(t)),e(" parentDummyChains",()=>cK(t)),e(" addBorderSegments",()=>yK(t)),e(" order",()=>zP(t,n)),e(" insertSelfEdges",()=>w7(t)),e(" adjustCoordinateSystem",()=>xK(t)),e(" position",()=>ZK(t)),e(" positionSelfEdges",()=>E7(t)),e(" removeBorderNodes",()=>b7(t)),e(" normalize.undo",()=>jq(t)),e(" fixupEdgeLabelCoords",()=>g7(t)),e(" undoCoordinateSystem",()=>wK(t)),e(" translateGraph",()=>m7(t)),e(" assignNodeIntersects",()=>h7(t)),e(" reversePoints",()=>y7(t)),e(" acyclic.undo",()=>Vq(t))}function e7(t,e){t.nodes().forEach(n=>{let r=t.node(n),o=e.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,e.children(n).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(n=>{let r=t.edge(n),o=e.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function c7(t){let e=new Na({multigraph:!0,compound:!0}),n=VE(t.graph());return e.setGraph(Object.assign({},r7,zE(n,n7),ng(n,o7))),t.nodes().forEach(r=>{let o=VE(t.node(r)),a=zE(o,a7);Object.keys(xP).forEach(s=>{a[s]===void 0&&(a[s]=xP[s])}),e.setNode(r,a);let i=t.parent(r);i!==void 0&&e.setParent(r,i)}),t.edges().forEach(r=>{let o=VE(t.edge(r));e.setEdge(r,Object.assign({},s7,zE(o,i7),ng(o,l7)))}),e}function d7(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function u7(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let r=t.node(e.v),o={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};md(t,"edge-proxy",o,"_ep")}})}function f7(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}function p7(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let r=n;t.edge(r.e).labelRank=n.rank,t.removeNode(e)}})}function m7(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,a=t.graph(),i=a.marginx||0,s=a.marginy||0;function l(c){let d=c.x,u=c.y,f=c.width,p=c.height;e=Math.min(e,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,u-p/2),o=Math.max(o,u+p/2)}t.nodes().forEach(c=>l(t.node(c))),t.edges().forEach(c=>{let d=t.edge(c);Object.hasOwn(d,"x")&&l(d)}),e-=i,r-=s,t.nodes().forEach(c=>{let d=t.node(c);d.x-=e,d.y-=r}),t.edges().forEach(c=>{let d=t.edge(c);d.points.forEach(u=>{u.x-=e,u.y-=r}),Object.hasOwn(d,"x")&&(d.x-=e),Object.hasOwn(d,"y")&&(d.y-=r)}),a.width=n-e+i,a.height=o-r+s}function h7(t){t.edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),a,i;n.points?(a=n.points[0],i=n.points[n.points.length-1]):(n.points=[],a=o,i=r),n.points.unshift(cP(r,a)),n.points.push(cP(o,i))})}function g7(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function y7(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function b7(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),i=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(i.x-a.x),n.height=Math.abs(o.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function x7(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function w7(t){Sf(t).forEach(e=>{let n=0;e.forEach((r,o)=>{let a=t.node(r);a.order=o+n,(a.selfEdges||[]).forEach(i=>{md(t,"selfedge",{width:i.label.width,height:i.label.height,rank:a.rank,order:o+ ++n,e:i.e,label:i.label},"_se")}),delete a.selfEdges})})}function E7(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let r=n,o=t.node(r.e.v),a=o.x+o.width/2,i=o.y,s=n.x-a,l=o.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],r.label.x=n.x,r.label.y=n.y}})}function zE(t,e){return rg(ng(t,e),Number)}function VE(t){let e={};return t&&Object.entries(t).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=r}),e}function S7(t){let e=Sf(t),n=new Na({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+t.node(r).rank)}),t.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),e.forEach((r,o)=>{let a="layer"+o;n.setNode(a,{rank:"same"}),r.reduce((i,s)=>(n.setEdge(i,s,{style:"invis"}),s))}),n}var wP,tq,eq,nq,EP,rq,SP,Na,aq,vP,XE,dq,LP,pq,yq,eg,AP,Rq,og,Pq,Dq,Gq,$q,DP,Jq,tK,eK,aK,sK,cK,yK,n7,r7,o7,a7,xP,i7,s7,l7,v7,er,ls=st(()=>{"use strict";wP=Object.defineProperty,tq=(t,e,n)=>e in t?wP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eq=(t,e)=>{for(var n in e)wP(t,n,{get:e[n],enumerable:!0})},nq=(t,e,n)=>tq(t,typeof e!="symbol"?e+"":e,n),EP={};eq(EP,{Graph:()=>Na,alg:()=>XE,json:()=>vP,version:()=>aq});rq=Object.defineProperty,SP=(t,e)=>{for(var n in e)rq(t,n,{get:e[n],enumerable:!0})},Na=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let r of this.successors(t))n.add(r);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,a])=>{t(o)&&e.setNode(o,a)}),Object.values(this._edgeObjs).forEach(o=>{e.hasNode(o.v)&&e.hasNode(o.w)&&e.setEdge(o,this.edge(o))});let n={},r=o=>{let a=this.parent(o);return!a||e.hasNode(a)?(n[o]=a??void 0,a??void 0):a in n?n[a]:r(a)};return this._isCompound&&e.nodes().forEach(o=>e.setParent(o,r(o))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,r)=>(e!==void 0?this.setEdge(n,r,e):this.setEdge(n,r),r)),this}setEdge(t,e,n,r){let o,a,i,s,l=!1;typeof t=="object"&&t!==null&&"v"in t?(o=t.v,a=t.w,i=t.name,arguments.length===2&&(s=e,l=!0)):(o=t,a=e,i=r,arguments.length>2&&(s=n,l=!0)),o=""+o,a=""+a,i!==void 0&&(i=""+i);let c=wf(this._isDirected,o,a,i);if(c in this._edgeLabels)return l&&(this._edgeLabels[c]=s),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(a),this._edgeLabels[c]=l?s:this._defaultEdgeLabelFn(o,a,i);let d=oq(this._isDirected,o,a,i);return o=d.v,a=d.w,Object.freeze(d),this._edgeObjs[c]=d,sP(this._preds[a],o),sP(this._sucs[o],a),this._in[a][c]=d,this._out[o][c]=d,this._edgeCount++,this}edge(t,e,n){let r=arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(t,e,n){let r=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof r!="object"?{label:r}:r}hasEdge(t,e,n){return(arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let r=arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n),o=this._edgeObjs[r];if(o){let a=o.v,i=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],lP(this._preds[i],a),lP(this._sucs[a],i),delete this._in[i][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let r=Object.values(t);return n?r.filter(o=>o.v===e&&o.w===n||o.v===n&&o.w===e):r}};aq="4.0.1",vP={};SP(vP,{read:()=>cq,write:()=>iq});XE={};SP(XE,{CycleException:()=>eg,bellmanFord:()=>kP,components:()=>fq,dijkstra:()=>tg,dijkstraAll:()=>hq,findCycles:()=>gq,floydWarshall:()=>bq,isAcyclic:()=>wq,postorder:()=>Sq,preorder:()=>vq,prim:()=>kq,shortestPaths:()=>Lq,tarjan:()=>NP,topsort:()=>MP});dq=()=>1;LP=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,r=String(t);if(!(r in n)){let o=this._arr,a=o.length;return n[r]=a,o.push({key:r,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let r=this._arr[n].priority;if(e>r)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${r} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,r=n+1,o=t;n<e.length&&(o=e[n].priority<e[o].priority?n:o,r<e.length&&(o=e[r].priority<e[o].priority?r:o),o!==t&&(this._swap(t,o),this._heapify(o)))}_decrease(t){let e=this._arr,n=e[t].priority,r;for(;t!==0&&(r=t>>1,!(e[r].priority<n));)this._swap(t,r),t=r}_swap(t,e){let n=this._arr,r=this._keyIndices,o=n[t],a=n[e];n[t]=a,n[e]=o,r[a.key]=t,r[o.key]=e}},pq=()=>1;yq=()=>1;eg=class extends Error{constructor(...t){super(...t)}};AP=65535;Rq=0;og="\0",Pq="3.0.0",Dq=class{constructor(){nq(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return uP(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&uP(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,Oq)),n=n._prev;return"["+t.join(", ")+"]"}};Gq=Dq,$q=()=>1;DP=qq;({preorder:Jq,postorder:tK}=XE),eK=Vl;Vl.initLowLimValues=ZE;Vl.initCutValues=KE;Vl.calcCutValue=OP;Vl.leaveEdge=$P;Vl.enterEdge=HP;Vl.exchangeEdges=WP;aK=iK;sK=qE;cK=dK;yK=bK;n7=["nodesep","edgesep","ranksep","marginx","marginy"],r7={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},o7=["acyclicer","ranker","rankdir","align","rankalign"],a7=["width","height","rank"],xP={width:0,height:0},i7=["minlen","weight","width","height","labeloffset"],s7={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},l7=["labelpos"];v7={graphlib:EP,version:Pq,layout:JK,debug:S7,util:{time:IP,notime:PP}},er=v7;});var t1={};ye(t1,{layoutSitemap:()=>P7});function XP(t,e,n,r,o,a){let i=o-t,s=a-e;if(i===0&&s===0)return{x:t,y:e};let l=n/2,c=r/2,d=i!==0?l/Math.abs(i):1/0,u=s!==0?c/Math.abs(s):1/0,f=Math.min(d,u);return{x:t+i*f,y:e+s*f}}function C7(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function _7(t,e,n){let r=_t(t,k7);for(let[o,a]of Object.entries(e)){let i=_t(`${o}: ${a}`,UP);i>r&&(r=i)}if(n)for(let o of n){let a=_t(o,UP);a>r&&(r=a)}return Math.max(JP,Math.ceil(r)+QP*2)}function A7(t,e=0){let r=Object.keys(t).length+e;return r===0?jP+qP:jP+M7+r*N7+qP}function ZP(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n,t.isContainer)}function I7(t,e){let n=[];for(let r of t){if(r.entries.length===0)continue;let o=e?.get(qt(r.name)),a=o?r.entries.filter(u=>o.has(u.value.toLowerCase())):r.entries;if(a.length===0)continue;let i=We(r.name,sr)+po,s=i,l=0;for(let u of a)l+=wr*2+Nr+We(u.value,Vn)+Kr;let c=Mo+Ei,d=Rn*2+i+4+c+l;n.push({name:r.name,...r.alias!==void 0&&{alias:r.alias},entries:a.map(u=>({value:u.value,color:u.color})),x:0,y:0,width:d,height:Se,minifiedWidth:s,minifiedHeight:Se})}return n}function JE(t,e,n,r,o,a){for(let i of t){let s=C7(i.metadata,o);if(i.isContainer){let l=Object.keys(s).length,c=tD+l*eD;a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:Math.max(JP,_t(i.label,L7)+QP*2),height:c+QE}),JE(i.children,i.id,n,r,o,a)}else a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:_7(i.label,s,i.description),height:A7(s,i.description?.length??0)}),i.children.length>0&&JE(i.children,e,i.id,r,o,a)}}function P7(t,e,n,r,o){if(t.roots.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let a=[],i=k=>{a.push(k);for(let N of k.children)i(N)};for(let k of t.roots)i(k);Ea(a,t.tagGroups,k=>k.isContainer);let s=[];JE(t.roots,null,null,e,r,s);let l=new Map;for(let k of s)l.set(k.sitemapNode.id,k);let c=new er.graphlib.Graph({compound:!0,multigraph:!0});c.setGraph({rankdir:t.direction,nodesep:50,ranksep:60,edgesep:30,marginx:Ul,marginy:Ul}),c.setDefaultEdgeLabel(()=>({}));let d=new Set,u=new Set,f=new Set;for(let k of s)k.sitemapNode.isContainer?(d.add(k.sitemapNode.id),(e?.get(k.sitemapNode.id)??0)>0&&f.add(k.sitemapNode.id)):u.add(k.sitemapNode.id);let p=0,m=0;for(let k of s)k.sitemapNode.isContainer||(k.width>p&&(p=k.width),k.height>m&&(m=k.height));for(let k of s){let N=k.sitemapNode;if(N.isContainer)if(f.has(N.id)){let _=Math.max(k.width,p),T=Math.max(k.height,m);c.setNode(N.id,{label:N.label,width:_,height:T})}else c.setNode(N.id,{label:N.label,paddingLeft:KP,paddingRight:KP,paddingTop:T7,paddingBottom:QE});else c.setNode(N.id,{label:N.label,width:k.width,height:k.height})}for(let k of s)k.parentContainerId&&!f.has(k.parentContainerId)&&c.setParent(k.sitemapNode.id,k.parentContainerId);let h=new Set;for(let k of d)f.has(k)||h.add(k);let g=[];for(let k=0;k<t.edges.length;k++){let N=t.edges[k];if(!(!c.hasNode(N.sourceId)||!c.hasNode(N.targetId))){if(h.has(N.sourceId)||h.has(N.targetId)){g.push(k);continue}c.setEdge(N.sourceId,N.targetId,{label:N.label??"",minlen:1},`e${k}`)}}er.layout(c);let E=[],y=[];for(let k of s){let N=k.sitemapNode;if(N.isContainer)continue;let _=c.node(N.id);if(!_)continue;let T=e?.get(N.id),R=ZP(N,t.tagGroups,n??null);E.push({id:N.id,label:N.label,metadata:k.meta,tagMetadata:k.fullMeta,...N.description!==void 0&&{description:[...N.description]},isContainer:!1,lineNumber:N.lineNumber,...R!==void 0&&{color:R},x:_.x,y:_.y-_.height/2,width:_.width,height:_.height,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}for(let k of s){let N=k.sitemapNode;if(!N.isContainer)continue;let _=c.node(N.id),T=e?.get(N.id),R=Object.keys(k.meta).length,G=tD+R*eD,I=ZP(N,t.tagGroups,n??null);if(_)y.push({nodeId:N.id,label:N.label,lineNumber:N.lineNumber,...I!==void 0&&{color:I},metadata:k.meta,tagMetadata:k.fullMeta,x:_.x-_.width/2,y:_.y-_.height/2,width:_.width,height:_.height,labelHeight:G,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}});else{let H=f.has(N.id),O=H?Math.max(k.width,p):k.width,D=H?k.height:G+QE,W=H?Math.max(D,m):D;y.push({nodeId:N.id,label:N.label,lineNumber:N.lineNumber,...I!==void 0&&{color:I},metadata:k.meta,tagMetadata:k.fullMeta,x:Ul,y:Ul,width:O,height:W,labelHeight:G,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}}let b=new Set(g),S=[];for(let k=0;k<t.edges.length;k++){let N=t.edges[k];if(!c.hasNode(N.sourceId)||!c.hasNode(N.targetId))continue;let _;if(b.has(k)){let T=c.node(N.sourceId),R=c.node(N.targetId);if(!T||!R)continue;let G=XP(T.x,T.y,T.width,T.height,R.x,R.y),I=XP(R.x,R.y,R.width,R.height,T.x,T.y),H=(G.x+I.x)/2,O=(G.y+I.y)/2;_=[G,{x:H,y:O},I]}else{let T=c.edge({v:N.sourceId,w:N.targetId,name:`e${k}`});if(!T)continue;_=T.points??[]}S.push({sourceId:N.sourceId,targetId:N.targetId,points:_,...N.label!==void 0&&{label:N.label},lineNumber:N.lineNumber,...b.has(k)&&{deferred:!0}})}{let k=new Set([...u,...f]),N=new Map;for(let O of k)N.set(O,O);let _=O=>{for(;N.get(O)!==O;)N.set(O,N.get(N.get(O))),O=N.get(O);return O},T=(O,D)=>{let W=_(O),z=_(D);W!==z&&N.set(W,z)};for(let O of t.edges)k.has(O.sourceId)&&k.has(O.targetId)&&T(O.sourceId,O.targetId);let R=s.find(O=>!O.sitemapNode.isContainer)?.sitemapNode.id,G=R?_(R):null,I=new Set;for(let O of k)G&&_(O)!==G&&I.add(O);let H=new Set;for(let O of d){if(f.has(O)){I.has(O)&&H.add(O);continue}let D=s.filter(W=>!W.sitemapNode.isContainer&&W.parentContainerId===O);D.length>0&&D.every(W=>I.has(W.sitemapNode.id))&&H.add(O)}if(I.size>0){let O=t.direction==="TB",D=0,W=0,z=1/0,P=1/0;for(let K of E)I.has(K.id)||(D=Math.max(D,K.x+K.width/2),W=Math.max(W,K.y+K.height),z=Math.min(z,K.y),P=Math.min(P,K.x-K.width/2));for(let K of y)H.has(K.nodeId)||(D=Math.max(D,K.x+K.width),W=Math.max(W,K.y+K.height),z=Math.min(z,K.y),P=Math.min(P,K.x));let B=1/0,Y=1/0,V=0,j=0;for(let K of E)I.has(K.id)&&(B=Math.min(B,K.x-K.width/2),Y=Math.min(Y,K.y),V=Math.max(V,K.x+K.width/2),j=Math.max(j,K.y+K.height));for(let K of y)H.has(K.nodeId)&&(B=Math.min(B,K.x),Y=Math.min(Y,K.y),V=Math.max(V,K.x+K.width),j=Math.max(j,K.y+K.height));if(B!==1/0){let K=R7*2,$,U;if(O?($=D+K-B,U=(z===1/0?0:z)-Y):($=(P===1/0?0:P)-B,U=W+K-Y),$!==0||U!==0){for(let X of E)I.has(X.id)&&(X.x+=$,X.y+=U);for(let X of y)H.has(X.nodeId)&&(X.x+=$,X.y+=U);for(let X of S){let q=I.has(X.sourceId),et=I.has(X.targetId);if(q||et)for(let tt of X.points)tt.x+=$,tt.y+=U}}}}}let x=0,L=0;for(let k of E){let N=k.x+k.width/2,_=k.y+k.height;N>x&&(x=N),_>L&&(L=_)}for(let k of y){let N=k.x+k.width,_=k.y+k.height;N>x&&(x=N),_>L&&(L=_)}for(let k of S)for(let N of k.points)N.x>x&&(x=N.x),N.y>L&&(L=N.y);x+=Ul,L+=Ul;let v=new Map;for(let k of t.tagGroups){let N=qt(k.name),_=new Set,T=R=>{!R.isContainer&&R.metadata[N]&&_.add(R.metadata[N].toLowerCase());for(let G of R.children)T(G)};for(let R of t.roots)T(R);v.set(N,_)}let A=I7(t.tagGroups,v),C=n!=null?A.filter(k=>k.name.toLowerCase()===n.toLowerCase()):A,M=o&&n==null,w=k=>n!=null||M?k.width:k.minifiedWidth;if(C.length>0){let k=Se+Wn,N=C.reduce((G,I)=>G+w(I),0)+(C.length-1)*Wn,_=N+Ul*2;_>x&&(x=_);let T=(x-N)/2,R=L+Wn;for(let G of C)G.x=T,G.y=R,T+=w(G)+Wn;L+=k}return{nodes:E,edges:S,containers:y,legend:A,width:x,height:L}}var k7,UP,L7,N7,jP,M7,QP,qP,JP,Ul,KP,T7,QE,tD,eD,R7,e1=st(()=>{"use strict";Ke();ls();Ke();Mr();en();k7=13,UP=11,L7=13;N7=16,jP=28,M7=6,QP=20,qP=10,JP=140,Ul=40,KP=24,T7=40,QE=24,tD=28,eD=16;R7=20});function D7(t,e){let n=new Map,r=o=>{for(let a of o)for(let i of e.getChildren(a))n.set(e.getId(i),e.getId(a)),r([i])};return r(t),n}function nD(t,e,n,r){let o=t;for(;;){let a=e.get(o);if(!a)return null;if(n.has(a)&&r.has(a))return a;o=a}}function rD(t,e,n,r,o,a){let i=KI(e,o),s=D7(t,o),l=[];for(let c of n){let d=a.getSource(c),u=a.getTarget(c),f=i.has(d),p=i.has(u);if(f&&p){l.push(a.withEndpoints(c,d,u));continue}if(!f){let m=nD(d,s,i,r);if(!m)continue;d=m}if(!p){let m=nD(u,s,i,r);if(!m)continue;u=m}d!==u&&l.push(a.withEndpoints(c,d,u))}return l}var oD=st(()=>{"use strict";xf()});var sD={};ye(sD,{collapseSitemapTree:()=>G7});function iD(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(iD),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function G7(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=ld(t.roots,e,aD),o=rD(t.roots,n,t.edges,e,aD,O7);return{parsed:{...t,roots:n,edges:o},hiddenCounts:r}}var aD,O7,lD=st(()=>{"use strict";xf();oD();aD={getId:t=>t.id,getChildren:t=>t.children,clone:iD,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer},O7={getSource:t=>t.sourceId,getTarget:t=>t.targetId,withEndpoints:(t,e,n)=>({...t,sourceId:e,targetId:n})}});var uD={};ye(uD,{renderSitemap:()=>dD,renderSitemapForExport:()=>q7});function Y7(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function z7(t,e){return e??t.primary}function V7(t,e,n){return n?Gt(n,nr(t,e),10):Gt(t.surface,t.bg,40)}function U7(t,e){return e??t.textMuted}function dD(t,e,n,r,o,a,i,s,l,c){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let d=i?.width??t.clientWidth,u=i?.height??t.clientHeight;if(d<=0||u<=0)return;let f=Ee.identity(),p=f.aesthetic($7),m=f.text(13),h=f.text(11),g=f.structural(16),E=f.structural(28),y=f.structural(6),b=f.structural(1.5),S=f.structural(1.5),x=f.text(B7),L=f.text(13),v=f.text(11),A=f.structural(16),C=f.structural(28),M=f.text(20),w=f.structural(W7),k=f.structural(6),N=f.aesthetic(F7),_=n.legend.length>0,T=Se+Wn,R=!!e.title&&e.options["no-title"]!=="on",G=!i&&_,I=G&&R,H=I?w:0,O=f.structural(G?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Mo+Ei},d):Se),D=G?O+N:0,W=H+D,z=0,P=!I&&R?w:0,B=n.width,Y=n.height+P;G&&(Y-=T);let V=u-p*2-W-z,j=(d-p*2)/B,K=V/Y,$=Math.min(H7,j,K),U=B*$,X=(d-U)/2,q=p+W,et=Rt(t).append("svg").attr("width",d).attr("height",u).attr("viewBox",`0 0 ${d} ${u}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);f.isBelowFloor&&et.attr("width","100%");let tt=et.append("defs");tt.append("marker").attr("id","sm-arrow").attr("viewBox",`0 0 ${Js} ${Pi}`).attr("refX",Js).attr("refY",Pi/2).attr("markerWidth",Js).attr("markerHeight",Pi).attr("orient","auto").append("polygon").attr("points",`0,0 ${Js},${Pi/2} 0,${Pi}`).attr("fill",r.textMuted);let F=new Set;for(let J of F){let at=`sm-arrow-${J.replace("#","")}`;tt.append("marker").attr("id",at).attr("viewBox",`0 0 ${Js} ${Pi}`).attr("refX",Js).attr("refY",Pi/2).attr("markerWidth",Js).attr("markerHeight",Pi).attr("orient","auto").append("polygon").attr("points",`0,0 ${Js},${Pi/2} 0,${Pi}`).attr("fill",J)}let Q=et.append("g").attr("transform",`translate(${X}, ${q}) scale(${$})`);if(!I&&R){let J=Q.append("text").attr("x",B/2).attr("y",M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",M).attr("font-weight","700").attr("class","sitemap-title chart-title");e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}let ot=G?-T:0,Z=Q.append("g").attr("transform",`translate(0, ${P+ot})`),lt=new Map,nt=new Map;for(let J of e.tagGroups){lt.set(qt(J.name),J.name);for(let at of J.entries)nt.set(`${qt(J.name)}:${at.value.toLowerCase()}`,at.color)}for(let J of n.containers){let at=Z.append("g").attr("transform",`translate(${J.x}, ${J.y})`).attr("class","sitemap-container").attr("data-line-number",String(J.lineNumber));if(J.hasChildren&&at.attr("data-node-toggle",J.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)).attr("aria-label",J.label),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let At=qt(s),rt=J.tagMetadata[At];rt&&at.attr(`data-tag-${At}`,rt.toLowerCase())}let it=V7(r,o,J.color),vt=U7(r,J.color);at.append("rect").attr("x",0).attr("y",0).attr("width",J.width).attr("height",J.height).attr("rx",8).attr("fill",it).attr("stroke",vt).attr("stroke-opacity",.35).attr("stroke-width",S),at.append("text").attr("x",J.width/2).attr("y",C/2+L/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",L).attr("font-weight","bold").text(J.label);let Tt=Object.entries(J.metadata);if(Tt.length>0){let At=Tt.map(([dt])=>lt.get(dt)??dt),pt=10+Math.max(...At.map(dt=>_t(`${dt}: `,v))),ht=C+v-2;for(let dt=0;dt<Tt.length;dt++){let[ut,yt]=Tt[dt],kt=At[dt],Ot=ht+dt*A,Xt=nt.get(`${ut}:${yt.toLowerCase()}`)??r.text;at.append("text").attr("x",10).attr("y",Ot).attr("fill",r.textMuted).attr("font-size",v).text(`${kt}: `),at.append("text").attr("x",pt).attr("y",Ot).attr("fill",Xt).attr("font-size",v).text(yt)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let At=`clip-${J.nodeId}`;at.append("clipPath").attr("id",At).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",8),at.append("rect").attr("y",J.height-k).attr("width",J.width).attr("height",k).attr("fill",vt).attr("clip-path",`url(#${At})`).attr("class","sitemap-collapse-bar")}}for(let J of n.edges){if(J.points.length<2)continue;let at=Z.append("g").attr("class","sitemap-edge-group").attr("data-line-number",String(J.lineNumber)).attr("data-from",J.sourceId).attr("data-to",J.targetId),it=r.textMuted,vt="sm-arrow",At=(J.deferred?j7:X7)(J.points);if(At&&at.append("path").attr("d",At).attr("fill","none").attr("stroke",it).attr("stroke-width",b).attr("marker-end",`url(#${vt})`).attr("class","sitemap-edge"),J.label&&J.points.length>=2){let rt=J.points[Math.floor(J.points.length/2)],pt=_t(J.label,x)+10,ht=x+6;at.append("rect").attr("x",rt.x-pt/2).attr("y",rt.y-ht/2-1).attr("width",pt).attr("height",ht).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","sitemap-edge-label-bg"),at.append("text").attr("x",rt.x).attr("y",rt.y+4).attr("text-anchor","middle").attr("fill",it).attr("font-size",x).attr("class","sitemap-edge-label").text(J.label)}}for(let J of n.nodes){let at=Z.append("g").attr("transform",`translate(${J.x-J.width/2}, ${J.y})`).attr("class","sitemap-node").attr("data-line-number",String(J.lineNumber)).attr("data-node-id",J.id);if(J.hasChildren&&at.attr("data-node-toggle",J.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let pt=qt(s),ht=J.tagMetadata[pt];ht&&at.attr(`data-tag-${pt}`,ht.toLowerCase())}let it=e.options["solid-fill"]==="on",vt=Y7(r,o,J.color,it),Tt=z7(r,J.color),At=ve(vt,r.textOnFillLight,r.textOnFillDark);od(at,{width:J.width,height:J.height,rx:6,fill:vt,stroke:Tt,strokeWidth:S,label:J.label,labelColor:At,labelFontSize:m,headerHeight:E});let rt=Object.entries(J.metadata);if(rt.length>0){at.append("line").attr("x1",0).attr("y1",E).attr("x2",J.width).attr("y2",E).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let pt=rt.map(([ut])=>lt.get(ut)??ut),dt=10+Math.max(...pt.map(ut=>_t(`${ut}: `,h)));for(let ut=0;ut<rt.length;ut++){let[yt,kt]=rt[ut],Ot=pt[ut],Xt=E+y+(ut+1)*g-4,bt=nt.get(`${yt}:${kt.toLowerCase()}`),Nt=it?At:bt??At;at.append("text").attr("x",10).attr("y",Xt).attr("fill",At).attr("font-size",h).text(`${Ot}:`),at.append("text").attr("x",dt).attr("y",Xt).attr("fill",Nt).attr("font-size",h).text(kt)}}if(J.description&&J.description.length>0){let pt=Object.keys(J.metadata).length,ht=pt>0?E+y+pt*g:E;at.append("line").attr("x1",0).attr("y1",ht).attr("x2",J.width).attr("y2",ht).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let dt=E+y+pt*g;for(let ut=0;ut<J.description.length;ut++){let yt=ea(J.description[ut]),kt=dt+(ut+1)*g-4,Ot=at.append("text").attr("x",10).attr("y",kt).attr("fill",At).attr("font-size",h);gn(Ot,yt,r,h)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let pt=`clip-${J.id}`;at.append("clipPath").attr("id",pt).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",6),at.append("rect").attr("y",J.height-k).attr("width",J.width).attr("height",k).attr("fill",it?At:J.color??r.primary).attr("opacity",.5).attr("clip-path",`url(#${pt})`)}}if(i&&_&&cD(Z,n.legend,r,o,s,void 0,l,c),I){let J=et.append("text").attr("x",d/2).attr("y",p+M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",M).attr("font-weight","700").attr("class","sitemap-title chart-title").style("font-family",It);e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}if(G){let J=et.append("g").attr("class","sitemap-legend-fixed").attr("transform",`translate(0, ${p+H})`);s&&J.attr("data-legend-active",s.toLowerCase()),cD(J,n.legend,r,o,s,d,l,c)}}function cD(t,e,n,r,o,a,i,s){if(e.length===0)return;let l=e.map(p=>({name:p.name,entries:p.entries.map(m=>({value:m.value,color:m.color}))})),c=a!=null,d=c?Mo+Ei:0,u=a??e[0].x+(e[0].width??200),f=fn(t,{groups:l,activeGroup:o??null,mode:s?"export":"preview",capsulePillAddonWidth:d,palette:n,isDark:r,width:u});if(t.selectAll("[data-legend-group]").classed("sitemap-legend-group",!0),c){let p=f.getLayout();if(p.activeCapsule?.addonX!=null){let m=p.activeCapsule,h=qt(m.groupName),g=i?.has(h)??!1,E=t.select(`[data-legend-group="${h}"]`);if(!E.empty()){let y=m.addonX,b=(Se-Mo)/2,S=6,x=E.append("g").attr("class","sitemap-legend-eye").attr("data-legend-visibility",h).style("cursor","pointer").attr("opacity",g?.4:.7);x.append("rect").attr("x",y-S).attr("y",b-S).attr("width",Mo+S*2).attr("height",Mo+S*2).attr("fill","transparent").attr("pointer-events","all"),x.append("path").attr("d",g?Gm:Om).attr("transform",`translate(${y}, ${b})`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}async function q7(t,e,n){let{parseSitemap:r}=await Promise.resolve().then(()=>(ef(),ew)),{layoutSitemap:o}=await Promise.resolve().then(()=>(e1(),t1)),{getPalette:a}=await Promise.resolve().then(()=>(yi(),vx)),i=e==="dark",s=n??(i?a("nord").dark:a("nord").light),l=r(t,s);if(l.error||l.roots.length===0)return"";let c=o(l,void 0,null,void 0,!0),d=20,u=l.title?30:0,f=c.width+d*2,p=c.height+d*2+u,m=document.createElement("div");m.style.width=`${f}px`,m.style.height=`${p}px`,m.style.position="absolute",m.style.left="-9999px",document.body.appendChild(m),dD(m,l,c,s,i,void 0,{width:f,height:p});let h=m.querySelector("svg");if(!h)return document.body.removeChild(m),"";e==="transparent"?h.style.background="none":h.style.background||(h.style.background=s.bg),h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.style.fontFamily=It;let g=h.outerHTML;return document.body.removeChild(m),g}var $7,H7,W7,Js,Pi,B7,F7,X7,j7,fD=st(()=>{"use strict";Ke();Xn();Eo();on();tn();_o();Qa();en();Mr();Br();To();fr();Oh();$7=20,H7=3,W7=30,Js=10,Pi=7,B7=11,F7=8;X7=Kn().x(t=>t.x).y(t=>t.y).curve(fo),j7=Kn().x(t=>t.x).y(t=>t.y).curve(Qi)});function ag(t){return t.toLowerCase()===K7}var K7,pD=st(()=>{"use strict";K7="archive"});var ED={};ye(ED,{renderKanban:()=>wD,renderKanbanForExport:()=>Z7});function mg(t,e,n){let r=[];for(let o of e){if(n?.includes(o.name.toLowerCase()))continue;let i=t.tags[qt(o.name)]??o.defaultValue;if(!i)continue;let s=o.entries.find(l=>l.value.toLowerCase()===i.toLowerCase());r.push({label:o.name,value:i,...s?.color!==void 0&&{color:s.color}})}return r}function bD(t,e,n){if(!n)return t.color;let r=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!r)return t.color;let a=t.tags[qt(r.name)]??r.defaultValue;return a?r.entries.find(s=>s.value.toLowerCase()===a.toLowerCase())?.color:void 0}function xD(t,e,n,r,o=vf,a=dg,i=ug,s=o1,l=ig,c=sg,d=cg,u=bd,f=yd,p=gd,m=hd,h=fg,g=lg,E=n1,y=kf,b=pg){let x=!!t.title&&t.options["no-title"]!=="on"?a+8:0,L=o+x,v=[],A=0,C=t.columns.filter(N=>!ag(N.name));for(let N of C){if(n?.has(N.id)??!1){v.push({x:0,y:L,width:b,height:0,column:N,cardLayouts:[]});continue}let T=_t(N.name,s),R=[],G=l+c;for(let O of N.cards){let D=_t(O.title,i);T=Math.max(T,D+d*2);let W=mg(O,t.tagGroups,r),z=W.length+O.details.length,P=z>0?f+1+u+z*p:0,B=m+u+P;for(let Y of W){let V=_t(`${Y.label}: ${Y.value}`,h)+d*2;T=Math.max(T,V)}R.push({x:c,y:G,width:0,height:B,card:O}),G+=B+g}let I=Math.max(E,T+c*2);for(let O of R)O.width=I-c*2;let H=G+c;A=Math.max(A,H),v.push({x:0,y:L,width:I,height:H,column:N,cardLayouts:R})}let M=o;for(let N of v)N.x=M,N.height=A,M+=N.width+y;let w=M-y+o,k=L+A+o;return{columns:v,totalWidth:w,totalHeight:k}}function wD(t,e,n,r,o){let a=o?.exportDims,i=o?.activeTagGroup??null,s=o?.onSwimlaneChange,l=o?.collapsedLanes,c=o?.collapsedColumns??new Set(e.columns.filter(F=>F.collapsed).map(F=>F.id)),d=o?.compactMeta??!1,u=e.options["solid-fill"]==="on",f=o?.currentSwimlaneGroup??null,p=f?e.tagGroups.find(F=>F.name.toLowerCase()===f.toLowerCase())??null:null,m=[];d&&(i&&m.push(i.toLowerCase()),f&&m.push(f.toLowerCase()));let h=e.columns.filter(F=>!ag(F.name)),g=Math.max(1,h.length),E=g*n1+(g-1)*kf+2*vf,y=a?.width??t.getBoundingClientRect().width,b=a||y<=0?Ee.identity():Ee.from(y,E),S=b.aesthetic(vf),x=b.aesthetic(kf),L=b.structural(ig),v=b.aesthetic(sg),A=b.structural(n1),C=b.structural(hd),M=b.structural(gd),w=b.structural(yd),k=b.aesthetic(lg),N=b.structural(6),_=b.aesthetic(cg),T=b.aesthetic(bd),R=b.structural(r1),G=b.structural(dg),I=b.text(o1),H=b.text(ug),O=b.text(fg),D=b.text(hD),W=b.structural(gD),z=b.structural(yD),P=b.structural(pg),B=b.structural(a1),Y=b.text(20),V=b.structural(i1),j=b.aesthetic(s1),K=xD(e,n,c,m,S,G,H,I,L,v,_,T,w,M,C,O,k,A,x,P),$=a?.width??K.totalWidth,U=a?.height??K.totalHeight;t.innerHTML="";let X=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",$).attr("height",U).attr("viewBox",`0 0 ${$} ${U}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",It).style("background",n.bg);b.isBelowFloor&&X.attr("width","100%");let q=!!e.title&&e.options["no-title"]!=="on";if(q&&X.append("text").attr("class","chart-title").attr("data-line-number",e.titleLineNumber??0).attr("x",S).attr("y",S+Y).attr("font-size",Y).attr("font-weight","700").attr("fill",n.text).text(e.title),e.tagGroups.length>0){let F=q?We(e.title,Y)+16:0,Q=S+F,ot={groups:e.tagGroups,position:{placement:"top-center",titleRelation:"inline-with-title"},mode:o?.exportMode?"export":"preview"},Z=Tr(ot,$-Q-S),lt=S+(Y-Z)/2,nt=X.append("g").attr("class","kanban-legend").attr("transform",`translate(${Q},${lt})`),at=!!s&&!a?{onGroupRendered:(it,vt,Tt)=>{let At=p?.name.toLowerCase()===it.toLowerCase(),rt=We(it,11),pt=Tt?10+rt+6:8+rt+4,ht=(Se-7)/2,dt=Q7(vt,pt,ht,At,n);dt.append("title").text(`Group by ${it}`),dt.style("cursor","pointer").on("click",ut=>{ut.stopPropagation(),s?.(At?null:it)})}}:void 0;fn(nt,{...ot,palette:n,isDark:r,width:$-Q-S,activeGroup:i??null,...at!==void 0&&{callbacks:at}})}if(p){eZ(X,e,K,p,n,r,i,l,c,m,S,G,V,x,P,L,v,C,T,k,B,j,w,M,I,W,z,D,N,_,R,H,O);return}let et=r?Gt(n.surface,n.bg,50):Gt(n.surface,n.bg,30),tt=r?Gt(n.surface,n.bg,70):Gt(n.surface,n.bg,50);for(let F of K.columns){let Q=F.column,ot=c?.has(Q.id)??!1,Z=X.append("g").attr("class","kanban-column").attr("data-column-id",Q.id).attr("data-line-number",Q.lineNumber),lt=et,nt=Q.color?ie(n,Q.color,r,{solid:u}):tt,J=Q.color?ve(nt,n.textOnFillLight,n.textOnFillDark):n.text;if(ot){Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",P).attr("height",F.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",P).attr("height",L).attr("rx",z).attr("fill",nt),Z.append("text").attr("x",F.x+P/2).attr("y",F.y+L/2+D/2-1).attr("font-size",D).attr("font-weight","bold").attr("fill",Q.color?J:n.textMuted).attr("text-anchor","middle").text(String(Q.cards.length)),Z.append("text").attr("x",F.x+P/2).attr("y",F.y+L+v).attr("font-size",H).attr("font-weight","bold").attr("fill",n.text).attr("text-anchor","middle").attr("writing-mode","tb").text(Q.name);continue}Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",F.width).attr("height",F.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",F.width).attr("height",L).attr("rx",z).attr("fill",nt),Z.append("text").attr("x",F.x+v).attr("y",F.y+L/2+I/2-2).attr("font-size",I).attr("font-weight","bold").attr("fill",J).text(Q.name);{let at=Q.wipLimit!=null&&Q.cards.length>Q.wipLimit,it=Q.wipLimit!=null?`${Q.cards.length}/${Q.wipLimit}`:String(Q.cards.length);Z.append("text").attr("x",F.x+F.width-v).attr("y",F.y+L/2+D/2-1).attr("text-anchor","end").attr("font-size",D).attr("fill",at?n.colors.red:Q.color?J:n.textMuted).attr("font-weight",at?"bold":"normal").text(it)}for(let at of F.cardLayouts){let it=at.card,vt=bD(it,e.tagGroups,i??null),Tt=mg(it,e.tagGroups,m),At=Tt.length>0||it.details.length>0,rt=ie(n,vt??n.primary,r,{solid:u}),pt=vt??n.textMuted,ht=ve(rt,n.textOnFillLight,n.textOnFillDark),dt=Z.append("g").attr("class","kanban-card").attr("data-card-id",it.id).attr("data-line-number",it.lineNumber);if(i){let Ot=qt(i),Xt=it.tags[Ot],bt=e.tagGroups.find(Vt=>Vt.name.toLowerCase()===Ot),Nt=Xt??bt?.defaultValue;Nt&&dt.attr(`data-tag-${Ot}`,Nt.toLowerCase())}let ut=F.x+at.x,yt=F.y+at.y;dt.append("rect").attr("x",ut).attr("y",yt).attr("width",at.width).attr("height",at.height).attr("rx",N).attr("fill",rt).attr("stroke",pt).attr("stroke-width",R);let kt=dt.append("text").attr("x",ut+_).attr("y",yt+T+H).attr("font-size",H).attr("font-weight","500").attr("fill",ht);if(gn(kt,it.title,n,H),At){let Ot=yt+C;dt.append("line").attr("x1",ut).attr("y1",Ot).attr("x2",ut+at.width).attr("y2",Ot).attr("stroke",u?ht:pt).attr("stroke-opacity",.3).attr("stroke-width",1);let Xt=Ot+w+O;for(let bt of Tt){dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",O).attr("fill",ht).text(`${bt.label}: `);let Nt=_t(`${bt.label}: `,O);dt.append("text").attr("x",ut+_+Nt).attr("y",Xt).attr("font-size",O).attr("fill",ht).text(bt.value),Xt+=M}for(let bt of it.details){let Nt=dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",O).attr("fill",ht);gn(Nt,bt,n,O),Xt+=M}}}}}function Z7(t,e,n){let r=Kc(t,n);if(r.error||r.columns.length===0)return"";let o=e==="dark",a=xD(r,n),i=document.createElement("div");return wD(i,r,n,o,{exportDims:{width:a.totalWidth,height:a.totalHeight},exportMode:!0}),i.querySelector("svg")?.outerHTML??""}function Q7(t,e,n,r,o){let a=t.append("g").attr("class","kanban-swimlane-icon").attr("transform",`translate(${e}, ${n})`);a.append("rect").attr("x",-5).attr("y",-5).attr("width",22).attr("height",18).attr("fill","transparent");let i=r?o.primary:o.textMuted,s=r?1:.35,l=[8,12,6],c=2,d=3;for(let u=0;u<l.length;u++)a.append("rect").attr("x",0).attr("y",u*d).attr("width",l[u]).attr("height",c).attr("rx",1).attr("fill",i).attr("opacity",s);return a}function J7(t,e){let n=qt(e.name),r=new Map;for(let a of e.entries)r.set(a.value.toLowerCase(),{laneName:a.value,laneColor:a.color,isFallback:!1,cellsByColumn:{}});let o=`__no_${n}__`;for(let a of t)for(let i of a.cards){let s=i.tags[n]??e.defaultValue,l;s&&r.has(s.toLowerCase())?l=s.toLowerCase():(r.has(o)||r.set(o,{laneName:`No ${e.name}`,isFallback:!0,cellsByColumn:{}}),l=o);let c=r.get(l);(c.cellsByColumn[a.id]??=[]).push(i)}return Array.from(r.values())}function mD(t,e,n,r=yd,o=bd,a=gd,i=hd){let l=mg(t,e,n).length+t.details.length,c=l>0?r+1+o+l*a:0;return i+o+c}function tZ(t,e,n,r,o,a,i=vf,s=dg,l=i1,c=kf,d=pg,u=ig,f=sg,p=hd,m=bd,h=lg,g=a1,E=s1,y=yd,b=gd){let S=t.title&&t.options["no-title"]!=="on"?s+8:0,x=i+S,L=[],v=i+l;for(let N of n.columns){let T=o?.has(N.column.id)??!1?d:N.width;L.push({column:N.column,x:v,width:T}),v+=T+c}let A=v-c+i,C=[],M=x+u+f,w=p+m+h;for(let N of e){if(r?.has(N.laneName)??!1){let H=L.map(O=>({column:O.column,cards:N.cellsByColumn[O.column.id]??[],cardLayouts:[]}));C.push({bucket:N,y:M,height:g,cells:H}),M+=g+E;continue}let T=w,R=[];for(let H of L){let O=o?.has(H.column.id)??!1,D=N.cellsByColumn[H.column.id]??[];if(O){R.push({column:H.column,cards:D,h:0});continue}let W=0;for(let z of D)W+=mD(z,t.tagGroups,a,y,m,b,p)+h;W=Math.max(W-(D.length>0?h:0),0),R.push({column:H.column,cards:D,h:W}),W>T&&(T=W)}let G=Math.max(T,w),I=R.map((H,O)=>{let D=L[O];if(o?.has(D.column.id)??!1)return{column:H.column,cards:H.cards,cardLayouts:[]};let z=[],P=0;for(let B of H.cards){let Y=mD(B,t.tagGroups,a,y,m,b,p);z.push({x:D.x+f,y:M+P,width:D.width-f*2,height:Y,card:B}),P+=Y+h}return{column:H.column,cards:H.cards,cardLayouts:z}});C.push({bucket:N,y:M,height:G,cells:I}),M+=G+E}let k=M-E+f+i;return{columnXs:L,lanes:C,totalWidth:A,totalHeight:k,startY:x}}function eZ(t,e,n,r,o,a,i,s,l,c,d=vf,u=dg,f=i1,p=kf,m=pg,h=ig,g=sg,E=hd,y=bd,b=lg,S=a1,x=s1,L=yd,v=gd,A=o1,C=gD,M=yD,w=hD,k=6,N=cg,_=r1,T=ug,R=fg){let G=e.columns.filter(P=>!ag(P.name)),I=J7(G,r),H=tZ(e,I,n,s,l,c,d,u,f,p,m,h,g,E,y,b,S,x,L,v),O=parseFloat(t.attr("width")||"0"),D=parseFloat(t.attr("height")||"0");H.totalWidth>O&&(t.attr("width",H.totalWidth),t.attr("viewBox",`0 0 ${H.totalWidth} ${Math.max(D,H.totalHeight)}`)),H.totalHeight>D&&(t.attr("height",H.totalHeight),t.attr("viewBox",`0 0 ${Math.max(O,H.totalWidth)} ${H.totalHeight}`));let W=a?Gt(o.surface,o.bg,50):Gt(o.surface,o.bg,30),z=a?Gt(o.surface,o.bg,70):Gt(o.surface,o.bg,50);for(let P of H.columnXs){let B=P.column,Y=l?.has(B.id)??!1,V=t.append("g").attr("class","kanban-column kanban-column-header").attr("data-column-id",B.id).attr("data-line-number",B.lineNumber),j=B.color?ie(o,B.color,a,{solid:e.options["solid-fill"]==="on"}):z;if(V.append("rect").attr("x",P.x).attr("y",H.startY).attr("width",P.width).attr("height",h).attr("rx",M).attr("fill",j),Y)V.append("text").attr("x",P.x+P.width/2).attr("y",H.startY+h/2+w/2-1).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String(B.cards.length));else{V.append("text").attr("x",P.x+g).attr("y",H.startY+h/2+A/2-2).attr("font-size",A).attr("font-weight","bold").attr("fill",o.text).text(B.name);let K=B.wipLimit!=null&&B.cards.length>B.wipLimit,$=B.wipLimit!=null?`${B.cards.length}/${B.wipLimit}`:String(B.cards.length);V.append("text").attr("x",P.x+P.width-g).attr("y",H.startY+h/2+w/2-1).attr("text-anchor","end").attr("font-size",w).attr("fill",K?o.colors.red:o.textMuted).attr("font-weight",K?"bold":"normal").text($)}}for(let P of H.lanes){let B=s?.has(P.bucket.laneName)??!1,Y=t.append("g").attr("class","kanban-lane").attr("data-lane-name",P.bucket.laneName),V=Y.append("g").attr("class","kanban-lane-header").attr("transform",`translate(${d}, ${P.y-g})`);V.append("rect").attr("x",0).attr("y",0).attr("width",f-8).attr("height",P.height+g*2).attr("rx",C).attr("fill",W);let j=10,K=P.cells.reduce(($,U)=>$+U.cards.length,0);if(P.bucket.laneColor&&(V.append("circle").attr("cx",j+4).attr("cy",16).attr("r",4).attr("fill",P.bucket.laneColor),j+=14),B?V.append("text").attr("x",j).attr("y",20).attr("font-size",10).attr("fill",o.textMuted).text(`${P.bucket.laneName} (${K})`):V.append("text").attr("x",j).attr("y",20).attr("font-size",12).attr("font-weight","bold").attr("fill",P.bucket.isFallback?o.textMuted:o.text).text(P.bucket.laneName),B)for(let $ of P.cells){let U=l?.has($.column.id)??!1;if($.cards.length>0){let X=H.columnXs.find(tt=>tt.column.id===$.column.id);if(!X)continue;let q=P.bucket.laneColor?Gt(P.bucket.laneColor,o.bg,a?40:28):Gt(o.textMuted,o.bg,a?28:22),et=U?m-8:X.width-g*2;Y.append("rect").attr("x",X.x+(U?4:g)).attr("y",P.y).attr("width",et).attr("height",18).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+(U?4:g)+et/2).attr("y",P.y+13).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}}if(Y.append("line").attr("x1",d+f).attr("x2",H.totalWidth-d).attr("y1",P.y+P.height+g).attr("y2",P.y+P.height+g).attr("stroke",o.border??o.textMuted).attr("stroke-opacity",.4).attr("stroke-width",1),!B)for(let $ of P.cells){if((l?.has($.column.id)??!1)&&$.cards.length>0){let X=H.columnXs.find(q=>q.column.id===$.column.id);if(X){let q=P.bucket.laneColor?Gt(P.bucket.laneColor,o.bg,a?40:28):Gt(o.textMuted,o.bg,a?28:22);Y.append("rect").attr("x",X.x+4).attr("y",P.y).attr("width",m-8).attr("height",22).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+m/2).attr("y",P.y+16).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}continue}for(let X of $.cardLayouts)nZ(Y,X,e.tagGroups,i,o,a,c,e.options["solid-fill"]==="on",k,N,y,_,T,R,E,L,v)}}}function nZ(t,e,n,r,o,a,i,s,l=6,c=cg,d=bd,u=r1,f=ug,p=fg,m=hd,h=yd,g=gd){let E=e.card,y=bD(E,n,r),b=mg(E,n,i),S=b.length>0||E.details.length>0,x=ie(o,y??o.primary,a,{...s!==void 0&&{solid:s}}),L=y??o.textMuted,v=ve(x,o.textOnFillLight,o.textOnFillDark),A=t.append("g").attr("class","kanban-card").attr("data-card-id",E.id).attr("data-line-number",E.lineNumber);if(r){let k=qt(r),N=n.find(T=>T.name.toLowerCase()===k),_=E.tags[k]??N?.defaultValue;_&&A.attr(`data-tag-${k}`,_.toLowerCase())}let C=e.x,M=e.y;A.append("rect").attr("x",C).attr("y",M).attr("width",e.width).attr("height",e.height).attr("rx",l).attr("fill",x).attr("stroke",L).attr("stroke-width",u);let w=A.append("text").attr("x",C+c).attr("y",M+d+f).attr("font-size",f).attr("font-weight","500").attr("fill",v);if(gn(w,E.title,o,f),S){let k=M+m;A.append("line").attr("x1",C).attr("y1",k).attr("x2",C+e.width).attr("y2",k).attr("stroke",L).attr("stroke-opacity",.3).attr("stroke-width",1);let N=k+h+p;for(let _ of b){A.append("text").attr("x",C+c).attr("y",N).attr("font-size",p).attr("fill",o.textMuted).text(`${_.label}: `);let T=_t(`${_.label}: `,p);A.append("text").attr("x",C+c+T).attr("y",N).attr("font-size",p).attr("fill",v).text(_.value),N+=g}for(let _ of E.details){let T=A.append("text").attr("x",C+c).attr("y",N).attr("font-size",p).attr("fill",o.textMuted);gn(T,_,o,p),N+=g}}}var vf,kf,ig,sg,n1,hd,gd,yd,lg,cg,bd,r1,dg,o1,ug,fg,hD,gD,yD,pg,a1,i1,s1,SD=st(()=>{"use strict";Ke();Xn();on();tn();_o();mh();pD();Mr();To();Br();fr();en();vf=20,kf=16,ig=36,sg=12,n1=200,hd=24,gd=14,yd=4,lg=8,cg=10,bd=6,r1=1.5,dg=30,o1=13,ug=12,fg=10,hD=10,gD=8,yD=8,pg=40,a1=26;i1=140,s1=14});var kD={};ye(kD,{layoutClassDiagram:()=>c1});function lZ(t){let e=t.members.filter(d=>!d.isMethod),n=t.members.filter(d=>d.isMethod),r=t.modifier==="enum",o=_t(t.name,iZ);t.modifier&&(o=Math.max(o,_t(`\xAB${t.modifier}\xBB`,vD)));for(let d of t.members){let u=d.name;d.isMethod?(u+=`(${d.params??""})`,d.type&&(u+=`: ${d.type}`)):d.type&&(u+=`: ${d.type}`),u=`+ ${u}`,o=Math.max(o,_t(u,vD))}let a=Math.max(rZ,o+oZ),i=aZ+(t.modifier?sZ:0),s;if(r){let d=t.members;d.length>0?s=xd*2+d.length*l1+wd:s=wd+xd}else e.length>0?s=xd*2+e.length*l1+wd:s=wd+xd;let l=0;r||(n.length>0?l=xd*2+n.length*l1+wd:l=wd+xd);let c=i+s+l;return{width:a,height:c,headerHeight:i,fieldsHeight:s,methodsHeight:l}}function c1(t,e){if(t.classes.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new er.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,edgesep:20}),n.setDefaultEdgeLabel(()=>({}));let r=new Map;for(let x of t.classes){let L=lZ(x);r.set(x.id,L),n.setNode(x.id,{label:x.name,width:L.width,height:L.height})}for(let x of t.relationships)n.setEdge(x.source,x.target,{label:x.label??""});er.layout(n);let a=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.classes.map(x=>({id:x.id,label:x.name}))),i=Hc(t.classes.map(x=>{let L=n.node(x.id);return{id:x.id,x:L.x,y:L.y,width:L.width,height:L.height}}),a,"TB",e?.collapsedNotes),s=t.classes.map(x=>{let L=n.node(x.id),v=r.get(x.id),A=i.get(x.id);return{...x,x:L.x,y:L.y,width:v.width,height:v.height,headerHeight:v.headerHeight,fieldsHeight:v.fieldsHeight,methodsHeight:v.methodsHeight,...A&&{note:A}}}),l=t.relationships.map(x=>{let L=n.edge(x.source,x.target);return{source:x.source,target:x.target,type:x.type,points:L?.points??[],...x.label!==void 0&&{label:x.label},lineNumber:x.lineNumber}}),c=1/0,d=1/0,u=-1/0,f=-1/0,p=(x,L,v,A)=>{x<c&&(c=x),L<d&&(d=L),v>u&&(u=v),A>f&&(f=A)};for(let x of s)p(x.x-x.width/2,x.y-x.height/2,x.x+x.width/2,x.y+x.height/2),x.note&&!x.note.collapsed&&p(x.x+x.note.x,x.y+x.note.y,x.x+x.note.x+x.note.width,x.y+x.note.y+x.note.height);Number.isFinite(c)||(c=0,d=0,u=0,f=0);let{shiftX:m,shiftY:h}=Ws(c,d),g=m!==0||h!==0,E=g?s.map(x=>({...x,x:x.x+m,y:x.y+h})):s,y=g?l.map(x=>({...x,points:x.points.map(L=>({x:L.x+m,y:L.y+h}))})):l,b=u+m+40,S=f+h+40;return{nodes:E,edges:y,width:b,height:S}}var rZ,oZ,aZ,iZ,vD,sZ,l1,xd,wd,d1=st(()=>{"use strict";ls();en();es();rZ=140,oZ=24,aZ=36,iZ=13,vD=11,sZ=16,l1=18,xd=8,wd=1});var _D={};ye(_D,{renderClassDiagram:()=>CD,renderClassDiagramForExport:()=>LZ});function MD(t,e,n){if(n)return e.textMuted;switch(t){case"interface":return e.colors.blue;case"abstract":return e.colors.purple;case"enum":return e.colors.yellow;default:return e.colors.teal}}function gZ(t,e,n,r,o,a){let i=r??MD(n,t,o);return ie(t,i,e,{...a!==void 0&&{solid:a}})}function yZ(t,e,n,r){return n??MD(e,t,r)}function TD(t){if(t.options?.["no-auto-color"])return[];let e=new Set;for(let n of t.classes)n.color||e.add(n.modifier??"class");return xZ.filter(n=>e.has(n)).map(n=>bZ[n])}function wZ(t){return t??"class"}function ND(t){switch(t){case"public":return"+";case"private":return"-";case"protected":return"#"}}function SZ(t){return t==="implements"||t==="depends"}function vZ(t){switch(t){case"extends":return"cd-arrow-inherit";case"implements":return"cd-arrow-implement";case"composes":return"cd-arrow-compose";case"aggregates":return"cd-arrow-aggregate";case"depends":return"cd-arrow-depend";case"associates":return"cd-arrow-assoc"}}function kZ(t){return t==="composes"||t==="aggregates"}function CD(t,e,n,r,o,a,i,s,l){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let c=i?.width??t.clientWidth,d=i?.height??t.clientHeight;if(c<=0||d<=0)return;let u=Ee.identity(),f=u.aesthetic(u1),p=u.text(dZ),m=u.text(uZ),h=u.text(fZ),g=u.structural(1.5),E=u.structural(1.5),y=u.structural(pZ),b=u.structural(mZ),S=u.structural(hZ),x=u.text(20),L=u.structural(30),v=u.structural(Se),A=TD(e),C=A.length>1,M=!!e.title&&e.options["no-title"]!=="on",w=M?40:0,N=u.aesthetic(8),_=C?v+N:0,T=n.width,R=n.height,G=d-w-_,I=(c-f*2)/T,H=(G-f*2)/R,O=Math.min(cZ,I,H),D=T*O,W=(c-D)/2,z=w+_+f,P=Rt(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);u.isBelowFloor&&P.attr("width","100%");let B=P.append("defs"),Y=12,V=8;B.append("marker").attr("id","cd-arrow-inherit").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-implement").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1);let j=12,K=8;if(B.append("marker").attr("id","cd-arrow-compose").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-aggregate").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-depend").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),B.append("marker").attr("id","cd-arrow-assoc").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),M){let X=P.append("text").attr("class","chart-title").attr("x",c/2).attr("y",L).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",x).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(X.attr("data-line-number",e.titleLineNumber),a&&X.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let $=s!==!1;if(C){let X=[{name:LD,entries:A.map(et=>({value:et.label,color:r.colors[et.colorKey]}))}],q=P.append("g").attr("class","cd-legend").attr("transform",`translate(0,${w})`);fn(q,{groups:X,activeGroup:$?LD:null,mode:l?"export":"preview",palette:r,isDark:o,width:c})}let U=P.append("g").attr("transform",`translate(${W}, ${z}) scale(${O})`);for(let X of n.edges){if(X.points.length<2)continue;let q=U.append("g").attr("class","cd-edge-group").attr("data-line-number",String(X.lineNumber)).attr("data-source",X.source).attr("data-target",X.target),et=r.textMuted,tt=vZ(X.type),F=SZ(X.type),Q=kZ(X.type),ot=EZ(X.points);if(ot){let Z=q.append("path").attr("d",ot).attr("fill","none").attr("stroke",et).attr("stroke-width",g).attr("class","cd-edge");F&&Z.attr("stroke-dasharray","6 3"),Q?Z.attr("marker-start",`url(#${tt})`):Z.attr("marker-end",`url(#${tt})`)}if(X.label){let Z=Math.floor(X.points.length/2),lt=X.points[Z],nt=_t(X.label,h)+8,J=16;q.append("rect").attr("x",lt.x-nt/2).attr("y",lt.y-J/2-1).attr("width",nt).attr("height",J).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","cd-edge-label-bg"),q.append("text").attr("x",lt.x).attr("y",lt.y+4).attr("text-anchor","middle").attr("fill",et).attr("font-size",h).attr("class","cd-edge-label").text(X.label)}}for(let X of n.nodes){let q=U.append("g").attr("transform",`translate(${X.x}, ${X.y})`).attr("class","cd-class").attr("data-line-number",String(X.lineNumber)).attr("data-node-id",X.id).attr("data-cd-type",wZ(X.modifier));a&&q.style("cursor","pointer").on("click",()=>{a(X.lineNumber)});let et=X.width,tt=X.height,F=!!e.options?.["no-auto-color"],ot=C&&!$&&!X.color?r.primary:X.color,Z=e.options?.["solid-fill"]==="on",lt=gZ(r,o,X.modifier,ot,F,Z),nt=yZ(r,X.modifier,ot,F),J=ve(lt,r.textOnFillLight,r.textOnFillDark);q.append("rect").attr("x",-et/2).attr("y",-tt/2).attr("width",et).attr("height",tt).attr("rx",3).attr("ry",3).attr("fill",lt).attr("stroke",nt).attr("stroke-width",E);let at=-tt/2,it=at+X.headerHeight/2;if(X.modifier){let rt=`\xAB${X.modifier}\xBB`;q.append("text").attr("x",0).attr("y",it-6).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).attr("font-style","italic").text(rt),q.append("text").attr("x",0).attr("y",it+10).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").attr("font-style",X.modifier==="abstract"?"italic":"normal").text(X.name)}else q.append("text").attr("x",0).attr("y",it).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").text(X.name);at+=X.headerHeight;let vt=X.modifier==="enum",Tt=X.members.filter(rt=>!rt.isMethod),At=X.members.filter(rt=>rt.isMethod);if(vt){q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5);let rt=at+b;for(let pt of X.members)q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).text(pt.name),rt+=y}else{if(q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),Tt.length>0){let rt=at+b;for(let pt of Tt){let dt=`${ND(pt.visibility)} ${pt.name}`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}if(at+=X.fieldsHeight,q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),At.length>0){let rt=at+b;for(let pt of At){let dt=`${ND(pt.visibility)} ${pt.name}(${pt.params??""})`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}}if(X.note)if(X.note.collapsed)Mi(q,{x:et/2-Yo-3,y:-tt/2+Yo+3},r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber});else{let[rt,pt,ht,dt]=Li({width:et,height:tt},X.note);ki(q,rt,pt,ht,dt,r),Ni(q,{x:X.note.x,y:X.note.y,width:X.note.width,height:X.note.height},X.note.lines,r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber,interactive:!0})}}}function LZ(t,e,n){let r=Yc(t,n);if(r.error||r.classes.length===0)return"";let o=c1(r),a=e==="dark",l=TD(r).length>1?Se+8:0,c=o.width+u1*2,d=o.height+u1*2+(r.title?40:0)+l;return cd(c,d,u=>(CD(u,r,o,n,a,void 0,{width:c,height:d},!0,!0),dd(u,e)))}var u1,cZ,dZ,uZ,fZ,pZ,mZ,hZ,bZ,xZ,LD,EZ,AD=st(()=>{"use strict";Xn();Eo();on();Qh();Mr();Br();tn();Qu();d1();fr();en();Ti();u1=20,cZ=3,dZ=13,uZ=11,fZ=11,pZ=18,mZ=8,hZ=10;bZ={class:{label:"Class",colorKey:"teal"},abstract:{label:"Abstract",colorKey:"purple"},interface:{label:"Interface",colorKey:"blue"},enum:{label:"Enum",colorKey:"yellow"}},xZ=["class","abstract","interface","enum"];LD="Type";EZ=Kn().x(t=>t.x).y(t=>t.y).curve(fo)});var ID={};ye(ID,{layoutERDiagram:()=>m1});function PZ(t){let e=_t(t.name,MZ);for(let i of t.columns){let s=i.name;i.type&&(s+=`: ${i.type}`);let l=_t(s,TZ);i.constraints.length>0&&(l+=_Z),e=Math.max(e,l)}let n=Math.max(f1,e+NZ),r=p1,o=0;t.columns.length>0&&(o=RZ*2+t.columns.length*AZ+IZ);let a=r+o+(o===0?4:0);return{width:n,height:a,headerHeight:r,columnsHeight:o}}function DZ(t,e){let n=new Map;for(let a of t)n.set(a,new Set);for(let a of e)n.get(a.source)?.add(a.target),n.get(a.target)?.add(a.source);let r=new Set,o=[];for(let a of t){if(r.has(a))continue;let i=[],s=[a];for(;s.length>0;){let l=s.shift();if(!r.has(l)){r.add(l),i.push(l);for(let c of n.get(l)??[])r.has(c)||s.push(c)}}o.push(i)}return o}function OZ(t,e,n){let r=new Map,o=new Map;if(t.length===1){let d=t[0],u=n.get(d.id);return r.set(d.id,{x:u.width/2,y:u.height/2,...u}),{nodePositions:r,edgePoints:o,width:u.width,height:u.height}}let a=new er.graphlib.Graph({multigraph:!0});a.setGraph({rankdir:"LR",nodesep:40,ranksep:80,edgesep:20}),a.setDefaultEdgeLabel(()=>({}));for(let d of t){let u=n.get(d.id);a.setNode(d.id,{width:u.width,height:u.height})}for(let d of e)a.setEdge(d.source,d.target,{label:d.label??""},String(d.lineNumber));er.layout(a);let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of t){let u=a.node(d.id),f=n.get(d.id);i=Math.min(i,u.x-f.width/2),s=Math.min(s,u.y-f.height/2),l=Math.max(l,u.x+f.width/2),c=Math.max(c,u.y+f.height/2)}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));for(let f of u?.points??[])i=Math.min(i,f.x),s=Math.min(s,f.y),l=Math.max(l,f.x),c=Math.max(c,f.y);if(d.label&&(u?.points??[]).length>0){let f=u.points,p=f[Math.floor(f.length/2)],m=(_t(d.label,CZ)+8)/2;i=Math.min(i,p.x-m),l=Math.max(l,p.x+m)}}for(let d of t){let u=a.node(d.id),f=n.get(d.id);r.set(d.id,{x:u.x-i,y:u.y-s,...f})}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));o.set(d.lineNumber,(u?.points??[]).map(f=>({x:f.x-i,y:f.y-s})))}return{nodePositions:r,edgePoints:o,width:Math.max(0,l-i),height:Math.max(0,c-s)}}function GZ(t){if(t.length===0)return[];let e=[...t].sort((l,c)=>{let d=l.compIds.length>1?1:0,u=c.compIds.length>1?1:0;return d!==u?u-d:c.compLayout.height-l.compLayout.height}),n=t.reduce((l,c)=>l+(c.compLayout.width||f1)*(c.compLayout.height||p1),0),r=Math.max(Math.sqrt(n)*1.5,e[0].compLayout.width),o=[],a=0,i=0,s=0;for(let l of e){let c=l.compLayout.width||f1,d=l.compLayout.height||p1;a>0&&a+c>r&&(i+=s+RD,a=0,s=0),o.push({compIds:l.compIds,compLayout:l.compLayout,offsetX:a,offsetY:i}),a+=c+RD,s=Math.max(s,d)}return o}function m1(t,e){if(t.tables.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new Map;for(let C of t.tables)n.set(C.id,PZ(C));let r=DZ(t.tables.map(C=>C.id),t.relationships),o=new Map(t.tables.map(C=>[C.id,C])),a=r.map(C=>{let M=C.map(k=>o.get(k)),w=t.relationships.filter(k=>C.includes(k.source));return{compIds:C,compLayout:OZ(M,w,n)}}),i=GZ(a),s=new Map;for(let C of i)for(let M of C.compIds)s.set(M,C);let l=new Map;for(let C of i)for(let M of C.compLayout.edgePoints.keys())l.set(M,C);let c=t.tables.map(C=>{let M=s.get(C.id),w=M.compLayout.nodePositions.get(C.id);return{...C,x:w.x+M.offsetX+Ed,y:w.y+M.offsetY+Ed,width:w.width,height:w.height,headerHeight:w.headerHeight,columnsHeight:w.columnsHeight}}),d=t.relationships.map(C=>{let M=l.get(C.lineNumber),w=M?.compLayout.edgePoints.get(C.lineNumber)??[];return{source:C.source,target:C.target,cardinality:C.cardinality,points:w.map(k=>({x:k.x+(M?.offsetX??0)+Ed,y:k.y+(M?.offsetY??0)+Ed})),...C.label!==void 0&&{label:C.label},lineNumber:C.lineNumber}}),f=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.tables.map(C=>({id:C.id,label:C.name}))),p=Hc(c.map(C=>({id:C.id,x:C.x,y:C.y,width:C.width,height:C.height})),f,"TB",e?.collapsedNotes),m=c.map(C=>{let M=p.get(C.id);return M?{...C,note:M}:C}),h=1/0,g=1/0,E=-1/0,y=-1/0,b=(C,M,w,k)=>{C<h&&(h=C),M<g&&(g=M),w>E&&(E=w),k>y&&(y=k)};for(let C of m)b(C.x-C.width/2,C.y-C.height/2,C.x+C.width/2,C.y+C.height/2),C.note&&!C.note.collapsed&&b(C.x+C.note.x,C.y+C.note.y,C.x+C.note.x+C.note.width,C.y+C.note.y+C.note.height);for(let C of d)for(let M of C.points)b(M.x,M.y,M.x,M.y);Number.isFinite(h)||(h=0,g=0,E=0,y=0);let{shiftX:S,shiftY:x}=Ws(h,g),L=S!==0||x!==0,v=L?m.map(C=>({...C,x:C.x+S,y:C.y+x})):m,A=L?d.map(C=>({...C,points:C.points.map(M=>({x:M.x+S,y:M.y+x}))})):d;return{nodes:v,edges:A,width:E+S+Ed,height:y+x+Ed}}var f1,NZ,p1,MZ,TZ,CZ,_Z,AZ,RZ,IZ,Ed,RD,h1=st(()=>{"use strict";ls();en();es();f1=140,NZ=24,p1=36,MZ=13,TZ=11,CZ=11,_Z=16,AZ=18,RZ=8,IZ=1,Ed=30,RD=60});function OD(t,e){let n=new Map;if(t.length===0)return n;let r={};for(let f of t)r[f.id]=0;for(let f of e)f.source!==f.target&&(f.cardinality.from==="1"&&f.cardinality.to!=="1"&&(r[f.source]=(r[f.source]??0)+1),f.cardinality.to==="1"&&f.cardinality.from!=="1"&&(r[f.target]=(r[f.target]??0)+1));let o=new Map;for(let f of e)f.source!==f.target&&(f.cardinality.from==="*"&&(o.has(f.source)||o.set(f.source,new Set),o.get(f.source).add(f.target)),f.cardinality.to==="*"&&(o.has(f.target)||o.set(f.target,new Set),o.get(f.target).add(f.source)));let a=new Set;for(let[f,p]of o)p.size>=2&&a.add(f);let i=Object.values(r),s=i.reduce((f,p)=>f+p,0)/i.length,l=i.reduce((f,p)=>f+(p-s)**2,0)/i.length,c=Math.sqrt(l),d=[...i].sort((f,p)=>f-p),u=d.length%2===0?(d[d.length/2-1]+d[d.length/2])/2:d[Math.floor(d.length/2)];for(let f of t){let p=f.id,m=f.columns,h=m.filter(N=>N.constraints.includes("fk")),g=m.filter(N=>N.constraints.includes("pk")&&N.constraints.includes("fk")),E=h.length,y=m.length===0?0:E/m.length,b=r[p]??0,S=f.name.toLowerCase(),x=e.filter(N=>(N.source===p||N.target===p)&&N.source!==N.target),L=e.some(N=>N.source===p&&N.target===p),v=new Set;for(let N of x)v.add(N.source===p?N.target:N.source);if(L&&x.length===0){n.set(p,"self-referential");continue}let A=g.length>=2&&v.size===1,C=y>=.6&&!A,M=g.length>=2&&v.size>=2,w=a.has(p);if(C||M||w){n.set(p,"junction");continue}if(y>=.4&&y<.6&&g.length<2&&!a.has(p)){n.set(p,"ambiguous");continue}if($Z.some(N=>S.endsWith(N))&&m.length<=6&&E<=1&&b>u){n.set(p,"lookup");continue}if(t.length>=6&&b>0&&b>s+1.5*c&&b>=2*s){n.set(p,"hub");continue}if(E>0){n.set(p,"dependent");continue}n.set(p,"core")}return n}var g1,PD,DD,$Z,GD=st(()=>{"use strict";g1={core:"green",dependent:"blue",junction:"red",ambiguous:"purple",lookup:"yellow",hub:"orange","self-referential":"teal",unclassified:"gray"},PD={core:"Core entity",dependent:"Dependent",junction:"Junction / M:M",ambiguous:"Bridge",lookup:"Lookup / Reference",hub:"Hub","self-referential":"Self-referential",unclassified:"Unclassified"},DD=["core","dependent","junction","ambiguous","lookup","hub","self-referential","unclassified"],$Z=["_type","_status","_code","_category"]});var BD={};ye(BD,{renderERDiagram:()=>WD,renderERDiagramForExport:()=>XZ});function VZ(t){switch(t){case"pk":return"\u2666";case"fk":return"\u2192";case"unique":return"\u25C6";case"nullable":return"\u25CB"}}function $D(t,e,n,r,o,a,i=HD,s=1.5){let l=e.x-n.x,c=e.y-n.y,d=Math.sqrt(l*l+c*c);if(d===0)return;let u=l/d,f=c/d,p=-f,m=u,h=s+.5;if(a){let b=e.x-u*15,S=e.y-f*15,x=r==="1"?"1":r==="*"?"*":"0..1";t.append("text").attr("x",b+p*12).attr("y",S+m*12).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",o).attr("font-size",i).text(x);return}let g=14,E=9;if(r==="1"){let y=e.x-u*g,b=e.y-f*g;t.append("line").attr("x1",y+p*E).attr("y1",b+m*E).attr("x2",y-p*E).attr("y2",b-m*E).attr("stroke",o).attr("stroke-width",h)}else if(r==="*"){let S=e.x-u*18,x=e.y-f*18,L=e.x-u*5,v=e.y-f*5;t.append("line").attr("x1",S).attr("y1",x).attr("x2",L+p*E).attr("y2",v+m*E).attr("stroke",o).attr("stroke-width",h),t.append("line").attr("x1",S).attr("y1",x).attr("x2",L-p*E).attr("y2",v-m*E).attr("stroke",o).attr("stroke-width",h),t.append("line").attr("x1",S).attr("y1",x).attr("x2",L).attr("y2",v).attr("stroke",o).attr("stroke-width",h)}else if(r==="?"){let b=g+10+2,S=e.x-u*b,x=e.y-f*b;t.append("circle").attr("cx",S).attr("cy",x).attr("r",5).attr("fill","none").attr("stroke",o).attr("stroke-width",h);let L=e.x-u*g,v=e.y-f*g;t.append("line").attr("x1",L+p*E).attr("y1",v+m*E).attr("x2",L-p*E).attr("y2",v-m*E).attr("stroke",o).attr("stroke-width",h)}}function WD(t,e,n,r,o,a,i,s,l,c){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let d=e.tagGroups.length===0&&n.nodes.every(V=>!V.color),u=8,f=e.tagGroups.length>0,p=d?Se+u:f?Se+u:0,m=!!e.title&&e.options["no-title"]!=="on",h=m?40:0,g=n.width,E=n.height,y=Ee.identity(),b=y.aesthetic(y1),S=y.text(WZ),x=y.text(BZ),L=y.text(HD),v=y.structural(1.5),A=y.structural(1.5),C=y.structural(FZ),M=y.structural(YZ),w=y.structural(zZ),k=y.text(20),N=y.structural(30),_=g+b*2,T=E+h+p+b*2,R,G,I,H,O;if(i){R=i.width??_,G=i.height??T;let V=G-h-p,j=(R-b*2)/g,K=(V-b*2)/E;I=Math.min(HZ,j,K);let $=g*I;H=(R-$)/2,O=h+p+b}else R=_,G=T,I=1,H=b,O=h+p+b;if(R<=0||G<=0)return;let D=Rt(t).append("svg").attr("width",i?R:"100%").attr("height",i?G:"100%").attr("viewBox",`0 0 ${R} ${G}`).attr("preserveAspectRatio","xMidYMid meet").style("font-family",It);if(m){let V=D.append("text").attr("class","chart-title").attr("x",R/2).attr("y",N).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(V.attr("data-line-number",e.titleLineNumber),a&&V.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let W=D.append("g").attr("transform",`translate(${H}, ${O}) scale(${I})`),z=ir(r),P=d?OD([...e.tables],[...e.relationships]):null,B=P!==null&&(l??!0),Y=e.options.notation==="labels";for(let V of n.edges){if(V.points.length<2)continue;let j=W.append("g").attr("class","er-edge-group").attr("data-line-number",String(V.lineNumber)).attr("data-source",V.source).attr("data-target",V.target),K=r.textMuted,$=UZ(V.points);$&&j.append("path").attr("d",$).attr("fill","none").attr("stroke",K).attr("stroke-width",v).attr("class","er-edge");let U=V.points;if($D(j,U[0],U[1],V.cardinality.from,K,Y,L,v),$D(j,U[U.length-1],U[U.length-2],V.cardinality.to,K,Y,L,v),V.label){let X=Math.floor(U.length/2),q=U[X],et=_t(V.label,L)+8,tt=16;j.append("rect").attr("x",q.x-et/2).attr("y",q.y-tt/2-1).attr("width",et).attr("height",tt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","er-edge-label-bg"),j.append("text").attr("x",q.x).attr("y",q.y+4).attr("text-anchor","middle").attr("fill",K).attr("font-size",L).attr("class","er-edge-label").text(V.label)}}for(let V=0;V<n.nodes.length;V++){let j=n.nodes[V],K=ar(j.metadata,[...e.tagGroups],s??null),$=B?r.colors[g1[P.get(j.id)??"unclassified"]]:P?r.primary:void 0,U=j.color??K??$??z[V%z.length],X=W.append("g").attr("transform",`translate(${j.x}, ${j.y})`).attr("class","er-table").attr("data-line-number",String(j.lineNumber)).attr("data-node-id",j.id);if(s){let lt=qt(s),nt=j.metadata[lt];nt&&X.attr(`data-tag-${lt}`,nt.toLowerCase())}if(P){let lt=P.get(j.id);lt&&X.attr("data-er-role",lt)}a&&X.style("cursor","pointer").on("click",()=>{a(j.lineNumber)});let q=j.width,et=j.height,tt=ie(r,U,o,{solid:e.options["solid-fill"]==="on"}),F=U,Q=ve(tt,r.textOnFillLight,r.textOnFillDark);X.append("rect").attr("x",-q/2).attr("y",-et/2).attr("width",q).attr("height",et).attr("rx",3).attr("ry",3).attr("fill",tt).attr("stroke",F).attr("stroke-width",A);let ot=-et/2,Z=ot+j.headerHeight/2;if(X.append("text").attr("x",0).attr("y",Z).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",Q).attr("font-size",S).attr("font-weight","bold").text(j.name),ot+=j.headerHeight,j.columns.length>0){X.append("line").attr("x1",-q/2).attr("y1",ot).attr("x2",q/2).attr("y2",ot).attr("stroke",F).attr("stroke-width",.5).attr("stroke-opacity",.5);let lt=ot+M;for(let nt of j.columns){let J=-q/2+w,at=nt.constraints[0];at&&X.append("text").attr("x",J).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(VZ(at));let it=-q/2+w+(at?16:0),vt=nt.name;nt.type&&(vt+=`: ${nt.type}`),X.append("text").attr("x",it).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(vt),lt+=C}}if(j.note)if(j.note.collapsed)Mi(X,{x:q/2-Yo-3,y:-et/2+Yo+3},r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber});else{let[lt,nt,J,at]=Li({width:q,height:et},j.note);ki(X,lt,nt,J,at,r),Ni(X,{x:j.note.x,y:j.note.y,width:j.note.width,height:j.note.height},j.note.lines,r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber,interactive:!0})}}if(e.tagGroups.length>0){let V=b+h,j=D.append("g").attr("class","er-tag-legend").attr("transform",`translate(0,${V})`);fn(j,{groups:e.tagGroups,activeGroup:s??null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),j.selectAll("[data-legend-group]").classed("er-legend-group",!0)}if(P){let V=DD.filter(j=>{for(let K of P.values())if(K===j)return!0;return!1});if(V.length>0){let j=b+h,K=[{name:"Role",entries:V.map(U=>({value:PD[U],color:r.colors[g1[U]]}))}],$=D.append("g").attr("class","er-semantic-legend").attr("transform",`translate(0,${j})`);fn($,{groups:K,activeGroup:B?"Role":null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),$.selectAll("[data-legend-group]").classed("er-legend-group",!0)}}}function XZ(t,e,n){let r=zc(t,n);if(r.error||r.tables.length===0)return"";let o=m1(r),a=e==="dark",i=document.createElement("div"),s=o.width+y1*2,l=o.height+y1*2+(r.title&&r.options["no-title"]!=="on"?40:0);i.style.width=`${s}px`,i.style.height=`${l}px`,i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i);try{WD(i,r,o,n,a,void 0,{width:s,height:l},void 0,void 0,!0);let c=i.querySelector("svg");return c?(e==="transparent"&&(c.style.background="none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.fontFamily=It,c.outerHTML):""}finally{document.body.removeChild(i)}}var y1,HZ,WZ,BZ,HD,FZ,YZ,zZ,UZ,FD=st(()=>{"use strict";Ke();Xn();Eo();on();tn();yi();Ke();Mr();Br();fr();en();Ti();Ju();h1();GD();y1=20,HZ=3,WZ=13,BZ=11,HD=11,FZ=18,YZ=8,zZ=10;UZ=Kn().x(t=>t.x).y(t=>t.y).curve(fo)});var qD={};ye(qD,{renderBoxesAndLines:()=>jD,renderBoxesAndLinesForExport:()=>lQ});function oQ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t[r-1],a=t[r],i=r+1<t.length?t[r+1]:"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function hg(t,e,n){let r=e-XD*2,o=t.split(/(\s+|-)/),a=[];for(let s of o)!s||/^\s+$/.test(s)||s==="-"||a.push(...oQ(s));for(let s=qZ;s>=gg;s--){if(r<_t("MM",s))continue;let l=[],c="";for(let p of a){let m=c?`${c} ${p}`:p;_t(m,s)<=r?c=m:(c&&l.push(c),c=p)}c&&l.push(c);let d=p=>_t(p,s)<=r;if(l.length<=n&&l.every(d))return{lines:l,fontSize:s};if(l.length<=n)return{lines:l.map(m=>d(m)?m:tr(m,s,r)),fontSize:s};let u=l.slice(0,n).map(p=>d(p)?p:tr(p,s,r)),f=u[n-1];return f.endsWith("\u2026")||(u[n-1]=tr(f+"\u2026",s,r)),{lines:u,fontSize:s}}return{lines:[tr(t,gg,r)],fontSize:gg}}function aQ(t,e,n,r,o,a,i){let s=Gt(r.bg,r.text,o?90:95);if(a.active){if(t.value===void 0){let g=ve(s,r.textOnFillLight,r.textOnFillDark);return{fill:s,stroke:a.hue,text:g}}let f=a.fillForValue(t.value),p=ie(r,f,o,{...i!==void 0&&{solid:i}}),m=a.twoColor?f:a.hue,h=ve(p,r.textOnFillLight,r.textOnFillDark);return{fill:p,stroke:m,text:h}}let l=ar(t.metadata,[...e],n);if(l){let f=ie(r,l,o,{...i!==void 0&&{solid:i}}),p=l,m=ve(f,r.textOnFillLight,r.textOnFillDark);return{fill:f,stroke:p,text:m}}let c=Gt(r.bg,r.text,o?90:95),d=Gt(r.text,r.bg,o?60:40),u=r.text;return{fill:c,stroke:d,text:u}}function iQ(t,e,n,r){if(Object.keys(t.metadata).length>0&&n!=null){let a=ar(t.metadata,[...e],n);if(a)return a}return r.textMuted}function sQ(t,e){for(let n of e){let r=`bl-arrow-${n.replace("#","")}`;if(!t.select(`#${r}`).empty())continue;t.append("marker").attr("id",r).attr("viewBox",`0 0 ${tl*2} ${Di*2}`).attr("refX",tl*2).attr("refY",Di).attr("markerWidth",tl).attr("markerHeight",Di).attr("orient","auto").append("polygon").attr("points",`0,0 ${tl*2},${Di} 0,${Di*2}`).attr("fill",n);let o=`bl-arrow-rev-${n.replace("#","")}`;t.select(`#${o}`).empty()&&t.append("marker").attr("id",o).attr("viewBox",`0 0 ${tl*2} ${Di*2}`).attr("refX",0).attr("refY",Di).attr("markerWidth",tl).attr("markerHeight",Di).attr("orient","auto").append("polygon").attr("points",`${tl*2},0 0,${Di} ${tl*2},${Di*2}`).attr("fill",n)}}function jD(t,e,n,r,o,a){let{onClickItem:i,exportDims:s,activeTagGroup:l,hiddenTagValues:c,hideDescriptions:d,controlsExpanded:u,onToggleDescriptions:f,onToggleControlsExpand:p,exportMode:m=!1,controlsHost:h,rampDomain:g}=a??{};Rt(t).selectAll(":not([data-d3-tooltip])").remove();let E=s?.width??t.clientWidth,y=s?.height??t.clientHeight;if(E<=0||y<=0)return;let b=Ee.identity(),S=b.aesthetic(jZ),x=b.text(gg),L=b.text(KZ),v=b.structural(1.5),A=b.structural(1.5),C=b.structural(ZZ),M=b.text(YD),w=b.text(JZ),k=b.structural(tQ),N=b.text(20),_=b.structural(30),T=e.nodes.filter(ft=>ft.value!==void 0).map(ft=>ft.value),R=T.length>0,G=g?.min??(R?Math.min(...T):0),I=g?.max??Math.max(...T),H=Dn(e.boxMetricColor??"",r)??r.primary,O=e.boxMetricLowColor?Dn(e.boxMetricLowColor,r)??void 0:void 0,D=o?Gt(r.surface,r.text,28):r.bg,W=Gt(H,D,b1),z=ft=>{let Wt=I>G?(ft-G)/(I-G):1;if(O!==void 0)return em(O,H,Wt,{isDark:o});let he=b1+Math.max(0,Math.min(1,Wt))*(100-b1);return Gt(H,D,he)},P=R?e.boxMetric?.trim()||"Value":null,B=ft=>{let Wt=ft.trim().toLowerCase();if(Wt===""||Wt==="none")return null;let he=e.tagGroups.find(ne=>ne.name.toLowerCase()===Wt);return he?he.name:Wt===P?.toLowerCase()?P:ft},Y=l,V;Y!==void 0?V=Y===null?null:B(Y):e.options["active-tag"]!==void 0?V=B(e.options["active-tag"]):V=P??(e.tagGroups.length>0?e.tagGroups[0].name:null);let j=P!==null&&V===P,K=P!==null?{name:P,entries:[],gradient:{min:G,max:I,low:O??W,high:H}}:null,$=[...K?[K]:[],...e.tagGroups],U=e.nodes.some(ft=>ft.description&&ft.description.length>0),q=$.length>0||U&&h!=="app"?b.structural(Tr({groups:$,position:{placement:"top-center",titleRelation:"below-title"},mode:m?"export":"preview"},E)):0,et=c??e.initialHiddenTagValues,tt=new Map;for(let ft of e.nodes)tt.set(ft.label,ft);let F=new Map;for(let ft of n.nodes)F.set(ft.label,ft);let Q=!!e.title&&e.options["no-title"]!=="on",ot=Q?40:0,Z=e.nodes.some(ft=>ft.description&&ft.description.length>0),nt=$.length>0||Z&&f?q+8:0,J=new Set(n.groups.map(ft=>ft.label)),at=0;for(let ft of e.groups)ft.children.some(Wt=>J.has(Wt))&&(at+=k);let it=n.width,vt=n.height+ot+nt+at,Tt=E/(it+S*2),At=y/(vt+S*2),rt=Math.min(Tt,At,3),pt=0,ht=0;if(e.nodePositions&&e.nodePositions.size>0){let ft=1/0,Wt=1/0,he=-1/0,ne=-1/0,se=(Zt,Ie)=>{Zt<ft&&(ft=Zt),Zt>he&&(he=Zt),Ie<Wt&&(Wt=Ie),Ie>ne&&(ne=Ie)};for(let Zt of n.nodes)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.groups)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.edges)for(let Ie of Zt.points)se(Ie.x,Ie.y);Number.isFinite(ft)&&(pt=(n.width-he-ft)/2,ht=(n.height-ne-Wt)/2)}let dt=(E-it*rt)/2+pt*rt,ut=S+ot+nt+ht*rt,yt=Rt(t).append("svg").attr("width",E).attr("height",y).attr("viewBox",`0 0 ${E} ${y}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It).style("background",r.bg);b.isBelowFloor&&yt.attr("width","100%");let kt=yt.append("defs");Q&&yt.append("text").attr("x",E/2).attr("y",_).attr("text-anchor","middle").attr("font-size",N).attr("font-weight","700").attr("fill",r.text).text(e.title);let Ot=yt.append("g").attr("transform",`translate(${dt},${ut}) scale(${rt})`),Xt=new Set,bt=new Map;for(let ft=0;ft<n.edges.length;ft++){let Wt=iQ(n.edges[ft],e.tagGroups,V,r);Xt.add(Wt),bt.set(ft,Wt)}sQ(kt,Xt);let Nt=[...n.groups].sort((ft,Wt)=>Wt.width*Wt.height-ft.width*ft.height),Vt=new Set(n.groups.map(ft=>ft.label)),xt=new Set;for(let ft of e.groups)for(let Wt of ft.children)Vt.has(Wt)&&xt.add(ft.label);for(let ft of Nt){let Wt=ft.x-ft.width/2,he=!ft.collapsed&&xt.has(ft.label),ne=he?ft.y-ft.height/2-k:ft.y-ft.height/2,se=he?ft.height+k:ft.height,Zt=Ot.append("g").attr("class",ft.collapsed?"bl-group bl-group-collapsed":"bl-group").attr("data-line-number",String(ft.lineNumber)).attr("data-node-id",ft.label).attr("data-group-toggle",ft.label).style("cursor","pointer");if(ft.collapsed){let Ie=nr(r,o),Ht=r.border;Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",Ie).attr("stroke",Ht).attr("stroke-width",A);let Qt=`bl-clip-${ft.label.replace(/[[\]\s]/g,"")}`;Zt.append("clipPath").attr("id",Qt).append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf),Zt.append("rect").attr("x",Wt).attr("y",ne+ft.height-C).attr("width",ft.width).attr("height",C).attr("fill",Ht).attr("clip-path",`url(#${Qt})`).attr("class","bl-collapse-bar");let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=hg(ft.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("class","bl-group-label").attr("x",ft.x).attr("y",ft.y-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",It).attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",r.text).text(fe.lines[ae])}else Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",se).attr("rx",VD).attr("ry",VD).attr("fill",Gt(r.surface,r.bg,40)).attr("stroke",r.textMuted).attr("stroke-width",1).attr("stroke-opacity",.35),Zt.append("text").attr("class","bl-group-label").attr("x",Wt+ft.width/2).attr("y",ne+18).attr("text-anchor","middle").attr("font-family",It).attr("font-size",w).attr("font-weight","600").attr("fill",r.text).text(ft.label)}for(let ft=0;ft<n.edges.length;ft++){let Wt=n.edges[ft],he=bt.get(ft)??r.textMuted;if(et.size>0){let Qt=!1;for(let[Ut,fe]of et){let de=Wt.metadata[Ut];if(de&&fe.has(de.toLowerCase())){Qt=!0;break}}if(Qt)continue}if(Wt.source===Wt.target){let Qt=F.get(Wt.source);if(Qt){let Ut=Ot.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),fe=`bl-arrow-${he.replace("#","")}`,de=Qt.x,te=Qt.y,ae=Qt.width/2,Te=Qt.height/2,Je=20,sn=de+ae,ze=te+Te*.4,Ce=de+ae*.4,ee=te+Te,oe=sn+ae+Je,Be=ze,dn=Ce,_n=ee+Te+Je;Ut.append("path").attr("class","bl-edge").attr("d",`M ${sn} ${ze} C ${oe} ${Be}, ${dn} ${_n}, ${Ce} ${ee}`).attr("fill","none").attr("stroke",he).attr("stroke-width",v).attr("marker-end",`url(#${fe})`)}continue}let ne;if(Wt.yOffset!==0&&Wt.parallelCount>1){let Qt=F.get(Wt.source),Ut=F.get(Wt.target),fe=Qt?.y??Wt.points[0]?.y??0,de=Ut?.y??Wt.points[Wt.points.length-1]?.y??0,te=Wt.points[0]?.x??0,ae=Wt.points[Wt.points.length-1]?.x??0,Te=(te+ae)/2,Je=(fe+de)/2;ne=[{x:te,y:fe},{x:te+(Te-te)*.3,y:fe+Wt.yOffset*.5},{x:Te,y:Je+Wt.yOffset},{x:ae-(ae-Te)*.3,y:de+Wt.yOffset*.5},{x:ae,y:de}]}else ne=Wt.points.map(Qt=>({x:Qt.x,y:Qt.y}));if(ne.length<2)continue;let se=Ot.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),Zt=`bl-arrow-${he.replace("#","")}`,Ie=Wt.straight?rQ:e.direction==="TB"?nQ:eQ,Ht=se.append("path").attr("class","bl-edge").attr("d",Ie(ne)??"").attr("fill","none").attr("stroke",he).attr("stroke-width",v).attr("marker-end",`url(#${Zt})`);if(Wt.bidirectional){let Qt=`bl-arrow-rev-${he.replace("#","")}`;Ht.attr("marker-start",`url(#${Qt})`)}}for(let ft of n.nodes){let Wt=tt.get(ft.label);if(!Wt)continue;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=Wt.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let he=e.options["solid-fill"]==="on",ne=aQ(Wt,e.tagGroups,V,r,o,{active:j,hue:H,twoColor:O!==void 0,fillForValue:z},he),se=he?ne.text:ne.stroke,Zt=Ot.append("g").attr("class","bl-node").attr("transform",`translate(${ft.x},${ft.y})`).attr("data-line-number",Wt.lineNumber).attr("data-node-id",Wt.label).style("cursor",i?"pointer":"default").style("--bl-node-stroke",ne.stroke);for(let[Ut,fe]of Object.entries(Wt.metadata))Zt.attr(`data-tag-${Ut.toLowerCase()}`,fe.toLowerCase());Wt.value!==void 0&&Zt.attr("data-value",Wt.value),i&&Zt.on("click",Ut=>{Ut.target?.closest("a")||i(Wt.lineNumber)});let Ie=-ft.width/2,Ht=-ft.height/2;Zt.append("rect").attr("x",Ie).attr("y",Ht).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",ne.fill).attr("stroke",ne.stroke).attr("stroke-width",A);let Qt=Wt.description;if(Qt&&Qt.length>0&&!d){let fe=hg(Wt.label,ft.width,3),de=fe.lines,te=fe.fontSize*1.3,ae=de.length*te,Te=ae+12,Je=-ft.height/2+Te/2;for(let An=0;An<de.length;An++)Zt.append("text").attr("x",0).attr("y",Je-ae/2+te/2+An*te).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(de[An]);let sn=-ft.height/2+Te;Zt.append("line").attr("x1",-ft.width/2).attr("y1",sn).attr("x2",ft.width/2).attr("y2",sn).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1);let ze=sn+4+M,Ce=ft.width-XD*2,ee=Math.floor(Ce/(M*Bo)),oe=M*QZ,Be=An=>An.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").replace(/https?:\/\/\S+/g,In=>In.slice(0,20)).length,dn=[];for(let An of Qt){let In=An.startsWith("- ")?"\u2022 "+An.slice(2):An;In=In.replace(/\bhttps?\s+([\w][\w.-]+\.[a-z]{2,}(?:\/\S*)?)/gi,(Ar,lr)=>`https://${lr}`),dn.push(In)}let _n=Ko(dn,ee,Be),He=_n.length>zD,Nn=He?_n.slice(0,zD):_n,jn=-ft.width/2+6,xo=jn+10,Sr=Ns(ne.fill)>.5?r.textMuted:Gt(ne.text,ne.fill,75);for(let An=0;An<Nn.length;An++){let In=Nn[An],Ar=In.text;He&&An===Nn.length-1&&(Ar=_t(Ar,M)>=Ce?tr(Ar,M,Ce):Ar+"\u2026");let lr=ze+An*oe;In.kind==="bullet-first"&&Zt.append("text").attr("x",jn).attr("y",lr).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size",M).attr("fill",Sr).text("\u2022");let Vr=In.kind==="bullet-first"||In.kind==="bullet-cont",Zn=Zt.append("text").attr("x",Vr?xo:0).attr("y",lr).attr("text-anchor",Vr?"start":"middle").attr("dominant-baseline","central").attr("font-size",YD).attr("fill",Sr);gn(Zn,Ar,r,M)}if(He){let An=Qt.join(" "),In=An.length>200?An.slice(0,199)+"\u2026":An;Zt.append("title").text(In)}if(e.showValues&&Wt.value!==void 0){let An=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value);Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",ze+Nn.length*oe).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",UD).attr("font-weight","600").attr("fill",ne.text).text(An)}}else if(e.showValues&&Wt.value!==void 0){let Ut=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value),fe=ft.height/2,de=-ft.height/2+fe,te=hg(Wt.label,ft.width,2),ae=te.fontSize*1.3,Te=te.lines.length*ae,Je=-ft.height/2+fe/2;for(let sn=0;sn<te.lines.length;sn++)Zt.append("text").attr("x",0).attr("y",Je-Te/2+ae/2+sn*ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",te.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(te.lines[sn]);Zt.append("line").attr("x1",-ft.width/2).attr("y1",de).attr("x2",ft.width/2).attr("y2",de).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1),Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",(de+ft.height/2)/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",UD).attr("fill",ne.text).attr("opacity",.85).text(Ut)}else{let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=hg(Wt.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("x",0).attr("y",-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",ne.text).text(fe.lines[ae])}if(ft.note)if(ft.note.collapsed)Mi(Zt,{x:ft.width/2-Yo-3,y:-ft.height/2+Yo+3},r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber});else{let[Ut,fe,de,te]=Li({width:ft.width,height:ft.height},ft.note);ki(Zt,Ut,fe,de,te,r),Ni(Zt,{x:ft.note.x,y:ft.note.y,width:ft.note.width,height:ft.note.height},ft.note.lines,r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber,interactive:!0})}}let Lt=Ot.append("g").attr("class","bl-edge-labels"),Dt=L*1.3;for(let ft of n.edges){if(!ft.labelLines||ft.labelLines.length===0||ft.labelX===void 0||ft.labelY===void 0)continue;let Wt=ft.labelX,he=ft.labelY;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=ft.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ne=ft.labelWidth??0,se=ft.labelHeight??L+6,Zt=ft.labelLines,Ie=Lt.append("g").attr("class","bl-edge-label").attr("data-line-number",String(ft.lineNumber));Ie.append("rect").attr("x",Wt-ne/2).attr("y",he-se/2).attr("width",ne).attr("height",se).attr("rx",3).attr("fill",r.bg).attr("opacity",.72);let Ht=Ie.append("text").attr("x",Wt).attr("text-anchor","middle").attr("font-family",It).attr("font-size",L).attr("fill",r.textMuted),Qt=he-(Zt.length-1)/2*Dt+L/3;Zt.forEach((Ut,fe)=>{Ht.append("tspan").attr("x",Wt).attr("y",Qt+fe*Dt).text(Ut)})}let zt=e.nodes.some(ft=>ft.description&&ft.description.length>0);if($.length>0||zt&&h!=="app"){let ft;zt&&(f||h==="app")&&(ft={toggles:[{id:"descriptions",type:"toggle",label:"Descriptions",active:!d,onToggle:()=>{}}]});let Wt={...p!==void 0&&{onControlsExpand:p},onControlsToggle:(ne,se)=>{ne==="descriptions"&&f&&f(se)}},he=yt.append("g").attr("transform",`translate(0,${ot+4})`);fn(he,{groups:$,activeGroup:V,mode:m?"export":"preview",showInactivePills:!0,...ft!==void 0&&{controlsGroup:ft},...h!==void 0&&{controlsHost:h},...u!==void 0&&{controlsExpanded:u},callbacks:Wt,palette:r,isDark:o,width:E}),he.selectAll("[data-legend-group]").classed("bl-legend-group",!0)}if(!s&&!m){let Wt=yt.append("g").attr("class","bl-focus-icon").attr("data-export-ignore","true").style("display","none").style("pointer-events","auto").style("cursor","pointer");Wt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let he=14/2,ne=14/2;Wt.append("circle").attr("cx",he).attr("cy",ne).attr("r",14/2-1).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1.5),Wt.append("circle").attr("cx",he).attr("cy",ne).attr("r",2).attr("fill",r.textMuted)}}function lQ(t,e,n,r,o,a){jD(t,e,n,r,o,{...a?.exportDims!==void 0&&{exportDims:a.exportDims},...a?.activeTagGroup!==void 0&&{activeTagGroup:a.activeTagGroup},...a?.hiddenTagValues!==void 0&&{hiddenTagValues:a.hiddenTagValues},...a?.exportMode!==void 0&&{exportMode:a.exportMode}})}var jZ,qZ,gg,KZ,Lf,ZZ,tl,Di,YD,QZ,zD,XD,VD,JZ,tQ,b1,UD,eQ,nQ,rQ,KD=st(()=>{"use strict";Xn();Ti();Eo();on();Br();To();tn();xr();Ke();_o();Hs();fr();en();jZ=20,qZ=11,gg=9,KZ=11,Lf=8,ZZ=4,tl=5,Di=4,YD=10,QZ=1.4,zD=6,XD=12,VD=8,JZ=14,tQ=32,b1=15,UD=11,eQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),nQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),rQ=Kn().x(t=>t.x).y(t=>t.y).curve(Qi)});function E1(t,e=xg,n=JD){let r=Tn(t,e,n,{hardBreak:!0});if(r.length>x1){let a=r.slice(0,x1-1),i=r.slice(x1-1).join(" ");a.push(tr(i,e,n)),r=a}let o=0;for(let a of r){let i=_t(a,e);i>o&&(o=i)}return{lines:r,width:o+2*dQ,height:r.length*e*cQ+2*uQ}}function mQ(t){return w1(t,.5).p}function w1(t,e){if(t.length===0)return{p:{x:0,y:0},nx:0,ny:1};if(t.length===1)return{p:{x:t[0].x,y:t[0].y},nx:0,ny:1};let n=[],r=0;for(let i=1;i<t.length;i++){let s=Math.hypot(t[i].x-t[i-1].x,t[i].y-t[i-1].y);n.push(s),r+=s}let o=r*Math.max(0,Math.min(1,e));for(let i=1;i<t.length;i++){let s=n[i-1];if(o<=s||i===t.length-1){let l=s===0?0:Math.min(1,o/s),c=t[i-1].x,d=t[i-1].y,u=t[i].x,f=t[i].y,p=u-c,m=f-d,h=Math.hypot(p,m)||1;return{p:{x:c+p*l,y:d+m*l},nx:-m/h,ny:p/h}}o-=s}let a=t[t.length-1];return{p:{x:a.x,y:a.y},nx:0,ny:1}}function QD(t,e,n,r){return{minX:t-n/2,minY:e-r/2,maxX:t+n/2,maxY:e+r/2}}function bg(t,e,n,r,o,a){let i=t-n/2-a,s=e-r/2-a,l=t+n/2+a,c=e+r/2+a;for(let d of o)if(i<d.maxX&&l>d.minX&&s<d.maxY&&c>d.minY)return!0;return!1}function hQ(){let t=[.5];for(let e=1;e<=pQ;e++){let n=e*.08;.5-n>=.12&&t.push(.5-n),.5+n<=.88&&t.push(.5+n)}return t}function gQ(t,e,n,r){let o=hQ();for(let a of o){let{p:i}=w1(n,a);if(!bg(i.x,i.y,t,e,r,yg))return i}for(let a=ZD;a<=fQ;a+=ZD)for(let i of o){let{p:s,nx:l,ny:c}=w1(n,i);for(let d of[-1,1]){let u=s.x+l*a*d,f=s.y+c*a*d;if(!bg(u,f,t,e,r,yg))return{x:u,y:f}}}return null}function yQ(t){for(let r=0;r<8;r++){let o=!1;for(let a=0;a<t.length;a++)for(let i=a+1;i<t.length;i++){let s=t[a],l=t[i],c=Math.abs(s.cx-l.cx),d=Math.abs(s.cy-l.cy),u=(s.w+l.w)/2+4-c,f=(s.h+l.h)/2+4-d;if(u>0&&f>0){let p=f/2+1;s.cy<l.cy?(s.cy-=p,l.cy+=p):(s.cy+=p,l.cy-=p),o=!0}}if(!o)break}}function S1(t,e){let n=e?.fontSize??xg,r=e?.maxWidth??JD,o=[];for(let l of t.nodes)o.push(QD(l.x,l.y,l.width,l.height));for(let l of t.groups)l.collapsed&&o.push(QD(l.x,l.y,l.width,l.height));let a=[];t.edges.forEach((l,c)=>{if(!l.label||l.points.length<2)return;let d=E1(l.label,n,r),u=mQ(l.points),f=u.y;l.parallelCount>1&&l.yOffset!==0&&(f+=(l.yOffset<0?-1:1)*(d.height/2)),a.push({edgeIdx:c,cx:u.x,cy:f,w:d.width,h:d.height,lines:d.lines,resolved:!0})});for(let l of a){if(!bg(l.cx,l.cy,l.w,l.h,o,yg))continue;let c=t.edges[l.edgeIdx],d=gQ(l.w,l.h,c.points,o);d?(l.cx=d.x,l.cy=d.y):l.resolved=!1}yQ(a);for(let l of a)bg(l.cx,l.cy,l.w,l.h,o,yg)&&(l.resolved=!1);let i=new Map;for(let l of a)i.set(l.edgeIdx,l);let s=t.edges.map((l,c)=>{let d=i.get(c);return d?{...l,labelX:d.cx,labelY:d.cy,labelWidth:d.w,labelHeight:d.h,labelLines:d.lines}:l});return{layout:{...t,edges:s},unresolved:a.filter(l=>!l.resolved).map(l=>l.edgeIdx)}}var xg,JD,x1,cQ,dQ,uQ,yg,ZD,fQ,pQ,v1=st(()=>{"use strict";en();xg=11,JD=160,x1=3,cQ=1.3,dQ=6,uQ=3,yg=4,ZD=8,fQ=40,pQ=9});function kQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function tO(t,e,n){if(t.groups.length>0)return[];let r=t.nodes.length;if(r<3||r>40)return[];let o=t.direction==="TB",a=n?.nodesep??bQ,i=n?.ranksep??xQ,s=n?.backEdgeSide??"nearest",l=n?.restarts??(r<=14?28:r<=25?14:6),c=n?.keepK??3,d=t.nodes.map($=>$.label),u=new Set(d),f=t.edges.map(($,U)=>({e:$,i:U})).filter(({e:$})=>u.has($.source)&&u.has($.target)&&$.source!==$.target);if(f.length===0)return[];let p=new Map;for(let $ of d)p.set($,[]);for(let{e:$,i:U}of f)p.get($.source).push({to:$.target,idx:U});let m=new Set,h=new Map;for(let $ of d)h.set($,0);let g=$=>{h.set($,1);for(let{to:U,idx:X}of p.get($)){let q=h.get(U);q===1?m.add(X):q===0&&g(U)}h.set($,2)};for(let $ of d)h.get($)===0&&g($);let E=f.map(({e:$,i:U})=>m.has(U)?{from:$.target,to:$.source,idx:U,rev:!0}:{from:$.source,to:$.target,idx:U,rev:!1}),y=new Map,b=new Map;for(let $ of d)y.set($,[]),b.set($,0);for(let $ of E)y.get($.from).push($.to),b.set($.to,(b.get($.to)??0)+1);let S=new Map;for(let $ of d)S.set($,0);let x=d.filter($=>(b.get($)??0)===0),L=new Map(b),v=[];for(;x.length;){let $=x.shift();v.push($);for(let U of y.get($))S.set(U,Math.max(S.get(U),S.get($)+1)),L.set(U,L.get(U)-1),L.get(U)===0&&x.push(U)}if(v.length!==d.length)return[];let A=Math.max(...d.map($=>S.get($))),C=new Map;for(let $ of t.nodes){let U=e.get($.label)??{width:Ma,height:aa};C.set($.label,{id:$.label,dummy:!1,rank:S.get($.label),cross:0,thick:o?U.width:U.height,depth:o?U.height:U.width,realW:U.width,realH:U.height})}let M=[],w=[],k=[];for(let $ of E){if($.rev){k.push({edgeIdx:$.idx,src:$.to,tgt:$.from});continue}let U=S.get($.from),X=S.get($.to),q=[$.from],et=$.from;for(let tt=U+1;tt<X;tt++){let F=`__d${$.idx}_${tt}`;C.set(F,{id:F,dummy:!0,rank:tt,cross:0,thick:wQ,depth:0,realW:0,realH:0}),M.push({a:et,b:F}),q.push(F),et=F}M.push({a:et,b:$.to}),q.push($.to),w.push({edgeIdx:$.idx,chain:$.rev?q.slice().reverse():q})}let N=Array.from({length:A+1},()=>[]);for(let $ of C.values())N[$.rank].push($.id);let _=new Map,T=new Map;for(let $ of C.keys())_.set($,[]),T.set($,[]);for(let $ of M)T.get($.a).push($.b),_.get($.b).push($.a);let R=new Map,G=$=>{for(let U of C.keys())R.set(U,$.get(U))},I=$=>{if(!N[$+1])return 0;let X=[];for(let et of N[$]){let tt=R.get(et);for(let F of T.get(et))X.push({p:tt,q:R.get(F)})}let q=0;for(let et=0;et<X.length;et++)for(let tt=et+1;tt<X.length;tt++){let F=X[et],Q=X[tt];(F.p-Q.p)*(F.q-Q.q)<0&&q++}return q},H=()=>{let $=0;for(let U=0;U<A;U++)$+=I(U);return $},O=$=>{if($.length===0)return-1;$.sort((et,tt)=>et-tt);let U=Math.floor($.length/2);if($.length%2===1)return $[U];if($.length===2)return($[0]+$[1])/2;let X=$[U-1]-$[0],q=$[$.length-1]-$[U];return X+q===0?($[U-1]+$[U])/2:($[U-1]*q+$[U]*X)/(X+q)},D=($,U)=>{let X=N[$],q=U?_:T,et=new Map;for(let Z of X)et.set(Z,O(q.get(Z).map(lt=>R.get(lt))));let tt=X.filter(Z=>et.get(Z)>=0).sort((Z,lt)=>et.get(Z)-et.get(lt)),F=new Array(X.length).fill(null);for(let Z of X)et.get(Z)<0&&(F[R.get(Z)]=Z);let Q=0;for(let Z=0;Z<F.length;Z++)F[Z]===null&&(F[Z]=tt[Q++]);let ot=F;ot.forEach((Z,lt)=>R.set(Z,lt)),N[$]=ot},W=()=>{let $=!0,U=0;for(;$&&U++<12;){$=!1;for(let X=0;X<=A;X++){let q=N[X];for(let et=0;et<q.length-1;et++){let tt=(X>0?I(X-1):0)+(X<A?I(X):0),F=q[et],Q=q[et+1];q[et]=Q,q[et+1]=F,R.set(Q,et),R.set(F,et+1),(X>0?I(X-1):0)+(X<A?I(X):0)<tt?$=!0:(q[et]=F,q[et+1]=Q,R.set(F,et),R.set(Q,et+1))}}}},z=$=>{let U=$===0?null:kQ($);for(let X=0;X<=A;X++){let q=N[X].slice();if(U)for(let et=q.length-1;et>0;et--){let tt=Math.floor(U()*(et+1));[q[et],q[tt]]=[q[tt],q[et]]}N[X]=q,q.forEach((et,tt)=>R.set(et,tt))}},P=[];for(let $=0;$<l;$++){z($);let U=H(),X=new Map(R);for(let et=0;et<8;et++){if(et%2===0)for(let Q=1;Q<=A;Q++)D(Q,!0);else for(let Q=A-1;Q>=0;Q--)D(Q,!1);W();let F=H();if(F<U&&(U=F,X=new Map(R)),F===0)break}G(X);for(let et=0;et<=A;et++)N[et].sort((tt,F)=>R.get(tt)-R.get(F));let q=N.map(et=>et.join(",")).join("|");P.some(et=>et.sig===q)||P.push({sig:q,cross:U,order:new Map(X)})}P.sort(($,U)=>$.cross-U.cross);let B=P.slice(0,c);if(B.length===0)return[];let Y=[];for(let $ of B){G($.order);let U=Array.from({length:A+1},()=>[]);for(let X of C.values())U[X.rank].push(X.id);for(let X=0;X<=A;X++)U[X].sort((q,et)=>$.order.get(q)-$.order.get(et));Y.push(V(U))}return Y;function V($){let U=$.map(xt=>Math.max(0,...xt.map(Lt=>C.get(Lt).depth))),X=[],q=Xl;for(let xt=0;xt<=A;xt++)X[xt]=q+U[xt]/2,q+=U[xt]+i;for(let xt=0;xt<=A;xt++){let Lt=Xl;for(let Dt of $[xt]){let zt=C.get(Dt);zt.cross=Lt+zt.thick/2,Lt+=zt.thick+a}}let et=18;for(let xt=0;xt<et;xt++){let Dt=xt%2===0?Array.from({length:A+1},(zt,$t)=>$t):Array.from({length:A+1},(zt,$t)=>A-$t);for(let zt of Dt){let $t=$[zt],ft=$t.map(Wt=>{let he=C.get(Wt),ne=0,se=0;for(let Zt of _.get(Wt)){let Ie=j(he,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}for(let Zt of T.get(Wt)){let Ie=j(he,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}return ne>0?se/ne:he.cross});K($t,ft)}}let tt=1/0;for(let xt of C.values())tt=Math.min(tt,xt.cross-xt.thick/2);let F=Xl-tt;for(let xt of C.values())xt.cross+=F;let Q=xt=>o?{x:xt.cross,y:X[xt.rank]}:{x:X[xt.rank],y:xt.cross},ot=t.nodes.map(xt=>{let Lt=C.get(xt.label),Dt=Q(Lt);return{label:xt.label,x:Dt.x,y:Dt.y,width:Lt.realW,height:Lt.realH}}),Z=new Map;for(let xt of w)Z.set(xt.edgeIdx,xt.chain);let lt=1/0,nt=-1/0;for(let xt of C.values())xt.dummy||(lt=Math.min(lt,xt.cross-xt.thick/2),nt=Math.max(nt,xt.cross+xt.thick/2));let J=34,at=28,it=xt=>s==="left"?-1:s==="right"||C.get(xt.src).cross-C.get(xt.tgt).cross>=0?1:-1,vt=k.map(xt=>({...xt,side:it(xt),span:Math.abs(C.get(xt.src).rank-C.get(xt.tgt).rank)})).sort((xt,Lt)=>xt.side-Lt.side||xt.span-Lt.span),Tt=new Map;for(let xt of vt)Tt.set(xt.side,(Tt.get(xt.side)??0)+1);let At=new Map,rt=new Map,pt=xt=>Math.max(0,xt/2-6),ht=new Map,dt=new Map;{let xt=new Map;for(let Lt of vt){let Dt=`${Lt.side}|${Lt.tgt}`,zt=xt.get(Dt)??0;xt.set(Dt,zt+1),ht.set(Lt.edgeIdx,zt)}for(let[Lt,Dt]of xt)dt.set(Lt,Dt)}for(let xt of vt){let Lt=xt.side,Dt=At.get(Lt)??0;At.set(Lt,Dt+1);let zt=Tt.get(Lt),$t=C.get(xt.src),ft=C.get(xt.tgt),Wt=Lt>0?nt+J+Dt*at:lt-J-Dt*at,he=X[$t.rank],ne=X[ft.rank],se=zt>1?(Dt+1)/(zt+1):0,Zt=he+se*pt($t.depth),Ie=ne-se*pt(ft.depth),Ht=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae},Qt=10,Ut=$t.cross+Lt*($t.thick/2+Qt),fe=ft.cross+Lt*(ft.thick/2+Qt),de=ht.get(xt.edgeIdx),te=dt.get(`${Lt}|${xt.tgt}`);if(te>1&&de>0){let ae=ne-(ft.depth/2+J+(de-1)*at),Te=ft.cross+Lt*pt(ft.thick)*(de/te);rt.set(xt.edgeIdx,[Ht($t.cross,he),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,ae),Ht(Te,ae),Ht(ft.cross,ne)])}else rt.set(xt.edgeIdx,[Ht($t.cross,he),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,Ie),Ht(fe,Ie),Ht(ft.cross,ne)])}let ut=[];for(let xt=0;xt<t.edges.length;xt++){let Lt=t.edges[xt];if(!u.has(Lt.source)||!u.has(Lt.target))continue;let Dt;if(Lt.source===Lt.target){let zt=Q(C.get(Lt.source));Dt=[zt,zt]}else if(rt.has(xt))Dt=rt.get(xt);else{let zt=Z.get(xt);if(!zt)continue;Dt=zt.map($t=>Q(C.get($t)))}ut.push({source:Lt.source,target:Lt.target,...Lt.label!==void 0&&{label:Lt.label},bidirectional:Lt.bidirectional,lineNumber:Lt.lineNumber,points:Dt,yOffset:0,parallelCount:1,metadata:Lt.metadata})}let yt=1/0,kt=1/0,Ot=-1/0,Xt=-1/0;for(let xt of ot)yt=Math.min(yt,xt.x-xt.width/2),kt=Math.min(kt,xt.y-xt.height/2),Ot=Math.max(Ot,xt.x+xt.width/2),Xt=Math.max(Xt,xt.y+xt.height/2);for(let xt of ut)for(let Lt of xt.points)yt=Math.min(yt,Lt.x),kt=Math.min(kt,Lt.y),Ot=Math.max(Ot,Lt.x),Xt=Math.max(Xt,Lt.y);let bt=Xl-yt,Nt=Xl-kt,Vt=bt!==0||Nt!==0?{nodes:ot.map(xt=>({...xt,x:xt.x+bt,y:xt.y+Nt})),edges:ut.map(xt=>({...xt,points:xt.points.map(Lt=>({x:Lt.x+bt,y:Lt.y+Nt}))}))}:{nodes:ot,edges:ut};return{nodes:Vt.nodes,edges:Vt.edges,groups:[],width:Ot+bt+Xl,height:Xt+Nt+Xl}}function j($,U){return $.dummy&&U.dummy?vQ:$.dummy||U.dummy?SQ:EQ}function K($,U){let X=$.length;if(X===0)return;let q=$.map(ot=>C.get(ot).thick/2),et=[0];for(let ot=1;ot<X;ot++)et[ot]=et[ot-1]+q[ot-1]+a+q[ot];let tt=U.map((ot,Z)=>ot-et[Z]),F=[];for(let ot=0;ot<X;ot++){let Z={pos:tt[ot],count:1,sumOffset:tt[ot],first:ot};for(;F.length&&F[F.length-1].pos>=Z.pos;){let lt=F.pop(),nt=lt.count+Z.count,J=lt.sumOffset+Z.sumOffset;Z={pos:J/nt,count:nt,sumOffset:J,first:lt.first}}F.push(Z)}let Q=new Array(X);for(let ot of F)for(let Z=0;Z<ot.count;Z++)Q[ot.first+Z]=ot.pos;for(let ot=0;ot<X;ot++)C.get($[ot]).cross=Q[ot]+et[ot]}}var bQ,xQ,wQ,Xl,EQ,SQ,vQ,eO=st(()=>{"use strict";Nf();bQ=50,xQ=60,wQ=10,Xl=40,EQ=1,SQ=2,vQ=8});function IQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function PQ(t){if(t.length===0)return-1;t.sort((o,a)=>o-a);let e=Math.floor(t.length/2);if(t.length%2===1)return t[e];if(t.length===2)return(t[0]+t[1])/2;let n=t[e-1]-t[0],r=t[t.length-1]-t[e];return n+r===0?(t[e-1]+t[e])/2:(t[e-1]*r+t[e]*n)/(n+r)}function wg(t,e){let n=new Map;for(let l of t)n.set(l,[]);for(let l of e)n.get(l.from)?.push({to:l.to,idx:l.idx});let r=new Set,o=new Map;for(let l of t)o.set(l,0);let a=[],i=l=>{a.push(l);let c=new Map;for(;a.length;){let d=a[a.length-1];o.get(d)===0&&o.set(d,1);let u=n.get(d),f=c.get(d)??0,p=!1;for(;f<u.length;f++){let{to:m,idx:h}=u[f],g=o.get(m);if(g===1)r.add(h);else if(g===0){c.set(d,f+1),a.push(m),p=!0;break}}p||(c.set(d,u.length),o.set(d,2),a.pop())}};for(let l of t)o.get(l)===0&&i(l);return{dag:e.map(l=>r.has(l.idx)?{from:l.to,to:l.from,idx:l.idx,rev:!0}:{from:l.from,to:l.to,idx:l.idx,rev:!1})}}function nO(t,e){let n=new Map,r=new Map;for(let l of t)n.set(l,[]),r.set(l,0);for(let l of e)n.get(l.from).push(l.to),r.set(l.to,(r.get(l.to)??0)+1);let o=new Map;for(let l of t)o.set(l,0);let a=t.filter(l=>(r.get(l)??0)===0),i=new Map(r),s=0;for(;a.length;){let l=a.shift();s++;for(let c of n.get(l))o.set(c,Math.max(o.get(c),o.get(l)+1)),i.set(c,i.get(c)-1),i.get(c)===0&&a.push(c)}return s===t.length?o:null}function oO(t,e,n){if(t.groups.length===0)return[];let r=t.nodes.length;if(r<3||r>60)return[];let o=t.direction==="TB",a=t.nodes.map(tt=>tt.label),i=new Set(a);for(let tt of t.edges)if(tt.source.startsWith("__group_")||tt.target.startsWith("__group_"))return[];let s=new Map(t.groups.map(tt=>[tt.label,tt])),l=new Map;for(let tt of t.groups)for(let F of tt.children)i.has(F)&&l.set(F,tt.label);let c=tt=>{let F=tt,Q=new Set;for(;;){let ot=s.get(F);if(!ot?.parentGroup||Q.has(F))return F;Q.add(F),F=ot.parentGroup}},d=tt=>{let F=l.get(tt);if(!F)return[];let Q=[F],ot=F,Z=new Set([F]);for(;;){let lt=s.get(ot);if(!lt?.parentGroup||Z.has(lt.parentGroup))break;Q.push(lt.parentGroup),Z.add(lt.parentGroup),ot=lt.parentGroup}return Q.reverse()},u="\0node\0",f=tt=>{let F=l.get(tt);return F?c(F):u+tt},p=t.edges.map((tt,F)=>({e:tt,i:F})).filter(({e:tt})=>i.has(tt.source)&&i.has(tt.target)&&tt.source!==tt.target);if(p.length===0)return[];let m=new Map;for(let tt of a)m.set(tt,f(tt));let h=Array.from(new Set(a.map(tt=>m.get(tt)))),g=p.filter(({e:tt})=>m.get(tt.source)!==m.get(tt.target)).map(({e:tt,i:F})=>({from:m.get(tt.source),to:m.get(tt.target),idx:F})),{dag:E}=wg(h,g),y=nO(h,E.map(tt=>({from:tt.from,to:tt.to})));if(!y)return[];let b=new Map,S=new Map;for(let tt of a){let F=m.get(tt);(S.get(F)??S.set(F,[]).get(F)).push(tt)}for(let[tt,F]of S){let Q=new Set(F),ot=p.filter(({e:nt})=>m.get(nt.source)===tt&&m.get(nt.target)===tt&&Q.has(nt.source)&&Q.has(nt.target)).map(({e:nt,i:J})=>({from:nt.source,to:nt.target,idx:J})),{dag:Z}=wg(F,ot),lt=nO(F,Z.map(nt=>({from:nt.from,to:nt.to})));if(!lt)return[];for(let nt of F)b.set(nt,lt.get(nt))}let x=Math.max(...h.map(tt=>y.get(tt))),L=Array.from({length:x+1},()=>1);for(let tt of h){let F=Math.max(...S.get(tt).map(ot=>b.get(ot)+1)),Q=y.get(tt);L[Q]=Math.max(L[Q],F)}let v=[],A=0;for(let tt=0;tt<=x;tt++)v[tt]=A,A+=L[tt];let C=new Set(v.slice(1)),M=new Map;for(let tt of a)M.set(tt,v[y.get(m.get(tt))]+b.get(tt));let w=Math.max(...a.map(tt=>M.get(tt))),k=new Map;for(let tt of t.nodes){let F=e.get(tt.label)??{width:Ma,height:aa};k.set(tt.label,{id:tt.label,dummy:!1,rank:M.get(tt.label),cross:0,thick:o?F.width:F.height,depth:o?F.height:F.width,realW:F.width,realH:F.height,unit:m.get(tt.label),path:d(tt.label)})}let N=[],_=[],T=[],R=[];for(let{e:tt,i:F}of p){let Q=M.get(tt.source),ot=M.get(tt.target);if(Q===ot){R.push({edgeIdx:F,a:tt.source,b:tt.target});continue}if(ot<Q){T.push({edgeIdx:F,src:tt.source,tgt:tt.target});continue}let Z=[tt.source],lt=tt.source;for(let nt=Q+1;nt<ot;nt++){let J=`__d${F}_${nt}`;k.set(J,{id:J,dummy:!0,rank:nt,cross:0,thick:MQ,depth:0,realW:0,realH:0,unit:u+J,path:[]}),_.push({a:lt,b:J}),Z.push(J),lt=J}_.push({a:lt,b:tt.target}),Z.push(tt.target),N.push({edgeIdx:F,chain:Z})}let G=Array.from({length:w+1},()=>[]);for(let tt of k.values())G[tt.rank].push(tt.id);let I=new Map,H=new Map;for(let tt of k.keys())I.set(tt,[]),H.set(tt,[]);for(let tt of _)H.get(tt.a).push(tt.b),I.get(tt.b).push(tt.a);let O=new Map,D=tt=>{if(!G[tt+1])return 0;let Q=[];for(let Z of G[tt]){let lt=O.get(Z);for(let nt of H.get(Z))Q.push({p:lt,q:O.get(nt)})}let ot=0;for(let Z=0;Z<Q.length;Z++)for(let lt=Z+1;lt<Q.length;lt++){let nt=Q[Z],J=Q[lt];(nt.p-J.p)*(nt.q-J.q)<0&&ot++}return ot},W=()=>{let tt=0;for(let F=0;F<w;F++)tt+=D(F);return tt},z=(tt,F)=>{let Q=G[tt],ot=F?I:H,Z=new Map;for(let it of Q)Z.set(it,PQ(ot.get(it).map(vt=>O.get(vt))));let lt=Q.filter(it=>Z.get(it)>=0).sort((it,vt)=>Z.get(it)-Z.get(vt)),nt=new Array(Q.length).fill(null);for(let it of Q)Z.get(it)<0&&(nt[O.get(it)]=it);let J=0;for(let it=0;it<nt.length;it++)nt[it]===null&&(nt[it]=lt[J++]);let at=nt;at.forEach((it,vt)=>O.set(it,vt)),G[tt]=at},P=()=>{let tt=!0,F=0;for(;tt&&F++<12;){tt=!1;for(let Q=0;Q<=w;Q++){let ot=G[Q];for(let Z=0;Z<ot.length-1;Z++){let lt=(Q>0?D(Q-1):0)+(Q<w?D(Q):0),nt=ot[Z],J=ot[Z+1];ot[Z]=J,ot[Z+1]=nt,O.set(J,Z),O.set(nt,Z+1),(Q>0?D(Q-1):0)+(Q<w?D(Q):0)<lt?tt=!0:(ot[Z]=nt,ot[Z+1]=J,O.set(nt,Z),O.set(J,Z+1))}}}},B=tt=>{let F=tt===0?null:IQ(tt);for(let Q=0;Q<=w;Q++){let ot=G[Q].slice();if(F)for(let Z=ot.length-1;Z>0;Z--){let lt=Math.floor(F()*(Z+1));[ot[Z],ot[lt]]=[ot[lt],ot[Z]]}G[Q]=ot,ot.forEach((Z,lt)=>O.set(Z,lt))}},Y=n?.restarts??(r<=16?20:r<=30?12:6),V=n?.keepK??3,j=[];for(let tt=0;tt<Y;tt++){B(tt);let F=W(),Q=new Map(O);for(let Z=0;Z<8;Z++){if(Z%2===0)for(let nt=1;nt<=w;nt++)z(nt,!0);else for(let nt=w-1;nt>=0;nt--)z(nt,!1);P();let lt=W();if(lt<F&&(F=lt,Q=new Map(O)),lt===0)break}for(let[Z,lt]of Q)O.set(Z,lt);for(let Z=0;Z<=w;Z++)G[Z].sort((lt,nt)=>O.get(lt)-O.get(nt));let ot=G.map(Z=>Z.join(",")).join("|");j.some(Z=>Z.sig===ot)||j.push({sig:ot,cross:F,order:new Map(Q)})}j.sort((tt,F)=>tt.cross-F.cross);let K=j.slice(0,V);if(K.length===0)return[];let $=[];for(let tt of K){for(let[Q,ot]of tt.order)O.set(Q,ot);let F=Array.from({length:w+1},()=>[]);for(let Q of k.values())F[Q.rank].push(Q.id);for(let Q=0;Q<=w;Q++)F[Q].sort((ot,Z)=>tt.order.get(ot)-tt.order.get(Z));$.push(et(F))}return $;function U(tt,F){return tt.dummy&&F.dummy?RQ:tt.dummy||F.dummy?AQ:_Q}function X(tt,F,Q){let ot=tt.length;if(ot===0)return;let Z=[0];for(let at=1;at<ot;at++)Z[at]=Z[at-1]+Q[at];let lt=F.map((at,it)=>at-Z[it]),nt=[];for(let at=0;at<ot;at++){let it={pos:lt[at],count:1,sumOffset:lt[at],first:at};for(;nt.length&&nt[nt.length-1].pos>=it.pos;){let vt=nt.pop(),Tt=vt.count+it.count,At=vt.sumOffset+it.sumOffset;it={pos:At/Tt,count:Tt,sumOffset:At,first:vt.first}}nt.push(it)}let J=new Array(ot);for(let at of nt)for(let it=0;it<at.count;it++)J[at.first+it]=at.pos;for(let at=0;at<ot;at++)k.get(tt[at]).cross=J[at]+Z[at]}function q(tt,F){let Q=tt.thick/2+F.thick/2+LQ;if(tt.dummy||F.dummy)return Q;if(tt.unit!==F.unit)return Q+2*Sd+TQ;let ot=tt.path[tt.path.length-1],Z=F.path[F.path.length-1];return ot!==Z&&(ot||Z)?Q+2*Sd:Q}function et(tt){let F=tt.map(Ht=>Math.max(0,...Ht.map(Qt=>k.get(Qt).depth))),Q=[],ot=el;for(let Ht=0;Ht<=w;Ht++)Ht>0&&(ot+=NQ+(C.has(Ht)?CQ:0)),Q[Ht]=ot+F[Ht]/2,ot+=F[Ht];let Z=Ht=>Ht.map((Qt,Ut)=>Ut===0?0:q(k.get(Ht[Ut-1]),k.get(Qt)));for(let Ht=0;Ht<=w;Ht++){let Qt=tt[Ht],Ut=Z(Qt),fe=el;for(let de=0;de<Qt.length;de++){let te=k.get(Qt[de]);fe+=Ut[de],te.cross=de===0?el+te.thick/2:fe}}let lt=18;for(let Ht=0;Ht<lt;Ht++){let Ut=Ht%2===0?Array.from({length:w+1},(fe,de)=>de):Array.from({length:w+1},(fe,de)=>w-de);for(let fe of Ut){let de=tt[fe],te=de.map(ae=>{let Te=k.get(ae),Je=0,sn=0;for(let ze of I.get(ae)){let Ce=U(Te,k.get(ze));Je+=Ce,sn+=Ce*k.get(ze).cross}for(let ze of H.get(ae)){let Ce=U(Te,k.get(ze));Je+=Ce,sn+=Ce*k.get(ze).cross}return Je>0?sn/Je:Te.cross});X(de,te,Z(de))}}let nt=1/0;for(let Ht of k.values())nt=Math.min(nt,Ht.cross-Ht.thick/2);let J=el-nt;for(let Ht of k.values())Ht.cross+=J;let at=Ht=>o?{x:Ht.cross,y:Q[Ht.rank]}:{x:Q[Ht.rank],y:Ht.cross},it=t.nodes.map(Ht=>{let Qt=k.get(Ht.label),Ut=at(Qt);return{label:Ht.label,x:Ut.x,y:Ut.y,width:Qt.realW,height:Qt.realH}}),vt=new Map;for(let Ht of N)vt.set(Ht.edgeIdx,Ht.chain);let Tt=1/0,At=-1/0;for(let Ht of k.values())Ht.dummy||(Tt=Math.min(Tt,Ht.cross-Ht.thick/2),At=Math.max(At,Ht.cross+Ht.thick/2));let rt=34,pt=28,ht=Ht=>Math.max(0,Ht/2-6),dt=Ht=>k.get(Ht.src).cross-k.get(Ht.tgt).cross>=0?1:-1,ut=T.map(Ht=>({...Ht,side:dt(Ht),span:Math.abs(k.get(Ht.src).rank-k.get(Ht.tgt).rank)})).sort((Ht,Qt)=>Ht.side-Qt.side||Ht.span-Qt.span),yt=new Map;for(let Ht of ut)yt.set(Ht.side,(yt.get(Ht.side)??0)+1);let kt=new Map,Ot=new Map;for(let Ht of ut){let Qt=Ht.side,Ut=kt.get(Qt)??0;kt.set(Qt,Ut+1);let fe=yt.get(Qt),de=k.get(Ht.src),te=k.get(Ht.tgt),ae=Qt>0?At+rt+Ut*pt:Tt-rt-Ut*pt,Te=Q[de.rank],Je=Q[te.rank],sn=fe>1?(Ut+1)/(fe+1):0,ze=Te-sn*ht(de.depth),Ce=Je+sn*ht(te.depth),ee=(_n,He)=>o?{x:_n,y:He}:{x:He,y:_n},oe=10,Be=de.cross+Qt*(de.thick/2+oe),dn=te.cross+Qt*(te.thick/2+oe);Ot.set(Ht.edgeIdx,[ee(de.cross,Te),ee(Be,ze),ee(ae,ze),ee(ae,Ce),ee(dn,Ce),ee(te.cross,Je)])}let Xt=new Map;for(let Ht of R){let Qt=k.get(Ht.a),Ut=k.get(Ht.b),fe=Q[Qt.rank],de=fe-(Qt.depth/2+26),te=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae};Xt.set(Ht.edgeIdx,[te(Qt.cross,fe),te(Qt.cross,de),te(Ut.cross,de),te(Ut.cross,fe)])}let bt=[];for(let Ht=0;Ht<t.edges.length;Ht++){let Qt=t.edges[Ht];if(!i.has(Qt.source)||!i.has(Qt.target))continue;let Ut;if(Qt.source===Qt.target){let fe=at(k.get(Qt.source));Ut=[fe,fe]}else if(Ot.has(Ht))Ut=Ot.get(Ht);else if(Xt.has(Ht))Ut=Xt.get(Ht);else{let fe=vt.get(Ht);if(!fe)continue;Ut=fe.map(de=>at(k.get(de)))}bt.push({source:Qt.source,target:Qt.target,...Qt.label!==void 0&&{label:Qt.label},bidirectional:Qt.bidirectional,lineNumber:Qt.lineNumber,points:Ut,yOffset:0,parallelCount:1,metadata:Qt.metadata})}let Nt=new Map(it.map(Ht=>[Ht.label,{l:Ht.x-Ht.width/2,r:Ht.x+Ht.width/2,t:Ht.y-Ht.height/2,b:Ht.y+Ht.height/2}])),Vt=Ht=>{let Qt=0,Ut=Ht,fe=new Set;for(;Ut&&!fe.has(Ut);)fe.add(Ut),Ut=s.get(Ut)?.parentGroup,Ut&&Qt++;return Qt},xt=new Map;for(let Ht of t.groups)Ht.parentGroup&&(xt.get(Ht.parentGroup)??xt.set(Ht.parentGroup,[]).get(Ht.parentGroup)).push(Ht.label);let Lt=new Map,Dt=[...t.groups].sort((Ht,Qt)=>Vt(Qt.label)-Vt(Ht.label)),zt=[];for(let Ht of Dt){let Qt=1/0,Ut=-1/0,fe=1/0,de=-1/0,te=ze=>{Qt=Math.min(Qt,ze.l),Ut=Math.max(Ut,ze.r),fe=Math.min(fe,ze.t),de=Math.max(de,ze.b)};for(let ze of Ht.children){let Ce=Nt.get(ze);Ce&&te(Ce)}for(let ze of xt.get(Ht.label)??[]){let Ce=Lt.get(ze);Ce&&te(Ce)}if(!Number.isFinite(Qt))continue;let ae=Qt-Sd,Te=Ut+Sd,Je=fe-rO,sn=de+Sd;Lt.set(Ht.label,{l:ae,r:Te,t:Je,b:sn}),zt.push({label:Ht.label,lineNumber:Ht.lineNumber,x:(ae+Te)/2,y:(Je+sn)/2,width:Te-ae,height:sn-Je,collapsed:!1,childCount:Ht.children.length})}let $t=1/0,ft=1/0,Wt=-1/0,he=-1/0,ne=(Ht,Qt,Ut,fe)=>{$t=Math.min($t,Ht),ft=Math.min(ft,Qt),Wt=Math.max(Wt,Ut),he=Math.max(he,fe)};for(let Ht of it)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);for(let Ht of bt)for(let Qt of Ht.points)ne(Qt.x,Qt.y,Qt.x,Qt.y);for(let Ht of zt)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);let se=el-$t,Zt=el-ft,Ie=se!==0||Zt!==0;return{nodes:Ie?it.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):it,edges:Ie?bt.map(Ht=>({...Ht,points:Ht.points.map(Qt=>({x:Qt.x+se,y:Qt.y+Zt}))})):bt,groups:Ie?zt.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):zt,width:Wt+se+el,height:he+Zt+el}}}var LQ,NQ,MQ,el,Sd,rO,TQ,CQ,_Q,AQ,RQ,k1=st(()=>{"use strict";Nf();LQ=50,NQ=60,MQ=10,el=40,Sd=16,rO=32,TQ=24,CQ=rO+2*Sd,_Q=1,AQ=2,RQ=8});var fO={};ye(fO,{countEdgeNearMiss:()=>qQ,countEdgeNodePierces:()=>dO,countEdgeOverlaps:()=>cO,countGroupOverlaps:()=>Sg,countSplineCrossings:()=>lO,deroutePierces:()=>L1,detectEdgeNodePierces:()=>M1,detectEdgeOverlaps:()=>Eg,detectGroupOverlaps:()=>KQ,layoutBoxesAndLinesSearch:()=>tJ,separateGroupBands:()=>uO});function WQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function BQ(t,e){let n=t.slice();for(let r=n.length-1;r>0;r--){let o=Math.floor(e()*(r+1));[n[r],n[o]]=[n[o],n[r]]}return n}function zQ(t){let e=t.match(YQ)??[],n=[],r=0,o=0,a=0,i="",s=()=>parseFloat(e[r++]),l=(c,d,u,f)=>{for(let p=0;p<=1;p+=.12){let m=1-p;u?n.push({x:m*m*m*c.x+3*m*m*p*d.x+3*m*p*p*u.x+p*p*p*f.x,y:m*m*m*c.y+3*m*m*p*d.y+3*m*p*p*u.y+p*p*p*f.y}):n.push({x:m*m*c.x+2*m*p*d.x+p*p*f.x,y:m*m*c.y+2*m*p*d.y+p*p*f.y})}};for(;r<e.length;){let c=e[r];if(/[MLQC]/i.test(c)&&(i=c,r++),i==="M"||i==="L"){let d=s(),u=s();n.push({x:d,y:u}),o=d,a=u}else if(i==="Q"){let d={x:s(),y:s()},u={x:s(),y:s()};l({x:o,y:a},d,null,u),o=u.x,a=u.y}else if(i==="C"){let d={x:s(),y:s()},u={x:s(),y:s()},f={x:s(),y:s()};l({x:o,y:a},d,u,f),o=f.x,a=f.y}else r++}return n}function N1(t){let e=t.edges,n=aO.get(e);if(n)return n;let r=t.edges.map(o=>{let a=o.points.length>=2?zQ(FQ(o.points)??""):[],i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of a)d.x<i&&(i=d.x),d.x>l&&(l=d.x),d.y<s&&(s=d.y),d.y>c&&(c=d.y);return{pts:a,x0:i,y0:s,x1:l,y1:c}});return aO.set(e,r),r}function VQ(t,e,n,r){let o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(Math.abs(o)<1e-9)return null;let a=((n.x-t.x)*(r.y-n.y)-(n.y-t.y)*(r.x-n.x))/o,i=((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))/o;return a>0&&a<1&&i>0&&i<1?{x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)}:null}function lO(t,e=1/0){let n=new Map;for(let s of t.nodes)n.set(s.label,{x:s.x,y:s.y});for(let s of t.groups)s.collapsed&&n.set("__group_"+s.label,{x:s.x,y:s.y});let r=N1(t),o=t.edges,a=34,i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){let c=r[s],d=r[l];if(c.pts.length<2||d.pts.length<2||c.x1<d.x0||d.x1<c.x0||c.y1<d.y0||d.y1<c.y0)continue;let u=o[s],f=o[l],p,m;(u.source===f.source||u.source===f.target)&&(p=n.get(u.source)),(u.target===f.source||u.target===f.target)&&(m=n.get(u.target));let h=[],g=c.pts,E=d.pts;for(let y=1;y<g.length;y++){let b=g[y-1],S=g[y],x=b.x<S.x?b.x:S.x,L=b.x>S.x?b.x:S.x,v=b.y<S.y?b.y:S.y,A=b.y>S.y?b.y:S.y;for(let C=1;C<E.length;C++){let M=E[C-1],w=E[C];if(L<(M.x<w.x?M.x:w.x)||(M.x>w.x?M.x:w.x)<x||A<(M.y<w.y?M.y:w.y)||(M.y>w.y?M.y:w.y)<v)continue;let k=VQ(b,S,M,w);k&&(p&&Math.hypot(k.x-p.x,k.y-p.y)<a||m&&Math.hypot(k.x-m.x,k.y-m.y)<a||h.some(N=>Math.hypot(N.x-k.x,N.y-k.y)<6)||h.push(k))}}if(i+=h.length,i>e)return i}return i}function UQ(t,e,n){let r=n.x-e.x,o=n.y-e.y,a=r*r+o*o;if(a<1e-9)return Math.hypot(t.x-e.x,t.y-e.y);let i=((t.x-e.x)*r+(t.y-e.y)*o)/a;return i=Math.max(0,Math.min(1,i)),Math.hypot(t.x-(e.x+i*r),t.y-(e.y+i*o))}function XQ(t,e){let n=1/0;for(let r=1;r<e.length;r++)n=Math.min(n,UQ(t,e[r-1],e[r]));return n}function iO(t,e){let n=Math.max(e.x-e.w/2-t.x,0,t.x-(e.x+e.w/2)),r=Math.max(e.y-e.h/2-t.y,0,t.y-(e.y+e.h/2));return Math.hypot(n,r)}function Eg(t,e){let n=e?.dist??8,r=e?.minLen??16,o=e?.nodeClear??12,a=new Map;for(let c of t.nodes)a.set(c.label,{x:c.x,y:c.y,w:c.width,h:c.height});for(let c of t.groups)c.collapsed&&a.set("__group_"+c.label,{x:c.x,y:c.y,w:c.width,h:c.height});let i=N1(t),s=t.edges,l=[];for(let c=0;c<i.length;c++)for(let d=c+1;d<i.length;d++){let u=i[c],f=i[d];if(u.pts.length<2||f.pts.length<2||u.x1+n<f.x0||f.x1+n<u.x0||u.y1+n<f.y0||f.y1+n<u.y0)continue;let p=s[c],m=s[d],h,g;(p.source===m.source||p.source===m.target)&&(h=a.get(p.source)),(p.target===m.source||p.target===m.target)&&(g=a.get(p.target));let E=[],y=0,b=()=>{y>=r&&E.length>=2&&l.push({mid:E[Math.floor(E.length/2)],length:y,pts:E.slice()}),E=[],y=0};for(let S of u.pts)!(h!==void 0&&iO(S,h)<o||g!==void 0&&iO(S,g)<o)&&XQ(S,f.pts)<n?(E.length&&(y+=Math.hypot(S.x-E[E.length-1].x,S.y-E[E.length-1].y)),E.push(S)):b();b()}return l}function cO(t,e){return Eg(t,e).length}function M1(t,e){let n=e?.inset??6,r=e?.minPts??2,o=[];for(let l of t.nodes)o.push({key:l.label,x:l.x,y:l.y,w:l.width,h:l.height});for(let l of t.groups)l.collapsed&&o.push({key:"__group_"+l.label,x:l.x,y:l.y,w:l.width,h:l.height});let a=(l,c)=>Math.abs(l.x-c.x)<c.w/2-n&&Math.abs(l.y-c.y)<c.h/2-n,i=[],s=N1(t);return t.edges.forEach((l,c)=>{if(l.points.length<2)return;let d=s[c].pts;for(let u of o){if(u.key===l.source||u.key===l.target||"__group_"+u.key===l.source||"__group_"+u.key===l.target)continue;let f=d.filter(p=>a(p,u));f.length>=r&&i.push({edgeIdx:c,node:u.key,pts:f})}}),i}function dO(t,e){return M1(t,e).length}function L1(t){let e=M1(t);if(!e.length)return t;let n=new Map;for(let a of t.nodes)n.set(a.label,{x:a.x,y:a.y,w:a.width,h:a.height});for(let a of t.groups)a.collapsed&&n.set("__group_"+a.label,{x:a.x,y:a.y,w:a.width,h:a.height});let r=new Map;for(let a of e){let i=r.get(a.edgeIdx);i?i.push(a.node):r.set(a.edgeIdx,[a.node])}let o=t.edges.map((a,i)=>{let s=r.get(i);if(!s)return a;let l=a.points.map(c=>({x:c.x,y:c.y}));for(let c of s){let d=n.get(c);d&&(l=jQ(l,d))}return{...a,points:l}});return{...t,edges:o}}function jQ(t,e){if(t.length<2)return t;let n={x:e.x,y:e.y},r=-1,o=0,a=1/0,i=t[0];for(let x=0;x<t.length-1;x++){let L=t[x],v=t[x+1],A=v.x-L.x,C=v.y-L.y,M=A*A+C*C||1e-9,w=((n.x-L.x)*A+(n.y-L.y)*C)/M;w=Math.max(0,Math.min(1,w));let k={x:L.x+w*A,y:L.y+w*C},N=Math.hypot(k.x-n.x,k.y-n.y);N<a&&(a=N,r=x,o=w,i=k)}if(r<0)return t;let s=i.x-n.x,l=i.y-n.y;Math.hypot(s,l)<1&&(e.w<=e.h?(s=1,l=0):(s=0,l=1));let c=Math.hypot(s,l)||1;s/=c,l/=c;let d=t[r],u=t[r+1],f=u.x-d.x,p=u.y-d.y,m=Math.hypot(f,p)||1;f/=m,p/=m;let h=Math.hypot(e.w,e.h)/2+18,g=Math.hypot(e.w,e.h)/2,E={x:i.x-f*g+s*h*.5,y:i.y-p*g+l*h*.5},y={x:n.x+s*h,y:n.y+l*h},b={x:i.x+f*g+s*h*.5,y:i.y+p*g+l*h*.5},S=t.slice(0,r+1);return S.push(E,y,b),S.push(...t.slice(r+1)),S}function qQ(t,e){let n=e?.near??14,r=e?.tight??8,o=e?.minLen??18,a=Eg(t,{dist:n,minLen:o}).length,i=Eg(t,{dist:r,minLen:o}).length;return Math.max(0,a-i)}function KQ(t,e){let n=e?.margin??4,r=t.groups.map(s=>({label:s.label,l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Mf}:s),i=new Set;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&(i.add(r[s].label),i.add(r[l].label))}return[...i]}function Sg(t,e){let n=e?.margin??4,r=t.groups.map(s=>({l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Mf}:s),i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&i++}return i}function uO(t,e){if(t.groups.some(T=>T.collapsed)||Sg(t)===0)return t;let n=new Map;for(let T of e.groups)n.set(T.label,T.parentGroup);let r=T=>{let R=T,G=new Set;for(;;){let I=n.get(R);if(!I||G.has(I))return R;G.add(R),R=I}},o=e.groups.filter(T=>!T.parentGroup).map(T=>T.label);if(o.length<2)return t;let a=new Map;for(let T of e.groups)for(let R of T.children)e.groups.some(G=>G.label===R)||a.set(R,r(T.label));let i=e.direction==="TB"?"x":"y",s=new Map(t.groups.map(T=>[T.label,T])),l=o.map(T=>{let R=s.get(T),G=(i==="y"?R.height:R.width)/2,I=(i==="y"?R.y:R.x)-G,H=(i==="y"?R.y:R.x)+G,O=e.groups.some(D=>D.parentGroup===T);return i==="y"&&O&&(I-=Mf),{label:T,lo:I,hi:H,c:(I+H)/2}});l.sort((T,R)=>T.c-R.c);let c=16,d=l.map(T=>(T.hi-T.lo)/2),u=[0];for(let T=1;T<l.length;T++)u[T]=u[T-1]+d[T-1]+c+d[T];let f=l.map((T,R)=>T.c-u[R]),p=[];for(let T=0;T<l.length;T++){let R={pos:f[T],count:1,sum:f[T],first:T};for(;p.length&&p[p.length-1].pos>=R.pos;){let G=p.pop(),I=G.count+R.count,H=G.sum+R.sum;R={pos:H/I,count:I,sum:H,first:G.first}}p.push(R)}let m=new Array(l.length);for(let T of p)for(let R=0;R<T.count;R++)m[T.first+R]=T.pos+u[T.first+R];let h=new Map,g=!1;if(l.forEach((T,R)=>{let G=m[R]-T.c;h.set(T.label,G),Math.abs(G)>.5&&(g=!0)}),!g)return t;let E=T=>{if(T.startsWith("__group_"))return h.get(r(T.slice(8)))??0;let R=a.get(T);return R?h.get(R)??0:0},y=(T,R)=>i==="y"?{x:T.x,y:T.y+R}:{x:T.x+R,y:T.y},b=t.nodes.map(T=>{let R=E(T.label);return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),S=t.groups.map(T=>{let R=h.get(r(T.label))??0;return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),x=t.edges.map(T=>{let R=E(T.source),G=E(T.target);if(!R&&!G)return T;let I=T.points.length,H=T.points.map((O,D)=>{let W=I>1?D/(I-1):0;return y(O,R*(1-W)+G*W)});return{...T,points:H}}),L=1/0,v=1/0,A=-1/0,C=-1/0,M=(T,R)=>{T<L&&(L=T),T>A&&(A=T),R<v&&(v=R),R>C&&(C=R)};for(let T of b)M(T.x-T.width/2,T.y-T.height/2),M(T.x+T.width/2,T.y+T.height/2);for(let T of S)M(T.x-T.width/2,T.y-T.height/2-Mf),M(T.x+T.width/2,T.y+T.height/2);for(let T of x)for(let R of T.points)M(R.x,R.y);let w=40,k=w-L,N=w-v,_=k!==0||N!==0;return{nodes:_?b.map(T=>({...T,x:T.x+k,y:T.y+N})):b,groups:_?S.map(T=>({...T,x:T.x+k,y:T.y+N})):S,edges:_?x.map(T=>({...T,points:T.points.map(R=>({x:R.x+k,y:R.y+N}))})):x,width:A-L+2*w,height:C-v+2*w}}function ZQ(t,e,n,r){let o=e.x-t.x,a=e.y-t.y,i=r.x-n.x,s=r.y-n.y,l=o*s-a*i;if(Math.abs(l)<1e-9)return!1;let c=((n.x-t.x)*s-(n.y-t.y)*i)/l,d=((n.x-t.x)*a-(n.y-t.y)*o)/l;return c>.001&&c<.999&&d>.001&&d<.999}function sO(t){let e=t.edges.filter(o=>o.points.length>=2),n=e.map(o=>{let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let c of o.points)c.x<a&&(a=c.x),c.x>s&&(s=c.x),c.y<i&&(i=c.y),c.y>l&&(l=c.y);return{x0:a,y0:i,x1:s,y1:l}}),r=0;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++){let i=e[o],s=e[a];if(i.source===s.source||i.source===s.target||i.target===s.source||i.target===s.target)continue;let l=n[o],c=n[a];if(l.x1<c.x0||c.x1<l.x0||l.y1<c.y0||c.y1<l.y0)continue;let d=i.points,u=s.points,f=!1;for(let p=0;p<d.length-1&&!f;p++)for(let m=0;m<u.length-1;m++)if(ZQ(d[p],d[p+1],u[m],u[m+1])){f=!0;break}f&&r++}return r}function QQ(t,e){if(!e?.size)return 0;let n=0,r=0;for(let o of t.nodes){let a=e.get(o.label);a&&(n+=Math.hypot(o.x-a.x,o.y-a.y),r++)}return r?n/r:0}function JQ(t){let e=0;for(let n of t.edges)for(let r=1;r<n.points.length;r++)e+=Math.hypot(n.points[r].x-n.points[r-1].x,n.points[r].y-n.points[r-1].y);return e}async function tJ(t,e,n){let r=n?.hideDescriptions??!1,o=n?.reserveEdgeLabels??!1,a=n?.onProgress,i=a?()=>new Promise(nt=>setTimeout(nt)):()=>{},s=150,l=30,c=performance.now(),d=c,u=new Set;if(e){let nt=new Set;for(let J of e.originalGroups)t.groups.some(at=>at.label===J.label)||nt.add(J.label);for(let J of nt){let it=e.originalGroups.find(vt=>vt.label===J)?.parentGroup;(!it||!nt.has(it))&&u.add(J)}}let f=new Map,p=0;for(let nt of t.nodes){let J=r?{width:Ma,height:aa}:T1(nt,t.showValues===!0);f.set(nt.label,J),!r&&nt.description&&nt.description.length>0&&(p=Math.max(p,J.height))}if(p>0){for(let nt of t.nodes)if(nt.description&&nt.description.length>0){let J=f.get(nt.label);f.set(nt.label,{width:J.width,height:p})}}let m=nt=>`__group_${nt}`,h=t.direction==="TB"?"TB":"LR",g=new Set(t.nodes.map(nt=>nt.label)),E=new Map,y=new Map;for(let nt of t.groups)if(E.set(nt.label,nt.children.filter(J=>g.has(J))),nt.parentGroup){let J=y.get(nt.parentGroup)??[];J.push(nt.label),y.set(nt.parentGroup,J)}let b=new Map,S=nt=>{let J=b.get(nt);if(J)return J;b.set(nt,[]);let at=[...E.get(nt)??[]];for(let it of y.get(nt)??[])at.push(...S(it));return b.set(nt,at),at},x=new Map,L=new Map;for(let nt of t.groups){let J=S(nt.label);if(J.length===0)continue;let at=new Set(J),it=new Map;for(let ht of t.edges)if(at.has(ht.source)&&at.has(ht.target)){let dt=it.get(ht.target)??[];dt.push(ht.source),it.set(ht.target,dt)}let vt=new Map,Tt=new Set,At=ht=>{let dt=vt.get(ht);if(dt!==void 0)return dt;if(Tt.has(ht))return 0;Tt.add(ht);let ut=0;for(let yt of it.get(ht)??[])ut=Math.max(ut,At(yt)+1);return Tt.delete(ht),vt.set(ht,ut),ut},rt=J[0],pt=J[0];for(let ht of J)At(ht)>At(rt)&&(rt=ht),At(ht)<At(pt)&&(pt=ht);x.set(m(nt.label),rt),L.set(m(nt.label),pt)}let v=nt=>x.get(nt)??nt,A=nt=>L.get(nt)??nt,C=nt=>`${nt.source}->${nt.target}#${nt.lineNumber}`,M=(nt,J)=>{let at=J.x-nt.x,it=J.y-nt.y,vt=at===0?1/0:nt.w/2/Math.abs(at),Tt=it===0?1/0:nt.h/2/Math.abs(it),At=Math.min(vt,Tt);return Number.isFinite(At)?{x:nt.x+at*At,y:nt.y+it*At}:{x:nt.x,y:nt.y}},w=(nt,J)=>Math.abs(nt.x-J.x)<=J.w/2&&Math.abs(nt.y-J.y)<=J.h/2,k=t.nodePositions,N=new Set(t.groups.map(nt=>nt.label)),_=t.groups.every(nt=>!nt.parentGroup&&!nt.children.some(J=>N.has(J))),T=new Set((e?.originalGroups??t.groups).map(nt=>nt.label)),R=u.size===0||k!==void 0&&e!==void 0&&[...u].every(nt=>{let J=e.originalGroups.find(at=>at.label===nt);return!J||J.parentGroup?!1:J.children.every(at=>k.has(at)&&!T.has(at))}),G=k!==void 0&&(t.nodes.length>0||u.size>0)&&t.nodes.every(nt=>k.has(nt.label))&&_&&R;function I(nt){let J=new Map,at=[];if(e)for(let Lt of u){let Dt=e.originalGroups.find(se=>se.label===Lt);if(!Dt)continue;let zt=1/0,$t=1/0,ft=-1/0,Wt=-1/0;for(let se of Dt.children){let Zt=nt.get(se);Zt&&(zt=Math.min(zt,Zt.x),ft=Math.max(ft,Zt.x),$t=Math.min($t,Zt.y),Wt=Math.max(Wt,Zt.y))}if(!Number.isFinite(zt))continue;let he=(zt+ft)/2,ne=($t+Wt)/2;J.set(`__group_${Lt}`,{x:he,y:ne}),at.push({label:Lt,lineNumber:Dt.lineNumber,childCount:e.collapsedChildCounts.get(Lt)??Dt.children.length,x:he,y:ne})}let it=Lt=>nt.get(Lt)??J.get(Lt),vt=Lt=>{let Dt=it(Lt),zt=f.get(Lt)??{width:Ma,height:aa};return{x:Dt.x,y:Dt.y,w:zt.width,h:zt.height}},Tt=t.nodes.map(Lt=>{let Dt=vt(Lt.label);return{label:Lt.label,x:Dt.x,y:Dt.y,width:Dt.w,height:Dt.h}}),At=t.edges.flatMap(Lt=>{let Dt=it(Lt.source),zt=it(Lt.target);if(!Dt||!zt)return[];let $t=vt(Lt.source),ft=vt(Lt.target),Wt=M($t,zt),he=M(ft,Dt);return[{source:Lt.source,target:Lt.target,...Lt.label!==void 0&&{label:Lt.label},bidirectional:Lt.bidirectional,lineNumber:Lt.lineNumber,points:[Wt,he],yOffset:0,parallelCount:1,metadata:Lt.metadata,straight:!0}]}),rt=16,pt=new Map(Tt.map(Lt=>[Lt.label,Lt])),ht=[];for(let Lt of t.groups){let Dt=1/0,zt=1/0,$t=-1/0,ft=-1/0;for(let Zt of Lt.children){let Ie=pt.get(Zt);Ie&&(Dt=Math.min(Dt,Ie.x-Ie.width/2),$t=Math.max($t,Ie.x+Ie.width/2),zt=Math.min(zt,Ie.y-Ie.height/2),ft=Math.max(ft,Ie.y+Ie.height/2))}if(!Number.isFinite(Dt))continue;let Wt=Dt-rt,he=$t+rt,ne=zt-Mf,se=ft+rt;ht.push({label:Lt.label,lineNumber:Lt.lineNumber,x:(Wt+he)/2,y:(ne+se)/2,width:he-Wt,height:se-ne,collapsed:!1,childCount:Lt.children.length})}for(let Lt of at)ht.push({label:Lt.label,lineNumber:Lt.lineNumber,x:Lt.x,y:Lt.y,width:Ma,height:aa,collapsed:!0,childCount:Lt.childCount});let dt=40,ut=1/0,yt=1/0,kt=-1/0,Ot=-1/0,Xt=(Lt,Dt)=>{Lt<ut&&(ut=Lt),Lt>kt&&(kt=Lt),Dt<yt&&(yt=Dt),Dt>Ot&&(Ot=Dt)};for(let Lt of Tt)Xt(Lt.x-Lt.width/2,Lt.y-Lt.height/2),Xt(Lt.x+Lt.width/2,Lt.y+Lt.height/2);for(let Lt of At)for(let Dt of Lt.points)Xt(Dt.x,Dt.y);for(let Lt of ht)Xt(Lt.x-Lt.width/2,Lt.y-Lt.height/2),Xt(Lt.x+Lt.width/2,Lt.y+Lt.height/2);let bt=2,Nt=ut<dt-bt?dt-ut:0,Vt=yt<dt-bt?dt-yt:0,xt=Nt!==0||Vt!==0;return{nodes:xt?Tt.map(Lt=>({...Lt,x:Lt.x+Nt,y:Lt.y+Vt})):Tt,edges:xt?At.map(Lt=>({...Lt,points:Lt.points.map(Dt=>({x:Dt.x+Nt,y:Dt.y+Vt}))})):At,groups:xt?ht.map(Lt=>({...Lt,x:Lt.x+Nt,y:Lt.y+Vt})):ht,width:kt+Nt+dt,height:Ot+Vt+dt}}function H(nt){let J=nt.seed===void 0?null:WQ(nt.seed+1),at=dt=>J?BQ(dt,J):dt.slice(),it=new er.graphlib.Graph({compound:!0,multigraph:!0});it.setGraph({rankdir:h,ranker:nt.ranker,nodesep:nt.nodesep,ranksep:nt.ranksep,edgesep:20,marginx:40,marginy:40}),it.setDefaultEdgeLabel(()=>({}));for(let dt of at(t.groups))it.setNode(m(dt.label),{label:dt.label});for(let dt of at(t.nodes)){let ut=f.get(dt.label);it.setNode(dt.label,{width:ut.width,height:ut.height})}for(let dt of u)it.setNode(m(dt),{width:Ma,height:aa});for(let dt of t.groups){dt.parentGroup&&it.hasNode(m(dt.parentGroup))&&it.setParent(m(dt.label),m(dt.parentGroup));for(let ut of at(dt.children))it.hasNode(ut)&&it.setParent(ut,m(dt.label))}if(e)for(let dt of u){let ut=e.originalGroups.find(yt=>yt.label===dt);ut?.parentGroup&&!u.has(ut.parentGroup)&&it.hasNode(m(ut.parentGroup))&&it.setParent(m(dt),m(ut.parentGroup))}for(let dt of at(t.edges)){let ut=v(dt.source),yt=A(dt.target);if(ut!==yt&&it.hasNode(ut)&&it.hasNode(yt)){let kt={};if(o&&dt.label){let Ot=E1(dt.label,xg);kt={width:Ot.width,height:Ot.height,labelpos:"c"}}it.setEdge(ut,yt,kt,C(dt))}}er.layout(it);let vt=t.nodes.map(dt=>{let ut=it.node(dt.label);return{label:dt.label,x:ut.x,y:ut.y,width:ut.width,height:ut.height}}),Tt=t.groups.map(dt=>{let ut=it.node(m(dt.label));return{label:dt.label,lineNumber:dt.lineNumber,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!1,childCount:dt.children.length}});for(let dt of u){let ut=it.node(m(dt));Tt.push({label:dt,lineNumber:0,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!0,childCount:e?.collapsedChildCounts.get(dt)??0})}let At=new Map;for(let dt of t.groups){let ut=it.node(m(dt.label));ut&&At.set(m(dt.label),{x:ut.x,y:ut.y,w:ut.width,h:ut.height})}let rt=(dt,ut,yt)=>{if(dt.length<2)return dt;let kt=dt,Ot=At.get(ut);if(Ot){let bt=0;for(;bt<kt.length-1&&w(kt[bt],Ot);)bt++;kt=[M(Ot,kt[bt]),...kt.slice(bt)]}let Xt=At.get(yt);if(Xt){let bt=kt.length-1;for(;bt>0&&w(kt[bt],Xt);)bt--;kt=[...kt.slice(0,bt+1),M(Xt,kt[bt])]}return kt},pt=t.edges.flatMap(dt=>{let ut=v(dt.source),yt=A(dt.target),kt=C(dt);if(ut===yt||!it.hasEdge(ut,yt,kt))return[];let Ot=it.edge(ut,yt,kt),Xt=rt(Ot?.points??[],dt.source,dt.target);return[{source:dt.source,target:dt.target,...dt.label!==void 0&&{label:dt.label},bidirectional:dt.bidirectional,lineNumber:dt.lineNumber,points:Xt,yOffset:0,parallelCount:1,metadata:dt.metadata}]}),ht=it.graph();return{nodes:vt,edges:pt,groups:Tt,width:ht.width??800,height:ht.height??600}}if(G)return I(k);let O=t.nodes.length,D=n?.seeds??(O<=12?80:O<=22?40:O<=35?22:10),W=n?.refineK??6,z=n?.lambda??DQ,P=n?.previousPositions,B=["network-simplex","tight-tree","longest-path"],Y=[{nodesep:50,ranksep:60},{nodesep:34,ranksep:46},{nodesep:66,ranksep:82}],V=[];for(let nt of B)for(let J of Y)V.push({ranker:nt,...J});for(let nt=0;nt<D;nt++)V.push({ranker:"network-simplex",nodesep:50,ranksep:60,seed:nt});let j=(nt,J)=>{let at=lO(nt,J);return at>J?1/0:at+cO(nt)+dO(nt)+Sg(nt)},K=(nt,J)=>J*1e6+JQ(nt)+z*QQ(nt,P)*10,$=V.length+Math.min(n?.refineK??6,V.length),U=0,X=async nt=>{if(!a)return;a(++U,$,nt);let J=performance.now();J-c>s&&J-d>l&&(d=J,await i())},q=[];for(let nt of V){try{q.push(H(nt))}catch{}await X("Optimizing layout")}if(!q.length)return H({ranker:"network-simplex",nodesep:50,ranksep:60});let et=[];try{et=tO(t,f)}catch{}if(t.groups.length>0&&u.size===0)try{et=et.concat(oO(t,f))}catch{}let tt=new Map;for(let nt of q)tt.set(nt,K(nt,sO(nt)));q.sort((nt,J)=>tt.get(nt)-tt.get(J));let F=Math.min(W,q.length),Q=q[0],ot=1/0,Z=1/0,lt=nt=>{let J=j(nt,Z);if(J===1/0)return;let at=K(nt,J);at<ot&&(ot=at,Z=J,Q=nt)};for(let nt of q.slice(0,F))lt(nt),await X("Refining layout");if(Z>=OQ&&O<=GQ){let nt=[];for(let at=D;at<D+$Q;at++)try{nt.push(H({ranker:"network-simplex",nodesep:50,ranksep:60,seed:at}))}catch{}let J=new Map;for(let at of nt)J.set(at,K(at,sO(at)));nt.sort((at,it)=>J.get(at)-J.get(it));for(let at of nt.slice(0,HQ))lt(at)}for(let nt of et){let J=[nt],at=L1(nt);at!==nt&&J.push(at);for(let it of J){let vt=j(it,Z-1);vt<Z&&(Z=vt,Q=it)}}if(Z>0){let nt=L1(Q);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}if(Z>0&&Sg(Q)>0){let nt=uO(Q,t);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}return Q}var DQ,OQ,GQ,$Q,HQ,FQ,YQ,aO,Mf,pO=st(()=>{"use strict";ls();Eo();Nf();eO();k1();v1();DQ=4,OQ=4,GQ=45,$Q=18,HQ=10;FQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),YQ=/[MLQC]|-?\d*\.?\d+(?:e-?\d+)?/gi;aO=new WeakMap;Mf=32});var xO={};ye(xO,{NODE_HEIGHT:()=>aa,NODE_WIDTH:()=>Ma,computeNodeSize:()=>T1,layoutBoxesAndLines:()=>uJ});function cJ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t.charAt(r-1),a=t.charAt(r),i=r+1<t.length?t.charAt(r+1):"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function dJ(t,e=Ma){let n=t.split(/[\s-]+/),r=[];for(let a of n)a&&r.push(...cJ(a));let o=e-24;for(let a=13;a>=9;a--){if(o<_t("MM",a))continue;let i=1,s="";for(let l of r){let c=s?`${s} ${l}`:l;_t(c,a)<=o?s=c:(i++,s=l)}if(i<=_1)return Math.min(i,_1)}return _1}function T1(t,e){if(!t.description||t.description.length===0)return{width:Ma,height:aa};let n=rJ,o=dJ(t.label,n)*13*aJ+iJ,a=n-24,i=0;for(let c of t.description)_t(c,C1)<=a?i+=1:i+=Tn(c,C1,a,{hardBreak:!0}).length;i=Math.min(i,oJ);let s=i*C1*yO,l=o+bO+A1+s+A1+(e?lJ:0);return{width:n,height:Math.max(aa,l)}}async function uJ(t,e,n){let{layoutBoxesAndLinesSearch:r}=await Promise.resolve().then(()=>(pO(),fO)),o={...n?.hideDescriptions!==void 0&&{hideDescriptions:n.hideDescriptions},...n?.previousPositions!==void 0&&{previousPositions:n.previousPositions},...n?.onProgress!==void 0&&{onProgress:n.onProgress}},a=await r(t,e,o),i=S1(gO(a));if(i.unresolved.length>0){let s=await r(t,e,{...o,reserveEdgeLabels:!0}),l=S1(gO(s));l.unresolved.length<i.unresolved.length&&(i=l)}return fJ(i.layout,t,n?.collapsedNotes)}function fJ(t,e,n){let o=e.options?.["no-notes"]==="on"||!e.notes?new Map:no(e.notes,e.nodes.map(y=>({id:y.label,label:y.label})));if(o.size===0)return t;let a=Hc(t.nodes.map(y=>({id:y.label,x:y.x,y:y.y,width:y.width,height:y.height})),o,e.direction==="TB"?"TB":"LR",n),i=t.nodes.map(y=>{let b=a.get(y.label);return b?{...y,note:b}:y}),s=1/0,l=1/0,c=-1/0,d=-1/0,u=(y,b,S,x)=>{y<s&&(s=y),b<l&&(l=b),S>c&&(c=S),x>d&&(d=x)};for(let y of i)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2),y.note&&!y.note.collapsed&&u(y.x+y.note.x,y.y+y.note.y,y.x+y.note.x+y.note.width,y.y+y.note.y+y.note.height);for(let y of t.groups)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2);if(!Number.isFinite(s))return{...t,nodes:i};let{shiftX:f,shiftY:p}=Ws(s,l),m=f!==0||p!==0,h=m?i.map(y=>({...y,x:y.x+f,y:y.y+p})):i,g=m?t.edges.map(y=>({...y,points:y.points.map(b=>({x:b.x+f,y:b.y+p})),...y.labelX!==void 0&&{labelX:y.labelX+f},...y.labelY!==void 0&&{labelY:y.labelY+p}})):t.edges,E=m?t.groups.map(y=>({...y,x:y.x+f,y:y.y+p})):t.groups;return{nodes:h,edges:g,groups:E,width:c+f+mO,height:d+p+mO}}function gO(t){let e=new Map;if(t.edges.forEach((o,a)=>{let[i,s]=o.source<o.target?[o.source,o.target]:[o.target,o.source],l=`${i}\0${s}`,c=e.get(l);c?c.push(a):e.set(l,[a])}),[...e.values()].every(o=>o.length<2))return t;let n=new Array(t.edges.length).fill(0),r=new Array(t.edges.length).fill(1);for(let o of e.values()){let a=o.slice(0,hO);for(let i of o.slice(hO))r[i]=0;a.length<2||a.forEach((i,s)=>{n[i]=(s-(a.length-1)/2)*eJ,r[i]=a.length})}return{...t,edges:t.edges.map((o,a)=>({...o,yOffset:n[a],parallelCount:r[a]}))}}var mO,hO,eJ,nJ,aa,Ma,rJ,C1,yO,A1,bO,oJ,_1,aJ,iJ,sJ,lJ,Nf=st(()=>{"use strict";en();v1();es();mO=40,hO=5,eJ=22,nJ=1.618,aa=60,Ma=Math.round(aa*nJ),rJ=140,C1=10,yO=1.4,A1=8,bO=4,oJ=6,_1=3,aJ=1.3,iJ=12,sJ=11,lJ=bO+sJ*yO+A1});var _O={};ye(_O,{layoutSwimlane:()=>hJ});function mJ(t){return t==="exclusive"||t==="parallel"?{w:EO,h:EO}:t==="terminal"?{w:SO,h:SO}:{w:I1,h:TO}}function MO(t,e,n,r){let o=new Map,a=new Map;for(let c of t)o.set(c,[]),a.set(c,0);for(let c of e)o.get(c.from)?.push(c.to),a.set(c.to,(a.get(c.to)??0)+1);let i=new Map(t.map(c=>[c,0])),s=new Map;for(let c of t)s.set(c,new Map);let l=t.filter(c=>(a.get(c)??0)===0);for(let c=0;c<l.length;c++){let d=l[c],u=n(d),f=s.get(d),p=r?.get(d);p!==void 0&&(i.get(d)??0)<p&&i.set(d,p);let m=f.get(u);m!==void 0&&(i.get(d)??0)<=m&&i.set(d,m+1);let h=i.get(d),g=new Map(f);g.set(u,Math.max(g.get(u)??-1,h));for(let E of o.get(d)??[]){let y=h+(n(E)===u?1:0);y>(i.get(E)??0)&&i.set(E,y);let b=s.get(E);for(let[x,L]of g)L>(b.get(x)??-1)&&b.set(x,L);let S=(a.get(E)??0)-1;a.set(E,S),S===0&&l.push(E)}}return i}function hJ(t){let n=t.direction==="LR",r=new Map(t.nodes.map(F=>[F.id,F])),o=t.nodes.map(F=>F.id),a=new Map(t.nodes.map(F=>[F.id,mJ(F.shape)])),i=F=>{let Q=a.get(F);return n?Q.w:Q.h},s=F=>{let Q=a.get(F);return n?Q.h:Q.w},l=t.edges.map((F,Q)=>({from:F.source,to:F.target,idx:Q})).filter(F=>F.from!==F.to&&r.has(F.from)&&r.has(F.to)),{dag:c}=wg(o,l),d=F=>r.get(F).lane,u=MO(o,c.map(F=>({from:F.from,to:F.to})),d),f=new Map;for(let F of o)f.set(F,u.get(F)??0);{let F=new Map(t.lanes.map((Z,lt)=>[Z.id,lt])),Q=c.map(Z=>({from:Z.from,to:Z.to})),ot=new Map;for(let Z=0;Z<o.length;Z++){let lt=!1;for(let nt of l)if(!((f.get(nt.to)??0)>=(f.get(nt.from)??0)))for(let J of[nt.from,nt.to]){let at=f.get(J),it=F.get(d(J));for(let vt of o)vt===nt.from||vt===nt.to||f.get(vt)===at&&((F.get(d(vt))??0)<=it||(ot.get(vt)??0)<=at&&(ot.set(vt,at+1),lt=!0))}if(!lt)break;f=MO(o,Q,d,ot)}}let p=Array.from(new Set(o.map(F=>f.get(F)))).sort((F,Q)=>F-Q),m=new Map(p.map((F,Q)=>[F,Q])),h=p.length,g=F=>m.get(f.get(F))??0,E=vO+vg,y=Array.from({length:h},()=>0);for(let F of o){let Q=g(F);y[Q]=Math.max(y[Q],i(F))}let b=[],S=[];{let F=E;for(let Q=0;Q<h;Q++){let ot=Math.max(y[Q],I1);S[Q]=ot,b[Q]=F+ot/2,F+=ot+wO}}let x=F=>b[F]+S[F]/2+wO/2,L=(h>0?b[h-1]+Math.max(y[h-1],I1)/2:E)+vg,v=(t.phases.length?kO:0)+vg,A=new Map;for(let F of t.nodes){let Q=`${F.lane}\0${g(F.id)}`;(A.get(Q)??A.set(Q,[]).get(Q)).push(F.id)}let C=(F,Q)=>{let ot=A.get(`${F}\0${Q}`)??[];return ot.length===0?0:ot.reduce((Z,lt)=>Z+s(lt),0)+R1*(ot.length-1)},M=new Map,w=new Map,k=new Map;{let F=v;for(let Q of t.lanes){let ot=0;for(let lt=0;lt<h;lt++)ot=Math.max(ot,C(Q.id,lt));let Z=Math.max(pJ,ot+2*CO);M.set(Q.id,F),w.set(Q.id,Z),k.set(Q.id,F+Z/2),F+=Z}}let N=(()=>{let F=v;for(let Q of t.lanes)F+=w.get(Q.id);return F})(),_=new Map,T=new Map;for(let[F,Q]of A){let ot=F.indexOf("\0"),Z=F.slice(0,ot),lt=k.get(Z)??v,nt=Q.reduce((at,it)=>at+s(it),0)+R1*(Q.length-1),J=lt-nt/2;for(let at of Q){let it=s(at);T.set(at,J+it/2),J+=it+R1,_.set(at,b[g(at)])}}let R=0;for(let F of l)(f.get(F.to)??0)<(f.get(F.from)??0)&&R++;let I=R>0?LO+NO*(R-1):0,H=N+I+vg,O=(F,Q)=>n?{x:F,y:Q}:{x:Q,y:F},D=t.nodes.map(F=>{let Q=a.get(F.id),ot=O(_.get(F.id),T.get(F.id));return{id:F.id,label:F.label,shape:F.shape,event:F.event,lane:F.lane,...F.phase!==void 0&&{phase:F.phase},...F.color!==void 0&&{color:F.color},tags:F.tags,x:ot.x,y:ot.y,width:Q.w,height:Q.h,lineNumber:F.lineNumber}}),W=16,z=new Array(t.edges.length).fill(0);{let F=new Map;t.edges.forEach((Q,ot)=>{let Z=r.get(Q.source),lt=r.get(Q.target);if(!Z||!lt||Z.id===lt.id)return;let nt=f.get(Z.id)??0;if((f.get(lt.id)??0)<=nt||Math.abs((T.get(Z.id)??0)-(T.get(lt.id)??0))<.5)return;let at=`${Q.target}\0${nt}`;(F.get(at)??F.set(at,[]).get(at)).push(ot)});for(let Q of F.values())Q.length<2||(Q.sort((ot,Z)=>(T.get(t.edges[ot].source)??0)-(T.get(t.edges[Z].source)??0)),Q.forEach((ot,Z)=>{z[ot]=(Z-(Q.length-1)/2)*W}))}let P=4,B=(F,Q,ot,Z,lt,nt)=>{let J=1/0;for(let Tt of o){if(Tt===F)continue;let At=i(Tt)/2+P;if(Math.abs(_.get(Tt)-Q)>=At)continue;let rt=s(Tt)/2,pt=T.get(Tt);pt+rt<=ot||pt-rt>=Z||(J=Math.min(J,pt-rt))}if(J===1/0)return{flow:Q};let at=lt-1,it=lt<h-1?lt:-1,vt=nt<Q?at:it;return vt<0&&(vt=nt<Q?it:at),vt<0?{flow:Q}:{flow:x(vt),jogCross:(ot+J)/2}},Y=0,V=[];t.edges.forEach((F,Q)=>{let ot=r.get(F.source),Z=r.get(F.target);if(!ot||!Z||ot.id===Z.id)return;let lt=_.get(ot.id),nt=T.get(ot.id),J=_.get(Z.id),at=T.get(Z.id),it=i(ot.id)/2,vt=i(Z.id)/2,Tt=s(ot.id)/2,At=s(Z.id)/2,rt=f.get(ot.id)??0,pt=f.get(Z.id)??0,ht,dt=!1;if(pt>rt){let ut=lt+it,yt=J-vt;if(Math.abs(nt-at)<.5)ht=[O(ut,nt),O(yt,at)];else{let kt=(ut+yt)/2+z[Q];ht=[O(ut,nt),O(kt,nt),O(kt,at),O(yt,at)]}}else if(pt===rt){let ut=at>=nt,yt=nt+(ut?Tt:-Tt),kt=at+(ut?-At:At);if(Math.abs(lt-J)<.5)ht=[O(lt,yt),O(J,kt)];else{let Ot=(yt+kt)/2;ht=[O(lt,yt),O(lt,Ot),O(J,Ot),O(J,kt)]}}else{dt=!0;let ut=N+LO+NO*Y;Y++;let yt=nt+Tt,kt=at+At,Ot=B(ot.id,lt,yt,ut,g(ot.id),J),Xt=B(Z.id,J,kt,ut,g(Z.id),lt);ht=[O(lt,yt),...Ot.jogCross!==void 0?[O(lt,Ot.jogCross),O(Ot.flow,Ot.jogCross)]:[],O(Ot.flow,ut),O(Xt.flow,ut),...Xt.jogCross!==void 0?[O(Xt.flow,Xt.jogCross),O(J,Xt.jogCross)]:[],O(J,kt)]}V.push({source:F.source,target:F.target,...F.label!==void 0&&{label:F.label},points:ht,back:dt,lineNumber:F.lineNumber})});let j=(F,Q,ot,Z)=>n?{x:F,y:ot,width:Q,height:Z}:{x:ot,y:F,width:Z,height:Q},K=t.lanes.map(F=>{let Q=j(0,L,M.get(F.id),w.get(F.id));return{id:F.id,label:F.label,...F.color!==void 0&&{color:F.color},...Q,headerSize:vO,lineNumber:F.lineNumber}}),$=new Map(t.phases.map((F,Q)=>[F.id,Q])),U=Array.from({length:h},()=>{});for(let F of t.nodes){if(F.phase===void 0)continue;let Q=$.get(F.phase);if(Q===void 0)continue;let ot=g(F.id),Z=U[ot];(Z===void 0||Q<Z)&&(U[ot]=Q)}let X=Array.from({length:h},()=>0),q=0;for(let F=0;F<h;F++){let Q=U[F];Q!==void 0&&Q>q&&(q=Q),X[F]=q}let et=(F,Q)=>(b[F]+b[Q])/2,tt=[];if(t.phases.length>0&&h>0){let F=0;for(let Q=1;Q<=h;Q++)if(Q===h||X[Q]!==X[F]){let ot=F,Z=Q-1,lt=t.phases[X[F]],nt=ot===0?0:et(ot-1,ot),J=Z===h-1?L:et(Z,Z+1);tt.push({id:lt.id,label:lt.label,...j(nt,J-nt,0,H),headerSize:kO,lineNumber:lt.lineNumber}),F=Q}}return{nodes:D,edges:V,lanes:K,phases:tt,width:n?L:H,height:n?H:L}}var vg,wO,I1,TO,EO,SO,R1,CO,pJ,vO,kO,LO,NO,AO=st(()=>{"use strict";k1();vg=30,wO=64,I1=124,TO=44,EO=56,SO=40,R1=16,CO=22,pJ=TO+2*CO,vO=116,kO=30,LO=28,NO=18});function vd(t,e){let{idPrefix:n,width:r,height:o,baseFill:a,colors:i}=e,s=(l,c)=>{t.append("marker").attr("id",l).attr("viewBox",`0 0 ${r} ${o}`).attr("refX",r).attr("refY",o/2).attr("markerWidth",r).attr("markerHeight",o).attr("orient","auto").append("polygon").attr("points",`0,0 ${r},${o/2} 0,${o}`).attr("fill",c)};s(`${n}-arrow`,a);for(let l of i??[])s(`${n}-arrow-${l.replace("#","")}`,l)}var kg=st(()=>{"use strict"});var OO={};ye(OO,{renderSwimlaneForExport:()=>kJ});function SJ(t,e){if(t.length<3)return t.map((o,a)=>`${a?"L":"M"}${o.x} ${o.y}`).join(" ");let n=`M${t[0].x} ${t[0].y}`;for(let o=1;o<t.length-1;o++){let a=t[o-1],i=t[o],s=t[o+1],l=Math.hypot(i.x-a.x,i.y-a.y),c=Math.hypot(s.x-i.x,s.y-i.y);if(l<.01||c<.01){n+=` L${i.x} ${i.y}`;continue}let d=Math.min(e,l/2,c/2),u=i.x-(i.x-a.x)/l*d,f=i.y-(i.y-a.y)/l*d,p=i.x+(s.x-i.x)/c*d,m=i.y+(s.y-i.y)/c*d;n+=` L${u} ${f} Q${i.x} ${i.y} ${p} ${m}`}let r=t[t.length-1];return n+=` L${r.x} ${r.y}`,n}function vJ(t,e,n,r,o,a){let i=o-n,s=a-r,l=i*i+s*s,c=l>0?((t-n)*i+(e-r)*s)/l:0;return c=Math.max(0,Math.min(1,c)),Math.hypot(t-(n+c*i),e-(r+c*s))}function PO(t,e,n,r,o={}){let a=Math.min(n,r)/2,i=Math.min(o.tl??0,a),s=Math.min(o.tr??0,a),l=Math.min(o.br??0,a),c=Math.min(o.bl??0,a);return[`M${t+i},${e}`,`H${t+n-s}`,s?`A${s},${s} 0 0 1 ${t+n},${e+s}`:"",`V${e+r-l}`,l?`A${l},${l} 0 0 1 ${t+n-l},${e+r}`:"",`H${t+c}`,c?`A${c},${c} 0 0 1 ${t},${e+r-c}`:"",`V${e+i}`,i?`A${i},${i} 0 0 1 ${t+i},${e}`:"","Z"].join(" ")}function kJ(t,e,n,r,o,a={}){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.title?40:0,s=a.exportDims?.width??n.width,l=(a.exportDims?.height??n.height)+0,c=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",s).attr("height",l).attr("viewBox",`0 0 ${s} ${l}`).style("font-family",It),d=c.append("defs"),u=nr(r,o),f={error:r.colors.red,success:r.colors.green,terminate:r.text,neutral:r.border};vd(d,{idPrefix:"sw",width:wJ,height:EJ,baseFill:r.textMuted,colors:[f.error,f.success]});let p=c.append("g").attr("transform",`translate(0, ${i})`);e.title&&c.append("text").attr("x",s/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).text(e.title);let m=new Map;e.lanes.forEach((M,w)=>{let k=M.color??Dn(yl[w%yl.length],r)??r.border;m.set(M.id,k)});let h=e.direction==="LR",g=e.options["solid-fill"]==="on",E=M=>Gt(M,u,9),y=M=>{for(let w of n.lanes){let k=h?w.y:w.x,N=k+(h?w.height:w.width);if(M>=k&&M<=N)return E(m.get(w.id)??r.border)}return u},b=p.append("g").attr("class","dgmo-swimlane-lanes");for(let M of n.lanes){let w=m.get(M.id)??r.border,k=h?M.x:M.x+Ng,N=h?M.y+Ng:M.y,_=h?M.width:M.width-Ng*2,T=h?M.height-Ng*2:M.height;b.append("path").attr("d",PO(k,N,_,T,{tl:cs,tr:cs,br:cs,bl:cs})).attr("fill",Gt(w,u,9)).attr("stroke",Gt(r.border,u,60)).attr("stroke-width",1).attr("data-line-number",String(M.lineNumber));let R=h?M.headerSize:_,G=h?T:M.headerSize;b.append("path").attr("d",PO(k,N,R,G,h?{tl:cs,bl:cs}:{tl:cs,tr:cs})).attr("fill",Gt(w,u,16)).attr("opacity",.6),b.append("text").attr("x",h?k+12:k+_/2).attr("y",h?N+T/2:N+M.headerSize/2).attr("text-anchor",h?"start":"middle").attr("dominant-baseline","middle").attr("font-size",gJ).attr("font-weight","700").attr("fill",Gt(w,r.text,55)).text(M.label)}let S=p.append("g").attr("class","dgmo-swimlane-phases");n.phases.forEach((M,w)=>{w%2===1&&S.append("rect").attr("x",M.x).attr("y",M.y).attr("width",M.width).attr("height",M.height).attr("rx",cs).attr("fill",r.text).attr("opacity",.05).attr("pointer-events","none"),S.append("text").attr("x",h?M.x+M.width/2:M.headerSize/2).attr("y",h?M.headerSize/2:M.y+M.height/2).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",yJ).attr("font-weight","700").attr("letter-spacing","0.06em").attr("fill",r.textMuted).attr("data-line-number",String(M.lineNumber)).text(M.label)});let x=a.activeTagGroup??null,L=M=>{if(x){let k=qt(x);if(M.tags[k]){let N=ar(M.tags,[...e.tagGroups],x);if(N&&N!=="#999999")return{fill:g?N:Gt(N,u,22),stroke:N}}}if(M.shape==="terminal")return M.event==="error"?{fill:g?f.error:Gt(f.error,u,22),stroke:f.error}:M.event==="success"?{fill:g?f.success:Gt(f.success,u,22),stroke:f.success}:M.event==="terminate"?{fill:Gt(r.text,u,30),stroke:r.text}:{fill:r.bg,stroke:r.textMuted};if(M.shape==="exclusive"||M.shape==="parallel")return{fill:Gt(r.surface,u,80),stroke:r.textMuted};let w=m.get(M.lane)??r.border;return{fill:g?w:Gt(w,u,20),stroke:Gt(w,r.text,40)}},v=new Map(n.nodes.map(M=>[M.id,M])),A=p.append("g").attr("class","dgmo-swimlane-edges");for(let M of n.edges){let w=v.get(M.target),k=r.textMuted,N="sw-arrow";w?.shape==="terminal"&&w.event==="error"?(k=f.error,N=`sw-arrow-${f.error.replace("#","")}`):w?.shape==="terminal"&&w.event==="success"&&(k=f.success,N=`sw-arrow-${f.success.replace("#","")}`);let _=SJ(M.points,xJ);if(A.append("path").attr("d",_).attr("fill","none").attr("stroke",k).attr("stroke-width",bJ).attr("stroke-dasharray",M.back?"5 4":null).attr("marker-end",`url(#${N})`).attr("data-line-number",String(M.lineNumber)),M.label){let T=[],R=0;for(let q=0;q<M.points.length-1;q++){let et=M.points[q],tt=M.points[q+1],F=Math.abs(tt.x-et.x)+Math.abs(tt.y-et.y);T.push(F),R+=F}let G=R/2,I=0;for(let q=0;q<T.length;q++){if(G<=T[q]||q===T.length-1){I=q;break}G-=T[q]}let H=M.points[I],O=M.points[I+1]??H,D=T[I]>0?G/T[I]:.5,W={x:H.x+(O.x-H.x)*D,y:H.y+(O.y-H.y)*D},z=Math.abs(O.x-H.x)>=Math.abs(O.y-H.y),P=7,B=(q,et)=>{let tt=1/0;for(let F of n.edges)if(F!==M)for(let Q=0;Q<F.points.length-1;Q++){let ot=vJ(q,et,F.points[Q].x,F.points[Q].y,F.points[Q+1].x,F.points[Q+1].y);ot<tt&&(tt=ot)}return tt},Y=M.label.length*RO*.6,V=(q,et,tt)=>{let F=tt===0?[q-Y/2,q,q+Y/2]:[q,q+tt*Y/2,q+tt*Y];return Math.min(...F.map(Q=>B(Q,et)))},j=10,K,$,U,X;if(z){let q=V(W.x,W.y-P,0),et=V(W.x,W.y+P,0),tt=q<j&&et>q;K=W.x,$=W.y+(tt?P:-P),U="middle",X=tt?"hanging":"auto"}else{let q=V(W.x+P,W.y,1),et=V(W.x-P,W.y,-1),tt=q<j&&et>q;K=W.x+(tt?-P:P),$=W.y,U=tt?"end":"start",X="middle"}A.append("text").attr("x",K).attr("y",$).attr("text-anchor",U).attr("dominant-baseline",X).attr("font-size",RO).attr("fill",k===r.textMuted?r.textMuted:k).attr("stroke",y($)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}}let C=p.append("g").attr("class","dgmo-swimlane-nodes");for(let M of n.nodes){let{fill:w,stroke:k}=L(M),N=C.append("g").attr("data-line-number",String(M.lineNumber)).attr("data-lane",M.lane),_=M.x,T=M.y;if(M.shape==="exclusive"||M.shape==="parallel"){let R=M.width/2;if(N.append("polygon").attr("points",`${_},${T-R} ${_+R},${T} ${_},${T+R} ${_-R},${T}`).attr("fill",w).attr("stroke",k).attr("stroke-width",P1),M.shape==="parallel"){let G=r.textMuted;N.append("line").attr("x1",_).attr("y1",T-R/2.4).attr("x2",_).attr("y2",T+R/2.4).attr("stroke",G).attr("stroke-width",2.4),N.append("line").attr("x1",_-R/2.4).attr("y1",T).attr("x2",_+R/2.4).attr("y2",T).attr("stroke",G).attr("stroke-width",2.4),N.append("text").attr("x",_).attr("y",T+R+12).attr("text-anchor","middle").attr("font-size",Lg-1).attr("fill",r.textMuted).attr("stroke",y(T+R+12)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}else DO(N,M.label,_,T,r.text,Lg-1,!0,y(T))}else if(M.shape==="terminal"){let R=M.width/2;N.append("circle").attr("cx",_).attr("cy",T).attr("r",R).attr("fill",w).attr("stroke",k).attr("stroke-width",M.event==="none"?P1:2.4),M.event==="success"&&N.append("circle").attr("cx",_).attr("cy",T).attr("r",R-4).attr("fill","none").attr("stroke",k).attr("stroke-width",1);let G=!1;for(let H of n.edges){let O=H.target===M.id?H.points[H.points.length-1]:H.source===M.id?H.points[0]:void 0;O&&O.y>T+R*.5&&(G=!0)}let I=G?T-R-6:T+R+12;N.append("text").attr("x",_).attr("y",I).attr("text-anchor","middle").attr("font-size",Lg-1).attr("fill",r.text).attr("stroke",y(I)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}else{N.append("rect").attr("x",_-M.width/2).attr("y",T-M.height/2).attr("width",M.width).attr("height",M.height).attr("rx",IO).attr("fill",w).attr("stroke",k).attr("stroke-width",P1),M.shape==="subprocess"&&N.append("rect").attr("x",_-M.width/2+3).attr("y",T-M.height/2+3).attr("width",M.width-6).attr("height",M.height-6).attr("rx",IO-2).attr("fill","none").attr("stroke",k).attr("stroke-width",1);let R=ve(w,r.textOnFillLight,r.textOnFillDark);DO(N,M.label,_,T,R,Lg)}}}function LJ(t,e){let n=[],r="";for(let o of t)r===""?r=o:r.length+1+o.length<=e?r+=" "+o:(n.push(r),r=o);return r&&n.push(r),n}function DO(t,e,n,r,o,a,i=!1,s){let l=e.split(/\s+/),c;if(i)c=l.length===1?[e]:LJ(l,7);else if(e.length<=14||l.length===1)c=[e];else{let f=Math.ceil(l.length/2);c=[l.slice(0,f).join(" "),l.slice(f).join(" ")]}let d=a*1.2,u=r-(c.length-1)*d/2;c.forEach((f,p)=>{let m=t.append("text").attr("x",n).attr("y",u+p*d).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",a).attr("fill",o);s&&m.attr("stroke",s).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke"),m.text(f)})}var Lg,gJ,yJ,RO,IO,P1,bJ,xJ,wJ,EJ,cs,Ng,GO=st(()=>{"use strict";Xn();on();kg();tn();xr();Ke();Lg=12,gJ=12,yJ=12,RO=11,IO=8,P1=1.5,bJ=1.6,xJ=11,wJ=9,EJ=6.4,cs=10,Ng=2});function MJ(t){let e=[],n=t.split(/(\s+)/);for(let r of n){if(/^\s+$/.test(r))continue;let o=r.split(/(?<=-)(?=\S)/);e.push(...o)}return e}function $O(t,e,n,r){let o=e-O1,a=[],i="";for(let s of t){let l=i&&!i.endsWith("-")?" ":"",c=i+l+s;if(_t(c,n)<=o)i=c;else if(!i)i=s;else{if(a.push(i),a.length>=r)return null;i=s}}return i&&a.push(i),a.length>r?null:a}function HO(t,e,n){let r=e-O1,o=[...t],a=o[o.length-1];return _t(a,n)>r&&(o[o.length-1]=tr(a,n,r)),o}function WO(t,e,n,r,o=BO){if(!t)return{lines:[""],fontSize:n};let a=MJ(t);for(let c=n;c>=r;c--){let d=$O(a,e,c,o);if(d)return{lines:HO(d,e,c),fontSize:c}}let i=$O(a,e,r,999)??[t],s=i.slice(0,o),l=HO(s,e,r);if(i.length>o){let c=l[l.length-1];if(!c.endsWith("\u2026")){let d=e-O1;_t(c+"\u2026",r)>d?l[l.length-1]=tr(c,r,d):l[l.length-1]=c+"\u2026"}}return{lines:l,fontSize:r}}function _J(t){return Math.max(FO,TJ-t*CJ)}function Mg(t,e,n,r,o){let a=_J(n),i=WO(t,r,a,FO,BO),s=[],l=D1;if(!o&&e&&e.length>0){let c=NJ;for(let d of e){if(c<=0)break;let u=ea(d),f=WO(u,r,D1,D1,c);s.push(...f.lines),c-=f.lines.length,l=f.fontSize}}return{labelLines:i.lines,labelFontSize:i.fontSize,descLines:s,descFontSize:l}}var O1,BO,NJ,TJ,FO,CJ,D1,G1=st(()=>{"use strict";Qa();en();O1=16,BO=3,NJ=2;TJ=17,FO=9,CJ=3,D1=10});var zO={};ye(zO,{layoutMindmap:()=>Cg});function Cg(t,e,n){let r=t.roots;if(r.length===0)return{nodes:[],edges:[],width:0,height:0};let o=n?.hiddenCounts??new Map,a=n?.activeTagGroup??null,i=n?.hideDescriptions??!1,s=n?.ctx??Ee.identity(),l={rootWidth:s.structural(AJ),depth1Width:s.structural(RJ),leafWidth:s.structural(IJ),hGap:s.aesthetic($J),vGap:s.aesthetic(HJ),margin:s.aesthetic(WJ),multiRootGap:s.aesthetic(BJ)};jJ(r);let c=[],d=f=>{for(let p of f)c.push(p),d(p.children)};d(r),Ea(c,t.tagGroups);let u=t.tagGroups;return r.length===1?YO(r[0],o,i,u,a,l):FJ(r,t,o,i,u,a,l)}function YO(t,e,n,r=[],o=null,a){let i=[],s=B1(0,a),l=F1(t,n,a),c=t.children,{right:d,left:u}=VJ(c,n,a),f=Tg(d,1,n,a),p=Tg(u,1,n,a),m=Math.max(f,p,l),h=0,g=m/2-l/2;i.push({node:t,x:h,y:g,width:s,height:l,depth:0,direction:"right",subtreeHeight:m});let E=g+l/2,y=h+s+a.hGap;$1(d,y,E,1,"right",n,i,a);let b=h-a.hGap;return $1(u,b,E,1,"left",n,i,a),zJ(i,e,n,t,r,o,a)}function FJ(t,e,n,r,o,a,i){let s=[];for(let p of t)s.push(YO(p,n,r,o,a,i));let l=s.reduce((p,m)=>p+m.width,0)+i.multiRootGap*(s.length-1),c=Math.max(...s.map(p=>p.height)),d=[],u=[],f=0;for(let p of s){let m=(c-p.height)/2;for(let h of p.nodes)d.push({...h,x:h.x+f,y:h.y+m});for(let h of p.edges)u.push({sourceId:h.sourceId,targetId:h.targetId,path:UJ(h.path,f,m)});f+=p.width+i.multiRootGap}return{nodes:d,edges:u,width:l,height:c}}function $1(t,e,n,r,o,a,i,s){if(t.length===0)return;let l=Tg(t,r,a,s),c=n-l/2;for(let d of t){let u=B1(r,s),f=F1(d,a,s),p=W1(d,r,a,s),m=c+p/2-f/2,h=o==="right"?e:e-u;if(i.push({node:d,x:h,y:m,width:u,height:f,depth:r,direction:o,subtreeHeight:p}),d.children.length>0){let g=m+f/2,E=o==="right"?h+u+s.hGap:h-s.hGap;$1(d.children,E,g,r+1,o,a,i,s)}c+=p+s.vGap}}function Tg(t,e,n,r){if(t.length===0)return 0;let o=0;for(let a of t)o+=W1(a,e,n,r);return o+=r.vGap*(t.length-1),o}function W1(t,e,n,r){let o=F1(t,n,r);if(t.children.length===0)return o;let a=Tg(t.children,e+1,n,r);return Math.max(o,a)}function YJ(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n)}function zJ(t,e,n,r,o=[],a=null,i){let s=1/0,l=1/0,c=-1/0,d=-1/0;for(let S of t)s=Math.min(s,S.x),l=Math.min(l,S.y),c=Math.max(c,S.x+S.width),d=Math.max(d,S.y+S.height);let u=-s+i.margin,f=-l+i.margin,p=c-s+i.margin*2,m=d-l+i.margin*2,h=new Map;for(let S of t)h.set(S.node.id,S);let g=[],E=[];for(let S of t){let x=YJ(S.node,o,a),L=e.get(S.node.id);g.push({id:S.node.id,label:S.node.label,...S.node.description!==void 0&&{description:[...S.node.description]},metadata:{...S.node.metadata},lineNumber:S.node.lineNumber,...x!==void 0&&{color:x},x:S.x+u,y:S.y+f,width:S.width,height:S.height,depth:S.depth,angle:0,radius:0,...L!==void 0&&{hiddenCount:L},hasChildren:e.has(S.node.id)||S.node.children.length>0})}let y=new Map;for(let S of t)if(S.node.parentId){let x=y.get(S.node.parentId)??[];x.push(S),y.set(S.node.parentId,x)}let b=[];for(let[S,x]of y){let L=x.filter(A=>A.direction==="right"),v=x.filter(A=>A.direction==="left");L.length>0&&b.push([S,L]),v.length>0&&b.push([S,v])}for(let[S,x]of b){let L=h.get(S),v=L.x+u,A=L.y+f,C=x[0].direction==="left",M=C?v:v+L.width,w=A+L.height/2,k=x[0],N=C?k.x+u+k.width:k.x+u,_=(M+N)/2;if(x.length===1){let T=x[0],R=C?T.x+u+T.width:T.x+u,G=T.y+f+T.height/2;E.push({sourceId:S,targetId:T.node.id,path:`M ${M} ${w} L ${_} ${w} L ${_} ${G} L ${R} ${G}`})}else{E.push({sourceId:S,targetId:S,path:`M ${M} ${w} L ${_} ${w}`});let T=x.map(I=>I.y+f+I.height/2),R=Math.min(...T),G=Math.max(...T);E.push({sourceId:S,targetId:S,path:`M ${_} ${R} L ${_} ${G}`});for(let I=0;I<x.length;I++){let H=x[I],O=C?H.x+u+H.width:H.x+u,D=T[I];E.push({sourceId:S,targetId:H.node.id,path:`M ${_} ${D} L ${O} ${D}`})}}}return{nodes:g,edges:E,width:p,height:m}}function VJ(t,e,n){if(t.length<=1)return{right:[...t],left:[]};if(t.length===2)return{right:[t[0]],left:[t[1]]};let r=t.map((l,c)=>({index:c,node:l,height:W1(l,1,e,n)})),o=[],a=[],i=0,s=0;for(let l of r)i<=s?(o.push(l.node),i+=l.height):(a.push(l.node),s+=l.height);return{right:o,left:a}}function UJ(t,e,n){return e===0&&n===0?t:t.replace(/([ML])\s*([\d.e+-]+)\s+([\d.e+-]+)/g,(r,o,a,i)=>`${o} ${parseFloat(a)+e} ${parseFloat(i)+n}`)}function B1(t,e){return t===0?e.rootWidth:t===1?e.depth1Width:e.leafWidth}function F1(t,e,n){let r=XJ(t),o=B1(r,n),a=Mg(t.label,t.description?[...t.description]:void 0,r,o,e),i=a.labelLines.length,l=(i<=1?PJ:DJ*i)+GJ;return a.descLines.length>0&&(l+=OJ*a.descLines.length+4),l}function XJ(t){return H1.get(t.id)??0}function jJ(t){H1.clear();let e=(n,r)=>{for(let o of n)H1.set(o.id,r),e(o.children,r+1)};e(t,0)}var AJ,RJ,IJ,PJ,DJ,OJ,GJ,$J,HJ,WJ,BJ,H1,Y1=st(()=>{"use strict";Ke();G1();fr();AJ=180,RJ=150,IJ=120,PJ=28,DJ=18,OJ=14,GJ=10,$J=40,HJ=12,WJ=40,BJ=60;H1=new Map});var UO={};ye(UO,{collapseMindmapTree:()=>KJ});function VO(t){return{id:t.id,label:t.label,...t.description!==void 0&&{description:[...t.description]},metadata:{...t.metadata},children:t.children.map(VO),parentId:t.parentId,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color},...t.collapsed!==void 0&&{collapsed:t.collapsed}}}function KJ(t,e){return e.size===0?{roots:[...t],hiddenCounts:new Map}:ld(t,e,qJ)}var qJ,XO=st(()=>{"use strict";xf();qJ={getId:t=>t.id,getChildren:t=>t.children,clone:VO,setChildren:(t,e)=>{t.children=e},countsAsHidden:()=>!0}});var KO={};ye(KO,{renderMindmap:()=>qO,renderMindmapForExport:()=>ott});function ttt(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function ett(t,e){return e??t.primary}function rtt(t,e){let n=ntt[t];return n&&n in e.colors?e.colors[n]:e.colors.gray}function qO(t,e,n,r,o,a,i,s,l,c,d){let u=!!i,f=i?.width??(t.getBoundingClientRect().width||800),p=i?.height??(t.getBoundingClientRect().height||600);Rt(t).selectAll("*").remove();let m=Rt(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It),h=d?.controlsHost==="app",g=!!d?.onToggleColorByDepth||!!d?.onToggleDescriptions,E=e.tagGroups.length>0||g&&!h,y=!u&&E,b=y?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},f)+Wn:0,S=!!e.title&&e.options["no-title"]!=="on",x=!u&&S,L=x?jO:0,v=f,A=p-kd*2-b-L,C=u?Ee.identity():Ee.fromBox(v,n.width,A,n.height),M=n;if(C.factor<1){let G=new Map;for(let H of n.nodes)H.hiddenCount!=null&&H.hiddenCount>0&&G.set(H.id,H.hiddenCount);let I=H=>Cg(e,r,{interactive:!u,...G.size>0&&{hiddenCounts:G},activeTagGroup:c??null,...l!==void 0&&{hideDescriptions:l},ctx:H});M=I(C);for(let H=0;H<3&&!C.isBelowFloor;H++){let O=Math.min(v/M.width,A/M.height);if(O>=.999)break;C=Ee.fromFactor(C.factor*O),M=I(C)}}let w=u?1:Math.min(1,M.width>0?v/M.width:1,M.height>0?A/M.height:1),k=M.width*w,N=M.height*w,_=Math.max(0,(v-k)/2),T=kd+b+L+Math.max(0,(A-N)/2),R=m.append("g").attr("transform",`translate(${_}, ${T})${w<1?` scale(${w})`:""}`);if(C.isBelowFloor&&m.attr("width","100%"),S){let G=x?m:R,I=x?f/2:M.width/2,H=x?kd+20:20,O=G.append("text").attr("x",I).attr("y",H).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("class","chart-title").text(e.title);e.titleLineNumber&&O.attr("data-line-number",e.titleLineNumber),a&&e.titleLineNumber&&O.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))}if(y){let G=m.append("g").attr("class","mindmap-legend-fixed").attr("transform",`translate(0, ${kd+L})`),I=new Map;for(let P of M.nodes)for(let B of e.tagGroups){let Y=B.name.toLowerCase(),V=P.metadata[Y];V&&(I.has(Y)||I.set(Y,new Set),I.get(Y).add(V.toLowerCase()))}let H=[];d?.onToggleDescriptions&&H.push({id:"descriptions",type:"toggle",label:"Descriptions",active:!l,onToggle:P=>d.onToggleDescriptions(P)}),d?.onToggleColorByDepth&&H.push({id:"depth-colors",type:"toggle",label:"Depth Colors",active:d.colorByDepth??!1,onToggle:d.onToggleColorByDepth});let O=H.length>0?{toggles:H}:void 0,D={groups:e.tagGroups.map(P=>{let B=I.get(P.name.toLowerCase());return{name:P.name,...P.alias!==void 0&&{alias:P.alias},entries:P.entries.filter(Y=>B?.has(Y.value.toLowerCase())).map(Y=>({value:Y.value,color:Y.color}))}}),position:{placement:"top-center",titleRelation:"below-title"},mode:d?.exportMode?"export":"preview",...O!==void 0&&{controlsGroup:O},...d?.controlsHost!==void 0&&{controlsHost:d.controlsHost}},W={text:r.text,textMuted:r.textMuted,bg:r.bg,surface:r.surface,primary:r.primary},z={...d?.onToggleControlsExpand!==void 0&&{onControlsExpand:d.onToggleControlsExpand},onControlsToggle:(P,B)=>{P==="depth-colors"&&d?.onToggleColorByDepth&&d.onToggleColorByDepth(B),P==="descriptions"&&d?.onToggleDescriptions&&d.onToggleDescriptions(B)}};fn(G,{...D,palette:W,isDark:o,width:f,activeGroup:d?.colorByDepth?null:c!==void 0?c:e.options["active-tag"]??null,hiddenAttributes:new Set,...d?.controlsExpanded!==void 0&&{controlsExpanded:d.controlsExpanded},callbacks:z})}for(let G of M.edges)R.append("path").attr("class","mindmap-edge").attr("d",G.path).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.5);for(let G of M.nodes){let I=G.radius===0&&M.nodes.indexOf(G)===0,H=I?JJ:1.5,O=d?.colorByDepth?rtt(G.depth,r):G.color,D=ttt(r,o,O,e.options["solid-fill"]==="on"),W=ett(r,O),z=ve(D,r.textOnFillLight,r.textOnFillDark),P=R.append("g").attr("class","mindmap-node").attr("data-line-number",G.lineNumber);if(c){let F=qt(c),Q=G.metadata[F];Q&&P.attr(`data-tag-${F}`,Q.toLowerCase())}G.hasChildren&&P.attr("data-node-toggle",G.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",G.hiddenCount!=null&&G.hiddenCount>0?"false":"true").attr("aria-label",G.label),P.append("rect").attr("x",G.x).attr("y",G.y).attr("width",G.width).attr("height",G.height).attr("rx",_g).attr("ry",_g).attr("fill",D).attr("stroke",W).attr("stroke-width",H);let B=G.hiddenCount!=null&&G.hiddenCount>0,Y=!l&&!!G.description&&!B,V=Mg(G.label,G.description,G.depth,G.width,l||B),{labelLines:j,labelFontSize:K,descLines:$,descFontSize:U}=V,X=j.length,q=X<=1?ZJ:z1*X,et=Y?q:G.height,tt=G.x+G.width/2;if(X<=1){let F=G.y+et/2+K*.35;P.append("text").attr("x",tt).attr("y",F).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",z).text(j[0])}else{let F=z1*(X-1),Q=G.y+et/2-F/2+K*.35,ot=P.append("text").attr("x",tt).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",z);for(let Z=0;Z<j.length;Z++)ot.append("tspan").attr("x",tt).attr("y",Q+Z*z1).text(j[Z])}if((j.length>1||j[0]!==G.label)&&P.append("title").text(G.label),Y&&$.length>0){let F=G.y+q;if(P.append("line").attr("x1",G.x).attr("y1",F).attr("x2",G.x+G.width).attr("y2",F).attr("stroke",W).attr("stroke-opacity",.3).attr("stroke-width",1),$.length<=1){let Q=F+4+U,ot=ea($[0]),Z=P.append("text").attr("x",tt).attr("y",Q).attr("text-anchor","middle").attr("font-size",U).attr("fill",z);gn(Z,ot,r,U)}else{let Q=F+4+U;for(let ot=0;ot<$.length;ot++){let Z=ea($[ot]),lt=P.append("text").attr("x",tt).attr("y",Q+ot*QJ).attr("text-anchor","middle").attr("font-size",U).attr("fill",z);gn(lt,Z,r,U)}}}if(!u&&G.hiddenCount!=null&&G.hiddenCount>0){let F=`collapse-clip-${G.id}`;R.append("defs").append("clipPath").attr("id",F).append("rect").attr("x",G.x).attr("y",G.y).attr("width",G.width).attr("height",G.height).attr("rx",_g).attr("ry",_g),P.append("rect").attr("class","collapse-bar").attr("x",G.x).attr("y",G.y+G.height-6).attr("width",G.width).attr("height",6).attr("fill",W).attr("clip-path",`url(#${F})`)}a&&P.style("cursor","pointer").on("click",F=>{G.hasChildren&&s?(F.stopPropagation(),s(G.id)):a(G.lineNumber)}),u||P.on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)})}}function ott(t,e,n){let r=nd(t,n);if(r.error)return"";let o=e==="dark",a=r.options["no-descriptions"]==="true",i=Cg(r,n,{interactive:!1,hideDescriptions:a}),s=r.title&&r.options["no-title"]!=="on"?jO:0,l=i.width+kd*2,c=i.height+kd*2+s;return cd(l,c,d=>(qO(d,r,i,n,o,void 0,{width:l,height:c},void 0,a),dd(d,e)))}var kd,jO,ZJ,z1,QJ,_g,JJ,ntt,ZO=st(()=>{"use strict";Ke();Xn();on();Qh();tn();kh();Y1();G1();_o();Qa();Br();Mr();To();fr();kd=20,jO=30,ZJ=28,z1=18,QJ=14,_g=6,JJ=2.5;ntt=["red","orange","yellow","green","blue","purple","teal","cyan"]});var nG={};ye(nG,{layoutWireframe:()=>gtt});function gtt(t,e,n,r=!0){V1=r?eG:ctt;let o=t.formFactor==="mobile"?itt:att,a=n??o,i=t.title&&t.options["no-title"]!=="on"?ftt:0,s=a-JO*2,l=ytt(t.roots,s,t.formFactor),c=0;for(let p of l)c=Math.max(c,p.y+p.height);let d=[],u=c+24;for(let p of t.modals){let m=Math.min(s*.7,600),h=(s-m)/2,g=Ld(p,h,u,m);d.push(g),u+=g.height+24}let f=(d.length>0?d[d.length-1].y+d[d.length-1].height:c)+JO*2+i;return{width:a,height:f,titleHeight:i,nodes:l,modalNodes:d}}function ytt(t,e,n){let r=[],o=0,a=[],i=[];for(let s of t){let l=s.label.toLowerCase().split(/\s+/)[0];tG.has(l)||n==="mobile"?(i.length>0&&(a.push(i),i=[]),a.push([s])):i.push(s)}i.length>0&&a.push(i);for(let s of a){if(s.length===1&&n!=="mobile"){let l=s[0],c=l.label.toLowerCase().split(/\s+/)[0];if(tG.has(c)){let d=Ld(l,0,o,e);c==="header"||c==="top"?d.height=Math.max(d.height,mtt):d.height=Math.max(d.height,htt),r.push(d),o+=d.height+16;continue}}if(n==="mobile"||s.length===1)for(let l of s){let c=Ld(l,0,o,e);r.push(c),o+=c.height+16}else{let l=btt(s,e),c=0,d=0,u=[];for(let f=0;f<s.length;f++){let p=l[f],m=Ld(s[f],c,o,p);u.push(m),d=Math.max(d,m.height),c+=p+12}for(let f of u)f.height=d;r.push(...u),o+=d+16}}return r}function btt(t,e){let r=(t.length-1)*12,o=e-r,a=new Array(t.length).fill(0),i=0,s=0;for(let l=0;l<t.length;l++){let c=t[l].label.toLowerCase().split(/\s+/)[0],d=ptt[c];d!==void 0&&d>0?(a[l]=o*d,i+=a[l]):s++}if(s>0){let c=Math.max(0,o-i)/s;for(let d=0;d<a.length;d++)a[d]===0&&(a[d]=Math.max(40,c))}for(let l=0;l<a.length;l++)a[l]=Math.max(40,a[l]);return a}function Ld(t,e,n,r){let o={id:t.id,x:e,y:n,width:r,height:0,element:t,children:[]},a=t.type==="nav"||t.type==="tabs";if(!t.isContainer||t.children.length===0||a)return o.height=wtt(t),o;let i=t.metadata._inlineRow==="true"||t.metadata._labelField==="true",s=i?0:V1,l=i?0:dtt,c=i?0:utt,d=r-c*2,u=c;if(t.orientation==="horizontal"){let f=xtt(t.children,d),p=u,m=0,h=[];for(let g=0;g<t.children.length;g++){let E=t.children[g],y=f[g],b=Ld(E,p,s,y);h.push(b),o.children.push(b),m=Math.max(m,b.height),p+=y+8}for(let g of h)g.height=m;o.height=s+m+l}else{let f=s,p=Stt(t.children);p>0&&(o.fieldAlignX=p);for(let m of t.children){let h=Ld(m,u,f,d);o.children.push(h),f+=h.height+Ett(m)}o.height=f+l}return t.states.includes("collapsed")&&(o.height=V1,o.children=[]),o}function xtt(t,e){let r=(t.length-1)*8,o=Math.max(40,(e-r)/t.length);return t.map(()=>o)}function wtt(t){return t.type==="heading"?t.headingLevel===2?Ag.subheading??36:Ag.heading??48:t.type==="textInput"&&t.fieldVariant==="textarea"?80:t.type==="table"?32+(t.tableData?.length||t.tableRows||0)*28+8:t.type==="image"?t.imageHint==="round"||t.imageHint==="wide"?80:Ag.image??120:t.metadata._labelField==="true"?36:Ag[t.type]??24}function Ett(t){return t.type==="heading"&&t.headingLevel===2?QO.subheading??12:QO[t.type]??8}function Stt(t){let e=0,n=0;for(let r of t)if(r.metadata._labelField==="true"&&r.children.length>=2){let o=r.children[0],a=_t(o.label,ltt);e=Math.max(e,a),n++}return n<2?0:e+stt}var att,itt,stt,ltt,Ag,QO,eG,ctt,dtt,V1,utt,JO,ftt,ptt,tG,mtt,htt,rG=st(()=>{"use strict";en();att=1200,itt=375,stt=16,ltt=13,Ag={textInput:36,button:40,dropdown:36,checkbox:24,radio:24,heading:48,subheading:36,divider:24,text:22,listItem:24,image:120,progress:28,chart:160,alert:40,nav:44,tabs:44},QO={heading:16,subheading:12,divider:12,textInput:8,dropdown:8,checkbox:8,radio:8,button:8,text:12,listItem:4,group:16,image:12,progress:12,chart:16,alert:12,nav:12,tabs:12,table:16},eG=32,ctt=10,dtt=12,V1=eG,utt=12,JO=20,ftt=40,ptt={sidebar:.25,side:.25,left:.25,right:.25,main:0,content:0,center:0},tG=new Set(["header","top","footer","bottom"]),mtt=60,htt=40});var cG={};ye(cG,{renderWireframe:()=>Ltt});function ktt(t,e){let n=vtt[t];return n?n(e):null}function sG(t,e){for(let n of t.states){let r=ktt(n,e);if(r)return r}return null}function Ltt(t,e,n,r,o,a,i,s,l){let c=l??{},d=c.exportDims??i,u=c.theme??s;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let f=!!d,p=d?.width??t.clientWidth,m=d?.height??t.clientHeight,h=f?Ee.identity():Ee.from(p,n.width),g=Rt(t).append("svg").attr("viewBox",`0 0 ${n.width} ${n.height}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);f?g.attr("width",p).attr("height",m):g.attr("width","100%").attr("height","auto").style("display","block");let E={palette:r,isTransparent:u==="transparent",isDark:o,showGroupLabels:c.showGroupLabels??!0,solid:e.options["solid-fill"]==="on"};E.isTransparent||g.append("rect").attr("width",n.width).attr("height",n.height).attr("fill",r.bg).attr("rx",8);let y=g.append("g").attr("transform","translate(20, 20)"),b=0,S=!!e.title&&e.options["no-title"]!=="on",x=h.text(20);f&&S&&(y.append("text").attr("x",0).attr("y",x).attr("fill",r.text).attr("font-size",x).attr("font-weight","700").text(e.title),b=n.titleHeight);let L=y.append("g").attr("transform",`translate(0, ${b})`);for(let v of n.nodes)Cf(L,v,E,0);if(n.modalNodes.length>0){let v=L.append("g").attr("class","wireframe-modals");for(let A of n.modalNodes)ztt(v,A,E)}}function Cf(t,e,n,r){let o=e.element,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",o.lineNumber);if(o.states.includes("disabled")&&a.attr("opacity",.5),o.isSkeleton&&o.type!=="skeleton"){lG(a,e,n);return}switch(o.type){case"group":Ntt(a,e,n,r);break;case"textInput":Mtt(a,e,n);break;case"button":Ttt(a,e,n);break;case"dropdown":Ctt(a,e,n);break;case"checkbox":_tt(a,e,n);break;case"radio":Att(a,e,n);break;case"heading":Rtt(a,e,n);break;case"divider":Itt(a,e,n);break;case"text":aG(a,e,n);break;case"listItem":Ptt(a,e,n);break;case"nav":Dtt(a,e,n);break;case"tabs":Ott(a,e,n);break;case"table":Gtt(a,e,n);break;case"image":Htt(a,e,n);break;case"skeleton":Wtt(a,e,n);break;case"alert":Btt(a,e,n);break;case"progress":Ftt(a,e,n);break;case"chart":Ytt(a,e,n);break;default:aG(a,e,n)}}function Ntt(t,e,n,r){let{palette:o,isTransparent:a}=n,i=e.element;if(i.metadata._inlineRow==="true"||i.metadata._labelField==="true"){for(let d of e.children)Cf(t,d,n,r);return}let s=[12,7,4,2],l=s[Math.min(r,s.length-1)],c=Gt(o.textMuted,o.bg,l);if(a?t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",o.border).attr("stroke-width",1).attr("rx",Tf):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("stroke",o.border).attr("stroke-width",1).attr("rx",Tf),i.label&&n.showGroupLabels&&t.append("text").attr("x",10).attr("y",18).attr("fill",o.textMuted).attr("font-size",11).attr("font-weight","600").attr("letter-spacing","0.5px").text(i.label.toUpperCase()),i.states.includes("collapsed")){t.append("text").attr("x",e.width-20).attr("y",18).attr("fill",o.textMuted).attr("font-size",12).attr("opacity",.6).text("\u25B6");return}i.states.includes("scrollable")&&t.append("rect").attr("x",e.width-6).attr("y",28).attr("width",3).attr("height",Math.min(e.height-36,40)).attr("fill",o.border).attr("rx",1.5);for(let d of e.children)Cf(t,d,n,r+1)}function Mtt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=e.height;if(t.append("rect").attr("width",e.width).attr("height",i).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",iG),a.fieldVariant==="password"?t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.text).attr("font-size",16).text("\u2022 \u2022 \u2022 \u2022 \u2022 \u2022"):t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.textMuted).attr("font-size",13).text(a.label||"Text input"),a.fieldVariant!=="password"){let s=Math.min(_t(a.label||"Text input",13)+14,e.width-20);t.append("line").attr("x1",s).attr("y1",8).attr("x2",s).attr("y2",i-8).attr("stroke",r.primary).attr("stroke-width",1.5).attr("opacity",.6)}if(a.fieldVariant==="textarea")for(let s=0;s<3;s++)t.append("line").attr("x1",e.width-12+s*3).attr("y1",i-4).attr("x2",e.width-4).attr("y2",i-12+s*3).attr("stroke",r.border).attr("stroke-width",1)}function Ttt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.states.includes("ghost"),s=sG(a,r),c=a.states.includes("primary")?r.primary:r.secondary,d=r.bg;s&&(c=s),i||o?(t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",c).attr("stroke-width",1.5).attr("rx",oG),d=c):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("rx",oG),t.append("text").attr("x",e.width/2).attr("y",e.height/2+4).attr("fill",d).attr("font-size",13).attr("font-weight","600").attr("text-anchor","middle").text(a.label)}function Ctt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",iG),t.append("text").attr("x",10).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(a.label||(a.options?.[0]??"Select..."));let i=e.width-16,s=e.height/2;t.append("path").attr("d",`M${i-4},${s-2} L${i},${s+2} L${i+4},${s-2}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5)}function _tt(t,e,n){let{palette:r}=n,o=e.element;if(o.states.includes("toggle")){let l=e.height/2;t.append("rect").attr("x",0).attr("y",l-18/2).attr("width",32).attr("height",18).attr("rx",18/2).attr("fill",o.checked?r.primary:r.border),t.append("circle").attr("cx",o.checked?32-18/2:18/2).attr("cy",l).attr("r",18/2-2).attr("fill",r.bg),o.label&&t.append("text").attr("x",40).attr("y",l+4).attr("fill",r.text).attr("font-size",13).text(o.label)}else{let s=e.height/2;t.append("rect").attr("x",0).attr("y",s-16/2).attr("width",16).attr("height",16).attr("fill",o.checked?r.primary:"none").attr("stroke",o.checked?r.primary:r.border).attr("rx",3),o.checked&&t.append("path").attr("d",`M3,${s} L6,${s+3} L13,${s-4}`).attr("fill","none").attr("stroke",r.bg).attr("stroke-width",2),o.label&&t.append("text").attr("x",24).attr("y",s+4).attr("fill",r.text).attr("font-size",13).text(o.label)}}function Att(t,e,n){let{palette:r}=n,o=e.element,a=8,i=e.height/2;t.append("circle").attr("cx",a).attr("cy",i).attr("r",a).attr("fill","none").attr("stroke",o.selected?r.primary:r.border).attr("stroke-width",1.5),o.selected&&t.append("circle").attr("cx",a).attr("cy",i).attr("r",4).attr("fill",r.primary),t.append("text").attr("x",a*2+8).attr("y",i+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function Rtt(t,e,n){let{palette:r}=n,o=e.element,a=o.headingLevel===1;t.append("text").attr("x",0).attr("y",a?28:22).attr("fill",r.text).attr("font-size",a?22:16).attr("font-weight","bold").text(o.label)}function Itt(t,e,n){let{palette:r}=n;t.append("line").attr("x1",0).attr("y1",e.height/2).attr("x2",e.width).attr("y2",e.height/2).attr("stroke",r.border).attr("stroke-width",1)}function aG(t,e,n){let{palette:r}=n,o=e.element;if(o.metadata._labelField==="true"&&o.children.length>=2){for(let i of e.children)Cf(t,i,n,0);return}let a=o.labelFor?r.textMuted:r.text;t.append("text").attr("x",0).attr("y",15).attr("fill",a).attr("font-size",13).text(o.label)}function Ptt(t,e,n){let{palette:r}=n,o=e.element;t.append("circle").attr("cx",4).attr("cy",e.height/2).attr("r",2.5).attr("fill",r.textMuted),t.append("text").attr("x",14).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function Dtt(t,e,n){let{palette:r}=n,o=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",Gt(r.textMuted,r.bg,8)).attr("rx",4);let a=12;for(let i of o.children){let s=i.states.includes("active");t.append("text").attr("x",a).attr("y",e.height/2+4).attr("fill",s?r.primary:r.text).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label);let l=_t(i.label,13);s&&t.append("line").attr("x1",a).attr("y1",e.height-4).attr("x2",a+l).attr("y2",e.height-4).attr("stroke",r.primary).attr("stroke-width",2),a+=l+24}}function Ott(t,e,n){let{palette:r}=n,o=e.element;t.append("line").attr("x1",0).attr("y1",e.height-1).attr("x2",e.width).attr("y2",e.height-1).attr("stroke",r.border).attr("stroke-width",1);let a=0;for(let i of o.children){let s=i.states.includes("active"),l=_t(i.label,13)+24;s&&t.append("line").attr("x1",a).attr("y1",e.height-1).attr("x2",a+l).attr("y2",e.height-1).attr("stroke",r.primary).attr("stroke-width",2),t.append("text").attr("x",a+12).attr("y",e.height/2+4).attr("fill",s?r.primary:r.textMuted).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label),a+=l}}function Gtt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.tableHeaders||[],s=a.tableData||[],l=a.tableRows!==void 0&&a.tableCols!==void 0,c=i.length||a.tableCols||3,d=e.width/c,u=32,f=28;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",r.border).attr("rx",4),t.append("rect").attr("width",e.width).attr("height",u).attr("fill",o?"none":Gt(r.textMuted,r.bg,8)).attr("rx",4);for(let m=0;m<c;m++){let h=i[m]||`Col ${m+1}`;t.append("text").attr("x",m*d+10).attr("y",u/2+4).attr("fill",r.text).attr("font-size",12).attr("font-weight","600").text(h)}t.append("line").attr("x1",0).attr("y1",u).attr("x2",e.width).attr("y2",u).attr("stroke",r.border);let p=l?a.tableRows||3:s.length;for(let m=0;m<p;m++){let h=u+m*f;m>0&&t.append("line").attr("x1",0).attr("y1",h).attr("x2",e.width).attr("y2",h).attr("stroke",r.border).attr("opacity",.3);for(let g=0;g<c;g++)if(l)t.append("rect").attr("x",g*d+10).attr("y",h+8).attr("width",d*.6).attr("height",12).attr("fill",r.textMuted).attr("opacity",.25).attr("rx",2);else if(s[m]){let E=s[m][g]||"";$tt(t,E,g*d+10,h,d-20,f,n)}}}function $tt(t,e,n,r,o,a,i){let{palette:s}=i,l=e.trim(),c=l.match(/^\(([^)]+)\)(?:\s*\|\s*(.+))?$/);if(c){let d=c[1],u=c[2]?.trim().toLowerCase(),f=u==="ghost",m=u==="destructive"?s.destructive:s.primary,h=Math.min(_t(d,10)+16,o),g=20,E=r+(a-g)/2;f?(t.append("rect").attr("x",n).attr("y",E).attr("width",h).attr("height",g).attr("fill","none").attr("stroke",m).attr("stroke-width",1).attr("rx",3),t.append("text").attr("x",n+h/2).attr("y",E+g/2+3).attr("fill",m).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d)):(t.append("rect").attr("x",n).attr("y",E).attr("width",h).attr("height",g).attr("fill",m).attr("rx",3),t.append("text").attr("x",n+h/2).attr("y",E+g/2+3).attr("fill",s.bg).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d));return}if(/^<\s*x?\s*>$/.test(l)){let d=/x/i.test(l),u=12,f=n,p=r+(a-u)/2;t.append("rect").attr("x",f).attr("y",p).attr("width",u).attr("height",u).attr("fill",d?s.primary:"none").attr("stroke",d?s.primary:s.border).attr("rx",2),d&&t.append("path").attr("d",`M${f+2},${p+u/2} L${f+4},${p+u/2+2} L${f+10},${p+2}`).attr("fill","none").attr("stroke",s.bg).attr("stroke-width",1.5);return}t.append("text").attr("x",n).attr("y",r+a/2+4).attr("fill",s.text).attr("font-size",12).text(l)}function Htt(t,e,n){let{palette:r,isTransparent:o}=n;if(e.element.imageHint==="round"){let s=Math.min(e.width,e.height)/2,l=e.width/2,c=e.height/2;t.append("circle").attr("cx",l).attr("cy",c).attr("r",s).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",r.border),t.append("line").attr("x1",l-s*.7).attr("y1",c-s*.7).attr("x2",l+s*.7).attr("y2",c+s*.7).attr("stroke",r.border),t.append("line").attr("x1",l+s*.7).attr("y1",c-s*.7).attr("x2",l-s*.7).attr("y2",c+s*.7).attr("stroke",r.border)}else t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",r.border).attr("rx",4),t.append("line").attr("x1",0).attr("y1",0).attr("x2",e.width).attr("y2",e.height).attr("stroke",r.border),t.append("line").attr("x1",e.width).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke",r.border)}function Wtt(t,e,n){for(let r of e.children)lG(t,r,n)}function lG(t,e,n){let{palette:r,isTransparent:o}=n,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`);o?a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.1).attr("rx",4):a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.2).attr("rx",4)}function Btt(t,e,n){let{palette:r,isDark:o,isTransparent:a}=n,i=e.element,s=sG(i,r)||r.accent,l=a?null:ie(r,s,o,{solid:n.solid});l&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",l).attr("rx",4),t.append("rect").attr("width",3).attr("height",e.height).attr("fill",s).attr("rx",1.5),a&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",s).attr("rx",4);let c=l?ve(l,r.textOnFillLight,r.textOnFillDark):r.text;t.append("text").attr("x",12).attr("y",e.height/2+4).attr("fill",c).attr("font-size",13).text(i.label)}function Ftt(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.progressValue??0,s=8,l=e.height/2;t.append("rect").attr("width",e.width-40).attr("height",s).attr("y",l-s/2).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",o?r.border:"none").attr("rx",s/2);let c=(e.width-40)*i/100;c>0&&t.append("rect").attr("width",c).attr("height",s).attr("y",l-s/2).attr("fill",r.primary).attr("rx",s/2),t.append("text").attr("x",e.width-32).attr("y",l+4).attr("fill",r.textMuted).attr("font-size",11).text(`${i}%`)}function Ytt(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.chartHint||"line";t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Gt(r.textMuted,r.bg,8)).attr("stroke",r.border).attr("rx",4);let s=20,l=20,c=e.width-s*2,d=e.height-l*2;if(i==="line"){let f=[[0,d*.7],[c*.2,d*.4],[c*.4,d*.6],[c*.6,d*.2],[c*.8,d*.3],[c,d*.1]].map(([p,m],h)=>h===0?`M${s+p},${l+m}`:`L${s+p},${l+m}`).join(" ");t.append("path").attr("d",f).attr("fill","none").attr("stroke",r.primary).attr("stroke-width",2)}else if(i==="bar"){let f=c/10,p=[.6,.8,.5,.9,.7];for(let m=0;m<5;m++){let h=d*p[m];t.append("rect").attr("x",s+m*(c/5)+f/2).attr("y",l+d-h).attr("width",f).attr("height",h).attr("fill",r.primary).attr("opacity",.7).attr("rx",2)}}else if(i==="pie"){let u=e.width/2,f=e.height/2,p=Math.min(c,d)/2,m=[.35,.25,.2,.2],h=[r.primary,r.secondary,r.accent,r.border],g=0;for(let E=0;E<m.length;E++){let y=g+m[E]*Math.PI*2,b=u+p*Math.cos(g),S=f+p*Math.sin(g),x=u+p*Math.cos(y),L=f+p*Math.sin(y),v=m[E]>.5?1:0;t.append("path").attr("d",`M${u},${f} L${b},${S} A${p},${p} 0 ${v},1 ${x},${L} Z`).attr("fill",h[E]).attr("opacity",.7),g=y}}}function ztt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",a.lineNumber);o||i.append("rect").attr("x",4).attr("y",4).attr("width",e.width).attr("height",e.height).attr("fill","rgba(0,0,0,0.1)").attr("rx",Tf),i.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.surface).attr("stroke",r.border).attr("rx",Tf),i.append("rect").attr("width",e.width).attr("height",36).attr("fill",o?"none":Gt(r.textMuted,r.bg,15)).attr("rx",Tf),i.append("text").attr("x",12).attr("y",24).attr("fill",r.text).attr("font-size",14).attr("font-weight","600").text(a.label||"Modal");let s=e.width-16;i.append("text").attr("x",s).attr("y",24).attr("fill",r.textMuted).attr("font-size",16).text("\xD7");for(let l of e.children){let c=i.append("g").attr("transform","translate(0, 36)");Cf(c,l,n,1)}}var iG,oG,Tf,vtt,dG=st(()=>{"use strict";Xn();on();tn();en();fr();iG=4,oG=6,Tf=8,vtt={destructive:t=>t.destructive,success:t=>t.colors.green,warning:t=>t.colors.yellow,info:t=>t.colors.blue}});var bG={};ye(bG,{collectCardMetadata:()=>Og,computeC4NodeDimensions:()=>jl,layoutC4Components:()=>K1,layoutC4Containers:()=>q1,layoutC4Context:()=>j1,layoutC4Deployment:()=>Z1,rollUpContextRelationships:()=>gG});function Pg(t,e,n,r){let o=0;for(let a of t){let i=e.get(a.source),s=e.get(a.target);if(i==null||s==null)continue;let l=Math.abs(i-s),c=Math.min(n.get(a.source)??1,n.get(a.target)??1);o+=l*c}if(r)for(let a of t){let i=r.get(a.source),s=r.get(a.target);if(!i||!s)continue;let l=e.get(a.source)??0,c=e.get(a.target)??0,d=i.y,u=s.y;if(d===u)continue;let f=Math.min(l,c),p=Math.max(l,c),m=Math.min(d,u),h=Math.max(d,u);for(let[g,E]of r){if(g===a.source||g===a.target)continue;let y=e.get(g)??0,b=E.y,S=E.width/2,x=E.height/2;y+S>f&&y-S<p&&b+x>m&&b-x<h&&(o+=Ztt)}}return o}function Dg(t,e,n){if(e.length<2)return;let r=new Map;for(let s of e)r.set(s.source,(r.get(s.source)??0)+1),r.set(s.target,(r.get(s.target)??0)+1);let o=new Map;for(let s of t.nodes()){let l=ds(t,s);l&&o.set(s,{y:l.y,width:l.width,height:l.height})}let a=new Map;for(let s of t.nodes()){let l=ds(t,s);if(!l)continue;let c=Math.round(l.y);a.has(c)||a.set(c,[]),a.get(c).push(s)}for(let[,s]of a)s.sort((l,c)=>ds(t,l).x-ds(t,c).x);let i=!1;for(let[,s]of a){if(s.length<2)continue;let l=[];if(n&&n.size>0){let c=new Map,d=[];for(let u of s){let f=n.get(u);f?(c.has(f)||c.set(f,[]),c.get(f).push(u)):d.push(u)}for(let u of c.values())u.length>=2&&l.push(u);d.length>=2&&l.push(d)}else l.push(s);for(let c of l){if(c.length<2)continue;let d=c.map(h=>ds(t,h).x).sort((h,g)=>h-g),u=new Map;for(let h of t.nodes()){let g=ds(t,h);g&&u.set(h,g.x)}let f=Pg(e,u,r,o),p=[...c],m=f;if(c.length<=8){let h=Qtt(c);for(let g of h){let E=new Map(u);for(let b=0;b<g.length;b++)E.set(g[b],d[b]);let y=Pg(e,E,r,o);y<m&&(m=y,p=[...g])}}else{let h=[...c],g=!0,E=0;for(;g&&E<10;){g=!1,E++;for(let y=0;y<h.length-1;y++){let b=new Map(u);for(let v=0;v<h.length;v++)b.set(h[v],d[v]);let S=Pg(e,b,r,o);[h[y],h[y+1]]=[h[y+1],h[y]];let x=new Map(u);for(let v=0;v<h.length;v++)x.set(h[v],d[v]);let L=Pg(e,x,r,o);L<S?(g=!0,L<m&&(m=L,p=[...h])):[h[y],h[y+1]]=[h[y+1],h[y]]}}}if(p.some((h,g)=>h!==c[g])){for(let h=0;h<p.length;h++){ds(t,p[h]).x=d[h];let g=s.indexOf(c[h]);g>=0&&(s[g]=p[h])}i=!0}}}if(i)for(let s of e){let l=Vtt(t,s.source,s.target);if(!l)continue;let c=ds(t,s.source),d=ds(t,s.target);if(!c||!d)continue;let u={x:c.x,y:c.y+c.height/2},f={x:d.x,y:d.y-d.height/2},p=(u.y+f.y)/2;l.points=[u,{x:u.x,y:p},{x:f.x,y:p},f]}}function Qtt(t){let e=[],n=[...t],r=n.length,o=new Array(r).fill(0);e.push([...n]);let a=0;for(;a<r;)o[a]<a?(a%2===0?[n[0],n[a]]=[n[a],n[0]]:[n[o[a]],n[a]]=[n[a],n[o[a]]],e.push([...n]),o[a]++,a=0):(o[a]=0,a++);return e}function U1(t){let e=new Map;function n(r,o){e.set(r.name,o);for(let a of r.children)n(a,o);for(let a of r.groups)for(let i of a.children)n(i,o)}for(let r of t)n(r,r.name);return e}function X1(t,e){let n=[];function r(o){for(let a of o.relationships)n.push({sourceName:o.name,rel:a});for(let a of o.children)r(a);for(let a of o.groups)for(let i of a.children)r(i)}for(let o of t)r(o);return n}function gG(t){let e=U1(t.elements),n=X1(t.elements,e),r=new Set(t.elements.map(c=>c.name)),o=new Set,a=[],i=[];for(let{sourceName:c,rel:d}of n){let u=e.get(c)??c,f=e.get(d.target)??d.target;if(u===f)continue;let p={sourceName:u,targetName:f,...d.label!==void 0&&{label:d.label},...d.technology!==void 0&&{technology:d.technology},arrowType:d.arrowType,lineNumber:d.lineNumber};if(r.has(c)&&c===u){let m=`${u}\u2192${f}`;o.add(m),a.push(p)}else i.push(p)}let s=[...a],l=new Set(o);for(let c of i){let d=`${c.sourceName}\u2192${c.targetName}`;l.has(d)||(l.add(d),s.push(c))}return s}function Nd(t,e,n,r){let o=t.metadata.color;if(o)return o;if(!n)return;let a=e.find(c=>c.name.toLowerCase()===n.toLowerCase());if(!a)return;let i=qt(a.name),s=t.metadata[i];if(!s&&r){for(let c of r)if(s=c.metadata[i],s)break}let l=s??a.defaultValue;return l?a.entries.find(c=>c.value.toLowerCase()===l.toLowerCase())?.color??"#999999":"#999999"}function Og(t){let e=[],n=t.tech??t.technology;n&&e.push({key:"Technology",value:n});for(let[r,o]of Object.entries(t)){if(Jtt.has(r.toLowerCase()))continue;let a=r.charAt(0).toUpperCase()+r.slice(1);e.push({key:a,value:o})}return e}function jl(t,e){let n=_t(t.name,jtt)+Ig*2,r=Math.max(Utt,Math.min(uG,n));if(e?.showTechnology){let i=Rg+pG,s=t.description?.join(`
211
+ `)){let n=e.trim();if(!(!n||n.startsWith("//")))return n.split(/\s+/)[0].toLowerCase()}return""}async function sE(t,e,n,r){let o=await Yn(e,n),a=e==="dark",i=r?.width&&r.width>0?Math.round(r.width):ur,s=r?.height&&r.height>0?Math.round(r.height):yr,l=rr(i,s),c=Xa(l,o,{width:i,height:s});if(!c)return document.body.removeChild(l),"";let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:h,colors:g}=c;return W9(d,t,o,a,u,f,p,m,h,g)?zn(l,e,o):(document.body.removeChild(l),"")}function W9(t,e,n,r,o,a,i,s,l,c){let d=H9(e),f=iE.has(d)?null:zs(e,n);if(f&&!f.error&&f.data.length>0&&DR.has(f.type)){let g=!f.noTitle&&!!f.title;switch(g&&co(t,f.title,f.titleLineNumber,o,i),f.type){case"bar":return sR(t,f,o,a,c,n,r,i,s,g),!0;case"line":return dR(t,f,o,a,c,n,r,i,s,l,g),!0;case"pie":return fR(t,f,o,a,n,r,i,g?52:24),!0;case"radar":{let E=dh(f,c),y=hf(t,E,n,r,g,o);return hR(t,f,o,a,c,n,r,i,s,y),!0}case"polar-area":return yR(t,f,o,a,n,r,i,g?52:24),!0}}let p=Vs(e,n);if(p.error||!iE.has(p.type))return!1;let m=ir(n),h=!p.noTitle&&!!p.title;switch(h&&co(t,p.title,p.titleLineNumber,o,i),p.type){case"funnel":return xR(t,p,o,a,m,n,r,i,h?52:24),!0;case"heatmap":return ER(t,p,o,a,n,r,i,l,h?52:24),!0;case"scatter":{let g=fw(p,m),E=hf(t,g,n,r,h,o);return kR(t,p,o,a,m,n,r,i,s,E),!0}case"sankey":return NR(t,p,o,a,m,l,i,h?52:24),!0;case"chord":return TR(t,p,o,a,m,n,r,i,h?52:24),!0;case"function":{let g=fw(p,m),E=hf(t,g,n,r,h,o);return IR(t,p,o,a,m,i,s,E),!0}default:return!1}}var DR,iE,OR,lE=st(()=>{"use strict";lh();lf();lf();tn();Zi();ra();lR();uR();pR();gR();bR();wR();SR();LR();MR();CR();PR();DR=new Set(["bar","line","pie","radar","polar-area"]),iE=new Set(["funnel","heatmap","scatter","sankey","chord","function"]),OR=new Set([...DR,...iE])});function od(t,e){let n=t.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("rx",e.rx).attr("fill",e.fill).attr("stroke",e.stroke).attr("stroke-width",e.strokeWidth);e.dashed&&n.attr("stroke-dasharray","6 3"),t.append("text").attr("x",e.width/2).attr("y",e.headerHeight/2+e.labelFontSize/2-2).attr("text-anchor","middle").attr("fill",e.labelColor).attr("font-size",e.labelFontSize).attr("font-weight","bold").text(e.label);let r=e.meta;if(!r||r.rows.length===0)return;t.append("line").attr("x1",0).attr("y1",e.headerHeight).attr("x2",e.width).attr("y2",e.headerHeight).attr("stroke",r.separatorColor).attr("stroke-opacity",.3).attr("stroke-width",1);let o=r.keyX??10,a=Math.max(...r.rows.map(([l])=>_t(`${l}: `,r.fontSize))),i=o+a,s=e.headerHeight+r.separatorGap+r.fontSize;for(let l=0;l<r.rows.length;l++){let[c,d]=r.rows[l],u=s+l*r.lineHeight;t.append("text").attr("x",o).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(`${c}: `),t.append("text").attr("x",i).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(d)}}function cE(t,e){t.append("clipPath").attr("id",e.clipId).append("rect").attr("width",e.width).attr("height",e.height).attr("rx",e.rx),t.append("rect").attr("x",e.inset).attr("y",e.height-e.barHeight).attr("width",e.width-e.inset*2).attr("height",e.barHeight).attr("fill",e.fill).attr("clip-path",`url(#${e.clipId})`).attr("class",e.className)}var Oh=st(()=>{"use strict";en()});var KR={};ye(KR,{clearEventLineMuted:()=>ej,focusEventLine:()=>qR,renderEventLine:()=>yE,renderEventLineForExport:()=>cj});function yE(t,e,n,r,o,a,i){if(e.events.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let s=a?.width??t.clientWidth,l=a?.height??t.clientHeight;if(s<=0||l<=0)return;let c=!!a,d=c?new Set:bE(t),f=ir(n)[0],p=Hr(e.tagGroups,void 0,i),m=!!e.title&&!e.options.noTitle,h=e.tagGroups.length>0&&p!==null&&!e.options.noLegend,g=m?B9:0,y=g+(h?F9:0),b=new Map(e.eras.map(rt=>[rt.name,rt])),S=new Set(e.eras.filter(rt=>rt.collapsed).map(rt=>rt.name)),x=e.events.some(rt=>rt.era&&b.has(rt.era)),L=e.events.some(rt=>rt.era&&b.has(rt.era)&&!S.has(rt.era)),v=e.options.side,A=v==="alternate",C=A||v==="above"?"below":"above",M=[],w=new Set;for(let rt of e.events){let pt=rt.era;pt&&S.has(pt)?w.has(pt)||(w.add(pt),M.push({kind:"era",era:b.get(pt),members:e.events.filter(ht=>ht.era===pt)})):M.push({kind:"event",event:rt})}let k=Math.max(8,Math.floor((oo-Bl*2)/(Fl*Bo))),N=(rt,pt)=>28+(pt?$R:0)+(rt.length>0?6+rt.length*XR:0)+(rt.length>0?Bl:6),_=rt=>{if(!p)return f;let pt=ar(rt.metadata,e.tagGroups,p);return pt&&pt!==j9?Dn(pt,n)??pt:f},T=0,R=M.map(rt=>{let pt=A?T++%2===0?"above":"below":v;if(rt.kind==="event"){let $t=rt.event,ft=_($t),Wt=ie(n,ft,r,{solid:!1}),he=ve(Wt,n.textOnFillLight,n.textOnFillDark),ne=VR($t.description,k);return{kind:"event",event:$t,era:null,members:[],label:$t.label,date:$t.date,dateValue:$t.dateValue,future:$t.future,futureSpan:$t.futureSpan,lineNumber:$t.lineNumber,eraName:$t.era,color:ft,cardFill:Wt,titleColor:he,lines:ne,bulletColors:[],bulletMeta:[],cardH:N(ne,!!$t.date),x:0,side:pt,lane:0,left:0,spanHalf:0}}let ht=rt.era,dt=rt.members.map(_),ut=p!=null&&dt.length>0&&dt.every($t=>$t===dt[0])&&dt[0]!==f,yt=ht.color?Dn(ht.color,n)??n.text:ut?dt[0]:n.text,kt=Gt(yt,nr(n,r),10),Ot=ve(kt,n.textOnFillLight,n.textOnFillDark),Xt=null,bt=null;for(let $t of rt.members)$t.dateValue!==null&&((Xt===null||$t.dateValue<Xt)&&(Xt=$t.dateValue),(bt===null||$t.dateValue>bt)&&(bt=$t.dateValue));let Nt=Xt!==null&&bt!==null?(Xt+bt)/2:null,Vt=rt.members.filter($t=>!rj($t.metadata,d)),xt=Vt.map($t=>`\u2022 ${$t.date?`${$t.future?"TBD":ts($t.date)} `:""}${$t.label}`),Lt=Vt.map(_),Dt=Vt.map($t=>$t.metadata),zt=VR(xt,k);return{kind:"era",event:null,era:ht,members:rt.members,label:ht.name,date:null,dateValue:Nt,future:!1,futureSpan:null,lineNumber:ht.lineNumber,eraName:ht.name,color:yt,cardFill:kt,titleColor:Ot,lines:zt,bulletColors:Lt,bulletMeta:Dt,cardH:N(zt,!1),x:0,side:pt,lane:0,left:0,spanHalf:0}}),G=e.options.scale&&R.every(rt=>rt.dateValue!==null),I=s-Gh*2,H=16,O=8,D=64,W=16,z=[],P=[],B=()=>{if(!P.length)return;let rt=P.map(pt=>pt.dateValue);z.push({kind:"run",events:P,lo:Math.min(...rt),hi:Math.max(...rt)}),P=[]};for(let rt of R)rt.kind==="era"?(B(),z.push({kind:"capsule",p:rt})):P.push(rt);B();let Y=z.reduce((rt,pt)=>rt+(pt.kind==="run"?pt.hi-pt.lo:0),0),V=rt=>{if(G){let pt=Y>0?I*rt/Y:0,ht={above:-1/0,below:-1/0},dt=Gh;for(let kt of z)if(kt.kind==="capsule"){let Ot=dt+D/2,Xt=Math.max(oo/2+6,ht[kt.p.side]+$h+oo/2);Ot<Xt&&(dt+=Xt-Ot,Ot=Xt),kt.p.x=Ot,kt.p.spanHalf=D/2,ht[kt.p.side]=Ot+oo/2,dt+=D+W}else{for(let Ot of kt.events)Ot.x=dt+(Ot.dateValue-kt.lo)*pt,Ot.spanHalf=0;dt+=(kt.hi-kt.lo)*pt+W}let ut=-1/0,yt=null;for(let kt of[...R].sort((Ot,Xt)=>Ot.x-Xt.x)){if(kt.kind==="era"){ut=kt.x+kt.spanHalf,yt=null;continue}if(kt.dateValue===yt){kt.x=ut;continue}kt.x<ut+H&&(kt.x=ut+H),ut=kt.x,yt=kt.dateValue}}else{R.forEach(dt=>{dt.spanHalf=0});let pt=R.length,ht=pt>1?Math.max(U9,I/(pt-1)):0;R.forEach((dt,ut)=>{dt.x=Gh+ut*ht})}if(G){let pt=oo+$h;for(let ht=0;ht<8;ht++){let dt=!1;for(let ut of["above","below"]){let yt=R.filter(kt=>kt.side===ut).sort((kt,Ot)=>kt.x-Ot.x);for(let kt=1;kt<yt.length;kt++){let Ot=yt[kt];if(Ot.kind!=="event")continue;let Xt=yt[kt-1];if(Xt.kind==="event"&&Ot.dateValue===Xt.dateValue)continue;let bt=Xt.x+pt;if(bt<=Ot.x)continue;let Nt=yt[kt+1],Vt=Nt?.kind==="era"?Nt.x-pt:1/0,xt=Math.min(bt,Vt);xt>Ot.x+.5&&(Ot.x=xt,dt=!0)}}if(!dt)break}}for(let pt of["above","below"]){let ht=R.filter(ut=>ut.side===pt).sort((ut,yt)=>ut.x-yt.x),dt=[];for(let ut=0;ut<ht.length;ut++){let yt=ht[ut],kt=ht[ut+1],Xt=yt.kind!=="era"&&!!kt&&kt.x-yt.x<oo+$h?yt.x-oo+dE:yt.x-oo/2,bt=yt.x-dE,Nt=yt.x-oo+dE,Vt=dt.length,xt=Math.max(Xt,Nt);for(let Lt=0;Lt<dt.length;Lt++){let Dt=Math.max(Xt,dt[Lt]+$h,Nt);if(Dt<=bt){Vt=Lt,xt=Dt;break}}yt.lane=Vt,yt.left=Math.max(6,xt),dt[Vt]=yt.left+oo}}},j=()=>{let rt=Math.max(s,Math.max(...R.map(Dt=>Dt.x+Dt.spanHalf))+Gh,Math.max(...R.map(Dt=>Dt.left+oo))+6),pt={above:[],below:[]};for(let Dt of["above","below"]){let zt=[];for(let Wt of R)Wt.side===Dt&&(zt[Wt.lane]=Math.max(zt[Wt.lane]??0,Wt.cardH));let $t=[],ft=0;for(let Wt=0;Wt<zt.length;Wt++)$t[Wt]=ft,ft+=(zt[Wt]??0)+X9;pt[Dt]=$t}let ht=Dt=>(Dt.side==="above"?Y9:z9)+(pt[Dt.side][Dt.lane]??0),dt=Dt=>Math.max(0,...R.filter(zt=>zt.side===Dt).map(zt=>ht(zt)+zt.cardH)),ut=dt("above"),yt=dt("below"),kt=ut+(L&&C==="above"?HR:0),Ot=yt+(L&&C==="below"?HR:0),Xt=14,bt=14,Nt=y+Xt+kt,Vt=C==="above"?Nt-(ut+14):Nt+(yt+14),xt=Nt+Ot+bt,Lt=c?xt:Math.max(l,xt);return{contentW:rt,contentH:xt,totalH:Lt,spineY:Nt,eraBaseY:Vt,laneNear:ht}},K=Number(globalThis.process?.env?.DGMO_EVT_STRETCH),$;if(Number.isFinite(K)&&K>0)V(K),$=j();else{V(1),$=j();let rt=s/l,pt=ht=>ht.contentW/ht.contentH;if(G&&$.contentH>l&&pt($)<rt){V(O);let ht=j();if(pt(ht)<=rt)$=ht;else{let dt=1,ut=O;for(let yt=0;yt<8;yt++){let kt=(dt+ut)/2;V(kt),pt(j())>=rt?ut=kt:dt=kt}V(ut),$=j()}}}let{contentW:U,totalH:X,spineY:q,eraBaseY:et,laneNear:tt}=$,F=Rt(t).append("svg").attr("width",U).attr("height",X).attr("viewBox",`0 0 ${U} ${X}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c||F.append("style").text(Q9),m){let rt=F.append("text").attr("class","chart-title").attr("x",U/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber){let pt=e.titleLineNumber;rt.style("cursor","pointer").on("click",()=>o(pt))}}if(h){let rt=F.append("g").attr("transform",`translate(0, ${g})`),pt=e.tagGroups.map(ht=>({name:ht.name,entries:ht.entries.map(dt=>({value:dt.value,color:Dn(dt.color,n)??dt.color}))}));fn(rt,{groups:pt,palette:n,isDark:r,width:U,mode:c?"export":"preview",activeGroup:p}),c||nj(rt)}let Q=Math.min(...R.map(rt=>rt.x-rt.spanHalf)),ot=Math.max(...R.map(rt=>rt.x+rt.spanHalf)),Z=Q-20,lt=ot+20,nt=G&&R.some(rt=>rt.future&&!rt.futureSpan),J=R.length?Math.max(Z,...R.filter(rt=>!rt.future).map(rt=>rt.x+rt.spanHalf)):lt,at=nt?J:lt;F.append("line").attr("x1",Z).attr("y1",q).attr("x2",at).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round"),nt&&F.append("line").attr("x1",at).attr("y1",q).attr("x2",lt).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round").attr("stroke-opacity",.45).attr("stroke-dasharray","2 6");let it=R.map(rt=>{let pt=rt.side==="above"?q-tt(rt):q+tt(rt),ht=rt.side==="above"?pt-rt.cardH:pt;return{p:rt,near:pt,top:ht}}),vt=(rt,pt)=>{let ht=Math.min(q,pt),dt=Math.max(q,pt);return it.some(ut=>ut.p!==rt&&rt.x>ut.p.left&&rt.x<ut.p.left+oo&&dt>ut.top&&ht<ut.top+ut.p.cardH)},Tt=rt=>q+Z9*(rt.side==="above"?-1:1);for(let{p:rt,near:pt}of it){let ht=rt.kind==="era"?Tt(rt):q,dt=F.append("line").attr("class","dgmo-event-leader").attr("x1",rt.x).attr("y1",ht).attr("x2",rt.x).attr("y2",pt).attr("stroke",rt.color).attr("stroke-width",1.5).attr("stroke-opacity",vt(rt,pt)?.18:rt.future?.4:.65);fE(dt,rt)}let At=0;for(let{p:rt,top:pt}of it){let ht=rt.left,dt=F.append("g").attr("class","dgmo-event-card").attr("transform",`translate(${ht}, ${pt})`).attr("data-line-number",rt.lineNumber);if(fE(dt,rt),rt.kind==="era"&&dt.attr("data-era",rt.era.name).attr("data-era-collapsed","true"),o){let kt=rt.lineNumber;dt.style("cursor","pointer").on("click",()=>o(kt)),dt.append("rect").attr("x",0).attr("y",0).attr("width",oo).attr("height",rt.cardH).attr("fill","transparent").attr("pointer-events","all")}let ut=rt.kind==="event"&&rt.date?rt.future?"TBD":ts(rt.date):null,yt=ut?$R:0;if(e.options.noBox){let kt=rt.side==="below",Ot=kt?0:rt.cardH-28,Xt=kt?0:rt.cardH-28-yt,bt=28+yt,Nt=`dgmo-evt-shelf-${At++}`;dt.append("clipPath").attr("id",Nt).append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("rx",uE),dt.append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("clip-path",`url(#${Nt})`).attr("fill",Gt(rt.color,nr(n,r),q9));let Vt=kt?Xt:Xt+bt-uE;if(dt.append("rect").attr("x",0).attr("y",Vt).attr("width",oo).attr("height",uE).attr("clip-path",`url(#${Nt})`).attr("fill",rt.color).attr("fill-opacity",rt.future?.4:1),dt.append("text").attr("x",Bl).attr("y",Ot+28/2+13/2-2).attr("fill",rt.color).attr("font-family",It).attr("font-size",13).attr("font-weight",700).text(rt.label),ut&&dt.append("text").attr("x",Bl).attr("y",(kt?28:Ot-yt)+Hh+2).attr("fill",Gt(n.text,n.bg,55)).attr("font-family",It).attr("font-size",Hh).attr("font-weight",600).text(ut),rt.lines.length>0){let xt=kt?pE+yt+Fl:Bl+Fl;UR(dt,rt.lines,n.text,n,xt,rt.bulletColors,rt.bulletMeta)}}else od(dt,{width:oo,height:rt.cardH,rx:6,fill:rt.cardFill,stroke:rt.color,strokeWidth:1.5,label:rt.label,labelColor:rt.titleColor,labelFontSize:13,headerHeight:28}),ut&&dt.append("text").attr("x",oo/2).attr("y",28+Hh+1).attr("text-anchor","middle").attr("fill",Gt(rt.titleColor,rt.cardFill,60)).attr("font-family",It).attr("font-size",Hh).attr("font-weight",600).text(ut),rt.lines.length>0&&(dt.append("line").attr("x1",0).attr("y1",28+yt).attr("x2",oo).attr("y2",28+yt).attr("stroke",rt.titleColor).attr("stroke-opacity",.3).attr("stroke-width",1),UR(dt,rt.lines,rt.titleColor,n,pE+yt+Fl,rt.bulletColors,rt.bulletMeta))}for(let rt of R){if(rt.kind==="era"){let ht=rt.color,dt=Math.max(16,rt.spanHalf),ut=Q-20,yt=ot+20,kt=Math.max(ut,rt.x-dt),Ot=Math.min(yt,rt.x+dt),Xt=Tt(rt),bt=F.append("g").attr("class","dgmo-event-era").attr("data-era",rt.era.name).attr("data-era-collapsed","true").attr("data-line-number",rt.lineNumber);if(o){let Vt=Math.min(Xt,q)-4,xt=Math.max(Xt,q)+8;bt.append("rect").attr("x",kt).attr("y",Vt).attr("width",Ot-kt).attr("height",xt-Vt).attr("fill","transparent").attr("pointer-events","all")}bt.append("path").attr("d",`M${kt},${q} L${kt},${Xt} L${Ot},${Xt} L${Ot},${q}`).attr("fill","none").attr("stroke",ht).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round");let Nt=(kt+Ot)/2;bt.append("line").attr("x1",Nt-Fh/2).attr("y1",q).attr("x2",Nt+Fh/2).attr("y2",q).attr("stroke",n.bg).attr("stroke-width",5).attr("stroke-linecap","butt");for(let Vt of dj(Nt,q))bt.append("path").attr("d",Vt).attr("fill","none").attr("stroke",n.text).attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round");if(o){let Vt=rt.lineNumber;bt.style("cursor","pointer").on("click",()=>o(Vt))}continue}let pt=F.append("circle").attr("class","dgmo-event-dot").attr("cx",rt.x).attr("cy",q).attr("r",V9).attr("fill",rt.future?n.bg:rt.color).attr("stroke",rt.future?rt.color:n.bg).attr("stroke-width",2).attr("data-line-number",rt.lineNumber);fE(pt,rt)}if(x){let rt=[],pt=null;for(let yt of R){let kt=yt.eraName;if(kt&&b.has(kt)){if(pt===kt&&rt.length>0){let Ot=rt[rt.length-1];Ot.firstX=Math.min(Ot.firstX,yt.x),Ot.lastX=Math.max(Ot.lastX,yt.x)}else rt.push({era:b.get(kt),collapsed:yt.kind==="era",firstX:yt.x,lastX:yt.x});pt=kt}else pt=null}let ht=yt=>Math.max(4,Math.min(U-4,yt)),dt=C==="above"?1:-1,ut=rt.filter(yt=>!yt.collapsed).map(yt=>({run:yt,x0:ht(yt.firstX-BR),x1:ht(yt.lastX+BR)})).sort((yt,kt)=>yt.run.firstX-kt.run.firstX);for(let yt=1;yt<ut.length;yt++){let kt=ut[yt-1],Ot=ut[yt];if(kt.x1<=Ot.x0)continue;let Xt=(kt.run.lastX+Ot.run.firstX)/2;kt.x1=Math.max(kt.run.lastX,Math.min(kt.x1,Xt-FR)),Ot.x0=Math.min(Ot.run.firstX,Math.max(Ot.x0,Xt+FR))}for(let{run:yt,x0:kt,x1:Ot}of ut){let Xt=!yt.era.color,bt=Xt?n.text:Dn(yt.era.color,n)??n.text,Nt=Xt?.5:.85,Vt=et,xt=F.append("g").attr("class","dgmo-event-era").attr("data-era",yt.era.name).attr("data-era-collapsed",String(yt.collapsed)).attr("data-line-number",yt.era.lineNumber);if(xt.append("path").attr("d",`M${kt},${Vt+WR*dt} L${kt},${Vt} L${Ot},${Vt} L${Ot},${Vt+WR*dt}`).attr("fill","none").attr("stroke",bt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",Nt),xt.append("text").attr("x",(yt.firstX+yt.lastX)/2).attr("y",C==="above"?Vt-6:Vt+zR+4).attr("text-anchor","middle").attr("font-family",It).attr("font-size",zR).attr("font-weight",700).attr("fill",bt).attr("fill-opacity",Xt?.85:1).text(yt.era.name),o){let Lt=yt.era.lineNumber;xt.style("cursor","pointer").on("click",()=>o(Lt))}}}if(!c){let rt=F.node();lj(rt),rt&&(sj(t,rt,()=>yE(t,e,n,r,o,a,i)),oj(t,rt))}}function fE(t,e){if(t.attr("data-evt",e.lineNumber),e.eraName&&t.attr("data-evt-era",e.eraName),e.event)for(let[n,r]of Object.entries(e.event.metadata))t.attr(`data-tag-${n.toLowerCase()}`,String(r).toLowerCase())}function tj(t){t.querySelectorAll(`.${Qs},.${Yl},.${Yh}`).forEach(e=>e.classList.remove(Qs,Yl,Yh))}function ad(t,e){if(tj(t),!e)return;let n=[...t.querySelectorAll(J9)];if(e.kind==="event"){let l=c=>c.getAttribute("data-evt")===e.id;if(!n.some(l))return;n.forEach(c=>c.classList.add(l(c)?Qs:Yl));return}if(e.kind==="era"){let l=c=>c.getAttribute("data-evt-era")===e.name||c.classList.contains("dgmo-event-era")&&c.getAttribute("data-era")===e.name;if(!n.some(l))return;n.forEach(c=>{l(c)?c.classList.contains("dgmo-event-era")&&c.classList.add(Yh):c.classList.add(Yl)});return}let r=`data-tag-${e.group}`,o=l=>l.getAttribute(r)===e.value,a=[...t.querySelectorAll(".dgmo-evt-bullet")],i=new Set;for(let l of a){if(!o(l))continue;let c=l.closest(".dgmo-event-card"),d=c?.getAttribute("data-era")??c?.getAttribute("data-evt-era");d&&i.add(d)}if(!n.some(o)&&i.size===0)return;let s=l=>{let c=l.getAttribute("data-era")??l.getAttribute("data-evt-era");return!!c&&i.has(c)};n.forEach(l=>{!o(l)&&!s(l)&&l.classList.add(Yl)});for(let l of a)o(l)||l.classList.add(Yl)}function Bh(t){let e=t.getAttribute(mE);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ej(t){t.removeAttribute(gE)}function qR(t,e){let n=t.querySelector("svg");n&&(e?n.setAttribute(mE,JSON.stringify(e)):n.removeAttribute(mE),ad(n,e))}function bE(t){let e=t.getAttribute(gE);if(!e)return new Set;try{return new Set(JSON.parse(e))}catch{return new Set}}function nj(t){t.selectAll("[data-legend-entry]").each(function(){let r;try{r=this.getBBox()}catch{return}!r.width||!r.height||Rt(this).insert("rect",":first-child").attr("x",r.x-6).attr("y",r.y-7).attr("width",r.width+12).attr("height",r.height+14).attr("fill","transparent").attr("data-legend-hit","")})}function rj(t,e){if(e.size===0)return!1;for(let[n,r]of Object.entries(t))if(e.has(`${n.toLowerCase()}:${String(r).toLowerCase()}`))return!0;return!1}function oj(t,e){let n=bE(t),r=o=>{for(let a of n){let i=a.indexOf(":");if(i<0)continue;let s=a.slice(0,i),l=a.slice(i+1);if(o.getAttribute(`data-tag-${s}`)===l)return!0}return!1};e.querySelectorAll(".dgmo-event-card,.dgmo-event-leader").forEach(o=>o.classList.toggle(gf,r(o))),e.querySelectorAll("[data-legend-entry]").forEach(o=>{let a=o.closest("[data-legend-group]")?.getAttribute("data-legend-group"),i=o.getAttribute("data-legend-entry");aj(o,!!a&&n.has(`${a}:${i}`))})}function aj(t,e){t.classList.toggle(jR,e);let n=t.querySelector("circle");if(n)if(e)n.hasAttribute("data-fill0")||n.setAttribute("data-fill0",n.getAttribute("fill")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",n.getAttribute("data-fill0")||"currentColor"),n.setAttribute("stroke-width","1.5");else{let r=n.getAttribute("data-fill0");r!==null&&n.setAttribute("fill",r),n.removeAttribute("stroke"),n.removeAttribute("stroke-width")}}function ij(t,e,n){let r=bE(t),o=`${e}:${n}`;r.has(o)?r.delete(o):r.add(o),t.setAttribute(gE,JSON.stringify([...r]))}function sj(t,e,n){e.addEventListener("click",r=>{let o=r.target;if(!o||typeof o.closest!="function")return;let a=o.closest("[data-legend-entry]");if(!a)return;let i=a.getAttribute("data-legend-entry"),s=a.closest("[data-legend-group]")?.getAttribute("data-legend-group");if(!s||!i)return;ij(t,s,i);let l=Bh(e);n(),l&&qR(t,l),typeof CustomEvent<"u"&&t.dispatchEvent(new CustomEvent("dgmo-event-line-rerender"))})}function lj(t){t&&(t.addEventListener("mouseover",e=>{let n=e.target;if(!n||typeof n.closest!="function")return;let r=n.closest("[data-legend-entry]");if(r){let i=r.getAttribute("data-legend-entry"),s=r.closest("[data-legend-group]")?.getAttribute("data-legend-group");ad(t,s&&i?{kind:"tag",group:s,value:i}:Bh(t));return}let o=n.closest(".dgmo-event-era");if(o){ad(t,{kind:"era",name:o.getAttribute("data-era")??""});return}let a=n.closest("[data-evt]");if(a){let i=a.getAttribute("data-era");ad(t,i?{kind:"era",name:i}:{kind:"event",id:a.getAttribute("data-evt")??""});return}ad(t,Bh(t))}),t.addEventListener("mouseout",e=>{let n=e.relatedTarget;(!n||!t.contains(n))&&ad(t,Bh(t))}))}function cj(t,e,n,r,o,a){yE(t,e,n,r,void 0,o,a)}function dj(t,e){let o=a=>{let i="";for(let s=0;s<=48;s++){let l=s/48,c=e-YR+l*2*YR,d=a+K9*Math.sin(l*Math.PI*2);i+=`${s===0?"M":"L"}${d.toFixed(2)},${c.toFixed(2)}`,s<48&&(i+=" ")}return i};return[o(t-Fh/2),o(t+Fh/2)]}function VR(t,e){let n=[];for(let r of t){if(r===""){n.push({text:"",kind:"plain"});continue}n.push(...Ko([r],e))}return n}function UR(t,e,n,r,o=pE+Fl,a=[],i=[]){let s=o,l=0,c=n,d=null,u=f=>{if(d){f.attr("class","dgmo-evt-bullet");for(let[p,m]of Object.entries(d))f.attr(`data-tag-${p.toLowerCase()}`,String(m).toLowerCase())}};for(let f of e){let p=f.kind==="bullet-first"||f.kind==="bullet-cont",m=Bl+(p?12:0);if(f.kind==="bullet-first"){c=a[l]??n,d=i[l]??null,l++;let g=t.append("text").attr("x",Bl).attr("y",s).attr("text-anchor","start").attr("fill",c).attr("font-family",It).attr("font-size",Fl).attr("font-weight",700).text("\u2022");u(g)}else p||(c=n,d=null);let h=t.append("text").attr("x",m).attr("y",s).attr("text-anchor","start").attr("fill",p?c:n).attr("font-family",It).attr("font-size",Fl);p&&u(h),gn(h,f.text,r),s+=XR}}var oo,Gh,B9,F9,Y9,z9,Fl,XR,Bl,pE,V9,U9,X9,j9,dE,$h,$R,Hh,q9,uE,HR,WR,BR,FR,YR,K9,Fh,Z9,zR,Qs,Yl,Yh,gf,jR,gE,Q9,J9,mE,ZR=st(()=>{"use strict";Xn();on();tn();xr();Oh();_o();en();Hs();Br();w0();Ke();oo=210,Gh=58,B9=48,F9=34,Y9=46,z9=46,Fl=11.5,XR=16,Bl=9,pE=34,V9=5.5,U9=96,X9=16,j9="#999999",dE=18,$h=6,$R=15,Hh=10,q9=13,uE=4,HR=30,WR=8,BR=14,FR=3,YR=6,K9=2.6,Fh=5,Z9=13,zR=11.5,Qs="dgmo-evt-hl",Yl="dgmo-evt-dim",Yh="dgmo-evt-era-hl",gf="dgmo-evt-collapsed",jR="dgmo-evt-off",gE="data-evt-hidden",Q9=`.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${Yl}{opacity:.2}.dgmo-event-dot.${Qs}{transform:scale(1.55)}.dgmo-event-leader.${Qs}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${Qs}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${Yh}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${gf},.dgmo-event-leader.${gf}{opacity:0;pointer-events:none}.dgmo-event-card.${gf}.${Qs},.dgmo-event-leader.${gf}.${Qs}{opacity:1;pointer-events:auto}[data-legend-entry].${jR} text{opacity:.5}`;J9=".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era",mE="data-evt-pin"});var eI={};ye(eI,{renderVersionControl:()=>tI,renderVersionControlForExport:()=>hj});function fj(t,e){return t.length>e?t.slice(0,e-1)+"\u2026":t}function EE(t,e,n,r,o,a,i){let s=Math.hypot(n-t,r-e),l=Math.hypot(o-n,a-r),c=Math.max(2,Math.min(i,s-1,l-1)),d=(n-t)/(s||1),u=(r-e)/(s||1),f=(o-n)/(l||1),p=(a-r)/(l||1);return`M${t},${e} L${n-d*c},${r-u*c} Q${n},${r} ${n+f*c},${r+p*c} L${o},${a}`}function tI(t,e,n,r,o,a){if(e.nodes.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.nodes,s=e.options.direction!=="LR",l=new Map(e.branches.map(D=>[D.name,D])),c=ir(n),d=D=>D.colorToken?Dn(D.colorToken,n)??c[D.lane%c.length]:c[D.lane%c.length],u=D=>d(l.get(D.branch)),f=D=>i[D],p=D=>D.kind==="cherry"?"\u21E0 ":D.kind==="merge"?"\u21F2 ":"",m=new Map;for(let D of i){let W=D.id,z=p(D)+fj(D.message||"(empty)",26),P=(W?W.length*6.6+8:0)+z.length*6.9+8;m.set(D.key,{sha:W,msg:z,lw:P})}let h=Math.max(0,...[...m.values()].map(D=>D.lw)),g=new Map,E=(D,W)=>{g.has(D)||g.set(D,[]),g.get(D).push(W)};if(!e.options.noLabels)for(let D of i)D.tag&&E(D.key,{kind:"tag",label:D.tag,w:D.tag.length*6.6+16});for(let D of e.refs)D.atKey!=null&&(D.head?E(D.atKey,{kind:"head",label:"HEAD",w:46}):E(D.atKey,{kind:"ref",label:D.name,remote:D.remote,w:D.name.length*6.2+18}));for(let D of e.notes)D.anchorKey!=null&&E(D.anchorKey,{kind:"note",label:JR[D.num-1]??`#${D.num}`,w:19});let y=Math.max(0,...[...g.values()].map(D=>D.length)),b=e.branches.length,S=i.length,x=new Map,L=[],v,A,C,M,w=0,k=Math.cos(SE*Math.PI/180),N=Math.sin(SE*Math.PI/180);if(s){C=24;let D=C+32,W=52,z=96;M=78;for(let B of i)x.set(B.key,{x:M+B.lane*z,y:D+B.seq*W});let P=M+(b-1)*z+28;for(let B of i){let Y=x.get(B.key);L.push({node:B,kind:"msg",diag:!1,x:P,y:Y.y,anchor:"start",leader:{x1:Y.x+Zo+2,y1:Y.y,x2:P-6,y2:Y.y}}),(g.get(B.key)??[]).forEach((j,K)=>L.push({node:B,kind:j.kind,label:j.label,remote:j.remote,w:j.w,x:Y.x-Zo-12-j.w/2-K*4,y:Y.y,anchor:"middle"}))}v=P+h+16,A=D+(S-1)*W+22}else{C=Math.max(4,...e.branches.map(V=>V.name.length))*7.5+18;let W=C+34,z=86,P=54;M=16+y*QR+14;for(let V of i)x.set(V.key,{x:W+V.seq*z,y:M+V.lane*P});let Y=M+(b-1)*P+26;for(let V of i){let j=x.get(V.key);L.push({node:V,kind:"msg",diag:!0,x:j.x,y:Y,anchor:"start",leader:{x1:j.x,y1:j.y+Zo,x2:j.x,y2:Y-3}}),(g.get(V.key)??[]).forEach(($,U)=>L.push({node:V,kind:$.kind,label:$.label,remote:$.remote,w:$.w,x:j.x,y:j.y-Zo-12-U*QR,anchor:"middle"}))}for(let V of e.branches){if(!V.ab||V.ab.ahead+V.ab.behind===0||V.tip==null)continue;let j=x.get(V.tip);L.push({node:f(V.tip),kind:"ab",label:pj(V.ab),x:j.x+Zo+10,y:j.y,anchor:"start"})}v=Math.max(W+(S-1)*z+Zo+70,...[...x.entries()].map(([V,j])=>j.x+m.get(V).lw*k))+18,A=Y+h*N+12*k+16,e.notes.length&&(w=A+4,A+=8+e.notes.length*16+8)}let _=!!e.title,T=_?uj:0,R=Math.round(v),G=Math.round(A+T),I=!!a,H=Rt(t).append("svg").attr("width",R).attr("height",G).attr("viewBox",`0 0 ${R} ${G}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(H.append("rect").attr("width",R).attr("height",G).attr("fill",n.bg),_){let D=H.append("text").attr("class","chart-title").attr("x",R/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber&&!I){let W=e.titleLineNumber;D.style("cursor","pointer").on("click",()=>o(W))}}let O=H.append("g").attr("transform",`translate(0, ${T})`);mj(O,e,n,s,x,L,m,u,f,C,M,w,o&&!I?o:void 0)}function pj(t){let e=[];return t.ahead&&e.push("\u2191"+t.ahead),t.behind&&e.push("\u2193"+t.behind),e.join(" ")}function mj(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=e.nodes,m=S=>o.get(S),h=(S,x)=>r?{x:m(x.key).x,y:m(S.key).y}:{x:m(S.key).x,y:m(x.key).y},g=(S,x)=>r?{x:m(S.key).x,y:m(x.key).y}:{x:m(x.key).x,y:m(S.key).y},E=S=>S.ghost?.32:1,y=(S,x,L,v)=>{let A=m(S.key),C=m(x.key),M=g(S,x);if(t.append("path").attr("d",EE(A.x,A.y,M.x,M.y,C.x,C.y,wE)).attr("fill","none").attr("stroke",L).attr("stroke-width",2).attr("stroke-dasharray","2 4").attr("opacity",.8),v){let w=C.x-M.x,k=C.y-M.y,N=Math.hypot(w,k)||1,_=w/N,T=k/N,R=-T,G=_,I=4;t.append("path").attr("d",`M${C.x},${C.y} L${C.x-_*I*2+R*I},${C.y-T*I*2+G*I} L${C.x-_*I*2-R*I},${C.y-T*I*2-G*I} Z`).attr("fill",L).attr("opacity",.8)}};for(let S of p){let x=s(S),L=E(S),v=m(S.key);if(S.prev!=null){let A=m(S.prev),C=t.append("line").attr("x1",A.x).attr("y1",A.y).attr("x2",v.x).attr("y2",v.y).attr("stroke",x).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",L);S.ghost&&C.attr("stroke-dasharray","5 5")}if(S.parent!=null){let A=l(S.parent),C=h(A,S),M=m(A.key),w=t.append("path").attr("d",EE(M.x,M.y,C.x,C.y,v.x,v.y,wE)).attr("fill","none").attr("stroke",x).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",L);S.ghost&&w.attr("stroke-dasharray","5 5")}if(S.mergeFrom!=null){let A=l(S.mergeFrom),C=g(A,S),M=m(A.key);t.append("path").attr("d",EE(M.x,M.y,C.x,C.y,v.x,v.y,wE)).attr("fill","none").attr("stroke",s(A)).attr("stroke-width",xE).attr("stroke-linecap","round").attr("opacity",.92*L)}S.cherryFrom!=null&&y(l(S.cherryFrom),S,s(l(S.cherryFrom)),!1),S.revertFrom!=null&&y(l(S.revertFrom),S,x,!1),S.squashFrom!=null&&y(l(S.squashFrom),S,n.textMuted,!0),S.movedTo!=null&&y(S,l(S.movedTo),n.textMuted,!0)}if(!e.options.noLanes)for(let S of e.branches){let x=null;for(let A of p)A.branch===S.name&&(x===null||A.seq<x.seq)&&(x=A);if(!x)continue;let L=m(x.key),v=s(x);r?t.append("text").attr("x",L.x).attr("y",14).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",800).attr("fill",v).text(S.name):t.append("text").attr("x",c).attr("y",L.y+4).attr("text-anchor","end").attr("font-size",12.5).attr("font-weight",800).attr("fill",v).text(S.name)}for(let S of p){let x=s(S),L=m(S.key),v=A=>{A.attr("data-line-number",S.lineNumber),A.attr("data-branch",S.branch),f&&A.style("cursor","pointer").on("click",()=>f(S.lineNumber))};if(S.ghost){v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo-1).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",2).attr("opacity",.4));continue}S.type==="highlight"?v(t.append("rect").attr("x",L.x-Zo).attr("y",L.y-Zo).attr("width",Zo*2).attr("height",Zo*2).attr("rx",3.5).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3)):S.type==="reverse"?(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),v(t.append("path").attr("d",`M${L.x-3.6},${L.y-3.6} L${L.x+3.6},${L.y+3.6} M${L.x+3.6},${L.y-3.6} L${L.x-3.6},${L.y+3.6}`).attr("stroke",x).attr("stroke-width",2).attr("stroke-linecap","round").attr("fill","none"))):S.kind==="merge"?(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",3).attr("fill",x))):v(t.append("circle").attr("cx",L.x).attr("cy",L.y).attr("r",Zo).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3))}let b=(S,x,L,v,A,C,M,w,k=700)=>{let N=t.append("rect").attr("x",S-L/2).attr("y",x-8.5).attr("width",L).attr("height",17).attr("rx",8.5).attr("fill",A);M&&(N.attr("stroke",M).attr("stroke-width",1.3),w&&N.attr("stroke-dasharray","3 2")),t.append("text").attr("x",S).attr("y",x+4).attr("text-anchor","middle").attr("font-size",10.5).attr("font-weight",k).attr("fill",C).text(v)};for(let S of a){let x=S.node,L=s(x);if(S.leader&&t.append("line").attr("x1",S.leader.x1).attr("y1",S.leader.y1).attr("x2",S.leader.x2).attr("y2",S.leader.y2).attr("stroke",L).attr("stroke-width",1).attr("opacity",.34*E(x)),S.kind==="tag")b(S.x,S.y,S.w,S.label,L,n.bg);else if(S.kind==="head")b(S.x,S.y,S.w,"HEAD",n.text,n.bg,void 0,!1,800);else if(S.kind==="ref")b(S.x,S.y,S.w,S.label,n.bg,L,L,S.remote);else if(S.kind==="note")t.append("circle").attr("cx",S.x).attr("cy",S.y).attr("r",8.5).attr("fill",L),t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor","middle").attr("font-size",11).attr("fill",n.bg).text(S.label);else if(S.kind==="ab")t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor","start").attr("font-size",11).attr("font-weight",700).attr("fill",L).text(S.label);else{let v=i.get(x.key),A=x.ghost,C=A?n.textMuted:L,M=S.diag?t.append("text").attr("transform",`translate(${S.x},${S.y}) rotate(${SE})`).attr("font-size",12).attr("opacity",A?.55:1):t.append("text").attr("x",S.x).attr("y",S.y+4).attr("text-anchor",S.anchor).attr("font-size",12).attr("opacity",A?.55:1);v.sha&&M.append("tspan").attr("font-family","ui-monospace, monospace").attr("font-size",11).attr("fill",n.textMuted).text(v.sha+" "),M.append("tspan").attr("fill",C).attr("font-weight",x.kind==="cherry"?400:700).attr("font-style",x.kind==="cherry"?"italic":"normal").text(v.msg)}}if(u&&e.notes.length){let S=u+14;for(let x of e.notes){let L=t.append("text").attr("x",12).attr("y",S).attr("font-size",11.5);L.append("tspan").attr("fill",n.text).attr("font-weight",800).text((JR[x.num-1]??`#${x.num}`)+" "),L.append("tspan").attr("fill",n.textMuted).text(x.text),S+=16}}}function hj(t,e,n,r,o){tI(t,e,n,r,void 0,o)}var xE,Zo,wE,SE,QR,JR,uj,nI=st(()=>{"use strict";Xn();on();tn();xr();xE=5.5,Zo=8,wE=13,SE=32,QR=19,JR="\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468",uj=40});function gj(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function rI(){return this.eachAfter(gj)}var oI=st(()=>{"use strict"});function aI(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}var iI=st(()=>{"use strict"});function sI(t,e){for(var n=this,r=[n],o,a,i=-1;n=r.pop();)if(t.call(e,n,++i,this),o=n.children)for(a=o.length-1;a>=0;--a)r.push(o[a]);return this}var lI=st(()=>{"use strict"});function cI(t,e){for(var n=this,r=[n],o=[],a,i,s,l=-1;n=r.pop();)if(o.push(n),a=n.children)for(i=0,s=a.length;i<s;++i)r.push(a[i]);for(;n=o.pop();)t.call(e,n,++l,this);return this}var dI=st(()=>{"use strict"});function uI(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}var fI=st(()=>{"use strict"});function pI(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}var mI=st(()=>{"use strict"});function hI(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}var gI=st(()=>{"use strict"});function yI(t){for(var e=this,n=yj(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function yj(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}var bI=st(()=>{"use strict"});function xI(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}var wI=st(()=>{"use strict"});function EI(){return Array.from(this)}var SI=st(()=>{"use strict"});function vI(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}var kI=st(()=>{"use strict"});function LI(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}var NI=st(()=>{"use strict"});function*MI(){var t=this,e,n=[t],r,o,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,a=r.length;o<a;++o)n.push(r[o]);while(n.length)}var TI=st(()=>{"use strict"});function Ri(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=wj)):e===void 0&&(e=xj);for(var n=new zl(t),r,o=[n],a,i,s,l;r=o.pop();)if((i=e(r.data))&&(l=(i=Array.from(i)).length))for(r.children=i,s=l-1;s>=0;--s)o.push(a=i[s]=new zl(i[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Sj)}function bj(){return Ri(this).eachBefore(Ej)}function xj(t){return t.children}function wj(t){return Array.isArray(t)?t[1]:null}function Ej(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Sj(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function zl(t){this.data=t,this.depth=this.height=0,this.parent=null}var vE=st(()=>{"use strict";oI();iI();lI();dI();fI();mI();gI();bI();wI();SI();kI();NI();TI();zl.prototype=Ri.prototype={constructor:zl,count:rI,each:aI,eachAfter:cI,eachBefore:sI,find:uI,sum:pI,sort:hI,path:yI,ancestors:xI,descendants:EI,leaves:vI,links:LI,copy:bj,[Symbol.iterator]:MI}});function CI(t){if(typeof t!="function")throw new Error;return t}var _I=st(()=>{"use strict"});function id(){return 0}function sd(t){return function(){return t}}var AI=st(()=>{"use strict"});function zh(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}var kE=st(()=>{"use strict"});function Vh(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)i=a[s],i.y0=n,i.y1=o,i.x0=e,i.x1=e+=i.value*c}var LE=st(()=>{"use strict"});function NE(){var t=1,e=1,n=0,r=!1;function o(i){var s=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/s,i.eachBefore(a(e,s)),r&&i.eachBefore(zh),i}function a(i,s){return function(l){l.children&&Vh(l,l.x0,i*(l.depth+1)/s,l.x1,i*(l.depth+2)/s);var c=l.x0,d=l.y0,u=l.x1-n,f=l.y1-n;u<c&&(c=u=(c+u)/2),f<d&&(d=f=(d+f)/2),l.x0=c,l.y0=d,l.x1=u,l.y1=f}}return o.round=function(i){return arguments.length?(r=!!i,o):r},o.size=function(i){return arguments.length?(t=+i[0],e=+i[1],o):[t,e]},o.padding=function(i){return arguments.length?(n=+i,o):n},o}var RI=st(()=>{"use strict";kE();LE()});function vj(t,e){return t.parent===e.parent?1:2}function ME(t){var e=t.children;return e?e[0]:t.t}function TE(t){var e=t.children;return e?e[e.length-1]:t.t}function kj(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Lj(t){for(var e=0,n=0,r=t.children,o=r.length,a;--o>=0;)a=r[o],a.z+=e,a.m+=e,e+=a.s+(n+=a.c)}function Nj(t,e,n){return t.a.parent===e.parent?t.a:n}function Uh(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Mj(t){for(var e=new Uh(t,0),n,r=[e],o,a,i,s;n=r.pop();)if(a=n._.children)for(n.children=new Array(s=a.length),i=s-1;i>=0;--i)r.push(o=n.children[i]=new Uh(a[i],i)),o.parent=n;return(e.parent=new Uh(null,0)).children=[e],e}function CE(){var t=vj,e=1,n=1,r=null;function o(c){var d=Mj(c);if(d.eachAfter(a),d.parent.m=-d.z,d.eachBefore(i),r)c.eachBefore(l);else{var u=c,f=c,p=c;c.eachBefore(function(y){y.x<u.x&&(u=y),y.x>f.x&&(f=y),y.depth>p.depth&&(p=y)});var m=u===f?1:t(u,f)/2,h=m-u.x,g=e/(f.x+m+h),E=n/(p.depth||1);c.eachBefore(function(y){y.x=(y.x+h)*g,y.y=y.depth*E})}return c}function a(c){var d=c.children,u=c.parent.children,f=c.i?u[c.i-1]:null;if(d){Lj(c);var p=(d[0].z+d[d.length-1].z)/2;f?(c.z=f.z+t(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+t(c._,f._));c.parent.A=s(c,f,c.parent.A||u[0])}function i(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function s(c,d,u){if(d){for(var f=c,p=c,m=d,h=f.parent.children[0],g=f.m,E=p.m,y=m.m,b=h.m,S;m=TE(m),f=ME(f),m&&f;)h=ME(h),p=TE(p),p.a=c,S=m.z+y-f.z-g+t(m._,f._),S>0&&(kj(Nj(m,c,u),c,S),g+=S,E+=S),y+=m.m,g+=f.m,b+=h.m,E+=p.m;m&&!TE(p)&&(p.t=m,p.m+=y-E),f&&!ME(h)&&(h.t=f,h.m+=g-b,u=c)}return u}function l(c){c.x*=e,c.y=c.depth*n}return o.separation=function(c){return arguments.length?(t=c,o):t},o.size=function(c){return arguments.length?(r=!1,e=+c[0],n=+c[1],o):r?null:[e,n]},o.nodeSize=function(c){return arguments.length?(r=!0,e=+c[0],n=+c[1],o):r?[e,n]:null},o}var II=st(()=>{"use strict";vE();Uh.prototype=Object.create(zl.prototype)});function PI(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(o-n)/t.value;++s<l;)i=a[s],i.x0=e,i.x1=r,i.y0=n,i.y1=n+=i.value*c}var DI=st(()=>{"use strict"});function Cj(t,e,n,r,o,a){for(var i=[],s=e.children,l,c,d=0,u=0,f=s.length,p,m,h=e.value,g,E,y,b,S,x,L;d<f;){p=o-n,m=a-r;do g=s[u++].value;while(!g&&u<f);for(E=y=g,x=Math.max(m/p,p/m)/(h*t),L=g*g*x,S=Math.max(y/L,L/E);u<f;++u){if(g+=c=s[u].value,c<E&&(E=c),c>y&&(y=c),L=g*g*x,b=Math.max(y/L,L/E),b>S){g-=c;break}S=b}i.push(l={value:g,dice:p<m,children:s.slice(d,u)}),l.dice?Vh(l,n,r,o,h?r+=m*g/h:a):PI(l,n,r,h?n+=p*g/h:o,a),h-=g,d=u}return i}var Tj,yf,_E=st(()=>{"use strict";LE();DI();Tj=(1+Math.sqrt(5))/2;yf=(function t(e){function n(r,o,a,i,s){Cj(e,r,o,a,i,s)}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Tj)});function AE(){var t=yf,e=!1,n=1,r=1,o=[0],a=id,i=id,s=id,l=id,c=id;function d(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(u),o=[0],e&&f.eachBefore(zh),f}function u(f){var p=o[f.depth],m=f.x0+p,h=f.y0+p,g=f.x1-p,E=f.y1-p;g<m&&(m=g=(m+g)/2),E<h&&(h=E=(h+E)/2),f.x0=m,f.y0=h,f.x1=g,f.y1=E,f.children&&(p=o[f.depth+1]=a(f)/2,m+=c(f)-p,h+=i(f)-p,g-=s(f)-p,E-=l(f)-p,g<m&&(m=g=(m+g)/2),E<h&&(h=E=(h+E)/2),t(f,m,h,g,E))}return d.round=function(f){return arguments.length?(e=!!f,d):e},d.size=function(f){return arguments.length?(n=+f[0],r=+f[1],d):[n,r]},d.tile=function(f){return arguments.length?(t=CI(f),d):t},d.padding=function(f){return arguments.length?d.paddingInner(f).paddingOuter(f):d.paddingInner()},d.paddingInner=function(f){return arguments.length?(a=typeof f=="function"?f:sd(+f),d):a},d.paddingOuter=function(f){return arguments.length?d.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):d.paddingTop()},d.paddingTop=function(f){return arguments.length?(i=typeof f=="function"?f:sd(+f),d):i},d.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:sd(+f),d):s},d.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:sd(+f),d):l},d.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:sd(+f),d):c},d}var OI=st(()=>{"use strict";kE();_E();_I();AI()});var Xh=st(()=>{"use strict";vE();RI();II();OI();_E()});var UI={};ye(UI,{layoutOrg:()=>DE});function Kh(t,e){let n=0;for(let r of t.children){n+=(r.isContainer?0:1)+Kh(r,e);let o=e?.get(r.id);o&&(n+=o)}return n}function bf(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function Oj(t,e){let n=_t(t,_j);for(let[r,o]of Object.entries(e)){let a=_t(`${r}: ${o}`,Aj);a>n&&(n=a)}return Math.max(Dj,Math.ceil(n)+Pj*2)}function Gj(t){let e=Object.keys(t).length;return e===0?GI+$I:GI+Ij+e*Rj+$I}function qh(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n,t.isContainer)}function YI(t,e,n,r,o){return t.map(a=>{let i=bf(a.metadata,n),s=e?.get(a.id);if(!a.isContainer&&o&&!(s!=null&&s>0)){let l=Kh(a,e);l>0&&(i[r??"Sub-node Count"]=String(l))}return{orgNode:a,children:YI(a.children,e,n,r,o),width:Oj(a.label,i),height:Gj(i)}})}function zI(t){let e=0;for(let n of t.children)e+=1+zI(n);return e}function VI(t){for(let i of t.children)VI(i);if(t.children.length<=2)return;let e=t.children.map(i=>({child:i,weight:zI(i)})).sort((i,s)=>s.weight-i.weight),n=new Array(e.length),r=Math.floor((e.length-1)/2),o=r,a=r;for(let i=0;i<e.length;i++){let s=e[i];i===0?n[r]=s.child:i%2===1?(a++,n[a]=s.child):(o--,n[o]=s.child)}t.children=n}function FI(t,e,n){let r=[];for(let o of t){if(o.entries.length===0)continue;let a=n?.get(qt(o.name)),i=a?o.entries.filter(f=>a.has(f.value.toLowerCase())):o.entries;if(i.length===0)continue;let s=We(o.name,sr)+po,l=s,c=0;for(let f of i)c+=wr*2+Nr+We(f.value,Vn)+Kr;let d=e?Mo+Ei:0,u=Rn*2+s+4+d+c;r.push({name:o.name,...o.alias!==void 0&&{alias:o.alias},entries:i.map(f=>({value:f.value,color:f.color})),x:0,y:0,width:u,height:Se,minifiedWidth:l,minifiedHeight:Se})}return r}function $j(t,e){let n=[],r=o=>{n.push(o);for(let a of o.children)r(a)};for(let o of t)r(o);Ea(n,e,o=>o.isContainer)}function DE(t,e,n,r,o){if(t.roots.length===0){let $=r!==void 0,U=FI(t.tagGroups,$);if(U.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let X=ei,q=0;for(let et of U)et.x=ei,et.y=X,X+=Se+Wn,et.width>q&&(q=et.width);return{nodes:[],edges:[],containers:[],legend:U,width:q+ei*2,height:X-Wn+ei}}$j(t.roots,t.tagGroups);let a=t.options["sub-node-label"]??void 0,i=["yes","on"].includes(t.options["show-sub-node-count"]?.toLowerCase()??""),s=YI(t.roots,e,r,a,i),l;s.length===1?l=s[0]:l={orgNode:{id:"__virtual_root__",label:"",metadata:{},children:t.roots,parentId:null,isContainer:!1,lineNumber:0},children:s,width:0,height:0};let c=0,d=0,u=[],f=$=>{$.orgNode.id!=="__virtual_root__"&&(u.push($),$.width>c&&(c=$.width),$.height>d&&(d=$.height));for(let U of $.children)f(U)};f(l);for(let $ of u)$.width=c;let p=new Map,m=$=>{for(let U of $.children)m(U);if($.orgNode.isContainer&&$.children.length>0&&$.children.every(U=>U.children.length===0)){let U=`__stack_${$.orgNode.id}`;p.set($.orgNode.id,{children:[...$.children],placeholderId:U});let X=Math.max(...$.children.map(et=>et.width));for(let et of $.children)et.width=X;let q=$.children.reduce((et,tt)=>et+tt.height,0)+($.children.length-1)*BI;$.children=[{orgNode:{id:U,label:"",metadata:{},children:[],parentId:$.orgNode.id,isContainer:!1,lineNumber:0},children:[],width:X,height:q}]}};m(l),VI(l);let h=Ri(l,$=>$.children);CE().nodeSize([c+HI,d+RE])(h);{let $=h.descendants().filter(tt=>tt.data.orgNode.id!=="__virtual_root__"),U=new Map;for(let tt of $){if(tt.data.orgNode.id.startsWith("__stack_"))continue;let F=U.get(tt.depth)??0;tt.data.height>F&&U.set(tt.depth,tt.data.height)}let X=Math.max(...U.keys(),0),q=new Map,et=s.length===1?0:1;q.set(et,0);for(let tt=et+1;tt<=X;tt++){let F=U.get(tt-1)??d,Q=q.get(tt-1)??0;q.set(tt,Q+F+RE)}for(let tt of h.descendants())tt.data.orgNode.id!=="__virtual_root__"&&(tt.y=q.get(tt.depth)??tt.y)}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.isContainer||!$.children||$.children.length===0)continue;let X=$.children[0].y-$.y,q=Object.keys($.data.orgNode.metadata).length,tt=IE+q*PE+15,F=X-tt;if(F<=0)continue;let Q=ot=>{if(ot.children)for(let Z of ot.children)Z.y-=F,Q(Z)};Q($)}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.isContainer||!$.children||$.children.length===0||!$.children.every(Q=>Q.data.orgNode.isContainer))continue;let U=$.y+$.data.height,q=Math.min(...$.children.map(Q=>Q.y))-U,et=RE*.6,tt=q-et;if(tt<=0)continue;let F=Q=>{if(Q.y-=tt,Q.children)for(let ot of Q.children)F(ot)};for(let Q of $.children)F(Q)}{let $=q=>{let et=q.x-q.data.width/2,tt=q.x+q.data.width/2;if(q.children)for(let F of q.children){let Q=$(F);Q.minX<et&&(et=Q.minX),Q.maxX>tt&&(tt=Q.maxX)}return q.data.orgNode.isContainer&&(et-=jh,tt+=jh),{minX:et,maxX:tt}},U=(q,et)=>{q.x+=et,q.children&&q.children.forEach(tt=>U(tt,et))},X=h.descendants().filter(q=>q.children&&q.children.length>=2).sort((q,et)=>et.depth-q.depth);for(let q of X){let et=q.children,tt=et.map(lt=>{let nt=$(lt);return{relLeft:nt.minX-lt.x,relRight:nt.maxX-lt.x}}),F=(et[0].x+et[et.length-1].x)/2,Q=[0];for(let lt=1;lt<et.length;lt++){let nt=Q[lt-1]+tt[lt-1].relRight;Q[lt]=nt+HI-tt[lt].relLeft}let ot=(Q[0]+Q[Q.length-1])/2,Z=F-ot;for(let lt=0;lt<et.length;lt++){let J=Q[lt]+Z-et[lt].x;Math.abs(J)>.001&&U(et[lt],J)}}}{let $=h.descendants().filter(U=>U.children&&U.children.length>=1&&U.data.orgNode.id!=="__virtual_root__").sort((U,X)=>X.depth-U.depth);for(let U of $){let X=U.children.map(et=>et.x),q=(Math.min(...X)+Math.max(...X))/2;U.x=q}}let E=[],y=[],b=1/0,S=-1/0,x=1/0,L=-1/0,v=[];for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode.id.replace("__stack_",""),X=p.get(U);if(!X)continue;let q=$.y;for(let et of X.children)v.push({orgNode:et.orgNode,width:et.width,height:et.height,cx:$.x,cy:q}),q+=et.height+BI}for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.width,X=$.data.height,q=$.x,et=$.y;q-U/2<b&&(b=q-U/2),q+U/2>S&&(S=q+U/2),et<x&&(x=et),et+X>L&&(L=et+X)}for(let $ of v)$.cx-$.width/2<b&&(b=$.cx-$.width/2),$.cx+$.width/2>S&&(S=$.cx+$.width/2),$.cy<x&&(x=$.cy),$.cy+$.height>L&&(L=$.cy+$.height);let A=-b+ei,C=-x+ei,M=a??"Sub-node Count";for(let $ of v){let U=e?.get($.orgNode.id),X=bf($.orgNode.metadata,r);if(!$.orgNode.isContainer&&i&&!(U!=null&&U>0)){let tt=Kh($.orgNode,e);tt>0&&(X[M]=String(tt))}let q=qh($.orgNode,t.tagGroups,n??null),et=$.orgNode.children.length>0||U!=null&&U>0||void 0;E.push({id:$.orgNode.id,label:$.orgNode.label,metadata:X,tagMetadata:{...$.orgNode.metadata},isContainer:$.orgNode.isContainer,lineNumber:$.orgNode.lineNumber,...q!==void 0&&{color:q},x:$.cx+A,y:$.cy+C,width:$.width,height:$.height,...U!==void 0&&{hiddenCount:U},...et!==void 0&&{hasChildren:et}})}let w=new Map;for(let $ of h.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode,X=$.data.width,q=$.data.height,et=$.x+A,tt=$.y+C,F=e?.get(U.id),Q=bf(U.metadata,r);if(!U.isContainer&&i&&!(F!=null&&F>0)){let nt=Kh(U,e);nt>0&&(Q[M]=String(nt))}let ot=qh(U,t.tagGroups,n??null),Z=$.children!=null&&$.children.length>0||F!=null&&F>0||void 0;E.push({id:U.id,label:U.label,metadata:Q,tagMetadata:{...U.metadata},isContainer:U.isContainer,lineNumber:U.lineNumber,...ot!==void 0&&{color:ot},x:et,y:tt,width:X,height:q,...F!==void 0&&{hiddenCount:F},...Z!==void 0&&{hasChildren:Z}});let lt=$.parent?.data.orgNode.isContainer&&$.parent.children&&$.parent.children.length>0;if($.parent&&$.parent.data.orgNode.id!=="__virtual_root__"&&!lt){let nt=$.parent.data.orgNode.id;if(!w.has(nt)){let J=$.parent.x+A,at=$.parent.y+C,it=$.parent.data.height;w.set(nt,{parentX:J,parentBottomY:at+it,children:[]})}w.get(nt).children.push({id:U.id,x:et,topY:tt})}}for(let[$,U]of w){let{parentX:X,parentBottomY:q,children:et}=U;if(et.length===1){let tt=et[0],F=(q+tt.topY)/2;y.push({sourceId:$,targetId:tt.id,points:[{x:X,y:q},{x:X,y:F},{x:tt.x,y:F},{x:tt.x,y:tt.topY}]})}else{let tt=(q+et[0].topY)/2,F=et.map(Z=>Z.x),Q=Math.min(...F),ot=Math.max(...F);y.push({sourceId:$,targetId:$,points:[{x:X,y:q},{x:X,y:tt}]}),y.push({sourceId:$,targetId:$,points:[{x:Q,y:tt},{x:ot,y:tt}]});for(let Z of et)y.push({sourceId:$,targetId:Z.id,points:[{x:Z.x,y:tt},{x:Z.x,y:Z.topY}]})}}let k=h.descendants().filter($=>$.data.orgNode.id!=="__virtual_root__"&&$.data.orgNode.isContainer),N=new Map,_=[],T=60;for(let $ of k){if($.children&&$.children.length>0)continue;let U=$.x+A,X=$.y+C,q=Object.keys($.data.orgNode.metadata).length,et=IE+q*PE,tt=$.data.width,F=Math.max(et+WI,T),Q=U-tt/2,ot=X;N.set($.data.orgNode.id,{minX:Q,maxX:Q+tt,minY:ot,maxY:ot+F});let Z=e?.get($.data.orgNode.id),lt=bf($.data.orgNode.metadata,r),nt=qh($.data.orgNode,t.tagGroups,n??null),J=Z!=null&&Z>0||void 0;_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...nt!==void 0&&{color:nt},metadata:lt,tagMetadata:{...$.data.orgNode.metadata},x:Q,y:ot,width:tt,height:F,labelHeight:et,...Z!==void 0&&{hiddenCount:Z},...J!==void 0&&{hasChildren:J}})}let R=k.filter($=>$.children&&$.children.length>0);R.sort(($,U)=>U.depth-$.depth);for(let $ of R){let U=[],X=pt=>{if(pt.children)for(let ht of pt.children)U.push(ht),X(ht)};if(X($),U.length===0)continue;let q=1/0,et=-1/0,tt=-1/0;for(let pt of U){let ht=N.get(pt.data.orgNode.id);if(ht)ht.minX<q&&(q=ht.minX),ht.maxX>et&&(et=ht.maxX),ht.maxY>tt&&(tt=ht.maxY);else if(pt.data.orgNode.id.startsWith("__stack_")){let dt=pt.data.orgNode.id.replace("__stack_","");if(p.get(dt))for(let yt of v){if(yt.orgNode.parentId!==dt)continue;let kt=yt.cx+A,Ot=yt.cy+C;kt-yt.width/2<q&&(q=kt-yt.width/2),kt+yt.width/2>et&&(et=kt+yt.width/2),Ot+yt.height>tt&&(tt=Ot+yt.height)}}else{let dt=pt.data.width,ut=pt.data.height,yt=pt.x+A,kt=pt.y+C;yt-dt/2<q&&(q=yt-dt/2),yt+dt/2>et&&(et=yt+dt/2),kt+ut>tt&&(tt=kt+ut)}}let F=$.x+A,Q=$.y+C,ot=Object.keys($.data.orgNode.metadata).length,Z=IE+ot*PE,lt=Q,nt=tt-Q+WI,J=q-jh,at=et-q+jh*2,it=Math.max(at,$.data.width),vt=it>at?F-it/2:J;N.set($.data.orgNode.id,{minX:vt,maxX:vt+it,minY:lt,maxY:lt+nt});let Tt=e?.get($.data.orgNode.id),At=bf($.data.orgNode.metadata,r),rt=qh($.data.orgNode,t.tagGroups,n??null);_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...rt!==void 0&&{color:rt},metadata:At,tagMetadata:{...$.data.orgNode.metadata},x:vt,y:lt,width:it,height:nt,labelHeight:Z,...Tt!==void 0&&{hiddenCount:Tt},hasChildren:!0})}_.reverse();let G=b,I=S,H=L;for(let $ of _){let U=$.x-A,X=U+$.width,q=$.y-C+$.height;U<G&&(G=U),X>I&&(I=X),q>H&&(H=q)}let O=I-G+ei*2,D=H-x+ei*2,W=new Map;for(let $ of t.tagGroups){let U=qt($.name),X=new Set,q=et=>{!et.isContainer&&et.metadata[U]&&X.add(et.metadata[U].toLowerCase());for(let tt of et.children)q(tt)};for(let et of t.roots)q(et);W.set(U,X)}let z=r!==void 0,P=FI(t.tagGroups,z,W),B=O,Y=D,V=n!=null?P.filter($=>$.name.toLowerCase()===n.toLowerCase()):P,j=o&&n==null,K=$=>n!=null||j?$.width:$.minifiedWidth;if(V.length>0){let $=Se+Wn;for(let et of E)et.y+=$;for(let et of _)et.y+=$;for(let et of y)for(let tt of et.points)tt.y+=$;let U=V.reduce((et,tt)=>et+K(tt),0)+(V.length-1)*Wn,X=ei;for(let et of V)et.x=X,et.y=ei,X+=K(et)+Wn;Y+=$;let q=U+ei*2;q>B&&(B=q)}return{nodes:E,edges:y,containers:_,legend:P,width:B,height:Y}}var _j,Aj,Rj,GI,Ij,Pj,$I,Dj,HI,RE,ei,jh,WI,IE,PE,BI,OE=st(()=>{"use strict";Ke();Xh();Ke();Mr();en();_j=13,Aj=11,Rj=16,GI=28,Ij=6,Pj=20,$I=10,Dj=140,HI=30,RE=50,ei=40,jh=24,WI=24,IE=28,PE=16,BI=20});function XI(t,e){let n=0;for(let r of e.getChildren(t))n+=(e.countsAsHidden(r)?1:0)+XI(r,e);return n}function jI(t,e,n,r){for(let o of t){let a=r.getChildren(o);e.has(r.getId(o))&&a.length>0&&n.set(r.getId(o),XI(o,r)),jI(a,e,n,r)}}function qI(t,e,n){for(let r of n.getChildren(t))qI(r,e,n);e.has(n.getId(t))&&n.getChildren(t).length>0&&n.setChildren(t,[])}function ld(t,e,n){let r=new Map;jI(t,e,r,n);let o=t.map(a=>n.clone(a));for(let a of o)qI(a,e,n);return{roots:o,hiddenCounts:r}}function KI(t,e){let n=new Set,r=o=>{for(let a of o)n.add(e.getId(a)),r(e.getChildren(a))};return r(t),n}var xf=st(()=>{"use strict"});var QI={};ye(QI,{collapseOrgTree:()=>Wj,focusOrgTree:()=>Bj});function Zh(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(Zh),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function Wj(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=ld(t.roots,e,Hj);return{parsed:{...t,roots:n},hiddenCounts:r}}function ZI(t,e,n){for(let r of t){if(r.id===e)return{node:r,path:n};let o=ZI(r.children,e,[...n,{id:r.id,label:r.label,lineNumber:r.lineNumber,...r.color!==void 0&&{color:r.color},metadata:{...r.metadata},isContainer:r.isContainer}]);if(o)return o}return null}function Bj(t,e){let n=ZI(t.roots,e,[]);if(!n)return null;if(t.roots.some(a=>a.id===e))return{parsed:{...t,roots:[Zh(n.node)]},ancestorPath:[]};let o=Zh(n.node);return o.parentId=null,{parsed:{...t,roots:[o]},ancestorPath:n.path}}var Hj,JI=st(()=>{"use strict";xf();Hj={getId:t=>t.id,getChildren:t=>t.children,clone:Zh,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer}});function cd(t,e,n){let r=document.createElement("div");r.style.width=`${t}px`,r.style.height=`${e}px`,r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);try{return n(r)}finally{document.body.removeChild(r)}}function dd(t,e){let n=t.querySelector("svg");return n?(e==="transparent"&&(n.style.background="none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.fontFamily=It,n.querySelectorAll("[data-export-ignore]").forEach(r=>r.remove()),n.outerHTML):""}var Qh=st(()=>{"use strict";on()});var aP={};ye(aP,{renderOrg:()=>oP,renderOrgForExport:()=>Jj});function Zj(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function tP(t,e){return e??t.primary}function Qj(t,e,n){return n?Gt(n,nr(t,e),10):Gt(t.surface,t.bg,40)}function eP(t,e){return e??t.textMuted}function oP(t,e,n,r,o,a,i,s,l,c,d){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let u=i?.width??t.clientWidth,f=i?.height??t.clientHeight;if(u<=0||f<=0)return;let p=Ee.identity(),m=p.aesthetic(GE),h=p.structural(rP),g=p.text(13),E=p.text(11),y=p.structural(16),b=p.structural(28),S=p.structural(6),x=p.structural(1.5),L=p.structural(1.5),v=p.structural(6),A=p.structural(8),C=p.text(13),M=p.text(11),w=p.structural(16),k=p.structural(28),N=p.structural(6),_=p.structural(0),T=p.structural(Uj),R=p.text(Xj),G=p.structural(jj),I=p.structural(qj),H=p.aesthetic(Kj),O=!!e.title&&e.options["no-title"]!=="on",D=O?h:0,W=n.nodes.length===0,z=n.legend.length>0,P=Se+Wn,B=!i&&z&&!W,Y=B?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Mo+Ei},u)+H:0,V=!i&&O,j=V?h:0,K=!i&&c&&c.length>0,$=K?c.length*G+I:0,U=n.width,X=n.height+(V?0:D)+$;B&&(X-=P);let q=f-m*2-Y-j,et=(u-m*2)/U,tt=q/X,F=Math.min(Vj,et,tt),Q=U*F,ot=(u-Q)/2,Z=B?m+Y+j:m+j,lt=Rt(t).append("svg").attr("width",u).attr("height",f).attr("viewBox",`0 0 ${u} ${f}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);p.isBelowFloor&&lt.attr("width","100%");let nt=lt.append("g").attr("transform",`translate(${ot}, ${Z}) scale(${F})`);if(O){let rt=V?lt:nt,pt=V?u/2:U/2,ht=V?m+20:20,dt=rt.append("text").attr("x",pt).attr("y",ht).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",20).attr("font-weight","700").attr("class","org-title chart-title").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(dt.attr("data-line-number",e.titleLineNumber),a&&dt.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let J=(V?0:D)+$,at=nt.append("g").attr("transform",`translate(0, ${J})`),it=new Map;for(let rt of e.tagGroups)it.set(qt(rt.name),rt.name);let vt=new Set(e.roots.map(rt=>rt.id)),Tt=e.options?.color==="off";for(let rt of n.containers){let pt=at.append("g").attr("transform",`translate(${rt.x}, ${rt.y})`).attr("class","org-container").attr("data-line-number",String(rt.lineNumber));if(s){let yt=qt(s),kt=rt.tagMetadata[yt];kt&&pt.attr(`data-tag-${yt}`,kt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let ht=Qj(r,o,Tt?void 0:rt.color),dt=eP(r,Tt?void 0:rt.color);pt.append("rect").attr("x",0).attr("y",0).attr("width",rt.width).attr("height",rt.height).attr("rx",A).attr("fill",ht).attr("stroke",dt).attr("stroke-opacity",.35).attr("stroke-width",L),pt.append("text").attr("x",rt.width/2).attr("y",k/2+C/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",C).attr("font-weight","bold").text(rt.label);let ut=Object.entries(rt.metadata);if(ut.length>0){let yt=ut.map(([bt])=>it.get(bt)??bt),Ot=10+Math.max(...yt.map(bt=>_t(`${bt}: `,M))),Xt=k+M-2;for(let bt=0;bt<ut.length;bt++){let[,Nt]=ut[bt],Vt=yt[bt],xt=Xt+bt*w;pt.append("text").attr("x",10).attr("y",xt).attr("fill",r.textMuted).attr("font-size",M).text(`${Vt}: `),pt.append("text").attr("x",Ot).attr("y",xt).attr("fill",r.text).attr("font-size",M).text(Nt)}}if(!i&&rt.hiddenCount&&rt.hiddenCount>0&&cE(pt,{width:rt.width,height:rt.height,barHeight:N,inset:_,rx:A,fill:eP(r,Tt?void 0:rt.color),clipId:`clip-${rt.nodeId}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!vt.has(rt.nodeId)){let Ot=rt.width-14-5,bt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.nodeId).attr("data-export-ignore","true").attr("transform",`translate(${Ot}, 5)`);bt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let Nt=ve(ht,r.textOnFillLight,r.textOnFillDark),Vt=14/2,xt=14/2;bt.append("circle").attr("cx",Vt).attr("cy",xt).attr("r",14/2-1).attr("fill","none").attr("stroke",Nt).attr("stroke-width",1.5),bt.append("circle").attr("cx",Vt).attr("cy",xt).attr("r",2).attr("fill",Nt)}}for(let rt of n.edges){if(rt.points.length<2)continue;let pt=[];pt.push(`M ${rt.points[0].x} ${rt.points[0].y}`);for(let ht=1;ht<rt.points.length;ht++)pt.push(`L ${rt.points[ht].x} ${rt.points[ht].y}`);at.append("path").attr("d",pt.join(" ")).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",x).attr("class","org-edge").attr("data-from",rt.sourceId).attr("data-to",rt.targetId)}let At=new Set(n.containers.map(rt=>rt.nodeId));for(let rt of n.nodes){if(At.has(rt.id))continue;let pt=at.append("g").attr("transform",`translate(${rt.x-rt.width/2}, ${rt.y})`).attr("class","org-node").attr("data-line-number",String(rt.lineNumber)).attr("data-node-id",rt.id);if(s){let Ot=qt(s),Xt=rt.tagMetadata[Ot];Xt&&pt.attr(`data-tag-${Ot}`,Xt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let ht=e.options["solid-fill"]==="on",dt=Zj(r,o,Tt?void 0:rt.color,ht),ut=tP(r,Tt?void 0:rt.color),yt=ve(dt,r.textOnFillLight,r.textOnFillDark),kt=Object.entries(rt.metadata);if(od(pt,{width:rt.width,height:rt.height,rx:v,fill:dt,stroke:ut,strokeWidth:L,...rt.isContainer&&{dashed:!0},label:rt.label,labelColor:yt,labelFontSize:g,headerHeight:b,...kt.length>0&&{meta:{rows:kt.map(([Ot,Xt])=>[it.get(Ot)??Ot,Xt]),fontSize:E,lineHeight:y,separatorGap:S,separatorColor:ht?yt:ut,textColor:yt}}}),!i&&rt.hiddenCount&&rt.hiddenCount>0&&cE(pt,{width:rt.width,height:rt.height,barHeight:N,inset:_,rx:v,fill:ht?yt:tP(r,Tt?void 0:rt.color),clipId:`clip-${rt.id}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!vt.has(rt.id)){let bt=rt.width-14-5,Vt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.id).attr("data-export-ignore","true").attr("transform",`translate(${bt}, 5)`);Vt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let xt=yt,Lt=14/2,Dt=14/2;Vt.append("circle").attr("cx",Lt).attr("cy",Dt).attr("r",14/2-1).attr("fill","none").attr("stroke",xt).attr("stroke-width",1.5),Vt.append("circle").attr("cx",Lt).attr("cy",Dt).attr("r",2).attr("fill",xt)}}if(K){let rt=n.nodes.find(ut=>vt.has(ut.id)),pt=rt?null:n.containers.find(ut=>vt.has(ut.nodeId)),ht=rt?rt.x:pt?pt.x+pt.width/2:null,dt=rt?rt.y:pt?pt.y:null;if(ht!==null&&dt!==null){let ut=dt-I,yt=at.append("g").attr("class","org-ancestor-trail"),kt=c.length,Ot=[];for(let bt=0;bt<kt;bt++){let Nt=kt-1-bt;Ot.push(ut-Nt*G)}let Xt=Ot[0];yt.append("line").attr("x1",ht).attr("y1",Xt).attr("x2",ht).attr("y2",dt).attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.4);for(let bt=0;bt<kt;bt++){let Nt=c[bt],Vt=Ot[bt],Lt=Nt.color??ar(Nt.metadata,[...e.tagGroups],s??null,Nt.isContainer)??r.textMuted,Dt=yt.append("g").attr("class","org-ancestor-node").attr("data-focus-ancestor",Nt.id).style("cursor","pointer").attr("transform",`translate(${ht}, ${Vt})`);Dt.append("rect").attr("x",-T-2).attr("y",-T-2).attr("width",120).attr("height",T*2+4).attr("fill","transparent"),Dt.append("circle").attr("cx",0).attr("cy",0).attr("r",T).attr("fill",Lt),Dt.append("text").attr("x",T+6).attr("y",R*.35).attr("fill",r.textMuted).attr("font-size",R).text(Nt.label),Dt.on("mouseenter",function(){Rt(this).select("circle").attr("r",T+1),Rt(this).select("text").attr("fill",r.text)}).on("mouseleave",function(){Rt(this).select("circle").attr("r",T),Rt(this).select("text").attr("fill",r.textMuted)})}}}if(B||W||i&&z){let rt=n.legend.map(ut=>({name:ut.name,entries:ut.entries.map(yt=>({value:yt.value,color:yt.color}))})),pt=B?Mo+Ei:0,ht=B?lt.append("g").attr("class","org-legend-fixed").attr("transform",`translate(0, ${m+j})`):at.append("g"),dt;if(W){for(let ut of n.legend){let yt={groups:[{name:ut.name,entries:ut.entries.map(Ot=>({value:Ot.value,color:Ot.color}))}],position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview"},kt=ht.append("g").attr("transform",`translate(${ut.x}, ${ut.y})`);fn(kt,{...yt,palette:r,isDark:o,width:ut.width,activeGroup:ut.name}),kt.selectAll("[data-legend-group]").classed("org-legend-group",!0)}dt=null}else dt=fn(ht,{...{groups:rt,position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview",capsulePillAddonWidth:pt},palette:r,isDark:o,width:B?u:n.width,activeGroup:s??null}),ht.selectAll("[data-legend-group]").classed("org-legend-group",!0);if(B&&dt){let ut=dt.getLayout();if(ut.activeCapsule?.addonX!=null){let yt=ut.activeCapsule,kt=qt(yt.groupName),Ot=l?.has(kt)??!1,Xt=ht.select(`[data-legend-group="${kt}"]`);if(!Xt.empty()){let bt=yt.addonX,Nt=(Se-Mo)/2,Vt=6,xt=Xt.append("g").attr("class","org-legend-eye").attr("data-legend-visibility",kt).style("cursor","pointer").attr("opacity",Ot?.4:.7);xt.append("rect").attr("x",bt-Vt).attr("y",Nt-Vt).attr("width",Mo+Vt*2).attr("height",Mo+Vt*2).attr("fill","transparent").attr("pointer-events","all"),xt.append("path").attr("d",Ot?Gm:Om).attr("transform",`translate(${bt}, ${Nt})`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}}function Jj(t,e,n){let r=Vc(t,n);if(r.error)return"";let o=r.options?.hide,a=o?new Set(o.split(",").map(u=>u.trim().toLowerCase())):void 0,i=DE(r,void 0,void 0,a),s=e==="dark",l=r.title&&r.options["no-title"]!=="on"?rP:0,c=i.width+GE*2,d=i.height+GE*2+l;return cd(c,d,u=>(oP(u,r,i,n,s,void 0,{width:c,height:d}),dd(u,e)))}var GE,Vj,rP,Uj,Xj,jj,qj,Kj,iP=st(()=>{"use strict";Ke();Xn();on();Qh();fr();tn();Ke();tf();OE();Mr();Br();Oh();en();To();GE=20,Vj=3,rP=30,Uj=4,Xj=11,jj=22,qj=16,Kj=8});function sP(t,e){t[e]?t[e]++:t[e]=1}function lP(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function wf(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let i=o;o=a,a=i}return o+""+a+""+(r===void 0?"\0":r)}function oq(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let s=o;o=a,a=s}let i={v:o,w:a};return r&&(i.name=r),i}function WE(t,e){return wf(t,e.v,e.w,e.name)}function iq(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:sq(t),edges:lq(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function sq(t){return t.nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function lq(t){return t.edges().map(e=>{let n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function cq(t){let e=new Na(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}function kP(t,e,n,r){return uq(t,String(e),n||dq,r||function(o){return t.outEdges(o)})}function uq(t,e,n,r){let o={},a,i=0,s=t.nodes(),l=function(u){let f=n(u);o[u.v].distance+f<o[u.w].distance&&(o[u.w]={distance:o[u.v].distance+f,predecessor:u.v},a=!0)},c=function(){s.forEach(function(u){r(u).forEach(function(f){let p=f.v===u?f.v:f.w,m=p===f.v?f.w:f.v;l({v:p,w:m})})})};s.forEach(function(u){let f=u===e?0:Number.POSITIVE_INFINITY;o[u]={distance:f,predecessor:""}});let d=s.length;for(let u=1;u<d&&(a=!1,i++,c(),!!a);u++);if(i===d-1&&(a=!1,c(),a))throw new Error("The graph contains a negative weight cycle");return o}function fq(t){let e={},n=[],r;function o(a){a in e||(e[a]=!0,r.push(a),t.successors(a).forEach(o),t.predecessors(a).forEach(o))}return t.nodes().forEach(function(a){r=[],o(a),r.length&&n.push(r)}),n}function tg(t,e,n,r){let o=function(a){return t.outEdges(a)};return mq(t,String(e),n||pq,r||o)}function mq(t,e,n,r){let o={},a=new LP,i,s,l=function(c){let d=c.v!==i?c.v:c.w,u=o[d],f=n(c),p=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+c+" Weight: "+f);p<u.distance&&(u.distance=p,u.predecessor=i,a.decrease(d,p))};for(t.nodes().forEach(function(c){let d=c===e?0:Number.POSITIVE_INFINITY;o[c]={distance:d,predecessor:""},a.add(c,d)});a.size()>0&&(i=a.removeMin(),s=o[i],s.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}function hq(t,e,n){return t.nodes().reduce(function(r,o){return r[o]=tg(t,o,e,n),r},{})}function NP(t){let e=0,n=[],r={},o=[];function a(i){let s=r[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(l){l in r?r[l].onStack&&(s.lowlink=Math.min(s.lowlink,r[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,r[l].lowlink))}),s.lowlink===s.index){let l=[],c;do c=n.pop(),r[c].onStack=!1,l.push(c);while(i!==c);o.push(l)}}return t.nodes().forEach(function(i){i in r||a(i)}),o}function gq(t){return NP(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}function bq(t,e,n){return xq(t,e||yq,n||function(r){return t.outEdges(r)})}function xq(t,e,n){let r={},o=t.nodes();return o.forEach(function(a){r[a]={},r[a][a]={distance:0,predecessor:""},o.forEach(function(i){a!==i&&(r[a][i]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(i){let s=i.v===a?i.w:i.v,l=e(i);r[a][s]={distance:l,predecessor:a}})}),o.forEach(function(a){let i=r[a];o.forEach(function(s){let l=r[s];o.forEach(function(c){let d=l[a],u=i[c],f=l[c],p=d.distance+u.distance;p<f.distance&&(f.distance=p,f.predecessor=u.predecessor)})})}),r}function MP(t){let e={},n={},r=[];function o(a){if(a in n)throw new eg;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(o),delete n[a],r.push(a))}if(t.sinks().forEach(o),Object.keys(e).length!==t.nodeCount())throw new eg;return r}function wq(t){try{MP(t)}catch(e){if(e instanceof eg)return!1;throw e}return!0}function Eq(t,e,n,r,o){Array.isArray(e)||(e=[e]);let a=(s=>{var l;return(l=t.isDirected()?t.successors(s):t.neighbors(s))!=null?l:[]}),i={};return e.forEach(function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);o=TP(t,s,n==="post",i,a,r,o)}),o}function TP(t,e,n,r,o,a,i){return e in r||(r[e]=!0,n||(i=a(i,e)),o(e).forEach(function(s){i=TP(t,s,n,r,o,a,i)}),n&&(i=a(i,e))),i}function CP(t,e,n){return Eq(t,e,n,function(r,o){return r.push(o),r},[])}function Sq(t,e){return CP(t,e,"post")}function vq(t,e){return CP(t,e,"pre")}function kq(t,e){let n=new Na,r={},o=new LP,a;function i(l){let c=l.v===a?l.w:l.v,d=o.priority(c);if(d!==void 0){let u=e(l);u<d&&(r[c]=a,o.decrease(c,u))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(l){o.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),o.decrease(t.nodes()[0],0);let s=!1;for(;o.size()>0;){if(a=o.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(a).forEach(i)}return n}function Lq(t,e,n,r){return Nq(t,e,n,r??(o=>{let a=t.outEdges(o);return a??[]}))}function Nq(t,e,n,r){if(n===void 0)return tg(t,e,n,r);let o=!1,a=t.nodes();for(let i=0;i<a.length;i++){let s=r(a[i]);for(let l=0;l<s.length;l++){let c=s[l],d=c.v===a[i]?c.v:c.w,u=d===c.v?c.w:c.v;n({v:d,w:u})<0&&(o=!0)}if(o)return kP(t,e,n,r)}return tg(t,e,n,r)}function md(t,e,n,r){let o=r;for(;t.hasNode(o);)o=jE(r);return n.dummy=e,t.setNode(o,n),o}function Mq(t){let e=new Na().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},o=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),e}function _P(t){let e=new Na({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function cP(t,e){let n=t.x,r=t.y,o=e.x-n,a=e.y-r,i=t.width/2,s=t.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let l,c;return Math.abs(a)*i>Math.abs(o)*s?(a<0&&(s=-s),l=s*o/a,c=s):(o<0&&(i=-i),l=i,c=i*a/o),{x:n+l,y:r+c}}function Sf(t){let e=Ef(RP(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),o=r.rank;o!==void 0&&(e[o]||(e[o]=[]),e[o][r.order]=n)}),e}function Tq(t){let e=t.nodes().map(r=>{let o=t.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=Ii(Math.min,e);t.nodes().forEach(r=>{let o=t.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function Cq(t){let e=t.nodes().map(i=>t.node(i).rank).filter(i=>i!==void 0),n=Ii(Math.min,e),r=[];t.nodes().forEach(i=>{let s=t.node(i).rank-n;r[s]||(r[s]=[]),r[s].push(i)});let o=0,a=t.graph().nodeRankFactor;Array.from(r).forEach((i,s)=>{i===void 0&&s%a!==0?--o:i!==void 0&&o&&i.forEach(l=>t.node(l).rank+=o)})}function dP(t,e,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),md(t,"border",o,e)}function _q(t,e=AP){let n=[];for(let r=0;r<t.length;r+=e){let o=t.slice(r,r+e);n.push(o)}return n}function Ii(t,e){if(e.length>AP){let n=_q(e);return t(...n.map(r=>t(...r)))}else return t(...e)}function RP(t){let e=t.nodes().map(n=>{let r=t.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return Ii(Math.max,e)}function Aq(t,e){let n={lhs:[],rhs:[]};return t.forEach(r=>{e(r)?n.lhs.push(r):n.rhs.push(r)}),n}function IP(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function PP(t,e){return e()}function jE(t){let e=++Rq;return t+(""+e)}function Ef(t,e,n=1){e==null&&(e=t,t=0);let r=a=>a<e;n<0&&(r=a=>e<a);let o=[];for(let a=t;r(a);a+=n)o.push(a);return o}function ng(t,e){let n={};for(let r of e)t[r]!==void 0&&(n[r]=t[r]);return n}function rg(t,e){let n;return typeof e=="string"?n=r=>r[e]:n=e,Object.entries(t).reduce((r,[o,a])=>(r[o]=n(a,o),r),{})}function Iq(t,e){return t.reduce((n,r,o)=>(n[r]=e[o],n),{})}function uP(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Oq(t,e){if(t!=="_next"&&t!=="_prev")return e}function Hq(t,e){if(t.nodeCount()<=1)return[];let n=Bq(t,e||$q);return Wq(n.graph,n.buckets,n.zeroIdx).flatMap(r=>t.outEdges(r.v,r.w)||[])}function Wq(t,e,n){var r;let o=[],a=e[e.length-1],i=e[0],s;for(;t.nodeCount();){for(;s=i.dequeue();)BE(t,e,n,s);for(;s=a.dequeue();)BE(t,e,n,s);if(t.nodeCount()){for(let l=e.length-2;l>0;--l)if(s=(r=e[l])==null?void 0:r.dequeue(),s){o=o.concat(BE(t,e,n,s,!0)||[]);break}}}return o}function BE(t,e,n,r,o){let a=[],i=o?a:void 0;return(t.inEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=t.node(s.v);o&&a.push({v:s.v,w:s.w}),c.out-=l,UE(e,n,c)}),(t.outEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=s.w,d=t.node(c);d.in-=l,UE(e,n,d)}),t.removeNode(r.v),i}function Bq(t,e){let n=new Na,r=0,o=0;t.nodes().forEach(s=>{n.setNode(s,{v:s,in:0,out:0})}),t.edges().forEach(s=>{let l=n.edge(s.v,s.w)||0,c=e(s),d=l+c;n.setEdge(s.v,s.w,d);let u=n.node(s.v),f=n.node(s.w);o=Math.max(o,u.out+=c),r=Math.max(r,f.in+=c)});let a=Fq(o+r+3).map(()=>new Gq),i=r+1;return n.nodes().forEach(s=>{UE(a,i,n.node(s))}),{graph:n,buckets:a,zeroIdx:i}}function UE(t,e,n){var r,o,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(o=t[t.length-1])==null||o.enqueue(n):(r=t[0])==null||r.enqueue(n)}function Fq(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function Yq(t){(t.graph().acyclicer==="greedy"?Hq(t,e(t)):zq(t)).forEach(n=>{let r=t.edge(n);t.removeEdge(n),r.forwardName=n.name,r.reversed=!0,t.setEdge(n.w,n.v,r,jE("rev"))});function e(n){return r=>n.edge(r).weight}}function zq(t){let e=[],n={},r={};function o(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,t.outEdges(a).forEach(i=>{Object.hasOwn(n,i.w)?e.push(i):o(i.w)}),delete n[a])}return t.nodes().forEach(o),e}function Vq(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}function Uq(t){t.graph().dummyChains=[],t.edges().forEach(e=>Xq(t,e))}function Xq(t,e){let n=e.v,r=t.node(n).rank,o=e.w,a=t.node(o).rank,i=e.name,s=t.edge(e),l=s.labelRank;if(a===r+1)return;t.removeEdge(e);let c,d,u;for(u=0,++r;r<a;++u,++r)s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:r},c=md(t,"edge",d,"_d"),r===l&&(d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos),t.setEdge(n,c,{weight:s.weight},i),u===0&&t.graph().dummyChains.push(c),n=c;t.setEdge(n,o,{weight:s.weight},i)}function jq(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeLabel,o;for(t.setEdge(n.edgeObj,r);n.dummy;)o=t.successors(e)[0],t.removeNode(e),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),e=o,n=t.node(e)})}function qE(t){let e={};function n(r){let o=t.node(r);if(Object.hasOwn(e,r))return o.rank;e[r]=!0;let a=t.outEdges(r),i=a?a.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-t.edge(l).minlen):[],s=Ii(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}t.sources().forEach(n)}function pd(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function qq(t){let e=new Na({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=t.nodeCount();e.setNode(r,{});let a,i;for(;Kq(e,t)<o&&(a=Zq(e,t),!!a);)i=e.hasNode(a.v)?pd(t,a):-pd(t,a),Qq(e,t,i);return e}function Kq(t,e){function n(r){let o=e.nodeEdges(r);o&&o.forEach(a=>{let i=a.v,s=r===i?a.w:i;!t.hasNode(s)&&!pd(e,a)&&(t.setNode(s,{}),t.setEdge(r,s,{}),n(s))})}return t.nodes().forEach(n),t.nodeCount()}function Zq(t,e){return e.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(o=pd(e,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function Qq(t,e,n){t.nodes().forEach(r=>e.node(r).rank+=n)}function Vl(t){t=Mq(t),qE(t);let e=DP(t);ZE(e),KE(e,t);let n,r;for(;n=$P(e);)r=HP(e,t,n),WP(e,t,n,r)}function KE(t,e){let n=tK(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(r=>nK(t,e,r))}function nK(t,e,n){let r=t.node(n).parent,o=t.edge(n,r);o.cutvalue=OP(t,e,n)}function OP(t,e,n){let r=t.node(n).parent,o=!0,a=e.edge(n,r),i=0;a||(o=!1,a=e.edge(r,n)),i=a.weight;let s=e.nodeEdges(n);return s&&s.forEach(l=>{let c=l.v===n,d=c?l.w:l.v;if(d!==r){let u=c===o,f=e.edge(l).weight;if(i+=u?f:-f,oK(t,n,d)){let p=t.edge(n,d).cutvalue;i+=u?-p:p}}}),i}function ZE(t,e){arguments.length<2&&(e=t.nodes()[0]),GP(t,{},1,e)}function GP(t,e,n,r,o){let a=n,i=t.node(r);e[r]=!0;let s=t.neighbors(r);return s&&s.forEach(l=>{Object.hasOwn(e,l)||(n=GP(t,e,n,l,r))}),i.low=a,i.lim=n++,o?i.parent=o:delete i.parent,n}function $P(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function HP(t,e,n){let r=n.v,o=n.w;e.hasEdge(r,o)||(r=n.w,o=n.v);let a=t.node(r),i=t.node(o),s=a,l=!1;return a.lim>i.lim&&(s=i,l=!0),e.edges().filter(c=>l===fP(t,t.node(c.v),s)&&l!==fP(t,t.node(c.w),s)).reduce((c,d)=>pd(e,d)<pd(e,c)?d:c)}function WP(t,e,n,r){let o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),ZE(t),KE(t,e),rK(t,e)}function rK(t,e){let n=t.nodes().find(o=>!t.node(o).parent);if(!n)return;let r=Jq(t,[n]);r=r.slice(1),r.forEach(o=>{let a=t.node(o).parent,i=e.edge(o,a),s=!1;i||(i=e.edge(a,o),s=!0),e.node(o).rank=e.node(a).rank+(s?i.minlen:-i.minlen)})}function oK(t,e,n){return t.hasEdge(e,n)}function fP(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function iK(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":pP(t);break;case"tight-tree":lK(t);break;case"longest-path":sK(t);break;case"none":break;default:pP(t)}}function lK(t){qE(t),DP(t)}function pP(t){eK(t)}function dK(t){let e=fK(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),o=r.edgeObj,a=uK(t,e,o.v,o.w),i=a.path,s=a.lca,l=0,c=i[l],d=!0;for(;n!==o.w;){if(r=t.node(n),d){for(;(c=i[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(i[l+1]).minRank<=r.rank;)l++;c=i[l]}c!==void 0&&t.setParent(n,c),n=t.successors(n)[0]}})}function uK(t,e,n,r){let o=[],a=[],i=Math.min(e[n].low,e[r].low),s=Math.max(e[n].lim,e[r].lim),l;l=n;do l=t.parent(l),o.push(l);while(l&&(e[l].low>i||s>e[l].lim));let c=l,d=r;for(;(d=t.parent(d))!==c;)a.push(d);return{path:o.concat(a.reverse()),lca:c}}function fK(t){let e={},n=0;function r(o){let a=n;t.children(o).forEach(r),e[o]={low:a,lim:n++}}return t.children(og).forEach(r),e}function pK(t){let e=md(t,"root",{},"_root"),n=mK(t),r=Object.values(n),o=Ii(Math.max,r)-1,a=2*o+1;t.graph().nestingRoot=e,t.edges().forEach(s=>t.edge(s).minlen*=a);let i=hK(t)+1;t.children(og).forEach(s=>BP(t,e,a,i,o,n,s)),t.graph().nodeRankFactor=a}function BP(t,e,n,r,o,a,i){var s;let l=t.children(i);if(!l.length){i!==e&&t.setEdge(e,i,{weight:0,minlen:n});return}let c=dP(t,"_bt"),d=dP(t,"_bb"),u=t.node(i);t.setParent(c,i),u.borderTop=c,t.setParent(d,i),u.borderBottom=d,l.forEach(f=>{var p;BP(t,e,n,r,o,a,f);let m=t.node(f),h=m.borderTop?m.borderTop:f,g=m.borderBottom?m.borderBottom:f,E=m.borderTop?r:2*r,y=h!==g?1:o-((p=a[i])!=null?p:0)+1;t.setEdge(c,h,{weight:E,minlen:y,nestingEdge:!0}),t.setEdge(g,d,{weight:E,minlen:y,nestingEdge:!0})}),t.parent(i)||t.setEdge(e,c,{weight:0,minlen:o+((s=a[i])!=null?s:0)})}function mK(t){let e={};function n(r,o){let a=t.children(r);a&&a.length&&a.forEach(i=>n(i,o+1)),e[r]=o}return t.children(og).forEach(r=>n(r,1)),e}function hK(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function gK(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}function bK(t){function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let a=o.minRank,i=o.maxRank+1;a<i;++a)mP(t,"borderLeft","_bl",n,o,a),mP(t,"borderRight","_br",n,o,a)}}t.children(og).forEach(e)}function mP(t,e,n,r,o,a){let i={width:0,height:0,rank:a,borderType:e},s=o[e][a-1],l=md(t,"border",i,n);o[e][a]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function xK(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&FP(t)}function wK(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&EK(t),(n==="lr"||n==="rl")&&(SK(t),FP(t))}function FP(t){t.nodes().forEach(e=>hP(t.node(e))),t.edges().forEach(e=>hP(t.edge(e)))}function hP(t){let e=t.width;t.width=t.height,t.height=e}function EK(t){t.nodes().forEach(e=>FE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(FE),Object.hasOwn(r,"y")&&FE(r)})}function FE(t){t.y=-t.y}function SK(t){t.nodes().forEach(e=>YE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(YE),Object.hasOwn(r,"x")&&YE(r)})}function YE(t){let e=t.x;t.x=t.y,t.y=e}function vK(t){let e={},n=t.nodes().filter(s=>!t.children(s).length),r=n.map(s=>t.node(s).rank),o=Ii(Math.max,r),a=Ef(o+1).map(()=>[]);function i(s){if(e[s])return;e[s]=!0;let l=t.node(s);a[l.rank].push(s);let c=t.successors(s);c&&c.forEach(i)}return n.sort((s,l)=>t.node(s).rank-t.node(l).rank).forEach(i),a}function kK(t,e){let n=0;for(let r=1;r<e.length;++r)n+=LK(t,e[r-1],e[r]);return n}function LK(t,e,n){let r=Iq(n,n.map((c,d)=>d)),o=e.flatMap(c=>{let d=t.outEdges(c);return d?d.map(u=>({pos:r[u.w],weight:t.edge(u).weight})).sort((u,f)=>u.pos-f.pos):[]}),a=1;for(;a<n.length;)a<<=1;let i=2*a-1;a-=1;let s=new Array(i).fill(0),l=0;return o.forEach(c=>{let d=c.pos+a;s[d]+=c.weight;let u=0;for(;d>0;)d%2&&(u+=s[d+1]),d=d-1>>1,s[d]+=c.weight;l+=c.weight*u}),l}function NK(t,e=[]){return e.map(n=>{let r=t.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((a,i)=>{let s=t.edge(i),l=t.node(i.v);return{sum:a.sum+s.weight*l.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function MK(t,e){let n={};t.forEach((o,a)=>{let i={indegree:0,in:[],out:[],vs:[o.v],i:a};o.barycenter!==void 0&&(i.barycenter=o.barycenter,i.weight=o.weight),n[o.v]=i}),e.edges().forEach(o=>{let a=n[o.v],i=n[o.w];a!==void 0&&i!==void 0&&(i.indegree++,a.out.push(i))});let r=Object.values(n).filter(o=>!o.indegree);return TK(r)}function TK(t){let e=[];function n(o){return a=>{a.merged||(a.barycenter===void 0||o.barycenter===void 0||a.barycenter>=o.barycenter)&&CK(o,a)}}function r(o){return a=>{a.in.push(o),--a.indegree===0&&t.push(a)}}for(;t.length;){let o=t.pop();e.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return e.filter(o=>!o.merged).map(o=>ng(o,["vs","i","barycenter","weight"]))}function CK(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}function _K(t,e){let n=Aq(t,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,u)=>u.i-d.i),a=[],i=0,s=0,l=0;r.sort(AK(!!e)),l=gP(a,o,l),r.forEach(d=>{l+=d.vs.length,a.push(d.vs),i+=d.barycenter*d.weight,s+=d.weight,l=gP(a,o,l)});let c={vs:a.flat(1)};return s&&(c.barycenter=i/s,c.weight=s),c}function gP(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}function AK(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function YP(t,e,n,r){let o=t.children(e),a=t.node(e),i=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};i&&(o=o.filter(f=>f!==i&&f!==s));let c=NK(t,o);c.forEach(f=>{if(t.children(f.v).length){let p=YP(t,f.v,n,r);l[f.v]=p,Object.hasOwn(p,"barycenter")&&IK(f,p)}});let d=MK(c,n);RK(d,l);let u=_K(d,r);if(i&&s){u.vs=[i,u.vs,s].flat(1);let f=t.predecessors(i);if(f&&f.length){let p=t.node(f[0]),m=t.predecessors(s),h=t.node(m[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+h.order)/(u.weight+2),u.weight+=2}}return u}function RK(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(r=>e[r]?e[r].vs:r)})}function IK(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function PK(t,e,n,r){r||(r=t.nodes());let o=DK(t),a=new Na({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(i=>t.node(i));return r.forEach(i=>{let s=t.node(i),l=t.parent(i);if(s.rank===e||s.minRank<=e&&e<=s.maxRank){a.setNode(i),a.setParent(i,l||o);let c=t[n](i);c&&c.forEach(d=>{let u=d.v===i?d.w:d.v,f=a.edge(u,i),p=f!==void 0?f.weight:0;a.setEdge(u,i,{weight:t.edge(d).weight+p})}),Object.hasOwn(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]})}}),a}function DK(t){let e;for(;t.hasNode(e=jE("_root")););return e}function OK(t,e,n){let r={},o;n.forEach(a=>{let i=t.parent(a),s,l;for(;i;){if(s=t.parent(i),s?(l=r[s],r[s]=i):(l=o,o=i),l&&l!==i){e.setEdge(l,i);return}i=s}})}function zP(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,zP);return}let n=RP(t),r=yP(t,Ef(1,n+1),"inEdges"),o=yP(t,Ef(n-1,-1,-1),"outEdges"),a=vK(t);if(bP(t,a),e.disableOptimalOrderHeuristic)return;let i=Number.POSITIVE_INFINITY,s,l=e.constraints||[];for(let c=0,d=0;d<4;++c,++d){GK(c%2?r:o,c%4>=2,l),a=Sf(t);let u=kK(t,a);u<i?(d=0,s=Object.assign({},a),i=u):u===i&&(s=structuredClone(a))}bP(t,s)}function yP(t,e,n){let r=new Map,o=(a,i)=>{r.has(a)||r.set(a,[]),r.get(a).push(i)};for(let a of t.nodes()){let i=t.node(a);if(typeof i.rank=="number"&&o(i.rank,a),typeof i.minRank=="number"&&typeof i.maxRank=="number")for(let s=i.minRank;s<=i.maxRank;s++)s!==i.rank&&o(s,a)}return e.map(function(a){return PK(t,a,n,r.get(a)||[])})}function GK(t,e,n){let r=new Na;t.forEach(function(o){n.forEach(s=>r.setEdge(s.left,s.right));let a=o.graph().root,i=YP(o,a,r,e);i.vs.forEach((s,l)=>o.node(s).order=l),OK(o,r,i.vs)})}function bP(t,e){Object.values(e).forEach(n=>n.forEach((r,o)=>t.node(r).order=o))}function $K(t,e){let n={};function r(o,a){let i=0,s=0,l=o.length,c=a[a.length-1];return a.forEach((d,u)=>{let f=WK(t,d),p=f?t.node(f).order:l;(f||d===c)&&(a.slice(s,u+1).forEach(m=>{let h=t.predecessors(m);h&&h.forEach(g=>{let E=t.node(g),y=E.order;(y<i||p<y)&&!(E.dummy&&t.node(m).dummy)&&VP(n,g,m)})}),s=u+1,i=p)}),a}return e.length&&e.reduce(r),n}function HK(t,e){let n={};function r(a,i,s,l,c){Ef(i,s).forEach(d=>{let u=a[d];if(u!==void 0&&t.node(u).dummy){let f=t.predecessors(u);f&&f.forEach(p=>{if(p===void 0)return;let m=t.node(p);m.dummy&&(m.order<l||m.order>c)&&VP(n,p,u)})}})}function o(a,i){let s=-1,l=-1,c=0;return i.forEach((d,u)=>{if(t.node(d).dummy==="border"){let f=t.predecessors(d);if(f&&f.length){let p=f[0];if(p===void 0)return;l=t.node(p).order,r(i,c,u,s,l),c=u,s=l}}r(i,c,i.length,l,a.length)}),i}return e.length&&e.reduce(o),n}function WK(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(r=>t.node(r).dummy)}}function VP(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];r||(t[e]=r={}),r[n]=!0}function BK(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];return r!==void 0&&Object.hasOwn(r,n)}function FK(t,e,n,r){let o={},a={},i={};return e.forEach(s=>{s.forEach((l,c)=>{o[l]=l,a[l]=l,i[l]=c})}),e.forEach(s=>{let l=-1;s.forEach(c=>{let d=r(c);if(d&&d.length){let u=d.sort((p,m)=>{let h=i[p],g=i[m];return(h!==void 0?h:0)-(g!==void 0?g:0)}),f=(u.length-1)/2;for(let p=Math.floor(f),m=Math.ceil(f);p<=m;++p){let h=u[p];if(h===void 0)continue;let g=i[h];if(g!==void 0&&a[c]===c&&l<g&&!BK(n,c,h)){let E=o[h];E!==void 0&&(a[h]=c,a[c]=o[c]=E,l=g)}}}})}),{root:o,align:a}}function YK(t,e,n,r,o=!1){let a={},i=zK(t,e,n,o),s=o?"borderLeft":"borderRight";function l(p,m){let h=i.nodes().slice(),g={},E=h.pop();for(;E;){if(g[E])p(E);else{g[E]=!0,h.push(E);for(let y of m(E))h.push(y)}E=h.pop()}}function c(p){let m=i.inEdges(p);m?a[p]=m.reduce((h,g)=>{var E;let y=(E=a[g.v])!=null?E:0,b=i.edge(g);return Math.max(h,y+(b!==void 0?b:0))},0):a[p]=0}function d(p){let m=i.outEdges(p),h=Number.POSITIVE_INFINITY;m&&(h=m.reduce((E,y)=>{let b=a[y.w],S=i.edge(y);return Math.min(E,(b!==void 0?b:0)-(S!==void 0?S:0))},Number.POSITIVE_INFINITY));let g=t.node(p);h!==Number.POSITIVE_INFINITY&&g.borderType!==s&&(a[p]=Math.max(a[p]!==void 0?a[p]:0,h))}function u(p){return i.predecessors(p)||[]}function f(p){return i.successors(p)||[]}return l(c,u),l(d,f),Object.keys(r).forEach(p=>{var m;let h=n[p];h!==void 0&&(a[p]=(m=a[h])!=null?m:0)}),a}function zK(t,e,n,r){let o=new Na,a=t.graph(),i=qK(a.nodesep,a.edgesep,r);return e.forEach(s=>{let l;s.forEach(c=>{let d=n[c];if(d!==void 0){if(o.setNode(d),l!==void 0){let u=n[l];if(u!==void 0){let f=o.edge(u,d);o.setEdge(u,d,Math.max(i(t,c,l),f||0))}}l=c}})}),o}function VK(t,e){return Object.values(e).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,l])=>{let c=KK(t,s)/2;o=Math.max(l+c,o),a=Math.min(l-c,a)});let i=o-a;return i<n[0]&&(n=[i,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function UK(t,e){let n=Object.values(e),r=Ii(Math.min,n),o=Ii(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(i=>{let s=a+i,l=t[s];if(!l||l===e)return;let c=Object.values(l),d=r-Ii(Math.min,c);i!=="l"&&(d=o-Ii(Math.max,c)),d&&(t[s]=rg(l,u=>u+d))})})}function XK(t,e=void 0){let n=t.ul;return n?rg(n,(r,o)=>{var a,i;if(e){let l=e.toLowerCase(),c=t[l];if(c&&c[o]!==void 0)return c[o]}let s=Object.values(t).map(l=>{let c=l[o];return c!==void 0?c:0}).sort((l,c)=>l-c);return(((a=s[1])!=null?a:0)+((i=s[2])!=null?i:0))/2}):{}}function jK(t){let e=Sf(t),n=Object.assign($K(t,e),HK(t,e)),r={},o;["u","d"].forEach(i=>{o=i==="u"?e:Object.values(e).reverse(),["l","r"].forEach(s=>{s==="r"&&(o=o.map(d=>Object.values(d).reverse()));let l=FK(t,o,n,d=>(i==="u"?t.predecessors(d):t.successors(d))||[]),c=YK(t,o,l.root,l.align,s==="r");s==="r"&&(c=rg(c,d=>-d)),r[i+s]=c})});let a=VK(t,r);return UK(r,a),XK(r,t.graph().align)}function qK(t,e,n){return(r,o,a)=>{let i=r.node(o),s=r.node(a),l=0,c;if(l+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":c=-i.width/2;break;case"r":c=i.width/2;break}if(c&&(l+=n?c:-c),c=void 0,l+=(i.dummy?e:t)/2,l+=(s.dummy?e:t)/2,l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=s.width/2;break;case"r":c=-s.width/2;break}return c&&(l+=n?c:-c),l}}function KK(t,e){return t.node(e).width}function ZK(t){t=_P(t),QK(t),Object.entries(jK(t)).forEach(([e,n])=>t.node(e).x=n)}function QK(t){let e=Sf(t),n=t.graph(),r=n.ranksep,o=n.rankalign,a=0;e.forEach(i=>{let s=i.reduce((l,c)=>{var d;let u=(d=t.node(c).height)!=null?d:0;return l>u?l:u},0);i.forEach(l=>{let c=t.node(l);o==="top"?c.y=a+c.height/2:o==="bottom"?c.y=a+s-c.height/2:c.y=a+s/2}),a+=s+r})}function JK(t,e={}){let n=e.debugTiming?IP:PP;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>c7(t));return n(" runLayout",()=>t7(r,n,e)),n(" updateInputGraph",()=>e7(t,r)),r})}function t7(t,e,n){e(" makeSpaceForEdgeLabels",()=>d7(t)),e(" removeSelfEdges",()=>x7(t)),e(" acyclic",()=>Yq(t)),e(" nestingGraph.run",()=>pK(t)),e(" rank",()=>aK(_P(t))),e(" injectEdgeLabelProxies",()=>u7(t)),e(" removeEmptyRanks",()=>Cq(t)),e(" nestingGraph.cleanup",()=>gK(t)),e(" normalizeRanks",()=>Tq(t)),e(" assignRankMinMax",()=>f7(t)),e(" removeEdgeLabelProxies",()=>p7(t)),e(" normalize.run",()=>Uq(t)),e(" parentDummyChains",()=>cK(t)),e(" addBorderSegments",()=>yK(t)),e(" order",()=>zP(t,n)),e(" insertSelfEdges",()=>w7(t)),e(" adjustCoordinateSystem",()=>xK(t)),e(" position",()=>ZK(t)),e(" positionSelfEdges",()=>E7(t)),e(" removeBorderNodes",()=>b7(t)),e(" normalize.undo",()=>jq(t)),e(" fixupEdgeLabelCoords",()=>g7(t)),e(" undoCoordinateSystem",()=>wK(t)),e(" translateGraph",()=>m7(t)),e(" assignNodeIntersects",()=>h7(t)),e(" reversePoints",()=>y7(t)),e(" acyclic.undo",()=>Vq(t))}function e7(t,e){t.nodes().forEach(n=>{let r=t.node(n),o=e.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,e.children(n).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(n=>{let r=t.edge(n),o=e.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function c7(t){let e=new Na({multigraph:!0,compound:!0}),n=VE(t.graph());return e.setGraph(Object.assign({},r7,zE(n,n7),ng(n,o7))),t.nodes().forEach(r=>{let o=VE(t.node(r)),a=zE(o,a7);Object.keys(xP).forEach(s=>{a[s]===void 0&&(a[s]=xP[s])}),e.setNode(r,a);let i=t.parent(r);i!==void 0&&e.setParent(r,i)}),t.edges().forEach(r=>{let o=VE(t.edge(r));e.setEdge(r,Object.assign({},s7,zE(o,i7),ng(o,l7)))}),e}function d7(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function u7(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let r=t.node(e.v),o={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};md(t,"edge-proxy",o,"_ep")}})}function f7(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}function p7(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let r=n;t.edge(r.e).labelRank=n.rank,t.removeNode(e)}})}function m7(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,a=t.graph(),i=a.marginx||0,s=a.marginy||0;function l(c){let d=c.x,u=c.y,f=c.width,p=c.height;e=Math.min(e,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,u-p/2),o=Math.max(o,u+p/2)}t.nodes().forEach(c=>l(t.node(c))),t.edges().forEach(c=>{let d=t.edge(c);Object.hasOwn(d,"x")&&l(d)}),e-=i,r-=s,t.nodes().forEach(c=>{let d=t.node(c);d.x-=e,d.y-=r}),t.edges().forEach(c=>{let d=t.edge(c);d.points.forEach(u=>{u.x-=e,u.y-=r}),Object.hasOwn(d,"x")&&(d.x-=e),Object.hasOwn(d,"y")&&(d.y-=r)}),a.width=n-e+i,a.height=o-r+s}function h7(t){t.edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),a,i;n.points?(a=n.points[0],i=n.points[n.points.length-1]):(n.points=[],a=o,i=r),n.points.unshift(cP(r,a)),n.points.push(cP(o,i))})}function g7(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function y7(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function b7(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),i=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(i.x-a.x),n.height=Math.abs(o.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function x7(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function w7(t){Sf(t).forEach(e=>{let n=0;e.forEach((r,o)=>{let a=t.node(r);a.order=o+n,(a.selfEdges||[]).forEach(i=>{md(t,"selfedge",{width:i.label.width,height:i.label.height,rank:a.rank,order:o+ ++n,e:i.e,label:i.label},"_se")}),delete a.selfEdges})})}function E7(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let r=n,o=t.node(r.e.v),a=o.x+o.width/2,i=o.y,s=n.x-a,l=o.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],r.label.x=n.x,r.label.y=n.y}})}function zE(t,e){return rg(ng(t,e),Number)}function VE(t){let e={};return t&&Object.entries(t).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=r}),e}function S7(t){let e=Sf(t),n=new Na({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+t.node(r).rank)}),t.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),e.forEach((r,o)=>{let a="layer"+o;n.setNode(a,{rank:"same"}),r.reduce((i,s)=>(n.setEdge(i,s,{style:"invis"}),s))}),n}var wP,tq,eq,nq,EP,rq,SP,Na,aq,vP,XE,dq,LP,pq,yq,eg,AP,Rq,og,Pq,Dq,Gq,$q,DP,Jq,tK,eK,aK,sK,cK,yK,n7,r7,o7,a7,xP,i7,s7,l7,v7,er,ls=st(()=>{"use strict";wP=Object.defineProperty,tq=(t,e,n)=>e in t?wP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eq=(t,e)=>{for(var n in e)wP(t,n,{get:e[n],enumerable:!0})},nq=(t,e,n)=>tq(t,typeof e!="symbol"?e+"":e,n),EP={};eq(EP,{Graph:()=>Na,alg:()=>XE,json:()=>vP,version:()=>aq});rq=Object.defineProperty,SP=(t,e)=>{for(var n in e)rq(t,n,{get:e[n],enumerable:!0})},Na=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let r of this.successors(t))n.add(r);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,a])=>{t(o)&&e.setNode(o,a)}),Object.values(this._edgeObjs).forEach(o=>{e.hasNode(o.v)&&e.hasNode(o.w)&&e.setEdge(o,this.edge(o))});let n={},r=o=>{let a=this.parent(o);return!a||e.hasNode(a)?(n[o]=a??void 0,a??void 0):a in n?n[a]:r(a)};return this._isCompound&&e.nodes().forEach(o=>e.setParent(o,r(o))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,r)=>(e!==void 0?this.setEdge(n,r,e):this.setEdge(n,r),r)),this}setEdge(t,e,n,r){let o,a,i,s,l=!1;typeof t=="object"&&t!==null&&"v"in t?(o=t.v,a=t.w,i=t.name,arguments.length===2&&(s=e,l=!0)):(o=t,a=e,i=r,arguments.length>2&&(s=n,l=!0)),o=""+o,a=""+a,i!==void 0&&(i=""+i);let c=wf(this._isDirected,o,a,i);if(c in this._edgeLabels)return l&&(this._edgeLabels[c]=s),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(a),this._edgeLabels[c]=l?s:this._defaultEdgeLabelFn(o,a,i);let d=oq(this._isDirected,o,a,i);return o=d.v,a=d.w,Object.freeze(d),this._edgeObjs[c]=d,sP(this._preds[a],o),sP(this._sucs[o],a),this._in[a][c]=d,this._out[o][c]=d,this._edgeCount++,this}edge(t,e,n){let r=arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(t,e,n){let r=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof r!="object"?{label:r}:r}hasEdge(t,e,n){return(arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let r=arguments.length===1?WE(this._isDirected,t):wf(this._isDirected,t,e,n),o=this._edgeObjs[r];if(o){let a=o.v,i=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],lP(this._preds[i],a),lP(this._sucs[a],i),delete this._in[i][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let r=Object.values(t);return n?r.filter(o=>o.v===e&&o.w===n||o.v===n&&o.w===e):r}};aq="4.0.1",vP={};SP(vP,{read:()=>cq,write:()=>iq});XE={};SP(XE,{CycleException:()=>eg,bellmanFord:()=>kP,components:()=>fq,dijkstra:()=>tg,dijkstraAll:()=>hq,findCycles:()=>gq,floydWarshall:()=>bq,isAcyclic:()=>wq,postorder:()=>Sq,preorder:()=>vq,prim:()=>kq,shortestPaths:()=>Lq,tarjan:()=>NP,topsort:()=>MP});dq=()=>1;LP=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,r=String(t);if(!(r in n)){let o=this._arr,a=o.length;return n[r]=a,o.push({key:r,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let r=this._arr[n].priority;if(e>r)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${r} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,r=n+1,o=t;n<e.length&&(o=e[n].priority<e[o].priority?n:o,r<e.length&&(o=e[r].priority<e[o].priority?r:o),o!==t&&(this._swap(t,o),this._heapify(o)))}_decrease(t){let e=this._arr,n=e[t].priority,r;for(;t!==0&&(r=t>>1,!(e[r].priority<n));)this._swap(t,r),t=r}_swap(t,e){let n=this._arr,r=this._keyIndices,o=n[t],a=n[e];n[t]=a,n[e]=o,r[a.key]=t,r[o.key]=e}},pq=()=>1;yq=()=>1;eg=class extends Error{constructor(...t){super(...t)}};AP=65535;Rq=0;og="\0",Pq="3.0.0",Dq=class{constructor(){nq(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return uP(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&uP(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,Oq)),n=n._prev;return"["+t.join(", ")+"]"}};Gq=Dq,$q=()=>1;DP=qq;({preorder:Jq,postorder:tK}=XE),eK=Vl;Vl.initLowLimValues=ZE;Vl.initCutValues=KE;Vl.calcCutValue=OP;Vl.leaveEdge=$P;Vl.enterEdge=HP;Vl.exchangeEdges=WP;aK=iK;sK=qE;cK=dK;yK=bK;n7=["nodesep","edgesep","ranksep","marginx","marginy"],r7={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},o7=["acyclicer","ranker","rankdir","align","rankalign"],a7=["width","height","rank"],xP={width:0,height:0},i7=["minlen","weight","width","height","labeloffset"],s7={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},l7=["labelpos"];v7={graphlib:EP,version:Pq,layout:JK,debug:S7,util:{time:IP,notime:PP}},er=v7;});var t1={};ye(t1,{layoutSitemap:()=>P7});function XP(t,e,n,r,o,a){let i=o-t,s=a-e;if(i===0&&s===0)return{x:t,y:e};let l=n/2,c=r/2,d=i!==0?l/Math.abs(i):1/0,u=s!==0?c/Math.abs(s):1/0,f=Math.min(d,u);return{x:t+i*f,y:e+s*f}}function C7(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function _7(t,e,n){let r=_t(t,k7);for(let[o,a]of Object.entries(e)){let i=_t(`${o}: ${a}`,UP);i>r&&(r=i)}if(n)for(let o of n){let a=_t(o,UP);a>r&&(r=a)}return Math.max(JP,Math.ceil(r)+QP*2)}function A7(t,e=0){let r=Object.keys(t).length+e;return r===0?jP+qP:jP+M7+r*N7+qP}function ZP(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n,t.isContainer)}function I7(t,e){let n=[];for(let r of t){if(r.entries.length===0)continue;let o=e?.get(qt(r.name)),a=o?r.entries.filter(u=>o.has(u.value.toLowerCase())):r.entries;if(a.length===0)continue;let i=We(r.name,sr)+po,s=i,l=0;for(let u of a)l+=wr*2+Nr+We(u.value,Vn)+Kr;let c=Mo+Ei,d=Rn*2+i+4+c+l;n.push({name:r.name,...r.alias!==void 0&&{alias:r.alias},entries:a.map(u=>({value:u.value,color:u.color})),x:0,y:0,width:d,height:Se,minifiedWidth:s,minifiedHeight:Se})}return n}function JE(t,e,n,r,o,a){for(let i of t){let s=C7(i.metadata,o);if(i.isContainer){let l=Object.keys(s).length,c=tD+l*eD;a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:Math.max(JP,_t(i.label,L7)+QP*2),height:c+QE}),JE(i.children,i.id,n,r,o,a)}else a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:_7(i.label,s,i.description),height:A7(s,i.description?.length??0)}),i.children.length>0&&JE(i.children,e,i.id,r,o,a)}}function P7(t,e,n,r,o){if(t.roots.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let a=[],i=k=>{a.push(k);for(let N of k.children)i(N)};for(let k of t.roots)i(k);Ea(a,t.tagGroups,k=>k.isContainer);let s=[];JE(t.roots,null,null,e,r,s);let l=new Map;for(let k of s)l.set(k.sitemapNode.id,k);let c=new er.graphlib.Graph({compound:!0,multigraph:!0});c.setGraph({rankdir:t.direction,nodesep:50,ranksep:60,edgesep:30,marginx:Ul,marginy:Ul}),c.setDefaultEdgeLabel(()=>({}));let d=new Set,u=new Set,f=new Set;for(let k of s)k.sitemapNode.isContainer?(d.add(k.sitemapNode.id),(e?.get(k.sitemapNode.id)??0)>0&&f.add(k.sitemapNode.id)):u.add(k.sitemapNode.id);let p=0,m=0;for(let k of s)k.sitemapNode.isContainer||(k.width>p&&(p=k.width),k.height>m&&(m=k.height));for(let k of s){let N=k.sitemapNode;if(N.isContainer)if(f.has(N.id)){let _=Math.max(k.width,p),T=Math.max(k.height,m);c.setNode(N.id,{label:N.label,width:_,height:T})}else c.setNode(N.id,{label:N.label,paddingLeft:KP,paddingRight:KP,paddingTop:T7,paddingBottom:QE});else c.setNode(N.id,{label:N.label,width:k.width,height:k.height})}for(let k of s)k.parentContainerId&&!f.has(k.parentContainerId)&&c.setParent(k.sitemapNode.id,k.parentContainerId);let h=new Set;for(let k of d)f.has(k)||h.add(k);let g=[];for(let k=0;k<t.edges.length;k++){let N=t.edges[k];if(!(!c.hasNode(N.sourceId)||!c.hasNode(N.targetId))){if(h.has(N.sourceId)||h.has(N.targetId)){g.push(k);continue}c.setEdge(N.sourceId,N.targetId,{label:N.label??"",minlen:1},`e${k}`)}}er.layout(c);let E=[],y=[];for(let k of s){let N=k.sitemapNode;if(N.isContainer)continue;let _=c.node(N.id);if(!_)continue;let T=e?.get(N.id),R=ZP(N,t.tagGroups,n??null);E.push({id:N.id,label:N.label,metadata:k.meta,tagMetadata:k.fullMeta,...N.description!==void 0&&{description:[...N.description]},isContainer:!1,lineNumber:N.lineNumber,...R!==void 0&&{color:R},x:_.x,y:_.y-_.height/2,width:_.width,height:_.height,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}for(let k of s){let N=k.sitemapNode;if(!N.isContainer)continue;let _=c.node(N.id),T=e?.get(N.id),R=Object.keys(k.meta).length,G=tD+R*eD,I=ZP(N,t.tagGroups,n??null);if(_)y.push({nodeId:N.id,label:N.label,lineNumber:N.lineNumber,...I!==void 0&&{color:I},metadata:k.meta,tagMetadata:k.fullMeta,x:_.x-_.width/2,y:_.y-_.height/2,width:_.width,height:_.height,labelHeight:G,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}});else{let H=f.has(N.id),O=H?Math.max(k.width,p):k.width,D=H?k.height:G+QE,W=H?Math.max(D,m):D;y.push({nodeId:N.id,label:N.label,lineNumber:N.lineNumber,...I!==void 0&&{color:I},metadata:k.meta,tagMetadata:k.fullMeta,x:Ul,y:Ul,width:O,height:W,labelHeight:G,...T!==void 0&&{hiddenCount:T},...(N.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}}let b=new Set(g),S=[];for(let k=0;k<t.edges.length;k++){let N=t.edges[k];if(!c.hasNode(N.sourceId)||!c.hasNode(N.targetId))continue;let _;if(b.has(k)){let T=c.node(N.sourceId),R=c.node(N.targetId);if(!T||!R)continue;let G=XP(T.x,T.y,T.width,T.height,R.x,R.y),I=XP(R.x,R.y,R.width,R.height,T.x,T.y),H=(G.x+I.x)/2,O=(G.y+I.y)/2;_=[G,{x:H,y:O},I]}else{let T=c.edge({v:N.sourceId,w:N.targetId,name:`e${k}`});if(!T)continue;_=T.points??[]}S.push({sourceId:N.sourceId,targetId:N.targetId,points:_,...N.label!==void 0&&{label:N.label},lineNumber:N.lineNumber,...b.has(k)&&{deferred:!0}})}{let k=new Set([...u,...f]),N=new Map;for(let O of k)N.set(O,O);let _=O=>{for(;N.get(O)!==O;)N.set(O,N.get(N.get(O))),O=N.get(O);return O},T=(O,D)=>{let W=_(O),z=_(D);W!==z&&N.set(W,z)};for(let O of t.edges)k.has(O.sourceId)&&k.has(O.targetId)&&T(O.sourceId,O.targetId);let R=s.find(O=>!O.sitemapNode.isContainer)?.sitemapNode.id,G=R?_(R):null,I=new Set;for(let O of k)G&&_(O)!==G&&I.add(O);let H=new Set;for(let O of d){if(f.has(O)){I.has(O)&&H.add(O);continue}let D=s.filter(W=>!W.sitemapNode.isContainer&&W.parentContainerId===O);D.length>0&&D.every(W=>I.has(W.sitemapNode.id))&&H.add(O)}if(I.size>0){let O=t.direction==="TB",D=0,W=0,z=1/0,P=1/0;for(let K of E)I.has(K.id)||(D=Math.max(D,K.x+K.width/2),W=Math.max(W,K.y+K.height),z=Math.min(z,K.y),P=Math.min(P,K.x-K.width/2));for(let K of y)H.has(K.nodeId)||(D=Math.max(D,K.x+K.width),W=Math.max(W,K.y+K.height),z=Math.min(z,K.y),P=Math.min(P,K.x));let B=1/0,Y=1/0,V=0,j=0;for(let K of E)I.has(K.id)&&(B=Math.min(B,K.x-K.width/2),Y=Math.min(Y,K.y),V=Math.max(V,K.x+K.width/2),j=Math.max(j,K.y+K.height));for(let K of y)H.has(K.nodeId)&&(B=Math.min(B,K.x),Y=Math.min(Y,K.y),V=Math.max(V,K.x+K.width),j=Math.max(j,K.y+K.height));if(B!==1/0){let K=R7*2,$,U;if(O?($=D+K-B,U=(z===1/0?0:z)-Y):($=(P===1/0?0:P)-B,U=W+K-Y),$!==0||U!==0){for(let X of E)I.has(X.id)&&(X.x+=$,X.y+=U);for(let X of y)H.has(X.nodeId)&&(X.x+=$,X.y+=U);for(let X of S){let q=I.has(X.sourceId),et=I.has(X.targetId);if(q||et)for(let tt of X.points)tt.x+=$,tt.y+=U}}}}}let x=0,L=0;for(let k of E){let N=k.x+k.width/2,_=k.y+k.height;N>x&&(x=N),_>L&&(L=_)}for(let k of y){let N=k.x+k.width,_=k.y+k.height;N>x&&(x=N),_>L&&(L=_)}for(let k of S)for(let N of k.points)N.x>x&&(x=N.x),N.y>L&&(L=N.y);x+=Ul,L+=Ul;let v=new Map;for(let k of t.tagGroups){let N=qt(k.name),_=new Set,T=R=>{!R.isContainer&&R.metadata[N]&&_.add(R.metadata[N].toLowerCase());for(let G of R.children)T(G)};for(let R of t.roots)T(R);v.set(N,_)}let A=I7(t.tagGroups,v),C=n!=null?A.filter(k=>k.name.toLowerCase()===n.toLowerCase()):A,M=o&&n==null,w=k=>n!=null||M?k.width:k.minifiedWidth;if(C.length>0){let k=Se+Wn,N=C.reduce((G,I)=>G+w(I),0)+(C.length-1)*Wn,_=N+Ul*2;_>x&&(x=_);let T=(x-N)/2,R=L+Wn;for(let G of C)G.x=T,G.y=R,T+=w(G)+Wn;L+=k}return{nodes:E,edges:S,containers:y,legend:A,width:x,height:L}}var k7,UP,L7,N7,jP,M7,QP,qP,JP,Ul,KP,T7,QE,tD,eD,R7,e1=st(()=>{"use strict";Ke();ls();Ke();Mr();en();k7=13,UP=11,L7=13;N7=16,jP=28,M7=6,QP=20,qP=10,JP=140,Ul=40,KP=24,T7=40,QE=24,tD=28,eD=16;R7=20});function D7(t,e){let n=new Map,r=o=>{for(let a of o)for(let i of e.getChildren(a))n.set(e.getId(i),e.getId(a)),r([i])};return r(t),n}function nD(t,e,n,r){let o=t;for(;;){let a=e.get(o);if(!a)return null;if(n.has(a)&&r.has(a))return a;o=a}}function rD(t,e,n,r,o,a){let i=KI(e,o),s=D7(t,o),l=[];for(let c of n){let d=a.getSource(c),u=a.getTarget(c),f=i.has(d),p=i.has(u);if(f&&p){l.push(a.withEndpoints(c,d,u));continue}if(!f){let m=nD(d,s,i,r);if(!m)continue;d=m}if(!p){let m=nD(u,s,i,r);if(!m)continue;u=m}d!==u&&l.push(a.withEndpoints(c,d,u))}return l}var oD=st(()=>{"use strict";xf()});var sD={};ye(sD,{collapseSitemapTree:()=>G7});function iD(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(iD),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function G7(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=ld(t.roots,e,aD),o=rD(t.roots,n,t.edges,e,aD,O7);return{parsed:{...t,roots:n,edges:o},hiddenCounts:r}}var aD,O7,lD=st(()=>{"use strict";xf();oD();aD={getId:t=>t.id,getChildren:t=>t.children,clone:iD,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer},O7={getSource:t=>t.sourceId,getTarget:t=>t.targetId,withEndpoints:(t,e,n)=>({...t,sourceId:e,targetId:n})}});var uD={};ye(uD,{renderSitemap:()=>dD,renderSitemapForExport:()=>q7});function Y7(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function z7(t,e){return e??t.primary}function V7(t,e,n){return n?Gt(n,nr(t,e),10):Gt(t.surface,t.bg,40)}function U7(t,e){return e??t.textMuted}function dD(t,e,n,r,o,a,i,s,l,c){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let d=i?.width??t.clientWidth,u=i?.height??t.clientHeight;if(d<=0||u<=0)return;let f=Ee.identity(),p=f.aesthetic($7),m=f.text(13),h=f.text(11),g=f.structural(16),E=f.structural(28),y=f.structural(6),b=f.structural(1.5),S=f.structural(1.5),x=f.text(B7),L=f.text(13),v=f.text(11),A=f.structural(16),C=f.structural(28),M=f.text(20),w=f.structural(W7),k=f.structural(6),N=f.aesthetic(F7),_=n.legend.length>0,T=Se+Wn,R=!!e.title&&e.options["no-title"]!=="on",G=!i&&_,I=G&&R,H=I?w:0,O=f.structural(G?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Mo+Ei},d):Se),D=G?O+N:0,W=H+D,z=0,P=!I&&R?w:0,B=n.width,Y=n.height+P;G&&(Y-=T);let V=u-p*2-W-z,j=(d-p*2)/B,K=V/Y,$=Math.min(H7,j,K),U=B*$,X=(d-U)/2,q=p+W,et=Rt(t).append("svg").attr("width",d).attr("height",u).attr("viewBox",`0 0 ${d} ${u}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);f.isBelowFloor&&et.attr("width","100%");let tt=et.append("defs");tt.append("marker").attr("id","sm-arrow").attr("viewBox",`0 0 ${Js} ${Pi}`).attr("refX",Js).attr("refY",Pi/2).attr("markerWidth",Js).attr("markerHeight",Pi).attr("orient","auto").append("polygon").attr("points",`0,0 ${Js},${Pi/2} 0,${Pi}`).attr("fill",r.textMuted);let F=new Set;for(let J of F){let at=`sm-arrow-${J.replace("#","")}`;tt.append("marker").attr("id",at).attr("viewBox",`0 0 ${Js} ${Pi}`).attr("refX",Js).attr("refY",Pi/2).attr("markerWidth",Js).attr("markerHeight",Pi).attr("orient","auto").append("polygon").attr("points",`0,0 ${Js},${Pi/2} 0,${Pi}`).attr("fill",J)}let Q=et.append("g").attr("transform",`translate(${X}, ${q}) scale(${$})`);if(!I&&R){let J=Q.append("text").attr("x",B/2).attr("y",M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",M).attr("font-weight","700").attr("class","sitemap-title chart-title");e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}let ot=G?-T:0,Z=Q.append("g").attr("transform",`translate(0, ${P+ot})`),lt=new Map,nt=new Map;for(let J of e.tagGroups){lt.set(qt(J.name),J.name);for(let at of J.entries)nt.set(`${qt(J.name)}:${at.value.toLowerCase()}`,at.color)}for(let J of n.containers){let at=Z.append("g").attr("transform",`translate(${J.x}, ${J.y})`).attr("class","sitemap-container").attr("data-line-number",String(J.lineNumber));if(J.hasChildren&&at.attr("data-node-toggle",J.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)).attr("aria-label",J.label),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let At=qt(s),rt=J.tagMetadata[At];rt&&at.attr(`data-tag-${At}`,rt.toLowerCase())}let it=V7(r,o,J.color),vt=U7(r,J.color);at.append("rect").attr("x",0).attr("y",0).attr("width",J.width).attr("height",J.height).attr("rx",8).attr("fill",it).attr("stroke",vt).attr("stroke-opacity",.35).attr("stroke-width",S),at.append("text").attr("x",J.width/2).attr("y",C/2+L/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",L).attr("font-weight","bold").text(J.label);let Tt=Object.entries(J.metadata);if(Tt.length>0){let At=Tt.map(([dt])=>lt.get(dt)??dt),pt=10+Math.max(...At.map(dt=>_t(`${dt}: `,v))),ht=C+v-2;for(let dt=0;dt<Tt.length;dt++){let[ut,yt]=Tt[dt],kt=At[dt],Ot=ht+dt*A,Xt=nt.get(`${ut}:${yt.toLowerCase()}`)??r.text;at.append("text").attr("x",10).attr("y",Ot).attr("fill",r.textMuted).attr("font-size",v).text(`${kt}: `),at.append("text").attr("x",pt).attr("y",Ot).attr("fill",Xt).attr("font-size",v).text(yt)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let At=`clip-${J.nodeId}`;at.append("clipPath").attr("id",At).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",8),at.append("rect").attr("y",J.height-k).attr("width",J.width).attr("height",k).attr("fill",vt).attr("clip-path",`url(#${At})`).attr("class","sitemap-collapse-bar")}}for(let J of n.edges){if(J.points.length<2)continue;let at=Z.append("g").attr("class","sitemap-edge-group").attr("data-line-number",String(J.lineNumber)).attr("data-from",J.sourceId).attr("data-to",J.targetId),it=r.textMuted,vt="sm-arrow",At=(J.deferred?j7:X7)(J.points);if(At&&at.append("path").attr("d",At).attr("fill","none").attr("stroke",it).attr("stroke-width",b).attr("marker-end",`url(#${vt})`).attr("class","sitemap-edge"),J.label&&J.points.length>=2){let rt=J.points[Math.floor(J.points.length/2)],pt=_t(J.label,x)+10,ht=x+6;at.append("rect").attr("x",rt.x-pt/2).attr("y",rt.y-ht/2-1).attr("width",pt).attr("height",ht).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","sitemap-edge-label-bg"),at.append("text").attr("x",rt.x).attr("y",rt.y+4).attr("text-anchor","middle").attr("fill",it).attr("font-size",x).attr("class","sitemap-edge-label").text(J.label)}}for(let J of n.nodes){let at=Z.append("g").attr("transform",`translate(${J.x-J.width/2}, ${J.y})`).attr("class","sitemap-node").attr("data-line-number",String(J.lineNumber)).attr("data-node-id",J.id);if(J.hasChildren&&at.attr("data-node-toggle",J.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let pt=qt(s),ht=J.tagMetadata[pt];ht&&at.attr(`data-tag-${pt}`,ht.toLowerCase())}let it=e.options["solid-fill"]==="on",vt=Y7(r,o,J.color,it),Tt=z7(r,J.color),At=ve(vt,r.textOnFillLight,r.textOnFillDark);od(at,{width:J.width,height:J.height,rx:6,fill:vt,stroke:Tt,strokeWidth:S,label:J.label,labelColor:At,labelFontSize:m,headerHeight:E});let rt=Object.entries(J.metadata);if(rt.length>0){at.append("line").attr("x1",0).attr("y1",E).attr("x2",J.width).attr("y2",E).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let pt=rt.map(([ut])=>lt.get(ut)??ut),dt=10+Math.max(...pt.map(ut=>_t(`${ut}: `,h)));for(let ut=0;ut<rt.length;ut++){let[yt,kt]=rt[ut],Ot=pt[ut],Xt=E+y+(ut+1)*g-4,bt=nt.get(`${yt}:${kt.toLowerCase()}`),Nt=it?At:bt??At;at.append("text").attr("x",10).attr("y",Xt).attr("fill",At).attr("font-size",h).text(`${Ot}:`),at.append("text").attr("x",dt).attr("y",Xt).attr("fill",Nt).attr("font-size",h).text(kt)}}if(J.description&&J.description.length>0){let pt=Object.keys(J.metadata).length,ht=pt>0?E+y+pt*g:E;at.append("line").attr("x1",0).attr("y1",ht).attr("x2",J.width).attr("y2",ht).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let dt=E+y+pt*g;for(let ut=0;ut<J.description.length;ut++){let yt=ea(J.description[ut]),kt=dt+(ut+1)*g-4,Ot=at.append("text").attr("x",10).attr("y",kt).attr("fill",At).attr("font-size",h);gn(Ot,yt,r,h)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let pt=`clip-${J.id}`;at.append("clipPath").attr("id",pt).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",6),at.append("rect").attr("y",J.height-k).attr("width",J.width).attr("height",k).attr("fill",it?At:J.color??r.primary).attr("opacity",.5).attr("clip-path",`url(#${pt})`)}}if(i&&_&&cD(Z,n.legend,r,o,s,void 0,l,c),I){let J=et.append("text").attr("x",d/2).attr("y",p+M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",M).attr("font-weight","700").attr("class","sitemap-title chart-title").style("font-family",It);e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}if(G){let J=et.append("g").attr("class","sitemap-legend-fixed").attr("transform",`translate(0, ${p+H})`);s&&J.attr("data-legend-active",s.toLowerCase()),cD(J,n.legend,r,o,s,d,l,c)}}function cD(t,e,n,r,o,a,i,s){if(e.length===0)return;let l=e.map(p=>({name:p.name,entries:p.entries.map(m=>({value:m.value,color:m.color}))})),c=a!=null,d=c?Mo+Ei:0,u=a??e[0].x+(e[0].width??200),f=fn(t,{groups:l,activeGroup:o??null,mode:s?"export":"preview",capsulePillAddonWidth:d,palette:n,isDark:r,width:u});if(t.selectAll("[data-legend-group]").classed("sitemap-legend-group",!0),c){let p=f.getLayout();if(p.activeCapsule?.addonX!=null){let m=p.activeCapsule,h=qt(m.groupName),g=i?.has(h)??!1,E=t.select(`[data-legend-group="${h}"]`);if(!E.empty()){let y=m.addonX,b=(Se-Mo)/2,S=6,x=E.append("g").attr("class","sitemap-legend-eye").attr("data-legend-visibility",h).style("cursor","pointer").attr("opacity",g?.4:.7);x.append("rect").attr("x",y-S).attr("y",b-S).attr("width",Mo+S*2).attr("height",Mo+S*2).attr("fill","transparent").attr("pointer-events","all"),x.append("path").attr("d",g?Gm:Om).attr("transform",`translate(${y}, ${b})`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}async function q7(t,e,n){let{parseSitemap:r}=await Promise.resolve().then(()=>(ef(),ew)),{layoutSitemap:o}=await Promise.resolve().then(()=>(e1(),t1)),{getPalette:a}=await Promise.resolve().then(()=>(yi(),vx)),i=e==="dark",s=n??(i?a("nord").dark:a("nord").light),l=r(t,s);if(l.error||l.roots.length===0)return"";let c=o(l,void 0,null,void 0,!0),d=20,u=l.title?30:0,f=c.width+d*2,p=c.height+d*2+u,m=document.createElement("div");m.style.width=`${f}px`,m.style.height=`${p}px`,m.style.position="absolute",m.style.left="-9999px",document.body.appendChild(m),dD(m,l,c,s,i,void 0,{width:f,height:p});let h=m.querySelector("svg");if(!h)return document.body.removeChild(m),"";e==="transparent"?h.style.background="none":h.style.background||(h.style.background=s.bg),h.setAttribute("xmlns","http://www.w3.org/2000/svg"),h.style.fontFamily=It;let g=h.outerHTML;return document.body.removeChild(m),g}var $7,H7,W7,Js,Pi,B7,F7,X7,j7,fD=st(()=>{"use strict";Ke();Xn();Eo();on();tn();_o();Qa();en();Mr();Br();To();fr();Oh();$7=20,H7=3,W7=30,Js=10,Pi=7,B7=11,F7=8;X7=Kn().x(t=>t.x).y(t=>t.y).curve(fo),j7=Kn().x(t=>t.x).y(t=>t.y).curve(Qi)});function ag(t){return t.toLowerCase()===K7}var K7,pD=st(()=>{"use strict";K7="archive"});var ED={};ye(ED,{renderKanban:()=>wD,renderKanbanForExport:()=>Z7});function mg(t,e,n){let r=[];for(let o of e){if(n?.includes(o.name.toLowerCase()))continue;let i=t.tags[qt(o.name)]??o.defaultValue;if(!i)continue;let s=o.entries.find(l=>l.value.toLowerCase()===i.toLowerCase());r.push({label:o.name,value:i,...s?.color!==void 0&&{color:s.color}})}return r}function bD(t,e,n){if(!n)return t.color;let r=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!r)return t.color;let a=t.tags[qt(r.name)]??r.defaultValue;return a?r.entries.find(s=>s.value.toLowerCase()===a.toLowerCase())?.color:void 0}function xD(t,e,n,r,o=vf,a=dg,i=ug,s=o1,l=ig,c=sg,d=cg,u=bd,f=yd,p=gd,m=hd,h=fg,g=lg,E=n1,y=kf,b=pg){let x=!!t.title&&t.options["no-title"]!=="on"?a+8:0,L=o+x,v=[],A=0,C=t.columns.filter(N=>!ag(N.name));for(let N of C){if(n?.has(N.id)??!1){v.push({x:0,y:L,width:b,height:0,column:N,cardLayouts:[]});continue}let T=_t(N.name,s),R=[],G=l+c;for(let O of N.cards){let D=_t(O.title,i);T=Math.max(T,D+d*2);let W=mg(O,t.tagGroups,r),z=W.length+O.details.length,P=z>0?f+1+u+z*p:0,B=m+u+P;for(let Y of W){let V=_t(`${Y.label}: ${Y.value}`,h)+d*2;T=Math.max(T,V)}R.push({x:c,y:G,width:0,height:B,card:O}),G+=B+g}let I=Math.max(E,T+c*2);for(let O of R)O.width=I-c*2;let H=G+c;A=Math.max(A,H),v.push({x:0,y:L,width:I,height:H,column:N,cardLayouts:R})}let M=o;for(let N of v)N.x=M,N.height=A,M+=N.width+y;let w=M-y+o,k=L+A+o;return{columns:v,totalWidth:w,totalHeight:k}}function wD(t,e,n,r,o){let a=o?.exportDims,i=o?.activeTagGroup??null,s=o?.onSwimlaneChange,l=o?.collapsedLanes,c=o?.collapsedColumns??new Set(e.columns.filter(F=>F.collapsed).map(F=>F.id)),d=o?.compactMeta??!1,u=e.options["solid-fill"]==="on",f=o?.currentSwimlaneGroup??null,p=f?e.tagGroups.find(F=>F.name.toLowerCase()===f.toLowerCase())??null:null,m=[];d&&(i&&m.push(i.toLowerCase()),f&&m.push(f.toLowerCase()));let h=e.columns.filter(F=>!ag(F.name)),g=Math.max(1,h.length),E=g*n1+(g-1)*kf+2*vf,y=a?.width??t.getBoundingClientRect().width,b=a||y<=0?Ee.identity():Ee.from(y,E),S=b.aesthetic(vf),x=b.aesthetic(kf),L=b.structural(ig),v=b.aesthetic(sg),A=b.structural(n1),C=b.structural(hd),M=b.structural(gd),w=b.structural(yd),k=b.aesthetic(lg),N=b.structural(6),_=b.aesthetic(cg),T=b.aesthetic(bd),R=b.structural(r1),G=b.structural(dg),I=b.text(o1),H=b.text(ug),O=b.text(fg),D=b.text(hD),W=b.structural(gD),z=b.structural(yD),P=b.structural(pg),B=b.structural(a1),Y=b.text(20),V=b.structural(i1),j=b.aesthetic(s1),K=xD(e,n,c,m,S,G,H,I,L,v,_,T,w,M,C,O,k,A,x,P),$=a?.width??K.totalWidth,U=a?.height??K.totalHeight;t.innerHTML="";let X=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",$).attr("height",U).attr("viewBox",`0 0 ${$} ${U}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",It).style("background",n.bg);b.isBelowFloor&&X.attr("width","100%");let q=!!e.title&&e.options["no-title"]!=="on";if(q&&X.append("text").attr("class","chart-title").attr("data-line-number",e.titleLineNumber??0).attr("x",S).attr("y",S+Y).attr("font-size",Y).attr("font-weight","700").attr("fill",n.text).text(e.title),e.tagGroups.length>0){let F=q?We(e.title,Y)+16:0,Q=S+F,ot={groups:e.tagGroups,position:{placement:"top-center",titleRelation:"inline-with-title"},mode:o?.exportMode?"export":"preview"},Z=Tr(ot,$-Q-S),lt=S+(Y-Z)/2,nt=X.append("g").attr("class","kanban-legend").attr("transform",`translate(${Q},${lt})`),at=!!s&&!a?{onGroupRendered:(it,vt,Tt)=>{let At=p?.name.toLowerCase()===it.toLowerCase(),rt=We(it,11),pt=Tt?10+rt+6:8+rt+4,ht=(Se-7)/2,dt=Q7(vt,pt,ht,At,n);dt.append("title").text(`Group by ${it}`),dt.style("cursor","pointer").on("click",ut=>{ut.stopPropagation(),s?.(At?null:it)})}}:void 0;fn(nt,{...ot,palette:n,isDark:r,width:$-Q-S,activeGroup:i??null,...at!==void 0&&{callbacks:at}})}if(p){eZ(X,e,K,p,n,r,i,l,c,m,S,G,V,x,P,L,v,C,T,k,B,j,w,M,I,W,z,D,N,_,R,H,O);return}let et=r?Gt(n.surface,n.bg,50):Gt(n.surface,n.bg,30),tt=r?Gt(n.surface,n.bg,70):Gt(n.surface,n.bg,50);for(let F of K.columns){let Q=F.column,ot=c?.has(Q.id)??!1,Z=X.append("g").attr("class","kanban-column").attr("data-column-id",Q.id).attr("data-line-number",Q.lineNumber),lt=et,nt=Q.color?ie(n,Q.color,r,{solid:u}):tt,J=Q.color?ve(nt,n.textOnFillLight,n.textOnFillDark):n.text;if(ot){Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",P).attr("height",F.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",P).attr("height",L).attr("rx",z).attr("fill",nt),Z.append("text").attr("x",F.x+P/2).attr("y",F.y+L/2+D/2-1).attr("font-size",D).attr("font-weight","bold").attr("fill",Q.color?J:n.textMuted).attr("text-anchor","middle").text(String(Q.cards.length)),Z.append("text").attr("x",F.x+P/2).attr("y",F.y+L+v).attr("font-size",H).attr("font-weight","bold").attr("fill",n.text).attr("text-anchor","middle").attr("writing-mode","tb").text(Q.name);continue}Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",F.width).attr("height",F.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",F.x).attr("y",F.y).attr("width",F.width).attr("height",L).attr("rx",z).attr("fill",nt),Z.append("text").attr("x",F.x+v).attr("y",F.y+L/2+I/2-2).attr("font-size",I).attr("font-weight","bold").attr("fill",J).text(Q.name);{let at=Q.wipLimit!=null&&Q.cards.length>Q.wipLimit,it=Q.wipLimit!=null?`${Q.cards.length}/${Q.wipLimit}`:String(Q.cards.length);Z.append("text").attr("x",F.x+F.width-v).attr("y",F.y+L/2+D/2-1).attr("text-anchor","end").attr("font-size",D).attr("fill",at?n.colors.red:Q.color?J:n.textMuted).attr("font-weight",at?"bold":"normal").text(it)}for(let at of F.cardLayouts){let it=at.card,vt=bD(it,e.tagGroups,i??null),Tt=mg(it,e.tagGroups,m),At=Tt.length>0||it.details.length>0,rt=ie(n,vt??n.primary,r,{solid:u}),pt=vt??n.textMuted,ht=ve(rt,n.textOnFillLight,n.textOnFillDark),dt=Z.append("g").attr("class","kanban-card").attr("data-card-id",it.id).attr("data-line-number",it.lineNumber);if(i){let Ot=qt(i),Xt=it.tags[Ot],bt=e.tagGroups.find(Vt=>Vt.name.toLowerCase()===Ot),Nt=Xt??bt?.defaultValue;Nt&&dt.attr(`data-tag-${Ot}`,Nt.toLowerCase())}let ut=F.x+at.x,yt=F.y+at.y;dt.append("rect").attr("x",ut).attr("y",yt).attr("width",at.width).attr("height",at.height).attr("rx",N).attr("fill",rt).attr("stroke",pt).attr("stroke-width",R);let kt=dt.append("text").attr("x",ut+_).attr("y",yt+T+H).attr("font-size",H).attr("font-weight","500").attr("fill",ht);if(gn(kt,it.title,n,H),At){let Ot=yt+C;dt.append("line").attr("x1",ut).attr("y1",Ot).attr("x2",ut+at.width).attr("y2",Ot).attr("stroke",u?ht:pt).attr("stroke-opacity",.3).attr("stroke-width",1);let Xt=Ot+w+O;for(let bt of Tt){dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",O).attr("fill",ht).text(`${bt.label}: `);let Nt=_t(`${bt.label}: `,O);dt.append("text").attr("x",ut+_+Nt).attr("y",Xt).attr("font-size",O).attr("fill",ht).text(bt.value),Xt+=M}for(let bt of it.details){let Nt=dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",O).attr("fill",ht);gn(Nt,bt,n,O),Xt+=M}}}}}function Z7(t,e,n){let r=Kc(t,n);if(r.error||r.columns.length===0)return"";let o=e==="dark",a=xD(r,n),i=document.createElement("div");return wD(i,r,n,o,{exportDims:{width:a.totalWidth,height:a.totalHeight},exportMode:!0}),i.querySelector("svg")?.outerHTML??""}function Q7(t,e,n,r,o){let a=t.append("g").attr("class","kanban-swimlane-icon").attr("transform",`translate(${e}, ${n})`);a.append("rect").attr("x",-5).attr("y",-5).attr("width",22).attr("height",18).attr("fill","transparent");let i=r?o.primary:o.textMuted,s=r?1:.35,l=[8,12,6],c=2,d=3;for(let u=0;u<l.length;u++)a.append("rect").attr("x",0).attr("y",u*d).attr("width",l[u]).attr("height",c).attr("rx",1).attr("fill",i).attr("opacity",s);return a}function J7(t,e){let n=qt(e.name),r=new Map;for(let a of e.entries)r.set(a.value.toLowerCase(),{laneName:a.value,laneColor:a.color,isFallback:!1,cellsByColumn:{}});let o=`__no_${n}__`;for(let a of t)for(let i of a.cards){let s=i.tags[n]??e.defaultValue,l;s&&r.has(s.toLowerCase())?l=s.toLowerCase():(r.has(o)||r.set(o,{laneName:`No ${e.name}`,isFallback:!0,cellsByColumn:{}}),l=o);let c=r.get(l);(c.cellsByColumn[a.id]??=[]).push(i)}return Array.from(r.values())}function mD(t,e,n,r=yd,o=bd,a=gd,i=hd){let l=mg(t,e,n).length+t.details.length,c=l>0?r+1+o+l*a:0;return i+o+c}function tZ(t,e,n,r,o,a,i=vf,s=dg,l=i1,c=kf,d=pg,u=ig,f=sg,p=hd,m=bd,h=lg,g=a1,E=s1,y=yd,b=gd){let S=t.title&&t.options["no-title"]!=="on"?s+8:0,x=i+S,L=[],v=i+l;for(let N of n.columns){let T=o?.has(N.column.id)??!1?d:N.width;L.push({column:N.column,x:v,width:T}),v+=T+c}let A=v-c+i,C=[],M=x+u+f,w=p+m+h;for(let N of e){if(r?.has(N.laneName)??!1){let H=L.map(O=>({column:O.column,cards:N.cellsByColumn[O.column.id]??[],cardLayouts:[]}));C.push({bucket:N,y:M,height:g,cells:H}),M+=g+E;continue}let T=w,R=[];for(let H of L){let O=o?.has(H.column.id)??!1,D=N.cellsByColumn[H.column.id]??[];if(O){R.push({column:H.column,cards:D,h:0});continue}let W=0;for(let z of D)W+=mD(z,t.tagGroups,a,y,m,b,p)+h;W=Math.max(W-(D.length>0?h:0),0),R.push({column:H.column,cards:D,h:W}),W>T&&(T=W)}let G=Math.max(T,w),I=R.map((H,O)=>{let D=L[O];if(o?.has(D.column.id)??!1)return{column:H.column,cards:H.cards,cardLayouts:[]};let z=[],P=0;for(let B of H.cards){let Y=mD(B,t.tagGroups,a,y,m,b,p);z.push({x:D.x+f,y:M+P,width:D.width-f*2,height:Y,card:B}),P+=Y+h}return{column:H.column,cards:H.cards,cardLayouts:z}});C.push({bucket:N,y:M,height:G,cells:I}),M+=G+E}let k=M-E+f+i;return{columnXs:L,lanes:C,totalWidth:A,totalHeight:k,startY:x}}function eZ(t,e,n,r,o,a,i,s,l,c,d=vf,u=dg,f=i1,p=kf,m=pg,h=ig,g=sg,E=hd,y=bd,b=lg,S=a1,x=s1,L=yd,v=gd,A=o1,C=gD,M=yD,w=hD,k=6,N=cg,_=r1,T=ug,R=fg){let G=e.columns.filter(P=>!ag(P.name)),I=J7(G,r),H=tZ(e,I,n,s,l,c,d,u,f,p,m,h,g,E,y,b,S,x,L,v),O=parseFloat(t.attr("width")||"0"),D=parseFloat(t.attr("height")||"0");H.totalWidth>O&&(t.attr("width",H.totalWidth),t.attr("viewBox",`0 0 ${H.totalWidth} ${Math.max(D,H.totalHeight)}`)),H.totalHeight>D&&(t.attr("height",H.totalHeight),t.attr("viewBox",`0 0 ${Math.max(O,H.totalWidth)} ${H.totalHeight}`));let W=a?Gt(o.surface,o.bg,50):Gt(o.surface,o.bg,30),z=a?Gt(o.surface,o.bg,70):Gt(o.surface,o.bg,50);for(let P of H.columnXs){let B=P.column,Y=l?.has(B.id)??!1,V=t.append("g").attr("class","kanban-column kanban-column-header").attr("data-column-id",B.id).attr("data-line-number",B.lineNumber),j=B.color?ie(o,B.color,a,{solid:e.options["solid-fill"]==="on"}):z;if(V.append("rect").attr("x",P.x).attr("y",H.startY).attr("width",P.width).attr("height",h).attr("rx",M).attr("fill",j),Y)V.append("text").attr("x",P.x+P.width/2).attr("y",H.startY+h/2+w/2-1).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String(B.cards.length));else{V.append("text").attr("x",P.x+g).attr("y",H.startY+h/2+A/2-2).attr("font-size",A).attr("font-weight","bold").attr("fill",o.text).text(B.name);let K=B.wipLimit!=null&&B.cards.length>B.wipLimit,$=B.wipLimit!=null?`${B.cards.length}/${B.wipLimit}`:String(B.cards.length);V.append("text").attr("x",P.x+P.width-g).attr("y",H.startY+h/2+w/2-1).attr("text-anchor","end").attr("font-size",w).attr("fill",K?o.colors.red:o.textMuted).attr("font-weight",K?"bold":"normal").text($)}}for(let P of H.lanes){let B=s?.has(P.bucket.laneName)??!1,Y=t.append("g").attr("class","kanban-lane").attr("data-lane-name",P.bucket.laneName),V=Y.append("g").attr("class","kanban-lane-header").attr("transform",`translate(${d}, ${P.y-g})`);V.append("rect").attr("x",0).attr("y",0).attr("width",f-8).attr("height",P.height+g*2).attr("rx",C).attr("fill",W);let j=10,K=P.cells.reduce(($,U)=>$+U.cards.length,0);if(P.bucket.laneColor&&(V.append("circle").attr("cx",j+4).attr("cy",16).attr("r",4).attr("fill",P.bucket.laneColor),j+=14),B?V.append("text").attr("x",j).attr("y",20).attr("font-size",10).attr("fill",o.textMuted).text(`${P.bucket.laneName} (${K})`):V.append("text").attr("x",j).attr("y",20).attr("font-size",12).attr("font-weight","bold").attr("fill",P.bucket.isFallback?o.textMuted:o.text).text(P.bucket.laneName),B)for(let $ of P.cells){let U=l?.has($.column.id)??!1;if($.cards.length>0){let X=H.columnXs.find(tt=>tt.column.id===$.column.id);if(!X)continue;let q=P.bucket.laneColor?Gt(P.bucket.laneColor,o.bg,a?40:28):Gt(o.textMuted,o.bg,a?28:22),et=U?m-8:X.width-g*2;Y.append("rect").attr("x",X.x+(U?4:g)).attr("y",P.y).attr("width",et).attr("height",18).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+(U?4:g)+et/2).attr("y",P.y+13).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}}if(Y.append("line").attr("x1",d+f).attr("x2",H.totalWidth-d).attr("y1",P.y+P.height+g).attr("y2",P.y+P.height+g).attr("stroke",o.border??o.textMuted).attr("stroke-opacity",.4).attr("stroke-width",1),!B)for(let $ of P.cells){if((l?.has($.column.id)??!1)&&$.cards.length>0){let X=H.columnXs.find(q=>q.column.id===$.column.id);if(X){let q=P.bucket.laneColor?Gt(P.bucket.laneColor,o.bg,a?40:28):Gt(o.textMuted,o.bg,a?28:22);Y.append("rect").attr("x",X.x+4).attr("y",P.y).attr("width",m-8).attr("height",22).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+m/2).attr("y",P.y+16).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}continue}for(let X of $.cardLayouts)nZ(Y,X,e.tagGroups,i,o,a,c,e.options["solid-fill"]==="on",k,N,y,_,T,R,E,L,v)}}}function nZ(t,e,n,r,o,a,i,s,l=6,c=cg,d=bd,u=r1,f=ug,p=fg,m=hd,h=yd,g=gd){let E=e.card,y=bD(E,n,r),b=mg(E,n,i),S=b.length>0||E.details.length>0,x=ie(o,y??o.primary,a,{...s!==void 0&&{solid:s}}),L=y??o.textMuted,v=ve(x,o.textOnFillLight,o.textOnFillDark),A=t.append("g").attr("class","kanban-card").attr("data-card-id",E.id).attr("data-line-number",E.lineNumber);if(r){let k=qt(r),N=n.find(T=>T.name.toLowerCase()===k),_=E.tags[k]??N?.defaultValue;_&&A.attr(`data-tag-${k}`,_.toLowerCase())}let C=e.x,M=e.y;A.append("rect").attr("x",C).attr("y",M).attr("width",e.width).attr("height",e.height).attr("rx",l).attr("fill",x).attr("stroke",L).attr("stroke-width",u);let w=A.append("text").attr("x",C+c).attr("y",M+d+f).attr("font-size",f).attr("font-weight","500").attr("fill",v);if(gn(w,E.title,o,f),S){let k=M+m;A.append("line").attr("x1",C).attr("y1",k).attr("x2",C+e.width).attr("y2",k).attr("stroke",L).attr("stroke-opacity",.3).attr("stroke-width",1);let N=k+h+p;for(let _ of b){A.append("text").attr("x",C+c).attr("y",N).attr("font-size",p).attr("fill",o.textMuted).text(`${_.label}: `);let T=_t(`${_.label}: `,p);A.append("text").attr("x",C+c+T).attr("y",N).attr("font-size",p).attr("fill",v).text(_.value),N+=g}for(let _ of E.details){let T=A.append("text").attr("x",C+c).attr("y",N).attr("font-size",p).attr("fill",o.textMuted);gn(T,_,o,p),N+=g}}}var vf,kf,ig,sg,n1,hd,gd,yd,lg,cg,bd,r1,dg,o1,ug,fg,hD,gD,yD,pg,a1,i1,s1,SD=st(()=>{"use strict";Ke();Xn();on();tn();_o();mh();pD();Mr();To();Br();fr();en();vf=20,kf=16,ig=36,sg=12,n1=200,hd=24,gd=14,yd=4,lg=8,cg=10,bd=6,r1=1.5,dg=30,o1=13,ug=12,fg=10,hD=10,gD=8,yD=8,pg=40,a1=26;i1=140,s1=14});var kD={};ye(kD,{layoutClassDiagram:()=>c1});function lZ(t){let e=t.members.filter(d=>!d.isMethod),n=t.members.filter(d=>d.isMethod),r=t.modifier==="enum",o=_t(t.name,iZ);t.modifier&&(o=Math.max(o,_t(`\xAB${t.modifier}\xBB`,vD)));for(let d of t.members){let u=d.name;d.isMethod?(u+=`(${d.params??""})`,d.type&&(u+=`: ${d.type}`)):d.type&&(u+=`: ${d.type}`),u=`+ ${u}`,o=Math.max(o,_t(u,vD))}let a=Math.max(rZ,o+oZ),i=aZ+(t.modifier?sZ:0),s;if(r){let d=t.members;d.length>0?s=xd*2+d.length*l1+wd:s=wd+xd}else e.length>0?s=xd*2+e.length*l1+wd:s=wd+xd;let l=0;r||(n.length>0?l=xd*2+n.length*l1+wd:l=wd+xd);let c=i+s+l;return{width:a,height:c,headerHeight:i,fieldsHeight:s,methodsHeight:l}}function c1(t,e){if(t.classes.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new er.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,edgesep:20}),n.setDefaultEdgeLabel(()=>({}));let r=new Map;for(let x of t.classes){let L=lZ(x);r.set(x.id,L),n.setNode(x.id,{label:x.name,width:L.width,height:L.height})}for(let x of t.relationships)n.setEdge(x.source,x.target,{label:x.label??""});er.layout(n);let a=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.classes.map(x=>({id:x.id,label:x.name}))),i=Hc(t.classes.map(x=>{let L=n.node(x.id);return{id:x.id,x:L.x,y:L.y,width:L.width,height:L.height}}),a,"TB",e?.collapsedNotes),s=t.classes.map(x=>{let L=n.node(x.id),v=r.get(x.id),A=i.get(x.id);return{...x,x:L.x,y:L.y,width:v.width,height:v.height,headerHeight:v.headerHeight,fieldsHeight:v.fieldsHeight,methodsHeight:v.methodsHeight,...A&&{note:A}}}),l=t.relationships.map(x=>{let L=n.edge(x.source,x.target);return{source:x.source,target:x.target,type:x.type,points:L?.points??[],...x.label!==void 0&&{label:x.label},lineNumber:x.lineNumber}}),c=1/0,d=1/0,u=-1/0,f=-1/0,p=(x,L,v,A)=>{x<c&&(c=x),L<d&&(d=L),v>u&&(u=v),A>f&&(f=A)};for(let x of s)p(x.x-x.width/2,x.y-x.height/2,x.x+x.width/2,x.y+x.height/2),x.note&&!x.note.collapsed&&p(x.x+x.note.x,x.y+x.note.y,x.x+x.note.x+x.note.width,x.y+x.note.y+x.note.height);Number.isFinite(c)||(c=0,d=0,u=0,f=0);let{shiftX:m,shiftY:h}=Ws(c,d),g=m!==0||h!==0,E=g?s.map(x=>({...x,x:x.x+m,y:x.y+h})):s,y=g?l.map(x=>({...x,points:x.points.map(L=>({x:L.x+m,y:L.y+h}))})):l,b=u+m+40,S=f+h+40;return{nodes:E,edges:y,width:b,height:S}}var rZ,oZ,aZ,iZ,vD,sZ,l1,xd,wd,d1=st(()=>{"use strict";ls();en();es();rZ=140,oZ=24,aZ=36,iZ=13,vD=11,sZ=16,l1=18,xd=8,wd=1});var _D={};ye(_D,{renderClassDiagram:()=>CD,renderClassDiagramForExport:()=>LZ});function MD(t,e,n){if(n)return e.textMuted;switch(t){case"interface":return e.colors.blue;case"abstract":return e.colors.purple;case"enum":return e.colors.yellow;default:return e.colors.teal}}function gZ(t,e,n,r,o,a){let i=r??MD(n,t,o);return ie(t,i,e,{...a!==void 0&&{solid:a}})}function yZ(t,e,n,r){return n??MD(e,t,r)}function TD(t){if(t.options?.["no-auto-color"])return[];let e=new Set;for(let n of t.classes)n.color||e.add(n.modifier??"class");return xZ.filter(n=>e.has(n)).map(n=>bZ[n])}function wZ(t){return t??"class"}function ND(t){switch(t){case"public":return"+";case"private":return"-";case"protected":return"#"}}function SZ(t){return t==="implements"||t==="depends"}function vZ(t){switch(t){case"extends":return"cd-arrow-inherit";case"implements":return"cd-arrow-implement";case"composes":return"cd-arrow-compose";case"aggregates":return"cd-arrow-aggregate";case"depends":return"cd-arrow-depend";case"associates":return"cd-arrow-assoc"}}function kZ(t){return t==="composes"||t==="aggregates"}function CD(t,e,n,r,o,a,i,s,l){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let c=i?.width??t.clientWidth,d=i?.height??t.clientHeight;if(c<=0||d<=0)return;let u=Ee.identity(),f=u.aesthetic(u1),p=u.text(dZ),m=u.text(uZ),h=u.text(fZ),g=u.structural(1.5),E=u.structural(1.5),y=u.structural(pZ),b=u.structural(mZ),S=u.structural(hZ),x=u.text(20),L=u.structural(30),v=u.structural(Se),A=TD(e),C=A.length>1,M=!!e.title&&e.options["no-title"]!=="on",w=M?40:0,N=u.aesthetic(8),_=C?v+N:0,T=n.width,R=n.height,G=d-w-_,I=(c-f*2)/T,H=(G-f*2)/R,O=Math.min(cZ,I,H),D=T*O,W=(c-D)/2,z=w+_+f,P=Rt(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It);u.isBelowFloor&&P.attr("width","100%");let B=P.append("defs"),Y=12,V=8;B.append("marker").attr("id","cd-arrow-inherit").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-implement").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1);let j=12,K=8;if(B.append("marker").attr("id","cd-arrow-compose").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-aggregate").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1),B.append("marker").attr("id","cd-arrow-depend").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),B.append("marker").attr("id","cd-arrow-assoc").attr("viewBox",`0 0 ${Y} ${V}`).attr("refX",Y).attr("refY",V/2).attr("markerWidth",Y).attr("markerHeight",V).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${V/2} 0,${V}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),M){let X=P.append("text").attr("class","chart-title").attr("x",c/2).attr("y",L).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",x).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(X.attr("data-line-number",e.titleLineNumber),a&&X.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let $=s!==!1;if(C){let X=[{name:LD,entries:A.map(et=>({value:et.label,color:r.colors[et.colorKey]}))}],q=P.append("g").attr("class","cd-legend").attr("transform",`translate(0,${w})`);fn(q,{groups:X,activeGroup:$?LD:null,mode:l?"export":"preview",palette:r,isDark:o,width:c})}let U=P.append("g").attr("transform",`translate(${W}, ${z}) scale(${O})`);for(let X of n.edges){if(X.points.length<2)continue;let q=U.append("g").attr("class","cd-edge-group").attr("data-line-number",String(X.lineNumber)).attr("data-source",X.source).attr("data-target",X.target),et=r.textMuted,tt=vZ(X.type),F=SZ(X.type),Q=kZ(X.type),ot=EZ(X.points);if(ot){let Z=q.append("path").attr("d",ot).attr("fill","none").attr("stroke",et).attr("stroke-width",g).attr("class","cd-edge");F&&Z.attr("stroke-dasharray","6 3"),Q?Z.attr("marker-start",`url(#${tt})`):Z.attr("marker-end",`url(#${tt})`)}if(X.label){let Z=Math.floor(X.points.length/2),lt=X.points[Z],nt=_t(X.label,h)+8,J=16;q.append("rect").attr("x",lt.x-nt/2).attr("y",lt.y-J/2-1).attr("width",nt).attr("height",J).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","cd-edge-label-bg"),q.append("text").attr("x",lt.x).attr("y",lt.y+4).attr("text-anchor","middle").attr("fill",et).attr("font-size",h).attr("class","cd-edge-label").text(X.label)}}for(let X of n.nodes){let q=U.append("g").attr("transform",`translate(${X.x}, ${X.y})`).attr("class","cd-class").attr("data-line-number",String(X.lineNumber)).attr("data-node-id",X.id).attr("data-cd-type",wZ(X.modifier));a&&q.style("cursor","pointer").on("click",()=>{a(X.lineNumber)});let et=X.width,tt=X.height,F=!!e.options?.["no-auto-color"],ot=C&&!$&&!X.color?r.primary:X.color,Z=e.options?.["solid-fill"]==="on",lt=gZ(r,o,X.modifier,ot,F,Z),nt=yZ(r,X.modifier,ot,F),J=ve(lt,r.textOnFillLight,r.textOnFillDark);q.append("rect").attr("x",-et/2).attr("y",-tt/2).attr("width",et).attr("height",tt).attr("rx",3).attr("ry",3).attr("fill",lt).attr("stroke",nt).attr("stroke-width",E);let at=-tt/2,it=at+X.headerHeight/2;if(X.modifier){let rt=`\xAB${X.modifier}\xBB`;q.append("text").attr("x",0).attr("y",it-6).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).attr("font-style","italic").text(rt),q.append("text").attr("x",0).attr("y",it+10).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").attr("font-style",X.modifier==="abstract"?"italic":"normal").text(X.name)}else q.append("text").attr("x",0).attr("y",it).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").text(X.name);at+=X.headerHeight;let vt=X.modifier==="enum",Tt=X.members.filter(rt=>!rt.isMethod),At=X.members.filter(rt=>rt.isMethod);if(vt){q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5);let rt=at+b;for(let pt of X.members)q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).text(pt.name),rt+=y}else{if(q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),Tt.length>0){let rt=at+b;for(let pt of Tt){let dt=`${ND(pt.visibility)} ${pt.name}`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}if(at+=X.fieldsHeight,q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),At.length>0){let rt=at+b;for(let pt of At){let dt=`${ND(pt.visibility)} ${pt.name}(${pt.params??""})`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+S).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}}if(X.note)if(X.note.collapsed)Mi(q,{x:et/2-Yo-3,y:-tt/2+Yo+3},r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber});else{let[rt,pt,ht,dt]=Li({width:et,height:tt},X.note);ki(q,rt,pt,ht,dt,r),Ni(q,{x:X.note.x,y:X.note.y,width:X.note.width,height:X.note.height},X.note.lines,r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber,interactive:!0})}}}function LZ(t,e,n){let r=Yc(t,n);if(r.error||r.classes.length===0)return"";let o=c1(r),a=e==="dark",l=TD(r).length>1?Se+8:0,c=o.width+u1*2,d=o.height+u1*2+(r.title?40:0)+l;return cd(c,d,u=>(CD(u,r,o,n,a,void 0,{width:c,height:d},!0,!0),dd(u,e)))}var u1,cZ,dZ,uZ,fZ,pZ,mZ,hZ,bZ,xZ,LD,EZ,AD=st(()=>{"use strict";Xn();Eo();on();Qh();Mr();Br();tn();Qu();d1();fr();en();Ti();u1=20,cZ=3,dZ=13,uZ=11,fZ=11,pZ=18,mZ=8,hZ=10;bZ={class:{label:"Class",colorKey:"teal"},abstract:{label:"Abstract",colorKey:"purple"},interface:{label:"Interface",colorKey:"blue"},enum:{label:"Enum",colorKey:"yellow"}},xZ=["class","abstract","interface","enum"];LD="Type";EZ=Kn().x(t=>t.x).y(t=>t.y).curve(fo)});var ID={};ye(ID,{layoutERDiagram:()=>m1});function PZ(t){let e=_t(t.name,MZ);for(let i of t.columns){let s=i.name;i.type&&(s+=`: ${i.type}`);let l=_t(s,TZ);i.constraints.length>0&&(l+=_Z),e=Math.max(e,l)}let n=Math.max(f1,e+NZ),r=p1,o=0;t.columns.length>0&&(o=RZ*2+t.columns.length*AZ+IZ);let a=r+o+(o===0?4:0);return{width:n,height:a,headerHeight:r,columnsHeight:o}}function DZ(t,e){let n=new Map;for(let a of t)n.set(a,new Set);for(let a of e)n.get(a.source)?.add(a.target),n.get(a.target)?.add(a.source);let r=new Set,o=[];for(let a of t){if(r.has(a))continue;let i=[],s=[a];for(;s.length>0;){let l=s.shift();if(!r.has(l)){r.add(l),i.push(l);for(let c of n.get(l)??[])r.has(c)||s.push(c)}}o.push(i)}return o}function OZ(t,e,n){let r=new Map,o=new Map;if(t.length===1){let d=t[0],u=n.get(d.id);return r.set(d.id,{x:u.width/2,y:u.height/2,...u}),{nodePositions:r,edgePoints:o,width:u.width,height:u.height}}let a=new er.graphlib.Graph({multigraph:!0});a.setGraph({rankdir:"LR",nodesep:40,ranksep:80,edgesep:20}),a.setDefaultEdgeLabel(()=>({}));for(let d of t){let u=n.get(d.id);a.setNode(d.id,{width:u.width,height:u.height})}for(let d of e)a.setEdge(d.source,d.target,{label:d.label??""},String(d.lineNumber));er.layout(a);let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of t){let u=a.node(d.id),f=n.get(d.id);i=Math.min(i,u.x-f.width/2),s=Math.min(s,u.y-f.height/2),l=Math.max(l,u.x+f.width/2),c=Math.max(c,u.y+f.height/2)}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));for(let f of u?.points??[])i=Math.min(i,f.x),s=Math.min(s,f.y),l=Math.max(l,f.x),c=Math.max(c,f.y);if(d.label&&(u?.points??[]).length>0){let f=u.points,p=f[Math.floor(f.length/2)],m=(_t(d.label,CZ)+8)/2;i=Math.min(i,p.x-m),l=Math.max(l,p.x+m)}}for(let d of t){let u=a.node(d.id),f=n.get(d.id);r.set(d.id,{x:u.x-i,y:u.y-s,...f})}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));o.set(d.lineNumber,(u?.points??[]).map(f=>({x:f.x-i,y:f.y-s})))}return{nodePositions:r,edgePoints:o,width:Math.max(0,l-i),height:Math.max(0,c-s)}}function GZ(t){if(t.length===0)return[];let e=[...t].sort((l,c)=>{let d=l.compIds.length>1?1:0,u=c.compIds.length>1?1:0;return d!==u?u-d:c.compLayout.height-l.compLayout.height}),n=t.reduce((l,c)=>l+(c.compLayout.width||f1)*(c.compLayout.height||p1),0),r=Math.max(Math.sqrt(n)*1.5,e[0].compLayout.width),o=[],a=0,i=0,s=0;for(let l of e){let c=l.compLayout.width||f1,d=l.compLayout.height||p1;a>0&&a+c>r&&(i+=s+RD,a=0,s=0),o.push({compIds:l.compIds,compLayout:l.compLayout,offsetX:a,offsetY:i}),a+=c+RD,s=Math.max(s,d)}return o}function m1(t,e){if(t.tables.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new Map;for(let C of t.tables)n.set(C.id,PZ(C));let r=DZ(t.tables.map(C=>C.id),t.relationships),o=new Map(t.tables.map(C=>[C.id,C])),a=r.map(C=>{let M=C.map(k=>o.get(k)),w=t.relationships.filter(k=>C.includes(k.source));return{compIds:C,compLayout:OZ(M,w,n)}}),i=GZ(a),s=new Map;for(let C of i)for(let M of C.compIds)s.set(M,C);let l=new Map;for(let C of i)for(let M of C.compLayout.edgePoints.keys())l.set(M,C);let c=t.tables.map(C=>{let M=s.get(C.id),w=M.compLayout.nodePositions.get(C.id);return{...C,x:w.x+M.offsetX+Ed,y:w.y+M.offsetY+Ed,width:w.width,height:w.height,headerHeight:w.headerHeight,columnsHeight:w.columnsHeight}}),d=t.relationships.map(C=>{let M=l.get(C.lineNumber),w=M?.compLayout.edgePoints.get(C.lineNumber)??[];return{source:C.source,target:C.target,cardinality:C.cardinality,points:w.map(k=>({x:k.x+(M?.offsetX??0)+Ed,y:k.y+(M?.offsetY??0)+Ed})),...C.label!==void 0&&{label:C.label},lineNumber:C.lineNumber}}),f=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.tables.map(C=>({id:C.id,label:C.name}))),p=Hc(c.map(C=>({id:C.id,x:C.x,y:C.y,width:C.width,height:C.height})),f,"TB",e?.collapsedNotes),m=c.map(C=>{let M=p.get(C.id);return M?{...C,note:M}:C}),h=1/0,g=1/0,E=-1/0,y=-1/0,b=(C,M,w,k)=>{C<h&&(h=C),M<g&&(g=M),w>E&&(E=w),k>y&&(y=k)};for(let C of m)b(C.x-C.width/2,C.y-C.height/2,C.x+C.width/2,C.y+C.height/2),C.note&&!C.note.collapsed&&b(C.x+C.note.x,C.y+C.note.y,C.x+C.note.x+C.note.width,C.y+C.note.y+C.note.height);for(let C of d)for(let M of C.points)b(M.x,M.y,M.x,M.y);Number.isFinite(h)||(h=0,g=0,E=0,y=0);let{shiftX:S,shiftY:x}=Ws(h,g),L=S!==0||x!==0,v=L?m.map(C=>({...C,x:C.x+S,y:C.y+x})):m,A=L?d.map(C=>({...C,points:C.points.map(M=>({x:M.x+S,y:M.y+x}))})):d;return{nodes:v,edges:A,width:E+S+Ed,height:y+x+Ed}}var f1,NZ,p1,MZ,TZ,CZ,_Z,AZ,RZ,IZ,Ed,RD,h1=st(()=>{"use strict";ls();en();es();f1=140,NZ=24,p1=36,MZ=13,TZ=11,CZ=11,_Z=16,AZ=18,RZ=8,IZ=1,Ed=30,RD=60});function OD(t,e){let n=new Map;if(t.length===0)return n;let r={};for(let f of t)r[f.id]=0;for(let f of e)f.source!==f.target&&(f.cardinality.from==="1"&&f.cardinality.to!=="1"&&(r[f.source]=(r[f.source]??0)+1),f.cardinality.to==="1"&&f.cardinality.from!=="1"&&(r[f.target]=(r[f.target]??0)+1));let o=new Map;for(let f of e)f.source!==f.target&&(f.cardinality.from==="*"&&(o.has(f.source)||o.set(f.source,new Set),o.get(f.source).add(f.target)),f.cardinality.to==="*"&&(o.has(f.target)||o.set(f.target,new Set),o.get(f.target).add(f.source)));let a=new Set;for(let[f,p]of o)p.size>=2&&a.add(f);let i=Object.values(r),s=i.reduce((f,p)=>f+p,0)/i.length,l=i.reduce((f,p)=>f+(p-s)**2,0)/i.length,c=Math.sqrt(l),d=[...i].sort((f,p)=>f-p),u=d.length%2===0?(d[d.length/2-1]+d[d.length/2])/2:d[Math.floor(d.length/2)];for(let f of t){let p=f.id,m=f.columns,h=m.filter(N=>N.constraints.includes("fk")),g=m.filter(N=>N.constraints.includes("pk")&&N.constraints.includes("fk")),E=h.length,y=m.length===0?0:E/m.length,b=r[p]??0,S=f.name.toLowerCase(),x=e.filter(N=>(N.source===p||N.target===p)&&N.source!==N.target),L=e.some(N=>N.source===p&&N.target===p),v=new Set;for(let N of x)v.add(N.source===p?N.target:N.source);if(L&&x.length===0){n.set(p,"self-referential");continue}let A=g.length>=2&&v.size===1,C=y>=.6&&!A,M=g.length>=2&&v.size>=2,w=a.has(p);if(C||M||w){n.set(p,"junction");continue}if(y>=.4&&y<.6&&g.length<2&&!a.has(p)){n.set(p,"ambiguous");continue}if($Z.some(N=>S.endsWith(N))&&m.length<=6&&E<=1&&b>u){n.set(p,"lookup");continue}if(t.length>=6&&b>0&&b>s+1.5*c&&b>=2*s){n.set(p,"hub");continue}if(E>0){n.set(p,"dependent");continue}n.set(p,"core")}return n}var g1,PD,DD,$Z,GD=st(()=>{"use strict";g1={core:"green",dependent:"blue",junction:"red",ambiguous:"purple",lookup:"yellow",hub:"orange","self-referential":"teal",unclassified:"gray"},PD={core:"Core entity",dependent:"Dependent",junction:"Junction / M:M",ambiguous:"Bridge",lookup:"Lookup / Reference",hub:"Hub","self-referential":"Self-referential",unclassified:"Unclassified"},DD=["core","dependent","junction","ambiguous","lookup","hub","self-referential","unclassified"],$Z=["_type","_status","_code","_category"]});var BD={};ye(BD,{renderERDiagram:()=>WD,renderERDiagramForExport:()=>XZ});function VZ(t){switch(t){case"pk":return"\u2666";case"fk":return"\u2192";case"unique":return"\u25C6";case"nullable":return"\u25CB"}}function $D(t,e,n,r,o,a,i=HD,s=1.5){let l=e.x-n.x,c=e.y-n.y,d=Math.sqrt(l*l+c*c);if(d===0)return;let u=l/d,f=c/d,p=-f,m=u,h=s+.5;if(a){let b=e.x-u*15,S=e.y-f*15,x=r==="1"?"1":r==="*"?"*":"0..1";t.append("text").attr("x",b+p*12).attr("y",S+m*12).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",o).attr("font-size",i).text(x);return}let g=14,E=9;if(r==="1"){let y=e.x-u*g,b=e.y-f*g;t.append("line").attr("x1",y+p*E).attr("y1",b+m*E).attr("x2",y-p*E).attr("y2",b-m*E).attr("stroke",o).attr("stroke-width",h)}else if(r==="*"){let S=e.x-u*18,x=e.y-f*18,L=e.x-u*5,v=e.y-f*5;t.append("line").attr("x1",S).attr("y1",x).attr("x2",L+p*E).attr("y2",v+m*E).attr("stroke",o).attr("stroke-width",h),t.append("line").attr("x1",S).attr("y1",x).attr("x2",L-p*E).attr("y2",v-m*E).attr("stroke",o).attr("stroke-width",h),t.append("line").attr("x1",S).attr("y1",x).attr("x2",L).attr("y2",v).attr("stroke",o).attr("stroke-width",h)}else if(r==="?"){let b=g+10+2,S=e.x-u*b,x=e.y-f*b;t.append("circle").attr("cx",S).attr("cy",x).attr("r",5).attr("fill","none").attr("stroke",o).attr("stroke-width",h);let L=e.x-u*g,v=e.y-f*g;t.append("line").attr("x1",L+p*E).attr("y1",v+m*E).attr("x2",L-p*E).attr("y2",v-m*E).attr("stroke",o).attr("stroke-width",h)}}function WD(t,e,n,r,o,a,i,s,l,c){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let d=e.tagGroups.length===0&&n.nodes.every(V=>!V.color),u=8,f=e.tagGroups.length>0,p=d?Se+u:f?Se+u:0,m=!!e.title&&e.options["no-title"]!=="on",h=m?40:0,g=n.width,E=n.height,y=Ee.identity(),b=y.aesthetic(y1),S=y.text(WZ),x=y.text(BZ),L=y.text(HD),v=y.structural(1.5),A=y.structural(1.5),C=y.structural(FZ),M=y.structural(YZ),w=y.structural(zZ),k=y.text(20),N=y.structural(30),_=g+b*2,T=E+h+p+b*2,R,G,I,H,O;if(i){R=i.width??_,G=i.height??T;let V=G-h-p,j=(R-b*2)/g,K=(V-b*2)/E;I=Math.min(HZ,j,K);let $=g*I;H=(R-$)/2,O=h+p+b}else R=_,G=T,I=1,H=b,O=h+p+b;if(R<=0||G<=0)return;let D=Rt(t).append("svg").attr("width",i?R:"100%").attr("height",i?G:"100%").attr("viewBox",`0 0 ${R} ${G}`).attr("preserveAspectRatio","xMidYMid meet").style("font-family",It);if(m){let V=D.append("text").attr("class","chart-title").attr("x",R/2).attr("y",N).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(V.attr("data-line-number",e.titleLineNumber),a&&V.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)}))}let W=D.append("g").attr("transform",`translate(${H}, ${O}) scale(${I})`),z=ir(r),P=d?OD([...e.tables],[...e.relationships]):null,B=P!==null&&(l??!0),Y=e.options.notation==="labels";for(let V of n.edges){if(V.points.length<2)continue;let j=W.append("g").attr("class","er-edge-group").attr("data-line-number",String(V.lineNumber)).attr("data-source",V.source).attr("data-target",V.target),K=r.textMuted,$=UZ(V.points);$&&j.append("path").attr("d",$).attr("fill","none").attr("stroke",K).attr("stroke-width",v).attr("class","er-edge");let U=V.points;if($D(j,U[0],U[1],V.cardinality.from,K,Y,L,v),$D(j,U[U.length-1],U[U.length-2],V.cardinality.to,K,Y,L,v),V.label){let X=Math.floor(U.length/2),q=U[X],et=_t(V.label,L)+8,tt=16;j.append("rect").attr("x",q.x-et/2).attr("y",q.y-tt/2-1).attr("width",et).attr("height",tt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","er-edge-label-bg"),j.append("text").attr("x",q.x).attr("y",q.y+4).attr("text-anchor","middle").attr("fill",K).attr("font-size",L).attr("class","er-edge-label").text(V.label)}}for(let V=0;V<n.nodes.length;V++){let j=n.nodes[V],K=ar(j.metadata,[...e.tagGroups],s??null),$=B?r.colors[g1[P.get(j.id)??"unclassified"]]:P?r.primary:void 0,U=j.color??K??$??z[V%z.length],X=W.append("g").attr("transform",`translate(${j.x}, ${j.y})`).attr("class","er-table").attr("data-line-number",String(j.lineNumber)).attr("data-node-id",j.id);if(s){let lt=qt(s),nt=j.metadata[lt];nt&&X.attr(`data-tag-${lt}`,nt.toLowerCase())}if(P){let lt=P.get(j.id);lt&&X.attr("data-er-role",lt)}a&&X.style("cursor","pointer").on("click",()=>{a(j.lineNumber)});let q=j.width,et=j.height,tt=ie(r,U,o,{solid:e.options["solid-fill"]==="on"}),F=U,Q=ve(tt,r.textOnFillLight,r.textOnFillDark);X.append("rect").attr("x",-q/2).attr("y",-et/2).attr("width",q).attr("height",et).attr("rx",3).attr("ry",3).attr("fill",tt).attr("stroke",F).attr("stroke-width",A);let ot=-et/2,Z=ot+j.headerHeight/2;if(X.append("text").attr("x",0).attr("y",Z).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",Q).attr("font-size",S).attr("font-weight","bold").text(j.name),ot+=j.headerHeight,j.columns.length>0){X.append("line").attr("x1",-q/2).attr("y1",ot).attr("x2",q/2).attr("y2",ot).attr("stroke",F).attr("stroke-width",.5).attr("stroke-opacity",.5);let lt=ot+M;for(let nt of j.columns){let J=-q/2+w,at=nt.constraints[0];at&&X.append("text").attr("x",J).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(VZ(at));let it=-q/2+w+(at?16:0),vt=nt.name;nt.type&&(vt+=`: ${nt.type}`),X.append("text").attr("x",it).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(vt),lt+=C}}if(j.note)if(j.note.collapsed)Mi(X,{x:q/2-Yo-3,y:-et/2+Yo+3},r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber});else{let[lt,nt,J,at]=Li({width:q,height:et},j.note);ki(X,lt,nt,J,at,r),Ni(X,{x:j.note.x,y:j.note.y,width:j.note.width,height:j.note.height},j.note.lines,r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber,interactive:!0})}}if(e.tagGroups.length>0){let V=b+h,j=D.append("g").attr("class","er-tag-legend").attr("transform",`translate(0,${V})`);fn(j,{groups:e.tagGroups,activeGroup:s??null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),j.selectAll("[data-legend-group]").classed("er-legend-group",!0)}if(P){let V=DD.filter(j=>{for(let K of P.values())if(K===j)return!0;return!1});if(V.length>0){let j=b+h,K=[{name:"Role",entries:V.map(U=>({value:PD[U],color:r.colors[g1[U]]}))}],$=D.append("g").attr("class","er-semantic-legend").attr("transform",`translate(0,${j})`);fn($,{groups:K,activeGroup:B?"Role":null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),$.selectAll("[data-legend-group]").classed("er-legend-group",!0)}}}function XZ(t,e,n){let r=zc(t,n);if(r.error||r.tables.length===0)return"";let o=m1(r),a=e==="dark",i=document.createElement("div"),s=o.width+y1*2,l=o.height+y1*2+(r.title&&r.options["no-title"]!=="on"?40:0);i.style.width=`${s}px`,i.style.height=`${l}px`,i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i);try{WD(i,r,o,n,a,void 0,{width:s,height:l},void 0,void 0,!0);let c=i.querySelector("svg");return c?(e==="transparent"&&(c.style.background="none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.fontFamily=It,c.outerHTML):""}finally{document.body.removeChild(i)}}var y1,HZ,WZ,BZ,HD,FZ,YZ,zZ,UZ,FD=st(()=>{"use strict";Ke();Xn();Eo();on();tn();yi();Ke();Mr();Br();fr();en();Ti();Ju();h1();GD();y1=20,HZ=3,WZ=13,BZ=11,HD=11,FZ=18,YZ=8,zZ=10;UZ=Kn().x(t=>t.x).y(t=>t.y).curve(fo)});var qD={};ye(qD,{renderBoxesAndLines:()=>jD,renderBoxesAndLinesForExport:()=>lQ});function oQ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t[r-1],a=t[r],i=r+1<t.length?t[r+1]:"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function hg(t,e,n){let r=e-XD*2,o=t.split(/(\s+|-)/),a=[];for(let s of o)!s||/^\s+$/.test(s)||s==="-"||a.push(...oQ(s));for(let s=qZ;s>=gg;s--){if(r<_t("MM",s))continue;let l=[],c="";for(let p of a){let m=c?`${c} ${p}`:p;_t(m,s)<=r?c=m:(c&&l.push(c),c=p)}c&&l.push(c);let d=p=>_t(p,s)<=r;if(l.length<=n&&l.every(d))return{lines:l,fontSize:s};if(l.length<=n)return{lines:l.map(m=>d(m)?m:tr(m,s,r)),fontSize:s};let u=l.slice(0,n).map(p=>d(p)?p:tr(p,s,r)),f=u[n-1];return f.endsWith("\u2026")||(u[n-1]=tr(f+"\u2026",s,r)),{lines:u,fontSize:s}}return{lines:[tr(t,gg,r)],fontSize:gg}}function aQ(t,e,n,r,o,a,i){let s=Gt(r.bg,r.text,o?90:95);if(a.active){if(t.value===void 0){let g=ve(s,r.textOnFillLight,r.textOnFillDark);return{fill:s,stroke:a.hue,text:g}}let f=a.fillForValue(t.value),p=ie(r,f,o,{...i!==void 0&&{solid:i}}),m=a.twoColor?f:a.hue,h=ve(p,r.textOnFillLight,r.textOnFillDark);return{fill:p,stroke:m,text:h}}let l=ar(t.metadata,[...e],n);if(l){let f=ie(r,l,o,{...i!==void 0&&{solid:i}}),p=l,m=ve(f,r.textOnFillLight,r.textOnFillDark);return{fill:f,stroke:p,text:m}}let c=Gt(r.bg,r.text,o?90:95),d=Gt(r.text,r.bg,o?60:40),u=r.text;return{fill:c,stroke:d,text:u}}function iQ(t,e,n,r){if(Object.keys(t.metadata).length>0&&n!=null){let a=ar(t.metadata,[...e],n);if(a)return a}return r.textMuted}function sQ(t,e){for(let n of e){let r=`bl-arrow-${n.replace("#","")}`;if(!t.select(`#${r}`).empty())continue;t.append("marker").attr("id",r).attr("viewBox",`0 0 ${tl*2} ${Di*2}`).attr("refX",tl*2).attr("refY",Di).attr("markerWidth",tl).attr("markerHeight",Di).attr("orient","auto").append("polygon").attr("points",`0,0 ${tl*2},${Di} 0,${Di*2}`).attr("fill",n);let o=`bl-arrow-rev-${n.replace("#","")}`;t.select(`#${o}`).empty()&&t.append("marker").attr("id",o).attr("viewBox",`0 0 ${tl*2} ${Di*2}`).attr("refX",0).attr("refY",Di).attr("markerWidth",tl).attr("markerHeight",Di).attr("orient","auto").append("polygon").attr("points",`${tl*2},0 0,${Di} ${tl*2},${Di*2}`).attr("fill",n)}}function jD(t,e,n,r,o,a){let{onClickItem:i,exportDims:s,activeTagGroup:l,hiddenTagValues:c,hideDescriptions:d,controlsExpanded:u,onToggleDescriptions:f,onToggleControlsExpand:p,exportMode:m=!1,controlsHost:h,rampDomain:g}=a??{};Rt(t).selectAll(":not([data-d3-tooltip])").remove();let E=s?.width??t.clientWidth,y=s?.height??t.clientHeight;if(E<=0||y<=0)return;let b=Ee.identity(),S=b.aesthetic(jZ),x=b.text(gg),L=b.text(KZ),v=b.structural(1.5),A=b.structural(1.5),C=b.structural(ZZ),M=b.text(YD),w=b.text(JZ),k=b.structural(tQ),N=b.text(20),_=b.structural(30),T=e.nodes.filter(ft=>ft.value!==void 0).map(ft=>ft.value),R=T.length>0,G=g?.min??(R?Math.min(...T):0),I=g?.max??Math.max(...T),H=Dn(e.boxMetricColor??"",r)??r.primary,O=e.boxMetricLowColor?Dn(e.boxMetricLowColor,r)??void 0:void 0,D=o?Gt(r.surface,r.text,28):r.bg,W=Gt(H,D,b1),z=ft=>{let Wt=I>G?(ft-G)/(I-G):1;if(O!==void 0)return em(O,H,Wt,{isDark:o});let he=b1+Math.max(0,Math.min(1,Wt))*(100-b1);return Gt(H,D,he)},P=R?e.boxMetric?.trim()||"Value":null,B=ft=>{let Wt=ft.trim().toLowerCase();if(Wt===""||Wt==="none")return null;let he=e.tagGroups.find(ne=>ne.name.toLowerCase()===Wt);return he?he.name:Wt===P?.toLowerCase()?P:ft},Y=l,V;Y!==void 0?V=Y===null?null:B(Y):e.options["active-tag"]!==void 0?V=B(e.options["active-tag"]):V=P??(e.tagGroups.length>0?e.tagGroups[0].name:null);let j=P!==null&&V===P,K=P!==null?{name:P,entries:[],gradient:{min:G,max:I,low:O??W,high:H}}:null,$=[...K?[K]:[],...e.tagGroups],U=e.nodes.some(ft=>ft.description&&ft.description.length>0),q=$.length>0||U&&h!=="app"?b.structural(Tr({groups:$,position:{placement:"top-center",titleRelation:"below-title"},mode:m?"export":"preview"},E)):0,et=c??e.initialHiddenTagValues,tt=new Map;for(let ft of e.nodes)tt.set(ft.label,ft);let F=new Map;for(let ft of n.nodes)F.set(ft.label,ft);let Q=!!e.title&&e.options["no-title"]!=="on",ot=Q?40:0,Z=e.nodes.some(ft=>ft.description&&ft.description.length>0),nt=$.length>0||Z&&f?q+8:0,J=new Set(n.groups.map(ft=>ft.label)),at=0;for(let ft of e.groups)ft.children.some(Wt=>J.has(Wt))&&(at+=k);let it=n.width,vt=n.height+ot+nt+at,Tt=E/(it+S*2),At=y/(vt+S*2),rt=Math.min(Tt,At,3),pt=0,ht=0;if(e.nodePositions&&e.nodePositions.size>0){let ft=1/0,Wt=1/0,he=-1/0,ne=-1/0,se=(Zt,Ie)=>{Zt<ft&&(ft=Zt),Zt>he&&(he=Zt),Ie<Wt&&(Wt=Ie),Ie>ne&&(ne=Ie)};for(let Zt of n.nodes)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.groups)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.edges)for(let Ie of Zt.points)se(Ie.x,Ie.y);Number.isFinite(ft)&&(pt=(n.width-he-ft)/2,ht=(n.height-ne-Wt)/2)}let dt=(E-it*rt)/2+pt*rt,ut=S+ot+nt+ht*rt,yt=Rt(t).append("svg").attr("width",E).attr("height",y).attr("viewBox",`0 0 ${E} ${y}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It).style("background",r.bg);b.isBelowFloor&&yt.attr("width","100%");let kt=yt.append("defs");Q&&yt.append("text").attr("x",E/2).attr("y",_).attr("text-anchor","middle").attr("font-size",N).attr("font-weight","700").attr("fill",r.text).text(e.title);let Ot=yt.append("g").attr("transform",`translate(${dt},${ut}) scale(${rt})`),Xt=new Set,bt=new Map;for(let ft=0;ft<n.edges.length;ft++){let Wt=iQ(n.edges[ft],e.tagGroups,V,r);Xt.add(Wt),bt.set(ft,Wt)}sQ(kt,Xt);let Nt=[...n.groups].sort((ft,Wt)=>Wt.width*Wt.height-ft.width*ft.height),Vt=new Set(n.groups.map(ft=>ft.label)),xt=new Set;for(let ft of e.groups)for(let Wt of ft.children)Vt.has(Wt)&&xt.add(ft.label);for(let ft of Nt){let Wt=ft.x-ft.width/2,he=!ft.collapsed&&xt.has(ft.label),ne=he?ft.y-ft.height/2-k:ft.y-ft.height/2,se=he?ft.height+k:ft.height,Zt=Ot.append("g").attr("class",ft.collapsed?"bl-group bl-group-collapsed":"bl-group").attr("data-line-number",String(ft.lineNumber)).attr("data-node-id",ft.label).attr("data-group-toggle",ft.label).style("cursor","pointer");if(ft.collapsed){let Ie=nr(r,o),Ht=r.border;Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",Ie).attr("stroke",Ht).attr("stroke-width",A);let Qt=`bl-clip-${ft.label.replace(/[[\]\s]/g,"")}`;Zt.append("clipPath").attr("id",Qt).append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf),Zt.append("rect").attr("x",Wt).attr("y",ne+ft.height-C).attr("width",ft.width).attr("height",C).attr("fill",Ht).attr("clip-path",`url(#${Qt})`).attr("class","bl-collapse-bar");let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=hg(ft.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("class","bl-group-label").attr("x",ft.x).attr("y",ft.y-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",It).attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",r.text).text(fe.lines[ae])}else Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",se).attr("rx",VD).attr("ry",VD).attr("fill",Gt(r.surface,r.bg,40)).attr("stroke",r.textMuted).attr("stroke-width",1).attr("stroke-opacity",.35),Zt.append("text").attr("class","bl-group-label").attr("x",Wt+ft.width/2).attr("y",ne+18).attr("text-anchor","middle").attr("font-family",It).attr("font-size",w).attr("font-weight","600").attr("fill",r.text).text(ft.label)}for(let ft=0;ft<n.edges.length;ft++){let Wt=n.edges[ft],he=bt.get(ft)??r.textMuted;if(et.size>0){let Qt=!1;for(let[Ut,fe]of et){let de=Wt.metadata[Ut];if(de&&fe.has(de.toLowerCase())){Qt=!0;break}}if(Qt)continue}if(Wt.source===Wt.target){let Qt=F.get(Wt.source);if(Qt){let Ut=Ot.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),fe=`bl-arrow-${he.replace("#","")}`,de=Qt.x,te=Qt.y,ae=Qt.width/2,Te=Qt.height/2,Je=20,sn=de+ae,ze=te+Te*.4,Ce=de+ae*.4,ee=te+Te,oe=sn+ae+Je,Be=ze,dn=Ce,_n=ee+Te+Je;Ut.append("path").attr("class","bl-edge").attr("d",`M ${sn} ${ze} C ${oe} ${Be}, ${dn} ${_n}, ${Ce} ${ee}`).attr("fill","none").attr("stroke",he).attr("stroke-width",v).attr("marker-end",`url(#${fe})`)}continue}let ne;if(Wt.yOffset!==0&&Wt.parallelCount>1){let Qt=F.get(Wt.source),Ut=F.get(Wt.target),fe=Qt?.y??Wt.points[0]?.y??0,de=Ut?.y??Wt.points[Wt.points.length-1]?.y??0,te=Wt.points[0]?.x??0,ae=Wt.points[Wt.points.length-1]?.x??0,Te=(te+ae)/2,Je=(fe+de)/2;ne=[{x:te,y:fe},{x:te+(Te-te)*.3,y:fe+Wt.yOffset*.5},{x:Te,y:Je+Wt.yOffset},{x:ae-(ae-Te)*.3,y:de+Wt.yOffset*.5},{x:ae,y:de}]}else ne=Wt.points.map(Qt=>({x:Qt.x,y:Qt.y}));if(ne.length<2)continue;let se=Ot.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),Zt=`bl-arrow-${he.replace("#","")}`,Ie=Wt.straight?rQ:e.direction==="TB"?nQ:eQ,Ht=se.append("path").attr("class","bl-edge").attr("d",Ie(ne)??"").attr("fill","none").attr("stroke",he).attr("stroke-width",v).attr("marker-end",`url(#${Zt})`);if(Wt.bidirectional){let Qt=`bl-arrow-rev-${he.replace("#","")}`;Ht.attr("marker-start",`url(#${Qt})`)}}for(let ft of n.nodes){let Wt=tt.get(ft.label);if(!Wt)continue;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=Wt.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let he=e.options["solid-fill"]==="on",ne=aQ(Wt,e.tagGroups,V,r,o,{active:j,hue:H,twoColor:O!==void 0,fillForValue:z},he),se=he?ne.text:ne.stroke,Zt=Ot.append("g").attr("class","bl-node").attr("transform",`translate(${ft.x},${ft.y})`).attr("data-line-number",Wt.lineNumber).attr("data-node-id",Wt.label).style("cursor",i?"pointer":"default").style("--bl-node-stroke",ne.stroke);for(let[Ut,fe]of Object.entries(Wt.metadata))Zt.attr(`data-tag-${Ut.toLowerCase()}`,fe.toLowerCase());Wt.value!==void 0&&Zt.attr("data-value",Wt.value),i&&Zt.on("click",Ut=>{Ut.target?.closest("a")||i(Wt.lineNumber)});let Ie=-ft.width/2,Ht=-ft.height/2;Zt.append("rect").attr("x",Ie).attr("y",Ht).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",ne.fill).attr("stroke",ne.stroke).attr("stroke-width",A);let Qt=Wt.description;if(Qt&&Qt.length>0&&!d){let fe=hg(Wt.label,ft.width,3),de=fe.lines,te=fe.fontSize*1.3,ae=de.length*te,Te=ae+12,Je=-ft.height/2+Te/2;for(let An=0;An<de.length;An++)Zt.append("text").attr("x",0).attr("y",Je-ae/2+te/2+An*te).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(de[An]);let sn=-ft.height/2+Te;Zt.append("line").attr("x1",-ft.width/2).attr("y1",sn).attr("x2",ft.width/2).attr("y2",sn).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1);let ze=sn+4+M,Ce=ft.width-XD*2,ee=Math.floor(Ce/(M*Bo)),oe=M*QZ,Be=An=>An.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").replace(/https?:\/\/\S+/g,In=>In.slice(0,20)).length,dn=[];for(let An of Qt){let In=An.startsWith("- ")?"\u2022 "+An.slice(2):An;In=In.replace(/\bhttps?\s+([\w][\w.-]+\.[a-z]{2,}(?:\/\S*)?)/gi,(Ar,lr)=>`https://${lr}`),dn.push(In)}let _n=Ko(dn,ee,Be),He=_n.length>zD,Nn=He?_n.slice(0,zD):_n,jn=-ft.width/2+6,xo=jn+10,Sr=Ns(ne.fill)>.5?r.textMuted:Gt(ne.text,ne.fill,75);for(let An=0;An<Nn.length;An++){let In=Nn[An],Ar=In.text;He&&An===Nn.length-1&&(Ar=_t(Ar,M)>=Ce?tr(Ar,M,Ce):Ar+"\u2026");let lr=ze+An*oe;In.kind==="bullet-first"&&Zt.append("text").attr("x",jn).attr("y",lr).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size",M).attr("fill",Sr).text("\u2022");let Vr=In.kind==="bullet-first"||In.kind==="bullet-cont",Zn=Zt.append("text").attr("x",Vr?xo:0).attr("y",lr).attr("text-anchor",Vr?"start":"middle").attr("dominant-baseline","central").attr("font-size",YD).attr("fill",Sr);gn(Zn,Ar,r,M)}if(He){let An=Qt.join(" "),In=An.length>200?An.slice(0,199)+"\u2026":An;Zt.append("title").text(In)}if(e.showValues&&Wt.value!==void 0){let An=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value);Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",ze+Nn.length*oe).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",UD).attr("font-weight","600").attr("fill",ne.text).text(An)}}else if(e.showValues&&Wt.value!==void 0){let Ut=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value),fe=ft.height/2,de=-ft.height/2+fe,te=hg(Wt.label,ft.width,2),ae=te.fontSize*1.3,Te=te.lines.length*ae,Je=-ft.height/2+fe/2;for(let sn=0;sn<te.lines.length;sn++)Zt.append("text").attr("x",0).attr("y",Je-Te/2+ae/2+sn*ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",te.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(te.lines[sn]);Zt.append("line").attr("x1",-ft.width/2).attr("y1",de).attr("x2",ft.width/2).attr("y2",de).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1),Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",(de+ft.height/2)/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",UD).attr("fill",ne.text).attr("opacity",.85).text(Ut)}else{let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=hg(Wt.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("x",0).attr("y",-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",ne.text).text(fe.lines[ae])}if(ft.note)if(ft.note.collapsed)Mi(Zt,{x:ft.width/2-Yo-3,y:-ft.height/2+Yo+3},r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber});else{let[Ut,fe,de,te]=Li({width:ft.width,height:ft.height},ft.note);ki(Zt,Ut,fe,de,te,r),Ni(Zt,{x:ft.note.x,y:ft.note.y,width:ft.note.width,height:ft.note.height},ft.note.lines,r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber,interactive:!0})}}let Lt=Ot.append("g").attr("class","bl-edge-labels"),Dt=L*1.3;for(let ft of n.edges){if(!ft.labelLines||ft.labelLines.length===0||ft.labelX===void 0||ft.labelY===void 0)continue;let Wt=ft.labelX,he=ft.labelY;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=ft.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ne=ft.labelWidth??0,se=ft.labelHeight??L+6,Zt=ft.labelLines,Ie=Lt.append("g").attr("class","bl-edge-label").attr("data-line-number",String(ft.lineNumber));Ie.append("rect").attr("x",Wt-ne/2).attr("y",he-se/2).attr("width",ne).attr("height",se).attr("rx",3).attr("fill",r.bg).attr("opacity",.72);let Ht=Ie.append("text").attr("x",Wt).attr("text-anchor","middle").attr("font-family",It).attr("font-size",L).attr("fill",r.textMuted),Qt=he-(Zt.length-1)/2*Dt+L/3;Zt.forEach((Ut,fe)=>{Ht.append("tspan").attr("x",Wt).attr("y",Qt+fe*Dt).text(Ut)})}let zt=e.nodes.some(ft=>ft.description&&ft.description.length>0);if($.length>0||zt&&h!=="app"){let ft;zt&&(f||h==="app")&&(ft={toggles:[{id:"descriptions",type:"toggle",label:"Descriptions",active:!d,onToggle:()=>{}}]});let Wt={...p!==void 0&&{onControlsExpand:p},onControlsToggle:(ne,se)=>{ne==="descriptions"&&f&&f(se)}},he=yt.append("g").attr("transform",`translate(0,${ot+4})`);fn(he,{groups:$,activeGroup:V,mode:m?"export":"preview",showInactivePills:!0,...ft!==void 0&&{controlsGroup:ft},...h!==void 0&&{controlsHost:h},...u!==void 0&&{controlsExpanded:u},callbacks:Wt,palette:r,isDark:o,width:E}),he.selectAll("[data-legend-group]").classed("bl-legend-group",!0)}if(!s&&!m){let Wt=yt.append("g").attr("class","bl-focus-icon").attr("data-export-ignore","true").style("display","none").style("pointer-events","auto").style("cursor","pointer");Wt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let he=14/2,ne=14/2;Wt.append("circle").attr("cx",he).attr("cy",ne).attr("r",14/2-1).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1.5),Wt.append("circle").attr("cx",he).attr("cy",ne).attr("r",2).attr("fill",r.textMuted)}}function lQ(t,e,n,r,o,a){jD(t,e,n,r,o,{...a?.exportDims!==void 0&&{exportDims:a.exportDims},...a?.activeTagGroup!==void 0&&{activeTagGroup:a.activeTagGroup},...a?.hiddenTagValues!==void 0&&{hiddenTagValues:a.hiddenTagValues},...a?.exportMode!==void 0&&{exportMode:a.exportMode}})}var jZ,qZ,gg,KZ,Lf,ZZ,tl,Di,YD,QZ,zD,XD,VD,JZ,tQ,b1,UD,eQ,nQ,rQ,KD=st(()=>{"use strict";Xn();Ti();Eo();on();Br();To();tn();xr();Ke();_o();Hs();fr();en();jZ=20,qZ=11,gg=9,KZ=11,Lf=8,ZZ=4,tl=5,Di=4,YD=10,QZ=1.4,zD=6,XD=12,VD=8,JZ=14,tQ=32,b1=15,UD=11,eQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),nQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),rQ=Kn().x(t=>t.x).y(t=>t.y).curve(Qi)});function E1(t,e=xg,n=JD){let r=Tn(t,e,n,{hardBreak:!0});if(r.length>x1){let a=r.slice(0,x1-1),i=r.slice(x1-1).join(" ");a.push(tr(i,e,n)),r=a}let o=0;for(let a of r){let i=_t(a,e);i>o&&(o=i)}return{lines:r,width:o+2*dQ,height:r.length*e*cQ+2*uQ}}function mQ(t){return w1(t,.5).p}function w1(t,e){if(t.length===0)return{p:{x:0,y:0},nx:0,ny:1};if(t.length===1)return{p:{x:t[0].x,y:t[0].y},nx:0,ny:1};let n=[],r=0;for(let i=1;i<t.length;i++){let s=Math.hypot(t[i].x-t[i-1].x,t[i].y-t[i-1].y);n.push(s),r+=s}let o=r*Math.max(0,Math.min(1,e));for(let i=1;i<t.length;i++){let s=n[i-1];if(o<=s||i===t.length-1){let l=s===0?0:Math.min(1,o/s),c=t[i-1].x,d=t[i-1].y,u=t[i].x,f=t[i].y,p=u-c,m=f-d,h=Math.hypot(p,m)||1;return{p:{x:c+p*l,y:d+m*l},nx:-m/h,ny:p/h}}o-=s}let a=t[t.length-1];return{p:{x:a.x,y:a.y},nx:0,ny:1}}function QD(t,e,n,r){return{minX:t-n/2,minY:e-r/2,maxX:t+n/2,maxY:e+r/2}}function bg(t,e,n,r,o,a){let i=t-n/2-a,s=e-r/2-a,l=t+n/2+a,c=e+r/2+a;for(let d of o)if(i<d.maxX&&l>d.minX&&s<d.maxY&&c>d.minY)return!0;return!1}function hQ(){let t=[.5];for(let e=1;e<=pQ;e++){let n=e*.08;.5-n>=.12&&t.push(.5-n),.5+n<=.88&&t.push(.5+n)}return t}function gQ(t,e,n,r){let o=hQ();for(let a of o){let{p:i}=w1(n,a);if(!bg(i.x,i.y,t,e,r,yg))return i}for(let a=ZD;a<=fQ;a+=ZD)for(let i of o){let{p:s,nx:l,ny:c}=w1(n,i);for(let d of[-1,1]){let u=s.x+l*a*d,f=s.y+c*a*d;if(!bg(u,f,t,e,r,yg))return{x:u,y:f}}}return null}function yQ(t){for(let r=0;r<8;r++){let o=!1;for(let a=0;a<t.length;a++)for(let i=a+1;i<t.length;i++){let s=t[a],l=t[i],c=Math.abs(s.cx-l.cx),d=Math.abs(s.cy-l.cy),u=(s.w+l.w)/2+4-c,f=(s.h+l.h)/2+4-d;if(u>0&&f>0){let p=f/2+1;s.cy<l.cy?(s.cy-=p,l.cy+=p):(s.cy+=p,l.cy-=p),o=!0}}if(!o)break}}function S1(t,e){let n=e?.fontSize??xg,r=e?.maxWidth??JD,o=[];for(let l of t.nodes)o.push(QD(l.x,l.y,l.width,l.height));for(let l of t.groups)l.collapsed&&o.push(QD(l.x,l.y,l.width,l.height));let a=[];t.edges.forEach((l,c)=>{if(!l.label||l.points.length<2)return;let d=E1(l.label,n,r),u=mQ(l.points),f=u.y;l.parallelCount>1&&l.yOffset!==0&&(f+=(l.yOffset<0?-1:1)*(d.height/2)),a.push({edgeIdx:c,cx:u.x,cy:f,w:d.width,h:d.height,lines:d.lines,resolved:!0})});for(let l of a){if(!bg(l.cx,l.cy,l.w,l.h,o,yg))continue;let c=t.edges[l.edgeIdx],d=gQ(l.w,l.h,c.points,o);d?(l.cx=d.x,l.cy=d.y):l.resolved=!1}yQ(a);for(let l of a)bg(l.cx,l.cy,l.w,l.h,o,yg)&&(l.resolved=!1);let i=new Map;for(let l of a)i.set(l.edgeIdx,l);let s=t.edges.map((l,c)=>{let d=i.get(c);return d?{...l,labelX:d.cx,labelY:d.cy,labelWidth:d.w,labelHeight:d.h,labelLines:d.lines}:l});return{layout:{...t,edges:s},unresolved:a.filter(l=>!l.resolved).map(l=>l.edgeIdx)}}var xg,JD,x1,cQ,dQ,uQ,yg,ZD,fQ,pQ,v1=st(()=>{"use strict";en();xg=11,JD=160,x1=3,cQ=1.3,dQ=6,uQ=3,yg=4,ZD=8,fQ=40,pQ=9});function kQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function tO(t,e,n){if(t.groups.length>0)return[];let r=t.nodes.length;if(r<3||r>40)return[];let o=t.direction==="TB",a=n?.nodesep??bQ,i=n?.ranksep??xQ,s=n?.backEdgeSide??"nearest",l=n?.restarts??(r<=14?28:r<=25?14:6),c=n?.keepK??3,d=t.nodes.map($=>$.label),u=new Set(d),f=t.edges.map(($,U)=>({e:$,i:U})).filter(({e:$})=>u.has($.source)&&u.has($.target)&&$.source!==$.target);if(f.length===0)return[];let p=new Map;for(let $ of d)p.set($,[]);for(let{e:$,i:U}of f)p.get($.source).push({to:$.target,idx:U});let m=new Set,h=new Map;for(let $ of d)h.set($,0);let g=$=>{h.set($,1);for(let{to:U,idx:X}of p.get($)){let q=h.get(U);q===1?m.add(X):q===0&&g(U)}h.set($,2)};for(let $ of d)h.get($)===0&&g($);let E=f.map(({e:$,i:U})=>m.has(U)?{from:$.target,to:$.source,idx:U,rev:!0}:{from:$.source,to:$.target,idx:U,rev:!1}),y=new Map,b=new Map;for(let $ of d)y.set($,[]),b.set($,0);for(let $ of E)y.get($.from).push($.to),b.set($.to,(b.get($.to)??0)+1);let S=new Map;for(let $ of d)S.set($,0);let x=d.filter($=>(b.get($)??0)===0),L=new Map(b),v=[];for(;x.length;){let $=x.shift();v.push($);for(let U of y.get($))S.set(U,Math.max(S.get(U),S.get($)+1)),L.set(U,L.get(U)-1),L.get(U)===0&&x.push(U)}if(v.length!==d.length)return[];let A=Math.max(...d.map($=>S.get($))),C=new Map;for(let $ of t.nodes){let U=e.get($.label)??{width:Ma,height:aa};C.set($.label,{id:$.label,dummy:!1,rank:S.get($.label),cross:0,thick:o?U.width:U.height,depth:o?U.height:U.width,realW:U.width,realH:U.height})}let M=[],w=[],k=[];for(let $ of E){if($.rev){k.push({edgeIdx:$.idx,src:$.to,tgt:$.from});continue}let U=S.get($.from),X=S.get($.to),q=[$.from],et=$.from;for(let tt=U+1;tt<X;tt++){let F=`__d${$.idx}_${tt}`;C.set(F,{id:F,dummy:!0,rank:tt,cross:0,thick:wQ,depth:0,realW:0,realH:0}),M.push({a:et,b:F}),q.push(F),et=F}M.push({a:et,b:$.to}),q.push($.to),w.push({edgeIdx:$.idx,chain:$.rev?q.slice().reverse():q})}let N=Array.from({length:A+1},()=>[]);for(let $ of C.values())N[$.rank].push($.id);let _=new Map,T=new Map;for(let $ of C.keys())_.set($,[]),T.set($,[]);for(let $ of M)T.get($.a).push($.b),_.get($.b).push($.a);let R=new Map,G=$=>{for(let U of C.keys())R.set(U,$.get(U))},I=$=>{if(!N[$+1])return 0;let X=[];for(let et of N[$]){let tt=R.get(et);for(let F of T.get(et))X.push({p:tt,q:R.get(F)})}let q=0;for(let et=0;et<X.length;et++)for(let tt=et+1;tt<X.length;tt++){let F=X[et],Q=X[tt];(F.p-Q.p)*(F.q-Q.q)<0&&q++}return q},H=()=>{let $=0;for(let U=0;U<A;U++)$+=I(U);return $},O=$=>{if($.length===0)return-1;$.sort((et,tt)=>et-tt);let U=Math.floor($.length/2);if($.length%2===1)return $[U];if($.length===2)return($[0]+$[1])/2;let X=$[U-1]-$[0],q=$[$.length-1]-$[U];return X+q===0?($[U-1]+$[U])/2:($[U-1]*q+$[U]*X)/(X+q)},D=($,U)=>{let X=N[$],q=U?_:T,et=new Map;for(let Z of X)et.set(Z,O(q.get(Z).map(lt=>R.get(lt))));let tt=X.filter(Z=>et.get(Z)>=0).sort((Z,lt)=>et.get(Z)-et.get(lt)),F=new Array(X.length).fill(null);for(let Z of X)et.get(Z)<0&&(F[R.get(Z)]=Z);let Q=0;for(let Z=0;Z<F.length;Z++)F[Z]===null&&(F[Z]=tt[Q++]);let ot=F;ot.forEach((Z,lt)=>R.set(Z,lt)),N[$]=ot},W=()=>{let $=!0,U=0;for(;$&&U++<12;){$=!1;for(let X=0;X<=A;X++){let q=N[X];for(let et=0;et<q.length-1;et++){let tt=(X>0?I(X-1):0)+(X<A?I(X):0),F=q[et],Q=q[et+1];q[et]=Q,q[et+1]=F,R.set(Q,et),R.set(F,et+1),(X>0?I(X-1):0)+(X<A?I(X):0)<tt?$=!0:(q[et]=F,q[et+1]=Q,R.set(F,et),R.set(Q,et+1))}}}},z=$=>{let U=$===0?null:kQ($);for(let X=0;X<=A;X++){let q=N[X].slice();if(U)for(let et=q.length-1;et>0;et--){let tt=Math.floor(U()*(et+1));[q[et],q[tt]]=[q[tt],q[et]]}N[X]=q,q.forEach((et,tt)=>R.set(et,tt))}},P=[];for(let $=0;$<l;$++){z($);let U=H(),X=new Map(R);for(let et=0;et<8;et++){if(et%2===0)for(let Q=1;Q<=A;Q++)D(Q,!0);else for(let Q=A-1;Q>=0;Q--)D(Q,!1);W();let F=H();if(F<U&&(U=F,X=new Map(R)),F===0)break}G(X);for(let et=0;et<=A;et++)N[et].sort((tt,F)=>R.get(tt)-R.get(F));let q=N.map(et=>et.join(",")).join("|");P.some(et=>et.sig===q)||P.push({sig:q,cross:U,order:new Map(X)})}P.sort(($,U)=>$.cross-U.cross);let B=P.slice(0,c);if(B.length===0)return[];let Y=[];for(let $ of B){G($.order);let U=Array.from({length:A+1},()=>[]);for(let X of C.values())U[X.rank].push(X.id);for(let X=0;X<=A;X++)U[X].sort((q,et)=>$.order.get(q)-$.order.get(et));Y.push(V(U))}return Y;function V($){let U=$.map(xt=>Math.max(0,...xt.map(Lt=>C.get(Lt).depth))),X=[],q=Xl;for(let xt=0;xt<=A;xt++)X[xt]=q+U[xt]/2,q+=U[xt]+i;for(let xt=0;xt<=A;xt++){let Lt=Xl;for(let Dt of $[xt]){let zt=C.get(Dt);zt.cross=Lt+zt.thick/2,Lt+=zt.thick+a}}let et=18;for(let xt=0;xt<et;xt++){let Dt=xt%2===0?Array.from({length:A+1},(zt,$t)=>$t):Array.from({length:A+1},(zt,$t)=>A-$t);for(let zt of Dt){let $t=$[zt],ft=$t.map(Wt=>{let he=C.get(Wt),ne=0,se=0;for(let Zt of _.get(Wt)){let Ie=j(he,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}for(let Zt of T.get(Wt)){let Ie=j(he,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}return ne>0?se/ne:he.cross});K($t,ft)}}let tt=1/0;for(let xt of C.values())tt=Math.min(tt,xt.cross-xt.thick/2);let F=Xl-tt;for(let xt of C.values())xt.cross+=F;let Q=xt=>o?{x:xt.cross,y:X[xt.rank]}:{x:X[xt.rank],y:xt.cross},ot=t.nodes.map(xt=>{let Lt=C.get(xt.label),Dt=Q(Lt);return{label:xt.label,x:Dt.x,y:Dt.y,width:Lt.realW,height:Lt.realH}}),Z=new Map;for(let xt of w)Z.set(xt.edgeIdx,xt.chain);let lt=1/0,nt=-1/0;for(let xt of C.values())xt.dummy||(lt=Math.min(lt,xt.cross-xt.thick/2),nt=Math.max(nt,xt.cross+xt.thick/2));let J=34,at=28,it=xt=>s==="left"?-1:s==="right"||C.get(xt.src).cross-C.get(xt.tgt).cross>=0?1:-1,vt=k.map(xt=>({...xt,side:it(xt),span:Math.abs(C.get(xt.src).rank-C.get(xt.tgt).rank)})).sort((xt,Lt)=>xt.side-Lt.side||xt.span-Lt.span),Tt=new Map;for(let xt of vt)Tt.set(xt.side,(Tt.get(xt.side)??0)+1);let At=new Map,rt=new Map,pt=xt=>Math.max(0,xt/2-6),ht=new Map,dt=new Map;{let xt=new Map;for(let Lt of vt){let Dt=`${Lt.side}|${Lt.tgt}`,zt=xt.get(Dt)??0;xt.set(Dt,zt+1),ht.set(Lt.edgeIdx,zt)}for(let[Lt,Dt]of xt)dt.set(Lt,Dt)}for(let xt of vt){let Lt=xt.side,Dt=At.get(Lt)??0;At.set(Lt,Dt+1);let zt=Tt.get(Lt),$t=C.get(xt.src),ft=C.get(xt.tgt),Wt=Lt>0?nt+J+Dt*at:lt-J-Dt*at,he=X[$t.rank],ne=X[ft.rank],se=zt>1?(Dt+1)/(zt+1):0,Zt=he+se*pt($t.depth),Ie=ne-se*pt(ft.depth),Ht=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae},Qt=10,Ut=$t.cross+Lt*($t.thick/2+Qt),fe=ft.cross+Lt*(ft.thick/2+Qt),de=ht.get(xt.edgeIdx),te=dt.get(`${Lt}|${xt.tgt}`);if(te>1&&de>0){let ae=ne-(ft.depth/2+J+(de-1)*at),Te=ft.cross+Lt*pt(ft.thick)*(de/te);rt.set(xt.edgeIdx,[Ht($t.cross,he),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,ae),Ht(Te,ae),Ht(ft.cross,ne)])}else rt.set(xt.edgeIdx,[Ht($t.cross,he),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,Ie),Ht(fe,Ie),Ht(ft.cross,ne)])}let ut=[];for(let xt=0;xt<t.edges.length;xt++){let Lt=t.edges[xt];if(!u.has(Lt.source)||!u.has(Lt.target))continue;let Dt;if(Lt.source===Lt.target){let zt=Q(C.get(Lt.source));Dt=[zt,zt]}else if(rt.has(xt))Dt=rt.get(xt);else{let zt=Z.get(xt);if(!zt)continue;Dt=zt.map($t=>Q(C.get($t)))}ut.push({source:Lt.source,target:Lt.target,...Lt.label!==void 0&&{label:Lt.label},bidirectional:Lt.bidirectional,lineNumber:Lt.lineNumber,points:Dt,yOffset:0,parallelCount:1,metadata:Lt.metadata})}let yt=1/0,kt=1/0,Ot=-1/0,Xt=-1/0;for(let xt of ot)yt=Math.min(yt,xt.x-xt.width/2),kt=Math.min(kt,xt.y-xt.height/2),Ot=Math.max(Ot,xt.x+xt.width/2),Xt=Math.max(Xt,xt.y+xt.height/2);for(let xt of ut)for(let Lt of xt.points)yt=Math.min(yt,Lt.x),kt=Math.min(kt,Lt.y),Ot=Math.max(Ot,Lt.x),Xt=Math.max(Xt,Lt.y);let bt=Xl-yt,Nt=Xl-kt,Vt=bt!==0||Nt!==0?{nodes:ot.map(xt=>({...xt,x:xt.x+bt,y:xt.y+Nt})),edges:ut.map(xt=>({...xt,points:xt.points.map(Lt=>({x:Lt.x+bt,y:Lt.y+Nt}))}))}:{nodes:ot,edges:ut};return{nodes:Vt.nodes,edges:Vt.edges,groups:[],width:Ot+bt+Xl,height:Xt+Nt+Xl}}function j($,U){return $.dummy&&U.dummy?vQ:$.dummy||U.dummy?SQ:EQ}function K($,U){let X=$.length;if(X===0)return;let q=$.map(ot=>C.get(ot).thick/2),et=[0];for(let ot=1;ot<X;ot++)et[ot]=et[ot-1]+q[ot-1]+a+q[ot];let tt=U.map((ot,Z)=>ot-et[Z]),F=[];for(let ot=0;ot<X;ot++){let Z={pos:tt[ot],count:1,sumOffset:tt[ot],first:ot};for(;F.length&&F[F.length-1].pos>=Z.pos;){let lt=F.pop(),nt=lt.count+Z.count,J=lt.sumOffset+Z.sumOffset;Z={pos:J/nt,count:nt,sumOffset:J,first:lt.first}}F.push(Z)}let Q=new Array(X);for(let ot of F)for(let Z=0;Z<ot.count;Z++)Q[ot.first+Z]=ot.pos;for(let ot=0;ot<X;ot++)C.get($[ot]).cross=Q[ot]+et[ot]}}var bQ,xQ,wQ,Xl,EQ,SQ,vQ,eO=st(()=>{"use strict";Nf();bQ=50,xQ=60,wQ=10,Xl=40,EQ=1,SQ=2,vQ=8});function IQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function PQ(t){if(t.length===0)return-1;t.sort((o,a)=>o-a);let e=Math.floor(t.length/2);if(t.length%2===1)return t[e];if(t.length===2)return(t[0]+t[1])/2;let n=t[e-1]-t[0],r=t[t.length-1]-t[e];return n+r===0?(t[e-1]+t[e])/2:(t[e-1]*r+t[e]*n)/(n+r)}function wg(t,e){let n=new Map;for(let l of t)n.set(l,[]);for(let l of e)n.get(l.from)?.push({to:l.to,idx:l.idx});let r=new Set,o=new Map;for(let l of t)o.set(l,0);let a=[],i=l=>{a.push(l);let c=new Map;for(;a.length;){let d=a[a.length-1];o.get(d)===0&&o.set(d,1);let u=n.get(d),f=c.get(d)??0,p=!1;for(;f<u.length;f++){let{to:m,idx:h}=u[f],g=o.get(m);if(g===1)r.add(h);else if(g===0){c.set(d,f+1),a.push(m),p=!0;break}}p||(c.set(d,u.length),o.set(d,2),a.pop())}};for(let l of t)o.get(l)===0&&i(l);return{dag:e.map(l=>r.has(l.idx)?{from:l.to,to:l.from,idx:l.idx,rev:!0}:{from:l.from,to:l.to,idx:l.idx,rev:!1})}}function nO(t,e){let n=new Map,r=new Map;for(let l of t)n.set(l,[]),r.set(l,0);for(let l of e)n.get(l.from).push(l.to),r.set(l.to,(r.get(l.to)??0)+1);let o=new Map;for(let l of t)o.set(l,0);let a=t.filter(l=>(r.get(l)??0)===0),i=new Map(r),s=0;for(;a.length;){let l=a.shift();s++;for(let c of n.get(l))o.set(c,Math.max(o.get(c),o.get(l)+1)),i.set(c,i.get(c)-1),i.get(c)===0&&a.push(c)}return s===t.length?o:null}function oO(t,e,n){if(t.groups.length===0)return[];let r=t.nodes.length;if(r<3||r>60)return[];let o=t.direction==="TB",a=t.nodes.map(tt=>tt.label),i=new Set(a);for(let tt of t.edges)if(tt.source.startsWith("__group_")||tt.target.startsWith("__group_"))return[];let s=new Map(t.groups.map(tt=>[tt.label,tt])),l=new Map;for(let tt of t.groups)for(let F of tt.children)i.has(F)&&l.set(F,tt.label);let c=tt=>{let F=tt,Q=new Set;for(;;){let ot=s.get(F);if(!ot?.parentGroup||Q.has(F))return F;Q.add(F),F=ot.parentGroup}},d=tt=>{let F=l.get(tt);if(!F)return[];let Q=[F],ot=F,Z=new Set([F]);for(;;){let lt=s.get(ot);if(!lt?.parentGroup||Z.has(lt.parentGroup))break;Q.push(lt.parentGroup),Z.add(lt.parentGroup),ot=lt.parentGroup}return Q.reverse()},u="\0node\0",f=tt=>{let F=l.get(tt);return F?c(F):u+tt},p=t.edges.map((tt,F)=>({e:tt,i:F})).filter(({e:tt})=>i.has(tt.source)&&i.has(tt.target)&&tt.source!==tt.target);if(p.length===0)return[];let m=new Map;for(let tt of a)m.set(tt,f(tt));let h=Array.from(new Set(a.map(tt=>m.get(tt)))),g=p.filter(({e:tt})=>m.get(tt.source)!==m.get(tt.target)).map(({e:tt,i:F})=>({from:m.get(tt.source),to:m.get(tt.target),idx:F})),{dag:E}=wg(h,g),y=nO(h,E.map(tt=>({from:tt.from,to:tt.to})));if(!y)return[];let b=new Map,S=new Map;for(let tt of a){let F=m.get(tt);(S.get(F)??S.set(F,[]).get(F)).push(tt)}for(let[tt,F]of S){let Q=new Set(F),ot=p.filter(({e:nt})=>m.get(nt.source)===tt&&m.get(nt.target)===tt&&Q.has(nt.source)&&Q.has(nt.target)).map(({e:nt,i:J})=>({from:nt.source,to:nt.target,idx:J})),{dag:Z}=wg(F,ot),lt=nO(F,Z.map(nt=>({from:nt.from,to:nt.to})));if(!lt)return[];for(let nt of F)b.set(nt,lt.get(nt))}let x=Math.max(...h.map(tt=>y.get(tt))),L=Array.from({length:x+1},()=>1);for(let tt of h){let F=Math.max(...S.get(tt).map(ot=>b.get(ot)+1)),Q=y.get(tt);L[Q]=Math.max(L[Q],F)}let v=[],A=0;for(let tt=0;tt<=x;tt++)v[tt]=A,A+=L[tt];let C=new Set(v.slice(1)),M=new Map;for(let tt of a)M.set(tt,v[y.get(m.get(tt))]+b.get(tt));let w=Math.max(...a.map(tt=>M.get(tt))),k=new Map;for(let tt of t.nodes){let F=e.get(tt.label)??{width:Ma,height:aa};k.set(tt.label,{id:tt.label,dummy:!1,rank:M.get(tt.label),cross:0,thick:o?F.width:F.height,depth:o?F.height:F.width,realW:F.width,realH:F.height,unit:m.get(tt.label),path:d(tt.label)})}let N=[],_=[],T=[],R=[];for(let{e:tt,i:F}of p){let Q=M.get(tt.source),ot=M.get(tt.target);if(Q===ot){R.push({edgeIdx:F,a:tt.source,b:tt.target});continue}if(ot<Q){T.push({edgeIdx:F,src:tt.source,tgt:tt.target});continue}let Z=[tt.source],lt=tt.source;for(let nt=Q+1;nt<ot;nt++){let J=`__d${F}_${nt}`;k.set(J,{id:J,dummy:!0,rank:nt,cross:0,thick:MQ,depth:0,realW:0,realH:0,unit:u+J,path:[]}),_.push({a:lt,b:J}),Z.push(J),lt=J}_.push({a:lt,b:tt.target}),Z.push(tt.target),N.push({edgeIdx:F,chain:Z})}let G=Array.from({length:w+1},()=>[]);for(let tt of k.values())G[tt.rank].push(tt.id);let I=new Map,H=new Map;for(let tt of k.keys())I.set(tt,[]),H.set(tt,[]);for(let tt of _)H.get(tt.a).push(tt.b),I.get(tt.b).push(tt.a);let O=new Map,D=tt=>{if(!G[tt+1])return 0;let Q=[];for(let Z of G[tt]){let lt=O.get(Z);for(let nt of H.get(Z))Q.push({p:lt,q:O.get(nt)})}let ot=0;for(let Z=0;Z<Q.length;Z++)for(let lt=Z+1;lt<Q.length;lt++){let nt=Q[Z],J=Q[lt];(nt.p-J.p)*(nt.q-J.q)<0&&ot++}return ot},W=()=>{let tt=0;for(let F=0;F<w;F++)tt+=D(F);return tt},z=(tt,F)=>{let Q=G[tt],ot=F?I:H,Z=new Map;for(let it of Q)Z.set(it,PQ(ot.get(it).map(vt=>O.get(vt))));let lt=Q.filter(it=>Z.get(it)>=0).sort((it,vt)=>Z.get(it)-Z.get(vt)),nt=new Array(Q.length).fill(null);for(let it of Q)Z.get(it)<0&&(nt[O.get(it)]=it);let J=0;for(let it=0;it<nt.length;it++)nt[it]===null&&(nt[it]=lt[J++]);let at=nt;at.forEach((it,vt)=>O.set(it,vt)),G[tt]=at},P=()=>{let tt=!0,F=0;for(;tt&&F++<12;){tt=!1;for(let Q=0;Q<=w;Q++){let ot=G[Q];for(let Z=0;Z<ot.length-1;Z++){let lt=(Q>0?D(Q-1):0)+(Q<w?D(Q):0),nt=ot[Z],J=ot[Z+1];ot[Z]=J,ot[Z+1]=nt,O.set(J,Z),O.set(nt,Z+1),(Q>0?D(Q-1):0)+(Q<w?D(Q):0)<lt?tt=!0:(ot[Z]=nt,ot[Z+1]=J,O.set(nt,Z),O.set(J,Z+1))}}}},B=tt=>{let F=tt===0?null:IQ(tt);for(let Q=0;Q<=w;Q++){let ot=G[Q].slice();if(F)for(let Z=ot.length-1;Z>0;Z--){let lt=Math.floor(F()*(Z+1));[ot[Z],ot[lt]]=[ot[lt],ot[Z]]}G[Q]=ot,ot.forEach((Z,lt)=>O.set(Z,lt))}},Y=n?.restarts??(r<=16?20:r<=30?12:6),V=n?.keepK??3,j=[];for(let tt=0;tt<Y;tt++){B(tt);let F=W(),Q=new Map(O);for(let Z=0;Z<8;Z++){if(Z%2===0)for(let nt=1;nt<=w;nt++)z(nt,!0);else for(let nt=w-1;nt>=0;nt--)z(nt,!1);P();let lt=W();if(lt<F&&(F=lt,Q=new Map(O)),lt===0)break}for(let[Z,lt]of Q)O.set(Z,lt);for(let Z=0;Z<=w;Z++)G[Z].sort((lt,nt)=>O.get(lt)-O.get(nt));let ot=G.map(Z=>Z.join(",")).join("|");j.some(Z=>Z.sig===ot)||j.push({sig:ot,cross:F,order:new Map(Q)})}j.sort((tt,F)=>tt.cross-F.cross);let K=j.slice(0,V);if(K.length===0)return[];let $=[];for(let tt of K){for(let[Q,ot]of tt.order)O.set(Q,ot);let F=Array.from({length:w+1},()=>[]);for(let Q of k.values())F[Q.rank].push(Q.id);for(let Q=0;Q<=w;Q++)F[Q].sort((ot,Z)=>tt.order.get(ot)-tt.order.get(Z));$.push(et(F))}return $;function U(tt,F){return tt.dummy&&F.dummy?RQ:tt.dummy||F.dummy?AQ:_Q}function X(tt,F,Q){let ot=tt.length;if(ot===0)return;let Z=[0];for(let at=1;at<ot;at++)Z[at]=Z[at-1]+Q[at];let lt=F.map((at,it)=>at-Z[it]),nt=[];for(let at=0;at<ot;at++){let it={pos:lt[at],count:1,sumOffset:lt[at],first:at};for(;nt.length&&nt[nt.length-1].pos>=it.pos;){let vt=nt.pop(),Tt=vt.count+it.count,At=vt.sumOffset+it.sumOffset;it={pos:At/Tt,count:Tt,sumOffset:At,first:vt.first}}nt.push(it)}let J=new Array(ot);for(let at of nt)for(let it=0;it<at.count;it++)J[at.first+it]=at.pos;for(let at=0;at<ot;at++)k.get(tt[at]).cross=J[at]+Z[at]}function q(tt,F){let Q=tt.thick/2+F.thick/2+LQ;if(tt.dummy||F.dummy)return Q;if(tt.unit!==F.unit)return Q+2*Sd+TQ;let ot=tt.path[tt.path.length-1],Z=F.path[F.path.length-1];return ot!==Z&&(ot||Z)?Q+2*Sd:Q}function et(tt){let F=tt.map(Ht=>Math.max(0,...Ht.map(Qt=>k.get(Qt).depth))),Q=[],ot=el;for(let Ht=0;Ht<=w;Ht++)Ht>0&&(ot+=NQ+(C.has(Ht)?CQ:0)),Q[Ht]=ot+F[Ht]/2,ot+=F[Ht];let Z=Ht=>Ht.map((Qt,Ut)=>Ut===0?0:q(k.get(Ht[Ut-1]),k.get(Qt)));for(let Ht=0;Ht<=w;Ht++){let Qt=tt[Ht],Ut=Z(Qt),fe=el;for(let de=0;de<Qt.length;de++){let te=k.get(Qt[de]);fe+=Ut[de],te.cross=de===0?el+te.thick/2:fe}}let lt=18;for(let Ht=0;Ht<lt;Ht++){let Ut=Ht%2===0?Array.from({length:w+1},(fe,de)=>de):Array.from({length:w+1},(fe,de)=>w-de);for(let fe of Ut){let de=tt[fe],te=de.map(ae=>{let Te=k.get(ae),Je=0,sn=0;for(let ze of I.get(ae)){let Ce=U(Te,k.get(ze));Je+=Ce,sn+=Ce*k.get(ze).cross}for(let ze of H.get(ae)){let Ce=U(Te,k.get(ze));Je+=Ce,sn+=Ce*k.get(ze).cross}return Je>0?sn/Je:Te.cross});X(de,te,Z(de))}}let nt=1/0;for(let Ht of k.values())nt=Math.min(nt,Ht.cross-Ht.thick/2);let J=el-nt;for(let Ht of k.values())Ht.cross+=J;let at=Ht=>o?{x:Ht.cross,y:Q[Ht.rank]}:{x:Q[Ht.rank],y:Ht.cross},it=t.nodes.map(Ht=>{let Qt=k.get(Ht.label),Ut=at(Qt);return{label:Ht.label,x:Ut.x,y:Ut.y,width:Qt.realW,height:Qt.realH}}),vt=new Map;for(let Ht of N)vt.set(Ht.edgeIdx,Ht.chain);let Tt=1/0,At=-1/0;for(let Ht of k.values())Ht.dummy||(Tt=Math.min(Tt,Ht.cross-Ht.thick/2),At=Math.max(At,Ht.cross+Ht.thick/2));let rt=34,pt=28,ht=Ht=>Math.max(0,Ht/2-6),dt=Ht=>k.get(Ht.src).cross-k.get(Ht.tgt).cross>=0?1:-1,ut=T.map(Ht=>({...Ht,side:dt(Ht),span:Math.abs(k.get(Ht.src).rank-k.get(Ht.tgt).rank)})).sort((Ht,Qt)=>Ht.side-Qt.side||Ht.span-Qt.span),yt=new Map;for(let Ht of ut)yt.set(Ht.side,(yt.get(Ht.side)??0)+1);let kt=new Map,Ot=new Map;for(let Ht of ut){let Qt=Ht.side,Ut=kt.get(Qt)??0;kt.set(Qt,Ut+1);let fe=yt.get(Qt),de=k.get(Ht.src),te=k.get(Ht.tgt),ae=Qt>0?At+rt+Ut*pt:Tt-rt-Ut*pt,Te=Q[de.rank],Je=Q[te.rank],sn=fe>1?(Ut+1)/(fe+1):0,ze=Te-sn*ht(de.depth),Ce=Je+sn*ht(te.depth),ee=(_n,He)=>o?{x:_n,y:He}:{x:He,y:_n},oe=10,Be=de.cross+Qt*(de.thick/2+oe),dn=te.cross+Qt*(te.thick/2+oe);Ot.set(Ht.edgeIdx,[ee(de.cross,Te),ee(Be,ze),ee(ae,ze),ee(ae,Ce),ee(dn,Ce),ee(te.cross,Je)])}let Xt=new Map;for(let Ht of R){let Qt=k.get(Ht.a),Ut=k.get(Ht.b),fe=Q[Qt.rank],de=fe-(Qt.depth/2+26),te=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae};Xt.set(Ht.edgeIdx,[te(Qt.cross,fe),te(Qt.cross,de),te(Ut.cross,de),te(Ut.cross,fe)])}let bt=[];for(let Ht=0;Ht<t.edges.length;Ht++){let Qt=t.edges[Ht];if(!i.has(Qt.source)||!i.has(Qt.target))continue;let Ut;if(Qt.source===Qt.target){let fe=at(k.get(Qt.source));Ut=[fe,fe]}else if(Ot.has(Ht))Ut=Ot.get(Ht);else if(Xt.has(Ht))Ut=Xt.get(Ht);else{let fe=vt.get(Ht);if(!fe)continue;Ut=fe.map(de=>at(k.get(de)))}bt.push({source:Qt.source,target:Qt.target,...Qt.label!==void 0&&{label:Qt.label},bidirectional:Qt.bidirectional,lineNumber:Qt.lineNumber,points:Ut,yOffset:0,parallelCount:1,metadata:Qt.metadata})}let Nt=new Map(it.map(Ht=>[Ht.label,{l:Ht.x-Ht.width/2,r:Ht.x+Ht.width/2,t:Ht.y-Ht.height/2,b:Ht.y+Ht.height/2}])),Vt=Ht=>{let Qt=0,Ut=Ht,fe=new Set;for(;Ut&&!fe.has(Ut);)fe.add(Ut),Ut=s.get(Ut)?.parentGroup,Ut&&Qt++;return Qt},xt=new Map;for(let Ht of t.groups)Ht.parentGroup&&(xt.get(Ht.parentGroup)??xt.set(Ht.parentGroup,[]).get(Ht.parentGroup)).push(Ht.label);let Lt=new Map,Dt=[...t.groups].sort((Ht,Qt)=>Vt(Qt.label)-Vt(Ht.label)),zt=[];for(let Ht of Dt){let Qt=1/0,Ut=-1/0,fe=1/0,de=-1/0,te=ze=>{Qt=Math.min(Qt,ze.l),Ut=Math.max(Ut,ze.r),fe=Math.min(fe,ze.t),de=Math.max(de,ze.b)};for(let ze of Ht.children){let Ce=Nt.get(ze);Ce&&te(Ce)}for(let ze of xt.get(Ht.label)??[]){let Ce=Lt.get(ze);Ce&&te(Ce)}if(!Number.isFinite(Qt))continue;let ae=Qt-Sd,Te=Ut+Sd,Je=fe-rO,sn=de+Sd;Lt.set(Ht.label,{l:ae,r:Te,t:Je,b:sn}),zt.push({label:Ht.label,lineNumber:Ht.lineNumber,x:(ae+Te)/2,y:(Je+sn)/2,width:Te-ae,height:sn-Je,collapsed:!1,childCount:Ht.children.length})}let $t=1/0,ft=1/0,Wt=-1/0,he=-1/0,ne=(Ht,Qt,Ut,fe)=>{$t=Math.min($t,Ht),ft=Math.min(ft,Qt),Wt=Math.max(Wt,Ut),he=Math.max(he,fe)};for(let Ht of it)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);for(let Ht of bt)for(let Qt of Ht.points)ne(Qt.x,Qt.y,Qt.x,Qt.y);for(let Ht of zt)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);let se=el-$t,Zt=el-ft,Ie=se!==0||Zt!==0;return{nodes:Ie?it.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):it,edges:Ie?bt.map(Ht=>({...Ht,points:Ht.points.map(Qt=>({x:Qt.x+se,y:Qt.y+Zt}))})):bt,groups:Ie?zt.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):zt,width:Wt+se+el,height:he+Zt+el}}}var LQ,NQ,MQ,el,Sd,rO,TQ,CQ,_Q,AQ,RQ,k1=st(()=>{"use strict";Nf();LQ=50,NQ=60,MQ=10,el=40,Sd=16,rO=32,TQ=24,CQ=rO+2*Sd,_Q=1,AQ=2,RQ=8});var fO={};ye(fO,{countEdgeNearMiss:()=>qQ,countEdgeNodePierces:()=>dO,countEdgeOverlaps:()=>cO,countGroupOverlaps:()=>Sg,countSplineCrossings:()=>lO,deroutePierces:()=>L1,detectEdgeNodePierces:()=>M1,detectEdgeOverlaps:()=>Eg,detectGroupOverlaps:()=>KQ,layoutBoxesAndLinesSearch:()=>tJ,separateGroupBands:()=>uO});function WQ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function BQ(t,e){let n=t.slice();for(let r=n.length-1;r>0;r--){let o=Math.floor(e()*(r+1));[n[r],n[o]]=[n[o],n[r]]}return n}function zQ(t){let e=t.match(YQ)??[],n=[],r=0,o=0,a=0,i="",s=()=>parseFloat(e[r++]),l=(c,d,u,f)=>{for(let p=0;p<=1;p+=.12){let m=1-p;u?n.push({x:m*m*m*c.x+3*m*m*p*d.x+3*m*p*p*u.x+p*p*p*f.x,y:m*m*m*c.y+3*m*m*p*d.y+3*m*p*p*u.y+p*p*p*f.y}):n.push({x:m*m*c.x+2*m*p*d.x+p*p*f.x,y:m*m*c.y+2*m*p*d.y+p*p*f.y})}};for(;r<e.length;){let c=e[r];if(/[MLQC]/i.test(c)&&(i=c,r++),i==="M"||i==="L"){let d=s(),u=s();n.push({x:d,y:u}),o=d,a=u}else if(i==="Q"){let d={x:s(),y:s()},u={x:s(),y:s()};l({x:o,y:a},d,null,u),o=u.x,a=u.y}else if(i==="C"){let d={x:s(),y:s()},u={x:s(),y:s()},f={x:s(),y:s()};l({x:o,y:a},d,u,f),o=f.x,a=f.y}else r++}return n}function N1(t){let e=t.edges,n=aO.get(e);if(n)return n;let r=t.edges.map(o=>{let a=o.points.length>=2?zQ(FQ(o.points)??""):[],i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of a)d.x<i&&(i=d.x),d.x>l&&(l=d.x),d.y<s&&(s=d.y),d.y>c&&(c=d.y);return{pts:a,x0:i,y0:s,x1:l,y1:c}});return aO.set(e,r),r}function VQ(t,e,n,r){let o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(Math.abs(o)<1e-9)return null;let a=((n.x-t.x)*(r.y-n.y)-(n.y-t.y)*(r.x-n.x))/o,i=((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))/o;return a>0&&a<1&&i>0&&i<1?{x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)}:null}function lO(t,e=1/0){let n=new Map;for(let s of t.nodes)n.set(s.label,{x:s.x,y:s.y});for(let s of t.groups)s.collapsed&&n.set("__group_"+s.label,{x:s.x,y:s.y});let r=N1(t),o=t.edges,a=34,i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){let c=r[s],d=r[l];if(c.pts.length<2||d.pts.length<2||c.x1<d.x0||d.x1<c.x0||c.y1<d.y0||d.y1<c.y0)continue;let u=o[s],f=o[l],p,m;(u.source===f.source||u.source===f.target)&&(p=n.get(u.source)),(u.target===f.source||u.target===f.target)&&(m=n.get(u.target));let h=[],g=c.pts,E=d.pts;for(let y=1;y<g.length;y++){let b=g[y-1],S=g[y],x=b.x<S.x?b.x:S.x,L=b.x>S.x?b.x:S.x,v=b.y<S.y?b.y:S.y,A=b.y>S.y?b.y:S.y;for(let C=1;C<E.length;C++){let M=E[C-1],w=E[C];if(L<(M.x<w.x?M.x:w.x)||(M.x>w.x?M.x:w.x)<x||A<(M.y<w.y?M.y:w.y)||(M.y>w.y?M.y:w.y)<v)continue;let k=VQ(b,S,M,w);k&&(p&&Math.hypot(k.x-p.x,k.y-p.y)<a||m&&Math.hypot(k.x-m.x,k.y-m.y)<a||h.some(N=>Math.hypot(N.x-k.x,N.y-k.y)<6)||h.push(k))}}if(i+=h.length,i>e)return i}return i}function UQ(t,e,n){let r=n.x-e.x,o=n.y-e.y,a=r*r+o*o;if(a<1e-9)return Math.hypot(t.x-e.x,t.y-e.y);let i=((t.x-e.x)*r+(t.y-e.y)*o)/a;return i=Math.max(0,Math.min(1,i)),Math.hypot(t.x-(e.x+i*r),t.y-(e.y+i*o))}function XQ(t,e){let n=1/0;for(let r=1;r<e.length;r++)n=Math.min(n,UQ(t,e[r-1],e[r]));return n}function iO(t,e){let n=Math.max(e.x-e.w/2-t.x,0,t.x-(e.x+e.w/2)),r=Math.max(e.y-e.h/2-t.y,0,t.y-(e.y+e.h/2));return Math.hypot(n,r)}function Eg(t,e){let n=e?.dist??8,r=e?.minLen??16,o=e?.nodeClear??12,a=new Map;for(let c of t.nodes)a.set(c.label,{x:c.x,y:c.y,w:c.width,h:c.height});for(let c of t.groups)c.collapsed&&a.set("__group_"+c.label,{x:c.x,y:c.y,w:c.width,h:c.height});let i=N1(t),s=t.edges,l=[];for(let c=0;c<i.length;c++)for(let d=c+1;d<i.length;d++){let u=i[c],f=i[d];if(u.pts.length<2||f.pts.length<2||u.x1+n<f.x0||f.x1+n<u.x0||u.y1+n<f.y0||f.y1+n<u.y0)continue;let p=s[c],m=s[d],h,g;(p.source===m.source||p.source===m.target)&&(h=a.get(p.source)),(p.target===m.source||p.target===m.target)&&(g=a.get(p.target));let E=[],y=0,b=()=>{y>=r&&E.length>=2&&l.push({mid:E[Math.floor(E.length/2)],length:y,pts:E.slice()}),E=[],y=0};for(let S of u.pts)!(h!==void 0&&iO(S,h)<o||g!==void 0&&iO(S,g)<o)&&XQ(S,f.pts)<n?(E.length&&(y+=Math.hypot(S.x-E[E.length-1].x,S.y-E[E.length-1].y)),E.push(S)):b();b()}return l}function cO(t,e){return Eg(t,e).length}function M1(t,e){let n=e?.inset??6,r=e?.minPts??2,o=[];for(let l of t.nodes)o.push({key:l.label,x:l.x,y:l.y,w:l.width,h:l.height});for(let l of t.groups)l.collapsed&&o.push({key:"__group_"+l.label,x:l.x,y:l.y,w:l.width,h:l.height});let a=(l,c)=>Math.abs(l.x-c.x)<c.w/2-n&&Math.abs(l.y-c.y)<c.h/2-n,i=[],s=N1(t);return t.edges.forEach((l,c)=>{if(l.points.length<2)return;let d=s[c].pts;for(let u of o){if(u.key===l.source||u.key===l.target||"__group_"+u.key===l.source||"__group_"+u.key===l.target)continue;let f=d.filter(p=>a(p,u));f.length>=r&&i.push({edgeIdx:c,node:u.key,pts:f})}}),i}function dO(t,e){return M1(t,e).length}function L1(t){let e=M1(t);if(!e.length)return t;let n=new Map;for(let a of t.nodes)n.set(a.label,{x:a.x,y:a.y,w:a.width,h:a.height});for(let a of t.groups)a.collapsed&&n.set("__group_"+a.label,{x:a.x,y:a.y,w:a.width,h:a.height});let r=new Map;for(let a of e){let i=r.get(a.edgeIdx);i?i.push(a.node):r.set(a.edgeIdx,[a.node])}let o=t.edges.map((a,i)=>{let s=r.get(i);if(!s)return a;let l=a.points.map(c=>({x:c.x,y:c.y}));for(let c of s){let d=n.get(c);d&&(l=jQ(l,d))}return{...a,points:l}});return{...t,edges:o}}function jQ(t,e){if(t.length<2)return t;let n={x:e.x,y:e.y},r=-1,o=0,a=1/0,i=t[0];for(let x=0;x<t.length-1;x++){let L=t[x],v=t[x+1],A=v.x-L.x,C=v.y-L.y,M=A*A+C*C||1e-9,w=((n.x-L.x)*A+(n.y-L.y)*C)/M;w=Math.max(0,Math.min(1,w));let k={x:L.x+w*A,y:L.y+w*C},N=Math.hypot(k.x-n.x,k.y-n.y);N<a&&(a=N,r=x,o=w,i=k)}if(r<0)return t;let s=i.x-n.x,l=i.y-n.y;Math.hypot(s,l)<1&&(e.w<=e.h?(s=1,l=0):(s=0,l=1));let c=Math.hypot(s,l)||1;s/=c,l/=c;let d=t[r],u=t[r+1],f=u.x-d.x,p=u.y-d.y,m=Math.hypot(f,p)||1;f/=m,p/=m;let h=Math.hypot(e.w,e.h)/2+18,g=Math.hypot(e.w,e.h)/2,E={x:i.x-f*g+s*h*.5,y:i.y-p*g+l*h*.5},y={x:n.x+s*h,y:n.y+l*h},b={x:i.x+f*g+s*h*.5,y:i.y+p*g+l*h*.5},S=t.slice(0,r+1);return S.push(E,y,b),S.push(...t.slice(r+1)),S}function qQ(t,e){let n=e?.near??14,r=e?.tight??8,o=e?.minLen??18,a=Eg(t,{dist:n,minLen:o}).length,i=Eg(t,{dist:r,minLen:o}).length;return Math.max(0,a-i)}function KQ(t,e){let n=e?.margin??4,r=t.groups.map(s=>({label:s.label,l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Mf}:s),i=new Set;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&(i.add(r[s].label),i.add(r[l].label))}return[...i]}function Sg(t,e){let n=e?.margin??4,r=t.groups.map(s=>({l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Mf}:s),i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&i++}return i}function uO(t,e){if(t.groups.some(T=>T.collapsed)||Sg(t)===0)return t;let n=new Map;for(let T of e.groups)n.set(T.label,T.parentGroup);let r=T=>{let R=T,G=new Set;for(;;){let I=n.get(R);if(!I||G.has(I))return R;G.add(R),R=I}},o=e.groups.filter(T=>!T.parentGroup).map(T=>T.label);if(o.length<2)return t;let a=new Map;for(let T of e.groups)for(let R of T.children)e.groups.some(G=>G.label===R)||a.set(R,r(T.label));let i=e.direction==="TB"?"x":"y",s=new Map(t.groups.map(T=>[T.label,T])),l=o.map(T=>{let R=s.get(T),G=(i==="y"?R.height:R.width)/2,I=(i==="y"?R.y:R.x)-G,H=(i==="y"?R.y:R.x)+G,O=e.groups.some(D=>D.parentGroup===T);return i==="y"&&O&&(I-=Mf),{label:T,lo:I,hi:H,c:(I+H)/2}});l.sort((T,R)=>T.c-R.c);let c=16,d=l.map(T=>(T.hi-T.lo)/2),u=[0];for(let T=1;T<l.length;T++)u[T]=u[T-1]+d[T-1]+c+d[T];let f=l.map((T,R)=>T.c-u[R]),p=[];for(let T=0;T<l.length;T++){let R={pos:f[T],count:1,sum:f[T],first:T};for(;p.length&&p[p.length-1].pos>=R.pos;){let G=p.pop(),I=G.count+R.count,H=G.sum+R.sum;R={pos:H/I,count:I,sum:H,first:G.first}}p.push(R)}let m=new Array(l.length);for(let T of p)for(let R=0;R<T.count;R++)m[T.first+R]=T.pos+u[T.first+R];let h=new Map,g=!1;if(l.forEach((T,R)=>{let G=m[R]-T.c;h.set(T.label,G),Math.abs(G)>.5&&(g=!0)}),!g)return t;let E=T=>{if(T.startsWith("__group_"))return h.get(r(T.slice(8)))??0;let R=a.get(T);return R?h.get(R)??0:0},y=(T,R)=>i==="y"?{x:T.x,y:T.y+R}:{x:T.x+R,y:T.y},b=t.nodes.map(T=>{let R=E(T.label);return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),S=t.groups.map(T=>{let R=h.get(r(T.label))??0;return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),x=t.edges.map(T=>{let R=E(T.source),G=E(T.target);if(!R&&!G)return T;let I=T.points.length,H=T.points.map((O,D)=>{let W=I>1?D/(I-1):0;return y(O,R*(1-W)+G*W)});return{...T,points:H}}),L=1/0,v=1/0,A=-1/0,C=-1/0,M=(T,R)=>{T<L&&(L=T),T>A&&(A=T),R<v&&(v=R),R>C&&(C=R)};for(let T of b)M(T.x-T.width/2,T.y-T.height/2),M(T.x+T.width/2,T.y+T.height/2);for(let T of S)M(T.x-T.width/2,T.y-T.height/2-Mf),M(T.x+T.width/2,T.y+T.height/2);for(let T of x)for(let R of T.points)M(R.x,R.y);let w=40,k=w-L,N=w-v,_=k!==0||N!==0;return{nodes:_?b.map(T=>({...T,x:T.x+k,y:T.y+N})):b,groups:_?S.map(T=>({...T,x:T.x+k,y:T.y+N})):S,edges:_?x.map(T=>({...T,points:T.points.map(R=>({x:R.x+k,y:R.y+N}))})):x,width:A-L+2*w,height:C-v+2*w}}function ZQ(t,e,n,r){let o=e.x-t.x,a=e.y-t.y,i=r.x-n.x,s=r.y-n.y,l=o*s-a*i;if(Math.abs(l)<1e-9)return!1;let c=((n.x-t.x)*s-(n.y-t.y)*i)/l,d=((n.x-t.x)*a-(n.y-t.y)*o)/l;return c>.001&&c<.999&&d>.001&&d<.999}function sO(t){let e=t.edges.filter(o=>o.points.length>=2),n=e.map(o=>{let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let c of o.points)c.x<a&&(a=c.x),c.x>s&&(s=c.x),c.y<i&&(i=c.y),c.y>l&&(l=c.y);return{x0:a,y0:i,x1:s,y1:l}}),r=0;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++){let i=e[o],s=e[a];if(i.source===s.source||i.source===s.target||i.target===s.source||i.target===s.target)continue;let l=n[o],c=n[a];if(l.x1<c.x0||c.x1<l.x0||l.y1<c.y0||c.y1<l.y0)continue;let d=i.points,u=s.points,f=!1;for(let p=0;p<d.length-1&&!f;p++)for(let m=0;m<u.length-1;m++)if(ZQ(d[p],d[p+1],u[m],u[m+1])){f=!0;break}f&&r++}return r}function QQ(t,e){if(!e?.size)return 0;let n=0,r=0;for(let o of t.nodes){let a=e.get(o.label);a&&(n+=Math.hypot(o.x-a.x,o.y-a.y),r++)}return r?n/r:0}function JQ(t){let e=0;for(let n of t.edges)for(let r=1;r<n.points.length;r++)e+=Math.hypot(n.points[r].x-n.points[r-1].x,n.points[r].y-n.points[r-1].y);return e}async function tJ(t,e,n){let r=n?.hideDescriptions??!1,o=n?.reserveEdgeLabels??!1,a=n?.onProgress,i=a?()=>new Promise(nt=>setTimeout(nt)):()=>{},s=150,l=30,c=performance.now(),d=c,u=new Set;if(e){let nt=new Set;for(let J of e.originalGroups)t.groups.some(at=>at.label===J.label)||nt.add(J.label);for(let J of nt){let it=e.originalGroups.find(vt=>vt.label===J)?.parentGroup;(!it||!nt.has(it))&&u.add(J)}}let f=new Map,p=0;for(let nt of t.nodes){let J=r?{width:Ma,height:aa}:T1(nt,t.showValues===!0);f.set(nt.label,J),!r&&nt.description&&nt.description.length>0&&(p=Math.max(p,J.height))}if(p>0){for(let nt of t.nodes)if(nt.description&&nt.description.length>0){let J=f.get(nt.label);f.set(nt.label,{width:J.width,height:p})}}let m=nt=>`__group_${nt}`,h=t.direction==="TB"?"TB":"LR",g=new Set(t.nodes.map(nt=>nt.label)),E=new Map,y=new Map;for(let nt of t.groups)if(E.set(nt.label,nt.children.filter(J=>g.has(J))),nt.parentGroup){let J=y.get(nt.parentGroup)??[];J.push(nt.label),y.set(nt.parentGroup,J)}let b=new Map,S=nt=>{let J=b.get(nt);if(J)return J;b.set(nt,[]);let at=[...E.get(nt)??[]];for(let it of y.get(nt)??[])at.push(...S(it));return b.set(nt,at),at},x=new Map,L=new Map;for(let nt of t.groups){let J=S(nt.label);if(J.length===0)continue;let at=new Set(J),it=new Map;for(let ht of t.edges)if(at.has(ht.source)&&at.has(ht.target)){let dt=it.get(ht.target)??[];dt.push(ht.source),it.set(ht.target,dt)}let vt=new Map,Tt=new Set,At=ht=>{let dt=vt.get(ht);if(dt!==void 0)return dt;if(Tt.has(ht))return 0;Tt.add(ht);let ut=0;for(let yt of it.get(ht)??[])ut=Math.max(ut,At(yt)+1);return Tt.delete(ht),vt.set(ht,ut),ut},rt=J[0],pt=J[0];for(let ht of J)At(ht)>At(rt)&&(rt=ht),At(ht)<At(pt)&&(pt=ht);x.set(m(nt.label),rt),L.set(m(nt.label),pt)}let v=nt=>x.get(nt)??nt,A=nt=>L.get(nt)??nt,C=nt=>`${nt.source}->${nt.target}#${nt.lineNumber}`,M=(nt,J)=>{let at=J.x-nt.x,it=J.y-nt.y,vt=at===0?1/0:nt.w/2/Math.abs(at),Tt=it===0?1/0:nt.h/2/Math.abs(it),At=Math.min(vt,Tt);return Number.isFinite(At)?{x:nt.x+at*At,y:nt.y+it*At}:{x:nt.x,y:nt.y}},w=(nt,J)=>Math.abs(nt.x-J.x)<=J.w/2&&Math.abs(nt.y-J.y)<=J.h/2,k=t.nodePositions,N=new Set(t.groups.map(nt=>nt.label)),_=t.groups.every(nt=>!nt.parentGroup&&!nt.children.some(J=>N.has(J))),T=new Set((e?.originalGroups??t.groups).map(nt=>nt.label)),R=u.size===0||k!==void 0&&e!==void 0&&[...u].every(nt=>{let J=e.originalGroups.find(at=>at.label===nt);return!J||J.parentGroup?!1:J.children.every(at=>k.has(at)&&!T.has(at))}),G=k!==void 0&&(t.nodes.length>0||u.size>0)&&t.nodes.every(nt=>k.has(nt.label))&&_&&R;function I(nt){let J=new Map,at=[];if(e)for(let Lt of u){let Dt=e.originalGroups.find(se=>se.label===Lt);if(!Dt)continue;let zt=1/0,$t=1/0,ft=-1/0,Wt=-1/0;for(let se of Dt.children){let Zt=nt.get(se);Zt&&(zt=Math.min(zt,Zt.x),ft=Math.max(ft,Zt.x),$t=Math.min($t,Zt.y),Wt=Math.max(Wt,Zt.y))}if(!Number.isFinite(zt))continue;let he=(zt+ft)/2,ne=($t+Wt)/2;J.set(`__group_${Lt}`,{x:he,y:ne}),at.push({label:Lt,lineNumber:Dt.lineNumber,childCount:e.collapsedChildCounts.get(Lt)??Dt.children.length,x:he,y:ne})}let it=Lt=>nt.get(Lt)??J.get(Lt),vt=Lt=>{let Dt=it(Lt),zt=f.get(Lt)??{width:Ma,height:aa};return{x:Dt.x,y:Dt.y,w:zt.width,h:zt.height}},Tt=t.nodes.map(Lt=>{let Dt=vt(Lt.label);return{label:Lt.label,x:Dt.x,y:Dt.y,width:Dt.w,height:Dt.h}}),At=t.edges.flatMap(Lt=>{let Dt=it(Lt.source),zt=it(Lt.target);if(!Dt||!zt)return[];let $t=vt(Lt.source),ft=vt(Lt.target),Wt=M($t,zt),he=M(ft,Dt);return[{source:Lt.source,target:Lt.target,...Lt.label!==void 0&&{label:Lt.label},bidirectional:Lt.bidirectional,lineNumber:Lt.lineNumber,points:[Wt,he],yOffset:0,parallelCount:1,metadata:Lt.metadata,straight:!0}]}),rt=16,pt=new Map(Tt.map(Lt=>[Lt.label,Lt])),ht=[];for(let Lt of t.groups){let Dt=1/0,zt=1/0,$t=-1/0,ft=-1/0;for(let Zt of Lt.children){let Ie=pt.get(Zt);Ie&&(Dt=Math.min(Dt,Ie.x-Ie.width/2),$t=Math.max($t,Ie.x+Ie.width/2),zt=Math.min(zt,Ie.y-Ie.height/2),ft=Math.max(ft,Ie.y+Ie.height/2))}if(!Number.isFinite(Dt))continue;let Wt=Dt-rt,he=$t+rt,ne=zt-Mf,se=ft+rt;ht.push({label:Lt.label,lineNumber:Lt.lineNumber,x:(Wt+he)/2,y:(ne+se)/2,width:he-Wt,height:se-ne,collapsed:!1,childCount:Lt.children.length})}for(let Lt of at)ht.push({label:Lt.label,lineNumber:Lt.lineNumber,x:Lt.x,y:Lt.y,width:Ma,height:aa,collapsed:!0,childCount:Lt.childCount});let dt=40,ut=1/0,yt=1/0,kt=-1/0,Ot=-1/0,Xt=(Lt,Dt)=>{Lt<ut&&(ut=Lt),Lt>kt&&(kt=Lt),Dt<yt&&(yt=Dt),Dt>Ot&&(Ot=Dt)};for(let Lt of Tt)Xt(Lt.x-Lt.width/2,Lt.y-Lt.height/2),Xt(Lt.x+Lt.width/2,Lt.y+Lt.height/2);for(let Lt of At)for(let Dt of Lt.points)Xt(Dt.x,Dt.y);for(let Lt of ht)Xt(Lt.x-Lt.width/2,Lt.y-Lt.height/2),Xt(Lt.x+Lt.width/2,Lt.y+Lt.height/2);let bt=2,Nt=ut<dt-bt?dt-ut:0,Vt=yt<dt-bt?dt-yt:0,xt=Nt!==0||Vt!==0;return{nodes:xt?Tt.map(Lt=>({...Lt,x:Lt.x+Nt,y:Lt.y+Vt})):Tt,edges:xt?At.map(Lt=>({...Lt,points:Lt.points.map(Dt=>({x:Dt.x+Nt,y:Dt.y+Vt}))})):At,groups:xt?ht.map(Lt=>({...Lt,x:Lt.x+Nt,y:Lt.y+Vt})):ht,width:kt+Nt+dt,height:Ot+Vt+dt}}function H(nt){let J=nt.seed===void 0?null:WQ(nt.seed+1),at=dt=>J?BQ(dt,J):dt.slice(),it=new er.graphlib.Graph({compound:!0,multigraph:!0});it.setGraph({rankdir:h,ranker:nt.ranker,nodesep:nt.nodesep,ranksep:nt.ranksep,edgesep:20,marginx:40,marginy:40}),it.setDefaultEdgeLabel(()=>({}));for(let dt of at(t.groups))it.setNode(m(dt.label),{label:dt.label});for(let dt of at(t.nodes)){let ut=f.get(dt.label);it.setNode(dt.label,{width:ut.width,height:ut.height})}for(let dt of u)it.setNode(m(dt),{width:Ma,height:aa});for(let dt of t.groups){dt.parentGroup&&it.hasNode(m(dt.parentGroup))&&it.setParent(m(dt.label),m(dt.parentGroup));for(let ut of at(dt.children))it.hasNode(ut)&&it.setParent(ut,m(dt.label))}if(e)for(let dt of u){let ut=e.originalGroups.find(yt=>yt.label===dt);ut?.parentGroup&&!u.has(ut.parentGroup)&&it.hasNode(m(ut.parentGroup))&&it.setParent(m(dt),m(ut.parentGroup))}for(let dt of at(t.edges)){let ut=v(dt.source),yt=A(dt.target);if(ut!==yt&&it.hasNode(ut)&&it.hasNode(yt)){let kt={};if(o&&dt.label){let Ot=E1(dt.label,xg);kt={width:Ot.width,height:Ot.height,labelpos:"c"}}it.setEdge(ut,yt,kt,C(dt))}}er.layout(it);let vt=t.nodes.map(dt=>{let ut=it.node(dt.label);return{label:dt.label,x:ut.x,y:ut.y,width:ut.width,height:ut.height}}),Tt=t.groups.map(dt=>{let ut=it.node(m(dt.label));return{label:dt.label,lineNumber:dt.lineNumber,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!1,childCount:dt.children.length}});for(let dt of u){let ut=it.node(m(dt));Tt.push({label:dt,lineNumber:0,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!0,childCount:e?.collapsedChildCounts.get(dt)??0})}let At=new Map;for(let dt of t.groups){let ut=it.node(m(dt.label));ut&&At.set(m(dt.label),{x:ut.x,y:ut.y,w:ut.width,h:ut.height})}let rt=(dt,ut,yt)=>{if(dt.length<2)return dt;let kt=dt,Ot=At.get(ut);if(Ot){let bt=0;for(;bt<kt.length-1&&w(kt[bt],Ot);)bt++;kt=[M(Ot,kt[bt]),...kt.slice(bt)]}let Xt=At.get(yt);if(Xt){let bt=kt.length-1;for(;bt>0&&w(kt[bt],Xt);)bt--;kt=[...kt.slice(0,bt+1),M(Xt,kt[bt])]}return kt},pt=t.edges.flatMap(dt=>{let ut=v(dt.source),yt=A(dt.target),kt=C(dt);if(ut===yt||!it.hasEdge(ut,yt,kt))return[];let Ot=it.edge(ut,yt,kt),Xt=rt(Ot?.points??[],dt.source,dt.target);return[{source:dt.source,target:dt.target,...dt.label!==void 0&&{label:dt.label},bidirectional:dt.bidirectional,lineNumber:dt.lineNumber,points:Xt,yOffset:0,parallelCount:1,metadata:dt.metadata}]}),ht=it.graph();return{nodes:vt,edges:pt,groups:Tt,width:ht.width??800,height:ht.height??600}}if(G)return I(k);let O=t.nodes.length,D=n?.seeds??(O<=12?80:O<=22?40:O<=35?22:10),W=n?.refineK??6,z=n?.lambda??DQ,P=n?.previousPositions,B=["network-simplex","tight-tree","longest-path"],Y=[{nodesep:50,ranksep:60},{nodesep:34,ranksep:46},{nodesep:66,ranksep:82}],V=[];for(let nt of B)for(let J of Y)V.push({ranker:nt,...J});for(let nt=0;nt<D;nt++)V.push({ranker:"network-simplex",nodesep:50,ranksep:60,seed:nt});let j=(nt,J)=>{let at=lO(nt,J);return at>J?1/0:at+cO(nt)+dO(nt)+Sg(nt)},K=(nt,J)=>J*1e6+JQ(nt)+z*QQ(nt,P)*10,$=V.length+Math.min(n?.refineK??6,V.length),U=0,X=async nt=>{if(!a)return;a(++U,$,nt);let J=performance.now();J-c>s&&J-d>l&&(d=J,await i())},q=[];for(let nt of V){try{q.push(H(nt))}catch{}await X("Optimizing layout")}if(!q.length)return H({ranker:"network-simplex",nodesep:50,ranksep:60});let et=[];try{et=tO(t,f)}catch{}if(t.groups.length>0&&u.size===0)try{et=et.concat(oO(t,f))}catch{}let tt=new Map;for(let nt of q)tt.set(nt,K(nt,sO(nt)));q.sort((nt,J)=>tt.get(nt)-tt.get(J));let F=Math.min(W,q.length),Q=q[0],ot=1/0,Z=1/0,lt=nt=>{let J=j(nt,Z);if(J===1/0)return;let at=K(nt,J);at<ot&&(ot=at,Z=J,Q=nt)};for(let nt of q.slice(0,F))lt(nt),await X("Refining layout");if(Z>=OQ&&O<=GQ){let nt=[];for(let at=D;at<D+$Q;at++)try{nt.push(H({ranker:"network-simplex",nodesep:50,ranksep:60,seed:at}))}catch{}let J=new Map;for(let at of nt)J.set(at,K(at,sO(at)));nt.sort((at,it)=>J.get(at)-J.get(it));for(let at of nt.slice(0,HQ))lt(at)}for(let nt of et){let J=[nt],at=L1(nt);at!==nt&&J.push(at);for(let it of J){let vt=j(it,Z-1);vt<Z&&(Z=vt,Q=it)}}if(Z>0){let nt=L1(Q);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}if(Z>0&&Sg(Q)>0){let nt=uO(Q,t);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}return Q}var DQ,OQ,GQ,$Q,HQ,FQ,YQ,aO,Mf,pO=st(()=>{"use strict";ls();Eo();Nf();eO();k1();v1();DQ=4,OQ=4,GQ=45,$Q=18,HQ=10;FQ=Kn().x(t=>t.x).y(t=>t.y).curve(fo),YQ=/[MLQC]|-?\d*\.?\d+(?:e-?\d+)?/gi;aO=new WeakMap;Mf=32});var xO={};ye(xO,{NODE_HEIGHT:()=>aa,NODE_WIDTH:()=>Ma,computeNodeSize:()=>T1,layoutBoxesAndLines:()=>uJ});function cJ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t.charAt(r-1),a=t.charAt(r),i=r+1<t.length?t.charAt(r+1):"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function dJ(t,e=Ma){let n=t.split(/[\s-]+/),r=[];for(let a of n)a&&r.push(...cJ(a));let o=e-24;for(let a=13;a>=9;a--){if(o<_t("MM",a))continue;let i=1,s="";for(let l of r){let c=s?`${s} ${l}`:l;_t(c,a)<=o?s=c:(i++,s=l)}if(i<=_1)return Math.min(i,_1)}return _1}function T1(t,e){if(!t.description||t.description.length===0)return{width:Ma,height:aa};let n=rJ,o=dJ(t.label,n)*13*aJ+iJ,a=n-24,i=0;for(let c of t.description)_t(c,C1)<=a?i+=1:i+=Tn(c,C1,a,{hardBreak:!0}).length;i=Math.min(i,oJ);let s=i*C1*yO,l=o+bO+A1+s+A1+(e?lJ:0);return{width:n,height:Math.max(aa,l)}}async function uJ(t,e,n){let{layoutBoxesAndLinesSearch:r}=await Promise.resolve().then(()=>(pO(),fO)),o={...n?.hideDescriptions!==void 0&&{hideDescriptions:n.hideDescriptions},...n?.previousPositions!==void 0&&{previousPositions:n.previousPositions},...n?.onProgress!==void 0&&{onProgress:n.onProgress}},a=await r(t,e,o),i=S1(gO(a));if(i.unresolved.length>0){let s=await r(t,e,{...o,reserveEdgeLabels:!0}),l=S1(gO(s));l.unresolved.length<i.unresolved.length&&(i=l)}return fJ(i.layout,t,n?.collapsedNotes)}function fJ(t,e,n){let o=e.options?.["no-notes"]==="on"||!e.notes?new Map:no(e.notes,e.nodes.map(y=>({id:y.label,label:y.label})));if(o.size===0)return t;let a=Hc(t.nodes.map(y=>({id:y.label,x:y.x,y:y.y,width:y.width,height:y.height})),o,e.direction==="TB"?"TB":"LR",n),i=t.nodes.map(y=>{let b=a.get(y.label);return b?{...y,note:b}:y}),s=1/0,l=1/0,c=-1/0,d=-1/0,u=(y,b,S,x)=>{y<s&&(s=y),b<l&&(l=b),S>c&&(c=S),x>d&&(d=x)};for(let y of i)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2),y.note&&!y.note.collapsed&&u(y.x+y.note.x,y.y+y.note.y,y.x+y.note.x+y.note.width,y.y+y.note.y+y.note.height);for(let y of t.groups)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2);if(!Number.isFinite(s))return{...t,nodes:i};let{shiftX:f,shiftY:p}=Ws(s,l),m=f!==0||p!==0,h=m?i.map(y=>({...y,x:y.x+f,y:y.y+p})):i,g=m?t.edges.map(y=>({...y,points:y.points.map(b=>({x:b.x+f,y:b.y+p})),...y.labelX!==void 0&&{labelX:y.labelX+f},...y.labelY!==void 0&&{labelY:y.labelY+p}})):t.edges,E=m?t.groups.map(y=>({...y,x:y.x+f,y:y.y+p})):t.groups;return{nodes:h,edges:g,groups:E,width:c+f+mO,height:d+p+mO}}function gO(t){let e=new Map;if(t.edges.forEach((o,a)=>{let[i,s]=o.source<o.target?[o.source,o.target]:[o.target,o.source],l=`${i}\0${s}`,c=e.get(l);c?c.push(a):e.set(l,[a])}),[...e.values()].every(o=>o.length<2))return t;let n=new Array(t.edges.length).fill(0),r=new Array(t.edges.length).fill(1);for(let o of e.values()){let a=o.slice(0,hO);for(let i of o.slice(hO))r[i]=0;a.length<2||a.forEach((i,s)=>{n[i]=(s-(a.length-1)/2)*eJ,r[i]=a.length})}return{...t,edges:t.edges.map((o,a)=>({...o,yOffset:n[a],parallelCount:r[a]}))}}var mO,hO,eJ,nJ,aa,Ma,rJ,C1,yO,A1,bO,oJ,_1,aJ,iJ,sJ,lJ,Nf=st(()=>{"use strict";en();v1();es();mO=40,hO=5,eJ=22,nJ=1.618,aa=60,Ma=Math.round(aa*nJ),rJ=140,C1=10,yO=1.4,A1=8,bO=4,oJ=6,_1=3,aJ=1.3,iJ=12,sJ=11,lJ=bO+sJ*yO+A1});var _O={};ye(_O,{layoutSwimlane:()=>hJ});function mJ(t){return t==="exclusive"||t==="parallel"?{w:EO,h:EO}:t==="terminal"?{w:SO,h:SO}:{w:I1,h:TO}}function MO(t,e,n,r){let o=new Map,a=new Map;for(let c of t)o.set(c,[]),a.set(c,0);for(let c of e)o.get(c.from)?.push(c.to),a.set(c.to,(a.get(c.to)??0)+1);let i=new Map(t.map(c=>[c,0])),s=new Map;for(let c of t)s.set(c,new Map);let l=t.filter(c=>(a.get(c)??0)===0);for(let c=0;c<l.length;c++){let d=l[c],u=n(d),f=s.get(d),p=r?.get(d);p!==void 0&&(i.get(d)??0)<p&&i.set(d,p);let m=f.get(u);m!==void 0&&(i.get(d)??0)<=m&&i.set(d,m+1);let h=i.get(d),g=new Map(f);g.set(u,Math.max(g.get(u)??-1,h));for(let E of o.get(d)??[]){let y=h+(n(E)===u?1:0);y>(i.get(E)??0)&&i.set(E,y);let b=s.get(E);for(let[x,L]of g)L>(b.get(x)??-1)&&b.set(x,L);let S=(a.get(E)??0)-1;a.set(E,S),S===0&&l.push(E)}}return i}function hJ(t){let n=t.direction==="LR",r=new Map(t.nodes.map(F=>[F.id,F])),o=t.nodes.map(F=>F.id),a=new Map(t.nodes.map(F=>[F.id,mJ(F.shape)])),i=F=>{let Q=a.get(F);return n?Q.w:Q.h},s=F=>{let Q=a.get(F);return n?Q.h:Q.w},l=t.edges.map((F,Q)=>({from:F.source,to:F.target,idx:Q})).filter(F=>F.from!==F.to&&r.has(F.from)&&r.has(F.to)),{dag:c}=wg(o,l),d=F=>r.get(F).lane,u=MO(o,c.map(F=>({from:F.from,to:F.to})),d),f=new Map;for(let F of o)f.set(F,u.get(F)??0);{let F=new Map(t.lanes.map((Z,lt)=>[Z.id,lt])),Q=c.map(Z=>({from:Z.from,to:Z.to})),ot=new Map;for(let Z=0;Z<o.length;Z++){let lt=!1;for(let nt of l)if(!((f.get(nt.to)??0)>=(f.get(nt.from)??0)))for(let J of[nt.from,nt.to]){let at=f.get(J),it=F.get(d(J));for(let vt of o)vt===nt.from||vt===nt.to||f.get(vt)===at&&((F.get(d(vt))??0)<=it||(ot.get(vt)??0)<=at&&(ot.set(vt,at+1),lt=!0))}if(!lt)break;f=MO(o,Q,d,ot)}}let p=Array.from(new Set(o.map(F=>f.get(F)))).sort((F,Q)=>F-Q),m=new Map(p.map((F,Q)=>[F,Q])),h=p.length,g=F=>m.get(f.get(F))??0,E=vO+vg,y=Array.from({length:h},()=>0);for(let F of o){let Q=g(F);y[Q]=Math.max(y[Q],i(F))}let b=[],S=[];{let F=E;for(let Q=0;Q<h;Q++){let ot=Math.max(y[Q],I1);S[Q]=ot,b[Q]=F+ot/2,F+=ot+wO}}let x=F=>b[F]+S[F]/2+wO/2,L=(h>0?b[h-1]+Math.max(y[h-1],I1)/2:E)+vg,v=(t.phases.length?kO:0)+vg,A=new Map;for(let F of t.nodes){let Q=`${F.lane}\0${g(F.id)}`;(A.get(Q)??A.set(Q,[]).get(Q)).push(F.id)}let C=(F,Q)=>{let ot=A.get(`${F}\0${Q}`)??[];return ot.length===0?0:ot.reduce((Z,lt)=>Z+s(lt),0)+R1*(ot.length-1)},M=new Map,w=new Map,k=new Map;{let F=v;for(let Q of t.lanes){let ot=0;for(let lt=0;lt<h;lt++)ot=Math.max(ot,C(Q.id,lt));let Z=Math.max(pJ,ot+2*CO);M.set(Q.id,F),w.set(Q.id,Z),k.set(Q.id,F+Z/2),F+=Z}}let N=(()=>{let F=v;for(let Q of t.lanes)F+=w.get(Q.id);return F})(),_=new Map,T=new Map;for(let[F,Q]of A){let ot=F.indexOf("\0"),Z=F.slice(0,ot),lt=k.get(Z)??v,nt=Q.reduce((at,it)=>at+s(it),0)+R1*(Q.length-1),J=lt-nt/2;for(let at of Q){let it=s(at);T.set(at,J+it/2),J+=it+R1,_.set(at,b[g(at)])}}let R=0;for(let F of l)(f.get(F.to)??0)<(f.get(F.from)??0)&&R++;let I=R>0?LO+NO*(R-1):0,H=N+I+vg,O=(F,Q)=>n?{x:F,y:Q}:{x:Q,y:F},D=t.nodes.map(F=>{let Q=a.get(F.id),ot=O(_.get(F.id),T.get(F.id));return{id:F.id,label:F.label,shape:F.shape,event:F.event,lane:F.lane,...F.phase!==void 0&&{phase:F.phase},...F.color!==void 0&&{color:F.color},tags:F.tags,x:ot.x,y:ot.y,width:Q.w,height:Q.h,lineNumber:F.lineNumber}}),W=16,z=new Array(t.edges.length).fill(0);{let F=new Map;t.edges.forEach((Q,ot)=>{let Z=r.get(Q.source),lt=r.get(Q.target);if(!Z||!lt||Z.id===lt.id)return;let nt=f.get(Z.id)??0;if((f.get(lt.id)??0)<=nt||Math.abs((T.get(Z.id)??0)-(T.get(lt.id)??0))<.5)return;let at=`${Q.target}\0${nt}`;(F.get(at)??F.set(at,[]).get(at)).push(ot)});for(let Q of F.values())Q.length<2||(Q.sort((ot,Z)=>(T.get(t.edges[ot].source)??0)-(T.get(t.edges[Z].source)??0)),Q.forEach((ot,Z)=>{z[ot]=(Z-(Q.length-1)/2)*W}))}let P=4,B=(F,Q,ot,Z,lt,nt)=>{let J=1/0;for(let Tt of o){if(Tt===F)continue;let At=i(Tt)/2+P;if(Math.abs(_.get(Tt)-Q)>=At)continue;let rt=s(Tt)/2,pt=T.get(Tt);pt+rt<=ot||pt-rt>=Z||(J=Math.min(J,pt-rt))}if(J===1/0)return{flow:Q};let at=lt-1,it=lt<h-1?lt:-1,vt=nt<Q?at:it;return vt<0&&(vt=nt<Q?it:at),vt<0?{flow:Q}:{flow:x(vt),jogCross:(ot+J)/2}},Y=0,V=[];t.edges.forEach((F,Q)=>{let ot=r.get(F.source),Z=r.get(F.target);if(!ot||!Z||ot.id===Z.id)return;let lt=_.get(ot.id),nt=T.get(ot.id),J=_.get(Z.id),at=T.get(Z.id),it=i(ot.id)/2,vt=i(Z.id)/2,Tt=s(ot.id)/2,At=s(Z.id)/2,rt=f.get(ot.id)??0,pt=f.get(Z.id)??0,ht,dt=!1;if(pt>rt){let ut=lt+it,yt=J-vt;if(Math.abs(nt-at)<.5)ht=[O(ut,nt),O(yt,at)];else{let kt=(ut+yt)/2+z[Q];ht=[O(ut,nt),O(kt,nt),O(kt,at),O(yt,at)]}}else if(pt===rt){let ut=at>=nt,yt=nt+(ut?Tt:-Tt),kt=at+(ut?-At:At);if(Math.abs(lt-J)<.5)ht=[O(lt,yt),O(J,kt)];else{let Ot=(yt+kt)/2;ht=[O(lt,yt),O(lt,Ot),O(J,Ot),O(J,kt)]}}else{dt=!0;let ut=N+LO+NO*Y;Y++;let yt=nt+Tt,kt=at+At,Ot=B(ot.id,lt,yt,ut,g(ot.id),J),Xt=B(Z.id,J,kt,ut,g(Z.id),lt);ht=[O(lt,yt),...Ot.jogCross!==void 0?[O(lt,Ot.jogCross),O(Ot.flow,Ot.jogCross)]:[],O(Ot.flow,ut),O(Xt.flow,ut),...Xt.jogCross!==void 0?[O(Xt.flow,Xt.jogCross),O(J,Xt.jogCross)]:[],O(J,kt)]}V.push({source:F.source,target:F.target,...F.label!==void 0&&{label:F.label},points:ht,back:dt,lineNumber:F.lineNumber})});let j=(F,Q,ot,Z)=>n?{x:F,y:ot,width:Q,height:Z}:{x:ot,y:F,width:Z,height:Q},K=t.lanes.map(F=>{let Q=j(0,L,M.get(F.id),w.get(F.id));return{id:F.id,label:F.label,...F.color!==void 0&&{color:F.color},...Q,headerSize:vO,lineNumber:F.lineNumber}}),$=new Map(t.phases.map((F,Q)=>[F.id,Q])),U=Array.from({length:h},()=>{});for(let F of t.nodes){if(F.phase===void 0)continue;let Q=$.get(F.phase);if(Q===void 0)continue;let ot=g(F.id),Z=U[ot];(Z===void 0||Q<Z)&&(U[ot]=Q)}let X=Array.from({length:h},()=>0),q=0;for(let F=0;F<h;F++){let Q=U[F];Q!==void 0&&Q>q&&(q=Q),X[F]=q}let et=(F,Q)=>(b[F]+b[Q])/2,tt=[];if(t.phases.length>0&&h>0){let F=0;for(let Q=1;Q<=h;Q++)if(Q===h||X[Q]!==X[F]){let ot=F,Z=Q-1,lt=t.phases[X[F]],nt=ot===0?0:et(ot-1,ot),J=Z===h-1?L:et(Z,Z+1);tt.push({id:lt.id,label:lt.label,...j(nt,J-nt,0,H),headerSize:kO,lineNumber:lt.lineNumber}),F=Q}}return{nodes:D,edges:V,lanes:K,phases:tt,width:n?L:H,height:n?H:L}}var vg,wO,I1,TO,EO,SO,R1,CO,pJ,vO,kO,LO,NO,AO=st(()=>{"use strict";k1();vg=30,wO=64,I1=124,TO=44,EO=56,SO=40,R1=16,CO=22,pJ=TO+2*CO,vO=116,kO=30,LO=28,NO=18});function vd(t,e){let{idPrefix:n,width:r,height:o,baseFill:a,colors:i}=e,s=(l,c)=>{t.append("marker").attr("id",l).attr("viewBox",`0 0 ${r} ${o}`).attr("refX",r).attr("refY",o/2).attr("markerWidth",r).attr("markerHeight",o).attr("orient","auto").append("polygon").attr("points",`0,0 ${r},${o/2} 0,${o}`).attr("fill",c)};s(`${n}-arrow`,a);for(let l of i??[])s(`${n}-arrow-${l.replace("#","")}`,l)}var kg=st(()=>{"use strict"});var OO={};ye(OO,{renderSwimlaneForExport:()=>kJ});function SJ(t,e){if(t.length<3)return t.map((o,a)=>`${a?"L":"M"}${o.x} ${o.y}`).join(" ");let n=`M${t[0].x} ${t[0].y}`;for(let o=1;o<t.length-1;o++){let a=t[o-1],i=t[o],s=t[o+1],l=Math.hypot(i.x-a.x,i.y-a.y),c=Math.hypot(s.x-i.x,s.y-i.y);if(l<.01||c<.01){n+=` L${i.x} ${i.y}`;continue}let d=Math.min(e,l/2,c/2),u=i.x-(i.x-a.x)/l*d,f=i.y-(i.y-a.y)/l*d,p=i.x+(s.x-i.x)/c*d,m=i.y+(s.y-i.y)/c*d;n+=` L${u} ${f} Q${i.x} ${i.y} ${p} ${m}`}let r=t[t.length-1];return n+=` L${r.x} ${r.y}`,n}function vJ(t,e,n,r,o,a){let i=o-n,s=a-r,l=i*i+s*s,c=l>0?((t-n)*i+(e-r)*s)/l:0;return c=Math.max(0,Math.min(1,c)),Math.hypot(t-(n+c*i),e-(r+c*s))}function PO(t,e,n,r,o={}){let a=Math.min(n,r)/2,i=Math.min(o.tl??0,a),s=Math.min(o.tr??0,a),l=Math.min(o.br??0,a),c=Math.min(o.bl??0,a);return[`M${t+i},${e}`,`H${t+n-s}`,s?`A${s},${s} 0 0 1 ${t+n},${e+s}`:"",`V${e+r-l}`,l?`A${l},${l} 0 0 1 ${t+n-l},${e+r}`:"",`H${t+c}`,c?`A${c},${c} 0 0 1 ${t},${e+r-c}`:"",`V${e+i}`,i?`A${i},${i} 0 0 1 ${t+i},${e}`:"","Z"].join(" ")}function kJ(t,e,n,r,o,a={}){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.title?40:0,s=a.exportDims?.width??n.width,l=(a.exportDims?.height??n.height)+0,c=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",s).attr("height",l).attr("viewBox",`0 0 ${s} ${l}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It),d=c.append("defs"),u=nr(r,o),f={error:r.colors.red,success:r.colors.green,terminate:r.text,neutral:r.border};vd(d,{idPrefix:"sw",width:wJ,height:EJ,baseFill:r.textMuted,colors:[f.error,f.success]});let p=c.append("g").attr("transform",`translate(0, ${i})`);e.title&&c.append("text").attr("x",s/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).text(e.title);let m=new Map;e.lanes.forEach((M,w)=>{let k=M.color??Dn(yl[w%yl.length],r)??r.border;m.set(M.id,k)});let h=e.direction==="LR",g=e.options["solid-fill"]==="on",E=M=>Gt(M,u,9),y=M=>{for(let w of n.lanes){let k=h?w.y:w.x,N=k+(h?w.height:w.width);if(M>=k&&M<=N)return E(m.get(w.id)??r.border)}return u},b=p.append("g").attr("class","dgmo-swimlane-lanes");for(let M of n.lanes){let w=m.get(M.id)??r.border,k=h?M.x:M.x+Ng,N=h?M.y+Ng:M.y,_=h?M.width:M.width-Ng*2,T=h?M.height-Ng*2:M.height;b.append("path").attr("d",PO(k,N,_,T,{tl:cs,tr:cs,br:cs,bl:cs})).attr("fill",Gt(w,u,9)).attr("stroke",Gt(r.border,u,60)).attr("stroke-width",1).attr("data-line-number",String(M.lineNumber));let R=h?M.headerSize:_,G=h?T:M.headerSize;b.append("path").attr("d",PO(k,N,R,G,h?{tl:cs,bl:cs}:{tl:cs,tr:cs})).attr("fill",Gt(w,u,16)).attr("opacity",.6),b.append("text").attr("x",h?k+12:k+_/2).attr("y",h?N+T/2:N+M.headerSize/2).attr("text-anchor",h?"start":"middle").attr("dominant-baseline","middle").attr("font-size",gJ).attr("font-weight","700").attr("fill",Gt(w,r.text,55)).text(M.label)}let S=p.append("g").attr("class","dgmo-swimlane-phases");n.phases.forEach((M,w)=>{w%2===1&&S.append("rect").attr("x",M.x).attr("y",M.y).attr("width",M.width).attr("height",M.height).attr("rx",cs).attr("fill",r.text).attr("opacity",.05).attr("pointer-events","none"),S.append("text").attr("x",h?M.x+M.width/2:M.headerSize/2).attr("y",h?M.headerSize/2:M.y+M.height/2).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",yJ).attr("font-weight","700").attr("letter-spacing","0.06em").attr("fill",r.textMuted).attr("data-line-number",String(M.lineNumber)).text(M.label)});let x=a.activeTagGroup??null,L=M=>{if(x){let k=qt(x);if(M.tags[k]){let N=ar(M.tags,[...e.tagGroups],x);if(N&&N!=="#999999")return{fill:g?N:Gt(N,u,22),stroke:N}}}if(M.shape==="terminal")return M.event==="error"?{fill:g?f.error:Gt(f.error,u,22),stroke:f.error}:M.event==="success"?{fill:g?f.success:Gt(f.success,u,22),stroke:f.success}:M.event==="terminate"?{fill:Gt(r.text,u,30),stroke:r.text}:{fill:r.bg,stroke:r.textMuted};if(M.shape==="exclusive"||M.shape==="parallel")return{fill:Gt(r.surface,u,80),stroke:r.textMuted};let w=m.get(M.lane)??r.border;return{fill:g?w:Gt(w,u,20),stroke:Gt(w,r.text,40)}},v=new Map(n.nodes.map(M=>[M.id,M])),A=p.append("g").attr("class","dgmo-swimlane-edges");for(let M of n.edges){let w=v.get(M.target),k=r.textMuted,N="sw-arrow";w?.shape==="terminal"&&w.event==="error"?(k=f.error,N=`sw-arrow-${f.error.replace("#","")}`):w?.shape==="terminal"&&w.event==="success"&&(k=f.success,N=`sw-arrow-${f.success.replace("#","")}`);let _=SJ(M.points,xJ);if(A.append("path").attr("d",_).attr("fill","none").attr("stroke",k).attr("stroke-width",bJ).attr("stroke-dasharray",M.back?"5 4":null).attr("marker-end",`url(#${N})`).attr("data-line-number",String(M.lineNumber)),M.label){let T=[],R=0;for(let q=0;q<M.points.length-1;q++){let et=M.points[q],tt=M.points[q+1],F=Math.abs(tt.x-et.x)+Math.abs(tt.y-et.y);T.push(F),R+=F}let G=R/2,I=0;for(let q=0;q<T.length;q++){if(G<=T[q]||q===T.length-1){I=q;break}G-=T[q]}let H=M.points[I],O=M.points[I+1]??H,D=T[I]>0?G/T[I]:.5,W={x:H.x+(O.x-H.x)*D,y:H.y+(O.y-H.y)*D},z=Math.abs(O.x-H.x)>=Math.abs(O.y-H.y),P=7,B=(q,et)=>{let tt=1/0;for(let F of n.edges)if(F!==M)for(let Q=0;Q<F.points.length-1;Q++){let ot=vJ(q,et,F.points[Q].x,F.points[Q].y,F.points[Q+1].x,F.points[Q+1].y);ot<tt&&(tt=ot)}return tt},Y=M.label.length*RO*.6,V=(q,et,tt)=>{let F=tt===0?[q-Y/2,q,q+Y/2]:[q,q+tt*Y/2,q+tt*Y];return Math.min(...F.map(Q=>B(Q,et)))},j=10,K,$,U,X;if(z){let q=V(W.x,W.y-P,0),et=V(W.x,W.y+P,0),tt=q<j&&et>q;K=W.x,$=W.y+(tt?P:-P),U="middle",X=tt?"hanging":"auto"}else{let q=V(W.x+P,W.y,1),et=V(W.x-P,W.y,-1),tt=q<j&&et>q;K=W.x+(tt?-P:P),$=W.y,U=tt?"end":"start",X="middle"}A.append("text").attr("x",K).attr("y",$).attr("text-anchor",U).attr("dominant-baseline",X).attr("font-size",RO).attr("fill",k===r.textMuted?r.textMuted:k).attr("stroke",y($)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}}let C=p.append("g").attr("class","dgmo-swimlane-nodes");for(let M of n.nodes){let{fill:w,stroke:k}=L(M),N=C.append("g").attr("data-line-number",String(M.lineNumber)).attr("data-lane",M.lane),_=M.x,T=M.y;if(M.shape==="exclusive"||M.shape==="parallel"){let R=M.width/2;if(N.append("polygon").attr("points",`${_},${T-R} ${_+R},${T} ${_},${T+R} ${_-R},${T}`).attr("fill",w).attr("stroke",k).attr("stroke-width",P1),M.shape==="parallel"){let G=r.textMuted;N.append("line").attr("x1",_).attr("y1",T-R/2.4).attr("x2",_).attr("y2",T+R/2.4).attr("stroke",G).attr("stroke-width",2.4),N.append("line").attr("x1",_-R/2.4).attr("y1",T).attr("x2",_+R/2.4).attr("y2",T).attr("stroke",G).attr("stroke-width",2.4),N.append("text").attr("x",_).attr("y",T+R+12).attr("text-anchor","middle").attr("font-size",Lg-1).attr("fill",r.textMuted).attr("stroke",y(T+R+12)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}else DO(N,M.label,_,T,r.text,Lg-1,!0,y(T))}else if(M.shape==="terminal"){let R=M.width/2;N.append("circle").attr("cx",_).attr("cy",T).attr("r",R).attr("fill",w).attr("stroke",k).attr("stroke-width",M.event==="none"?P1:2.4),M.event==="success"&&N.append("circle").attr("cx",_).attr("cy",T).attr("r",R-4).attr("fill","none").attr("stroke",k).attr("stroke-width",1);let G=!1;for(let H of n.edges){let O=H.target===M.id?H.points[H.points.length-1]:H.source===M.id?H.points[0]:void 0;O&&O.y>T+R*.5&&(G=!0)}let I=G?T-R-6:T+R+12;N.append("text").attr("x",_).attr("y",I).attr("text-anchor","middle").attr("font-size",Lg-1).attr("fill",r.text).attr("stroke",y(I)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(M.label)}else{N.append("rect").attr("x",_-M.width/2).attr("y",T-M.height/2).attr("width",M.width).attr("height",M.height).attr("rx",IO).attr("fill",w).attr("stroke",k).attr("stroke-width",P1),M.shape==="subprocess"&&N.append("rect").attr("x",_-M.width/2+3).attr("y",T-M.height/2+3).attr("width",M.width-6).attr("height",M.height-6).attr("rx",IO-2).attr("fill","none").attr("stroke",k).attr("stroke-width",1);let R=ve(w,r.textOnFillLight,r.textOnFillDark);DO(N,M.label,_,T,R,Lg)}}}function LJ(t,e){let n=[],r="";for(let o of t)r===""?r=o:r.length+1+o.length<=e?r+=" "+o:(n.push(r),r=o);return r&&n.push(r),n}function DO(t,e,n,r,o,a,i=!1,s){let l=e.split(/\s+/),c;if(i)c=l.length===1?[e]:LJ(l,7);else if(e.length<=14||l.length===1)c=[e];else{let f=Math.ceil(l.length/2);c=[l.slice(0,f).join(" "),l.slice(f).join(" ")]}let d=a*1.2,u=r-(c.length-1)*d/2;c.forEach((f,p)=>{let m=t.append("text").attr("x",n).attr("y",u+p*d).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",a).attr("fill",o);s&&m.attr("stroke",s).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke"),m.text(f)})}var Lg,gJ,yJ,RO,IO,P1,bJ,xJ,wJ,EJ,cs,Ng,GO=st(()=>{"use strict";Xn();on();kg();tn();xr();Ke();Lg=12,gJ=12,yJ=12,RO=11,IO=8,P1=1.5,bJ=1.6,xJ=11,wJ=9,EJ=6.4,cs=10,Ng=2});function MJ(t){let e=[],n=t.split(/(\s+)/);for(let r of n){if(/^\s+$/.test(r))continue;let o=r.split(/(?<=-)(?=\S)/);e.push(...o)}return e}function $O(t,e,n,r){let o=e-O1,a=[],i="";for(let s of t){let l=i&&!i.endsWith("-")?" ":"",c=i+l+s;if(_t(c,n)<=o)i=c;else if(!i)i=s;else{if(a.push(i),a.length>=r)return null;i=s}}return i&&a.push(i),a.length>r?null:a}function HO(t,e,n){let r=e-O1,o=[...t],a=o[o.length-1];return _t(a,n)>r&&(o[o.length-1]=tr(a,n,r)),o}function WO(t,e,n,r,o=BO){if(!t)return{lines:[""],fontSize:n};let a=MJ(t);for(let c=n;c>=r;c--){let d=$O(a,e,c,o);if(d)return{lines:HO(d,e,c),fontSize:c}}let i=$O(a,e,r,999)??[t],s=i.slice(0,o),l=HO(s,e,r);if(i.length>o){let c=l[l.length-1];if(!c.endsWith("\u2026")){let d=e-O1;_t(c+"\u2026",r)>d?l[l.length-1]=tr(c,r,d):l[l.length-1]=c+"\u2026"}}return{lines:l,fontSize:r}}function _J(t){return Math.max(FO,TJ-t*CJ)}function Mg(t,e,n,r,o){let a=_J(n),i=WO(t,r,a,FO,BO),s=[],l=D1;if(!o&&e&&e.length>0){let c=NJ;for(let d of e){if(c<=0)break;let u=ea(d),f=WO(u,r,D1,D1,c);s.push(...f.lines),c-=f.lines.length,l=f.fontSize}}return{labelLines:i.lines,labelFontSize:i.fontSize,descLines:s,descFontSize:l}}var O1,BO,NJ,TJ,FO,CJ,D1,G1=st(()=>{"use strict";Qa();en();O1=16,BO=3,NJ=2;TJ=17,FO=9,CJ=3,D1=10});var zO={};ye(zO,{layoutMindmap:()=>Cg});function Cg(t,e,n){let r=t.roots;if(r.length===0)return{nodes:[],edges:[],width:0,height:0};let o=n?.hiddenCounts??new Map,a=n?.activeTagGroup??null,i=n?.hideDescriptions??!1,s=n?.ctx??Ee.identity(),l={rootWidth:s.structural(AJ),depth1Width:s.structural(RJ),leafWidth:s.structural(IJ),hGap:s.aesthetic($J),vGap:s.aesthetic(HJ),margin:s.aesthetic(WJ),multiRootGap:s.aesthetic(BJ)};jJ(r);let c=[],d=f=>{for(let p of f)c.push(p),d(p.children)};d(r),Ea(c,t.tagGroups);let u=t.tagGroups;return r.length===1?YO(r[0],o,i,u,a,l):FJ(r,t,o,i,u,a,l)}function YO(t,e,n,r=[],o=null,a){let i=[],s=B1(0,a),l=F1(t,n,a),c=t.children,{right:d,left:u}=VJ(c,n,a),f=Tg(d,1,n,a),p=Tg(u,1,n,a),m=Math.max(f,p,l),h=0,g=m/2-l/2;i.push({node:t,x:h,y:g,width:s,height:l,depth:0,direction:"right",subtreeHeight:m});let E=g+l/2,y=h+s+a.hGap;$1(d,y,E,1,"right",n,i,a);let b=h-a.hGap;return $1(u,b,E,1,"left",n,i,a),zJ(i,e,n,t,r,o,a)}function FJ(t,e,n,r,o,a,i){let s=[];for(let p of t)s.push(YO(p,n,r,o,a,i));let l=s.reduce((p,m)=>p+m.width,0)+i.multiRootGap*(s.length-1),c=Math.max(...s.map(p=>p.height)),d=[],u=[],f=0;for(let p of s){let m=(c-p.height)/2;for(let h of p.nodes)d.push({...h,x:h.x+f,y:h.y+m});for(let h of p.edges)u.push({sourceId:h.sourceId,targetId:h.targetId,path:UJ(h.path,f,m)});f+=p.width+i.multiRootGap}return{nodes:d,edges:u,width:l,height:c}}function $1(t,e,n,r,o,a,i,s){if(t.length===0)return;let l=Tg(t,r,a,s),c=n-l/2;for(let d of t){let u=B1(r,s),f=F1(d,a,s),p=W1(d,r,a,s),m=c+p/2-f/2,h=o==="right"?e:e-u;if(i.push({node:d,x:h,y:m,width:u,height:f,depth:r,direction:o,subtreeHeight:p}),d.children.length>0){let g=m+f/2,E=o==="right"?h+u+s.hGap:h-s.hGap;$1(d.children,E,g,r+1,o,a,i,s)}c+=p+s.vGap}}function Tg(t,e,n,r){if(t.length===0)return 0;let o=0;for(let a of t)o+=W1(a,e,n,r);return o+=r.vGap*(t.length-1),o}function W1(t,e,n,r){let o=F1(t,n,r);if(t.children.length===0)return o;let a=Tg(t.children,e+1,n,r);return Math.max(o,a)}function YJ(t,e,n){return t.color?t.color:ar(t.metadata,[...e],n)}function zJ(t,e,n,r,o=[],a=null,i){let s=1/0,l=1/0,c=-1/0,d=-1/0;for(let S of t)s=Math.min(s,S.x),l=Math.min(l,S.y),c=Math.max(c,S.x+S.width),d=Math.max(d,S.y+S.height);let u=-s+i.margin,f=-l+i.margin,p=c-s+i.margin*2,m=d-l+i.margin*2,h=new Map;for(let S of t)h.set(S.node.id,S);let g=[],E=[];for(let S of t){let x=YJ(S.node,o,a),L=e.get(S.node.id);g.push({id:S.node.id,label:S.node.label,...S.node.description!==void 0&&{description:[...S.node.description]},metadata:{...S.node.metadata},lineNumber:S.node.lineNumber,...x!==void 0&&{color:x},x:S.x+u,y:S.y+f,width:S.width,height:S.height,depth:S.depth,angle:0,radius:0,...L!==void 0&&{hiddenCount:L},hasChildren:e.has(S.node.id)||S.node.children.length>0})}let y=new Map;for(let S of t)if(S.node.parentId){let x=y.get(S.node.parentId)??[];x.push(S),y.set(S.node.parentId,x)}let b=[];for(let[S,x]of y){let L=x.filter(A=>A.direction==="right"),v=x.filter(A=>A.direction==="left");L.length>0&&b.push([S,L]),v.length>0&&b.push([S,v])}for(let[S,x]of b){let L=h.get(S),v=L.x+u,A=L.y+f,C=x[0].direction==="left",M=C?v:v+L.width,w=A+L.height/2,k=x[0],N=C?k.x+u+k.width:k.x+u,_=(M+N)/2;if(x.length===1){let T=x[0],R=C?T.x+u+T.width:T.x+u,G=T.y+f+T.height/2;E.push({sourceId:S,targetId:T.node.id,path:`M ${M} ${w} L ${_} ${w} L ${_} ${G} L ${R} ${G}`})}else{E.push({sourceId:S,targetId:S,path:`M ${M} ${w} L ${_} ${w}`});let T=x.map(I=>I.y+f+I.height/2),R=Math.min(...T),G=Math.max(...T);E.push({sourceId:S,targetId:S,path:`M ${_} ${R} L ${_} ${G}`});for(let I=0;I<x.length;I++){let H=x[I],O=C?H.x+u+H.width:H.x+u,D=T[I];E.push({sourceId:S,targetId:H.node.id,path:`M ${_} ${D} L ${O} ${D}`})}}}return{nodes:g,edges:E,width:p,height:m}}function VJ(t,e,n){if(t.length<=1)return{right:[...t],left:[]};if(t.length===2)return{right:[t[0]],left:[t[1]]};let r=t.map((l,c)=>({index:c,node:l,height:W1(l,1,e,n)})),o=[],a=[],i=0,s=0;for(let l of r)i<=s?(o.push(l.node),i+=l.height):(a.push(l.node),s+=l.height);return{right:o,left:a}}function UJ(t,e,n){return e===0&&n===0?t:t.replace(/([ML])\s*([\d.e+-]+)\s+([\d.e+-]+)/g,(r,o,a,i)=>`${o} ${parseFloat(a)+e} ${parseFloat(i)+n}`)}function B1(t,e){return t===0?e.rootWidth:t===1?e.depth1Width:e.leafWidth}function F1(t,e,n){let r=XJ(t),o=B1(r,n),a=Mg(t.label,t.description?[...t.description]:void 0,r,o,e),i=a.labelLines.length,l=(i<=1?PJ:DJ*i)+GJ;return a.descLines.length>0&&(l+=OJ*a.descLines.length+4),l}function XJ(t){return H1.get(t.id)??0}function jJ(t){H1.clear();let e=(n,r)=>{for(let o of n)H1.set(o.id,r),e(o.children,r+1)};e(t,0)}var AJ,RJ,IJ,PJ,DJ,OJ,GJ,$J,HJ,WJ,BJ,H1,Y1=st(()=>{"use strict";Ke();G1();fr();AJ=180,RJ=150,IJ=120,PJ=28,DJ=18,OJ=14,GJ=10,$J=40,HJ=12,WJ=40,BJ=60;H1=new Map});var UO={};ye(UO,{collapseMindmapTree:()=>KJ});function VO(t){return{id:t.id,label:t.label,...t.description!==void 0&&{description:[...t.description]},metadata:{...t.metadata},children:t.children.map(VO),parentId:t.parentId,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color},...t.collapsed!==void 0&&{collapsed:t.collapsed}}}function KJ(t,e){return e.size===0?{roots:[...t],hiddenCounts:new Map}:ld(t,e,qJ)}var qJ,XO=st(()=>{"use strict";xf();qJ={getId:t=>t.id,getChildren:t=>t.children,clone:VO,setChildren:(t,e)=>{t.children=e},countsAsHidden:()=>!0}});var KO={};ye(KO,{renderMindmap:()=>qO,renderMindmapForExport:()=>ott});function ttt(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function ett(t,e){return e??t.primary}function rtt(t,e){let n=ntt[t];return n&&n in e.colors?e.colors[n]:e.colors.gray}function qO(t,e,n,r,o,a,i,s,l,c,d){let u=!!i,f=i?.width??(t.getBoundingClientRect().width||800),p=i?.height??(t.getBoundingClientRect().height||600);Rt(t).selectAll("*").remove();let m=Rt(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",It),h=d?.controlsHost==="app",g=!!d?.onToggleColorByDepth||!!d?.onToggleDescriptions,E=e.tagGroups.length>0||g&&!h,y=!u&&E,b=y?Tr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},f)+Wn:0,S=!!e.title&&e.options["no-title"]!=="on",x=!u&&S,L=x?jO:0,v=f,A=p-kd*2-b-L,C=u?Ee.identity():Ee.fromBox(v,n.width,A,n.height),M=n;if(C.factor<1){let G=new Map;for(let H of n.nodes)H.hiddenCount!=null&&H.hiddenCount>0&&G.set(H.id,H.hiddenCount);let I=H=>Cg(e,r,{interactive:!u,...G.size>0&&{hiddenCounts:G},activeTagGroup:c??null,...l!==void 0&&{hideDescriptions:l},ctx:H});M=I(C);for(let H=0;H<3&&!C.isBelowFloor;H++){let O=Math.min(v/M.width,A/M.height);if(O>=.999)break;C=Ee.fromFactor(C.factor*O),M=I(C)}}let w=u?1:Math.min(1,M.width>0?v/M.width:1,M.height>0?A/M.height:1),k=M.width*w,N=M.height*w,_=Math.max(0,(v-k)/2),T=kd+b+L+Math.max(0,(A-N)/2),R=m.append("g").attr("transform",`translate(${_}, ${T})${w<1?` scale(${w})`:""}`);if(C.isBelowFloor&&m.attr("width","100%"),S){let G=x?m:R,I=x?f/2:M.width/2,H=x?kd+20:20,O=G.append("text").attr("x",I).attr("y",H).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("class","chart-title").text(e.title);e.titleLineNumber&&O.attr("data-line-number",e.titleLineNumber),a&&e.titleLineNumber&&O.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))}if(y){let G=m.append("g").attr("class","mindmap-legend-fixed").attr("transform",`translate(0, ${kd+L})`),I=new Map;for(let P of M.nodes)for(let B of e.tagGroups){let Y=B.name.toLowerCase(),V=P.metadata[Y];V&&(I.has(Y)||I.set(Y,new Set),I.get(Y).add(V.toLowerCase()))}let H=[];d?.onToggleDescriptions&&H.push({id:"descriptions",type:"toggle",label:"Descriptions",active:!l,onToggle:P=>d.onToggleDescriptions(P)}),d?.onToggleColorByDepth&&H.push({id:"depth-colors",type:"toggle",label:"Depth Colors",active:d.colorByDepth??!1,onToggle:d.onToggleColorByDepth});let O=H.length>0?{toggles:H}:void 0,D={groups:e.tagGroups.map(P=>{let B=I.get(P.name.toLowerCase());return{name:P.name,...P.alias!==void 0&&{alias:P.alias},entries:P.entries.filter(Y=>B?.has(Y.value.toLowerCase())).map(Y=>({value:Y.value,color:Y.color}))}}),position:{placement:"top-center",titleRelation:"below-title"},mode:d?.exportMode?"export":"preview",...O!==void 0&&{controlsGroup:O},...d?.controlsHost!==void 0&&{controlsHost:d.controlsHost}},W={text:r.text,textMuted:r.textMuted,bg:r.bg,surface:r.surface,primary:r.primary},z={...d?.onToggleControlsExpand!==void 0&&{onControlsExpand:d.onToggleControlsExpand},onControlsToggle:(P,B)=>{P==="depth-colors"&&d?.onToggleColorByDepth&&d.onToggleColorByDepth(B),P==="descriptions"&&d?.onToggleDescriptions&&d.onToggleDescriptions(B)}};fn(G,{...D,palette:W,isDark:o,width:f,activeGroup:d?.colorByDepth?null:c!==void 0?c:e.options["active-tag"]??null,hiddenAttributes:new Set,...d?.controlsExpanded!==void 0&&{controlsExpanded:d.controlsExpanded},callbacks:z})}for(let G of M.edges)R.append("path").attr("class","mindmap-edge").attr("d",G.path).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.5);for(let G of M.nodes){let I=G.radius===0&&M.nodes.indexOf(G)===0,H=I?JJ:1.5,O=d?.colorByDepth?rtt(G.depth,r):G.color,D=ttt(r,o,O,e.options["solid-fill"]==="on"),W=ett(r,O),z=ve(D,r.textOnFillLight,r.textOnFillDark),P=R.append("g").attr("class","mindmap-node").attr("data-line-number",G.lineNumber);if(c){let F=qt(c),Q=G.metadata[F];Q&&P.attr(`data-tag-${F}`,Q.toLowerCase())}G.hasChildren&&P.attr("data-node-toggle",G.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",G.hiddenCount!=null&&G.hiddenCount>0?"false":"true").attr("aria-label",G.label),P.append("rect").attr("x",G.x).attr("y",G.y).attr("width",G.width).attr("height",G.height).attr("rx",_g).attr("ry",_g).attr("fill",D).attr("stroke",W).attr("stroke-width",H);let B=G.hiddenCount!=null&&G.hiddenCount>0,Y=!l&&!!G.description&&!B,V=Mg(G.label,G.description,G.depth,G.width,l||B),{labelLines:j,labelFontSize:K,descLines:$,descFontSize:U}=V,X=j.length,q=X<=1?ZJ:z1*X,et=Y?q:G.height,tt=G.x+G.width/2;if(X<=1){let F=G.y+et/2+K*.35;P.append("text").attr("x",tt).attr("y",F).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",z).text(j[0])}else{let F=z1*(X-1),Q=G.y+et/2-F/2+K*.35,ot=P.append("text").attr("x",tt).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",z);for(let Z=0;Z<j.length;Z++)ot.append("tspan").attr("x",tt).attr("y",Q+Z*z1).text(j[Z])}if((j.length>1||j[0]!==G.label)&&P.append("title").text(G.label),Y&&$.length>0){let F=G.y+q;if(P.append("line").attr("x1",G.x).attr("y1",F).attr("x2",G.x+G.width).attr("y2",F).attr("stroke",W).attr("stroke-opacity",.3).attr("stroke-width",1),$.length<=1){let Q=F+4+U,ot=ea($[0]),Z=P.append("text").attr("x",tt).attr("y",Q).attr("text-anchor","middle").attr("font-size",U).attr("fill",z);gn(Z,ot,r,U)}else{let Q=F+4+U;for(let ot=0;ot<$.length;ot++){let Z=ea($[ot]),lt=P.append("text").attr("x",tt).attr("y",Q+ot*QJ).attr("text-anchor","middle").attr("font-size",U).attr("fill",z);gn(lt,Z,r,U)}}}if(!u&&G.hiddenCount!=null&&G.hiddenCount>0){let F=`collapse-clip-${G.id}`;R.append("defs").append("clipPath").attr("id",F).append("rect").attr("x",G.x).attr("y",G.y).attr("width",G.width).attr("height",G.height).attr("rx",_g).attr("ry",_g),P.append("rect").attr("class","collapse-bar").attr("x",G.x).attr("y",G.y+G.height-6).attr("width",G.width).attr("height",6).attr("fill",W).attr("clip-path",`url(#${F})`)}a&&P.style("cursor","pointer").on("click",F=>{G.hasChildren&&s?(F.stopPropagation(),s(G.id)):a(G.lineNumber)}),u||P.on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)})}}function ott(t,e,n){let r=nd(t,n);if(r.error)return"";let o=e==="dark",a=r.options["no-descriptions"]==="true",i=Cg(r,n,{interactive:!1,hideDescriptions:a}),s=r.title&&r.options["no-title"]!=="on"?jO:0,l=i.width+kd*2,c=i.height+kd*2+s;return cd(l,c,d=>(qO(d,r,i,n,o,void 0,{width:l,height:c},void 0,a),dd(d,e)))}var kd,jO,ZJ,z1,QJ,_g,JJ,ntt,ZO=st(()=>{"use strict";Ke();Xn();on();Qh();tn();kh();Y1();G1();_o();Qa();Br();Mr();To();fr();kd=20,jO=30,ZJ=28,z1=18,QJ=14,_g=6,JJ=2.5;ntt=["red","orange","yellow","green","blue","purple","teal","cyan"]});var nG={};ye(nG,{layoutWireframe:()=>gtt});function gtt(t,e,n,r=!0){V1=r?eG:ctt;let o=t.formFactor==="mobile"?itt:att,a=n??o,i=t.title&&t.options["no-title"]!=="on"?ftt:0,s=a-JO*2,l=ytt(t.roots,s,t.formFactor),c=0;for(let p of l)c=Math.max(c,p.y+p.height);let d=[],u=c+24;for(let p of t.modals){let m=Math.min(s*.7,600),h=(s-m)/2,g=Ld(p,h,u,m);d.push(g),u+=g.height+24}let f=(d.length>0?d[d.length-1].y+d[d.length-1].height:c)+JO*2+i;return{width:a,height:f,titleHeight:i,nodes:l,modalNodes:d}}function ytt(t,e,n){let r=[],o=0,a=[],i=[];for(let s of t){let l=s.label.toLowerCase().split(/\s+/)[0];tG.has(l)||n==="mobile"?(i.length>0&&(a.push(i),i=[]),a.push([s])):i.push(s)}i.length>0&&a.push(i);for(let s of a){if(s.length===1&&n!=="mobile"){let l=s[0],c=l.label.toLowerCase().split(/\s+/)[0];if(tG.has(c)){let d=Ld(l,0,o,e);c==="header"||c==="top"?d.height=Math.max(d.height,mtt):d.height=Math.max(d.height,htt),r.push(d),o+=d.height+16;continue}}if(n==="mobile"||s.length===1)for(let l of s){let c=Ld(l,0,o,e);r.push(c),o+=c.height+16}else{let l=btt(s,e),c=0,d=0,u=[];for(let f=0;f<s.length;f++){let p=l[f],m=Ld(s[f],c,o,p);u.push(m),d=Math.max(d,m.height),c+=p+12}for(let f of u)f.height=d;r.push(...u),o+=d+16}}return r}function btt(t,e){let r=(t.length-1)*12,o=e-r,a=new Array(t.length).fill(0),i=0,s=0;for(let l=0;l<t.length;l++){let c=t[l].label.toLowerCase().split(/\s+/)[0],d=ptt[c];d!==void 0&&d>0?(a[l]=o*d,i+=a[l]):s++}if(s>0){let c=Math.max(0,o-i)/s;for(let d=0;d<a.length;d++)a[d]===0&&(a[d]=Math.max(40,c))}for(let l=0;l<a.length;l++)a[l]=Math.max(40,a[l]);return a}function Ld(t,e,n,r){let o={id:t.id,x:e,y:n,width:r,height:0,element:t,children:[]},a=t.type==="nav"||t.type==="tabs";if(!t.isContainer||t.children.length===0||a)return o.height=wtt(t),o;let i=t.metadata._inlineRow==="true"||t.metadata._labelField==="true",s=i?0:V1,l=i?0:dtt,c=i?0:utt,d=r-c*2,u=c;if(t.orientation==="horizontal"){let f=xtt(t.children,d),p=u,m=0,h=[];for(let g=0;g<t.children.length;g++){let E=t.children[g],y=f[g],b=Ld(E,p,s,y);h.push(b),o.children.push(b),m=Math.max(m,b.height),p+=y+8}for(let g of h)g.height=m;o.height=s+m+l}else{let f=s,p=Stt(t.children);p>0&&(o.fieldAlignX=p);for(let m of t.children){let h=Ld(m,u,f,d);o.children.push(h),f+=h.height+Ett(m)}o.height=f+l}return t.states.includes("collapsed")&&(o.height=V1,o.children=[]),o}function xtt(t,e){let r=(t.length-1)*8,o=Math.max(40,(e-r)/t.length);return t.map(()=>o)}function wtt(t){return t.type==="heading"?t.headingLevel===2?Ag.subheading??36:Ag.heading??48:t.type==="textInput"&&t.fieldVariant==="textarea"?80:t.type==="table"?32+(t.tableData?.length||t.tableRows||0)*28+8:t.type==="image"?t.imageHint==="round"||t.imageHint==="wide"?80:Ag.image??120:t.metadata._labelField==="true"?36:Ag[t.type]??24}function Ett(t){return t.type==="heading"&&t.headingLevel===2?QO.subheading??12:QO[t.type]??8}function Stt(t){let e=0,n=0;for(let r of t)if(r.metadata._labelField==="true"&&r.children.length>=2){let o=r.children[0],a=_t(o.label,ltt);e=Math.max(e,a),n++}return n<2?0:e+stt}var att,itt,stt,ltt,Ag,QO,eG,ctt,dtt,V1,utt,JO,ftt,ptt,tG,mtt,htt,rG=st(()=>{"use strict";en();att=1200,itt=375,stt=16,ltt=13,Ag={textInput:36,button:40,dropdown:36,checkbox:24,radio:24,heading:48,subheading:36,divider:24,text:22,listItem:24,image:120,progress:28,chart:160,alert:40,nav:44,tabs:44},QO={heading:16,subheading:12,divider:12,textInput:8,dropdown:8,checkbox:8,radio:8,button:8,text:12,listItem:4,group:16,image:12,progress:12,chart:16,alert:12,nav:12,tabs:12,table:16},eG=32,ctt=10,dtt=12,V1=eG,utt=12,JO=20,ftt=40,ptt={sidebar:.25,side:.25,left:.25,right:.25,main:0,content:0,center:0},tG=new Set(["header","top","footer","bottom"]),mtt=60,htt=40});var cG={};ye(cG,{renderWireframe:()=>Ltt});function ktt(t,e){let n=vtt[t];return n?n(e):null}function sG(t,e){for(let n of t.states){let r=ktt(n,e);if(r)return r}return null}function Ltt(t,e,n,r,o,a,i,s,l){let c=l??{},d=c.exportDims??i,u=c.theme??s;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let f=!!d,p=d?.width??t.clientWidth,m=d?.height??t.clientHeight,h=f?Ee.identity():Ee.from(p,n.width),g=Rt(t).append("svg").attr("viewBox",`0 0 ${n.width} ${n.height}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);f?g.attr("width",p).attr("height",m):g.attr("width","100%").attr("height","auto").style("display","block");let E={palette:r,isTransparent:u==="transparent",isDark:o,showGroupLabels:c.showGroupLabels??!0,solid:e.options["solid-fill"]==="on"};E.isTransparent||g.append("rect").attr("width",n.width).attr("height",n.height).attr("fill",r.bg).attr("rx",8);let y=g.append("g").attr("transform","translate(20, 20)"),b=0,S=!!e.title&&e.options["no-title"]!=="on",x=h.text(20);f&&S&&(y.append("text").attr("x",0).attr("y",x).attr("fill",r.text).attr("font-size",x).attr("font-weight","700").text(e.title),b=n.titleHeight);let L=y.append("g").attr("transform",`translate(0, ${b})`);for(let v of n.nodes)Cf(L,v,E,0);if(n.modalNodes.length>0){let v=L.append("g").attr("class","wireframe-modals");for(let A of n.modalNodes)ztt(v,A,E)}}function Cf(t,e,n,r){let o=e.element,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",o.lineNumber);if(o.states.includes("disabled")&&a.attr("opacity",.5),o.isSkeleton&&o.type!=="skeleton"){lG(a,e,n);return}switch(o.type){case"group":Ntt(a,e,n,r);break;case"textInput":Mtt(a,e,n);break;case"button":Ttt(a,e,n);break;case"dropdown":Ctt(a,e,n);break;case"checkbox":_tt(a,e,n);break;case"radio":Att(a,e,n);break;case"heading":Rtt(a,e,n);break;case"divider":Itt(a,e,n);break;case"text":aG(a,e,n);break;case"listItem":Ptt(a,e,n);break;case"nav":Dtt(a,e,n);break;case"tabs":Ott(a,e,n);break;case"table":Gtt(a,e,n);break;case"image":Htt(a,e,n);break;case"skeleton":Wtt(a,e,n);break;case"alert":Btt(a,e,n);break;case"progress":Ftt(a,e,n);break;case"chart":Ytt(a,e,n);break;default:aG(a,e,n)}}function Ntt(t,e,n,r){let{palette:o,isTransparent:a}=n,i=e.element;if(i.metadata._inlineRow==="true"||i.metadata._labelField==="true"){for(let d of e.children)Cf(t,d,n,r);return}let s=[12,7,4,2],l=s[Math.min(r,s.length-1)],c=Gt(o.textMuted,o.bg,l);if(a?t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",o.border).attr("stroke-width",1).attr("rx",Tf):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("stroke",o.border).attr("stroke-width",1).attr("rx",Tf),i.label&&n.showGroupLabels&&t.append("text").attr("x",10).attr("y",18).attr("fill",o.textMuted).attr("font-size",11).attr("font-weight","600").attr("letter-spacing","0.5px").text(i.label.toUpperCase()),i.states.includes("collapsed")){t.append("text").attr("x",e.width-20).attr("y",18).attr("fill",o.textMuted).attr("font-size",12).attr("opacity",.6).text("\u25B6");return}i.states.includes("scrollable")&&t.append("rect").attr("x",e.width-6).attr("y",28).attr("width",3).attr("height",Math.min(e.height-36,40)).attr("fill",o.border).attr("rx",1.5);for(let d of e.children)Cf(t,d,n,r+1)}function Mtt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=e.height;if(t.append("rect").attr("width",e.width).attr("height",i).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",iG),a.fieldVariant==="password"?t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.text).attr("font-size",16).text("\u2022 \u2022 \u2022 \u2022 \u2022 \u2022"):t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.textMuted).attr("font-size",13).text(a.label||"Text input"),a.fieldVariant!=="password"){let s=Math.min(_t(a.label||"Text input",13)+14,e.width-20);t.append("line").attr("x1",s).attr("y1",8).attr("x2",s).attr("y2",i-8).attr("stroke",r.primary).attr("stroke-width",1.5).attr("opacity",.6)}if(a.fieldVariant==="textarea")for(let s=0;s<3;s++)t.append("line").attr("x1",e.width-12+s*3).attr("y1",i-4).attr("x2",e.width-4).attr("y2",i-12+s*3).attr("stroke",r.border).attr("stroke-width",1)}function Ttt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.states.includes("ghost"),s=sG(a,r),c=a.states.includes("primary")?r.primary:r.secondary,d=r.bg;s&&(c=s),i||o?(t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",c).attr("stroke-width",1.5).attr("rx",oG),d=c):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("rx",oG),t.append("text").attr("x",e.width/2).attr("y",e.height/2+4).attr("fill",d).attr("font-size",13).attr("font-weight","600").attr("text-anchor","middle").text(a.label)}function Ctt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",iG),t.append("text").attr("x",10).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(a.label||(a.options?.[0]??"Select..."));let i=e.width-16,s=e.height/2;t.append("path").attr("d",`M${i-4},${s-2} L${i},${s+2} L${i+4},${s-2}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5)}function _tt(t,e,n){let{palette:r}=n,o=e.element;if(o.states.includes("toggle")){let l=e.height/2;t.append("rect").attr("x",0).attr("y",l-18/2).attr("width",32).attr("height",18).attr("rx",18/2).attr("fill",o.checked?r.primary:r.border),t.append("circle").attr("cx",o.checked?32-18/2:18/2).attr("cy",l).attr("r",18/2-2).attr("fill",r.bg),o.label&&t.append("text").attr("x",40).attr("y",l+4).attr("fill",r.text).attr("font-size",13).text(o.label)}else{let s=e.height/2;t.append("rect").attr("x",0).attr("y",s-16/2).attr("width",16).attr("height",16).attr("fill",o.checked?r.primary:"none").attr("stroke",o.checked?r.primary:r.border).attr("rx",3),o.checked&&t.append("path").attr("d",`M3,${s} L6,${s+3} L13,${s-4}`).attr("fill","none").attr("stroke",r.bg).attr("stroke-width",2),o.label&&t.append("text").attr("x",24).attr("y",s+4).attr("fill",r.text).attr("font-size",13).text(o.label)}}function Att(t,e,n){let{palette:r}=n,o=e.element,a=8,i=e.height/2;t.append("circle").attr("cx",a).attr("cy",i).attr("r",a).attr("fill","none").attr("stroke",o.selected?r.primary:r.border).attr("stroke-width",1.5),o.selected&&t.append("circle").attr("cx",a).attr("cy",i).attr("r",4).attr("fill",r.primary),t.append("text").attr("x",a*2+8).attr("y",i+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function Rtt(t,e,n){let{palette:r}=n,o=e.element,a=o.headingLevel===1;t.append("text").attr("x",0).attr("y",a?28:22).attr("fill",r.text).attr("font-size",a?22:16).attr("font-weight","bold").text(o.label)}function Itt(t,e,n){let{palette:r}=n;t.append("line").attr("x1",0).attr("y1",e.height/2).attr("x2",e.width).attr("y2",e.height/2).attr("stroke",r.border).attr("stroke-width",1)}function aG(t,e,n){let{palette:r}=n,o=e.element;if(o.metadata._labelField==="true"&&o.children.length>=2){for(let i of e.children)Cf(t,i,n,0);return}let a=o.labelFor?r.textMuted:r.text;t.append("text").attr("x",0).attr("y",15).attr("fill",a).attr("font-size",13).text(o.label)}function Ptt(t,e,n){let{palette:r}=n,o=e.element;t.append("circle").attr("cx",4).attr("cy",e.height/2).attr("r",2.5).attr("fill",r.textMuted),t.append("text").attr("x",14).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function Dtt(t,e,n){let{palette:r}=n,o=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",Gt(r.textMuted,r.bg,8)).attr("rx",4);let a=12;for(let i of o.children){let s=i.states.includes("active");t.append("text").attr("x",a).attr("y",e.height/2+4).attr("fill",s?r.primary:r.text).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label);let l=_t(i.label,13);s&&t.append("line").attr("x1",a).attr("y1",e.height-4).attr("x2",a+l).attr("y2",e.height-4).attr("stroke",r.primary).attr("stroke-width",2),a+=l+24}}function Ott(t,e,n){let{palette:r}=n,o=e.element;t.append("line").attr("x1",0).attr("y1",e.height-1).attr("x2",e.width).attr("y2",e.height-1).attr("stroke",r.border).attr("stroke-width",1);let a=0;for(let i of o.children){let s=i.states.includes("active"),l=_t(i.label,13)+24;s&&t.append("line").attr("x1",a).attr("y1",e.height-1).attr("x2",a+l).attr("y2",e.height-1).attr("stroke",r.primary).attr("stroke-width",2),t.append("text").attr("x",a+12).attr("y",e.height/2+4).attr("fill",s?r.primary:r.textMuted).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label),a+=l}}function Gtt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.tableHeaders||[],s=a.tableData||[],l=a.tableRows!==void 0&&a.tableCols!==void 0,c=i.length||a.tableCols||3,d=e.width/c,u=32,f=28;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",r.border).attr("rx",4),t.append("rect").attr("width",e.width).attr("height",u).attr("fill",o?"none":Gt(r.textMuted,r.bg,8)).attr("rx",4);for(let m=0;m<c;m++){let h=i[m]||`Col ${m+1}`;t.append("text").attr("x",m*d+10).attr("y",u/2+4).attr("fill",r.text).attr("font-size",12).attr("font-weight","600").text(h)}t.append("line").attr("x1",0).attr("y1",u).attr("x2",e.width).attr("y2",u).attr("stroke",r.border);let p=l?a.tableRows||3:s.length;for(let m=0;m<p;m++){let h=u+m*f;m>0&&t.append("line").attr("x1",0).attr("y1",h).attr("x2",e.width).attr("y2",h).attr("stroke",r.border).attr("opacity",.3);for(let g=0;g<c;g++)if(l)t.append("rect").attr("x",g*d+10).attr("y",h+8).attr("width",d*.6).attr("height",12).attr("fill",r.textMuted).attr("opacity",.25).attr("rx",2);else if(s[m]){let E=s[m][g]||"";$tt(t,E,g*d+10,h,d-20,f,n)}}}function $tt(t,e,n,r,o,a,i){let{palette:s}=i,l=e.trim(),c=l.match(/^\(([^)]+)\)(?:\s*\|\s*(.+))?$/);if(c){let d=c[1],u=c[2]?.trim().toLowerCase(),f=u==="ghost",m=u==="destructive"?s.destructive:s.primary,h=Math.min(_t(d,10)+16,o),g=20,E=r+(a-g)/2;f?(t.append("rect").attr("x",n).attr("y",E).attr("width",h).attr("height",g).attr("fill","none").attr("stroke",m).attr("stroke-width",1).attr("rx",3),t.append("text").attr("x",n+h/2).attr("y",E+g/2+3).attr("fill",m).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d)):(t.append("rect").attr("x",n).attr("y",E).attr("width",h).attr("height",g).attr("fill",m).attr("rx",3),t.append("text").attr("x",n+h/2).attr("y",E+g/2+3).attr("fill",s.bg).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d));return}if(/^<\s*x?\s*>$/.test(l)){let d=/x/i.test(l),u=12,f=n,p=r+(a-u)/2;t.append("rect").attr("x",f).attr("y",p).attr("width",u).attr("height",u).attr("fill",d?s.primary:"none").attr("stroke",d?s.primary:s.border).attr("rx",2),d&&t.append("path").attr("d",`M${f+2},${p+u/2} L${f+4},${p+u/2+2} L${f+10},${p+2}`).attr("fill","none").attr("stroke",s.bg).attr("stroke-width",1.5);return}t.append("text").attr("x",n).attr("y",r+a/2+4).attr("fill",s.text).attr("font-size",12).text(l)}function Htt(t,e,n){let{palette:r,isTransparent:o}=n;if(e.element.imageHint==="round"){let s=Math.min(e.width,e.height)/2,l=e.width/2,c=e.height/2;t.append("circle").attr("cx",l).attr("cy",c).attr("r",s).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",r.border),t.append("line").attr("x1",l-s*.7).attr("y1",c-s*.7).attr("x2",l+s*.7).attr("y2",c+s*.7).attr("stroke",r.border),t.append("line").attr("x1",l+s*.7).attr("y1",c-s*.7).attr("x2",l-s*.7).attr("y2",c+s*.7).attr("stroke",r.border)}else t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",r.border).attr("rx",4),t.append("line").attr("x1",0).attr("y1",0).attr("x2",e.width).attr("y2",e.height).attr("stroke",r.border),t.append("line").attr("x1",e.width).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke",r.border)}function Wtt(t,e,n){for(let r of e.children)lG(t,r,n)}function lG(t,e,n){let{palette:r,isTransparent:o}=n,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`);o?a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.1).attr("rx",4):a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.2).attr("rx",4)}function Btt(t,e,n){let{palette:r,isDark:o,isTransparent:a}=n,i=e.element,s=sG(i,r)||r.accent,l=a?null:ie(r,s,o,{solid:n.solid});l&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",l).attr("rx",4),t.append("rect").attr("width",3).attr("height",e.height).attr("fill",s).attr("rx",1.5),a&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",s).attr("rx",4);let c=l?ve(l,r.textOnFillLight,r.textOnFillDark):r.text;t.append("text").attr("x",12).attr("y",e.height/2+4).attr("fill",c).attr("font-size",13).text(i.label)}function Ftt(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.progressValue??0,s=8,l=e.height/2;t.append("rect").attr("width",e.width-40).attr("height",s).attr("y",l-s/2).attr("fill",o?"none":Gt(r.border,r.bg,30)).attr("stroke",o?r.border:"none").attr("rx",s/2);let c=(e.width-40)*i/100;c>0&&t.append("rect").attr("width",c).attr("height",s).attr("y",l-s/2).attr("fill",r.primary).attr("rx",s/2),t.append("text").attr("x",e.width-32).attr("y",l+4).attr("fill",r.textMuted).attr("font-size",11).text(`${i}%`)}function Ytt(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.chartHint||"line";t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Gt(r.textMuted,r.bg,8)).attr("stroke",r.border).attr("rx",4);let s=20,l=20,c=e.width-s*2,d=e.height-l*2;if(i==="line"){let f=[[0,d*.7],[c*.2,d*.4],[c*.4,d*.6],[c*.6,d*.2],[c*.8,d*.3],[c,d*.1]].map(([p,m],h)=>h===0?`M${s+p},${l+m}`:`L${s+p},${l+m}`).join(" ");t.append("path").attr("d",f).attr("fill","none").attr("stroke",r.primary).attr("stroke-width",2)}else if(i==="bar"){let f=c/10,p=[.6,.8,.5,.9,.7];for(let m=0;m<5;m++){let h=d*p[m];t.append("rect").attr("x",s+m*(c/5)+f/2).attr("y",l+d-h).attr("width",f).attr("height",h).attr("fill",r.primary).attr("opacity",.7).attr("rx",2)}}else if(i==="pie"){let u=e.width/2,f=e.height/2,p=Math.min(c,d)/2,m=[.35,.25,.2,.2],h=[r.primary,r.secondary,r.accent,r.border],g=0;for(let E=0;E<m.length;E++){let y=g+m[E]*Math.PI*2,b=u+p*Math.cos(g),S=f+p*Math.sin(g),x=u+p*Math.cos(y),L=f+p*Math.sin(y),v=m[E]>.5?1:0;t.append("path").attr("d",`M${u},${f} L${b},${S} A${p},${p} 0 ${v},1 ${x},${L} Z`).attr("fill",h[E]).attr("opacity",.7),g=y}}}function ztt(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",a.lineNumber);o||i.append("rect").attr("x",4).attr("y",4).attr("width",e.width).attr("height",e.height).attr("fill","rgba(0,0,0,0.1)").attr("rx",Tf),i.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.surface).attr("stroke",r.border).attr("rx",Tf),i.append("rect").attr("width",e.width).attr("height",36).attr("fill",o?"none":Gt(r.textMuted,r.bg,15)).attr("rx",Tf),i.append("text").attr("x",12).attr("y",24).attr("fill",r.text).attr("font-size",14).attr("font-weight","600").text(a.label||"Modal");let s=e.width-16;i.append("text").attr("x",s).attr("y",24).attr("fill",r.textMuted).attr("font-size",16).text("\xD7");for(let l of e.children){let c=i.append("g").attr("transform","translate(0, 36)");Cf(c,l,n,1)}}var iG,oG,Tf,vtt,dG=st(()=>{"use strict";Xn();on();tn();en();fr();iG=4,oG=6,Tf=8,vtt={destructive:t=>t.destructive,success:t=>t.colors.green,warning:t=>t.colors.yellow,info:t=>t.colors.blue}});var bG={};ye(bG,{collectCardMetadata:()=>Og,computeC4NodeDimensions:()=>jl,layoutC4Components:()=>K1,layoutC4Containers:()=>q1,layoutC4Context:()=>j1,layoutC4Deployment:()=>Z1,rollUpContextRelationships:()=>gG});function Pg(t,e,n,r){let o=0;for(let a of t){let i=e.get(a.source),s=e.get(a.target);if(i==null||s==null)continue;let l=Math.abs(i-s),c=Math.min(n.get(a.source)??1,n.get(a.target)??1);o+=l*c}if(r)for(let a of t){let i=r.get(a.source),s=r.get(a.target);if(!i||!s)continue;let l=e.get(a.source)??0,c=e.get(a.target)??0,d=i.y,u=s.y;if(d===u)continue;let f=Math.min(l,c),p=Math.max(l,c),m=Math.min(d,u),h=Math.max(d,u);for(let[g,E]of r){if(g===a.source||g===a.target)continue;let y=e.get(g)??0,b=E.y,S=E.width/2,x=E.height/2;y+S>f&&y-S<p&&b+x>m&&b-x<h&&(o+=Ztt)}}return o}function Dg(t,e,n){if(e.length<2)return;let r=new Map;for(let s of e)r.set(s.source,(r.get(s.source)??0)+1),r.set(s.target,(r.get(s.target)??0)+1);let o=new Map;for(let s of t.nodes()){let l=ds(t,s);l&&o.set(s,{y:l.y,width:l.width,height:l.height})}let a=new Map;for(let s of t.nodes()){let l=ds(t,s);if(!l)continue;let c=Math.round(l.y);a.has(c)||a.set(c,[]),a.get(c).push(s)}for(let[,s]of a)s.sort((l,c)=>ds(t,l).x-ds(t,c).x);let i=!1;for(let[,s]of a){if(s.length<2)continue;let l=[];if(n&&n.size>0){let c=new Map,d=[];for(let u of s){let f=n.get(u);f?(c.has(f)||c.set(f,[]),c.get(f).push(u)):d.push(u)}for(let u of c.values())u.length>=2&&l.push(u);d.length>=2&&l.push(d)}else l.push(s);for(let c of l){if(c.length<2)continue;let d=c.map(h=>ds(t,h).x).sort((h,g)=>h-g),u=new Map;for(let h of t.nodes()){let g=ds(t,h);g&&u.set(h,g.x)}let f=Pg(e,u,r,o),p=[...c],m=f;if(c.length<=8){let h=Qtt(c);for(let g of h){let E=new Map(u);for(let b=0;b<g.length;b++)E.set(g[b],d[b]);let y=Pg(e,E,r,o);y<m&&(m=y,p=[...g])}}else{let h=[...c],g=!0,E=0;for(;g&&E<10;){g=!1,E++;for(let y=0;y<h.length-1;y++){let b=new Map(u);for(let v=0;v<h.length;v++)b.set(h[v],d[v]);let S=Pg(e,b,r,o);[h[y],h[y+1]]=[h[y+1],h[y]];let x=new Map(u);for(let v=0;v<h.length;v++)x.set(h[v],d[v]);let L=Pg(e,x,r,o);L<S?(g=!0,L<m&&(m=L,p=[...h])):[h[y],h[y+1]]=[h[y+1],h[y]]}}}if(p.some((h,g)=>h!==c[g])){for(let h=0;h<p.length;h++){ds(t,p[h]).x=d[h];let g=s.indexOf(c[h]);g>=0&&(s[g]=p[h])}i=!0}}}if(i)for(let s of e){let l=Vtt(t,s.source,s.target);if(!l)continue;let c=ds(t,s.source),d=ds(t,s.target);if(!c||!d)continue;let u={x:c.x,y:c.y+c.height/2},f={x:d.x,y:d.y-d.height/2},p=(u.y+f.y)/2;l.points=[u,{x:u.x,y:p},{x:f.x,y:p},f]}}function Qtt(t){let e=[],n=[...t],r=n.length,o=new Array(r).fill(0);e.push([...n]);let a=0;for(;a<r;)o[a]<a?(a%2===0?[n[0],n[a]]=[n[a],n[0]]:[n[o[a]],n[a]]=[n[a],n[o[a]]],e.push([...n]),o[a]++,a=0):(o[a]=0,a++);return e}function U1(t){let e=new Map;function n(r,o){e.set(r.name,o);for(let a of r.children)n(a,o);for(let a of r.groups)for(let i of a.children)n(i,o)}for(let r of t)n(r,r.name);return e}function X1(t,e){let n=[];function r(o){for(let a of o.relationships)n.push({sourceName:o.name,rel:a});for(let a of o.children)r(a);for(let a of o.groups)for(let i of a.children)r(i)}for(let o of t)r(o);return n}function gG(t){let e=U1(t.elements),n=X1(t.elements,e),r=new Set(t.elements.map(c=>c.name)),o=new Set,a=[],i=[];for(let{sourceName:c,rel:d}of n){let u=e.get(c)??c,f=e.get(d.target)??d.target;if(u===f)continue;let p={sourceName:u,targetName:f,...d.label!==void 0&&{label:d.label},...d.technology!==void 0&&{technology:d.technology},arrowType:d.arrowType,lineNumber:d.lineNumber};if(r.has(c)&&c===u){let m=`${u}\u2192${f}`;o.add(m),a.push(p)}else i.push(p)}let s=[...a],l=new Set(o);for(let c of i){let d=`${c.sourceName}\u2192${c.targetName}`;l.has(d)||(l.add(d),s.push(c))}return s}function Nd(t,e,n,r){let o=t.metadata.color;if(o)return o;if(!n)return;let a=e.find(c=>c.name.toLowerCase()===n.toLowerCase());if(!a)return;let i=qt(a.name),s=t.metadata[i];if(!s&&r){for(let c of r)if(s=c.metadata[i],s)break}let l=s??a.defaultValue;return l?a.entries.find(c=>c.value.toLowerCase()===l.toLowerCase())?.color??"#999999":"#999999"}function Og(t){let e=[],n=t.tech??t.technology;n&&e.push({key:"Technology",value:n});for(let[r,o]of Object.entries(t)){if(Jtt.has(r.toLowerCase()))continue;let a=r.charAt(0).toUpperCase()+r.slice(1);e.push({key:a,value:o})}return e}function jl(t,e){let n=_t(t.name,jtt)+Ig*2,r=Math.max(Utt,Math.min(uG,n));if(e?.showTechnology){let i=Rg+pG,s=t.description?.join(`
212
212
  `);if(s){let c=r-Ig*2,d=Tn(s,hG,c);i+=d.length*mG}let l=Og(t.metadata);if(l.length>0){i+=fG,i+=l.length*qtt;let c=Math.max(...l.map(d=>_t(`${d.key}: ${d.value}`,Ktt)+Ig*2));c>r&&(r=Math.min(uG,c))}return i+=Rg,{width:r,height:i}}let o=Rg+Xtt+fG+pG,a=t.description?.join(`
213
213
  `);if(a){let i=r-Ig*2,s=Tn(a,hG,i);o+=s.length*mG}return o+=Rg,{width:r,height:o}}function Gg(t){let e=[];for(let n of t){let r=[];for(let i of n.entries)r.push({value:i.value,color:i.color});if(r.length===0)continue;let o=We(n.name,sr)+po*2,a=Rn;for(let i of r)a+=wr*2+Nr+We(i.value,Vn)+Kr;a+=Rn,e.push({name:n.name,entries:r,x:0,y:0,width:o+a,height:Se})}return e}function $g(t){let e=new Map;for(let i of t)(i.label||i.technology)&&e.set(i.sourceName,(e.get(i.sourceName)??0)+1);let n=Math.max(0,...e.values()),r=Math.max(80,60+n*20),o=Math.max(140,100+n*35),a=Math.max(30,20+n*8);return{nodesep:r,ranksep:o,edgesep:a}}function j1(t,e){let n=t.elements.filter(E=>E.type==="person"||E.type==="system");if(n.length===0)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let r=gG(t),o=$g(r),a=new er.graphlib.Graph;a.setGraph({rankdir:"TB",nodesep:o.nodesep,ranksep:o.ranksep,edgesep:o.edgesep}),a.setDefaultEdgeLabel(()=>({}));let i=new Map;for(let E of n){i.set(E.name,E);let y=jl(E);a.setNode(E.name,{width:y.width,height:y.height})}let s=[];for(let E of r)i.has(E.sourceName)&&i.has(E.targetName)&&(s.push(E),a.setEdge(E.sourceName,E.targetName,{label:E.label??""}));er.layout(a),Dg(a,s.map(E=>({source:E.sourceName,target:E.targetName})));let l=n.map(E=>{let y=a.node(E.name),b=Nd(E,t.tagGroups,e??null),S=E.children.some(v=>v.type==="container")||E.groups.some(v=>v.children.some(A=>A.type==="container")),x=E.description?.join(`
214
214
  `),L=S||E.importPath?!0:void 0;return{id:E.name,name:E.name,type:E.type,...x!==void 0&&{description:x},metadata:E.metadata,lineNumber:E.lineNumber,...b!==void 0&&{color:b},...L!==void 0&&{drillable:L},...E.importPath!==void 0&&{importPath:E.importPath},x:y.x,y:y.y,width:y.width,height:y.height}}),c=s.map(E=>{let y=a.edge(E.sourceName,E.targetName);return{source:E.sourceName,target:E.targetName,arrowType:E.arrowType,...E.label!==void 0&&{label:E.label},...E.technology!==void 0&&{technology:E.technology},lineNumber:E.lineNumber,points:y?.points??[]}}),d=1/0,u=1/0,f=-1/0,p=-1/0;for(let E of l){let y=E.x-E.width/2,b=E.y-E.height/2,S=E.x+E.width/2,x=E.y+E.height/2;y<d&&(d=y),b<u&&(u=b),S>f&&(f=S),x>p&&(p=x)}for(let E of c)for(let y of E.points)y.x<d&&(d=y.x),y.y<u&&(u=y.y),y.x>f&&(f=y.x),y.y>p&&(p=y.y);if(l.length>0){let E=_r-d,y=_r-u;for(let b of l)b.x+=E,b.y+=y;for(let b of c)for(let S of b.points)S.x+=E,S.y+=y}let m=l.length>0?f-d+_r*2:0,h=l.length>0?p-u+_r*2:0,g=Gg(t.tagGroups);if(g.length>0){let E=h+_r,y=_r;for(let x of g)x.x=y,x.y=E,y+=x.width+12;let b=y,S=E+Se;b>m&&(m=b),S>h&&(h=S)}return{nodes:l,edges:c,legend:g,groupBoundaries:[],width:m,height:h}}function q1(t,e,n){let r=t.elements.find(D=>D.name.toLowerCase()===e.toLowerCase());if(!r)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let o=[];for(let D of r.children)D.type==="container"&&o.push(D);for(let D of r.groups)for(let W of D.children)W.type==="container"&&o.push(W);if(o.length===0)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let a=new Set(o.map(D=>D.name.toLowerCase())),i=new Map;for(let D of t.elements)i.set(D.name.toLowerCase(),D);let s=new Set;for(let D of o)for(let W of D.relationships){let z=W.target.toLowerCase();a.has(z)||s.add(z)}let l=U1(t.elements),c=X1(t.elements,l);for(let{sourceName:D,rel:W}of c){let z=l.get(D)??D;z.toLowerCase()!==r.name.toLowerCase()&&a.has(W.target.toLowerCase())&&s.add(z.toLowerCase())}let d=[];for(let D of s){let W=i.get(D);W&&d.push(W)}let u=new Map;for(let D of r.groups)for(let W of D.children)W.type==="container"&&u.set(W.name,{name:D.name,lineNumber:D.lineNumber});let f=u.size>0,p=f?new er.graphlib.Graph({compound:!0}):new er.graphlib.Graph;if(p.setDefaultEdgeLabel(()=>({})),f){let D=new Set;for(let{name:W}of u.values())D.has(W)||(D.add(W),p.setNode("__group_"+W,{}))}let m=new Map;for(let D of o){m.set(D.name,D);let W=jl(D,{showTechnology:!0});p.setNode(D.name,{width:W.width,height:W.height});let z=u.get(D.name);z&&p.setParent(D.name,"__group_"+z.name)}for(let D of d){m.set(D.name,D);let W=jl(D);p.setNode(D.name,{width:W.width,height:W.height})}let h=[],g=new Set;for(let D of o)for(let W of D.relationships){if(!m.get(W.target))continue;let P=`${D.name}\u2192${W.target}`;g.has(P)||(g.add(P),h.push({sourceName:D.name,targetName:W.target,...W.label!==void 0&&{label:W.label},...W.technology!==void 0&&{technology:W.technology},arrowType:W.arrowType,lineNumber:W.lineNumber}))}for(let{sourceName:D,rel:W}of c){let z=l.get(D)??D;if(z.toLowerCase()!==r.name.toLowerCase()&&a.has(W.target.toLowerCase())){if(!m.get(z))continue;let B=`${z}\u2192${W.target}`;g.has(B)||(g.add(B),h.push({sourceName:z,targetName:W.target,...W.label!==void 0&&{label:W.label},...W.technology!==void 0&&{technology:W.technology},arrowType:W.arrowType,lineNumber:W.lineNumber}))}}let E=$g(h);p.setGraph({rankdir:"TB",nodesep:E.nodesep,ranksep:E.ranksep,edgesep:E.edgesep});for(let D of h)m.has(D.sourceName)&&m.has(D.targetName)&&p.setEdge(D.sourceName,D.targetName,{label:D.label??""});er.layout(p);let y=f?new Map([...u.entries()].map(([D,W])=>[D,W.name])):void 0;Dg(p,h.filter(D=>m.has(D.sourceName)&&m.has(D.targetName)).map(D=>({source:D.sourceName,target:D.targetName})),y);let b=[];for(let D of o){let W=p.node(D.name),z=Nd(D,t.tagGroups,n??null),P=D.metadata.tech??D.metadata.technology,B=D.children.some(j=>j.type==="component")||D.groups.some(j=>j.children.some(K=>K.type==="component")),Y=D.description?.join(`
@@ -305,7 +305,7 @@ poi Tokyo
305
305
  poi Tokyo`},DUPLICATE_REGION:{code:"W_MAP_DUPLICATE_REGION",severity:"warning",chartType:"map",title:"Duplicate region",message:t=>`Duplicate region "${t.name??""}" \u2014 last definition wins.`,hint:"The same region is defined twice \u2014 remove the earlier definition.",example:`map
306
306
  California heat: 1
307
307
  California heat: 9`},REGION_AMBIGUOUS:{code:"W_MAP_REGION_AMBIGUOUS",severity:"warning",chartType:"map",title:"Region is both a country and a US state",message:t=>`"${t.name??""}" is both a country and a US state \u2014 resolved as ${t.layer??""} (${t.chosenId??""}). Pin it with an ISO code (${t.stateId??""} / ${t.countryId??""}) or name + scope ("${t.name??""} US" / "${t.name??""} ${t.countryId??""}").`,hint:"The name collides between a country and a US state \u2014 pin it with an ISO code or a `US` / `US-XX` scope.",example:`map
308
- Georgia heat: 2`}},S2t=Object.values(sa)});function Nv(t){return t}var Mv=st(()=>{"use strict"});function Ry(t){if(t==null)return Nv;var e,n,r=t.scale[0],o=t.scale[1],a=t.translate[0],i=t.translate[1];return function(s,l){l||(e=n=0);var c=2,d=s.length,u=new Array(d);for(u[0]=(e+=s[0])*r+a,u[1]=(n+=s[1])*o+i;c<d;)u[c]=s[c],++c;return u}}var Iy=st(()=>{"use strict";Mv()});var Tv=st(()=>{"use strict";Iy()});function HW(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}var WW=st(()=>{"use strict"});function Jl(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return BW(t,n)})}:BW(t,e)}function BW(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,a=Cv(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:a}:r==null?{type:"Feature",id:n,properties:o,geometry:a}:{type:"Feature",id:n,bbox:r,properties:o,geometry:a}}function Cv(t,e){var n=Ry(t.transform),r=t.arcs;function o(d,u){u.length&&u.pop();for(var f=r[d<0?~d:d],p=0,m=f.length;p<m;++p)u.push(n(f[p],p));d<0&&HW(u,m)}function a(d){return n(d)}function i(d){for(var u=[],f=0,p=d.length;f<p;++f)o(d[f],u);return u.length<2&&u.push(u[0]),u}function s(d){for(var u=i(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(s)}function c(d){var u=d.type,f;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(c)};case"Point":f=a(d.coordinates);break;case"MultiPoint":f=d.coordinates.map(a);break;case"LineString":f=i(d.arcs);break;case"MultiLineString":f=d.arcs.map(i);break;case"Polygon":f=l(d.arcs);break;case"MultiPolygon":f=d.arcs.map(l);break;default:return null}return{type:u,coordinates:f}}return c(e)}var Py=st(()=>{"use strict";WW();Iy()});var _v=st(()=>{"use strict"});var FW=st(()=>{"use strict";Py();_v()});var YW=st(()=>{"use strict";Py();_v()});function Av(t,e){for(var n=0,r=t.length;n<r;){var o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var zW=st(()=>{"use strict"});function Rv(t){var e={},n=t.map(function(){return[]});function r(h,g){h.forEach(function(E){E<0&&(E=~E);var y=e[E];y?y.push(g):e[E]=[g]})}function o(h,g){h.forEach(function(E){r(E,g)})}function a(h,g){h.type==="GeometryCollection"?h.geometries.forEach(function(E){a(E,g)}):h.type in i&&i[h.type](h.arcs,g)}var i={LineString:r,MultiLineString:o,Polygon:o,MultiPolygon:function(h,g){h.forEach(function(E){o(E,g)})}};t.forEach(a);for(var s in e)for(var l=e[s],c=l.length,d=0;d<c;++d)for(var u=d+1;u<c;++u){var f=l[d],p=l[u],m;(m=n[f])[s=Av(m,p)]!==p&&m.splice(s,0,p),(m=n[p])[s=Av(m,f)]!==f&&m.splice(s,0,f)}return n}var VW=st(()=>{"use strict";zW()});var Iv=st(()=>{"use strict";Mv()});var UW=st(()=>{"use strict";Tv();Iv()});var Pv=st(()=>{"use strict";Tv();Py();FW();YW();VW();UW();Iy();Iv()});function KW(t){return t>1?0:t<-1?bn:Math.acos(t)}function Io(t){return t>1?yo:t<-1?-yo:Math.asin(t)}var yn,Dy,bn,yo,zd,Xr,Pr,Un,En,Oy,la,Cn,XW,jW,Ln,Vd,bo,qW,Er=st(()=>{"use strict";yn=1e-6,Dy=1e-12,bn=Math.PI,yo=bn/2,zd=bn/4,Xr=bn*2,Pr=180/bn,Un=bn/180,En=Math.abs,Oy=Math.atan,la=Math.atan2,Cn=Math.cos,XW=Math.exp,jW=Math.log,Ln=Math.sin,Vd=Math.sign||function(t){return t>0?1:t<0?-1:0},bo=Math.sqrt,qW=Math.tan});function Dr(){}var tc=st(()=>{"use strict"});function Gy(t,e){t&&QW.hasOwnProperty(t.type)&&QW[t.type](t,e)}function Dv(t,e,n){var r=-1,o=t.length-n,a;for(e.lineStart();++r<o;)a=t[r],e.point(a[0],a[1],a[2]);e.lineEnd()}function JW(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Dv(t[n],e,1);e.polygonEnd()}function Ha(t,e){t&&ZW.hasOwnProperty(t.type)?ZW[t.type](t,e):Gy(t,e)}var ZW,QW,Qf=st(()=>{"use strict";ZW={Feature:function(t,e){Gy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)Gy(n[r].geometry,e)}},QW={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Dv(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)Dv(n[r],e,0)},Polygon:function(t,e){JW(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)JW(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)Gy(n[r],e)}}});function Qat(){ii.point=tit}function Jat(){nB(tB,eB)}function tit(t,e){ii.point=nB,tB=t,eB=e,t*=Un,e*=Un,Ov=t,Gv=Cn(e=e/2+zd),$v=Ln(e)}function nB(t,e){t*=Un,e*=Un,e=e/2+zd;var n=t-Ov,r=n>=0?1:-1,o=r*n,a=Cn(e),i=Ln(e),s=$v*i,l=Gv*a+s*Cn(o),c=s*r*Ln(o);Jf.add(la(c,l)),Ov=t,Gv=a,$v=i}function Hv(t){return $y=new qr,Ha(t,ii),$y*2}var Jf,$y,tB,eB,Ov,Gv,$v,ii,Wv=st(()=>{"use strict";No();Er();tc();Qf();Jf=new qr,$y=new qr,ii={point:Dr,lineStart:Dr,lineEnd:Dr,polygonStart:function(){Jf=new qr,ii.lineStart=Qat,ii.lineEnd=Jat},polygonEnd:function(){var t=+Jf;$y.add(t<0?Xr+t:t),this.lineStart=this.lineEnd=this.point=Dr},sphere:function(){$y.add(Xr)}}});function ec(t){return[la(t[1],t[0]),Io(t[2])]}function Wa(t){var e=t[0],n=t[1],r=Cn(n);return[r*Cn(e),r*Ln(e),Ln(n)]}function tp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ps(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Hy(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ep(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function nc(t){var e=bo(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Ud=st(()=>{"use strict";Er()});function Bv(t,e){dl.push(hs=[Or=t,zr=t]),e<Jo&&(Jo=e),e>da&&(da=e)}function lB(t,e){var n=Wa([t*Un,e*Un]);if(Xd){var r=ps(Xd,n),o=[r[1],-r[0],0],a=ps(o,r);nc(a),a=ec(a);var i=t-rc,s=i>0?1:-1,l=a[0]*Pr*s,c,d=En(i)>180;d^(s*rc<l&&l<s*t)?(c=a[1]*Pr,c>da&&(da=c)):(l=(l+360)%360-180,d^(s*rc<l&&l<s*t)?(c=-a[1]*Pr,c<Jo&&(Jo=c)):(e<Jo&&(Jo=e),e>da&&(da=e))),d?t<rc?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t):zr>=Or?(t<Or&&(Or=t),t>zr&&(zr=t)):t>rc?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t)}else dl.push(hs=[Or=t,zr=t]);e<Jo&&(Jo=e),e>da&&(da=e),Xd=n,rc=t}function rB(){ms.point=lB}function oB(){hs[0]=Or,hs[1]=zr,ms.point=Bv,Xd=null}function cB(t,e){if(Xd){var n=t-rc;np.add(En(n)>180?n+(n>0?360:-360):n)}else iB=t,sB=e;ii.point(t,e),lB(t,e)}function eit(){ii.lineStart()}function nit(){cB(iB,sB),ii.lineEnd(),En(np)>yn&&(Or=-(zr=180)),hs[0]=Or,hs[1]=zr,Xd=null}function ca(t,e){return(e-=t)<0?e+360:e}function rit(t,e){return t[0]-e[0]}function aB(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function gs(t){var e,n,r,o,a,i,s;if(da=zr=-(Or=Jo=1/0),dl=[],Ha(t,ms),n=dl.length){for(dl.sort(rit),e=1,r=dl[0],a=[r];e<n;++e)o=dl[e],aB(r,o[0])||aB(r,o[1])?(ca(r[0],o[1])>ca(r[0],r[1])&&(r[1]=o[1]),ca(o[0],r[1])>ca(r[0],r[1])&&(r[0]=o[0])):a.push(r=o);for(i=-1/0,n=a.length-1,e=0,r=a[n];e<=n;r=o,++e)o=a[e],(s=ca(r[1],o[0]))>i&&(i=s,Or=o[0],zr=r[1])}return dl=hs=null,Or===1/0||Jo===1/0?[[NaN,NaN],[NaN,NaN]]:[[Or,Jo],[zr,da]]}var Or,Jo,zr,da,rc,iB,sB,Xd,np,dl,hs,ms,dB=st(()=>{"use strict";No();Wv();Ud();Er();Qf();ms={point:Bv,lineStart:rB,lineEnd:oB,polygonStart:function(){ms.point=cB,ms.lineStart=eit,ms.lineEnd=nit,np=new qr,ii.polygonStart()},polygonEnd:function(){ii.polygonEnd(),ms.point=Bv,ms.lineStart=rB,ms.lineEnd=oB,Jf<0?(Or=-(zr=180),Jo=-(da=90)):np>yn?da=90:np<-yn&&(Jo=-90),hs[0]=Or,hs[1]=zr},sphere:function(){Or=-(zr=180),Jo=-(da=90)}}});function rp(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}var Fv=st(()=>{"use strict"});function Yv(t,e){return En(t)>bn&&(t-=Math.round(t/Xr)*Xr),[t,e]}function zv(t,e,n){return(t%=Xr)?e||n?rp(fB(t),pB(e,n)):fB(t):e||n?pB(e,n):Yv}function uB(t){return function(e,n){return e+=t,En(e)>bn&&(e-=Math.round(e/Xr)*Xr),[e,n]}}function fB(t){var e=uB(t);return e.invert=uB(-t),e}function pB(t,e){var n=Cn(t),r=Ln(t),o=Cn(e),a=Ln(e);function i(s,l){var c=Cn(l),d=Cn(s)*c,u=Ln(s)*c,f=Ln(l),p=f*n+d*r;return[la(u*o-p*a,d*n-f*r),Io(p*o+u*a)]}return i.invert=function(s,l){var c=Cn(l),d=Cn(s)*c,u=Ln(s)*c,f=Ln(l),p=f*o-u*a;return[la(u*o+f*a,d*n+p*r),Io(p*n-d*r)]},i}function mB(t){t=zv(t[0]*Un,t[1]*Un,t.length>2?t[2]*Un:0);function e(n){return n=t(n[0]*Un,n[1]*Un),n[0]*=Pr,n[1]*=Pr,n}return e.invert=function(n){return n=t.invert(n[0]*Un,n[1]*Un),n[0]*=Pr,n[1]*=Pr,n},e}var Vv=st(()=>{"use strict";Fv();Er();Yv.invert=Yv});function gB(t,e,n,r,o,a){if(n){var i=Cn(e),s=Ln(e),l=r*n;o==null?(o=e+r*Xr,a=e-l/2):(o=hB(i,o),a=hB(i,a),(r>0?o<a:o>a)&&(o+=r*Xr));for(var c,d=o;r>0?d>a:d<a;d-=l)c=ec([i,-s*Cn(d),-s*Ln(d)]),t.point(c[0],c[1])}}function hB(t,e){e=Wa(e),e[0]-=t,nc(e);var n=KW(-e[1]);return((-e[2]<0?-n:n)+Xr-yn)%Xr}var yB=st(()=>{"use strict";Ud();Er()});function Wy(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Dr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}var Uv=st(()=>{"use strict";tc()});function jd(t,e){return En(t[0]-e[0])<yn&&En(t[1]-e[1])<yn}var Xv=st(()=>{"use strict";Er()});function By(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Fy(t,e,n,r,o){var a=[],i=[],s,l;if(t.forEach(function(m){if(!((h=m.length-1)<=0)){var h,g=m[0],E=m[h],y;if(jd(g,E)){if(!g[2]&&!E[2]){for(o.lineStart(),s=0;s<h;++s)o.point((g=m[s])[0],g[1]);o.lineEnd();return}E[0]+=2*yn}a.push(y=new By(g,m,null,!0)),i.push(y.o=new By(g,null,y,!1)),a.push(y=new By(E,m,null,!1)),i.push(y.o=new By(E,null,y,!0))}}),!!a.length){for(i.sort(e),bB(a),bB(i),s=0,l=i.length;s<l;++s)i[s].e=n=!n;for(var c=a[0],d,u;;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;d=f.z,o.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,l=d.length;s<l;++s)o.point((u=d[s])[0],u[1]);else r(f.x,f.n.x,1,o);f=f.n}else{if(p)for(d=f.p.z,s=d.length-1;s>=0;--s)o.point((u=d[s])[0],u[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,d=f.z,p=!p}while(!f.v);o.lineEnd()}}}function bB(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}var jv=st(()=>{"use strict";Xv();Er()});function qv(t){return En(t[0])<=bn?t[0]:Vd(t[0])*((En(t[0])+bn)%Xr-bn)}function xB(t,e){var n=qv(e),r=e[1],o=Ln(r),a=[Ln(n),-Cn(n),0],i=0,s=0,l=new qr;o===1?r=yo+yn:o===-1&&(r=-yo-yn);for(var c=0,d=t.length;c<d;++c)if(f=(u=t[c]).length)for(var u,f,p=u[f-1],m=qv(p),h=p[1]/2+zd,g=Ln(h),E=Cn(h),y=0;y<f;++y,m=S,g=L,E=v,p=b){var b=u[y],S=qv(b),x=b[1]/2+zd,L=Ln(x),v=Cn(x),A=S-m,C=A>=0?1:-1,M=C*A,w=M>bn,k=g*L;if(l.add(la(k*C*Ln(M),E*v+k*Cn(M))),i+=w?A+C*Xr:A,w^m>=n^S>=n){var N=ps(Wa(p),Wa(b));nc(N);var _=ps(a,N);nc(_);var T=(w^A>=0?-1:1)*Io(_[2]);(r>T||r===T&&(N[0]||N[1]))&&(s+=w^A>=0?1:-1)}}return(i<-yn||i<yn&&l<-Dy)^s&1}var wB=st(()=>{"use strict";No();Ud();Er()});function Yy(t,e,n,r){return function(o){var a=e(o),i=Wy(),s=e(i),l=!1,c,d,u,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=E,f.lineStart=y,f.lineEnd=b,d=[],c=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,d=vc(d);var S=xB(c,r);d.length?(l||(o.polygonStart(),l=!0),Fy(d,ait,S,n,o)):S&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),d=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function p(S,x){t(S,x)&&o.point(S,x)}function m(S,x){a.point(S,x)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function E(S,x){u.push([S,x]),s.point(S,x)}function y(){s.lineStart(),u=[]}function b(){E(u[0][0],u[0][1]),s.lineEnd();var S=s.clean(),x=i.result(),L,v=x.length,A,C,M;if(u.pop(),c.push(u),u=null,!!v){if(S&1){if(C=x[0],(A=C.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),L=0;L<A;++L)o.point((M=C[L])[0],M[1]);o.lineEnd()}return}v>1&&S&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(oit))}}return f}}function oit(t){return t.length>1}function ait(t,e){return((t=t.x)[0]<0?t[1]-yo-yn:yo-t[1])-((e=e.x)[0]<0?e[1]-yo-yn:yo-e[1])}var Kv=st(()=>{"use strict";Uv();jv();Er();wB();No()});function iit(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(a,i){var s=a>0?bn:-bn,l=En(a-e);En(l-bn)<yn?(t.point(e,n=(n+i)/2>0?yo:-yo),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),o=0):r!==s&&l>=bn&&(En(e-r)<yn&&(e-=r*yn),En(a-s)<yn&&(a-=s*yn),n=sit(e,n,a,i),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),o=0),t.point(e=a,n=i),r=s},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function sit(t,e,n,r){var o,a,i=Ln(t-n);return En(i)>yn?Oy((Ln(e)*(a=Cn(r))*Ln(n)-Ln(r)*(o=Cn(e))*Ln(t))/(o*a*i)):(e+r)/2}function lit(t,e,n,r){var o;if(t==null)o=n*yo,r.point(-bn,o),r.point(0,o),r.point(bn,o),r.point(bn,0),r.point(bn,-o),r.point(0,-o),r.point(-bn,-o),r.point(-bn,0),r.point(-bn,o);else if(En(t[0]-e[0])>yn){var a=t[0]<e[0]?bn:-bn;o=n*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(e[0],e[1])}var Zv,EB=st(()=>{"use strict";Kv();Er();Zv=Yy(function(){return!0},iit,lit,[-bn,-yo])});function SB(t){var e=Cn(t),n=2*Un,r=e>0,o=En(e)>yn;function a(d,u,f,p){gB(p,t,n,f,d,u)}function i(d,u){return Cn(d)*Cn(u)>e}function s(d){var u,f,p,m,h;return{lineStart:function(){m=p=!1,h=1},point:function(g,E){var y=[g,E],b,S=i(g,E),x=r?S?0:c(g,E):S?c(g+(g<0?bn:-bn),E):0;if(!u&&(m=p=S)&&d.lineStart(),S!==p&&(b=l(u,y),(!b||jd(u,b)||jd(y,b))&&(y[2]=1)),S!==p)h=0,S?(d.lineStart(),b=l(y,u),d.point(b[0],b[1])):(b=l(u,y),d.point(b[0],b[1],2),d.lineEnd()),u=b;else if(o&&u&&r^S){var L;!(x&f)&&(L=l(y,u,!0))&&(h=0,r?(d.lineStart(),d.point(L[0][0],L[0][1]),d.point(L[1][0],L[1][1]),d.lineEnd()):(d.point(L[1][0],L[1][1]),d.lineEnd(),d.lineStart(),d.point(L[0][0],L[0][1],3)))}S&&(!u||!jd(u,y))&&d.point(y[0],y[1]),u=y,p=S,f=x},lineEnd:function(){p&&d.lineEnd(),u=null},clean:function(){return h|(m&&p)<<1}}}function l(d,u,f){var p=Wa(d),m=Wa(u),h=[1,0,0],g=ps(p,m),E=tp(g,g),y=g[0],b=E-y*y;if(!b)return!f&&d;var S=e*E/b,x=-e*y/b,L=ps(h,g),v=ep(h,S),A=ep(g,x);Hy(v,A);var C=L,M=tp(v,C),w=tp(C,C),k=M*M-w*(tp(v,v)-1);if(!(k<0)){var N=bo(k),_=ep(C,(-M-N)/w);if(Hy(_,v),_=ec(_),!f)return _;var T=d[0],R=u[0],G=d[1],I=u[1],H;R<T&&(H=T,T=R,R=H);var O=R-T,D=En(O-bn)<yn,W=D||O<yn;if(!D&&I<G&&(H=G,G=I,I=H),W?D?G+I>0^_[1]<(En(_[0]-T)<yn?G:I):G<=_[1]&&_[1]<=I:O>bn^(T<=_[0]&&_[0]<=R)){var z=ep(C,(-M+N)/w);return Hy(z,v),[_,ec(z)]}}}function c(d,u){var f=r?t:bn-t,p=0;return d<-f?p|=1:d>f&&(p|=2),u<-f?p|=4:u>f&&(p|=8),p}return Yy(i,s,a,r?[0,-t]:[-bn,t-bn])}var vB=st(()=>{"use strict";Ud();yB();Er();Xv();Kv()});function kB(t,e,n,r,o,a){var i=t[0],s=t[1],l=e[0],c=e[1],d=0,u=1,f=l-i,p=c-s,m;if(m=n-i,!(!f&&m>0)){if(m/=f,f<0){if(m<d)return;m<u&&(u=m)}else if(f>0){if(m>u)return;m>d&&(d=m)}if(m=o-i,!(!f&&m<0)){if(m/=f,f<0){if(m>u)return;m>d&&(d=m)}else if(f>0){if(m<d)return;m<u&&(u=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<d)return;m<u&&(u=m)}else if(p>0){if(m>u)return;m>d&&(d=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>u)return;m>d&&(d=m)}else if(p>0){if(m<d)return;m<u&&(u=m)}return d>0&&(t[0]=i+d*f,t[1]=s+d*p),u<1&&(e[0]=i+u*f,e[1]=s+u*p),!0}}}}}var LB=st(()=>{"use strict"});function Qv(t,e,n,r){function o(c,d){return t<=c&&c<=n&&e<=d&&d<=r}function a(c,d,u,f){var p=0,m=0;if(c==null||(p=i(c,u))!==(m=i(d,u))||l(c,d)<0^u>0)do f.point(p===0||p===3?t:n,p>1?r:e);while((p=(p+u+4)%4)!==m);else f.point(d[0],d[1])}function i(c,d){return En(c[0]-t)<yn?d>0?0:3:En(c[0]-n)<yn?d>0?2:1:En(c[1]-e)<yn?d>0?1:0:d>0?3:2}function s(c,d){return l(c.x,d.x)}function l(c,d){var u=i(c,1),f=i(d,1);return u!==f?u-f:u===0?d[1]-c[1]:u===1?c[0]-d[0]:u===2?c[1]-d[1]:d[0]-c[0]}return function(c){var d=c,u=Wy(),f,p,m,h,g,E,y,b,S,x,L,v={point:A,lineStart:k,lineEnd:N,polygonStart:M,polygonEnd:w};function A(T,R){o(T,R)&&d.point(T,R)}function C(){for(var T=0,R=0,G=p.length;R<G;++R)for(var I=p[R],H=1,O=I.length,D=I[0],W,z,P=D[0],B=D[1];H<O;++H)W=P,z=B,D=I[H],P=D[0],B=D[1],z<=r?B>r&&(P-W)*(r-z)>(B-z)*(t-W)&&++T:B<=r&&(P-W)*(r-z)<(B-z)*(t-W)&&--T;return T}function M(){d=u,f=[],p=[],L=!0}function w(){var T=C(),R=L&&T,G=(f=vc(f)).length;(R||G)&&(c.polygonStart(),R&&(c.lineStart(),a(null,null,1,c),c.lineEnd()),G&&Fy(f,s,T,a,c),c.polygonEnd()),d=c,f=p=m=null}function k(){v.point=_,p&&p.push(m=[]),x=!0,S=!1,y=b=NaN}function N(){f&&(_(h,g),E&&S&&u.rejoin(),f.push(u.result())),v.point=A,S&&d.lineEnd()}function _(T,R){var G=o(T,R);if(p&&m.push([T,R]),x)h=T,g=R,E=G,x=!1,G&&(d.lineStart(),d.point(T,R));else if(G&&S)d.point(T,R);else{var I=[y=Math.max(zy,Math.min(op,y)),b=Math.max(zy,Math.min(op,b))],H=[T=Math.max(zy,Math.min(op,T)),R=Math.max(zy,Math.min(op,R))];kB(I,H,t,e,n,r)?(S||(d.lineStart(),d.point(I[0],I[1])),d.point(H[0],H[1]),G||d.lineEnd(),L=!1):G&&(d.lineStart(),d.point(T,R),L=!1)}y=T,b=R,S=G}return v}}var op,zy,NB=st(()=>{"use strict";Er();Uv();LB();jv();No();op=1e9,zy=-op});var ap,Jv=st(()=>{"use strict";ap=t=>t});function cit(){ul.point=dit}function dit(t,e){ul.point=CB,MB=nk=t,TB=rk=e}function CB(t,e){ek.add(rk*t-nk*e),nk=t,rk=e}function uit(){CB(MB,TB)}var tk,ek,MB,TB,nk,rk,ul,ok,_B=st(()=>{"use strict";No();Er();tc();tk=new qr,ek=new qr,ul={point:Dr,lineStart:Dr,lineEnd:Dr,polygonStart:function(){ul.lineStart=cit,ul.lineEnd=uit},polygonEnd:function(){ul.lineStart=ul.lineEnd=ul.point=Dr,tk.add(En(ek)),ek=new qr},result:function(){var t=tk/2;return tk=new qr,t}};ok=ul});function pit(t,e){t<qd&&(qd=t),t>ip&&(ip=t),e<Vy&&(Vy=e),e>Uy&&(Uy=e)}var qd,Vy,ip,Uy,fit,Kd,ak=st(()=>{"use strict";tc();qd=1/0,Vy=qd,ip=-qd,Uy=ip,fit={point:pit,lineStart:Dr,lineEnd:Dr,polygonStart:Dr,polygonEnd:Dr,result:function(){var t=[[qd,Vy],[ip,Uy]];return ip=Uy=-(Vy=qd=1/0),t}};Kd=fit});function oc(t,e){ik+=t,sk+=e,++sp}function AB(){si.point=mit}function mit(t,e){si.point=hit,oc(Fi=t,Yi=e)}function hit(t,e){var n=t-Fi,r=e-Yi,o=bo(n*n+r*r);Xy+=o*(Fi+t)/2,jy+=o*(Yi+e)/2,Zd+=o,oc(Fi=t,Yi=e)}function RB(){si.point=oc}function git(){si.point=bit}function yit(){DB(IB,PB)}function bit(t,e){si.point=DB,oc(IB=Fi=t,PB=Yi=e)}function DB(t,e){var n=t-Fi,r=e-Yi,o=bo(n*n+r*r);Xy+=o*(Fi+t)/2,jy+=o*(Yi+e)/2,Zd+=o,o=Yi*t-Fi*e,lk+=o*(Fi+t),ck+=o*(Yi+e),lp+=o*3,oc(Fi=t,Yi=e)}var ik,sk,sp,Xy,jy,Zd,lk,ck,lp,IB,PB,Fi,Yi,si,dk,OB=st(()=>{"use strict";Er();ik=0,sk=0,sp=0,Xy=0,jy=0,Zd=0,lk=0,ck=0,lp=0,si={point:oc,lineStart:AB,lineEnd:RB,polygonStart:function(){si.lineStart=git,si.lineEnd=yit},polygonEnd:function(){si.point=oc,si.lineStart=AB,si.lineEnd=RB},result:function(){var t=lp?[lk/lp,ck/lp]:Zd?[Xy/Zd,jy/Zd]:sp?[ik/sp,sk/sp]:[NaN,NaN];return ik=sk=sp=Xy=jy=Zd=lk=ck=lp=0,t}};dk=si});function qy(t){this._context=t}var GB=st(()=>{"use strict";Er();tc();qy.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Xr);break}}},result:Dr}});function xit(t,e){Ky.point=WB,$B=cp=t,HB=dp=e}function WB(t,e){cp-=t,dp-=e,fk.add(bo(cp*cp+dp*dp)),cp=t,dp=e}var fk,uk,$B,HB,cp,dp,Ky,pk,BB=st(()=>{"use strict";No();Er();tc();fk=new qr,Ky={point:Dr,lineStart:function(){Ky.point=xit},lineEnd:function(){uk&&WB($B,HB),Ky.point=Dr},polygonStart:function(){uk=!0},polygonEnd:function(){uk=null},result:function(){var t=+fk;return fk=new qr,t}};pk=Ky});function VB(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function wit(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return VB;if(e!==FB){let n=10**e;FB=e,Zy=function(o){let a=1;this._+=o[0];for(let i=o.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+o[a]}}return Zy}var FB,Zy,YB,zB,Qd,UB=st(()=>{"use strict";Qd=class{constructor(e){this._append=e==null?VB:wit(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==YB||this._append!==Zy){let r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,YB=r,Zy=this._append,zB=this._,this._=o}this._+=zB;break}}}result(){let e=this._;return this._="",e.length?e:null}}});function Ba(t,e){let n=3,r=4.5,o,a;function i(s){return s&&(typeof r=="function"&&a.pointRadius(+r.apply(this,arguments)),Ha(s,o(a))),a.result()}return i.area=function(s){return Ha(s,o(ok)),ok.result()},i.measure=function(s){return Ha(s,o(pk)),pk.result()},i.bounds=function(s){return Ha(s,o(Kd)),Kd.result()},i.centroid=function(s){return Ha(s,o(dk)),dk.result()},i.projection=function(s){return arguments.length?(o=s==null?(t=null,ap):(t=s).stream,i):t},i.context=function(s){return arguments.length?(a=s==null?(e=null,new Qd(n)):new qy(e=s),typeof r!="function"&&a.pointRadius(r),i):e},i.pointRadius=function(s){return arguments.length?(r=typeof s=="function"?s:(a.pointRadius(+s),+s),i):r},i.digits=function(s){if(!arguments.length)return n;if(s==null)n=null;else{let l=Math.floor(s);if(!(l>=0))throw new RangeError(`invalid digits: ${s}`);n=l}return e===null&&(a=new Qd(n)),i},i.projection(t).digits(n).context(e)}var XB=st(()=>{"use strict";Jv();Qf();_B();ak();OB();GB();BB();UB()});function Qy(t){return{stream:Jd(t)}}function Jd(t){return function(e){var n=new mk;for(var r in t)n[r]=t[r];return n.stream=e,n}}function mk(){}var Jy=st(()=>{"use strict";mk.prototype={constructor:mk,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}});function hk(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),Ha(n,t.stream(Kd)),e(Kd.result()),r!=null&&t.clipExtent(r),t}function gk(t,e,n){return hk(t,function(r){var o=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=Math.min(o/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+e[0][0]+(o-i*(r[1][0]+r[0][0]))/2,l=+e[0][1]+(a-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,l])},n)}function jB(t,e,n){return gk(t,[[0,0],e],n)}function qB(t,e,n){return hk(t,function(r){var o=+e,a=o/(r[1][0]-r[0][0]),i=(o-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([i,s])},n)}function KB(t,e,n){return hk(t,function(r){var o=+e,a=o/(r[1][1]-r[0][1]),i=-a*r[0][0],s=(o-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([i,s])},n)}var ZB=st(()=>{"use strict";Qf();ak()});function yk(t,e){return+e?vit(t,e):Sit(t)}function Sit(t){return Jd({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function vit(t,e){function n(r,o,a,i,s,l,c,d,u,f,p,m,h,g){var E=c-r,y=d-o,b=E*E+y*y;if(b>4*e&&h--){var S=i+f,x=s+p,L=l+m,v=bo(S*S+x*x+L*L),A=Io(L/=v),C=En(En(L)-1)<yn||En(a-u)<yn?(a+u)/2:la(x,S),M=t(C,A),w=M[0],k=M[1],N=w-r,_=k-o,T=y*N-E*_;(T*T/b>e||En((E*N+y*_)/b-.5)>.3||i*f+s*p+l*m<Eit)&&(n(r,o,a,i,s,l,w,k,C,S/=v,x/=v,L,h,g),g.point(w,k),n(w,k,C,S,x,L,c,d,u,f,p,m,h,g))}}return function(r){var o,a,i,s,l,c,d,u,f,p,m,h,g={point:E,lineStart:y,lineEnd:S,polygonStart:function(){r.polygonStart(),g.lineStart=x},polygonEnd:function(){r.polygonEnd(),g.lineStart=y}};function E(A,C){A=t(A,C),r.point(A[0],A[1])}function y(){u=NaN,g.point=b,r.lineStart()}function b(A,C){var M=Wa([A,C]),w=t(A,C);n(u,f,d,p,m,h,u=w[0],f=w[1],d=A,p=M[0],m=M[1],h=M[2],QB,r),r.point(u,f)}function S(){g.point=E,r.lineEnd()}function x(){y(),g.point=L,g.lineEnd=v}function L(A,C){b(o=A,C),a=u,i=f,s=p,l=m,c=h,g.point=b}function v(){n(u,f,d,p,m,h,a,i,o,s,l,c,QB,r),g.lineEnd=S,S()}return g}}var QB,Eit,JB=st(()=>{"use strict";Ud();Er();Jy();QB=16,Eit=Cn(30*Un)});function Lit(t){return Jd({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function Nit(t,e,n,r,o){function a(i,s){return i*=r,s*=o,[e+t*i,n-t*s]}return a.invert=function(i,s){return[(i-e)/t*r,(n-s)/t*o]},a}function tF(t,e,n,r,o,a){if(!a)return Nit(t,e,n,r,o);var i=Cn(a),s=Ln(a),l=i*t,c=s*t,d=i/t,u=s/t,f=(s*n-i*e)/t,p=(s*e+i*n)/t;function m(h,g){return h*=r,g*=o,[l*h-c*g+e,n-c*h-l*g]}return m.invert=function(h,g){return[r*(d*h-u*g+f),o*(p-u*h-d*g)]},m}function ys(t){return bk(function(){return t})()}function bk(t){var e,n=150,r=480,o=250,a=0,i=0,s=0,l=0,c=0,d,u=0,f=1,p=1,m=null,h=Zv,g=null,E,y,b,S=ap,x=.5,L,v,A,C,M;function w(T){return A(T[0]*Un,T[1]*Un)}function k(T){return T=A.invert(T[0],T[1]),T&&[T[0]*Pr,T[1]*Pr]}w.stream=function(T){return C&&M===T?C:C=kit(Lit(d)(h(L(S(M=T)))))},w.preclip=function(T){return arguments.length?(h=T,m=void 0,_()):h},w.postclip=function(T){return arguments.length?(S=T,g=E=y=b=null,_()):S},w.clipAngle=function(T){return arguments.length?(h=+T?SB(m=T*Un):(m=null,Zv),_()):m*Pr},w.clipExtent=function(T){return arguments.length?(S=T==null?(g=E=y=b=null,ap):Qv(g=+T[0][0],E=+T[0][1],y=+T[1][0],b=+T[1][1]),_()):g==null?null:[[g,E],[y,b]]},w.scale=function(T){return arguments.length?(n=+T,N()):n},w.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],N()):[r,o]},w.center=function(T){return arguments.length?(a=T[0]%360*Un,i=T[1]%360*Un,N()):[a*Pr,i*Pr]},w.rotate=function(T){return arguments.length?(s=T[0]%360*Un,l=T[1]%360*Un,c=T.length>2?T[2]%360*Un:0,N()):[s*Pr,l*Pr,c*Pr]},w.angle=function(T){return arguments.length?(u=T%360*Un,N()):u*Pr},w.reflectX=function(T){return arguments.length?(f=T?-1:1,N()):f<0},w.reflectY=function(T){return arguments.length?(p=T?-1:1,N()):p<0},w.precision=function(T){return arguments.length?(L=yk(v,x=T*T),_()):bo(x)},w.fitExtent=function(T,R){return gk(w,T,R)},w.fitSize=function(T,R){return jB(w,T,R)},w.fitWidth=function(T,R){return qB(w,T,R)},w.fitHeight=function(T,R){return KB(w,T,R)};function N(){var T=tF(n,0,0,f,p,u).apply(null,e(a,i)),R=tF(n,r-T[0],o-T[1],f,p,u);return d=zv(s,l,c),v=rp(e,R),A=rp(d,v),L=yk(v,x),_()}function _(){return C=M=null,w}return function(){return e=t.apply(this,arguments),w.invert=e.invert&&k,N()}}var kit,tu=st(()=>{"use strict";EB();vB();NB();Fv();Jv();Er();Vv();Jy();ZB();JB();kit=Jd({point:function(t,e){this.stream.point(t*Un,e*Un)}})});function eF(t){var e=0,n=bn/3,r=bk(t),o=r(e,n);return o.parallels=function(a){return arguments.length?r(e=a[0]*Un,n=a[1]*Un):[e*Pr,n*Pr]},o}var nF=st(()=>{"use strict";Er();tu()});function rF(t){var e=Cn(t);function n(r,o){return[r*e,Ln(o)/e]}return n.invert=function(r,o){return[r/e,Io(o*e)]},n}var oF=st(()=>{"use strict";Er()});function aF(t,e){var n=Ln(t),r=(n+Ln(e))/2;if(En(r)<yn)return rF(t);var o=1+n*(2*r-n),a=bo(o)/r;function i(s,l){var c=bo(o-2*r*Ln(l))/r;return[c*Ln(s*=r),a-c*Cn(s)]}return i.invert=function(s,l){var c=a-l,d=la(s,En(c))*Vd(c);return c*r<0&&(d-=bn*Vd(s)*Vd(c)),[d/r,Io((o-(s*s+c*c)*r*r)/(2*r))]},i}function up(){return eF(aF).scale(155.424).center([0,33.6442])}var iF=st(()=>{"use strict";Er();nF();oF()});function tb(t,e){return[t,jW(qW((yo+e)/2))]}function eb(){return Mit(tb).scale(961/Xr)}function Mit(t){var e=ys(t),n=e.center,r=e.scale,o=e.translate,a=e.clipExtent,i=null,s,l,c;e.scale=function(u){return arguments.length?(r(u),d()):r()},e.translate=function(u){return arguments.length?(o(u),d()):o()},e.center=function(u){return arguments.length?(n(u),d()):n()},e.clipExtent=function(u){return arguments.length?(u==null?i=s=l=c=null:(i=+u[0][0],s=+u[0][1],l=+u[1][0],c=+u[1][1]),d()):i==null?null:[[i,s],[l,c]]};function d(){var u=bn*r(),f=e(mB(e.rotate()).invert([0,0]));return a(i==null?[[f[0]-u,f[1]-u],[f[0]+u,f[1]+u]]:t===tb?[[Math.max(f[0]-u,i),s],[Math.min(f[0]+u,l),c]]:[[i,Math.max(f[1]-u,s)],[l,Math.min(f[1]+u,c)]])}return d()}var sF=st(()=>{"use strict";Er();Vv();tu();tb.invert=function(t,e){return[t,2*Oy(XW(e))-yo]}});function nb(t,e){return[t,e]}function rb(){return ys(nb).scale(152.63)}var lF=st(()=>{"use strict";tu();nb.invert=nb});function xk(t,e){var n=Io(ob*Ln(e)),r=n*n,o=r*r*r;return[t*Cn(n)/(ob*(fp+3*pp*r+o*(7*mp+9*hp*r))),n*(fp+pp*r+o*(mp+hp*r))]}function wk(){return ys(xk).scale(177.158)}var fp,pp,mp,hp,ob,Tit,cF=st(()=>{"use strict";tu();Er();fp=1.340264,pp=-.081106,mp=893e-6,hp=.003796,ob=bo(3)/2,Tit=12;xk.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,a=0,i,s,l;a<Tit&&(s=n*(fp+pp*r+o*(mp+hp*r))-e,l=fp+3*pp*r+o*(7*mp+9*hp*r),n-=i=s/l,r=n*n,o=r*r*r,!(En(i)<Dy));++a);return[ob*t*(fp+3*pp*r+o*(7*mp+9*hp*r))/Cn(n),Io(Ln(n)/ob)]}});function Ek(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function Sk(){return ys(Ek).scale(175.295)}var dF=st(()=>{"use strict";tu();Er();Ek.invert=function(t,e){var n=e,r=25,o;do{var a=n*n,i=a*a;n-=o=(n*(1.007226+a*(.015085+i*(-.044475+.028874*a-.005916*i)))-e)/(1.007226+a*(.015085*3+i*(-.044475*7+.028874*9*a-.005916*11*i)))}while(En(o)>yn&&--r>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}});var ab=st(()=>{"use strict";Wv();dB();XB();iF();cF();lF();sF();dF();Jy()});function eu(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function vk(t){let e=new Map;for(let n of eu(t).geometries){let r=li(n.properties.name);e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}for(let n of eu(t).geometries){let r=n.id.toLowerCase();e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}return e}function kk(t){let e=uF.get(t);if(e)return e;let n=eu(t).geometries,r=Rv(n),o=new Map;n.forEach((i,s)=>{if(!i.type||i.type==="null")return;let l=o.get(i.id);l||(l=new Set,o.set(i.id,l));for(let c of r[s]??[]){let d=n[c]?.id;d&&d!==i.id&&l.add(d)}});let a=new Map;for(let[i,s]of o)a.set(i,[...s].sort());return uF.set(t,a),a}function Lk(t){return eu(t).geometries.map(e=>{let n=Jl(t,e);return{type:"Feature",id:e.id,properties:e.properties,geometry:n.geometry}})}function fF(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let i=n[o][0],s=n[o][1],l=n[a][0],c=n[a][1];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function pF(t,e,n){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r][0],i=n[r][1],s=n[o][0],l=n[o][1];if(t<Math.min(a,s)-gp||t>Math.max(a,s)+gp||e<Math.min(i,l)-gp||e>Math.max(i,l)+gp)continue;let c=(s-a)*(e-i)-(l-i)*(t-a);if(Math.abs(c)<=gp)return!0}return!1}function yp(t,e,n){let r=t;if(!r)return!1;let o=r.type==="Polygon"?[r.coordinates]:r.type==="MultiPolygon"?r.coordinates:[];for(let a of o){if(!a.length)continue;if(pF(e,n,a[0]))return!0;if(!fF(e,n,a[0]))continue;let i=!1;for(let s=1;s<a.length;s++)if(fF(e,n,a[s])&&!pF(e,n,a[s])){i=!0;break}if(!i)return!0}return!1}function mF(t,e,n){let r=t[0],o=t[1],a=null;for(let s of e)if(yp(s.geometry,r,o)){a={iso:s.id,name:s.properties.name};break}let i=null;if(a?.iso==="US"&&n){for(let s of n)if(yp(s.geometry,r,o)){i={iso:s.id,name:s.properties.name};break}}return{country:a,state:i}}function bp(t,e){let n=eu(t).geometries.find(a=>a.id===e);if(!n)return null;let r=Jl(t,n),o=gs(r);return!o||!Number.isFinite(o[0][0])?null:[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]}function Ait(t){let e=t.geometry??t,n=e.type,r=e.coordinates;return n==="Polygon"?[{type:"Feature",geometry:{type:"Polygon",coordinates:r}}]:n==="MultiPolygon"?r.map(o=>({type:"Feature",geometry:{type:"Polygon",coordinates:o}})):[]}function Rit(t,e){let n=Math.max(0,t[0][0]-e[1][0],e[0][0]-t[1][0]),r=Math.max(0,t[0][1]-e[1][1],e[0][1]-t[1][1]);return Math.max(n,r)}function xp(t,e){let n=eu(t).geometries.find(u=>u.id===e);if(!n)return null;let r=Jl(t,n),o=Ait(r);if(o.length<=1)return bp(t,e);let a=o.map(u=>{let f=gs(u);if(!f||!Number.isFinite(f[0][0]))return null;let p=f[1][0]<f[0][0];return{bbox:[[f[0][0],f[0][1]],[f[1][0],f[1][1]]],area:Hv(u),wraps:p}}).filter(u=>u!==null);if(a.length<=1||a.some(u=>u.wraps))return bp(t,e);let i=Math.max(...a.map(u=>u.area)),s=a.find(u=>u.area===i),l=[[s.bbox[0][0],s.bbox[0][1]],[s.bbox[1][0],s.bbox[1][1]]],c=a.filter(u=>u!==s),d=!0;for(;d;){d=!1;for(let u=c.length-1;u>=0;u--){let f=c[u],p=Rit(f.bbox,l)<=Cit,m=f.area>=_it*i;(p||m)&&(l[0][0]=Math.min(l[0][0],f.bbox[0][0]),l[0][1]=Math.min(l[0][1],f.bbox[0][1]),l[1][0]=Math.max(l[1][0],f.bbox[1][0]),l[1][1]=Math.max(l[1][1],f.bbox[1][1]),c.splice(u,1),d=!0)}}return l}function ib(t,e){let n=[],r=[];for(let l of t)n.push(l[0][1],l[1][1]),r.push(l[0][0],l[1][0]);for(let[l,c]of e)r.push(l),n.push(c);if(!n.length)return null;let o=Math.min(...n),a=Math.max(...n),{west:i,east:s}=Iit(r);return[[i,o],[s,a]]}function Iit(t){let e=[...new Set(t)].sort((a,i)=>a-i);if(e.length===1)return{west:e[0],east:e[0]};let n=-1,r=-1;for(let a=1;a<e.length;a++){let i=e[a]-e[a-1];i>n&&(n=i,r=a)}return e[0]+360-e[e.length-1]>=n?{west:e[0],east:e[e.length-1]}:{west:e[r],east:e[r-1]+360}}var li,uF,gp,Cit,_it,Nk=st(()=>{"use strict";Pv();ab();li=t=>t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim();uF=new WeakMap;gp=1e-9;Cit=10,_it=.25});var Ck={};ye(Ck,{isSubNationalUsExtent:()=>SF,resolveMap:()=>Xit});function Bit(t,e){return e?Mk:Math.max(Hit,Math.min(Mk,Mk-Wit*t))}function yF(t){return(t[1][0]-t[0][0])*(t[1][1]-t[0][1])}function SF(t){return t?yF(t)/yF(Yit)<zit:!1}function Tk(t){if(!t)return null;let e=t.toUpperCase();return Vit.has(e)?`US-${e}`:null}function xF(t,e){return t<15||t>72?!1:e>=-180&&e<=-64||e>=172}function wF(t,e){return t>=14&&t<=72&&e>=-141&&e<=-52}function Uit(t){return t[0][0]<=-179&&t[1][0]>=179&&t[0][1]<=-89&&t[1][1]>=89}function Xit(t,e){let n=[...t.diagnostics],r=new Set,o={title:t.title,...t.directives.caption!==void 0&&{caption:t.directives.caption},tagGroups:[...t.tagGroups],directives:{...t.directives},basemaps:{world:"detail",subdivisions:[]},regions:[],pois:[],edges:[],routes:[],extent:[[-180,-85],[180,85]],projection:"equirectangular",poiFrameContainers:[],diagnostics:n,error:t.error},a=vk(e.worldCoarse),i=vk(e.usStates),s=[...[...a.values()].map(Z=>Z.name),...[...i.values()].map(Z=>Z.name)],l=t.directives.locale?.toUpperCase(),c=l?l.split("-")[0]:void 0,d=l&&/^[A-Z]{2}-/.test(l)?l:void 0,u=c==="US"||t.regions.some(Z=>{let lt=li(Z.name);return i.has(lt)&&!a.has(lt)})||t.regions.some(Z=>Z.scope==="US"||Z.scope?.startsWith("US-")||Tk(Z.scope)!==null)||t.pois.some(Z=>Z.pos.kind==="name"&&(Z.pos.scope?.startsWith("US-")||Tk(Z.pos.scope)!==null)),f=[],p=new Map,m=!1,h=!1,g=!1,E=[];for(let Z of t.regions){let lt=li(Z.name),nt=a.get(lt)??(bF[lt]?a.get(bF[lt]):void 0),J=i.get(lt),at=null,it=Z.scope;if(it){let At=it==="US"||it.startsWith("US-");if(At&&J){if(it.startsWith("US-")&&J.id!==it){n.push(Ne(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it,iso:J.id}));continue}at={...J,layer:"us-state"}}else if(!At&&nt)at={...nt,layer:"country"};else{n.push(Ne(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it}));continue}}else nt&&J?u?at={...J,layer:"us-state"}:(at={...nt,layer:"country"},n.push(Ne(sa.REGION_AMBIGUOUS,Z.lineNumber,{name:Z.name,layer:at.layer,chosenId:at.id,stateId:J.id,countryId:nt.id}))):J?at={...J,layer:"us-state"}:nt&&(at={...nt,layer:"country"});if(!at){let At=be(Z.name,s);n.push(Ne(sa.UNKNOWN_SUBDIVISION,Z.lineNumber,{name:Z.name,hint:At}));continue}at.layer==="us-state"&&(m=!0,at.id==="US-AK"&&(h=!0),at.id==="US-HI"&&(g=!0),E.push({topo:"us",id:at.id}));let vt={iso:at.id,name:at.name,layer:at.layer,...Z.value!==void 0&&{value:Z.value},...Z.color!==void 0&&{color:Z.color},tags:Z.tags,meta:Z.meta,lineNumber:Z.lineNumber},Tt=p.get(at.id);Tt!==void 0?(n.push(Ne(sa.DUPLICATE_REGION,Z.lineNumber,{name:at.name})),f[Tt]=vt):(p.set(at.id,f.length),f.push(vt))}let y=new Map,b=[],S=(Z,lt,nt)=>{let J=y.get(Z);if(J){if(lt.implicit&&!J.implicit)return;!lt.implicit&&!J.implicit&&n.push(Ne(sa.DUPLICATE_POI,nt,{id:Z}));let at=b.indexOf(J);at>=0&&(b[at]=lt)}else b.push(lt);y.set(Z,lt)},x=(Z,lt,nt,J,at)=>{let it=li(Z),vt=e.gazetteer.byName[it];if(!vt?.length){let pt=e.gazetteer.alt[it];pt!==void 0&&(vt=[pt])}if(!vt?.length){let pt=e.airports?.airportIata?.[it];if(pt!==void 0){let ut=e.airports.airports[pt];if(ut)return{kind:"ok",lat:ut[0],lon:ut[1],iso:ut[2]}}if(/^[A-Za-z]{3}$/.test(Z)){let ut=Z.toUpperCase();return n.push(Ne(sa.UNKNOWN_AIRPORT_CODE,nt,{code:ut})),{kind:"miss"}}let ht=e.gazetteer.cities.map(ut=>ut[4]),dt=be(Z,ht);return n.push(Ne(sa.UNKNOWN_PLACE,nt,{name:Z,hint:dt})),{kind:"miss"}}let Tt=vt.map(pt=>e.gazetteer.cities[pt]),At=lt??J;if(At){let pt=Tk(At),ht=/^[A-Za-z]{2}-/.test(At)?At:pt,dt=Tt.filter(ut=>ht?ut[5]===ht:ut[2]===At);if(dt.length)Tt=dt;else if(lt)return n.push(Ne(sa.SCOPE_MISS,nt,{name:Z,scope:lt,place:!0})),{kind:"miss"}}if(Tt.length>1){if(!at&&!At)return{kind:"defer"};Tt=[...Tt].sort((pt,ht)=>ht[3]-pt[3]),lt||n.push(Ne(sa.AMBIGUOUS_NAME,nt,{name:Z}))}let rt=Tt[0];if(e.airports?.airportIata?.[it]!==void 0&&!r.has(it)){r.add(it);let pt=Z.toUpperCase();n.push(Ne(sa.AIRPORT_SHADOWED_BY_CITY,nt,{name:Z,code:pt}))}return{kind:"ok",lat:rt[0],lon:rt[1],iso:rt[2]}},L=(Z,lt)=>lt?li(lt):Z.kind==="coords"?`@${Z.lat},${Z.lon}`:li(Z.name),v=[],A=!1,C=!1,M=Z=>{Z&&(v.push(Z),Z==="US"&&(A=!0),Z!=="US"&&Z!=="CA"&&Z!=="MX"&&(C=!0))},w=[];for(let Z of t.pois){if(Z.pos.kind==="coords"){xF(Z.pos.lat,Z.pos.lon)?A=!0:wF(Z.pos.lat,Z.pos.lon)||(C=!0),_(Z.pos.lat,Z.pos.lon,Z);continue}let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,void 0,!1);lt.kind==="ok"?(M(lt.iso),_(lt.lat,lt.lon,Z)):lt.kind==="defer"&&w.push(Z)}let k=c??jit(f,v)??void 0,N=d??k;for(let Z of w){if(Z.pos.kind!=="name")continue;let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,N,!0);lt.kind==="ok"&&(M(lt.iso),_(lt.lat,lt.lon,Z))}function _(Z,lt,nt){let J=L(nt.pos,nt.alias),at=nt.pos.kind==="name"?nt.pos.name:nt.alias,it={id:J,...at!==void 0&&{name:at},lat:Z,lon:lt,...nt.label!==void 0&&{label:nt.label},...nt.color!==void 0&&{color:nt.color},tags:nt.tags,meta:nt.meta,lineNumber:nt.lineNumber};S(J,it,nt.lineNumber)}let T=new Map;for(let Z of b){let lt=Z.name?li(Z.name):void 0;lt&&lt!==Z.id&&!T.has(lt)&&T.set(lt,Z.id)}let R=(Z,lt)=>{let nt=li(Z);if(y.has(nt))return nt;let J=T.get(nt);if(J)return J;let at=x(Z,void 0,lt,k,!0);if(at.kind!=="ok")return null;M(at.iso);let it={id:nt,name:Z,lat:at.lat,lon:at.lon,tags:{},meta:{},lineNumber:lt,implicit:!0};return S(nt,it,lt),nt},G=[];for(let Z of t.edges){let lt=R(Z.from,Z.lineNumber),nt=R(Z.to,Z.lineNumber);!lt||!nt||G.push({fromId:lt,toId:nt,...Z.label!==void 0&&{label:Z.label},directed:Z.directed,style:Z.style,meta:Z.meta,tags:Z.tags,lineNumber:Z.lineNumber})}let I=(Z,lt,nt,J,at,it)=>{let vt=at!==void 0?{value:at}:{};if(Z.kind==="coords"){let pt=lt?li(lt):`@${Z.lat},${Z.lon}`;return xF(Z.lat,Z.lon)?A=!0:wF(Z.lat,Z.lon)||(C=!0),y.has(pt)||S(pt,{id:pt,...lt!==void 0&&{name:lt},lat:Z.lat,lon:Z.lon,...nt!==void 0&&{label:nt},tags:J,meta:vt,lineNumber:it},it),pt}let Tt=li(Z.name);if(y.has(Tt))return Tt;let At=T.get(Tt);if(At)return At;let rt=x(Z.name,Z.scope,it,N,!0);return rt.kind!=="ok"?null:(M(rt.iso),S(Tt,{id:Tt,name:Z.name,lat:rt.lat,lon:rt.lon,...nt!==void 0&&{label:nt},tags:J,meta:vt,lineNumber:it},it),Tt)},H=[];for(let Z of t.routes){let lt=I(Z.origin,Z.originAlias,Z.originLabel,Z.originTags,Z.originValue,Z.lineNumber);if(!lt)continue;let nt=[lt],J=[],at=lt;for(let it of Z.legs){let vt=I(it.dest,it.destAlias,it.destLabel,{},void 0,it.lineNumber);vt&&(J.push({fromId:at,toId:vt,...it.label!==void 0&&{label:it.label},style:it.style,...it.value!==void 0&&{value:it.value},tags:it.tags,lineNumber:it.lineNumber}),nt.includes(vt)||nt.push(vt),at=vt)}H.push({stopIds:nt,legs:J,lineNumber:Z.lineNumber})}let O=m||A||c==="US",D=!C&&!f.some(Z=>Z.layer==="country"&&!["US","CA","MX"].includes(Z.iso))&&O,W=[];(m||D)&&W.push("us-states");let z=[];for(let Z of E){let lt=bp(e.usStates,Z.id);lt&&z.push(lt)}for(let Z of f)if(Z.layer==="country"){let lt=xp(e.worldCoarse,Z.iso);lt&&z.push(lt)}let P=b.map(Z=>[Z.lon,Z.lat]),B=ib(z,P),Y=SF(B),V=c==="US"&&!d,j=[[-180,-85],[180,85]],K=f.length>0?Oit:hF,$=B?EF(B,K):j,U=b.length>0&&f.length===0,X=[];if(U){let Z=Lk(e.worldDetail),lt=Lk(e.usStates),nt=new Set,J=[];for(let it of b){let{country:vt,state:Tt}=mF([it.lon,it.lat],Z,lt),At=Tt?.iso??vt?.iso;if(!At||nt.has(At))continue;nt.add(At),X.push(At);let rt=Tt?bp(e.usStates,At):D?null:xp(e.worldCoarse,At);rt&&!Uit(rt)&&J.push(rt)}let at=ib(J,P);at&&($=EF(qit(at,P,D),hF))}if(U||Y&&D){let Z=($[0][0]+$[1][0])/2,lt=($[0][1]+$[1][1])/2,nt=$[1][0]-$[0][0],J=$[1][1]-$[0][1],at=Math.max(nt,J);if(at>0&&at<gF){let it=gF/at,vt=nt*it/2,Tt=J*it/2;$=[[Z-vt,lt-Tt],[Z+vt,lt+Tt]]}}let q=$[1][0]-$[0][0],et=$[1][1]-$[0][1],tt=Math.max(q,et),F=Math.max(Math.abs($[0][1]),Math.abs($[1][1])),Q=D&&Y&&!U&&!h&&!g&&!V,ot;return D&&q<Fit&&(U||Q)?ot="mercator":D?ot="albers-usa":tt>Pit||F>Dit?ot="equirectangular":ot="conic-equal-area",q>=180&&($=[[-180,Math.min($[0][1],Git)],[180,Math.max($[1][1],$it)]]),o.regions=f,o.pois=b,o.edges=G,o.routes=H,o.basemaps={world:"detail",subdivisions:W},o.extent=$,o.projection=ot,o.poiFrameContainers=X,o.error=t.error??Kit(n),o}function jit(t,e){let n=new Map;for(let a of t){let i=a.layer==="us-state"?"US":a.iso;n.set(i,(n.get(i)??0)+1)}for(let a of e)n.set(a,(n.get(a)??0)+1);let r,o=0;for(let[a,i]of[...n.entries()].sort((s,l)=>s[0]<l[0]?-1:1))i>o&&(o=i,r=a);return r}function qit(t,e,n){let r=ib([],e);if(!r)return t;let[[o,a],[i,s]]=t,[[l,c],[d,u]]=r,f=Bit(Math.max(d-l,u-c),n);a=Math.max(a,c-f),s=Math.min(s,u+f);let p=l-f,m=d+f;return o=o>=-180&&o<=l?Math.max(o,p):p,i=i<=180&&i>=d?Math.min(i,m):m,[[o,a],[i,s]]}function EF(t,e){let n=(t[1][0]-t[0][0])*e||1,r=(t[1][1]-t[0][1])*e||1;return[[Math.max(-180,t[0][0]-n),Math.max(-90,t[0][1]-r)],[Math.min(540,t[1][0]+n),Math.min(90,t[1][1]+r)]]}function Kit(t){let e=t.find(n=>n.severity==="error");return e?Fe(e):null}var Pit,Dit,hF,Oit,Git,$it,gF,Mk,Hit,Wit,Fit,Yit,zit,bF,Vit,_k=st(()=>{"use strict";hn();$W();Nk();Pit=90,Dit=80,hF=.05,Oit=.12,Git=-58,$it=78,gF=7,Mk=8,Hit=3,Wit=.3;Fit=48,Yit=[[-125,25],[-66,49]],zit=.4;bF={"united states":"united states of america",usa:"united states of america",america:"united states of america",uk:"united kingdom","western sahara":"w. sahara","democratic republic of the congo":"dem. rep. congo","dr congo":"dem. rep. congo",drc:"dem. rep. congo","dominican republic":"dominican rep.","falkland islands":"falkland is.","ivory coast":"cote d'ivoire","central african republic":"central african rep.","equatorial guinea":"eq. guinea","solomon islands":"solomon is.","bosnia and herzegovina":"bosnia and herz.","south sudan":"s. sudan","north macedonia":"macedonia","czech republic":"czechia"},Vit=new Set(["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"])});function sb(t){let e=t.ramp,n=e?{name:e.metric?.trim()||"Value",entries:[],gradient:{min:e.min,max:e.max,low:e.low,high:e.high}}:null,r=t.tagGroups.filter(o=>o.entries.length>0).map(o=>({name:o.name,entries:[...o.entries]}));return[...n?[n]:[],...r]}function lb(t,e){return{groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:e,showEmptyGroups:!1,showInactivePills:!0}}function vF(t,e){return(t?50:0)+(e?20:0)+Zit}function kF(t,e){if(!t)return 0;let n=sb(t);if(n.length===0)return 0;let r=lb(n,e.mode),o={activeGroup:t.activeGroup},{height:a}=Rl(r,o,e.width);return a<=0?0:vF(e.hasTitle,e.hasSubtitle)+a+Qit}function LF(t,e){if(!t)return null;let n=sb(t);if(n.length===0)return null;let r=lb(n,e.mode),o={activeGroup:t.activeGroup},{width:a,height:i}=Rl(r,o,e.width);return i<=0||a<=0?null:{x:(e.width-a)/2,y:vF(e.hasTitle,e.hasSubtitle),width:a,height:i}}var Zit,Qit,Ak=st(()=>{"use strict";To();Zit=8,Qit=10});function NF(t,e){let n=[...t].sort(),r=new Map,o=-1;for(let a of n){let i=new Set;for(let l of e.get(a)??[]){let c=r.get(l);c!==void 0&&i.add(c)}let s=0;for(;i.has(s);)s++;r.set(a,s),s>o&&(o=s)}return{byIso:r,huesNeeded:o+1}}var MF=st(()=>{"use strict"});function Dk(t){return t>=90?"world":t>=20?"continental":t>=5?"regional":"local"}function Ok(t,e,n){let r={world:10,continental:9,regional:7,local:6},o=Math.floor(Math.sqrt(Math.max(0,t*e))/105);return Math.max(0,Math.min(o,r[n]))}function ast(t,e,n){switch(n){case"world":return t<=1&&(e==="ocean"||e==="sea");case"continental":return t<=2;case"regional":return t<=3;case"local":return t<=4}}function _F(t,e,n){return!!t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]>=0&&t[0]<=e&&t[1]>=0&&t[1]<=n}function nu(t,e,n=bs){let r=e>0?Math.max(0,t.length-1)*e:0;return We(t,n)+r+2*Jit}function ist(t,e){let n=t.split(/\s+/).filter(Boolean);if(n.length<=1)return[t];let r=n.length>=4?3:2,o=n.length,a=null;for(let i=0;i<1<<o-1;i++){let s=[],l=[n[0]];for(let u=1;u<o;u++)i&1<<u-1?(s.push(l.join(" ")),l=[n[u]]):l.push(n[u]);if(s.push(l.join(" ")),s.length>r)continue;let c=Math.round(Math.max(...s.map(u=>nu(u,e)))),d=nu(s[0],e);(!a||c<a.cost||c===a.cost&&s.length<a.lines.length||c===a.cost&&s.length===a.lines.length&&d>a.head)&&(a={lines:s,cost:c,head:d})}return a?.lines??[t]}function sst(t,e,n,r,o=bs){let a=o+2,i=Math.max(...n.map(l=>nu(l,r,o))),s=(n.length-1)*a+o+2*Pk;return{x:t-i/2,y:e-s/2,w:i,h:s}}function lst(t,e,n){return t.x>=0&&t.y>=0&&t.x+t.w<=e&&t.y+t.h<=n}function cst(t,e,n){return t.x-n<e.x+e.w&&t.x+t.w+n>e.x&&t.y-n<e.y+e.h&&t.y+t.h+n>e.y}function PF(t){let{projection:e,dLonSpan:n,dLatSpan:r,width:o,height:a,waterBodies:i,countries:s,palette:l,countryTone:c,waterTone:d,project:u,collides:f,overLand:p}=t,m=Dk(Math.max(n,r)),h=Ok(o,a,m);if(h<=0)return[];let g=d??Gt(l.colors.blue,l.textMuted,50),E=c??l.textMuted,y=l.bg,b=[],S=[o/2,a/2];for(let R of i?.entries??[]){let[G,I,H,O,D,W]=R;if(!ast(O,D,m))continue;let z=ist(H,Ik),P=[[I,G]];for(let K of W??[])P.push([K[1],K[0]]);let B=null,Y=1/0,V=null,j=1/0;for(let[K,$]of P){let U=u(K,$);if(!U||!Number.isFinite(U[0])||!Number.isFinite(U[1]))continue;let X=(U[0]-S[0])**2+(U[1]-S[1])**2;X<j&&(j=X,V=U),_F(U,o,a)&&X<Y&&(Y=X,B=U)}if(!B&&O===0&&V){let K=Math.max(0,-V[0],V[0]-o),$=Math.max(0,-V[1],V[1]-a);if(K<=o*TF&&$<=a*TF){let U=Math.max(...z.map(et=>nu(et,Ik)))/2,X=((z.length-1)*Rk+bs+2*Pk)/2,q=est;B=[Math.min(Math.max(V[0],U+q),o-U-q),Math.min(Math.max(V[1],X+q),a-X-q)]}}B&&b.push({text:H,lines:z,cx:B[0],cy:B[1],italic:!0,letterSpacing:Ik,color:g,fontSize:bs,sort:(O<=1?0:2e3)+O*10+ost[D]})}let x=s.map(R=>{let[G,I,H,O]=R.bbox,D=H-G,W=O-I;return{c:R,w:D,h:W,area:D*W}}).filter(R=>Number.isFinite(R.area)&&R.area>0).sort((R,G)=>G.area-R.area),L=Math.sqrt(Math.max(1,o*a)),v=0;for(let R of x){let{c:G,w:I,h:H,area:O}=R;if(!G.curatedAnchor&&I>o*.66&&H>a*.66||!_F(G.anchor,o,a))continue;let D=Math.sqrt(O)/L,W=Math.min(1,Math.max(0,(D-CF)/(rst-CF))),z=Math.round(bs+W*(nst-bs)),P=E,B=G.name;nu(B,0,z)>I||z+2*Pk>H||b.push({text:B,lines:[B],cx:G.anchor[0],cy:G.anchor[1],italic:!1,letterSpacing:0,color:P,fontSize:z,...G.bordering?{bordering:!0}:{},...G.positions?{positions:G.positions}:{},sort:1e3+v++})}b.sort((R,G)=>R.sort-G.sort);let A=[],C=[],M=b.reduce((R,G)=>R+(!G.italic&&!G.bordering?1:0),0),w=h-Math.min(2,M),k=0,N=0,_=(R,G,I)=>{let H=sst(R,G,I.lines,I.letterSpacing,I.fontSize);if(!lst(H,o,a))return null;if(I.italic&&p){let D=G-(I.lines.length-1)/2*Rk;if(I.lines.some((z,P)=>{let B=nu(z,I.letterSpacing),Y=R-B/2+2,V=R+B/2-2,j=[Y,(Y+R)/2,R,(R+V)/2,V],K=D+P*Rk;return[K,K-bs*.4,K-bs*.8].some($=>j.some(U=>p(U,$)))}))return null}return f(H)||C.some(O=>cst(H,O,tst))?null:H},T=R=>{let G=R.positions??[[R.cx,R.cy]];for(let[I,H]of G){let O=_(I,H,R);if(O)return C.push(O),A.push({x:I,y:H,text:R.text,anchor:"middle",color:R.color,halo:!1,haloColor:y,fontSize:R.fontSize,italic:R.italic,letterSpacing:R.letterSpacing,...R.lines.length>1?{lines:R.lines}:{},lineNumber:0}),!0}return!1};for(let R of b)R.bordering&&T(R);for(let R of b)if(!R.bordering){if(N>=h)break;R.italic&&k>=w||T(R)&&(N++,R.italic&&k++)}return A}var bs,Rk,Jit,Pk,Ik,tst,est,TF,nst,CF,rst,AF,RF,IF,ost,DF=st(()=>{"use strict";tn();Mr();bs=11,Rk=bs+2,Jit=4,Pk=3,Ik=1.5,tst=4,est=8,TF=.35,nst=22,CF=.06,rst=.32,AF=4,RF=5,IF=3,ost={ocean:0,sea:1,gulf:2,bay:3,strait:4,channel:5,sound:6}});function GF(){let t=OF*OF;return Qy({lineStart(){let e=this;e._has=!1,e._pending=!1,e.stream.lineStart()},point(e,n){let r=this;if(r._lx=e,r._ly=n,r._has){let o=e-r._ex,a=n-r._ey;if(o*o+a*a<t){r._pending=!0;return}}r.stream.point(e,n),r._ex=e,r._ey=n,r._has=!0,r._pending=!1},lineEnd(){let e=this;e._pending&&e.stream.point(e._lx,e._ly),e._pending=!1,e.stream.lineEnd()}})}function Yst(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function zst(t,e){let n=a=>{let i=a.geometry;return i?i.type==="Polygon"?[i.coordinates]:i.type==="MultiPolygon"?i.coordinates:null:null},r=n(t),o=n(e);return!r||!o?t:{...t,geometry:{type:"MultiPolygon",coordinates:[...r,...o]}}}function ru(t){let e=XF.get(t);if(e)return e;let n=new Map;for(let r of Yst(t).geometries){let o=Jl(t,r);if(!o.geometry)continue;let a={...o,id:r.id},i=n.get(r.id);n.set(r.id,i?zst(i,a):a)}return XF.set(t,n),n}function Vst(t){let{geometry:e,bounds:n,project:r,width:o,height:a,curated:i}=t,s=n[0][0],l=n[0][1],c=n[1][0],d=n[1][1];if(![s,l,c,d].every(Number.isFinite)||c<=s||d<=l)return Wk(i,r);let u=RF,f=[],p=[];for(let A=0;A<u;A++){f[A]=[];let C=s+(A+.5)/u*(c-s);for(let M=0;M<u;M++){let w=l+(M+.5)/u*(d-l),k=yp(e,C,w);if(f[A][M]=k,!k)continue;let N=r(C,w);!N||!Number.isFinite(N[0])||!Number.isFinite(N[1])||N[0]<0||N[0]>o||N[1]<0||N[1]>a||p.push({i:A,j:M,lon:C,lat:w,sx:N[0],sy:N[1]})}}if(!p.length)return Wk(i,r);let m=p.reduce((A,C)=>A+C.sx,0)/p.length,h=p.reduce((A,C)=>A+C.sy,0)/p.length,g=A=>{let C=0;for(let M=-1;M<=1;M++)for(let w=-1;w<=1;w++){if(M===0&&w===0)continue;let k=A.i+M,N=A.j+w;k>=0&&k<u&&N>=0&&N<u&&f[k][N]&&C++}return C},E=A=>(A.sx-m)**2+(A.sy-h)**2,y=p.reduce((A,C)=>A+C.lon,0)/p.length,b=p.reduce((A,C)=>A+C.lat,0)/p.length,S=r(y,b),x=yp(e,y,b)&&S&&Number.isFinite(S[0])&&Number.isFinite(S[1])&&S[0]>=0&&S[0]<=o&&S[1]>=0&&S[1]<=a?[{lonLat:[y,b],screen:[S[0],S[1]]}]:[],L=[...p].sort((A,C)=>g(C)-g(A)||E(A)-E(C)).map(A=>({lonLat:[A.lon,A.lat],screen:[A.sx,A.sy]}));return[...i?Wk(i,r):[],...x,...L].slice(0,AF)}function Wk(t,e){if(!t)return[];let n=e(t[0],t[1]);return!n||!Number.isFinite(n[0])||!Number.isFinite(n[1])?[]:[{lonLat:[t[0],t[1]],screen:[n[0],n[1]]}]}function qst(t,e){switch(t){case"albers-usa":return Ust();case"conic-equal-area":{let n=e[0][1],r=e[1][1];return up().parallels([n+(r-n)/6,n+(r-n)*5/6]).center([0,(n+r)/2])}case"mercator":return eb();case"equal-earth":return wk();case"equirectangular":return rb();case"natural-earth":return Sk();default:return rb()}}function Qst(t,e=!1,n=!1){return Gt(t.colors.blue,t.bg,e?bst:yst)}function Jst(t,e,n=!1){return Gt(t.colors.green,t.bg,e?gst:hst)}function wp(t,e){let n=t.basemaps.subdivisions.includes("us-states"),r=(t.projection==="albers-usa"||t.projection==="mercator")&&n&&!!e.naLand,o=r||t.basemaps.world==="detail"?e.worldDetail:e.worldCoarse,a=new Map(ru(o));if(r&&e.naLand){let[p,m,h,g]=[-140,10,-52,66],E=ru(e.naLand);for(let[y,b]of E){let S=a.get(y);if(!S)continue;let[[x,L],[v,A]]=gs(S);x>=p&&v<=h&&L>=m&&A<=g&&a.set(y,{...b,properties:S.properties})}}let i=n?ru(e.usStates):null,s=()=>{let[[p,m],[h,g]]=t.extent,E=16,y=[];for(let b=0;b<=E;b++){let S=b/E,x=p+(h-p)*S,L=m+(g-m)*S;y.push([x,m],[x,g],[p,L],[h,L])}return{type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:y}}},l;if(t.projection==="albers-usa"&&i){l=[...i.entries()].filter(([m])=>!Yk.has(m)).map(([,m])=>m);let p=t.pois.filter(m=>!Bk(m.lon,m.lat)&&!Fk(m.lon,m.lat)).map(m=>[m.lon,m.lat]);p.length>0&&l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:p}});for(let m of t.regions)if(m.layer==="country"&&(m.iso==="CA"||m.iso==="MX")){let h=a.get(m.iso);h&&l.push(h)}}else l=[s()];let c={type:"FeatureCollection",features:l},d=qst(t.projection,t.extent);if(t.projection!=="albers-usa"){let p=(t.extent[0][0]+t.extent[1][0])/2;p>180&&(p-=360),d.rotate([-p,0])}let u=gs(c),f=u[1][0]-u[0][0]>=270||u[1][1]-u[0][1]>=130;return{projection:d,fitTarget:c,fitIsGlobal:f,worldLayer:a,usLayer:i,usCrisp:r,wantsUsStates:n,worldTopo:o}}function Ep(t){let e=[],n=[],r=/([MLZ])([^MLZ]*)/g,o;for(;o=r.exec(t);){if(o[1]==="Z"){n.length&&e.push(n),n=[];continue}o[1]==="M"&&n.length&&(e.push(n),n=[]);let a=o[2].split(/[ ,]+/).map(Number);for(let i=0;i+1<a.length;i+=2){let s=a[i],l=a[i+1];Number.isFinite(s)&&Number.isFinite(l)&&n.push([s,l])}}return n.length&&e.push(n),e}function tlt(t,e,n){let r=Ep(t);if(r.length<=1)return t;let o=.75,a=.003*e*n,i=f=>{let p=0;for(let m=0;m<f.length;m++){let h=f[m],g=f[(m+1)%f.length];p+=h[0]*g[1]-g[0]*h[1]}return Math.abs(p)/2},s=r.map(i),l=Math.max(...s),c=(f,p)=>Math.abs(f[0])<=o&&Math.abs(p[0])<=o||Math.abs(f[0]-e)<=o&&Math.abs(p[0]-e)<=o,d=!1,u=r.filter((f,p)=>s[p]>=l||s[p]>=a?!0:f.some((h,g)=>c(h,f[(g+1)%f.length]))?(d=!0,!1):!0);return d?u.map(f=>f.map((p,m)=>(m?"L":"M")+p[0]+","+p[1]).join("")+"Z").join(""):t}function elt(t,e,n,r){if(t.projection!=="albers-usa"||!t.basemaps.subdivisions.includes("us-states")||!(n>0)||!(r>0))return!1;let o=t.regions.some(p=>p.iso==="US-AK")||t.pois.some(p=>Bk(p.lon,p.lat)),a=t.regions.some(p=>p.iso==="US-HI")||t.pois.some(p=>Fk(p.lon,p.lat));if(o||a)return!1;let{projection:i,fitTarget:s,usLayer:l}=wp(t,e);if(!l||![...l.keys()].some(p=>!Yk.has(p)))return!1;i.fitSize([1e3,1e3],s);let c=Ba(i).bounds(s),d=(c[1][0]-c[0][0])/(c[1][1]-c[0][1]);if(!(d>0))return!1;let u=n/r;return Math.max(u/d,d/u)>dst}function rlt(t,e){let n=jF.get(t);n||(n=new Map,jF.set(t,n));let r=n.get(e);if(!r&&(r=new Map,n.set(e,r),n.size>nlt)){let o=n.keys().next().value;o!==void 0&&n.delete(o)}return r}function zk(t,e,n,r){let{palette:o,isDark:a}=r,{width:i,height:s}=n,l=t;elt(l,e,i,s)&&(l={...l,projection:"conic-equal-area"});let{projection:c,fitTarget:d,fitIsGlobal:u,worldLayer:f,usLayer:p,usCrisp:m,worldTopo:h}=wp(l,e),g=p!==null,E=a?Gt(o.border,o.text,65):Gt(o.text,o.bg,78),y=l.regions.filter(mt=>mt.value!==void 0).map(mt=>mt.value),b=y.length>0?Math.min(...y):0,S=Math.max(...y),x=Dn(l.directives.regionMetricColor??"",o)??o.colors.red,L=l.directives.regionMetricLowColor?Dn(l.directives.regionMetricLowColor,o)??void 0:void 0,v=y.length>0,A=v?l.directives.regionMetric?.trim()||"Value":null,C=mt=>{let St=mt.trim().toLowerCase();if(St==="none")return null;if(St===A?.toLowerCase())return A;let Ft=l.tagGroups.find(Mt=>Mt.name.toLowerCase()===St);return Ft?Ft.name:mt},M=new Set;for(let mt of l.tagGroups){let St=mt.name.toLowerCase();(l.regions.some(Ft=>Ft.tags[St])||l.pois.some(Ft=>Ft.tags[St]))&&M.add(mt.name)}let w=l.tagGroups.find(mt=>M.has(mt.name))?.name??null,k=r.activeGroup,N;k!==void 0?N=k===null?null:C(k):l.directives.activeTag!==void 0?N=C(l.directives.activeTag):N=A??w??l.tagGroups[0]?.name??null;let _=A!==null&&N===A,T=_||N!==null&&M.has(N),R=Jst(o,a,T),G=Qst(o,a,T),I=Gt(E,G,45),H=Gt(o.colors.gray,o.bg,T?a?Dst:Pst:a?Ist:Rst),O=(mt,...St)=>{let Ft=Mt=>St.every(Jt=>wl(Mt,Jt)>=BF);if(Ft(mt))return mt;for(let Mt=10;Mt<=100;Mt+=10){let Jt=Gt(o.text,mt,Mt);if(Ft(Jt))return Jt}return o.text},D=O(o.textMuted,R,G),W=O(Gt(o.colors.blue,o.textMuted,50),G,R),z=l.regions.some(mt=>mt.color!==void 0),P=l.directives.noColorize!==!0&&!v&&!z&&M.size===0,B=new Map;if(P){let mt=new Map,St=re=>{for(let[pe,ce]of re){let Me=mt.get(pe);Me?Me.push(...ce):mt.set(pe,[...ce])}};if(St(kk(h)),p){St(kk(e.usStates));for(let[re,pe]of Object.entries(Zst)){let ce=mt.get(re);if(ce)for(let Me of pe){let Ge=mt.get(Me);Ge&&(ce.push(Me),Ge.push(re))}}}let{byIso:Ft,huesNeeded:Mt}=NF([...mt.keys()],mt),Jt=UM(o,Mt,a);for(let[re,pe]of Ft)B.set(re,Jt[pe])}let Y=mt=>Gt(mt,o.text,35),V=a?Gt(o.surface,o.text,28):o.bg,j=Gt(x,V,$k),K=mt=>{let St=S>b?(mt-b)/(S-b):1;if(L!==void 0)return em(L,x,St,{isDark:a});let Ft=$k+Math.max(0,Math.min(1,St))*(100-$k);return Gt(x,V,Ft)},$=(mt,St)=>{if(!St)return null;let Ft=l.tagGroups.find(re=>re.name.toLowerCase()===St.toLowerCase());if(!Ft)return null;let Mt=mt[qt(Ft.name)]??Ft.defaultValue;if(!Mt)return null;let Jt=Ft.entries.find(re=>re.value.toLowerCase()===Mt.toLowerCase());return Jt?.color?Gt(Jt.color,o.bg,a?YF:FF):null},U=mt=>{let St=mt?Dn(mt,o):null;return St?Gt(St,o.bg,a?YF:FF):null},X=mt=>{let St=U(mt.color);return St||(_?mt.value!==void 0?K(mt.value):R:P?(mt.iso&&B.get(mt.iso))??R:$(mt.tags,N)??R)},q=new Map(l.regions.map(mt=>[mt.iso,mt])),et=null;if(!l.directives.noLegend){let mt=l.tagGroups.map(St=>({name:St.name,entries:St.entries.map(Ft=>({value:Ft.value,color:Ft.color}))}));(mt.length>0||v)&&(et={tagGroups:mt,activeGroup:N,...v&&{ramp:{...l.directives.regionMetric!==void 0&&{metric:l.directives.regionMetric},min:b,max:S,low:L??j,high:x}}})}let tt=l.directives.noTitle?null:l.title,F=16,Q=Po;if(tt&&l.pois.length>0){let mt=(l.subtitle?50:30)+20/2;Q=Math.max(Po,mt+F)}let ot=kF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});ot>Q&&(Q=ot);let Z=[];if(tt){let mt=l.subtitle?2:1,St=Math.max(We(tt,20),l.subtitle?We(l.subtitle,20):0)+40;Z.push({x:i/2-St/2,y:10,w:St,h:20*(mt+.5)})}let lt=LF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});lt&&Z.push({x:lt.x,y:lt.y,w:lt.width,h:lt.height});let nt=r._calloutReserve,J=Po+(nt?.left??0),at=i-Po-(nt?.right??0),it=Q+(nt?.top??0),vt=s-Po-(nt?.bottom??0),Tt=[[J,it],[Math.max(J+1,at),Math.max(it+1,vt)]];if(c.fitExtent(Tt,d),!u&&l.projection!=="albers-usa"&&l.regions.length>0){let mt=1/0,St=-1/0;for(let Ft of l.regions){let Mt=Ft.iso?xp(e.worldCoarse,Ft.iso):null;if(Mt)for(let Jt of[Mt[0][0],Mt[1][0]])for(let re of[Mt[0][1],Mt[1][1]]){let pe=c([Jt,re]);pe&&Number.isFinite(pe[1])&&(pe[1]<mt&&(mt=pe[1]),pe[1]>St&&(St=pe[1]))}}if(mt<St){let Ft=it,Mt=vt,Jt=(Ft+Mt)/2-(mt+St)/2,re=Ft-mt,pe=Mt-St;re<=pe&&(Jt=Math.max(re,Math.min(pe,Jt)));let[ce,Me]=c.translate();c.translate([ce,Me+Jt])}}if(!u&&l.projection==="albers-usa"){let mt=Ba(c).bounds(d);if(Number.isFinite(mt[0][1])){let St=vt-it-(mt[1][1]-mt[0][1]);if(St>0){let Ft=mt[0][1]-it,Mt=St*.3-Ft,[Jt,re]=c.translate();c.translate([Jt,re+Mt])}}}let At,rt,pt=null;if(u&&!r.preferContain){let mt=Ba(c).bounds(d),St=mt[0][0],Ft=mt[0][1],Mt=mt[1][0]-St,Jt=mt[1][1]-Ft,re=l.title&&l.pois.length>0||ot>0?Q:0,pe=0,ce=re,Me=Mt>0?i/Mt:1,Ge=Jt>0?(s-re)/Jt:1;pt={sx:Me,sy:Ge,ox:pe,oy:ce,bx0:St,by0:Ft};let ct=(Yt,Et)=>[pe+(Yt-St)*Me,ce+(Et-Ft)*Ge],gt=c,wt=Qy({point(Yt,Et){let[Bt,Kt]=ct(Yt,Et);this.stream.point(Bt,Kt)}}),Ct=GF();At=Ba({stream:Yt=>gt.stream(wt.stream(Ct.stream(Yt)))}).digits(Gk),rt=(Yt,Et)=>{let Bt=gt([Yt,Et]);return Bt?ct(Bt[0],Bt[1]):null}}else{c.clipExtent([[0,0],[i,s]]);let mt=GF();At=Ba({stream:St=>c.stream(mt.stream(St))}).digits(Gk),rt=(St,Ft)=>c([St,Ft])??null}let ht=rlt(t,JSON.stringify([i,s,[[-100,40],[-120,37],[-80,40],[0,0],[60,30],[-60,-30],[150,60],[-150,-60],[100,-40],[-30,50]].map(([mt,St])=>rt(mt,St))])),dt=[],ut=[],yt=[],kt=l.regions.some(mt=>mt.iso==="US-AK")||l.pois.some(mt=>Bk(mt.lon,mt.lat)),Ot=l.regions.some(mt=>mt.iso==="US-HI")||l.pois.some(mt=>Fk(mt.lon,mt.lat));if(l.projection==="albers-usa"&&p&&(kt||Ot)){let Ft=s-Po,Mt=8,Jt=new Map,re=(gt,wt)=>{let Ct=c([gt,wt]);if(!Ct)return;let Yt=Math.floor(Ct[0]/Mt),Et=Jt.get(Yt);(Et===void 0||Ct[1]>Et)&&Jt.set(Yt,Ct[1])},pe=gt=>{if(Array.isArray(gt)&&typeof gt[0]=="number")re(gt[0],gt[1]);else if(Array.isArray(gt))for(let wt of gt)pe(wt)};for(let[gt,wt]of p)Yk.has(gt)||pe(wt.geometry.coordinates);let ce=gt=>{let wt=Math.floor(gt/Mt),Ct=-1/0;for(let Yt=wt-1;Yt<=wt+1;Yt++){let Et=Jt.get(Yt);Et!==void 0&&Et>Ct&&(Ct=Et)}return Ct},Me=(gt,wt)=>{let Yt=-1/0;for(let Et=0;Et<=24;Et++){let Bt=ce(gt+(wt-gt)*Et/24);Bt>Yt&&(Yt=Bt)}return Yt},Ge=(gt,wt,Ct,Yt)=>{let Et=p.get(gt);if(!Et)return Ct;let Bt=Ct,Kt=Math.min(Yt,i-Po-Bt-16);if(Kt<24)return Ct;let ue=Bt+Kt+16,_e=Me(Bt,ue),ke=_e>-1/0?_e+12:Ft-s*.42;wt.fitWidth(Kt,Et);let Re=Ba(wt).bounds(Et),an=(Number.isFinite(Re[0][0])?Re[1][1]-Re[0][1]:Kt)+16,Pe=ke,je=Math.min(Pe+an,Ft);je-Pe<an&&(Pe=je-an),wt.fitExtent([[Bt+8,Pe+8],[ue-8,je-8]],Et);let Ae=Ba(wt).digits(Gk),Ze=Ae(Et)??"";if(!Ze)return ue;let Oe;if(gt==="US-AK"){let Rr=f.get("CA"),Vo=Rr?Ae(Rr)??"":"";Vo&&(Oe={d:Vo,fill:P?B.get("CA")??H:H})}let qe=q.get(gt),De=P?B.get(gt)??R:R,xn=-1;qe?.layer==="us-state"&&(De=X(qe),xn=qe.lineNumber),dt.push({x:Bt,y:Pe,w:ue-Bt,h:je-Pe,points:[[Bt,Pe],[ue,Pe],[ue,je],[Bt,je]],projection:wt,...Oe&&{contextLand:Oe}}),ut.push({id:gt,d:Ze,fill:De,stroke:P?Y(De):E,lineNumber:xn,layer:"us-state",...qe?.value!==void 0&&{value:qe.value},...qe&&Object.keys(qe.tags).length>0&&{tags:qe.tags}});let Mn=Ba(wt).centroid(Et);if(Number.isFinite(Mn[0])){let Rr=Et.properties?.name??gt;yt.push({x:Mn[0],y:Mn[1],iso:gt,name:Rr,lineNumber:xn})}return ue},ct=Po;kt&&(ct=Ge("US-AK",Xst(),Po,i*.18)),Ot&&Ge("US-HI",jst(),kt?ct+24:Po,i*.12)}let Xt=l.projection==="albers-usa"&&!!p,bt=Xt?gs(d):l.extent,Nt=bt[1][0]-bt[0][0],Vt=bt[1][1]-bt[0][1],xt=Nt>=270||Vt>=130,Lt=(bt[0][0]+bt[1][0])/2,Dt=mt=>{let St=mt;for(;St<Lt-180;)St+=360;for(;St>Lt+180;)St-=360;return St},zt=mt=>{let St=1/0,Ft=-1/0,Mt=1/0,Jt=-1/0,re=[];for(let[Ct]of mt){let Yt=Dt(Ct);re.push(Yt),Yt<St&&(St=Yt),Yt>Ft&&(Ft=Yt),Ct<Mt&&(Mt=Ct),Ct>Jt&&(Jt=Ct)}re.sort((Ct,Yt)=>Ct-Yt);let pe=0;for(let Ct=1;Ct<re.length;Ct++)pe=Math.max(pe,re[Ct]-re[Ct-1]);re.length>1&&(pe=Math.max(pe,re[0]+360-re[re.length-1]));let ce=360-pe;if(ce>270||Jt-Mt>180&&ce<90)return!1;let Me=1/0,Ge=1/0,ct=-1/0,gt=-1/0,wt=!1;for(let[Ct,Yt]of mt){let Et=rt(Ct,Yt);!Et||!Number.isFinite(Et[0])||!Number.isFinite(Et[1])||(wt=!0,Et[0]<Me&&(Me=Et[0]),Et[0]>ct&&(ct=Et[0]),Et[1]<Ge&&(Ge=Et[1]),Et[1]>gt&&(gt=Et[1]))}return wt?!(ct<0||Me>i||gt<0||Ge>s):!1},$t=mt=>{if(xt)return mt;let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Ft=St.coordinates[0];return zt(Ft)?mt:null}if(St.type==="MultiPolygon"){let Ft=St.coordinates,Mt=Ft.filter(Jt=>zt(Jt[0]));return Mt.length?Mt.length===Ft.length?mt:{...mt,geometry:{...St,coordinates:Mt}}:null}return mt},ft=100,Wt=mt=>{let St=mt.map(([ce])=>ce).sort((ce,Me)=>ce-Me);if(St.length<2)return!1;let Ft=-1,Mt=0;for(let ce=1;ce<St.length;ce++){let Me=St[ce]-St[ce-1];Me>Ft&&(Ft=Me,Mt=ce)}if(St[0]+360-St[St.length-1]>=Ft)return!1;let re=360-Ft;return St[Mt-1]+360>180&&re<ft},he=mt=>{let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Ft=St.coordinates[0];return Wt(Ft)?null:mt}if(St.type==="MultiPolygon"){let Ft=St.coordinates,Mt=Ft.filter(Jt=>!Wt(Jt[0]));return Mt.length?Mt.length===Ft.length?mt:{...mt,geometry:{...St,coordinates:Mt}}:null}return mt},ne=[],se=(mt,St,Ft)=>{for(let[Mt,Jt]of mt){if(St==="us-state"&&g&&l.projection==="albers-usa"&&Kst.has(Mt)||St==="country"&&g&&Mt==="US"||St==="country"&&Mt==="AQ"&&!q.has("AQ"))continue;let re=q.get(Mt),pe=St+":"+Mt,ce=ht.get(pe);if(ce===void 0){let Kt=Ft?$t(Jt):he(Jt);if(!Kt){ht.set(pe,null);continue}let ue=At(Kt)??"",_e=u?tlt(ue,i,s):ue;if(!_e){ht.set(pe,null);continue}let ke=Hk[Mt],Re=ke?rt(ke[0],ke[1]):At.centroid(Kt),Xe=Re!=null&&Number.isFinite(Re[0])&&Number.isFinite(Re[1]);ce={d:_e,cx:Xe?Re[0]:void 0,cy:Xe?Re[1]:void 0},ht.set(pe,ce)}else if(ce===null)continue;let Me=ce.d,Ge=ce.cx!==void 0&&ce.cy!==void 0,ct=re?.layer===St,wt=St==="country"&&g&&Mt!=="US"?H:R,Ct=P?B.get(Mt)??wt:wt,Yt,Et=-1,Bt="base";ct?(Ct=X(re),Et=re.lineNumber,Bt=St,Yt=re.name):Yt=Jt.properties?.name,ne.push({id:Mt,d:Me,fill:Ct,stroke:P?Y(Ct):E,lineNumber:Et,layer:Bt,...Yt!==void 0&&{label:Yt},...Ge&&{labelX:ce.cx,labelY:ce.cy},...ct&&re.value!==void 0&&{value:re.value},...ct&&Object.keys(re.tags).length>0&&{tags:re.tags}})}};se(f,"country",!xt),p&&se(p,"us-state",!Xt&&!xt);let Zt=m&&e.naLakes?e.naLakes:e.lakes;if(Zt)for(let[,mt]of ru(Zt)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At(St)??"";Ft&&ne.push({id:"lake",d:Ft,fill:G,stroke:I,lineNumber:-1,layer:"base"})}let Ie=(mt,St,Ft)=>{let Mt=!1;for(let Jt of Ft)for(let re=0,pe=Jt.length-1;re<Jt.length;pe=re++){let[ce,Me]=Jt[re],[Ge,ct]=Jt[pe];Me>St!=ct>St&&mt<(Ge-ce)*(St-Me)/(ct-Me)+ce&&(Mt=!Mt)}return Mt},Ht=[...ne,...ut].map(mt=>{let St=Ep(mt.d),Ft=1/0,Mt=1/0,Jt=-1/0,re=-1/0;for(let pe of St)for(let ce of pe)ce[0]<Ft&&(Ft=ce[0]),ce[0]>Jt&&(Jt=ce[0]),ce[1]<Mt&&(Mt=ce[1]),ce[1]>re&&(re=ce[1]);return mt.bbox=[Ft,Mt,Jt,re],mt.rings=St,{fill:mt.fill,rings:St,minX:Ft,minY:Mt,maxX:Jt,maxY:re}}),Qt=(mt,St)=>{let Ft=G;for(let Mt of Ht)mt<Mt.minX||mt>Mt.maxX||St<Mt.minY||St>Mt.maxY||Ie(mt,St,Mt.rings)&&(Ft=Mt.fill);return Ft},Ut=mt=>{let St=wl(mt,o.textOnFillDark)>=wl(mt,o.textOnFillLight)?o.textOnFillDark:o.textOnFillLight,Ft=St===o.textOnFillLight?o.textOnFillDark:o.textOnFillLight;return{color:St,halo:wl(mt,St)<BF,haloColor:Ft}},fe=l.directives.noRelief!==!0,de=[],te=null;if(fe&&e.mountainRanges){for(let[,mt]of ru(e.mountainRanges)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At.area(St);if(!Number.isFinite(Ft)||Ft<Est)continue;let Mt=At.bounds(St);if(Mt[1][0]-Mt[0][0]<zF||Mt[1][1]-Mt[0][1]<zF)continue;let Jt=At(St)??"";Jt&&de.push({d:Jt})}if(de.length){let mt=a?o.bg:o.text,St=a?o.text:o.bg,Ft=P?a?o.surface:o.bg:R,Mt=Ns(Ft),Jt=Math.abs(Mt-Ns(mt))>.04?mt:St;te={color:Gt(Jt,Ft,kst),spacing:Sst,width:vst}}}let ae=null;if(l.directives.noCoastline!==!0){let mt=Math.min(i,s);ae={color:Gt(E,G,Ast),lines:Array.from({length:VF},(St,Ft)=>({d:(Lst+Ft*Nst)*mt,thickness:Mst*mt,opacity:UF+(Tst-UF)*Ft/(VF-1)})),minExtent:(xt?_st:Cst)*mt}}let Te=Gt(o.colors.blue,G,32),Je=[];if(e.rivers)for(let[,mt]of ru(e.rivers)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At(St)??"";Ft&&Je.push({d:Ft,color:Te,width:xst})}let sn=l.pois.map(mt=>Number(mt.meta.size)).filter(mt=>Number.isFinite(mt)&&mt>0),ze=sn.length?Math.min(...sn):0,Ce=sn.length?Math.max(...sn):0,ee=mt=>{let St=Number(mt.meta.size);if(!Number.isFinite(St)||St<=0||Ce<=0)return ust;let Ft=Ce>ze?(Math.sqrt(St)-Math.sqrt(ze))/(Math.sqrt(Ce)-Math.sqrt(ze)):1;return cb+Math.max(0,Math.min(1,Ft))*($F-cb)},oe=mt=>{let St=Math.max(0,Math.min(1,(mt-cb)/($F-cb)));return HF-St*(HF-fst)},Be=mt=>{let St=mt.color?Dn(mt.color,o):null;if(St)return{fill:St,stroke:Gt(St,o.text,18)};for(let Ft of l.tagGroups){let Mt=mt.tags[qt(Ft.name)];if(!Mt)continue;let re=Ft.entries.find(pe=>pe.value.toLowerCase()===Mt.toLowerCase())?.color;if(re)return{fill:re,stroke:Gt(re,o.text,18)}}return{fill:o.colors.orange,stroke:Gt(o.colors.orange,o.text,18)}},dn=mt=>{for(let St of l.tagGroups){let Ft=mt[qt(St.name)];if(!Ft)continue;let Mt=St.entries.find(Jt=>Jt.value.toLowerCase()===Ft.toLowerCase());if(Mt?.color)return Mt.color}return null},_n=new Map,He=new Set;for(let mt of l.routes)mt.stopIds.forEach((St,Ft)=>{Ft===0&&He.add(St),_n.has(St)||_n.set(St,Ft+1)});let Nn=new Map,jn=[],xo=[...l.pois].sort((mt,St)=>mt.lineNumber-St.lineNumber||(mt.id<St.id?-1:1)),Sr=[];for(let mt of xo){let St=rt(mt.lon,mt.lat);St&&Sr.push({p:mt,xy:St})}let An=(mt,St,Ft,Mt)=>{let{fill:Jt,stroke:re}=Be(mt.p),pe=ee(mt.p);Nn.set(mt.p.id,{cx:St,cy:Ft,r:pe});let ce=_n.get(mt.p.id);jn.push({id:mt.p.id,cx:St,cy:Ft,r:pe,fill:Jt,fillOpacity:oe(pe),stroke:re,lineNumber:mt.p.lineNumber,implicit:!!mt.p.implicit,isOrigin:He.has(mt.p.id),...ce!==void 0&&{routeNumber:ce},...Object.keys(mt.p.tags).length>0&&{tags:mt.p.tags},...Mt!==void 0&&{clusterId:Mt}})},In=[],Ar=new Set;for(let mt of l.edges)Ar.add(mt.fromId),Ar.add(mt.toId);for(let mt of l.routes)mt.stopIds.forEach(St=>Ar.add(St));let lr=mt=>ee(mt.p);for(let mt of Sr)Ar.has(mt.p.id)&&An(mt,mt.xy[0],mt.xy[1]);let Vr=[];for(let mt of Sr){if(Ar.has(mt.p.id))continue;let St=lr(mt),Ft=Vr.find(Mt=>Mt.some(Jt=>Math.hypot(Jt.xy[0]-mt.xy[0],Jt.xy[1]-mt.xy[1])<(St+lr(Jt))*$st));Ft?Ft.push(mt):Vr.push([mt])}for(let mt of Vr){if(mt.length===1){An(mt[0],mt[0].xy[0],mt[0].xy[1]);continue}let St=mt[0].p.id,Ft=mt.reduce((Et,Bt)=>Et+Bt.xy[0],0)/mt.length,Mt=mt.reduce((Et,Bt)=>Et+Bt.xy[1],0)/mt.length,Jt=Math.max(...mt.map(lr)),re=2*Jt+Wst,pe=Math.max(Ost,re/(2*Math.sin(Math.PI/Math.max(mt.length,2)))),ce=mt.map((Et,Bt)=>{if(mt.length<=Hst){let _e=-Math.PI/2+Bt*2*Math.PI/mt.length;return{e:Et,mx:Ft+Math.cos(_e)*pe,my:Mt+Math.sin(_e)*pe}}let Kt=Bt*Gst,ue=pe*Math.sqrt((Bt+1)/mt.length);return{e:Et,mx:Ft+Math.cos(Kt)*ue,my:Mt+Math.sin(Kt)*ue}}),Me=Ft-Jt,Ge=Ft+Jt,ct=Mt-Jt,gt=Mt+Jt;for(let{mx:Et,my:Bt,e:Kt}of ce){let ue=lr(Kt);Me=Math.min(Me,Et-ue),Ge=Math.max(Ge,Et+ue),ct=Math.min(ct,Bt-ue),gt=Math.max(gt,Bt+ue)}let wt=0,Ct=0;Me+wt<2&&(wt=2-Me),Ge+wt>i-2&&(wt=i-2-Ge),ct+Ct<2&&(Ct=2-ct),gt+Ct>s-2&&(Ct=s-2-gt);let Yt=[];for(let{e:Et,mx:Bt,my:Kt}of ce){let ue=Bt+wt,_e=Kt+Ct;An(Et,ue,_e,St),Yt.push({x2:ue,y2:_e,color:Be(Et.p).fill})}In.push({id:St,cx:Ft+wt,cy:Mt+Ct,count:mt.length,hitR:pe+Jt+6,legs:Yt})}let Zn=[],io=1.5,Oo=(mt,St,Ft,Mt,Jt,re,pe)=>{if(Jt!==0)return Jt;let ce=re*Fst;return pe&&Ft*(mt-pe.x)+Mt*(St-pe.y)<0?-ce:ce},lc=(mt,St,Ft,Mt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2,ce=St.cx-mt.cx,Me=St.cy-mt.cy,Ge=Math.hypot(ce,Me)||1,ct=Math.min(mt.r+io,Ge*.45),gt=Math.min(St.r+io,Ge*.45);if(!Ft&&Mt===0){let an=ce/Ge,Pe=Me/Ge,je=mt.cx+an*ct,Ae=mt.cy+Pe*ct,Ze=St.cx-an*gt,Oe=St.cy-Pe*gt;return`M${je},${Ae}L${Ze},${Oe}`}let wt=-Me/Ge,Ct=ce/Ge,Yt=Oo(re,pe,wt,Ct,Mt,Ge,Jt),Et=re+wt*Yt,Bt=pe+Ct*Yt,Kt=Math.hypot(Et-mt.cx,Bt-mt.cy)||1,ue=Math.hypot(St.cx-Et,St.cy-Bt)||1,_e=mt.cx+(Et-mt.cx)/Kt*ct,ke=mt.cy+(Bt-mt.cy)/Kt*ct,Re=St.cx-(St.cx-Et)/ue*gt,Xe=St.cy-(St.cy-Bt)/ue*gt;return`M${_e},${ke}Q${Et},${Bt} ${Re},${Xe}`},di=(mt,St,Ft,Mt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2;if(!Ft&&Mt===0)return{x:re,y:pe-4};let ce=St.cx-mt.cx,Me=St.cy-mt.cy,Ge=Math.hypot(ce,Me)||1,ct=-Me/Ge,gt=ce/Ge,wt=Oo(re,pe,ct,gt,Mt,Ge,Jt),Ct=wt*.5+Math.sign(wt||1)*8;return{x:re+ct*Ct,y:pe+gt*Ct}},ko=l.routes.flatMap(mt=>mt.legs).map(mt=>Number(mt.value)).filter(mt=>Number.isFinite(mt)&&mt>0),ma=ko.length?Math.min(...ko):0,ha=ko.length?Math.max(...ko):0,ui=mt=>{if(!Number.isFinite(mt)||mt<=0||ha<=0)return ac;let St=ha>ma?(mt-ma)/(ha-ma):1;return ac+St*(WF-ac)};for(let mt of l.routes){let St=mt.stopIds.map(Mt=>Nn.get(Mt)).filter(Mt=>!!Mt),Ft=St.length>=3?{x:St.reduce((Mt,Jt)=>Mt+Jt.cx,0)/St.length,y:St.reduce((Mt,Jt)=>Mt+Jt.cy,0)/St.length}:void 0;for(let Mt of mt.legs){let Jt=Nn.get(Mt.fromId),re=Nn.get(Mt.toId);if(!Jt||!re)continue;let pe=di(Jt,re,Mt.style==="arc",0,Ft),ce={curved:Mt.style==="arc",offset:0,center:Ft,labelX:pe.x,labelY:pe.y},Me=Mt.label!==void 0?Ut(Qt(ce.labelX,ce.labelY)):void 0,Ge=Number(Mt.value);Zn.push({d:lc(Jt,re,ce.curved,ce.offset,ce.center),width:ui(Ge),color:dn(Mt.tags)??Gt(o.text,o.bg,72),arrow:!0,fromId:Mt.fromId,toId:Mt.toId,...Number.isFinite(Ge)&&Ge>0&&{value:Ge},...Object.keys(Mt.tags).length>0&&{tags:Mt.tags},lineNumber:Mt.lineNumber,...Mt.label!==void 0&&{label:Mt.label,labelX:ce.labelX,labelY:ce.labelY,labelColor:Me.color,labelHalo:Me.halo,labelHaloColor:Me.haloColor}})}}let ga=l.edges.map(mt=>Number(mt.meta.width)).filter(mt=>Number.isFinite(mt)&&mt>0),fi=ga.length?Math.min(...ga):0,pi=ga.length?Math.max(...ga):0,ml=mt=>{let St=Number(mt.meta.width);if(!Number.isFinite(St)||St<=0||pi<=0)return ac;let Ft=pi>fi?(St-fi)/(pi-fi):1;return ac+Ft*(WF-ac)},Va=new Map;for(let mt of l.edges){let St=[mt.fromId,mt.toId].sort().join(" "),Ft=Va.get(St);Ft?Ft.push(mt):Va.set(St,[mt])}for(let mt of Va.values()){let St=[...mt].sort((Mt,Jt)=>Mt.lineNumber-Jt.lineNumber),Ft=St.length;St.forEach((Mt,Jt)=>{let re=Nn.get(Mt.fromId),pe=Nn.get(Mt.toId);if(!re||!pe)return;let ce=Ft>1?(Jt-(Ft-1)/2)*Bst:0,Me=Mt.style==="arc"||Ft>1,Ge=di(re,pe,Me,ce),ct={curved:Me,offset:ce,labelX:Ge.x,labelY:Ge.y},gt=Mt.label!==void 0?Ut(Qt(ct.labelX,ct.labelY)):void 0,wt=Number(Mt.meta.width);Zn.push({d:lc(re,pe,ct.curved,ct.offset),width:ml(Mt),color:dn(Mt.tags)??Gt(o.text,o.bg,66),arrow:Mt.directed,fromId:Mt.fromId,toId:Mt.toId,...Number.isFinite(wt)&&wt>0&&{value:wt},...Object.keys(Mt.tags).length>0&&{tags:Mt.tags},lineNumber:Mt.lineNumber,...Mt.label!==void 0&&{label:Mt.label,labelX:ct.labelX,labelY:ct.labelY,labelColor:gt.color,labelHalo:gt.halo,labelHaloColor:gt.haloColor}})})}let vr=[],ya=[...Z],ws=[],Vi=jn.map(mt=>({cx:mt.cx,cy:mt.cy,r:mt.r})),du=[];for(let mt of Zn){let St=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(mt.d);if(!St)continue;let Ft=+St[1],Mt=+St[2];if(St[3]!==void 0)du.push([Ft,Mt,+St[3],+St[4]]);else{let Jt=+St[5],re=+St[6],pe=+St[7],ce=+St[8],Me=8,Ge=Ft,ct=Mt;for(let gt=1;gt<=Me;gt++){let wt=gt/Me,Ct=1-wt,Yt=Ct*Ct*Ft+2*Ct*wt*Jt+wt*wt*pe,Et=Ct*Ct*Mt+2*Ct*wt*re+wt*wt*ce;du.push([Ge,ct,Yt,Et]),Ge=Yt,ct=Et}}}let Ui=mt=>Vi.some(St=>Uu(mt,St))||ya.some(St=>Sa(mt,St))||du.some(St=>N0(St[0],St[1],St[2],St[3],mt)),mi=l.directives.noRegionLabels!==!0,hi=new Set,to=l.directives.noRegionValue!==!0&&_,uu=mt=>to&&mt!==void 0?$m(mt):void 0,cc=i<wst,Xi=l.projection==="mercator"&&l.basemaps.subdivisions.includes("us-states")&&_,fu=6,dc=3,gr=1,ba=(mt,St=br)=>We(mt,St)+2*fu,Go=br+2*dc,Es=(mt,St,Ft=br)=>Math.max(ba(mt,Ft),St?We(St,Math.round(Ft*.82))+2*fu:0),pu=(mt,St=br)=>{let Ft=St+2*dc;return mt?Ft+gr+Math.round(St*.82):Ft},Op=22,uc=.06,fc=.32,mu=18,Vb=13,hu=15,Ub=Math.sqrt(Math.max(1,i*s)),Xb=(mt,St)=>{let Ft=Math.sqrt(Math.max(0,mt*St))/Ub;return Math.min(1,Math.max(0,(Ft-uc)/(fc-uc)))},gu=(mt,St,Ft,Mt,Jt,re,pe=br,ce)=>{let{color:Me,haloColor:Ge}=Ut(Mt),ct=ce??Me,gt=Math.round(pe*.82),wt=Math.max(We(Ft,pe),re?We(re,gt):0)/2,Ct=[St-pe*.55,St-pe*.1].some(Yt=>Qt(mt-wt,Yt)!==Mt||Qt(mt+wt,Yt)!==Mt);vr.push({x:mt,y:St,text:Ft,anchor:"middle",color:ct,halo:ce?!1:Ct,haloColor:Ge,...pe!==br&&{fontSize:pe},...re!==void 0&&{valueLine:re},lineNumber:Jt})},Ss=2,ta=(mt,St,Ft,Mt,Jt=br)=>{let re=Math.round(Jt*.82),pe=Math.max(We(Ft,Jt),Mt?We(Mt,re):0)+2*Ss,ce=Mt?Jt+gr+re:Jt;return{x:mt-pe/2,y:St-ce/2,w:pe,h:ce}};if(mi){let mt=new Set(l.poiFrameContainers),St=ne.map(Et=>{let Bt=mt.has(Et.id);if(Et.layer==="base"&&!Bt||Et.label===void 0)return null;let Kt=Et.layer==="us-state"||Et.id.startsWith("US-"),ue=Kt?p?.get(Et.id):f.get(Et.id);if(!ue)return null;let[[_e,ke],[Re,Xe]]=At.bounds(ue),an=Re-_e,Pe=Xe-ke,je=Kt&&!Xi?Et.id.replace(/^US-/,""):void 0,Ae=je!==void 0?cc?[je,Et.label]:Bt?[Et.label]:[Et.label,je]:[Et.label],Ze=Kt?void 0:Hk[Et.id],Oe=Ze?rt(Ze[0],Ze[1]):At.centroid(ue);return!Oe||!Number.isFinite(Oe[0])?null:{r:Et,c:Oe,boxW:an,boxH:Pe,area:an*Pe,candidates:Ae}}).filter(Et=>Et!==null).sort((Et,Bt)=>Bt.area-Et.area||Et.r.lineNumber-Bt.r.lineNumber),Ft=[...Z],Mt=[],Jt=Et=>Et===G||Et===R||Et===H,re=14,pe=jn.map(Et=>({x:Et.cx-Et.r-re,y:Et.cy-Et.r-re,w:2*(Et.r+re),h:2*(Et.r+re)})),ce=Math.max(46,Math.min(i,s)*.11),Me=4,Ge=9,ct=6,gt=ce*3,wt=ct,Ct=(Et,Bt,Kt,ue)=>{let _e=Math.atan2(ue,Kt),ke=gt;for(let Re=-2;Re<=2;Re++){let Xe=_e+Re*Math.PI/4,an=Math.cos(Xe),Pe=Math.sin(Xe),je=ct;for(;je<=gt;je+=ct){let Ae=Et+an*je,Ze=Bt+Pe*je;if(Ae<Po||Ze<Q||Ae>i-Po||Ze>s-Po||Qt(Ae,Ze)!==G)break}je<ke&&(ke=je)}return ke},Yt=(Et,Bt,Kt,ue,_e,ke=br,Re=Ge,Xe=ce)=>{let an=Es(ue,_e,ke),Pe=pu(_e!==void 0,ke),je=Math.SQRT1_2,Ae=[[0,-1],[0,1],[1,0],[-1,0],[je,-je],[je,je],[-je,-je],[-je,je]],Ze=null;for(let[Oe,qe]of Ae){let De=Et,xn=Bt,Mn=0,Rr=Math.ceil(Xe/Me)+1;for(;Mn<Rr&&Qt(De,xn)===Kt;)De+=Oe*Me,xn+=qe*Me,Mn++;if(Qt(De,xn)===Kt)continue;let Vo=(Math.abs(Oe)*an+Math.abs(qe)*Pe)/2,so=De+Oe*(Re+Vo),xa=xn+qe*(Re+Vo),kr={x:so-an/2,y:xa-Pe/2,w:an,h:Pe};if(kr.x<Po||kr.y<Q||kr.x+kr.w>i-Po||kr.y+kr.h>s-Po)continue;let gl=[kr.x+2,so,kr.x+kr.w-2],WL=[kr.y+2,xa,kr.y+kr.h-2],jt=!0;for(let pn of gl)for(let un of WL)if(!Jt(Qt(pn,un))){jt=!1;break}if(!jt||Ft.some(pn=>Sa(kr,pn))||pe.some(pn=>Sa(kr,pn))||Vi.some(pn=>Uu(kr,pn)))continue;let ge=so-Oe*(an/2),Le=xa-qe*(Pe/2),xe=Math.hypot(ge-Et,Le-Bt);if(xe>Xe||Mt.some(pn=>S_(Et,Bt,ge,Le,pn[0],pn[1],pn[2],pn[3]))||Ft.some(pn=>N0(Et,Bt,ge,Le,pn)))continue;let nn=Ct(so,xa,Oe,qe);(Ze===null||nn>Ze.clear+wt||nn>=Ze.clear-wt&&xe<Ze.len)&&(Ze={x:so,y:xa,rect:kr,leader:[Et,Bt,ge,Le],len:xe,clear:nn})}return Ze?{x:Ze.x,y:Ze.y,rect:Ze.rect,leader:Ze.leader}:null};for(let{r:Et,c:Bt,boxW:Kt,boxH:ue,candidates:_e}of St){let ke=uu(Et.value),Re=De=>!Ft.some(xn=>Sa(De,xn)),Xe=De=>!pe.some(xn=>Sa(De,xn)),an=q.has(Et.id),Pe=(De,xn,Mn)=>{let Rr=We(Mn,br)/2;return Qt(De-Rr,xn)===Et.fill&&Qt(De+Rr,xn)===Et.fill};if(an&&ke===void 0&&Et.label!==void 0){let De=_e[0],xn=-1;for(let Mn=mu;Mn>=br;Mn--){if(We(De,Mn)>Kt||Mn+2*dc>ue)continue;let Rr=ta(Bt[0],Bt[1],De,void 0,Mn);if(!Re(Rr)||!Xe(Rr)||Ui(Rr))continue;let Vo=We(De,Mn)/2;if(!(Qt(Bt[0]-Vo,Bt[1])!==Et.fill||Qt(Bt[0]+Vo,Bt[1])!==Et.fill)){xn=Mn;break}}if(xn>=Vb){let Mn=ta(Bt[0],Bt[1],De,void 0,xn);Ft.push(Mn),gu(Bt[0],Bt[1],De,Et.fill,Et.lineNumber,void 0,xn),hi.add(Et.id),ws.push({label:vr[vr.length-1],rect:Mn})}else{let Mn=Yt(Bt[0],Bt[1],Et.fill,Et.label,void 0,hu,Ge+hu,ce*2.2);if(Mn){Ft.push(Mn.rect),Mt.push(Mn.leader);let Rr=Gt(Et.fill,o.text,60);vr.push({x:Mn.x,y:Mn.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,fontSize:hu,leader:{x1:Mn.leader[0],y1:Mn.leader[1],x2:Mn.leader[2],y2:Mn.leader[3]},leaderColor:Rr,calloutDot:{x:Bt[0],y:Bt[1],color:Rr},lineNumber:Et.lineNumber}),hi.add(Et.id)}}continue}let je=[{x:Bt[0],y:Bt[1],guard:!1}];ke&&je.push({x:Bt[0],y:Bt[1]+ue*.26,guard:!0},{x:Bt[0],y:Bt[1]-ue*.26,guard:!0},{x:Bt[0]+Kt*.26,y:Bt[1],guard:!0},{x:Bt[0]-Kt*.26,y:Bt[1],guard:!0},{x:Bt[0]+Kt*.22,y:Bt[1]+ue*.22,guard:!0},{x:Bt[0]-Kt*.22,y:Bt[1]+ue*.22,guard:!0},{x:Bt[0]+Kt*.22,y:Bt[1]-ue*.22,guard:!0},{x:Bt[0]-Kt*.22,y:Bt[1]-ue*.22,guard:!0});let Ae;for(let De of je)if(!(De.guard&&Qt(De.x,De.y)!==Et.fill)){for(let xn of _e){let Mn=ta(De.x,De.y,xn);if(ke&&Es(xn,ke)<=Kt&&pu(!0)<=ue){let Rr=ta(De.x,De.y,xn,ke);if(Re(Rr)&&Xe(Mn)&&Pe(De.x,De.y,xn)){Ae={text:xn,valueLine:ke,ax:De.x,ay:De.y};break}}if(ba(xn)<=Kt&&Go<=ue&&Re(Mn)&&Xe(Mn)&&(ke===void 0||Pe(De.x,De.y,xn))){Ae={text:xn,ax:De.x,ay:De.y};break}}if(Ae)break}if(Ae===void 0&&Et.label!==void 0&&an){let De=Yt(Bt[0],Bt[1],Et.fill,Et.label,ke);if(De){Ft.push(De.rect),Mt.push(De.leader);let xn=Gt(Et.fill,o.text,60);vr.push({x:De.x,y:De.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,...ke!==void 0&&{valueLine:ke},leader:{x1:De.leader[0],y1:De.leader[1],x2:De.leader[2],y2:De.leader[3]},leaderColor:xn,calloutDot:{x:Bt[0],y:Bt[1],color:xn},lineNumber:Et.lineNumber}),hi.add(Et.id)}continue}if(Ae===void 0)continue;let Ze=Et.value===void 0&&Et.layer==="base",Oe=br;if(Ze){let De=Xb(Kt,ue),xn=Math.round(br+De*(Op-br)),Mn=Ae.valueLine!==void 0,Rr=so=>{let xa=We(Ae.text,so)/2;return[Ae.ax-xa,Ae.ax+xa].every(kr=>{let gl=Qt(kr,Ae.ay);return gl===Et.fill||Jt(gl)})},Vo=-1;for(let so=xn;so>=br;so--){if(Es(Ae.text,Ae.valueLine,so)>Kt||pu(Mn,so)>ue)continue;let xa=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,so),kr=ta(Ae.ax,Ae.ay,Ae.text,void 0,so);if(!(!Re(xa)||!Xe(kr)||Ui(kr))&&Rr(so)){Vo=so;break}}if(Vo<0){if(!mt.has(Et.id))continue;Oe=br}else Oe=Vo}let qe=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,Oe);Ft.push(qe),gu(Ae.ax,Ae.ay,Ae.text,Et.fill,Et.lineNumber,Ae.valueLine,Oe,Ze?D:void 0),hi.add(Et.id),ws.push({label:vr[vr.length-1],rect:qe})}for(let Et of yt){let Bt=cc?Et.iso.replace(/^US-/,""):Et.name,Kt=q.get(Et.iso),ue=uu(Kt?.value);gu(Et.x,Et.y,Bt,Kt?X(Kt):R,Et.lineNumber,ue),hi.add(Et.iso),ws.push({label:vr[vr.length-1],rect:ta(Et.x,Et.y,Bt,ue)})}}if(l.directives.noPoiLabels!==!0){let mt=[...jn].filter(jt=>jt.clusterId===void 0).sort((jt,ge)=>jt.lineNumber-ge.lineNumber||(jt.id<ge.id?-1:1)),St=new Map(l.pois.map(jt=>[jt.id,jt])),Ft=jt=>{let ge=St.get(jt.id);return ge?.label??ge?.name??jt.id},Mt=br*1.25,Jt=jt=>{let ge=Ft(jt);return{text:ge,w:We(ge,br)}},re=3,pe=Math.max(20,Math.round(Math.min(i,s)*.03)),ce=new Map;for(let jt of jn){if(jt.clusterId===void 0)continue;let ge=ce.get(jt.clusterId);ge?ge.push(jt):ce.set(jt.clusterId,[jt])}let Me=(jt,ge,Le)=>{switch(Le){case"right":return{x:jt.cx+jt.r+re,y:jt.cy-Mt/2,w:ge,h:Mt};case"left":return{x:jt.cx-jt.r-re-ge,y:jt.cy-Mt/2,w:ge,h:Mt};case"above":return{x:jt.cx-ge/2,y:jt.cy-jt.r-re-Mt,w:ge,h:Mt};case"below":return{x:jt.cx-ge/2,y:jt.cy+jt.r+re,w:ge,h:Mt};case"below-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy+xe,w:ge,h:Mt}}case"below-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-ge,y:jt.cy+xe,w:ge,h:Mt}}case"above-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy-xe-Mt,w:ge,h:Mt}}case"above-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-ge,y:jt.cy-xe-Mt,w:ge,h:Mt}}}},Ge=(jt,ge,Le,xe,nn)=>{let rn=Me(jt,Le,xe);ya.push(rn);let pn=xe==="right"||xe==="below-right"||xe==="above-right",un=xe==="left"||xe==="below-left"||xe==="above-left",cn=pn?"start":un?"end":"middle",Pn=pn?rn.x:un?rn.x+Le:jt.cx;vr.push({x:Pn,y:rn.y+Mt/2+br/3,text:ge,anchor:cn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,lineNumber:jt.lineNumber,...nn!==void 0&&{clusterMember:nn}})},ct=(jt,ge,Le)=>{let xe=Me(jt,ge,Le);return xe.x>=0&&xe.x+xe.w<=i&&xe.y>=0&&xe.y+xe.h<=s&&!Ui(xe)},gt=30,wt=[];for(let jt of mt){let ge=wt.find(Le=>Le.some(xe=>Math.hypot(xe.cx-jt.cx,xe.cy-jt.cy)<gt));ge?ge.push(jt):wt.push([jt])}let Yt=Mt+3,Et=16,Bt=jt=>jt.map(ge=>({p:ge,...Jt(ge)})).sort((ge,Le)=>ge.p.cy-Le.p.cy||(ge.text<Le.text?-1:1)),Kt=(jt,ge)=>{let Le=Math.min(...jt.map(Pn=>Pn.p.cx-Pn.p.r)),xe=Math.max(...jt.map(Pn=>Pn.p.cx+Pn.p.r)),nn=Math.max(...jt.map(Pn=>Pn.w)),rn=(Math.min(...jt.map(Pn=>Pn.p.cy))+Math.max(...jt.map(Pn=>Pn.p.cy)))/2,pn=ge==="right"?Math.min(xe+Et,i-pe-nn):Math.max(Le-Et,pe+nn),un=jt.length*Yt,cn=rn-un/2;return cn=Math.max(pe,Math.min(cn,s-un-pe)),jt.map((Pn,$o)=>{let Uo=cn+$o*Yt+Yt/2;return{o:Pn,colX:pn,rowCy:Uo,rect:{x:ge==="right"?pn:pn-Pn.w,y:Uo-Mt/2,w:Pn.w,h:Mt}}})},ue=(jt,ge)=>Kt(jt,ge).every(({rect:Le})=>Le.x>=0&&Le.x+Le.w<=i&&Le.y>=0&&Le.y+Le.h<=s&&!Ui(Le)),_e=1e3,ke=jt=>{let ge=[jt.x+jt.w*.15,jt.x+jt.w*.5,jt.x+jt.w*.85],Le=[jt.y+jt.h*.25,jt.y+jt.h*.75],xe=0;for(let pn of ge)for(let un of Le)Qt(pn,un)===G&&xe++;let nn=xe/(ge.length*Le.length),rn=Math.max(0,Math.min(jt.x,i-(jt.x+jt.w),jt.y,s-(jt.y+jt.h)));return _e*nn+rn*.1},Re=(jt,ge)=>{let Le=Kt(jt,ge);return Le.length===0?-1/0:Le.reduce((xe,{rect:nn})=>xe+ke(nn),0)/Le.length},Xe=jt=>Re(jt,"right")>=Re(jt,"left")?"right":"left",an=(jt,ge,Le)=>{for(let{o:xe,colX:nn,rowCy:rn,rect:pn}of Kt(jt,ge))ya.push(pn),vr.push({x:nn,y:rn+br/3,text:xe.text,anchor:ge==="right"?"start":"end",color:o.text,halo:!1,haloColor:o.bg,leader:{x1:xe.p.cx,y1:xe.p.cy,x2:ge==="right"?nn-2:nn+2,y2:rn},leaderColor:xe.p.fill,poiId:xe.p.id,lineNumber:xe.p.lineNumber,...Le!==void 0&&{clusterMember:Le}})},Pe=jt=>{let{text:ge,w:Le}=Jt(jt),xe=jt.cx+jt.r+re,nn="start";xe+Le>i&&(xe=jt.cx-jt.r-re-Le,nn="end");let rn=Math.max(0,Math.min(jt.cy-Mt/2,s-Mt));vr.push({x:nn==="start"?xe:xe+Le,y:rn+Mt/2+br/3,text:ge,anchor:nn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,hidden:!0,lineNumber:jt.lineNumber})},je=4,Ae=(jt,ge,Le)=>{let xe=jt.cx-ge,nn=jt.cy-Le;return Math.abs(nn)>=Math.abs(xe)?nn<=0?"above":"below":xe<0?"left":"right"},Ze=(jt,ge)=>{let Le=In.find(rn=>rn.id===ge);if(!Le||jt.length>je)return!1;let xe=[],nn=[];for(let{p:rn,text:pn,w:un}of jt){let cn=Ae(rn,Le.cx,Le.cy),$o=[cn,...["above","below","right","left"].filter(Uo=>Uo!==cn)].find(Uo=>{let Gr=Me(rn,un,Uo);return Gr.x>=0&&Gr.x+Gr.w<=i&&Gr.y>=0&&Gr.y+Gr.h<=s&&!Ui(Gr)&&!xe.some(pc=>Sa(pc,Gr))});if($o===void 0)return!1;xe.push(Me(rn,un,$o)),nn.push({p:rn,text:pn,w:un,side:$o})}for(let{p:rn,text:pn,w:un,side:cn}of nn)Ge(rn,pn,un,cn,ge);return!0};for(let[jt,ge]of ce){if(ge.length===0)continue;let Le=Bt(ge);if(Ze(Le,jt))continue;let xe=ue(Le,"right"),nn=ue(Le,"left"),rn=xe&&nn?Xe(Le):xe?"right":nn?"left":Xe(Le);an(Le,rn,jt)}let Oe=48,qe=8,De=.25,xn=(jt,ge,Le,xe,nn,rn)=>{let pn=nn-Le,un=rn-xe,cn=pn*pn+un*un,Pn=cn>0?((jt-Le)*pn+(ge-xe)*un)/cn:0;return Pn=Math.max(0,Math.min(1,Pn)),Math.hypot(jt-(Le+Pn*pn),ge-(xe+Pn*un))},Mn=(jt,ge)=>{let Le=jt.x+jt.w/2,xe=jt.y+jt.h/2,nn=Oe;for(let rn of jn)rn.id!==ge&&(nn=Math.min(nn,Math.hypot(rn.cx-Le,rn.cy-xe)-rn.r));for(let rn of du)nn=Math.min(nn,xn(Le,xe,rn[0],rn[1],rn[2],rn[3]));return Math.max(0,nn)},Rr={right:160,left:160,above:100,below:100,"below-right":0,"below-left":0,"above-right":0,"above-left":0},Vo=Object.keys(Rr),so=(jt,ge,Le)=>{let xe=Me(jt,ge,Le);return qe*Mn(xe,jt.id)+De*ke(xe)+Rr[Le]},xa=pst*Math.min(i,s),kr=[];for(let jt of wt){let ge=Bt(jt);if(jt.length===1){let{p:un,text:cn,w:Pn}=ge[0],$o=Vo.filter(Gr=>ct(un,Pn,Gr)).map(Gr=>({s:Gr,v:so(un,Pn,Gr)}));if($o.length===0){an(ge,Xe(ge));continue}let Uo=$o.reduce((Gr,pc)=>pc.v>Gr.v?pc:Gr).s;Ge(un,cn,Pn,Uo);continue}let Le=Math.min(...ge.map(un=>un.p.cx-un.p.r)),xe=Math.max(...ge.map(un=>un.p.cx+un.p.r)),nn=Math.min(...ge.map(un=>un.p.cy)),rn=Math.max(...ge.map(un=>un.p.cy));Math.hypot(xe-Le,rn-nn)>xa||ge.length>mst?ge.forEach(un=>Pe(un.p)):kr.push(ge)}for(let jt of kr){let ge=["right","left"].filter(xe=>ue(jt,xe)),Le=ge.length>1?Xe(jt):ge[0];Le?an(jt,Le):jt.forEach(xe=>Pe(xe.p))}let gl=r._poiClearancePass??0;if(gl<4&&jn.length>0){let jt=pe,ge=Math.floor(i*.3),Le=Math.floor(s*.3),xe=new Map(jn.map(cn=>[cn.id,cn])),nn=0,rn=0,pn=0,un=0;for(let cn of jn)nn=Math.max(nn,jt-(cn.cx-cn.r)),rn=Math.max(rn,cn.cx+cn.r+jt-i),pn=Math.max(pn,jt-(cn.cy-cn.r)),un=Math.max(un,cn.cy+cn.r+jt-s);for(let cn of vr){if(cn.poiId===void 0)continue;let Pn=xe.get(cn.poiId);if(!Pn)continue;if(cn.hidden||cn.leader){let E5=cn.hidden?Jt(Pn).w:We(cn.text,br),BL=Pn.r+Et+E5+jt;Pn.cx>=i/2?rn=Math.max(rn,Pn.cx+BL-i):nn=Math.max(nn,BL-Pn.cx);continue}let $o=We(cn.text,br),Uo=cn.anchor==="start"?cn.x:cn.anchor==="end"?cn.x-$o:cn.x-$o/2,Gr=cn.y-br/3-Mt/2,pc=Uo+$o,w5=Gr+Mt;nn=Math.max(nn,jt-Uo),rn=Math.max(rn,pc+jt-i),pn=Math.max(pn,jt-Gr),un=Math.max(un,w5+jt-s)}if(nn=Math.min(Math.max(0,Math.ceil(nn)),ge),rn=Math.min(Math.max(0,Math.ceil(rn)),ge),pn=Math.min(Math.max(0,Math.ceil(pn)),Le),un=Math.min(Math.max(0,Math.ceil(un)),Le),nn>=1||rn>=1||pn>=1||un>=1){let cn=r._calloutReserve,Pn=Math.min((cn?.left??0)+nn,ge),$o=Math.min((cn?.right??0)+rn,ge),Uo=Math.min((cn?.top??0)+pn,Le),Gr=Math.min((cn?.bottom??0)+un,Le);return zk(l,e,n,{...r,_poiClearancePass:gl+1,_calloutReserve:{...Pn>0&&{left:Pn},...$o>0&&{right:$o},...Uo>0&&{top:Uo},...Gr>0&&{bottom:Gr}}})}}}if(ws.length>0){let St=vr.filter(Ft=>Ft.poiId!==void 0&&Ft.hidden!==!0).map(Ft=>{let Mt=We(Ft.text,br);return{x:(Ft.anchor==="start"?Ft.x:Ft.anchor==="end"?Ft.x-Mt:Ft.x-Mt/2)-2,y:Ft.y-br,w:Mt+4,h:br*1.4+4}});for(let Ft of ws)if(St.some(Mt=>Sa(Mt,Ft.rect))){let Mt=vr.indexOf(Ft.label);Mt>=0&&vr.splice(Mt,1)}}if(Zn.some(mt=>mt.label!==void 0)){let mt=vr.filter(Mt=>!Mt.hidden).map(Mt=>{let Jt=ba(Mt.text);return{x:Mt.anchor==="start"?Mt.x:Mt.anchor==="end"?Mt.x-Jt:Mt.x-Jt/2,y:Mt.y-Go/2,w:Jt,h:Go}}),St=[],Ft=[.5,.42,.58,.34,.66,.28,.72];for(let Mt=0;Mt<Zn.length;Mt++){let Jt=Zn[Mt];if(Jt.label===void 0)continue;let re=Nn.get(Jt.fromId),pe=Nn.get(Jt.toId);if(!re||!pe)continue;let ce=ba(Jt.label),Me=pe.cx-re.cx,Ge=pe.cy-re.cy,ct=Math.hypot(Me,Ge)||1,gt=-Ge/ct,wt=Me/ct,Ct=Go+2,Yt=Jt.width??ac,Et=Yt/2+Go/2+3,Bt=Yt>=4?[Et,-Et,Et+Ct,-(Et+Ct),0]:[0,Ct,-Ct,2*Ct,-2*Ct],Kt=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(Jt.d),ue=Ae=>{if(Kt?.[5]!==void 0){let Ze=1-Ae;return[Ze*Ze*+Kt[1]+2*Ze*Ae*+Kt[5]+Ae*Ae*+Kt[7],Ze*Ze*+Kt[2]+2*Ze*Ae*+Kt[6]+Ae*Ae*+Kt[8]]}return Kt?.[3]!==void 0?[+Kt[1]+(+Kt[3]-+Kt[1])*Ae,+Kt[2]+(+Kt[4]-+Kt[2])*Ae]:[re.cx+Me*Ae,re.cy+Ge*Ae]},_e=[];for(let Ae of Bt)for(let Ze of Ft){let[Oe,qe]=ue(Ze);_e.push([Oe+gt*Ae,qe+wt*Ae-4])}let ke=([Ae,Ze])=>{let Oe={x:Ae-ce/2,y:Ze-Go/2,w:ce,h:Go};return!(Oe.x<0||Oe.x+ce>i||Oe.y<0||Oe.y+Oe.h>s||Vi.some(qe=>Uu(Oe,qe))||mt.some(qe=>Sa(qe,Oe))||St.some(qe=>Sa(qe,Oe)))},Re=ue(.5),[Xe,an]=_e.find(ke)??[Re[0],Re[1]-4],Pe=Ut(Qt(Xe,an));Zn[Mt]={...Jt,labelX:Xe,labelY:an,labelColor:Pe.color,labelHalo:Pe.halo,labelHaloColor:Pe.haloColor};let je={x:Xe-ce/2,y:an-Go/2,w:ce,h:Go};St.push(je),ya.push(je)}}if(l.directives.noContextLabels!==!0){for(let ct of vr){if(ct.hidden)continue;let gt=ba(ct.text),wt=ct.anchor==="start"?ct.x:ct.anchor==="end"?ct.x-gt:ct.x-gt/2;ya.push({x:wt,y:ct.y-Go/2,w:gt,h:Go})}for(let ct of dt)ya.push({x:ct.x,y:ct.y,w:ct.w,h:ct.h});let mt=[],St=[];for(let ct of f.values()){let gt=typeof ct.id=="string"?ct.id:String(ct.id??"");if(!gt||q.has(gt)||hi.has(gt)||g&&gt==="US")continue;let wt=!1;for(let ke of q.keys())if(ke.startsWith(gt+"-")){wt=!0;break}if(wt)continue;let Ct=At.bounds(ct),[Yt,Et]=Ct[0],[Bt,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Bt))continue;let ue=Hk[gt],_e=ue?rt(ue[0],ue[1]):At.centroid(ct);St.push({f:ct,iso:gt,name:ct.properties?.name??gt,bbox:[Yt,Et,Bt,Kt],anchor:_e&&Number.isFinite(_e[0])?[_e[0],_e[1]]:null,curatedLngLat:ue??null,area:(Bt-Yt)*(Kt-Et)})}let Ft=Dk(Math.max(Nt,Vt)),Mt=Ok(i,s,Ft),Jt=Ft!=="world",re=Mt+IF,pe=St.map((ct,gt)=>({idx:gt,area:ct.area})).filter(ct=>Number.isFinite(ct.area)&&ct.area>0).sort((ct,gt)=>gt.area-ct.area).slice(0,re),ce=new Set(pe.map(ct=>ct.idx));for(let ct=0;ct<St.length;ct++){let gt=St[ct],wt=gt.anchor,Ct;if(ce.has(ct)&&wt){let Yt=gs(gt.f),Et=Vst({geometry:gt.f.geometry,bounds:Yt,project:rt,width:i,height:s,curated:gt.curatedLngLat});Et.length&&(Ct=Et.map(Bt=>Bt.screen),wt=Ct[0])}mt.push({name:gt.name,bbox:gt.bbox,anchor:wt,curatedAnchor:!!gt.curatedLngLat,bordering:Jt,...Ct?{positions:Ct}:{}})}let Me=(l.poiFrameContainers??[]).some(ct=>ct.startsWith("US-"));if(p&&Me)for(let[ct,gt]of p){if(q.has(ct)||hi.has(ct))continue;let wt=$t(gt);if(!wt)continue;let Ct=At.bounds(wt),[Yt,Et]=Ct[0],[Bt,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Bt))continue;let ue=At.centroid(wt);mt.push({name:gt.properties?.name??ct,bbox:[Yt,Et,Bt,Kt],anchor:ue&&Number.isFinite(ue[0])?[ue[0],ue[1]]:null})}let Ge=PF({projection:l.projection,dLonSpan:Nt,dLatSpan:Vt,width:i,height:s,waterBodies:e.waterBodies,countries:mt,palette:o,countryTone:D,waterTone:W,project:rt,collides:Ui,overLand:(ct,gt)=>Qt(ct,gt)!==G});vr.push(...Ge)}let hl=[];if(l.directives.noCities!==!0){let ce=Math.log10(5e4),Me=Math.log10(15e6)-ce,Ge=wt=>wt>5e4?.7+Math.min(1,(Math.log10(wt)-ce)/Me)*(2.6-.7):.7,ct=jn.map(wt=>({x:wt.cx,y:wt.cy})),gt=[...e.gazetteer.cities].sort((wt,Ct)=>Ct[3]-wt[3]);for(let wt of gt){if(hl.length>=220)break;let Ct=wt[0],Yt=wt[1],Et=rt(Yt,Ct);if(!Et)continue;let[Bt,Kt]=Et;if(Bt<0||Bt>i||Kt<0||Kt>s)continue;let ue=!1;for(let _e of ct){let ke=_e.x-Bt,Re=_e.y-Kt;if(ke*ke+Re*Re<144){ue=!0;break}}ue||(ct.push({x:Bt,y:Kt}),hl.push({cx:Bt,cy:Kt,r:Ge(wt[3])}))}}return{width:i,height:s,background:G,title:tt,...l.subtitle!==void 0&&{subtitle:l.subtitle},...l.caption!==void 0&&{caption:l.caption},regions:ne,rivers:Je,relief:de,reliefHatch:te,coastlineStyle:ae,legs:Zn,pois:jn,cityDots:hl,clusters:In,labels:vr,legend:et,insets:dt,insetRegions:ut,projection:c,stretch:pt,diagnostics:[]}}var Po,Gk,OF,dst,$k,ust,cb,$F,HF,fst,ac,WF,br,Hk,pst,mst,BF,hst,gst,FF,YF,yst,bst,xst,wst,Est,zF,Sst,vst,kst,VF,Lst,Nst,Mst,UF,Tst,Cst,_st,Ast,Rst,Ist,Pst,Dst,Ost,Gst,$st,Hst,Wst,Bst,Fst,XF,Ust,Xst,jst,Kst,Bk,Fk,Zst,Yk,jF,nlt,Vk=st(()=>{"use strict";Ke();ab();Pv();tn();Nk();MF();xr();M0();Mr();b0();Ak();DF();Po=24,Gk=1,OF=.6,dst=1.25;$k=15,ust=6,cb=4,$F=22,HF=.92,fst=.55,ac=1.25,WF=8,br=11,Hk={US:[-98.5,39.5],RU:[45,58]},pst=.18,mst=7,BF=4.5,hst=12,gst=24,FF=60,YF=68,yst=24,bst=24,xst=1.3,wst=480,Est=12,zF=2,Sst=1.5,vst=.2,kst=26,VF=5,Lst=.0016,Nst=.0028,Mst=.0014,UF=.5,Tst=.1,Cst=6e-4,_st=6e-4,Ast=32,Rst=30,Ist=62,Pst=28,Dst=16,Ost=9,Gst=2.399963229728653,$st=1,Hst=8,Wst=4,Bst=16,Fst=.18;XF=new WeakMap;Ust=()=>up().parallels([29.5,45.5]).rotate([96,0]),Xst=()=>up().rotate([154,0]).center([-2,58.5]).parallels([55,65]),jst=()=>eb();Kst=new Set(["US-AK","US-HI"]),Bk=(t,e)=>e>=51&&(t<=-129||t>=172),Fk=(t,e)=>e>=18&&e<=23&&t>=-161&&t<=-154,Zst={CA:["US-AK","US-WA","US-ID","US-MT","US-ND","US-MN","US-MI","US-NY","US-VT","US-NH","US-ME"],MX:["US-CA","US-AZ","US-NM","US-TX"]},Yk=new Set(["US-AK","US-HI","US-AS","US-GU","US-MP","US-PR","US-VI"]);jF=new WeakMap,nlt=8});var t3={};ye(t3,{renderMap:()=>JF,renderMapForExport:()=>slt});function olt(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let[i,s]=n[o],[l,c]=n[a];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function qF(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e+"Z"}function KF(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e}function alt(t,e){if(!e)return[qF(t)];let n=t.length,r=.75,o=p=>Math.abs(p)<=r,a=p=>Math.abs(p-e.w)<=r,i=p=>Math.abs(p)<=r,s=p=>Math.abs(p-e.h)<=r,l=(p,m)=>o(p[0])&&o(m[0])||a(p[0])&&a(m[0])||i(p[1])&&i(m[1])||s(p[1])&&s(m[1]),c=-1;for(let p=0;p<n;p++)if(l(t[p],t[(p+1)%n])){c=p;break}if(c===-1)return[qF(t)];let d=[],u=[],f=(c+1)%n;for(let p=0;p<n;p++){let m=(f+p)%n,h=t[m],g=t[(m+1)%n];if(l(h,g)){u.length>=2&&d.push(KF(u)),u=[];continue}u.length===0&&u.push(h),u.push(g)}return u.length>=2&&d.push(KF(u)),d}function ZF(t,e,n){let r=[];for(let o of t){let a=o.rings??Ep(o.d);for(let i=0;i<a.length;i++){let s=a[i];if(s.length<3)continue;let l=1/0,c=1/0,d=-1/0,u=-1/0;for(let[h,g]of s)h<l&&(l=h),h>d&&(d=h),g<c&&(c=g),g>u&&(u=g);if(Math.max(d-l,u-c)<e)continue;let[f,p]=s[0],m=0;for(let h=0;h<a.length;h++)h!==i&&olt(f,p,a[h])&&m++;m%2!==1&&r.push(...alt(s,n))}}return r}function QF(t,e,n,r,o,a){let i=r.join(" ");if(!i)return;e.append("path").attr("id",n).attr("d",i).attr("fill","none");let s=`#${n}`,l=[...o.lines].sort((c,d)=>d.d-c.d);for(let c of l)t.append("use").attr("href",s).attr("stroke",o.color).attr("stroke-width",2*(c.d+c.thickness)).attr("stroke-opacity",c.opacity).attr("stroke-linejoin","round").attr("stroke-linecap","round"),t.append("use").attr("href",s).attr("stroke",a).attr("stroke-width",2*c.d).attr("stroke-linejoin","round").attr("stroke-linecap","round")}function JF(t,e,n,r,o,a,i,s){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let l=i?.width??t.clientWidth,c=i?.height??t.clientHeight;if(l<=0||c<=0)return;let d=zk(e,n,{width:l,height:c},{palette:r,isDark:o,preferContain:i?.preferContain??!1,legendMode:i?"export":"preview",...s!==void 0&&{activeGroup:s}}),u=Rt(t).append("svg").attr("width",l).attr("height",c).attr("viewBox",`0 0 ${l} ${c}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It).style("background",d.background);u.append("rect").attr("width",l).attr("height",c).attr("fill",d.background);let f=u.append("defs"),p=ilt++,m=w=>`${w}__m${p}`,h=w=>Math.min(15,7+w*.95),g=r.bg,E=u.append("g").attr("class","dgmo-map-regions"),y=(w,k,N)=>{let _=w.append("path").attr("d",k.d).attr("fill",k.fill).attr("stroke",k.stroke).attr("stroke-width",N);if(k.label&&_.attr("data-region-name",k.label),k.id&&k.id!=="lake"&&_.attr("data-iso",k.id),k.labelX!==void 0&&k.labelY!==void 0&&_.attr("data-label-x",k.labelX).attr("data-label-y",k.labelY),k.layer!=="base"&&(_.classed("dgmo-map-region",!0).attr("data-region",k.id),k.value!==void 0&&_.attr("data-value",k.value),k.tags))for(let[T,R]of Object.entries(k.tags))_.attr(`data-tag-${T.toLowerCase()}`,R.toLowerCase());k.lineNumber>=0&&(_.attr("data-line-number",k.lineNumber),a&&_.style("cursor","pointer").on("click",()=>a(k.lineNumber)))};for(let w of d.regions)y(E,w,.5);if(d.relief.length&&d.reliefHatch){let w=d.reliefHatch,k=m("dgmo-relief-clip"),N=m("dgmo-relief-land"),_=f.append("clipPath").attr("id",k);for(let G of d.relief)_.append("path").attr("d",G.d);let T=f.append("clipPath").attr("id",N);for(let G of d.regions)G.id!=="lake"&&T.append("path").attr("d",G.d);let R=u.append("g").attr("clip-path",`url(#${N})`).style("pointer-events","none").append("g").attr("class","dgmo-map-relief").attr("clip-path",`url(#${k})`).attr("stroke",w.color).attr("stroke-width",w.width).attr("vector-effect","non-scaling-stroke");for(let G=w.spacing;G<c;G+=w.spacing)R.append("line").attr("x1",0).attr("y1",G).attr("x2",l).attr("y2",G)}if(d.coastlineStyle){let w=d.coastlineStyle,k=m("dgmo-map-water-mask"),N=f.append("mask").attr("id",k).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c);N.append("rect").attr("x",0).attr("y",0).attr("width",l).attr("height",c).attr("fill","white");let _=d.regions.filter(I=>I.id!=="lake").map(I=>I.d).join(" "),T=d.regions.filter(I=>I.id==="lake").map(I=>I.d).join(" ");if(_&&N.append("path").attr("d",_).attr("fill","black"),T&&N.append("path").attr("d",T).attr("fill","white"),d.insets.length){let I=Math.max(0,...w.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";N.append("path").attr("d",O).attr("fill","black").attr("stroke","black").attr("stroke-width",2*I).attr("stroke-linejoin","round")}}let R=u.append("g").attr("class","dgmo-map-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${k})`);QF(R,f,m("dgmo-map-coast"),ZF(d.regions,w.minExtent,{w:l,h:c}),w,d.background);let G=new Map;for(let I of d.regions){let H=G.get(I.stroke);H?H.push(I.d):G.set(I.stroke,[I.d])}for(let[I,H]of G)R.append("path").attr("d",H.join(" ")).attr("stroke",I).attr("stroke-width",.5).attr("stroke-linejoin","round")}if(d.rivers.length){let w=u.append("g").attr("class","dgmo-map-rivers").attr("fill","none").style("pointer-events","none");for(let k of d.rivers)w.append("path").attr("d",k.d).attr("stroke",k.color).attr("stroke-width",k.width).attr("stroke-linecap","round").attr("stroke-linejoin","round")}if(d.cityDots.length){let w=u.append("g").attr("class","dgmo-map-cities").attr("fill",r.textMuted).attr("fill-opacity",.28).style("pointer-events","none");for(let k of d.cityDots)w.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",k.r)}let b=!i&&!e.directives.noClusterPois,S=d.labels.filter(w=>w.poiId!==void 0&&!w.hidden);if(S.length){let w=m("dgmo-map-label-patch-blur");f.append("filter").attr("id",w).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%").append("feGaussianBlur").attr("in","SourceGraphic").attr("stdDeviation",2.5);let k=8,N=(_,T,R)=>{if(!_.length)return;let I=f.append("mask").attr("id",T).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c).append("g").attr("filter",`url(#${w})`),H=[];for(let D of _){let W=D.lines&&D.lines.length>1,z=W?Math.max(...D.lines.map(K=>_t(K,Fa))):_t(D.text,Fa),P=W?D.lines.length*(Fa+2):Fa,B=D.anchor==="start"?D.x+z/2:D.anchor==="end"?D.x-z/2:D.x,Y=D.y-Fa*.3,V=z+8,j=P+6;I.append("rect").attr("x",B-V/2).attr("y",Y-j/2).attr("width",V).attr("height",j).attr("rx",j/2).attr("fill","white"),H.push({x0:B-V/2-k,y0:Y-j/2-k,x1:B+V/2+k,y1:Y+j/2+k})}let O=u.append("g").attr("class","dgmo-map-label-patch").attr("mask",`url(#${T})`).style("pointer-events","none");R!==void 0&&O.attr("data-cluster-deco",R);for(let D of d.regions){let W,z,P,B;if(D.bbox)[W,z,P,B]=D.bbox;else{W=1/0,z=1/0,P=-1/0,B=-1/0;for(let V of Ep(D.d))for(let[j,K]of V)j<W&&(W=j),j>P&&(P=j),K<z&&(z=K),K>B&&(B=K)}H.some(V=>W<=V.x1&&P>=V.x0&&z<=V.y1&&B>=V.y0)&&O.append("path").attr("d",D.d).attr("fill",D.fill)}};if(b){N(S.filter(R=>R.clusterMember===void 0),m("dgmo-map-label-patch"));let _=new Map;for(let R of S){if(R.clusterMember===void 0)continue;let G=_.get(R.clusterMember);G?G.push(R):_.set(R.clusterMember,[R])}let T=0;for(let[R,G]of _)N(G,m(`dgmo-map-label-patch-c${T++}`),R)}else N(S,m("dgmo-map-label-patch"))}if(d.insets.length){let w=u.append("g").attr("class","dgmo-map-insets");d.insets.forEach((k,N)=>{let _=k.points.map((T,R)=>`${R?"L":"M"}${T[0]},${T[1]}`).join("")+"Z";if(w.append("path").attr("d",_).attr("fill",d.background).attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round"),k.contextLand){let T=m(`dgmo-map-inset-clip-${N}`);f.append("clipPath").attr("id",T).append("path").attr("d",_),w.append("path").attr("d",k.contextLand.d).attr("fill",k.contextLand.fill).attr("clip-path",`url(#${T})`)}});for(let k of d.insetRegions)y(w,k,.5);if(d.coastlineStyle){let k=d.coastlineStyle,N=m("dgmo-map-inset-water-mask"),_=f.append("mask").attr("id",N).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c),T=Math.max(0,...k.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";_.append("path").attr("d",O).attr("fill","white").attr("stroke","black").attr("stroke-width",2*T).attr("stroke-linejoin","round")}d.insets.forEach((H,O)=>{H.contextLand&&_.append("path").attr("d",H.contextLand.d).attr("fill","black").attr("clip-path",`url(#${m(`dgmo-map-inset-clip-${O}`)})`)});for(let H of d.insetRegions)H.id!=="lake"&&_.append("path").attr("d",H.d).attr("fill","black");for(let H of d.insetRegions)H.id==="lake"&&_.append("path").attr("d",H.d).attr("fill","white");let R=m("dgmo-map-inset-water-clip"),G=f.append("clipPath").attr("id",R);for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";G.append("path").attr("d",O)}let I=w.append("g").attr("clip-path",`url(#${R})`).append("g").attr("class","dgmo-map-inset-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${N})`);QF(I,f,m("dgmo-map-inset-coast"),ZF(d.insetRegions,k.minExtent),k,d.background);for(let H of d.insetRegions)I.append("path").attr("d",H.d).attr("stroke",H.stroke).attr("stroke-width",.5).attr("stroke-linejoin","round")}for(let k of d.insets){let N=k.points.map((_,T)=>`${T?"L":"M"}${_[0]},${_[1]}`).join("")+"Z";w.append("path").attr("d",N).attr("fill","none").attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round").style("pointer-events","none")}}let x=(w,k)=>{k<1||(w.attr("data-line-number",k),a&&w.style("cursor","pointer").on("click",()=>a(k)))},L=u.append("g").attr("class","dgmo-map-legs").attr("fill","none"),v=w=>{let k=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(w);if(!k)return null;let N=+k[1],_=+k[2],T,R,G,I;k[3]!==void 0?(T=+k[3],R=+k[4],G=N,I=_):(T=+k[7],R=+k[8],G=+k[5],I=+k[6]);let H=T-G,O=R-I,D=Math.hypot(H,O);return D>0?{ex:T,ey:R,tx:H/D,ty:O/D}:null};d.legs.forEach(w=>{let k=w.arrow?v(w.d):null,N=w.d,_=null;if(k){let R=h(w.width),G=Math.max(R*.5,w.width*.6+1),I=k.ex-k.tx*R,H=k.ey-k.ty*R,O=-k.ty,D=k.tx;_=`M${I+O*G},${H+D*G}L${k.ex},${k.ey}L${I-O*G},${H-D*G}z`,N=w.d.replace(/(-?[\d.]+),(-?[\d.]+)$/,`${I.toFixed(2)},${H.toFixed(2)}`)}let T=L.append("path").attr("d",N).attr("stroke",w.color).attr("stroke-width",w.width).attr("stroke-linecap","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[R,G]of Object.entries(w.tags))T.attr(`data-tag-${R.toLowerCase()}`,G.toLowerCase());if(x(T,w.lineNumber),w.value!==void 0&&(T.attr("data-value",w.value),T.append("title").text(w.label!==void 0?`${w.label}: ${w.value}`:`${w.value}`)),_){let R=L.append("path").attr("d",_).attr("fill",w.color).attr("stroke",w.color).attr("stroke-width",1).attr("stroke-linejoin","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[G,I]of Object.entries(w.tags))R.attr(`data-tag-${G.toLowerCase()}`,I.toLowerCase())}if(w.label!==void 0&&w.labelX!==void 0){let R=Sp(L,w.labelX,w.labelY??0,w.label,"middle",w.labelColor??r.textMuted,w.labelHaloColor??g,w.labelHalo??!0,Fa-1);x(R,w.lineNumber)}});let A=u.append("g").attr("class","dgmo-map-spider");for(let w of d.clusters){b&&A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.hitR).attr("fill","transparent").attr("data-cluster-hit",w.id).style("cursor","pointer");for(let k of w.legs)A.append("line").attr("x1",w.cx).attr("y1",w.cy).attr("x2",k.x2).attr("y2",k.y2).attr("stroke",k.color).attr("stroke-width",1).attr("data-cluster-deco",w.id).style("pointer-events","none");A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",2).attr("fill",Gt(r.textMuted,r.bg,40)).attr("data-cluster-deco",w.id).style("pointer-events","none")}let C=u.append("g").attr("class","dgmo-map-pois");for(let w of d.pois){w.isOrigin&&C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r+3).attr("fill","none").attr("stroke",w.stroke).attr("stroke-width",1.5);let k=C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r).attr("fill",w.fill).attr("fill-opacity",w.fillOpacity).attr("stroke",w.stroke).attr("stroke-width",1).attr("data-line-number",w.lineNumber).attr("data-poi",w.id);if(w.clusterId!==void 0&&k.attr("data-cluster-member",w.clusterId),w.tags)for(let[N,_]of Object.entries(w.tags))k.attr(`data-tag-${N.toLowerCase()}`,_.toLowerCase());a&&k.style("cursor","pointer").on("click",()=>a(w.lineNumber)),w.routeNumber!==void 0&&Sp(C,w.cx,w.cy+3,String(w.routeNumber),"middle",r.bg,w.fill,!1,Fa-2)}let M=u.append("g").attr("class","dgmo-map-labels");for(let w of d.labels){if(w.hidden){if(i)continue;Sp(M,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing).attr("data-poi",w.poiId??null).attr("data-poi-hidden","").style("opacity",0).style("pointer-events","none");continue}if(w.leader){let N=M.append("line").attr("x1",w.leader.x1).attr("y1",w.leader.y1).attr("x2",w.leader.x2).attr("y2",w.leader.y2).attr("stroke",w.leaderColor??Gt(r.textMuted,r.bg,60)).attr("stroke-width",w.leaderColor?1:.75);w.poiId!==void 0&&N.attr("data-poi",w.poiId),w.clusterMember!==void 0&&N.attr("data-cluster-member",w.clusterMember),x(N,w.lineNumber)}w.calloutDot&&M.append("circle").attr("cx",w.calloutDot.x).attr("cy",w.calloutDot.y).attr("r",2.5).attr("fill",w.calloutDot.color).attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",.75);let k=Sp(M,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing,w.lines,w.valueLine);w.poiId!==void 0&&k.attr("data-poi",w.poiId).style("cursor","default"),w.clusterMember!==void 0&&k.attr("data-cluster-member",w.clusterMember),x(k,w.lineNumber)}if(b&&d.clusters.length){let w=u.append("g").attr("class","dgmo-map-cluster-badges");for(let k of d.clusters){let N=w.append("g").attr("data-cluster",k.id).style("opacity",0).style("pointer-events","none"),_=9;N.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",_).attr("fill",Gt(r.textMuted,r.bg,35)).attr("stroke",r.textMuted).attr("stroke-width",1),N.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",_+2.5).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1);let T=_+2.5;for(let R of k.legs){let G=Math.atan2(R.y2-k.cy,R.x2-k.cx);N.append("circle").attr("class","dgmo-map-cluster-bead").attr("cx",k.cx+T*Math.cos(G)).attr("cy",k.cy+T*Math.sin(G)).attr("r",1.8).attr("fill",R.color).attr("stroke",r.bg).attr("stroke-width",.5)}Sp(N,k.cx,k.cy+3,String(k.count),"middle",r.text,r.bg,!1,Fa)}}if(d.legend){let w=(d.title?50:0)+(d.subtitle?20:0)+8,k=u.append("g").attr("class","dgmo-map-legend").attr("transform",`translate(0, ${w})`),N=sb(d.legend);if(N.length>0){let _=lb(N,i?"export":"preview");fn(k,{..._,palette:r,isDark:o,width:l,activeGroup:d.legend.activeGroup})}}d.title&&u.append("text").attr("class","dgmo-map-title").attr("x",l/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.title),d.subtitle&&u.append("text").attr("class","dgmo-map-subtitle").attr("x",l/2).attr("y",50).attr("text-anchor","middle").attr("font-size",Fa+1).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.subtitle),d.caption&&u.append("text").attr("x",l/2).attr("y",c-8).attr("text-anchor","middle").attr("font-size",Fa).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.caption)}function slt(t,e,n,r,o,a){JF(t,e,n,r,o,void 0,a)}function Sp(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=t.append("text").attr("x",e).attr("y",n).attr("text-anchor",o).attr("font-size",l).attr("fill",a);if(u&&u.length>1){let m=l+2,h=-((u.length-1)/2)*m;u.forEach((g,E)=>{p.append("tspan").attr("x",e).attr("dy",E===0?h:m).text(g)})}else if(f!==void 0){let m=Math.round(l*.82);p.append("tspan").attr("x",e).attr("dy",-l*.28).text(r),p.append("tspan").attr("x",e).attr("dy",l*.92).attr("font-size",m).attr("fill-opacity",.72).text(f)}else p.text(r);return c&&p.attr("font-style","italic"),d&&p.attr("letter-spacing",d),s&&p.attr("paint-order","stroke fill").attr("stroke",i).attr("stroke-width",2).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-opacity",.55),p}var Fa,ilt,e3=st(()=>{"use strict";Xn();on();tn();en();Br();Ak();Vk();Fa=11;ilt=0});var a3={};ye(a3,{mapContentAspect:()=>o3,mapExportDimensions:()=>mlt});function o3(t,e,n=plt){let{projection:r,fitTarget:o}=wp(t,e);r.fitSize([n,n],o);let a=Ba(r).bounds(o),i=a[1][0]-a[0][0],s=a[1][1]-a[0][1],l=i/s;return Number.isFinite(l)&&l>0?l:flt}function mlt(t,e,n=1200,r){let o=r!==void 0&&Number.isFinite(r)&&r>0,a=o?r:o3(t,e),s=!o&&wp(t,e).fitIsGlobal?a/ult:a,l=o?a:Math.max(dlt,Math.min(clt,s)),c=n,d=Math.round(c/l),u=0;if(t.title&&t.pois.length>0){let m=(t.subtitle?50:30)+20/2;u+=Math.max(n3,m+llt)-n3}let f=!1;return d-u<r3&&(d=Math.round(u+r3),f=!0),{width:c,height:d,preferContain:o?f:l!==s||f}}var n3,llt,clt,dlt,ult,r3,flt,plt,i3=st(()=>{"use strict";ab();Vk();n3=24,llt=16,clt=3,dlt=.9,ult=1.12,r3=200,flt=1.5,plt=1e3});var Xk={};ye(Xk,{loadMapData:()=>xlt});async function hlt(){let[{readFile:t},{fileURLToPath:e},{dirname:n,resolve:r}]=await Promise.all([import("fs/promises"),import("url"),import("path")]);return{readFile:t,fileURLToPath:e,dirname:n,resolve:r}}async function ci(t,e,n){return JSON.parse(await t.readFile(t.resolve(e,n),"utf8"))}async function glt(t,e){for(let n of s3){let r=t.resolve(e,n);try{return await t.readFile(t.resolve(r,Ya.gazetteer),"utf8"),r}catch{}}throw new Error(`map data assets not found near ${e} (looked in ${s3.join(", ")}). Run \`pnpm build:map-data\` and \`pnpm build\`.`)}function ylt(t){let e=n=>!!n&&n.type==="Topology"&&!!n.objects;if(!e(t.worldCoarse)||!e(t.worldDetail)||!e(t.usStates)||!t.gazetteer||!Array.isArray(t.gazetteer.cities)||!t.gazetteer.byName)throw new Error("map data assets are malformed (failed shape validation)");return t}function blt(t){try{let e=wlt.url;if(e)return t.dirname(t.fileURLToPath(e))}catch{}return typeof __dirname<"u"?__dirname:process.cwd()}function xlt(){return Uk??=(async()=>{let t=await hlt(),e=await glt(t,blt(t)),[n,r,o,a,i,s,l,c,d,u,f]=await Promise.all([ci(t,e,Ya.worldCoarse),ci(t,e,Ya.worldDetail),ci(t,e,Ya.usStates),ci(t,e,Ya.lakes).catch(()=>{}),ci(t,e,Ya.rivers).catch(()=>{}),ci(t,e,Ya.mountainRanges).catch(()=>{}),ci(t,e,Ya.naLand).catch(()=>{}),ci(t,e,Ya.naLakes).catch(()=>{}),ci(t,e,Ya.waterBodies).catch(()=>{}),ci(t,e,Ya.airports).catch(()=>{}),ci(t,e,Ya.gazetteer)]);return ylt({worldCoarse:n,worldDetail:r,usStates:o,gazetteer:f,...a&&{lakes:a},...i&&{rivers:i},...s&&{mountainRanges:s},...l&&{naLand:l},...c&&{naLakes:c},...d&&{waterBodies:d},...u&&{airports:u}})})().catch(t=>{throw Uk=void 0,t}),Uk}var wlt,Ya,s3,Uk,jk=st(()=>{"use strict";wlt={};Ya={worldCoarse:"world-coarse.json",worldDetail:"world-detail.json",usStates:"us-states.json",lakes:"lakes.json",rivers:"rivers.json",mountainRanges:"mountain-ranges.json",naLand:"na-land.json",naLakes:"na-lakes.json",waterBodies:"water-bodies.json",airports:"airports.json",gazetteer:"gazetteer.json"},s3=["./data","./map-data","../map-data","../src/map/data"]});var h3={};ye(h3,{renderPyramid:()=>m3,renderPyramidForExport:()=>_lt});function m3(t,e,n,r,o,a){if(e.layers.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Elt),p=c.aesthetic(qk),m=e.layers.some(T=>T.description.length>0),h=!!e.title&&e.options["no-title"]!=="on",g=h?f:0,E=g+p,y=s-p,b=Math.max(60,y-E),S=i*Slt,x=i-S*2,L=e.layers.length,v=d3({width:i,usableWidth:x,sideMargin:S,bodyTop:E,bodyHeight:b,layers:e.layers,hasDescription:m,alternate:!1}),C=v.wraps.some(T=>T.overflows)&&m&&L>=2,M=C?d3({width:i,usableWidth:x,sideMargin:S,bodyTop:E,bodyHeight:b,layers:e.layers,hasDescription:!0,alternate:!0}):v,w=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c.isBelowFloor&&w.attr("width","100%"),w.append("style").text(".pyramid-desc-full{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-short{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-full{display:inline}.dgmo-pyramid-hidden{display:none}"),w.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),h){let T=w.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&T.on("click",()=>o(e.titleLineNumber))}let k=ir(n),N=(T,R)=>{if(T.color){let G=Dn(T.color,n);if(G)return G}return k[R%k.length]},_=w.append("g").attr("class","pyramid-body");for(let T=0;T<L;T++){let R=e.layers[T],G=M.pyramidTop+T*M.layerH,I=G+M.layerH,H=u3(T,L,M.baseWidth,e.inverted),O=u3(T+1,L,M.baseWidth,e.inverted),D=[[M.pyramidCx-H,G],[M.pyramidCx+H,G],[M.pyramidCx+O,I],[M.pyramidCx-O,I]].map($=>`${$[0]},${$[1]}`).join(" "),W=N(R,T),z=ie(n,W,r,{solid:e.options["solid-fill"]==="on"}),P=_.append("g").attr("class","pyramid-layer").attr("data-line-number",R.lineNumber);if(o){let $=R.lineNumber;P.style("cursor","pointer").on("click",()=>o($))}P.append("polygon").attr("points",D).attr("fill",z).attr("stroke",W).attr("stroke-width",2);let B=(G+I)/2,Y=ve(z,n.textOnFillLight,n.textOnFillDark),V=Math.min(H,O)*2>_t(R.label,M.labelFont),j=Y===n.textOnFillLight?n.textOnFillDark:n.textOnFillLight,K=P.append("text").attr("x",M.pyramidCx).attr("y",B).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",Y).attr("font-family",It).attr("font-size",M.labelFont).attr("font-weight",600);if(V||K.attr("paint-order","stroke fill").attr("stroke",j).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.6),gn(K,R.label,n),R.description.length>0){let $=C?T%2===0?"right":"left":"right",U=M.wraps[T];Alt(_,R,$,U,M,B,W,n,g+qk,s-qk,o)}}}function _lt(t,e,n,r,o){m3(t,e,n,r,void 0,o)}function d3(t){let{width:e,usableWidth:n,sideMargin:r,bodyTop:o,bodyHeight:a,layers:i,hasDescription:s,alternate:l}=t,c=i.length,u=n*(s?l?Llt:klt:vlt),f=a/l3,p=Math.min(u,f),m=p*l3,h;s?l?h=e/2:h=r+u/2:h=e/2;let g=o+(a-m)/2,E=m/c,y=f3(Math.round(E*.38),Nlt,Mlt),b=f3(Math.round(E*.22),Tlt,Clt),S=Math.round(b*1.35),x=h+p/2,L=h-p/2,v=x+c3,A=v+db+ub,C=Math.max(80,e-r-A),M=L-c3-db,w=Math.max(80,M-ub-r),k=r,N=i.map((_,T)=>{if(_.description.length===0)return{allLines:[],overflows:!1,shortLineCount:0};let G=(l?T%2===0?"right":"left":"right")==="right"?C:w,I=Plt(_.description,G,b),H=Math.max(1,Math.floor(E/S)-0),O=I.length>H,D=O?H:I.length;return{allLines:I,overflows:O,shortLineCount:D}});return{alternate:l,baseWidth:p,pyramidCx:h,pyramidTop:g,pyramidH:m,layerH:E,labelFont:y,descFont:b,descLineHeight:S,rightTextX:A,rightTextWidth:C,leftTextX:k,leftTextWidth:w,rightAccentX:v,leftAccentX:M,wraps:N}}function u3(t,e,n,r){return(!r?t/e:(e-t)/e)*n/2}function Alt(t,e,n,r,o,a,i,s,l,c,d){let{descFont:u,descLineHeight:f}=o,p=n==="right"?o.rightAccentX:o.leftAccentX,m=n==="right"?o.rightTextX:o.leftTextX,h=n==="right"?"start":"end",g=n==="right"?m:o.leftAccentX-ub,E=o.leftAccentX-ub,y=v=>{if(n==="right")return o.rightTextX;let A=0;for(let C of v)(C.kind==="bullet-first"||C.kind==="bullet-cont")&&(A=Math.max(A,_t(C.text,u)));return E-A-p3},b=c-l,S=Math.max(1,Math.floor(b/f)),x=Rlt(r.allLines,S);if(!r.overflows){Kk({parentG:t,layer:e,lines:r.allLines,className:"pyramid-desc",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(r.allLines),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"});return}let L=Ilt(r);Kk({parentG:t,layer:e,lines:L,className:"pyramid-desc pyramid-desc-short",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(L),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"}),Kk({parentG:t,layer:e,lines:x,className:"pyramid-desc pyramid-desc-full",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(x),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"full"})}function Rlt(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function Ilt(t){if(!t.overflows)return t.allLines.slice();let e=t.allLines.slice(0,t.shortLineCount);if(e.length===0)return[];let n=e[e.length-1];return e[e.length-1]={...n,text:n.text.endsWith("\u2026")?n.text:`${n.text} \u2026`},e}function Kk(t){let{parentG:e,layer:n,lines:r,className:o,accentX:a,accentColor:i,textX:s,textAnchor:l,bulletColLeftX:c,midY:d,descFont:u,descLineHeight:f,palette:p,topBound:m,bottomBound:h,onClickItem:g,variant:E}=t;if(r.length===0)return;let y=r.length*f,b=d-y/2+f/2,S=Math.max(4,Math.round(u*.3)),x=b-f/2-S,L=b+(r.length-1)*f+f/2+S,v=0;x<m?v=m-x:L>h&&(v=h-L),b+=v;let A=b-f/2-S,C=y+S*2,M=e.append("g").attr("class",o).attr("data-line-number",n.lineNumber).attr("data-variant",E);if(g){let w=n.lineNumber;M.style("cursor","pointer").on("click",()=>g(w))}M.append("rect").attr("x",a).attr("y",A).attr("width",db).attr("height",C).attr("rx",db/2).attr("fill",i);for(let w=0;w<r.length;w++){let k=r[w],N=b+w*f,_=k.kind==="bullet-first"||k.kind==="bullet-cont";k.kind==="bullet-first"&&M.append("text").attr("x",c).attr("y",N).attr("dy","0.35em").attr("text-anchor","start").attr("fill",p.text).attr("font-family",It).attr("font-size",u).attr("font-weight",w===0?500:400).text("\u2022");let T=M.append("text").attr("x",_?c+p3:s).attr("y",N).attr("dy","0.35em").attr("text-anchor",_?"start":l).attr("fill",p.text).attr("font-family",It).attr("font-size",u).attr("font-weight",w===0?500:400);gn(T,k.text,p)}}function Plt(t,e,n){let r=n*Bo,o=Math.max(8,Math.floor(e/r)),a=t.map(s=>s.startsWith("- ")?"\u2022 "+s.slice(2):s),i=[];for(let s of a){if(s===""){i.push({text:"",kind:"plain"});continue}i.push(...Ko([s],o))}return i}function f3(t,e,n){return Math.max(e,Math.min(n,t))}var Elt,Slt,qk,vlt,klt,Llt,l3,c3,db,ub,p3,Nlt,Mlt,Tlt,Clt,g3=st(()=>{"use strict";Xn();on();tn();xr();_o();en();Hs();fr();Elt=50,Slt=.03,qk=16,vlt=.78,klt=.58,Llt=.42,l3=.85,c3=28,db=3,ub=12,p3=10,Nlt=12,Mlt=22,Tlt=11,Clt=15});var k3={};ye(k3,{renderRing:()=>v3,renderRingForExport:()=>Vlt});function v3(t,e,n,r,o,a){if(e.layers.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Dlt),p=c.aesthetic(Glt),m=e.layers.length,h=e.layers.some(U=>U.description.length>0),g=!!e.title&&e.options["no-title"]!=="on",y=(g?f:0)+p,b=s-p,S=Math.max(60,b-y),x=i*Olt,L=i-x*2,v=h?Hlt:$lt,A=L*v,w=Math.min(A,S)/2,k=w/m,N=y+S/2,_=h?x+L*v/2:i/2,T=_+w+Wlt,R=T+Zk+Blt,G=Math.max(80,i-x-R),I=Math.round(k*.45),H=I>=w3,O=S3(I,w3,Ylt),D=h?S3(Math.round(G/30),E3,zlt):E3,W=Math.round(D*1.35),z=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c.isBelowFloor&&z.attr("width","100%"),z.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),g){let U=z.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&U.on("click",()=>o(e.titleLineNumber))}let P=ir(n),B=(U,X)=>{if(U.color){let q=Dn(U.color,n);if(q)return q}return P[X%P.length]},Y=e.options["solid-fill"]==="on",V=e.layers.map((U,X)=>B(U,X)),j=V.map(U=>ie(n,U,r,{solid:Y})),K=z.append("g").attr("class","ring-body"),$=n.text;for(let U=0;U<m;U++){let X=e.layers[U],q=(U+1)*k,et=U*k,tt=j[U],F=K.append("g").attr("class","ring-layer").attr("data-line-number",X.lineNumber);if(o){let Q=X.lineNumber;F.style("cursor","pointer").on("click",()=>o(Q))}if(U===0)F.append("circle").attr("cx",_).attr("cy",N).attr("r",q).attr("fill",tt).attr("stroke",$).attr("stroke-width",y3).attr("stroke-opacity",b3);else{let Q=`M ${_-q} ${N} A ${q} ${q} 0 1 0 ${_+q} ${N} A ${q} ${q} 0 1 0 ${_-q} ${N} M ${_-et} ${N} A ${et} ${et} 0 1 0 ${_+et} ${N} A ${et} ${et} 0 1 0 ${_-et} ${N} Z`;F.append("path").attr("d",Q).attr("fill-rule","evenodd").attr("fill",tt).attr("stroke",$).attr("stroke-width",y3).attr("stroke-opacity",b3)}}if(H){let U=z.append("g").attr("class","ring-labels");for(let X=0;X<m;X++){let q=e.layers[X],et=j[X],F=X===0?N:N-(X+.5)*k,Q=O,ot=ve(et,n.textOnFillLight,n.textOnFillDark),lt=U.append("g").attr("class","ring-label-group").attr("data-line-number",q.lineNumber).append("text").attr("class","ring-label").attr("x",_).attr("y",F).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",ot).attr("font-family",It).attr("font-size",Q).attr("font-weight",600).style("pointer-events","none");gn(lt,q.label,n,Q)}}(h||!H)&&Ult({parentG:z.append("g").attr("class","ring-descriptions"),layers:e.layers,colors:V,accentX:T,textX:R,textWidth:G,topY:y,bottomY:b,descFont:D,descLineHeight:W,palette:n,...o!==void 0&&{onClickItem:o}})}function Vlt(t,e,n,r,o){v3(t,e,n,r,void 0,o)}function Ult(t){let{parentG:e,layers:n,colors:r,accentX:o,textX:a,textWidth:i,topY:s,bottomY:l,descFont:c,descLineHeight:d,palette:u,onClickItem:f}=t,p=Math.max(8,Math.floor(i/(c*Bo))),m=Math.round(c*1.3),h=Math.max(8,Math.round(c*.6)),g=l-s,E=v=>{let A=n.map(w=>Xlt(Ko(w.description.slice(),p),v)),C=A.map(w=>m+w.length*d),M=C.reduce((w,k)=>w+k,0)+h*Math.max(0,n.length-1);return{wraps:A,blockHeights:C,totalH:M}},y=E(x3);for(let v=x3-1;v>=0&&y.totalH>g;v--)y=E(v);let{wraps:b,blockHeights:S,totalH:x}=y,L=s+Math.max(0,(g-x)/2);for(let v=0;v<n.length;v++){let A=n[v],C=b[v],M=S[v],w=e.append("g").attr("class","ring-desc").attr("data-line-number",A.lineNumber);if(f){let _=A.lineNumber;w.style("cursor","pointer").on("click",()=>f(_))}w.append("rect").attr("x",o).attr("y",L).attr("width",Zk).attr("height",M).attr("rx",Zk/2).attr("fill",r[v]);let k=w.append("text").attr("x",a).attr("y",L+Math.round(m*.7)).attr("text-anchor","start").attr("fill",u.text).attr("font-family",It).attr("font-size",c).attr("font-weight",600);gn(k,A.label,u,c);let N=L+m+Math.round(d*.4);for(let _ of C){let T=_.kind==="bullet-first"||_.kind==="bullet-cont";_.kind==="bullet-first"&&w.append("text").attr("x",a).attr("y",N).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",It).attr("font-size",c).text("\u2022");let R=w.append("text").attr("x",T?a+Flt:a).attr("y",N).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",It).attr("font-size",c);gn(R,_.text,u,c),N+=d}L+=M+h}}function Xlt(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function S3(t,e,n){return Math.max(e,Math.min(n,t))}var Dlt,Olt,Glt,$lt,Hlt,Wlt,Zk,Blt,Flt,y3,b3,x3,w3,Ylt,E3,zlt,L3=st(()=>{"use strict";Xn();on();tn();xr();_o();en();Hs();fr();Dlt=50,Olt=.03,Glt=16,$lt=.78,Hlt=.58,Wlt=28,Zk=3,Blt=12,Flt=10,y3=1,b3=.4,x3=4,w3=12,Ylt=22,E3=11,zlt=15});function M3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>M3(e))}}function jlt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function N3(t,e){let n=t*.32,r=t/(Math.max(1,e)+1);return Math.min(n,r)}function T3(t,e){let n=e.maxDepth??1/0,r=Math.max(1,e.radius),o={label:"__root",children:t.map(m=>M3(m))},a=Ri(o).sum(m=>m.children?.length?0:m.value??0),i=a.value??0;if(i<=0)return{cells:[],total:0,discRadius:e.discRadius??N3(r,1),maxDepthReached:0,isEmpty:!0};let s=NE().size([2*Math.PI,1])(a),l=s.height,c=Math.min(r-1,e.discRadius??N3(r,l)),u=Math.max(1,r-c)/Math.max(1,l);(s.children??[]).forEach((m,h)=>{m.each(g=>{g._topIndex=h})});let f=[],p=0;for(let m of s.descendants()){if(m.depth===0||m.depth>n)continue;let h=!!m.children&&m.children.length>0;m.depth>p&&(p=m.depth);let g=[],E=m;for(;E&&E.depth>0;)g.unshift(E.data.label),E=E.parent;let y=c+(m.depth-1)*u,b=c+m.depth*u,S=jlt(m);f.push({node:m.data.ref??null,label:m.data.label,startAngle:m.x0,endAngle:m.x1,innerR:y,outerR:b,depth:m.depth,value:m.value??0,isContainer:h,isCollapsed:!1,topIndex:m._topIndex??0,pctOfRoot:i>0?(m.value??0)/i:0,pctOfParent:m.parent&&(m.parent.value??0)>0?(m.value??0)/(m.parent.value??1):1,...S!==void 0&&{heat:S},path:g,...m.data.lineNumber!==void 0&&{lineNumber:m.data.lineNumber}})}return{cells:f,total:i,discRadius:c,maxDepthReached:p,isEmpty:!1}}var C3=st(()=>{"use strict";Xh()});function qlt(t,e,n){if(e<=1)return t;let r=Math.max(55,100-(e-1)*18);return Gt(t,n,r)}function pb(t,e){let n=e??t.defaultColorMode;return n==="tag"&&t.tagGroups.length===0&&(n=t.hasHeat?"heat":"branch"),n==="heat"&&!t.hasHeat&&(n="branch"),n}function mb(t,e){if(e.mode==="heat")return t.heat!==void 0&&e.heat?e.heat.scale(t.heat):Qk;if(e.mode==="tag")return t.node?ar(t.node.metadata,e.tagGroups,e.activeGroup)??Qk:Qk;let n=t.path[0]??t.label,r=(e.rootIndexByLabel.get(n)??t.topIndex)+e.colorOffset,o=e.seriesColors[r%e.seriesColors.length];return qlt(o,t.depth,e.bg)}function hb(t,e){if(!t.hasHeat)return null;let n=[],r=f=>{for(let p of f)typeof p.heat=="number"&&n.push(p.heat),r(p.children)};if(r(t.roots),n.length===0)return null;let o=Math.min(...n),a=Math.max(...n),i=o<0&&a>0,s=e.surface,l=t.options.heatColors.map(f=>Dn(f,e)??f).filter(f=>!!f),c,d;if(l.length>=2){c=[l[0],s,l[1]];let f=i?0:(o+a)/2;d=[o,f,a]}else l.length===1?(c=[s,l[0]],d=[o,a]):i?(c=[e.colors.red,s,e.colors.green],d=[o,0,a]):(c=[s,e.primary],d=[o,a]);if(d[0]===d[d.length-1]){let f=c[c.length-1];return{scale:()=>f,min:o,max:a,stops:c,signed:i}}let u=or().domain(d).range(c).clamp(!0);return{scale:f=>Klt(u(f)),min:o,max:a,stops:c,signed:i}}function Klt(t){if(t.startsWith("#"))return t;let e=t.match(/rgba?\(([^)]+)\)/);if(!e)return t;let n=e[1].split(",").map(o=>Math.round(parseFloat(o))),r=o=>Math.max(0,Math.min(255,o||0)).toString(16).padStart(2,"0");return`#${r(n[0]??0)}${r(n[1]??0)}${r(n[2]??0)}`}function ou(t){let e=Math.abs(t);return e>=1e9?fb(t/1e9)+"B":e>=1e6?fb(t/1e6)+"M":e>=1e3?fb(t/1e3)+"k":fb(Math.round(t*100)/100)}function fb(t){return parseFloat(t.toFixed(t<10&&!Number.isInteger(t)?1:0)).toString()}function vp(t){let e=t*100;return e>=10?`${Math.round(e)}%`:e>=1?`${e.toFixed(0)}%`:`${e.toFixed(1)}%`}function gb(t,e,n,r,o){let a=[],i=new Map,s=null;if(e.tagGroups.length>0){let l=e.tagGroups[0],c=new Set,d=u=>{for(let f of u){let p=f.metadata[qt(l.name)];p&&c.add(p.toLowerCase()),d(f.children)}};d(e.roots),a.push({name:l.name,entries:l.entries.filter(u=>c.has(u.value.toLowerCase())).map(u=>({value:u.value,color:u.color}))}),i.set(l.name,"tag"),t==="tag"&&(s=l.name)}if(n){let l=e.options.heatLabel??"Value";a.push({name:l,entries:[],gradient:{min:n.min,max:n.max,low:n.stops[0],high:n.stops[n.stops.length-1]}}),i.set(l,"heat"),t==="heat"&&(s=l)}return a.push({name:"Branch",entries:e.roots.map((l,c)=>({value:l.label,color:r[(c+o)%r.length]}))}),i.set("Branch","branch"),(t==="branch"||s===null)&&(s="Branch"),{groups:a,activeGroup:s,modeByName:i}}var Qk,Jk=st(()=>{"use strict";qa();xr();tn();Ke();Qk="#cbd5e1"});var R3={};ye(R3,{renderTreemapRadial:()=>A3,renderTreemapRadialForExport:()=>Jlt});function Jlt(t,e,n,r,o,a){A3(t,e,n,r,o,{exportMode:!0,...a})}function A3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=a.exportMode??!1,u=ir(n),f=hb(e,n),p=c.noLegend?null:gb(l,e,f,u,a.colorOffset??0),h=(p?Tr({groups:p.groups,position:_3,mode:"preview"},i)+Wn:0)+yb,g=Math.max(1,i-yb*2),E=Math.max(1,s-h-yb),y=Math.max(1,Math.min(g,E)/2-yb),b=i/2,S=h+E/2,x=T3(e.roots,{radius:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),L=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap dgmo-treemap-radial").style("font-family",It),v=L.append("defs");L.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg);let A=L.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${S})`),C=e.tagGroups.length>0?e.tagGroups[0].name:null,M=new Map(e.roots.map((_,T)=>[_.label,T])),w={mode:l,heat:f,tagGroups:e.tagGroups,activeGroup:C,rootIndexByLabel:M,seriesColors:u,colorOffset:a.colorOffset??0,bg:n.bg},k=_l().startAngle(_=>_.startAngle).endAngle(_=>_.endAngle).innerRadius(_=>_.innerR).outerRadius(_=>_.outerR).padAngle(.004).padRadius(y),N=0;if(!x.isEmpty)for(let _ of x.cells){let T=mb(_,w),R=A.append("g").attr("class","dgmo-treemap-cell").attr("data-node-path",_.path.join(" / "));if(_.lineNumber!==void 0&&R.attr("data-line-number",_.lineNumber),_.heat!==void 0&&R.attr("data-heat",_.heat),_.node&&C){let G=qt(C),I=_.node.metadata[G];I&&R.attr(`data-tag-${G}`,I)}R.append("path").attr("class",_.isContainer?"dgmo-treemap-arc branch":"dgmo-treemap-arc").attr("d",k(_)??"").attr("fill",T).attr("stroke",n.bg).attr("stroke-width",1),ect(R,v,`dgmo-arc-lbl-${N++}`,_,c,n,T)}if(tct(A,e,x.discRadius,x.total,x.isEmpty,n),p){let _=L.append("g").attr("class","dgmo-treemap-legend").attr("transform","translate(0, 0)");fn(_,{groups:p.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:d?"export":"preview",position:_3,activeGroup:p.activeGroup,showInactivePills:!d,showEmptyGroups:!d})}}function tct(t,e,n,r,o,a){let i=t.append("g").attr("class","dgmo-treemap-disc");i.append("circle").attr("r",n).attr("fill",a.surface).attr("stroke",a.bg).attr("stroke-width",1);let s=ve(a.surface,a.textOnFillLight,a.textOnFillDark),l=n*1.7;if(o){i.append("text").attr("class","dgmo-treemap-empty").attr("text-anchor","middle").attr("y",4).attr("fill",s).attr("font-size",bb(13,n)).text(xb("No values to chart",l,13));return}let c=e.title??"",d=ou(r),u=bb(15,n),f=bb(22,n);if(c){let p=i.append("text").attr("class","dgmo-treemap-disc-title").attr("text-anchor","middle").attr("y",-4).attr("fill",s).attr("font-size",u).attr("font-weight",600).text(xb(c,l,u));e.titleLineNumber!==null&&p.attr("data-line-number",e.titleLineNumber)}i.append("text").attr("class","dgmo-treemap-disc-total").attr("text-anchor","middle").attr("y",c?u:8).attr("fill",s).attr("font-size",f).attr("font-weight",700).text(xb(d,l,f))}function ect(t,e,n,r,o,a,i){let s=r.endAngle-r.startAngle;if(s<Zlt)return;let l=r.outerR-r.innerR;if(l<10)return;let c=ve(i,a.textOnFillLight,a.textOnFillDark),d=(r.innerR+r.outerR)/2,u=bb(13,l),p=[o.noValues?"":ou(r.value),o.noPercent?"":vp(r.pctOfRoot)].filter(Boolean).join(" \xB7 "),m=p?`${r.label} ${p}`:r.label,h=s*d*.94,g=u,E=_t(m,u);E>h&&(g=Math.max(Qlt,Math.floor(u*h/E)));let y=xb(m,h,g);y&&nct(t,e,n,r,d,g,y,c)}function nct(t,e,n,r,o,a,i,s){let l=(r.startAngle+r.endAngle)/2,c=l>Math.PI/2&&l<3*Math.PI/2,d=c?o+a*.32:o-a*.32,[u,f]=c?[r.endAngle,r.startAngle]:[r.startAngle,r.endAngle],p=Math.sin(u)*d,m=-Math.cos(u)*d,h=Math.sin(f)*d,g=-Math.cos(f)*d,E=c?0:1,y=`M ${p.toFixed(2)} ${m.toFixed(2)} A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 ${E} ${h.toFixed(2)} ${g.toFixed(2)}`;e.append("path").attr("id",n).attr("d",y),t.append("text").attr("class","dgmo-treemap-label").attr("font-size",a).attr("font-weight",600).attr("fill",s).append("textPath").attr("href",`#${n}`).attr("startOffset","50%").attr("text-anchor","middle").text(i)}function bb(t,e){return Math.max(8,Math.min(t,Math.round(e*.9)))}function xb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var yb,_3,Zlt,Qlt,I3=st(()=>{"use strict";Xn();Eo();on();tn();Ke();en();Br();To();Mr();C3();Jk();yb=12,_3={placement:"top-center",titleRelation:"below-title"},Zlt=6*Math.PI/180,Qlt=8});function P3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>P3(e))}}function rct(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function D3(t,e){let n=e.maxDepth??1/0,r={label:"__root",children:t.map(l=>P3(l))},o=Ri(r).sum(l=>l.children?.length?0:l.value??0).sort((l,c)=>(c.value??0)-(l.value??0)),a=AE().tile(yf).size([e.width,e.height]).paddingOuter(e.paddingOuter??3).paddingTop(e.headerH>0?e.headerH:e.paddingInner??2).paddingInner(e.paddingInner??2).round(!0)(o),i=a.value??0;(a.children??[]).forEach((l,c)=>{l.each(d=>{d._topIndex=c})});let s=[];for(let l of a.descendants()){if(l.depth===0||l.depth>n)continue;let c=!!l.children&&l.children.length>0,d=c&&l.depth>=n,u=c&&!d,f=[],p=l;for(;p&&p.depth>0;)f.unshift(p.data.label),p=p.parent;let m=rct(l);s.push({node:l.data.ref??null,label:l.data.label,x0:l.x0,y0:l.y0,x1:l.x1,y1:l.y1,depth:l.depth,value:l.value??0,isContainer:u,isCollapsed:d,topIndex:l._topIndex??0,pctOfRoot:i>0?(l.value??0)/i:0,pctOfParent:l.parent&&(l.parent.value??0)>0?(l.value??0)/(l.parent.value??1):1,...m!==void 0&&{heat:m},path:f,...l.data.lineNumber!==void 0&&{lineNumber:l.data.lineNumber}})}return{cells:s,total:i}}var O3=st(()=>{"use strict";Xh()});var W3={};ye(W3,{renderTreemap:()=>H3,renderTreemapForExport:()=>sct});function sct(t,e,n,r,o,a){H3(t,e,n,r,o,{exportMode:!0,...a})}function H3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=c.solidFill,u=a.exportMode??!1,f=ir(n),p=!!e.title,m=p?act:0,h=hb(e,n),g=c.noLegend?null:gb(l,e,h,f,a.colorOffset??0),E=g?Tr({groups:g.groups,position:G3,mode:"preview"},i)+Wn:0,y=c.noHeaders?0:oct,b=wb,S=m+E+wb,x=Math.max(1,i-wb*2),L=Math.max(1,s-S-wb),v=D3(e.roots,{width:x,height:L,headerH:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),A=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap").style("font-family",It);if(A.append("style").text(".dgmo-treemap-focus{opacity:.3;transition:opacity .12s}.dgmo-treemap-cell:hover .dgmo-treemap-focus{opacity:.7}"),A.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),p){let T=A.append("text").attr("class","chart-title").attr("x",i/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&T.attr("data-line-number",e.titleLineNumber)}let C=A.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${S})`),M=f,w=a.colorOffset??0,k=e.tagGroups.length>0?e.tagGroups[0].name:null,N=new Map(e.roots.map((T,R)=>[T.label,R])),_={mode:l,heat:h,tagGroups:e.tagGroups,activeGroup:k,rootIndexByLabel:N,seriesColors:M,colorOffset:w,bg:n.bg};for(let T of v.cells){let R=Math.max(0,T.x1-T.x0),G=Math.max(0,T.y1-T.y0);if(R<=0||G<=0)continue;let I=mb(T,_),H=T.isContainer||d?I:Gt(I,n.bg,ict),O=T.isContainer||T.isCollapsed,D=C.append("g").attr("class","dgmo-treemap-cell").attr("transform",`translate(${T.x0},${T.y0})`).attr("data-node-path",T.path.join(" / "));if(T.lineNumber!==void 0&&D.attr("data-line-number",T.lineNumber),T.heat!==void 0&&D.attr("data-heat",T.heat),T.node&&k){let Y=qt(k),V=T.node.metadata[Y];V&&D.attr(`data-tag-${Y}`,V)}let W=D.append("rect").attr("class",T.isContainer?"dgmo-treemap-rect branch":"dgmo-treemap-rect").attr("width",R).attr("height",G).attr("rx",2).attr("fill",H).attr("fill-opacity",1).attr("stroke",n.bg).attr("stroke-width",T.isContainer?1:0);if(O&&a.onClickItem&&T.lineNumber!==void 0){let Y=T.lineNumber;W.style("cursor","pointer").on("click",()=>a.onClickItem(Y))}let z=ve(H,n.textOnFillLight,n.textOnFillDark);if(T.isContainer&&y>0&&R>34&&G>y){let Y=[];c.noValues||Y.push(ou(T.value)),c.noPercent||Y.push(vp(T.pctOfRoot));let V=Y.join(" \xB7 "),j=O?16:4,K=V.length>0&&R>110,$=K?_t(V,10.5):0,U=R-8-j-(K?$+10:0);D.append("text").attr("class","dgmo-treemap-header").attr("x",6).attr("y",13).attr("font-size",11).attr("font-weight",700).attr("fill",z).text(Sb(T.label,Math.max(0,U),11)),K&&D.append("text").attr("class","dgmo-treemap-header-value").attr("x",R-j-4).attr("y",13).attr("text-anchor","end").attr("font-size",10.5).attr("fill",z).attr("opacity",.75).text(V)}let P=Math.max(4,Math.min(14,Math.floor(Math.min(R,G)/5))),B=7;if(!T.isContainer&&R>=2*P+8&&G>=2*P+8){let Y=R-2*P;if(_t(T.label,B)*1.06>Y&&G>R*1.25&&G-2*P>Y){lct(D,T.label,R,G,P,z),O&&R>30&&G>22&&$3(D,R,z,9);continue}let j=Lp(Math.round(Math.min(R/3.6,G/3.4)),B,72),K=_t(T.label,j)*1.06;K>Y&&(j=Math.max(B,Math.floor(j*Y/K)));let U=.95-Lp((j-B)/(72-B),0,1)*.5,X=Lp(Math.round(j*.42),11,28),q=Math.max(.45,U-.1),et=P+Math.round(j*.78);D.append("text").attr("class","dgmo-treemap-label").attr("x",P).attr("y",et).attr("font-size",j).attr("font-weight",600).attr("fill",z).attr("opacity",U).text(Sb(T.label,Y,j));let tt=[c.noValues?"":ou(T.value),c.noPercent?"":vp(T.pctOfRoot)].filter(Boolean),F=tt.join(" \xB7 "),Q=et,ot=(Z,lt,nt,J)=>{D.append("text").attr("class","dgmo-treemap-value").attr("x",P).attr("y",lt).attr("font-size",nt).attr("fill",z).attr("opacity",J).text(Z)};if(F){let Z=_t(F,X)<=Y,lt=et+Eb(j,X),nt=lt+kp(X)<=G-P;if(Z&&nt)ot(F,lt,X,q);else if(Z){let J=Lp(Math.round(j*.5),11,Math.max(11,X)),at=Sb(T.label,Y,j),it=_t(at,j)*1.12,vt=Math.max(12,Math.round(j*.25));P+it+vt+_t(F,J)<=R-P&&D.append("text").attr("class","dgmo-treemap-value").attr("x",P+it+vt).attr("y",Q).attr("font-size",J).attr("fill",z).attr("opacity",q).text(F)}else if(tt.length===2){let J=Eb(j,X);et+J+kp(X)<=G-P&&(et+=J,ot(tt[0],et,X,q));let at=Math.max(10,Math.round(X*.9)),it=Eb(X,at);et+it+kp(at)<=G-P&&(et+=it,ot(tt[1],et,at,q))}else{let J=et+Eb(j,X);J+kp(X)<=G-P&&ot(F,J,X,q)}}}O&&R>30&&G>22&&$3(D,R,z,9)}if(g){let T=A.append("g").attr("class","dgmo-treemap-legend").attr("transform",`translate(0, ${m})`);fn(T,{groups:g.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:u?"export":"preview",position:G3,activeGroup:g.activeGroup,showInactivePills:!u,showEmptyGroups:!u,...a.onSelectMode!==void 0&&{callbacks:{onGroupToggle:R=>{let G=g.modeByName.get(R);G&&a.onSelectMode(G)}}}})}}function $3(t,e,n,r){let a=e-4.5-5,i=t.append("g").attr("class","dgmo-treemap-focus").attr("data-export-ignore","true");i.append("rect").attr("x",a-9).attr("y",r-9).attr("width",18).attr("height",18).attr("fill","transparent"),i.append("circle").attr("cx",a).attr("cy",r).attr("r",4.5).attr("fill","none").attr("stroke",n).attr("stroke-width",1.25),i.append("circle").attr("cx",a).attr("cy",r).attr("r",1.4).attr("fill",n)}function lct(t,e,n,r,o,a){let s=r-2*o,l=n-2*o,c=Lp(Math.round(Math.min(l/.8,14)),6,22),d=_t(e,c)*1.06;d>s&&(c=Math.max(6,Math.floor(c*s/d)));let u=Sb(e,s,c);u&&t.append("text").attr("class","dgmo-treemap-label").attr("transform",`translate(${n/2},${r/2}) rotate(-90)`).attr("y",Math.round(c*.28)).attr("text-anchor","middle").attr("font-size",c).attr("font-weight",600).attr("fill",a).attr("opacity",.95).text(u)}function kp(t){return Math.ceil(t*.26)}function Eb(t,e,n=4){return kp(t)+n+Math.round(e*.72)}function Lp(t,e,n){return Math.max(e,Math.min(n,t))}function Sb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var wb,oct,act,ict,G3,B3=st(()=>{"use strict";Xn();on();tn();Ke();en();Br();To();Mr();O3();Jk();wb=12,oct=18,act=36,ict=50,G3={placement:"top-center",titleRelation:"below-title"}});function Y3(t,e={}){let n=e.collapsed??new Set,r=V3(t,0,0,null,n);return{width:r.w,height:r.h,items:r.items}}function eL(t){return Math.max(1,...t.rows.map(e=>e.reduce((n,r)=>n+(r.span||1),0)))}function uct(t){return Math.max(rL,Math.min(cct,_t(t.label,dct)+2*Np+14))}function z3(t){let e=rL;for(let n of t.rows)for(let r of n){if(!ti(r))continue;let o=r.grid?fct(r.grid)+2*Np:uct(r);e=Math.max(e,o/(r.span||1))}return e}function fct(t){let e=t.cols??eL(t);return e*z3(t)+(e+1)*vo}function V3(t,e,n,r,o){let a=t.cols??eL(t),i=r??z3(t),s=a*i+(a+1)*vo,l=n+vo,c=[],d=e+vo;for(let f of t.rows){let p=e+vo,m=tL,h=[];for(let g of f){let E=g.span||1,y=E*i+(E-1)*vo;if(!ti(g)){h.push({type:"empty",x:p,y:l,w:y,h:tL}),p+=y+vo,d=Math.max(d,p-vo);continue}if(g.grid&&o.has(g.id)){let b={type:"collapsed",x:p,y:l,w:y,h:F3,label:g.label,node:g,lineNumber:g.lineNumber};h.push(b),m=Math.max(m,F3),p+=y+vo,d=Math.max(d,p-vo);continue}if(g.grid){let b=g.grid.cols??eL(g.grid),S=Math.max(rL*.66,(y-2*Np-(b+1)*vo)/b),x=V3(g.grid,p+Np,l+vb,S,o),L=vb+x.h+Np;h.push({type:"container",x:p,y:l,w:y,h:L,label:g.label,node:g,lineNumber:g.lineNumber,inner:x.items}),m=Math.max(m,L),p+=y+vo,d=Math.max(d,p-vo);continue}h.push({type:"leaf",x:p,y:l,w:y,h:tL,label:g.label,node:g,lineNumber:g.lineNumber}),p+=y+vo,d=Math.max(d,p-vo)}c.push(...h),l+=m+vo}let u=Math.max(s,d-e+vo);return{x:e,y:n,w:u,h:l-n,items:c}}var vo,Np,tL,vb,F3,nL,rL,cct,dct,U3=st(()=>{"use strict";en();_h();vo=12,Np=10,tL=46,vb=28,F3=46,nL=6,rL=104,cct=250,dct=13});var Q3={};ye(Q3,{authoredCollapsedIds:()=>Z3,renderBlock:()=>q3,renderBlockForExport:()=>hct});function hct(t,e,n,r,o,a){q3(t,e,n,r,o,{exportMode:!0,...a})}function q3(t,e,n,r,o,a={}){if(e.error||e.top.rows.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.options,s=!!e.title,l=s?pct:0,c=a.collapsed??Z3(e),d=Y3(e.top,{collapsed:c}),u=i.noLegend?null:xct(e),f,p;a.exportMode?f=Math.max(d.width,mct)+au*2:f=o?.width??t.clientWidth;let m=u?Tr({groups:u.groups,position:X3,mode:"preview"},f)+Wn:0,h=l+m+au;if(a.exportMode?p=h+d.height+au:p=o?.height??t.clientHeight,f<=0||p<=0)return;let g=au,E=Math.max(1,f-au*2),y=Math.max(1,p-h-au),b=Math.min(1,E/d.width,y/d.height),S=g+(E-d.width*b)/2,x=h,L=Rt(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-block").style("font-family",It);if(L.append("rect").attr("width",f).attr("height",p).attr("fill",n.bg),s){let M=L.append("text").attr("class","chart-title").attr("x",f/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&M.attr("data-line-number",e.titleLineNumber)}let v=e.tagGroups.length>0?e.tagGroups[0].name:null,A=Gt(n.text,n.bg,22),C=L.append("g").attr("class","dgmo-block-cells").attr("transform",`translate(${S},${x}) scale(${b})`);if(K3(C,d.items,{palette:n,tagGroups:e.tagGroups,activeGroup:v,activeKey:v?qt(v):null,neutral:A,solidFill:i.solidFill,onToggle:a.onToggle}),u){let M=L.append("g").attr("class","dgmo-block-legend").attr("transform",`translate(0, ${l})`);fn(M,{groups:u.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:f,mode:a.exportMode?"export":"preview",position:X3,activeGroup:u.activeGroup})}}function gct(t,e){return!t||!e.activeGroup?null:ar(t.metadata,e.tagGroups,e.activeGroup)??null}function oL(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}function K3(t,e,n,r=[]){let{palette:o,solidFill:a}=n;for(let i of e){if(i.type==="empty"){t.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",7).attr("fill","none").attr("stroke",n.neutral).attr("stroke-width",1).attr("stroke-dasharray","3 4").attr("opacity",.7);continue}let s=i.node,l=[...r,s.id],c=gct(s,n),d=c??n.neutral,u=t.append("g").attr("class","dgmo-block-cell").attr("data-block-id",s.id).attr("data-block-path",l.join(" / "));if(i.lineNumber!==void 0&&u.attr("data-line-number",i.lineNumber),n.activeKey){let p=s.metadata[n.activeKey];p&&u.attr(`data-tag-${n.activeKey}`,p)}if(i.type==="collapsed"){let p=c?a?c:Gt(c,o.bg,12):o.surface,m=`dgmo-block-clip-${yct++}`;u.append("clipPath").attr("id",m).append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+4).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",700).attr("fill",o.text).text(oL(i.label??"",i.w-24,12.5)),u.append("rect").attr("x",i.x).attr("y",i.y+i.h-nL).attr("width",i.w).attr("height",nL).attr("fill",a&&c?o.text:d).attr("clip-path",`url(#${m})`),j3(u,i,n,i.h);continue}if(i.type==="container"){let p=c?a?c:Gt(c,o.bg,7):o.surface;u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5);let m=Math.min(i.w,i.h*2.5),h=Math.max(13,Math.min(20,Math.round(13+(m-220)/70))),E=.92-(h-13)/7*.3,y=i.y+Math.round(h*.7)+7;u.append("text").attr("x",i.x+i.w/2).attr("y",y).attr("text-anchor","middle").attr("font-size",h).attr("font-weight",700).attr("fill",o.text).attr("opacity",E).text(oL(i.label??"",i.w-24,h)),j3(u,i,n,vb),i.inner&&K3(t,i.inner,n,l);continue}let f=c?a?c:Gt(c,o.bg,14):o.bg;u.attr("data-leaf","true"),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",8).attr("fill",f).attr("stroke",d).attr("stroke-width",1.25),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+5).attr("text-anchor","middle").attr("font-size",13).attr("font-weight",600).attr("fill",o.text).text(oL(i.label??"",i.w-16,13))}}function j3(t,e,n,r){if(!n.onToggle||!e.node||e.lineNumber===void 0)return;let o=e.node.id,a=e.lineNumber;t.append("rect").attr("x",e.x).attr("y",e.y).attr("width",e.w).attr("height",r).attr("rx",10).attr("fill","transparent").style("cursor","pointer").on("click",()=>n.onToggle(o,a))}function Z3(t){let e=new Set;return bct(t,e),e}function bct(t,e){let n=r=>{for(let o of r.rows)for(let a of o)ti(a)&&(a.collapsed&&a.grid&&e.add(a.id),a.grid&&n(a.grid))};n(t.top)}function xct(t){if(t.tagGroups.length===0)return null;let e=t.tagGroups[0],n=qt(e.name),r=new Set,o=i=>{for(let s of i.rows)for(let l of s)if(ti(l)){let c=l.metadata[n];c&&r.add(c.toLowerCase()),l.grid&&o(l.grid)}};o(t.top);let a=e.entries.filter(i=>r.has(i.value.toLowerCase())).map(i=>({value:i.value,color:i.color}));return a.length===0?null:{groups:[{name:e.name,entries:a}],activeGroup:e.name}}var au,pct,mct,X3,yct,J3=st(()=>{"use strict";Xn();on();tn();Ke();Br();To();Mr();en();_h();U3();au=12,pct=36,mct=220,X3={placement:"top-center",titleRelation:"below-title"};yct=0});var f4={};ye(f4,{MARKER_LABELS:()=>Lb,renderRaci:()=>d4,renderRaciForExport:()=>Xct});function wct(t){let e=new Map;if(t.diagnostics.length===0)return e;let n=[];for(let r of t.tasksWithoutPhase)n.push(r);for(let r of t.phases)for(let o of r.tasks)n.push(o);for(let r of t.diagnostics){if(r.line<=0)continue;let o=n.find(s=>r.line>=s.lineNumber&&r.line<=s.endLineNumber);if(!o)continue;let a=e.get(o.id);a?r.line<a.firstLine&&(a.firstLine=r.line):(a={errors:[],warnings:[],firstLine:r.line},e.set(o.id,a));let i={line:r.line,message:r.message};r.severity==="error"?a.errors.push(i):a.warnings.push(i)}return e}function Ect(t){let e=t.match(/^Task '[^']*'\s+(.+)$/);if(e){let n=e[1];return n.charAt(0).toUpperCase()+n.slice(1)}return t.replace(/\s+on task '[^']*'/,"")}function Sct(t,e,n,r,o){let a=Math.min(o,n/2,r/2);return`M ${t} ${e+a} A ${a} ${a} 0 0 1 ${t+a} ${e} H ${t+n-a} A ${a} ${a} 0 0 1 ${t+n} ${e+a} V ${e+r} H ${t} Z`}function o4(t,e){let n=new Map(e.map((r,o)=>[r,o]));return[...t].sort((r,o)=>(n.get(r)??99)-(n.get(o)??99))}function aL(t,e){return e.colors[r4[t%r4.length]]}function lL(t,e){switch(t){case"R":return e.colors.green;case"A":return e.colors.red;case"S":return e.colors.teal;case"C":return e.colors.yellow;case"I":return e.colors.gray;case"D":return e.colors.purple}}function d4(t,e,n,r,o,a){let i=typeof o=="function"?{onClickLine:o}:o??{},s=i.onClickLine,l=i.onMarkerDragStart,c=i.hideLegend??!1,d=i.collapsedPhases??new Set,u=(i.hideTitle??!1)||e.options["no-title"]==="on";Rt(t).selectAll(":not([data-d3-tooltip])").remove();let f=a?.width??t.clientWidth,p=a?.height??t.clientHeight;if(f<=0||p<=0)return;let m=[...as(e)];if(m.length===0&&e.phases.length===0)return;let h=e.options["solid-fill"]==="on",g=nr(n,r),E=Math.max(1,e.roles.length),y=E*n4+e4+2*t4,b=a?Ee.identity():Ee.from(f,y),S=b.text(20),x=b.structural(30),L=b.aesthetic(t4),v=b.aesthetic(kct),A=b.structural(vct),C=b.structural(Rct),M=b.structural(a4),w=b.structural(Ict),k=b.structural(Pct),N=b.structural(e4),_=b.structural(Dct),T=b.structural(n4),R=b.structural(Oct),G=b.text(c4),I=b.text(Fct),H=b.text(Yct),O=b.text(Wct),D=b.text(l4),W=b.structural(Gct),z=b.structural($ct),P=b.structural(Hct),B=b.structural(Lct),Y=b.structural(Nct),V=b.structural(Mct),j=b.structural(Tct),K=b.aesthetic(Cct),$=b.text(_ct),U=b.text(Act),X=b.structural(i4),q=b.structural(s4),et=b.structural(1.5),tt=b.structural(zct),F=Math.max(0,f-2*L),Q=Math.max(_,Math.min(T,Math.floor((F-k)/E))),ot=F-Q*E;ot>N&&(ot=N,Q=Math.max(_,Math.floor((F-ot)/E))),ot<k&&(ot=k);let Z=wct(e),lt=[];for(let te of e.tasksWithoutPhase)lt.push({kind:"task",task:te});for(let te of e.phases){let ae=d.has(te.id);if(lt.push({kind:"phase",phase:te,collapsed:ae}),!ae)for(let Te of te.tasks)lt.push({kind:"task",task:Te})}let J=!u||!c?A:v,at=(A-B)/2,it=J+v,Tt=it+C,At=[],rt=ot-16,pt=new Map;for(let te of lt)if(te.kind==="task"){let ae=Z.get(te.task.id);pt.set(te.task.id,u4(te.task,ae,rt,G,D,M,q,X))}for(let te of lt)if(At.push(Tt),te.kind==="phase")Tt+=w;else{let ae=pt.get(te.task.id);Tt+=ae?.rowHeight??M}let ht=Tt+P,dt=ht+v,ut=a?dt:Math.max(p,dt),yt=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",f).attr("height",ut).attr("viewBox",`0 0 ${f} ${ut}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",It).style("background","transparent");b.isBelowFloor&&yt.attr("width","100%");let kt=Lb[e.variant],Ot=Object.keys(kt).filter(te=>kt[te]!==void 0),Xt=Ot.length,bt=Y*Math.max(0,Xt-1),Nt=Ot.reduce((te,ae)=>Math.max(te,_t(kt[ae]??"",$)),0),Vt=Math.max(V,Math.ceil(36+Nt+8)),xt=Xt*Vt+bt,Lt=Xt*j+bt,Dt=e.title&&!u?_t(e.title,S):0,zt="full",$t=xt,ft=Vt;c?$t=0:F-Dt-K<xt&&(zt="letters",$t=Lt,ft=j);let Wt=L+F-$t,he=c?F:Wt-L-K;e.title&&!u&&yt.append("text").attr("x",L).attr("y",x).attr("text-anchor","start").attr("font-size",S).attr("font-weight","700").attr("fill",n.text).text(tr(e.title,S,he)),!c&&Xt>0&&Uct(yt,Ot,e.variant,Wt,at,zt,ft,n,g,h,l,Y,B,tt,et,U,$);let ne=te=>L+ot+te*Q,se=ht-it;if(e.phases.length===0){let te=yt.append("g").attr("class","raci-row-bands");lt.forEach((ae,Te)=>{if(ae.kind!=="task")return;let Je=e.tasksWithoutPhase.indexOf(ae.task);if(Je<0)return;let sn=At[Te],ze=pt.get(ae.task.id)?.rowHeight??M;te.append("rect").attr("class","raci-row-band").attr("data-task-id",ae.task.id).attr("x",L).attr("y",sn+2).attr("width",F).attr("height",ze-4).attr("rx",6).attr("fill",Gt(aL(Je,n),g,12))})}let Zt=yt.append("g").attr("class","raci-columns");e.roles.forEach((te,ae)=>{let Te=ne(ae)+z,Je=Q-2*z,sn=e.roleColors[ae]??aL(ae,n),ze=Gt(sn,nr(n,r),16),Ce=Gt(sn,nr(n,r),30),ee=Zt.append("g").attr("class","raci-column").attr("data-role-id",te);ee.append("rect").attr("class","raci-column-body").attr("x",Te).attr("y",it).attr("width",Je).attr("height",se).attr("rx",W).attr("fill",ze),ee.append("path").attr("class","raci-column-header").attr("d",Sct(Te,it,Je,C,W)).attr("fill",Ce);let oe=ne(ae)+Q/2;ee.append("text").attr("class","raci-column-label").attr("x",oe).attr("y",it+C/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",I).attr("font-weight",600).attr("fill",n.text).text(tr(e.roleDisplayNames[ae]??"",I,Q-2*R))});let Ie=Z.size>0,Ht=22,Qt=z+4,Ut=Q-2*Qt,fe=!0;for(let te of lt)if(!(te.kind!=="phase"||!te.collapsed)){for(let ae of e.roles){let Te=new Set;for(let ze of te.phase.tasks){let Ce=ze.roleAssignments.find(ee=>ee.id===ae);if(Ce)for(let ee of Ce.markers)Te.add(ee)}if(Te.size===0)continue;let Je=Mp*Math.max(0,Te.size-1);if((Ut-Je)/Te.size<Ht){fe=!1;break}}if(!fe)break}for(let te=0;te<lt.length;te++){let ae=lt[te],Te=At[te];if(ae.kind==="phase"){let Je=e.phases.indexOf(ae.phase);jct(yt,ae.phase,L,Te,F,n,ae.collapsed,aL(Math.max(0,Je),n),e.roles,ne,Q,e.variant,g,h,fe,w,H,z,tt)}else qct(yt,ae.task,e,L,Te,ot,ne,Q,n,g,h,Z,Ie,pt.get(ae.task.id),s,l,G,D,R,M,z,tt,et,O,$,q,X)}m.some(te=>te.roleAssignments.some(ae=>ae.markers.length>0))||yt.append("text").attr("x",f/2).attr("y",dt-v-2).attr("text-anchor","middle").attr("font-size",12).attr("fill",n.textMuted).text("Drag a marker from the legend onto any cell. Drag a marker out to remove."),Vct(yt)}function Vct(t){let e=t.node();if(!e)return;let n=null,r=a=>{let i=a;for(;i&&i!==e;){let s=i.getAttribute&&i.getAttribute("data-role-id");if(s)return s;i=i.parentElement}return null},o=a=>{a!==n&&(n&&t.selectAll(`.raci-cell[data-role-id="${n}"], .raci-column[data-role-id="${n}"]`).classed("raci-col-active",!1),n=a,a?(t.attr("data-hover-col",a),t.selectAll(`.raci-cell[data-role-id="${a}"], .raci-column[data-role-id="${a}"]`).classed("raci-col-active",!0)):t.attr("data-hover-col",null))};t.on("mouseover",a=>o(r(a.target))),t.on("mouseleave",()=>o(null))}function Uct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g){if(e.length===0)return;let E=Lb[n],y=t.append("g").attr("class","raci-legend").attr("aria-label",`${n.toUpperCase()} marker legend`);e.forEach((b,S)=>{let x=r+S*(i+u),L=lL(b,s),v=E[b],A=y.append("g").attr("class","raci-legend-chip").attr("data-marker",b).style("cursor","grab");if(a==="letters"){let _=c?L:Gt(L,l,kb),T=c?Gt(L,l,70):L;A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",_).attr("stroke",T).attr("stroke-width",m),A.append("text").attr("x",x+i/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",700).attr("fill",c?ve(_,s.textOnFillLight,s.textOnFillDark):s.text).text(b);return}let C=c?L:Gt(L,l,kb),M=Gt(L,l,70);A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",C).attr("stroke",M).attr("stroke-width",m);let w=4,k=24,N=c?Gt(L,l,70):Gt(L,l,55);A.append("rect").attr("x",x+w).attr("y",o+w).attr("width",k).attr("height",f-2*w).attr("rx",4).attr("fill",N),A.append("text").attr("x",x+w+k/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",700).attr("fill",c?ve(N,s.textOnFillLight,s.textOnFillDark):s.text).text(b),A.append("text").attr("x",x+w+k+8).attr("y",o+f/2).attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",600).attr("fill",s.text).text(tr(v,g,i-k-w*2-12))})}function Xct(t,e,n,r,o){d4(t,e,n,r,{},o)}function jct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g,E,y){let b=t.append("g").attr("class","raci-phase").attr("data-section",`phase-${e.id}`).attr("data-section-toggle","").attr("data-line-number",String(e.lineNumber)).attr("data-phase-id",e.id).attr("data-collapsed",i?"1":"0").style("cursor","pointer"),S=Gt(e.color??s,a.bg,30);b.append("rect").attr("x",n).attr("y",r+4).attr("width",o).attr("height",h-8).attr("fill",S).attr("rx",4);let x=n+12,L=r+h/2;if(b.append("text").attr("x",x).attr("y",L).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",It).attr("font-size",9).attr("fill",a.text).attr("opacity",.6).text(i?"\u25B6":"\u25BC"),b.append("text").attr("x",n+26).attr("y",r+(h-4)/2+2).attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",600).attr("fill",a.text).text(e.displayName),i){let v=e.tasks.length;if(v>0){let _=_t(e.displayName,g);b.append("text").attr("x",n+26+_+10).attr("y",r+(h-4)/2+2).attr("dominant-baseline","central").attr("font-size",g-1).attr("font-weight",500).attr("fill",a.textMuted).text(`${v} ${v===1?"task":"tasks"}`)}if(!m)return;let A=rd[u].alphabet,C=E+4,M=d-2*C,w=24,k=13,N=r+(h-w)/2;l.forEach((_,T)=>{let R=new Set;for(let D of e.tasks){let W=D.roleAssignments.find(z=>z.id===_);if(W)for(let z of W.markers)R.add(z)}if(R.size===0)return;let G=o4([...R],A),I=Mp*Math.max(0,G.length-1),H=(M-I)/G.length,O=c(T)+C;G.forEach((D,W)=>{let z=O+W*(H+Mp),P=lL(D,a),B=p?P:Gt(P,f,kb),Y=p?Gt(P,f,70):P,V=b.append("g").attr("class","raci-phase-summary");V.append("rect").attr("x",z).attr("y",N).attr("width",H).attr("height",w).attr("rx",y).attr("fill",B).attr("stroke",Y).attr("stroke-width",1.25),V.append("text").attr("x",z+H/2).attr("y",N+w/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",k).attr("font-weight",700).attr("fill",p?ve(B,a.textOnFillLight,a.textOnFillDark):a.text).text(D)})})}}function qct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g,E,y,b,S,x,L,v,A,C,M){let w=t.append("g").attr("class","raci-task-row").attr("data-task-id",e.id).attr("data-line-number",String(e.lineNumber)),k=r+8,N=a-16,_=p??u4(e,u?.get(e.id),N,g,E,b,C,M),{nameLines:T,descLines:R,violations:G,rowHeight:I}=_,H=w.append("g").attr("class","raci-task-label-area");H.append("rect").attr("class","raci-task-label-zone").attr("x",r).attr("y",o).attr("width",a).attr("height",I).attr("fill","transparent").attr("pointer-events","all");let O=o+g/2+6,D=H.append("text").attr("class","raci-task-label").attr("x",k).attr("y",O).attr("dominant-baseline","central").attr("font-size",g).attr("fill",l.text);T.forEach((B,Y)=>{let V=D.append("tspan").attr("x",k).text(B);Y>0&&V.attr("dy",iL)});let W=O+Math.max(0,T.length-1)*iL+g/2+4+C;if(R.length>0){let B=H.append("text").attr("class","raci-task-description").attr("x",k).attr("y",W).attr("dominant-baseline","central").attr("font-size",E).attr("fill",l.textMuted);R.forEach((Y,V)=>{let j=B.append("tspan").attr("x",k).text(Y);V>0&&j.attr("dy",sL)}),W+=R.length*sL}for(let B of G){let Y=B.severity==="error"?l.colors.red:l.colors.orange,V=H.append("g").attr("class","raci-violation-line").attr("data-severity",B.severity).style("cursor",m?"pointer":"default"),j=g-2,K=V.append("text").attr("x",k).attr("y",W).attr("dominant-baseline","central").attr("font-size",j).attr("fill",Y);if(B.lines.forEach(($,U)=>{Kct($).forEach((q,et)=>{let tt=K.append("tspan").text(q.text);U>0&&et===0&&tt.attr("x",k).attr("dy",M),q.bold&&tt.attr("font-weight",700)})}),m){let $=B.sourceLine;V.on("click",U=>{U.stopPropagation(),m($)})}W+=B.lines.length*M}let z=new Map;for(let B of e.roleAssignments)z.set(B.id,B.markers);let P=rd[n.variant].alphabet;n.roles.forEach((B,Y)=>{let V=S+4,j=i(Y)+V,K=o+y,$=s-2*V,U=b-2*y,X=z.get(B)??[],q=o4(X,P),et=e.roleAssignments.find(Z=>Z.id===B),tt=w.append("g").attr("class","raci-cell").attr("data-task-id",e.id).attr("data-role-id",B);et&&tt.attr("data-line-number",String(et.lineNumber)),tt.append("rect").attr("class","raci-cell-hit").attr("x",i(Y)+S).attr("y",o).attr("width",s-2*S).attr("height",b).attr("fill","transparent").attr("pointer-events","all");let F=Mp*(q.length-1),Q=q.length>0?($-F)/q.length:0,ot=Lb[n.variant];q.forEach((Z,lt)=>{let nt=lL(Z,l),J=d?nt:Gt(nt,c,kb),at=nt,it=j+lt*(Q+Mp),vt=tt.append("g").attr("class","raci-marker-slice").attr("data-marker",Z).style("cursor","grab");vt.append("rect").attr("x",it).attr("y",K).attr("width",Q).attr("height",U).attr("rx",x).attr("fill",J).attr("stroke",at).attr("stroke-width",L);let Tt=ot[Z]??Z,rt=_t(Tt,A)+16<=Q,pt=rt?Tt:Z,ht=rt?A:v;vt.append("text").attr("x",it+Q/2).attr("y",K+U/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",ht).attr("font-weight",Bct).attr("fill",d?ve(J,l.textOnFillLight,l.textOnFillDark):l.text).text(pt)}),tt.append("rect").attr("class","raci-cell-drop-preview").attr("x",j).attr("y",K).attr("width",$).attr("height",U).attr("rx",x).attr("fill","transparent").attr("stroke","transparent").attr("pointer-events","none"),m&&et&&tt.on("click",()=>m(et.lineNumber))})}function u4(t,e,n,r=c4,o=l4,a=a4,i=s4,s=i4){let l=Tn(t.displayName,r,n,{hardBreak:!0}),c=t.description?.trim()??"",d=c.length>0?c.split(`
308
+ Georgia heat: 2`}},S2t=Object.values(sa)});function Nv(t){return t}var Mv=st(()=>{"use strict"});function Ry(t){if(t==null)return Nv;var e,n,r=t.scale[0],o=t.scale[1],a=t.translate[0],i=t.translate[1];return function(s,l){l||(e=n=0);var c=2,d=s.length,u=new Array(d);for(u[0]=(e+=s[0])*r+a,u[1]=(n+=s[1])*o+i;c<d;)u[c]=s[c],++c;return u}}var Iy=st(()=>{"use strict";Mv()});var Tv=st(()=>{"use strict";Iy()});function HW(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}var WW=st(()=>{"use strict"});function Jl(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return BW(t,n)})}:BW(t,e)}function BW(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,a=Cv(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:a}:r==null?{type:"Feature",id:n,properties:o,geometry:a}:{type:"Feature",id:n,bbox:r,properties:o,geometry:a}}function Cv(t,e){var n=Ry(t.transform),r=t.arcs;function o(d,u){u.length&&u.pop();for(var f=r[d<0?~d:d],p=0,m=f.length;p<m;++p)u.push(n(f[p],p));d<0&&HW(u,m)}function a(d){return n(d)}function i(d){for(var u=[],f=0,p=d.length;f<p;++f)o(d[f],u);return u.length<2&&u.push(u[0]),u}function s(d){for(var u=i(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(s)}function c(d){var u=d.type,f;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(c)};case"Point":f=a(d.coordinates);break;case"MultiPoint":f=d.coordinates.map(a);break;case"LineString":f=i(d.arcs);break;case"MultiLineString":f=d.arcs.map(i);break;case"Polygon":f=l(d.arcs);break;case"MultiPolygon":f=d.arcs.map(l);break;default:return null}return{type:u,coordinates:f}}return c(e)}var Py=st(()=>{"use strict";WW();Iy()});var _v=st(()=>{"use strict"});var FW=st(()=>{"use strict";Py();_v()});var YW=st(()=>{"use strict";Py();_v()});function Av(t,e){for(var n=0,r=t.length;n<r;){var o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var zW=st(()=>{"use strict"});function Rv(t){var e={},n=t.map(function(){return[]});function r(h,g){h.forEach(function(E){E<0&&(E=~E);var y=e[E];y?y.push(g):e[E]=[g]})}function o(h,g){h.forEach(function(E){r(E,g)})}function a(h,g){h.type==="GeometryCollection"?h.geometries.forEach(function(E){a(E,g)}):h.type in i&&i[h.type](h.arcs,g)}var i={LineString:r,MultiLineString:o,Polygon:o,MultiPolygon:function(h,g){h.forEach(function(E){o(E,g)})}};t.forEach(a);for(var s in e)for(var l=e[s],c=l.length,d=0;d<c;++d)for(var u=d+1;u<c;++u){var f=l[d],p=l[u],m;(m=n[f])[s=Av(m,p)]!==p&&m.splice(s,0,p),(m=n[p])[s=Av(m,f)]!==f&&m.splice(s,0,f)}return n}var VW=st(()=>{"use strict";zW()});var Iv=st(()=>{"use strict";Mv()});var UW=st(()=>{"use strict";Tv();Iv()});var Pv=st(()=>{"use strict";Tv();Py();FW();YW();VW();UW();Iy();Iv()});function KW(t){return t>1?0:t<-1?bn:Math.acos(t)}function Io(t){return t>1?yo:t<-1?-yo:Math.asin(t)}var yn,Dy,bn,yo,zd,Xr,Pr,Un,En,Oy,la,Cn,XW,jW,Ln,Vd,bo,qW,Er=st(()=>{"use strict";yn=1e-6,Dy=1e-12,bn=Math.PI,yo=bn/2,zd=bn/4,Xr=bn*2,Pr=180/bn,Un=bn/180,En=Math.abs,Oy=Math.atan,la=Math.atan2,Cn=Math.cos,XW=Math.exp,jW=Math.log,Ln=Math.sin,Vd=Math.sign||function(t){return t>0?1:t<0?-1:0},bo=Math.sqrt,qW=Math.tan});function Dr(){}var tc=st(()=>{"use strict"});function Gy(t,e){t&&QW.hasOwnProperty(t.type)&&QW[t.type](t,e)}function Dv(t,e,n){var r=-1,o=t.length-n,a;for(e.lineStart();++r<o;)a=t[r],e.point(a[0],a[1],a[2]);e.lineEnd()}function JW(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)Dv(t[n],e,1);e.polygonEnd()}function Ha(t,e){t&&ZW.hasOwnProperty(t.type)?ZW[t.type](t,e):Gy(t,e)}var ZW,QW,Qf=st(()=>{"use strict";ZW={Feature:function(t,e){Gy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)Gy(n[r].geometry,e)}},QW={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){Dv(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)Dv(n[r],e,0)},Polygon:function(t,e){JW(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)JW(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)Gy(n[r],e)}}});function Qat(){ii.point=tit}function Jat(){nB(tB,eB)}function tit(t,e){ii.point=nB,tB=t,eB=e,t*=Un,e*=Un,Ov=t,Gv=Cn(e=e/2+zd),$v=Ln(e)}function nB(t,e){t*=Un,e*=Un,e=e/2+zd;var n=t-Ov,r=n>=0?1:-1,o=r*n,a=Cn(e),i=Ln(e),s=$v*i,l=Gv*a+s*Cn(o),c=s*r*Ln(o);Jf.add(la(c,l)),Ov=t,Gv=a,$v=i}function Hv(t){return $y=new qr,Ha(t,ii),$y*2}var Jf,$y,tB,eB,Ov,Gv,$v,ii,Wv=st(()=>{"use strict";No();Er();tc();Qf();Jf=new qr,$y=new qr,ii={point:Dr,lineStart:Dr,lineEnd:Dr,polygonStart:function(){Jf=new qr,ii.lineStart=Qat,ii.lineEnd=Jat},polygonEnd:function(){var t=+Jf;$y.add(t<0?Xr+t:t),this.lineStart=this.lineEnd=this.point=Dr},sphere:function(){$y.add(Xr)}}});function ec(t){return[la(t[1],t[0]),Io(t[2])]}function Wa(t){var e=t[0],n=t[1],r=Cn(n);return[r*Cn(e),r*Ln(e),Ln(n)]}function tp(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ps(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Hy(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ep(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function nc(t){var e=bo(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Ud=st(()=>{"use strict";Er()});function Bv(t,e){dl.push(hs=[Or=t,zr=t]),e<Jo&&(Jo=e),e>da&&(da=e)}function lB(t,e){var n=Wa([t*Un,e*Un]);if(Xd){var r=ps(Xd,n),o=[r[1],-r[0],0],a=ps(o,r);nc(a),a=ec(a);var i=t-rc,s=i>0?1:-1,l=a[0]*Pr*s,c,d=En(i)>180;d^(s*rc<l&&l<s*t)?(c=a[1]*Pr,c>da&&(da=c)):(l=(l+360)%360-180,d^(s*rc<l&&l<s*t)?(c=-a[1]*Pr,c<Jo&&(Jo=c)):(e<Jo&&(Jo=e),e>da&&(da=e))),d?t<rc?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t):zr>=Or?(t<Or&&(Or=t),t>zr&&(zr=t)):t>rc?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t)}else dl.push(hs=[Or=t,zr=t]);e<Jo&&(Jo=e),e>da&&(da=e),Xd=n,rc=t}function rB(){ms.point=lB}function oB(){hs[0]=Or,hs[1]=zr,ms.point=Bv,Xd=null}function cB(t,e){if(Xd){var n=t-rc;np.add(En(n)>180?n+(n>0?360:-360):n)}else iB=t,sB=e;ii.point(t,e),lB(t,e)}function eit(){ii.lineStart()}function nit(){cB(iB,sB),ii.lineEnd(),En(np)>yn&&(Or=-(zr=180)),hs[0]=Or,hs[1]=zr,Xd=null}function ca(t,e){return(e-=t)<0?e+360:e}function rit(t,e){return t[0]-e[0]}function aB(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function gs(t){var e,n,r,o,a,i,s;if(da=zr=-(Or=Jo=1/0),dl=[],Ha(t,ms),n=dl.length){for(dl.sort(rit),e=1,r=dl[0],a=[r];e<n;++e)o=dl[e],aB(r,o[0])||aB(r,o[1])?(ca(r[0],o[1])>ca(r[0],r[1])&&(r[1]=o[1]),ca(o[0],r[1])>ca(r[0],r[1])&&(r[0]=o[0])):a.push(r=o);for(i=-1/0,n=a.length-1,e=0,r=a[n];e<=n;r=o,++e)o=a[e],(s=ca(r[1],o[0]))>i&&(i=s,Or=o[0],zr=r[1])}return dl=hs=null,Or===1/0||Jo===1/0?[[NaN,NaN],[NaN,NaN]]:[[Or,Jo],[zr,da]]}var Or,Jo,zr,da,rc,iB,sB,Xd,np,dl,hs,ms,dB=st(()=>{"use strict";No();Wv();Ud();Er();Qf();ms={point:Bv,lineStart:rB,lineEnd:oB,polygonStart:function(){ms.point=cB,ms.lineStart=eit,ms.lineEnd=nit,np=new qr,ii.polygonStart()},polygonEnd:function(){ii.polygonEnd(),ms.point=Bv,ms.lineStart=rB,ms.lineEnd=oB,Jf<0?(Or=-(zr=180),Jo=-(da=90)):np>yn?da=90:np<-yn&&(Jo=-90),hs[0]=Or,hs[1]=zr},sphere:function(){Or=-(zr=180),Jo=-(da=90)}}});function rp(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}var Fv=st(()=>{"use strict"});function Yv(t,e){return En(t)>bn&&(t-=Math.round(t/Xr)*Xr),[t,e]}function zv(t,e,n){return(t%=Xr)?e||n?rp(fB(t),pB(e,n)):fB(t):e||n?pB(e,n):Yv}function uB(t){return function(e,n){return e+=t,En(e)>bn&&(e-=Math.round(e/Xr)*Xr),[e,n]}}function fB(t){var e=uB(t);return e.invert=uB(-t),e}function pB(t,e){var n=Cn(t),r=Ln(t),o=Cn(e),a=Ln(e);function i(s,l){var c=Cn(l),d=Cn(s)*c,u=Ln(s)*c,f=Ln(l),p=f*n+d*r;return[la(u*o-p*a,d*n-f*r),Io(p*o+u*a)]}return i.invert=function(s,l){var c=Cn(l),d=Cn(s)*c,u=Ln(s)*c,f=Ln(l),p=f*o-u*a;return[la(u*o+f*a,d*n+p*r),Io(p*n-d*r)]},i}function mB(t){t=zv(t[0]*Un,t[1]*Un,t.length>2?t[2]*Un:0);function e(n){return n=t(n[0]*Un,n[1]*Un),n[0]*=Pr,n[1]*=Pr,n}return e.invert=function(n){return n=t.invert(n[0]*Un,n[1]*Un),n[0]*=Pr,n[1]*=Pr,n},e}var Vv=st(()=>{"use strict";Fv();Er();Yv.invert=Yv});function gB(t,e,n,r,o,a){if(n){var i=Cn(e),s=Ln(e),l=r*n;o==null?(o=e+r*Xr,a=e-l/2):(o=hB(i,o),a=hB(i,a),(r>0?o<a:o>a)&&(o+=r*Xr));for(var c,d=o;r>0?d>a:d<a;d-=l)c=ec([i,-s*Cn(d),-s*Ln(d)]),t.point(c[0],c[1])}}function hB(t,e){e=Wa(e),e[0]-=t,nc(e);var n=KW(-e[1]);return((-e[2]<0?-n:n)+Xr-yn)%Xr}var yB=st(()=>{"use strict";Ud();Er()});function Wy(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Dr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}var Uv=st(()=>{"use strict";tc()});function jd(t,e){return En(t[0]-e[0])<yn&&En(t[1]-e[1])<yn}var Xv=st(()=>{"use strict";Er()});function By(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Fy(t,e,n,r,o){var a=[],i=[],s,l;if(t.forEach(function(m){if(!((h=m.length-1)<=0)){var h,g=m[0],E=m[h],y;if(jd(g,E)){if(!g[2]&&!E[2]){for(o.lineStart(),s=0;s<h;++s)o.point((g=m[s])[0],g[1]);o.lineEnd();return}E[0]+=2*yn}a.push(y=new By(g,m,null,!0)),i.push(y.o=new By(g,null,y,!1)),a.push(y=new By(E,m,null,!1)),i.push(y.o=new By(E,null,y,!0))}}),!!a.length){for(i.sort(e),bB(a),bB(i),s=0,l=i.length;s<l;++s)i[s].e=n=!n;for(var c=a[0],d,u;;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;d=f.z,o.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,l=d.length;s<l;++s)o.point((u=d[s])[0],u[1]);else r(f.x,f.n.x,1,o);f=f.n}else{if(p)for(d=f.p.z,s=d.length-1;s>=0;--s)o.point((u=d[s])[0],u[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,d=f.z,p=!p}while(!f.v);o.lineEnd()}}}function bB(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}var jv=st(()=>{"use strict";Xv();Er()});function qv(t){return En(t[0])<=bn?t[0]:Vd(t[0])*((En(t[0])+bn)%Xr-bn)}function xB(t,e){var n=qv(e),r=e[1],o=Ln(r),a=[Ln(n),-Cn(n),0],i=0,s=0,l=new qr;o===1?r=yo+yn:o===-1&&(r=-yo-yn);for(var c=0,d=t.length;c<d;++c)if(f=(u=t[c]).length)for(var u,f,p=u[f-1],m=qv(p),h=p[1]/2+zd,g=Ln(h),E=Cn(h),y=0;y<f;++y,m=S,g=L,E=v,p=b){var b=u[y],S=qv(b),x=b[1]/2+zd,L=Ln(x),v=Cn(x),A=S-m,C=A>=0?1:-1,M=C*A,w=M>bn,k=g*L;if(l.add(la(k*C*Ln(M),E*v+k*Cn(M))),i+=w?A+C*Xr:A,w^m>=n^S>=n){var N=ps(Wa(p),Wa(b));nc(N);var _=ps(a,N);nc(_);var T=(w^A>=0?-1:1)*Io(_[2]);(r>T||r===T&&(N[0]||N[1]))&&(s+=w^A>=0?1:-1)}}return(i<-yn||i<yn&&l<-Dy)^s&1}var wB=st(()=>{"use strict";No();Ud();Er()});function Yy(t,e,n,r){return function(o){var a=e(o),i=Wy(),s=e(i),l=!1,c,d,u,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=E,f.lineStart=y,f.lineEnd=b,d=[],c=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,d=vc(d);var S=xB(c,r);d.length?(l||(o.polygonStart(),l=!0),Fy(d,ait,S,n,o)):S&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),d=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function p(S,x){t(S,x)&&o.point(S,x)}function m(S,x){a.point(S,x)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function E(S,x){u.push([S,x]),s.point(S,x)}function y(){s.lineStart(),u=[]}function b(){E(u[0][0],u[0][1]),s.lineEnd();var S=s.clean(),x=i.result(),L,v=x.length,A,C,M;if(u.pop(),c.push(u),u=null,!!v){if(S&1){if(C=x[0],(A=C.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),L=0;L<A;++L)o.point((M=C[L])[0],M[1]);o.lineEnd()}return}v>1&&S&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(oit))}}return f}}function oit(t){return t.length>1}function ait(t,e){return((t=t.x)[0]<0?t[1]-yo-yn:yo-t[1])-((e=e.x)[0]<0?e[1]-yo-yn:yo-e[1])}var Kv=st(()=>{"use strict";Uv();jv();Er();wB();No()});function iit(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(a,i){var s=a>0?bn:-bn,l=En(a-e);En(l-bn)<yn?(t.point(e,n=(n+i)/2>0?yo:-yo),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),o=0):r!==s&&l>=bn&&(En(e-r)<yn&&(e-=r*yn),En(a-s)<yn&&(a-=s*yn),n=sit(e,n,a,i),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),o=0),t.point(e=a,n=i),r=s},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function sit(t,e,n,r){var o,a,i=Ln(t-n);return En(i)>yn?Oy((Ln(e)*(a=Cn(r))*Ln(n)-Ln(r)*(o=Cn(e))*Ln(t))/(o*a*i)):(e+r)/2}function lit(t,e,n,r){var o;if(t==null)o=n*yo,r.point(-bn,o),r.point(0,o),r.point(bn,o),r.point(bn,0),r.point(bn,-o),r.point(0,-o),r.point(-bn,-o),r.point(-bn,0),r.point(-bn,o);else if(En(t[0]-e[0])>yn){var a=t[0]<e[0]?bn:-bn;o=n*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(e[0],e[1])}var Zv,EB=st(()=>{"use strict";Kv();Er();Zv=Yy(function(){return!0},iit,lit,[-bn,-yo])});function SB(t){var e=Cn(t),n=2*Un,r=e>0,o=En(e)>yn;function a(d,u,f,p){gB(p,t,n,f,d,u)}function i(d,u){return Cn(d)*Cn(u)>e}function s(d){var u,f,p,m,h;return{lineStart:function(){m=p=!1,h=1},point:function(g,E){var y=[g,E],b,S=i(g,E),x=r?S?0:c(g,E):S?c(g+(g<0?bn:-bn),E):0;if(!u&&(m=p=S)&&d.lineStart(),S!==p&&(b=l(u,y),(!b||jd(u,b)||jd(y,b))&&(y[2]=1)),S!==p)h=0,S?(d.lineStart(),b=l(y,u),d.point(b[0],b[1])):(b=l(u,y),d.point(b[0],b[1],2),d.lineEnd()),u=b;else if(o&&u&&r^S){var L;!(x&f)&&(L=l(y,u,!0))&&(h=0,r?(d.lineStart(),d.point(L[0][0],L[0][1]),d.point(L[1][0],L[1][1]),d.lineEnd()):(d.point(L[1][0],L[1][1]),d.lineEnd(),d.lineStart(),d.point(L[0][0],L[0][1],3)))}S&&(!u||!jd(u,y))&&d.point(y[0],y[1]),u=y,p=S,f=x},lineEnd:function(){p&&d.lineEnd(),u=null},clean:function(){return h|(m&&p)<<1}}}function l(d,u,f){var p=Wa(d),m=Wa(u),h=[1,0,0],g=ps(p,m),E=tp(g,g),y=g[0],b=E-y*y;if(!b)return!f&&d;var S=e*E/b,x=-e*y/b,L=ps(h,g),v=ep(h,S),A=ep(g,x);Hy(v,A);var C=L,M=tp(v,C),w=tp(C,C),k=M*M-w*(tp(v,v)-1);if(!(k<0)){var N=bo(k),_=ep(C,(-M-N)/w);if(Hy(_,v),_=ec(_),!f)return _;var T=d[0],R=u[0],G=d[1],I=u[1],H;R<T&&(H=T,T=R,R=H);var O=R-T,D=En(O-bn)<yn,W=D||O<yn;if(!D&&I<G&&(H=G,G=I,I=H),W?D?G+I>0^_[1]<(En(_[0]-T)<yn?G:I):G<=_[1]&&_[1]<=I:O>bn^(T<=_[0]&&_[0]<=R)){var z=ep(C,(-M+N)/w);return Hy(z,v),[_,ec(z)]}}}function c(d,u){var f=r?t:bn-t,p=0;return d<-f?p|=1:d>f&&(p|=2),u<-f?p|=4:u>f&&(p|=8),p}return Yy(i,s,a,r?[0,-t]:[-bn,t-bn])}var vB=st(()=>{"use strict";Ud();yB();Er();Xv();Kv()});function kB(t,e,n,r,o,a){var i=t[0],s=t[1],l=e[0],c=e[1],d=0,u=1,f=l-i,p=c-s,m;if(m=n-i,!(!f&&m>0)){if(m/=f,f<0){if(m<d)return;m<u&&(u=m)}else if(f>0){if(m>u)return;m>d&&(d=m)}if(m=o-i,!(!f&&m<0)){if(m/=f,f<0){if(m>u)return;m>d&&(d=m)}else if(f>0){if(m<d)return;m<u&&(u=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<d)return;m<u&&(u=m)}else if(p>0){if(m>u)return;m>d&&(d=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>u)return;m>d&&(d=m)}else if(p>0){if(m<d)return;m<u&&(u=m)}return d>0&&(t[0]=i+d*f,t[1]=s+d*p),u<1&&(e[0]=i+u*f,e[1]=s+u*p),!0}}}}}var LB=st(()=>{"use strict"});function Qv(t,e,n,r){function o(c,d){return t<=c&&c<=n&&e<=d&&d<=r}function a(c,d,u,f){var p=0,m=0;if(c==null||(p=i(c,u))!==(m=i(d,u))||l(c,d)<0^u>0)do f.point(p===0||p===3?t:n,p>1?r:e);while((p=(p+u+4)%4)!==m);else f.point(d[0],d[1])}function i(c,d){return En(c[0]-t)<yn?d>0?0:3:En(c[0]-n)<yn?d>0?2:1:En(c[1]-e)<yn?d>0?1:0:d>0?3:2}function s(c,d){return l(c.x,d.x)}function l(c,d){var u=i(c,1),f=i(d,1);return u!==f?u-f:u===0?d[1]-c[1]:u===1?c[0]-d[0]:u===2?c[1]-d[1]:d[0]-c[0]}return function(c){var d=c,u=Wy(),f,p,m,h,g,E,y,b,S,x,L,v={point:A,lineStart:k,lineEnd:N,polygonStart:M,polygonEnd:w};function A(T,R){o(T,R)&&d.point(T,R)}function C(){for(var T=0,R=0,G=p.length;R<G;++R)for(var I=p[R],H=1,O=I.length,D=I[0],W,z,P=D[0],B=D[1];H<O;++H)W=P,z=B,D=I[H],P=D[0],B=D[1],z<=r?B>r&&(P-W)*(r-z)>(B-z)*(t-W)&&++T:B<=r&&(P-W)*(r-z)<(B-z)*(t-W)&&--T;return T}function M(){d=u,f=[],p=[],L=!0}function w(){var T=C(),R=L&&T,G=(f=vc(f)).length;(R||G)&&(c.polygonStart(),R&&(c.lineStart(),a(null,null,1,c),c.lineEnd()),G&&Fy(f,s,T,a,c),c.polygonEnd()),d=c,f=p=m=null}function k(){v.point=_,p&&p.push(m=[]),x=!0,S=!1,y=b=NaN}function N(){f&&(_(h,g),E&&S&&u.rejoin(),f.push(u.result())),v.point=A,S&&d.lineEnd()}function _(T,R){var G=o(T,R);if(p&&m.push([T,R]),x)h=T,g=R,E=G,x=!1,G&&(d.lineStart(),d.point(T,R));else if(G&&S)d.point(T,R);else{var I=[y=Math.max(zy,Math.min(op,y)),b=Math.max(zy,Math.min(op,b))],H=[T=Math.max(zy,Math.min(op,T)),R=Math.max(zy,Math.min(op,R))];kB(I,H,t,e,n,r)?(S||(d.lineStart(),d.point(I[0],I[1])),d.point(H[0],H[1]),G||d.lineEnd(),L=!1):G&&(d.lineStart(),d.point(T,R),L=!1)}y=T,b=R,S=G}return v}}var op,zy,NB=st(()=>{"use strict";Er();Uv();LB();jv();No();op=1e9,zy=-op});var ap,Jv=st(()=>{"use strict";ap=t=>t});function cit(){ul.point=dit}function dit(t,e){ul.point=CB,MB=nk=t,TB=rk=e}function CB(t,e){ek.add(rk*t-nk*e),nk=t,rk=e}function uit(){CB(MB,TB)}var tk,ek,MB,TB,nk,rk,ul,ok,_B=st(()=>{"use strict";No();Er();tc();tk=new qr,ek=new qr,ul={point:Dr,lineStart:Dr,lineEnd:Dr,polygonStart:function(){ul.lineStart=cit,ul.lineEnd=uit},polygonEnd:function(){ul.lineStart=ul.lineEnd=ul.point=Dr,tk.add(En(ek)),ek=new qr},result:function(){var t=tk/2;return tk=new qr,t}};ok=ul});function pit(t,e){t<qd&&(qd=t),t>ip&&(ip=t),e<Vy&&(Vy=e),e>Uy&&(Uy=e)}var qd,Vy,ip,Uy,fit,Kd,ak=st(()=>{"use strict";tc();qd=1/0,Vy=qd,ip=-qd,Uy=ip,fit={point:pit,lineStart:Dr,lineEnd:Dr,polygonStart:Dr,polygonEnd:Dr,result:function(){var t=[[qd,Vy],[ip,Uy]];return ip=Uy=-(Vy=qd=1/0),t}};Kd=fit});function oc(t,e){ik+=t,sk+=e,++sp}function AB(){si.point=mit}function mit(t,e){si.point=hit,oc(Fi=t,Yi=e)}function hit(t,e){var n=t-Fi,r=e-Yi,o=bo(n*n+r*r);Xy+=o*(Fi+t)/2,jy+=o*(Yi+e)/2,Zd+=o,oc(Fi=t,Yi=e)}function RB(){si.point=oc}function git(){si.point=bit}function yit(){DB(IB,PB)}function bit(t,e){si.point=DB,oc(IB=Fi=t,PB=Yi=e)}function DB(t,e){var n=t-Fi,r=e-Yi,o=bo(n*n+r*r);Xy+=o*(Fi+t)/2,jy+=o*(Yi+e)/2,Zd+=o,o=Yi*t-Fi*e,lk+=o*(Fi+t),ck+=o*(Yi+e),lp+=o*3,oc(Fi=t,Yi=e)}var ik,sk,sp,Xy,jy,Zd,lk,ck,lp,IB,PB,Fi,Yi,si,dk,OB=st(()=>{"use strict";Er();ik=0,sk=0,sp=0,Xy=0,jy=0,Zd=0,lk=0,ck=0,lp=0,si={point:oc,lineStart:AB,lineEnd:RB,polygonStart:function(){si.lineStart=git,si.lineEnd=yit},polygonEnd:function(){si.point=oc,si.lineStart=AB,si.lineEnd=RB},result:function(){var t=lp?[lk/lp,ck/lp]:Zd?[Xy/Zd,jy/Zd]:sp?[ik/sp,sk/sp]:[NaN,NaN];return ik=sk=sp=Xy=jy=Zd=lk=ck=lp=0,t}};dk=si});function qy(t){this._context=t}var GB=st(()=>{"use strict";Er();tc();qy.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Xr);break}}},result:Dr}});function xit(t,e){Ky.point=WB,$B=cp=t,HB=dp=e}function WB(t,e){cp-=t,dp-=e,fk.add(bo(cp*cp+dp*dp)),cp=t,dp=e}var fk,uk,$B,HB,cp,dp,Ky,pk,BB=st(()=>{"use strict";No();Er();tc();fk=new qr,Ky={point:Dr,lineStart:function(){Ky.point=xit},lineEnd:function(){uk&&WB($B,HB),Ky.point=Dr},polygonStart:function(){uk=!0},polygonEnd:function(){uk=null},result:function(){var t=+fk;return fk=new qr,t}};pk=Ky});function VB(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function wit(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return VB;if(e!==FB){let n=10**e;FB=e,Zy=function(o){let a=1;this._+=o[0];for(let i=o.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+o[a]}}return Zy}var FB,Zy,YB,zB,Qd,UB=st(()=>{"use strict";Qd=class{constructor(e){this._append=e==null?VB:wit(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==YB||this._append!==Zy){let r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,YB=r,Zy=this._append,zB=this._,this._=o}this._+=zB;break}}}result(){let e=this._;return this._="",e.length?e:null}}});function Ba(t,e){let n=3,r=4.5,o,a;function i(s){return s&&(typeof r=="function"&&a.pointRadius(+r.apply(this,arguments)),Ha(s,o(a))),a.result()}return i.area=function(s){return Ha(s,o(ok)),ok.result()},i.measure=function(s){return Ha(s,o(pk)),pk.result()},i.bounds=function(s){return Ha(s,o(Kd)),Kd.result()},i.centroid=function(s){return Ha(s,o(dk)),dk.result()},i.projection=function(s){return arguments.length?(o=s==null?(t=null,ap):(t=s).stream,i):t},i.context=function(s){return arguments.length?(a=s==null?(e=null,new Qd(n)):new qy(e=s),typeof r!="function"&&a.pointRadius(r),i):e},i.pointRadius=function(s){return arguments.length?(r=typeof s=="function"?s:(a.pointRadius(+s),+s),i):r},i.digits=function(s){if(!arguments.length)return n;if(s==null)n=null;else{let l=Math.floor(s);if(!(l>=0))throw new RangeError(`invalid digits: ${s}`);n=l}return e===null&&(a=new Qd(n)),i},i.projection(t).digits(n).context(e)}var XB=st(()=>{"use strict";Jv();Qf();_B();ak();OB();GB();BB();UB()});function Qy(t){return{stream:Jd(t)}}function Jd(t){return function(e){var n=new mk;for(var r in t)n[r]=t[r];return n.stream=e,n}}function mk(){}var Jy=st(()=>{"use strict";mk.prototype={constructor:mk,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}});function hk(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),Ha(n,t.stream(Kd)),e(Kd.result()),r!=null&&t.clipExtent(r),t}function gk(t,e,n){return hk(t,function(r){var o=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=Math.min(o/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+e[0][0]+(o-i*(r[1][0]+r[0][0]))/2,l=+e[0][1]+(a-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,l])},n)}function jB(t,e,n){return gk(t,[[0,0],e],n)}function qB(t,e,n){return hk(t,function(r){var o=+e,a=o/(r[1][0]-r[0][0]),i=(o-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([i,s])},n)}function KB(t,e,n){return hk(t,function(r){var o=+e,a=o/(r[1][1]-r[0][1]),i=-a*r[0][0],s=(o-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([i,s])},n)}var ZB=st(()=>{"use strict";Qf();ak()});function yk(t,e){return+e?vit(t,e):Sit(t)}function Sit(t){return Jd({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function vit(t,e){function n(r,o,a,i,s,l,c,d,u,f,p,m,h,g){var E=c-r,y=d-o,b=E*E+y*y;if(b>4*e&&h--){var S=i+f,x=s+p,L=l+m,v=bo(S*S+x*x+L*L),A=Io(L/=v),C=En(En(L)-1)<yn||En(a-u)<yn?(a+u)/2:la(x,S),M=t(C,A),w=M[0],k=M[1],N=w-r,_=k-o,T=y*N-E*_;(T*T/b>e||En((E*N+y*_)/b-.5)>.3||i*f+s*p+l*m<Eit)&&(n(r,o,a,i,s,l,w,k,C,S/=v,x/=v,L,h,g),g.point(w,k),n(w,k,C,S,x,L,c,d,u,f,p,m,h,g))}}return function(r){var o,a,i,s,l,c,d,u,f,p,m,h,g={point:E,lineStart:y,lineEnd:S,polygonStart:function(){r.polygonStart(),g.lineStart=x},polygonEnd:function(){r.polygonEnd(),g.lineStart=y}};function E(A,C){A=t(A,C),r.point(A[0],A[1])}function y(){u=NaN,g.point=b,r.lineStart()}function b(A,C){var M=Wa([A,C]),w=t(A,C);n(u,f,d,p,m,h,u=w[0],f=w[1],d=A,p=M[0],m=M[1],h=M[2],QB,r),r.point(u,f)}function S(){g.point=E,r.lineEnd()}function x(){y(),g.point=L,g.lineEnd=v}function L(A,C){b(o=A,C),a=u,i=f,s=p,l=m,c=h,g.point=b}function v(){n(u,f,d,p,m,h,a,i,o,s,l,c,QB,r),g.lineEnd=S,S()}return g}}var QB,Eit,JB=st(()=>{"use strict";Ud();Er();Jy();QB=16,Eit=Cn(30*Un)});function Lit(t){return Jd({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function Nit(t,e,n,r,o){function a(i,s){return i*=r,s*=o,[e+t*i,n-t*s]}return a.invert=function(i,s){return[(i-e)/t*r,(n-s)/t*o]},a}function tF(t,e,n,r,o,a){if(!a)return Nit(t,e,n,r,o);var i=Cn(a),s=Ln(a),l=i*t,c=s*t,d=i/t,u=s/t,f=(s*n-i*e)/t,p=(s*e+i*n)/t;function m(h,g){return h*=r,g*=o,[l*h-c*g+e,n-c*h-l*g]}return m.invert=function(h,g){return[r*(d*h-u*g+f),o*(p-u*h-d*g)]},m}function ys(t){return bk(function(){return t})()}function bk(t){var e,n=150,r=480,o=250,a=0,i=0,s=0,l=0,c=0,d,u=0,f=1,p=1,m=null,h=Zv,g=null,E,y,b,S=ap,x=.5,L,v,A,C,M;function w(T){return A(T[0]*Un,T[1]*Un)}function k(T){return T=A.invert(T[0],T[1]),T&&[T[0]*Pr,T[1]*Pr]}w.stream=function(T){return C&&M===T?C:C=kit(Lit(d)(h(L(S(M=T)))))},w.preclip=function(T){return arguments.length?(h=T,m=void 0,_()):h},w.postclip=function(T){return arguments.length?(S=T,g=E=y=b=null,_()):S},w.clipAngle=function(T){return arguments.length?(h=+T?SB(m=T*Un):(m=null,Zv),_()):m*Pr},w.clipExtent=function(T){return arguments.length?(S=T==null?(g=E=y=b=null,ap):Qv(g=+T[0][0],E=+T[0][1],y=+T[1][0],b=+T[1][1]),_()):g==null?null:[[g,E],[y,b]]},w.scale=function(T){return arguments.length?(n=+T,N()):n},w.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],N()):[r,o]},w.center=function(T){return arguments.length?(a=T[0]%360*Un,i=T[1]%360*Un,N()):[a*Pr,i*Pr]},w.rotate=function(T){return arguments.length?(s=T[0]%360*Un,l=T[1]%360*Un,c=T.length>2?T[2]%360*Un:0,N()):[s*Pr,l*Pr,c*Pr]},w.angle=function(T){return arguments.length?(u=T%360*Un,N()):u*Pr},w.reflectX=function(T){return arguments.length?(f=T?-1:1,N()):f<0},w.reflectY=function(T){return arguments.length?(p=T?-1:1,N()):p<0},w.precision=function(T){return arguments.length?(L=yk(v,x=T*T),_()):bo(x)},w.fitExtent=function(T,R){return gk(w,T,R)},w.fitSize=function(T,R){return jB(w,T,R)},w.fitWidth=function(T,R){return qB(w,T,R)},w.fitHeight=function(T,R){return KB(w,T,R)};function N(){var T=tF(n,0,0,f,p,u).apply(null,e(a,i)),R=tF(n,r-T[0],o-T[1],f,p,u);return d=zv(s,l,c),v=rp(e,R),A=rp(d,v),L=yk(v,x),_()}function _(){return C=M=null,w}return function(){return e=t.apply(this,arguments),w.invert=e.invert&&k,N()}}var kit,tu=st(()=>{"use strict";EB();vB();NB();Fv();Jv();Er();Vv();Jy();ZB();JB();kit=Jd({point:function(t,e){this.stream.point(t*Un,e*Un)}})});function eF(t){var e=0,n=bn/3,r=bk(t),o=r(e,n);return o.parallels=function(a){return arguments.length?r(e=a[0]*Un,n=a[1]*Un):[e*Pr,n*Pr]},o}var nF=st(()=>{"use strict";Er();tu()});function rF(t){var e=Cn(t);function n(r,o){return[r*e,Ln(o)/e]}return n.invert=function(r,o){return[r/e,Io(o*e)]},n}var oF=st(()=>{"use strict";Er()});function aF(t,e){var n=Ln(t),r=(n+Ln(e))/2;if(En(r)<yn)return rF(t);var o=1+n*(2*r-n),a=bo(o)/r;function i(s,l){var c=bo(o-2*r*Ln(l))/r;return[c*Ln(s*=r),a-c*Cn(s)]}return i.invert=function(s,l){var c=a-l,d=la(s,En(c))*Vd(c);return c*r<0&&(d-=bn*Vd(s)*Vd(c)),[d/r,Io((o-(s*s+c*c)*r*r)/(2*r))]},i}function up(){return eF(aF).scale(155.424).center([0,33.6442])}var iF=st(()=>{"use strict";Er();nF();oF()});function tb(t,e){return[t,jW(qW((yo+e)/2))]}function eb(){return Mit(tb).scale(961/Xr)}function Mit(t){var e=ys(t),n=e.center,r=e.scale,o=e.translate,a=e.clipExtent,i=null,s,l,c;e.scale=function(u){return arguments.length?(r(u),d()):r()},e.translate=function(u){return arguments.length?(o(u),d()):o()},e.center=function(u){return arguments.length?(n(u),d()):n()},e.clipExtent=function(u){return arguments.length?(u==null?i=s=l=c=null:(i=+u[0][0],s=+u[0][1],l=+u[1][0],c=+u[1][1]),d()):i==null?null:[[i,s],[l,c]]};function d(){var u=bn*r(),f=e(mB(e.rotate()).invert([0,0]));return a(i==null?[[f[0]-u,f[1]-u],[f[0]+u,f[1]+u]]:t===tb?[[Math.max(f[0]-u,i),s],[Math.min(f[0]+u,l),c]]:[[i,Math.max(f[1]-u,s)],[l,Math.min(f[1]+u,c)]])}return d()}var sF=st(()=>{"use strict";Er();Vv();tu();tb.invert=function(t,e){return[t,2*Oy(XW(e))-yo]}});function nb(t,e){return[t,e]}function rb(){return ys(nb).scale(152.63)}var lF=st(()=>{"use strict";tu();nb.invert=nb});function xk(t,e){var n=Io(ob*Ln(e)),r=n*n,o=r*r*r;return[t*Cn(n)/(ob*(fp+3*pp*r+o*(7*mp+9*hp*r))),n*(fp+pp*r+o*(mp+hp*r))]}function wk(){return ys(xk).scale(177.158)}var fp,pp,mp,hp,ob,Tit,cF=st(()=>{"use strict";tu();Er();fp=1.340264,pp=-.081106,mp=893e-6,hp=.003796,ob=bo(3)/2,Tit=12;xk.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,a=0,i,s,l;a<Tit&&(s=n*(fp+pp*r+o*(mp+hp*r))-e,l=fp+3*pp*r+o*(7*mp+9*hp*r),n-=i=s/l,r=n*n,o=r*r*r,!(En(i)<Dy));++a);return[ob*t*(fp+3*pp*r+o*(7*mp+9*hp*r))/Cn(n),Io(Ln(n)/ob)]}});function Ek(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function Sk(){return ys(Ek).scale(175.295)}var dF=st(()=>{"use strict";tu();Er();Ek.invert=function(t,e){var n=e,r=25,o;do{var a=n*n,i=a*a;n-=o=(n*(1.007226+a*(.015085+i*(-.044475+.028874*a-.005916*i)))-e)/(1.007226+a*(.015085*3+i*(-.044475*7+.028874*9*a-.005916*11*i)))}while(En(o)>yn&&--r>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}});var ab=st(()=>{"use strict";Wv();dB();XB();iF();cF();lF();sF();dF();Jy()});function eu(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function vk(t){let e=new Map;for(let n of eu(t).geometries){let r=li(n.properties.name);e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}for(let n of eu(t).geometries){let r=n.id.toLowerCase();e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}return e}function kk(t){let e=uF.get(t);if(e)return e;let n=eu(t).geometries,r=Rv(n),o=new Map;n.forEach((i,s)=>{if(!i.type||i.type==="null")return;let l=o.get(i.id);l||(l=new Set,o.set(i.id,l));for(let c of r[s]??[]){let d=n[c]?.id;d&&d!==i.id&&l.add(d)}});let a=new Map;for(let[i,s]of o)a.set(i,[...s].sort());return uF.set(t,a),a}function Lk(t){return eu(t).geometries.map(e=>{let n=Jl(t,e);return{type:"Feature",id:e.id,properties:e.properties,geometry:n.geometry}})}function fF(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let i=n[o][0],s=n[o][1],l=n[a][0],c=n[a][1];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function pF(t,e,n){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r][0],i=n[r][1],s=n[o][0],l=n[o][1];if(t<Math.min(a,s)-gp||t>Math.max(a,s)+gp||e<Math.min(i,l)-gp||e>Math.max(i,l)+gp)continue;let c=(s-a)*(e-i)-(l-i)*(t-a);if(Math.abs(c)<=gp)return!0}return!1}function yp(t,e,n){let r=t;if(!r)return!1;let o=r.type==="Polygon"?[r.coordinates]:r.type==="MultiPolygon"?r.coordinates:[];for(let a of o){if(!a.length)continue;if(pF(e,n,a[0]))return!0;if(!fF(e,n,a[0]))continue;let i=!1;for(let s=1;s<a.length;s++)if(fF(e,n,a[s])&&!pF(e,n,a[s])){i=!0;break}if(!i)return!0}return!1}function mF(t,e,n){let r=t[0],o=t[1],a=null;for(let s of e)if(yp(s.geometry,r,o)){a={iso:s.id,name:s.properties.name};break}let i=null;if(a?.iso==="US"&&n){for(let s of n)if(yp(s.geometry,r,o)){i={iso:s.id,name:s.properties.name};break}}return{country:a,state:i}}function bp(t,e){let n=eu(t).geometries.find(a=>a.id===e);if(!n)return null;let r=Jl(t,n),o=gs(r);return!o||!Number.isFinite(o[0][0])?null:[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]}function Ait(t){let e=t.geometry??t,n=e.type,r=e.coordinates;return n==="Polygon"?[{type:"Feature",geometry:{type:"Polygon",coordinates:r}}]:n==="MultiPolygon"?r.map(o=>({type:"Feature",geometry:{type:"Polygon",coordinates:o}})):[]}function Rit(t,e){let n=Math.max(0,t[0][0]-e[1][0],e[0][0]-t[1][0]),r=Math.max(0,t[0][1]-e[1][1],e[0][1]-t[1][1]);return Math.max(n,r)}function xp(t,e){let n=eu(t).geometries.find(u=>u.id===e);if(!n)return null;let r=Jl(t,n),o=Ait(r);if(o.length<=1)return bp(t,e);let a=o.map(u=>{let f=gs(u);if(!f||!Number.isFinite(f[0][0]))return null;let p=f[1][0]<f[0][0];return{bbox:[[f[0][0],f[0][1]],[f[1][0],f[1][1]]],area:Hv(u),wraps:p}}).filter(u=>u!==null);if(a.length<=1||a.some(u=>u.wraps))return bp(t,e);let i=Math.max(...a.map(u=>u.area)),s=a.find(u=>u.area===i),l=[[s.bbox[0][0],s.bbox[0][1]],[s.bbox[1][0],s.bbox[1][1]]],c=a.filter(u=>u!==s),d=!0;for(;d;){d=!1;for(let u=c.length-1;u>=0;u--){let f=c[u],p=Rit(f.bbox,l)<=Cit,m=f.area>=_it*i;(p||m)&&(l[0][0]=Math.min(l[0][0],f.bbox[0][0]),l[0][1]=Math.min(l[0][1],f.bbox[0][1]),l[1][0]=Math.max(l[1][0],f.bbox[1][0]),l[1][1]=Math.max(l[1][1],f.bbox[1][1]),c.splice(u,1),d=!0)}}return l}function ib(t,e){let n=[],r=[];for(let l of t)n.push(l[0][1],l[1][1]),r.push(l[0][0],l[1][0]);for(let[l,c]of e)r.push(l),n.push(c);if(!n.length)return null;let o=Math.min(...n),a=Math.max(...n),{west:i,east:s}=Iit(r);return[[i,o],[s,a]]}function Iit(t){let e=[...new Set(t)].sort((a,i)=>a-i);if(e.length===1)return{west:e[0],east:e[0]};let n=-1,r=-1;for(let a=1;a<e.length;a++){let i=e[a]-e[a-1];i>n&&(n=i,r=a)}return e[0]+360-e[e.length-1]>=n?{west:e[0],east:e[e.length-1]}:{west:e[r],east:e[r-1]+360}}var li,uF,gp,Cit,_it,Nk=st(()=>{"use strict";Pv();ab();li=t=>t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim();uF=new WeakMap;gp=1e-9;Cit=10,_it=.25});var Ck={};ye(Ck,{isSubNationalUsExtent:()=>SF,resolveMap:()=>Xit});function Bit(t,e){return e?Mk:Math.max(Hit,Math.min(Mk,Mk-Wit*t))}function yF(t){return(t[1][0]-t[0][0])*(t[1][1]-t[0][1])}function SF(t){return t?yF(t)/yF(Yit)<zit:!1}function Tk(t){if(!t)return null;let e=t.toUpperCase();return Vit.has(e)?`US-${e}`:null}function xF(t,e){return t<15||t>72?!1:e>=-180&&e<=-64||e>=172}function wF(t,e){return t>=14&&t<=72&&e>=-141&&e<=-52}function Uit(t){return t[0][0]<=-179&&t[1][0]>=179&&t[0][1]<=-89&&t[1][1]>=89}function Xit(t,e){let n=[...t.diagnostics],r=new Set,o={title:t.title,...t.directives.caption!==void 0&&{caption:t.directives.caption},tagGroups:[...t.tagGroups],directives:{...t.directives},basemaps:{world:"detail",subdivisions:[]},regions:[],pois:[],edges:[],routes:[],extent:[[-180,-85],[180,85]],projection:"equirectangular",poiFrameContainers:[],diagnostics:n,error:t.error},a=vk(e.worldCoarse),i=vk(e.usStates),s=[...[...a.values()].map(Z=>Z.name),...[...i.values()].map(Z=>Z.name)],l=t.directives.locale?.toUpperCase(),c=l?l.split("-")[0]:void 0,d=l&&/^[A-Z]{2}-/.test(l)?l:void 0,u=c==="US"||t.regions.some(Z=>{let lt=li(Z.name);return i.has(lt)&&!a.has(lt)})||t.regions.some(Z=>Z.scope==="US"||Z.scope?.startsWith("US-")||Tk(Z.scope)!==null)||t.pois.some(Z=>Z.pos.kind==="name"&&(Z.pos.scope?.startsWith("US-")||Tk(Z.pos.scope)!==null)),f=[],p=new Map,m=!1,h=!1,g=!1,E=[];for(let Z of t.regions){let lt=li(Z.name),nt=a.get(lt)??(bF[lt]?a.get(bF[lt]):void 0),J=i.get(lt),at=null,it=Z.scope;if(it){let At=it==="US"||it.startsWith("US-");if(At&&J){if(it.startsWith("US-")&&J.id!==it){n.push(Ne(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it,iso:J.id}));continue}at={...J,layer:"us-state"}}else if(!At&&nt)at={...nt,layer:"country"};else{n.push(Ne(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it}));continue}}else nt&&J?u?at={...J,layer:"us-state"}:(at={...nt,layer:"country"},n.push(Ne(sa.REGION_AMBIGUOUS,Z.lineNumber,{name:Z.name,layer:at.layer,chosenId:at.id,stateId:J.id,countryId:nt.id}))):J?at={...J,layer:"us-state"}:nt&&(at={...nt,layer:"country"});if(!at){let At=be(Z.name,s);n.push(Ne(sa.UNKNOWN_SUBDIVISION,Z.lineNumber,{name:Z.name,hint:At}));continue}at.layer==="us-state"&&(m=!0,at.id==="US-AK"&&(h=!0),at.id==="US-HI"&&(g=!0),E.push({topo:"us",id:at.id}));let vt={iso:at.id,name:at.name,layer:at.layer,...Z.value!==void 0&&{value:Z.value},...Z.color!==void 0&&{color:Z.color},tags:Z.tags,meta:Z.meta,lineNumber:Z.lineNumber},Tt=p.get(at.id);Tt!==void 0?(n.push(Ne(sa.DUPLICATE_REGION,Z.lineNumber,{name:at.name})),f[Tt]=vt):(p.set(at.id,f.length),f.push(vt))}let y=new Map,b=[],S=(Z,lt,nt)=>{let J=y.get(Z);if(J){if(lt.implicit&&!J.implicit)return;!lt.implicit&&!J.implicit&&n.push(Ne(sa.DUPLICATE_POI,nt,{id:Z}));let at=b.indexOf(J);at>=0&&(b[at]=lt)}else b.push(lt);y.set(Z,lt)},x=(Z,lt,nt,J,at)=>{let it=li(Z),vt=e.gazetteer.byName[it];if(!vt?.length){let pt=e.gazetteer.alt[it];pt!==void 0&&(vt=[pt])}if(!vt?.length){let pt=e.airports?.airportIata?.[it];if(pt!==void 0){let ut=e.airports.airports[pt];if(ut)return{kind:"ok",lat:ut[0],lon:ut[1],iso:ut[2]}}if(/^[A-Za-z]{3}$/.test(Z)){let ut=Z.toUpperCase();return n.push(Ne(sa.UNKNOWN_AIRPORT_CODE,nt,{code:ut})),{kind:"miss"}}let ht=e.gazetteer.cities.map(ut=>ut[4]),dt=be(Z,ht);return n.push(Ne(sa.UNKNOWN_PLACE,nt,{name:Z,hint:dt})),{kind:"miss"}}let Tt=vt.map(pt=>e.gazetteer.cities[pt]),At=lt??J;if(At){let pt=Tk(At),ht=/^[A-Za-z]{2}-/.test(At)?At:pt,dt=Tt.filter(ut=>ht?ut[5]===ht:ut[2]===At);if(dt.length)Tt=dt;else if(lt)return n.push(Ne(sa.SCOPE_MISS,nt,{name:Z,scope:lt,place:!0})),{kind:"miss"}}if(Tt.length>1){if(!at&&!At)return{kind:"defer"};Tt=[...Tt].sort((pt,ht)=>ht[3]-pt[3]),lt||n.push(Ne(sa.AMBIGUOUS_NAME,nt,{name:Z}))}let rt=Tt[0];if(e.airports?.airportIata?.[it]!==void 0&&!r.has(it)){r.add(it);let pt=Z.toUpperCase();n.push(Ne(sa.AIRPORT_SHADOWED_BY_CITY,nt,{name:Z,code:pt}))}return{kind:"ok",lat:rt[0],lon:rt[1],iso:rt[2]}},L=(Z,lt)=>lt?li(lt):Z.kind==="coords"?`@${Z.lat},${Z.lon}`:li(Z.name),v=[],A=!1,C=!1,M=Z=>{Z&&(v.push(Z),Z==="US"&&(A=!0),Z!=="US"&&Z!=="CA"&&Z!=="MX"&&(C=!0))},w=[];for(let Z of t.pois){if(Z.pos.kind==="coords"){xF(Z.pos.lat,Z.pos.lon)?A=!0:wF(Z.pos.lat,Z.pos.lon)||(C=!0),_(Z.pos.lat,Z.pos.lon,Z);continue}let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,void 0,!1);lt.kind==="ok"?(M(lt.iso),_(lt.lat,lt.lon,Z)):lt.kind==="defer"&&w.push(Z)}let k=c??jit(f,v)??void 0,N=d??k;for(let Z of w){if(Z.pos.kind!=="name")continue;let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,N,!0);lt.kind==="ok"&&(M(lt.iso),_(lt.lat,lt.lon,Z))}function _(Z,lt,nt){let J=L(nt.pos,nt.alias),at=nt.pos.kind==="name"?nt.pos.name:nt.alias,it={id:J,...at!==void 0&&{name:at},lat:Z,lon:lt,...nt.label!==void 0&&{label:nt.label},...nt.color!==void 0&&{color:nt.color},tags:nt.tags,meta:nt.meta,lineNumber:nt.lineNumber};S(J,it,nt.lineNumber)}let T=new Map;for(let Z of b){let lt=Z.name?li(Z.name):void 0;lt&&lt!==Z.id&&!T.has(lt)&&T.set(lt,Z.id)}let R=(Z,lt)=>{let nt=li(Z);if(y.has(nt))return nt;let J=T.get(nt);if(J)return J;let at=x(Z,void 0,lt,k,!0);if(at.kind!=="ok")return null;M(at.iso);let it={id:nt,name:Z,lat:at.lat,lon:at.lon,tags:{},meta:{},lineNumber:lt,implicit:!0};return S(nt,it,lt),nt},G=[];for(let Z of t.edges){let lt=R(Z.from,Z.lineNumber),nt=R(Z.to,Z.lineNumber);!lt||!nt||G.push({fromId:lt,toId:nt,...Z.label!==void 0&&{label:Z.label},directed:Z.directed,style:Z.style,meta:Z.meta,tags:Z.tags,lineNumber:Z.lineNumber})}let I=(Z,lt,nt,J,at,it)=>{let vt=at!==void 0?{value:at}:{};if(Z.kind==="coords"){let pt=lt?li(lt):`@${Z.lat},${Z.lon}`;return xF(Z.lat,Z.lon)?A=!0:wF(Z.lat,Z.lon)||(C=!0),y.has(pt)||S(pt,{id:pt,...lt!==void 0&&{name:lt},lat:Z.lat,lon:Z.lon,...nt!==void 0&&{label:nt},tags:J,meta:vt,lineNumber:it},it),pt}let Tt=li(Z.name);if(y.has(Tt))return Tt;let At=T.get(Tt);if(At)return At;let rt=x(Z.name,Z.scope,it,N,!0);return rt.kind!=="ok"?null:(M(rt.iso),S(Tt,{id:Tt,name:Z.name,lat:rt.lat,lon:rt.lon,...nt!==void 0&&{label:nt},tags:J,meta:vt,lineNumber:it},it),Tt)},H=[];for(let Z of t.routes){let lt=I(Z.origin,Z.originAlias,Z.originLabel,Z.originTags,Z.originValue,Z.lineNumber);if(!lt)continue;let nt=[lt],J=[],at=lt;for(let it of Z.legs){let vt=I(it.dest,it.destAlias,it.destLabel,{},void 0,it.lineNumber);vt&&(J.push({fromId:at,toId:vt,...it.label!==void 0&&{label:it.label},style:it.style,...it.value!==void 0&&{value:it.value},tags:it.tags,lineNumber:it.lineNumber}),nt.includes(vt)||nt.push(vt),at=vt)}H.push({stopIds:nt,legs:J,lineNumber:Z.lineNumber})}let O=m||A||c==="US",D=!C&&!f.some(Z=>Z.layer==="country"&&!["US","CA","MX"].includes(Z.iso))&&O,W=[];(m||D)&&W.push("us-states");let z=[];for(let Z of E){let lt=bp(e.usStates,Z.id);lt&&z.push(lt)}for(let Z of f)if(Z.layer==="country"){let lt=xp(e.worldCoarse,Z.iso);lt&&z.push(lt)}let P=b.map(Z=>[Z.lon,Z.lat]),B=ib(z,P),Y=SF(B),V=c==="US"&&!d,j=[[-180,-85],[180,85]],K=f.length>0?Oit:hF,$=B?EF(B,K):j,U=b.length>0&&f.length===0,X=[];if(U){let Z=Lk(e.worldDetail),lt=Lk(e.usStates),nt=new Set,J=[];for(let it of b){let{country:vt,state:Tt}=mF([it.lon,it.lat],Z,lt),At=Tt?.iso??vt?.iso;if(!At||nt.has(At))continue;nt.add(At),X.push(At);let rt=Tt?bp(e.usStates,At):D?null:xp(e.worldCoarse,At);rt&&!Uit(rt)&&J.push(rt)}let at=ib(J,P);at&&($=EF(qit(at,P,D),hF))}if(U||Y&&D){let Z=($[0][0]+$[1][0])/2,lt=($[0][1]+$[1][1])/2,nt=$[1][0]-$[0][0],J=$[1][1]-$[0][1],at=Math.max(nt,J);if(at>0&&at<gF){let it=gF/at,vt=nt*it/2,Tt=J*it/2;$=[[Z-vt,lt-Tt],[Z+vt,lt+Tt]]}}let q=$[1][0]-$[0][0],et=$[1][1]-$[0][1],tt=Math.max(q,et),F=Math.max(Math.abs($[0][1]),Math.abs($[1][1])),Q=D&&Y&&!U&&!h&&!g&&!V,ot;return D&&q<Fit&&(U||Q)?ot="mercator":D?ot="albers-usa":tt>Pit||F>Dit?ot="equirectangular":ot="conic-equal-area",q>=180&&($=[[-180,Math.min($[0][1],Git)],[180,Math.max($[1][1],$it)]]),o.regions=f,o.pois=b,o.edges=G,o.routes=H,o.basemaps={world:"detail",subdivisions:W},o.extent=$,o.projection=ot,o.poiFrameContainers=X,o.error=t.error??Kit(n),o}function jit(t,e){let n=new Map;for(let a of t){let i=a.layer==="us-state"?"US":a.iso;n.set(i,(n.get(i)??0)+1)}for(let a of e)n.set(a,(n.get(a)??0)+1);let r,o=0;for(let[a,i]of[...n.entries()].sort((s,l)=>s[0]<l[0]?-1:1))i>o&&(o=i,r=a);return r}function qit(t,e,n){let r=ib([],e);if(!r)return t;let[[o,a],[i,s]]=t,[[l,c],[d,u]]=r,f=Bit(Math.max(d-l,u-c),n);a=Math.max(a,c-f),s=Math.min(s,u+f);let p=l-f,m=d+f;return o=o>=-180&&o<=l?Math.max(o,p):p,i=i<=180&&i>=d?Math.min(i,m):m,[[o,a],[i,s]]}function EF(t,e){let n=(t[1][0]-t[0][0])*e||1,r=(t[1][1]-t[0][1])*e||1;return[[Math.max(-180,t[0][0]-n),Math.max(-90,t[0][1]-r)],[Math.min(540,t[1][0]+n),Math.min(90,t[1][1]+r)]]}function Kit(t){let e=t.find(n=>n.severity==="error");return e?Fe(e):null}var Pit,Dit,hF,Oit,Git,$it,gF,Mk,Hit,Wit,Fit,Yit,zit,bF,Vit,_k=st(()=>{"use strict";hn();$W();Nk();Pit=90,Dit=80,hF=.05,Oit=.12,Git=-58,$it=78,gF=7,Mk=8,Hit=3,Wit=.3;Fit=48,Yit=[[-125,25],[-66,49]],zit=.4;bF={"united states":"united states of america",usa:"united states of america",america:"united states of america",uk:"united kingdom","western sahara":"w. sahara","democratic republic of the congo":"dem. rep. congo","dr congo":"dem. rep. congo",drc:"dem. rep. congo","dominican republic":"dominican rep.","falkland islands":"falkland is.","ivory coast":"cote d'ivoire","central african republic":"central african rep.","equatorial guinea":"eq. guinea","solomon islands":"solomon is.","bosnia and herzegovina":"bosnia and herz.","south sudan":"s. sudan","north macedonia":"macedonia","czech republic":"czechia"},Vit=new Set(["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"])});function sb(t){let e=t.ramp,n=e?{name:e.metric?.trim()||"Value",entries:[],gradient:{min:e.min,max:e.max,low:e.low,high:e.high}}:null,r=t.tagGroups.filter(o=>o.entries.length>0).map(o=>({name:o.name,entries:[...o.entries]}));return[...n?[n]:[],...r]}function lb(t,e){return{groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:e,showEmptyGroups:!1,showInactivePills:!0}}function vF(t,e){return(t?50:0)+(e?20:0)+Zit}function kF(t,e){if(!t)return 0;let n=sb(t);if(n.length===0)return 0;let r=lb(n,e.mode),o={activeGroup:t.activeGroup},{height:a}=Rl(r,o,e.width);return a<=0?0:vF(e.hasTitle,e.hasSubtitle)+a+Qit}function LF(t,e){if(!t)return null;let n=sb(t);if(n.length===0)return null;let r=lb(n,e.mode),o={activeGroup:t.activeGroup},{width:a,height:i}=Rl(r,o,e.width);return i<=0||a<=0?null:{x:(e.width-a)/2,y:vF(e.hasTitle,e.hasSubtitle),width:a,height:i}}var Zit,Qit,Ak=st(()=>{"use strict";To();Zit=8,Qit=10});function NF(t,e){let n=[...t].sort(),r=new Map,o=-1;for(let a of n){let i=new Set;for(let l of e.get(a)??[]){let c=r.get(l);c!==void 0&&i.add(c)}let s=0;for(;i.has(s);)s++;r.set(a,s),s>o&&(o=s)}return{byIso:r,huesNeeded:o+1}}var MF=st(()=>{"use strict"});function Dk(t){return t>=90?"world":t>=20?"continental":t>=5?"regional":"local"}function Ok(t,e,n){let r={world:10,continental:9,regional:7,local:6},o=Math.floor(Math.sqrt(Math.max(0,t*e))/105);return Math.max(0,Math.min(o,r[n]))}function ast(t,e,n){switch(n){case"world":return t<=1&&(e==="ocean"||e==="sea");case"continental":return t<=2;case"regional":return t<=3;case"local":return t<=4}}function _F(t,e,n){return!!t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]>=0&&t[0]<=e&&t[1]>=0&&t[1]<=n}function nu(t,e,n=bs){let r=e>0?Math.max(0,t.length-1)*e:0;return We(t,n)+r+2*Jit}function ist(t,e){let n=t.split(/\s+/).filter(Boolean);if(n.length<=1)return[t];let r=n.length>=4?3:2,o=n.length,a=null;for(let i=0;i<1<<o-1;i++){let s=[],l=[n[0]];for(let u=1;u<o;u++)i&1<<u-1?(s.push(l.join(" ")),l=[n[u]]):l.push(n[u]);if(s.push(l.join(" ")),s.length>r)continue;let c=Math.round(Math.max(...s.map(u=>nu(u,e)))),d=nu(s[0],e);(!a||c<a.cost||c===a.cost&&s.length<a.lines.length||c===a.cost&&s.length===a.lines.length&&d>a.head)&&(a={lines:s,cost:c,head:d})}return a?.lines??[t]}function sst(t,e,n,r,o=bs){let a=o+2,i=Math.max(...n.map(l=>nu(l,r,o))),s=(n.length-1)*a+o+2*Pk;return{x:t-i/2,y:e-s/2,w:i,h:s}}function lst(t,e,n){return t.x>=0&&t.y>=0&&t.x+t.w<=e&&t.y+t.h<=n}function cst(t,e,n){return t.x-n<e.x+e.w&&t.x+t.w+n>e.x&&t.y-n<e.y+e.h&&t.y+t.h+n>e.y}function PF(t){let{projection:e,dLonSpan:n,dLatSpan:r,width:o,height:a,waterBodies:i,countries:s,palette:l,countryTone:c,waterTone:d,project:u,collides:f,overLand:p}=t,m=Dk(Math.max(n,r)),h=Ok(o,a,m);if(h<=0)return[];let g=d??Gt(l.colors.blue,l.textMuted,50),E=c??l.textMuted,y=l.bg,b=[],S=[o/2,a/2];for(let R of i?.entries??[]){let[G,I,H,O,D,W]=R;if(!ast(O,D,m))continue;let z=ist(H,Ik),P=[[I,G]];for(let K of W??[])P.push([K[1],K[0]]);let B=null,Y=1/0,V=null,j=1/0;for(let[K,$]of P){let U=u(K,$);if(!U||!Number.isFinite(U[0])||!Number.isFinite(U[1]))continue;let X=(U[0]-S[0])**2+(U[1]-S[1])**2;X<j&&(j=X,V=U),_F(U,o,a)&&X<Y&&(Y=X,B=U)}if(!B&&O===0&&V){let K=Math.max(0,-V[0],V[0]-o),$=Math.max(0,-V[1],V[1]-a);if(K<=o*TF&&$<=a*TF){let U=Math.max(...z.map(et=>nu(et,Ik)))/2,X=((z.length-1)*Rk+bs+2*Pk)/2,q=est;B=[Math.min(Math.max(V[0],U+q),o-U-q),Math.min(Math.max(V[1],X+q),a-X-q)]}}B&&b.push({text:H,lines:z,cx:B[0],cy:B[1],italic:!0,letterSpacing:Ik,color:g,fontSize:bs,sort:(O<=1?0:2e3)+O*10+ost[D]})}let x=s.map(R=>{let[G,I,H,O]=R.bbox,D=H-G,W=O-I;return{c:R,w:D,h:W,area:D*W}}).filter(R=>Number.isFinite(R.area)&&R.area>0).sort((R,G)=>G.area-R.area),L=Math.sqrt(Math.max(1,o*a)),v=0;for(let R of x){let{c:G,w:I,h:H,area:O}=R;if(!G.curatedAnchor&&I>o*.66&&H>a*.66||!_F(G.anchor,o,a))continue;let D=Math.sqrt(O)/L,W=Math.min(1,Math.max(0,(D-CF)/(rst-CF))),z=Math.round(bs+W*(nst-bs)),P=E,B=G.name;nu(B,0,z)>I||z+2*Pk>H||b.push({text:B,lines:[B],cx:G.anchor[0],cy:G.anchor[1],italic:!1,letterSpacing:0,color:P,fontSize:z,...G.bordering?{bordering:!0}:{},...G.positions?{positions:G.positions}:{},sort:1e3+v++})}b.sort((R,G)=>R.sort-G.sort);let A=[],C=[],M=b.reduce((R,G)=>R+(!G.italic&&!G.bordering?1:0),0),w=h-Math.min(2,M),k=0,N=0,_=(R,G,I)=>{let H=sst(R,G,I.lines,I.letterSpacing,I.fontSize);if(!lst(H,o,a))return null;if(I.italic&&p){let D=G-(I.lines.length-1)/2*Rk;if(I.lines.some((z,P)=>{let B=nu(z,I.letterSpacing),Y=R-B/2+2,V=R+B/2-2,j=[Y,(Y+R)/2,R,(R+V)/2,V],K=D+P*Rk;return[K,K-bs*.4,K-bs*.8].some($=>j.some(U=>p(U,$)))}))return null}return f(H)||C.some(O=>cst(H,O,tst))?null:H},T=R=>{let G=R.positions??[[R.cx,R.cy]];for(let[I,H]of G){let O=_(I,H,R);if(O)return C.push(O),A.push({x:I,y:H,text:R.text,anchor:"middle",color:R.color,halo:!1,haloColor:y,fontSize:R.fontSize,italic:R.italic,letterSpacing:R.letterSpacing,...R.lines.length>1?{lines:R.lines}:{},lineNumber:0}),!0}return!1};for(let R of b)R.bordering&&T(R);for(let R of b)if(!R.bordering){if(N>=h)break;R.italic&&k>=w||T(R)&&(N++,R.italic&&k++)}return A}var bs,Rk,Jit,Pk,Ik,tst,est,TF,nst,CF,rst,AF,RF,IF,ost,DF=st(()=>{"use strict";tn();Mr();bs=11,Rk=bs+2,Jit=4,Pk=3,Ik=1.5,tst=4,est=8,TF=.35,nst=22,CF=.06,rst=.32,AF=4,RF=5,IF=3,ost={ocean:0,sea:1,gulf:2,bay:3,strait:4,channel:5,sound:6}});function GF(){let t=OF*OF;return Qy({lineStart(){let e=this;e._has=!1,e._pending=!1,e.stream.lineStart()},point(e,n){let r=this;if(r._lx=e,r._ly=n,r._has){let o=e-r._ex,a=n-r._ey;if(o*o+a*a<t){r._pending=!0;return}}r.stream.point(e,n),r._ex=e,r._ey=n,r._has=!0,r._pending=!1},lineEnd(){let e=this;e._pending&&e.stream.point(e._lx,e._ly),e._pending=!1,e.stream.lineEnd()}})}function Yst(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function zst(t,e){let n=a=>{let i=a.geometry;return i?i.type==="Polygon"?[i.coordinates]:i.type==="MultiPolygon"?i.coordinates:null:null},r=n(t),o=n(e);return!r||!o?t:{...t,geometry:{type:"MultiPolygon",coordinates:[...r,...o]}}}function ru(t){let e=XF.get(t);if(e)return e;let n=new Map;for(let r of Yst(t).geometries){let o=Jl(t,r);if(!o.geometry)continue;let a={...o,id:r.id},i=n.get(r.id);n.set(r.id,i?zst(i,a):a)}return XF.set(t,n),n}function Vst(t){let{geometry:e,bounds:n,project:r,width:o,height:a,curated:i}=t,s=n[0][0],l=n[0][1],c=n[1][0],d=n[1][1];if(![s,l,c,d].every(Number.isFinite)||c<=s||d<=l)return Wk(i,r);let u=RF,f=[],p=[];for(let A=0;A<u;A++){f[A]=[];let C=s+(A+.5)/u*(c-s);for(let M=0;M<u;M++){let w=l+(M+.5)/u*(d-l),k=yp(e,C,w);if(f[A][M]=k,!k)continue;let N=r(C,w);!N||!Number.isFinite(N[0])||!Number.isFinite(N[1])||N[0]<0||N[0]>o||N[1]<0||N[1]>a||p.push({i:A,j:M,lon:C,lat:w,sx:N[0],sy:N[1]})}}if(!p.length)return Wk(i,r);let m=p.reduce((A,C)=>A+C.sx,0)/p.length,h=p.reduce((A,C)=>A+C.sy,0)/p.length,g=A=>{let C=0;for(let M=-1;M<=1;M++)for(let w=-1;w<=1;w++){if(M===0&&w===0)continue;let k=A.i+M,N=A.j+w;k>=0&&k<u&&N>=0&&N<u&&f[k][N]&&C++}return C},E=A=>(A.sx-m)**2+(A.sy-h)**2,y=p.reduce((A,C)=>A+C.lon,0)/p.length,b=p.reduce((A,C)=>A+C.lat,0)/p.length,S=r(y,b),x=yp(e,y,b)&&S&&Number.isFinite(S[0])&&Number.isFinite(S[1])&&S[0]>=0&&S[0]<=o&&S[1]>=0&&S[1]<=a?[{lonLat:[y,b],screen:[S[0],S[1]]}]:[],L=[...p].sort((A,C)=>g(C)-g(A)||E(A)-E(C)).map(A=>({lonLat:[A.lon,A.lat],screen:[A.sx,A.sy]}));return[...i?Wk(i,r):[],...x,...L].slice(0,AF)}function Wk(t,e){if(!t)return[];let n=e(t[0],t[1]);return!n||!Number.isFinite(n[0])||!Number.isFinite(n[1])?[]:[{lonLat:[t[0],t[1]],screen:[n[0],n[1]]}]}function qst(t,e){switch(t){case"albers-usa":return Ust();case"conic-equal-area":{let n=e[0][1],r=e[1][1];return up().parallels([n+(r-n)/6,n+(r-n)*5/6]).center([0,(n+r)/2])}case"mercator":return eb();case"equal-earth":return wk();case"equirectangular":return rb();case"natural-earth":return Sk();default:return rb()}}function Qst(t,e=!1,n=!1){return Gt(t.colors.blue,t.bg,e?bst:yst)}function Jst(t,e,n=!1){return Gt(t.colors.green,t.bg,e?gst:hst)}function wp(t,e){let n=t.basemaps.subdivisions.includes("us-states"),r=(t.projection==="albers-usa"||t.projection==="mercator")&&n&&!!e.naLand,o=r||t.basemaps.world==="detail"?e.worldDetail:e.worldCoarse,a=new Map(ru(o));if(r&&e.naLand){let[p,m,h,g]=[-140,10,-52,66],E=ru(e.naLand);for(let[y,b]of E){let S=a.get(y);if(!S)continue;let[[x,L],[v,A]]=gs(S);x>=p&&v<=h&&L>=m&&A<=g&&a.set(y,{...b,properties:S.properties})}}let i=n?ru(e.usStates):null,s=()=>{let[[p,m],[h,g]]=t.extent,E=16,y=[];for(let b=0;b<=E;b++){let S=b/E,x=p+(h-p)*S,L=m+(g-m)*S;y.push([x,m],[x,g],[p,L],[h,L])}return{type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:y}}},l;if(t.projection==="albers-usa"&&i){l=[...i.entries()].filter(([m])=>!Yk.has(m)).map(([,m])=>m);let p=t.pois.filter(m=>!Bk(m.lon,m.lat)&&!Fk(m.lon,m.lat)).map(m=>[m.lon,m.lat]);p.length>0&&l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:p}});for(let m of t.regions)if(m.layer==="country"&&(m.iso==="CA"||m.iso==="MX")){let h=a.get(m.iso);h&&l.push(h)}}else l=[s()];let c={type:"FeatureCollection",features:l},d=qst(t.projection,t.extent);if(t.projection!=="albers-usa"){let p=(t.extent[0][0]+t.extent[1][0])/2;p>180&&(p-=360),d.rotate([-p,0])}let u=gs(c),f=u[1][0]-u[0][0]>=270||u[1][1]-u[0][1]>=130;return{projection:d,fitTarget:c,fitIsGlobal:f,worldLayer:a,usLayer:i,usCrisp:r,wantsUsStates:n,worldTopo:o}}function Ep(t){let e=[],n=[],r=/([MLZ])([^MLZ]*)/g,o;for(;o=r.exec(t);){if(o[1]==="Z"){n.length&&e.push(n),n=[];continue}o[1]==="M"&&n.length&&(e.push(n),n=[]);let a=o[2].split(/[ ,]+/).map(Number);for(let i=0;i+1<a.length;i+=2){let s=a[i],l=a[i+1];Number.isFinite(s)&&Number.isFinite(l)&&n.push([s,l])}}return n.length&&e.push(n),e}function tlt(t,e,n){let r=Ep(t);if(r.length<=1)return t;let o=.75,a=.003*e*n,i=f=>{let p=0;for(let m=0;m<f.length;m++){let h=f[m],g=f[(m+1)%f.length];p+=h[0]*g[1]-g[0]*h[1]}return Math.abs(p)/2},s=r.map(i),l=Math.max(...s),c=(f,p)=>Math.abs(f[0])<=o&&Math.abs(p[0])<=o||Math.abs(f[0]-e)<=o&&Math.abs(p[0]-e)<=o,d=!1,u=r.filter((f,p)=>s[p]>=l||s[p]>=a?!0:f.some((h,g)=>c(h,f[(g+1)%f.length]))?(d=!0,!1):!0);return d?u.map(f=>f.map((p,m)=>(m?"L":"M")+p[0]+","+p[1]).join("")+"Z").join(""):t}function elt(t,e,n,r){if(t.projection!=="albers-usa"||!t.basemaps.subdivisions.includes("us-states")||!(n>0)||!(r>0))return!1;let o=t.regions.some(p=>p.iso==="US-AK")||t.pois.some(p=>Bk(p.lon,p.lat)),a=t.regions.some(p=>p.iso==="US-HI")||t.pois.some(p=>Fk(p.lon,p.lat));if(o||a)return!1;let{projection:i,fitTarget:s,usLayer:l}=wp(t,e);if(!l||![...l.keys()].some(p=>!Yk.has(p)))return!1;i.fitSize([1e3,1e3],s);let c=Ba(i).bounds(s),d=(c[1][0]-c[0][0])/(c[1][1]-c[0][1]);if(!(d>0))return!1;let u=n/r;return Math.max(u/d,d/u)>dst}function rlt(t,e){let n=jF.get(t);n||(n=new Map,jF.set(t,n));let r=n.get(e);if(!r&&(r=new Map,n.set(e,r),n.size>nlt)){let o=n.keys().next().value;o!==void 0&&n.delete(o)}return r}function zk(t,e,n,r){let{palette:o,isDark:a}=r,{width:i,height:s}=n,l=t;elt(l,e,i,s)&&(l={...l,projection:"conic-equal-area"});let{projection:c,fitTarget:d,fitIsGlobal:u,worldLayer:f,usLayer:p,usCrisp:m,worldTopo:h}=wp(l,e),g=p!==null,E=a?Gt(o.border,o.text,65):Gt(o.text,o.bg,78),y=l.regions.filter(mt=>mt.value!==void 0).map(mt=>mt.value),b=y.length>0?Math.min(...y):0,S=Math.max(...y),x=Dn(l.directives.regionMetricColor??"",o)??o.colors.red,L=l.directives.regionMetricLowColor?Dn(l.directives.regionMetricLowColor,o)??void 0:void 0,v=y.length>0,A=v?l.directives.regionMetric?.trim()||"Value":null,C=mt=>{let St=mt.trim().toLowerCase();if(St==="none")return null;if(St===A?.toLowerCase())return A;let Ft=l.tagGroups.find(Mt=>Mt.name.toLowerCase()===St);return Ft?Ft.name:mt},M=new Set;for(let mt of l.tagGroups){let St=mt.name.toLowerCase();(l.regions.some(Ft=>Ft.tags[St])||l.pois.some(Ft=>Ft.tags[St]))&&M.add(mt.name)}let w=l.tagGroups.find(mt=>M.has(mt.name))?.name??null,k=r.activeGroup,N;k!==void 0?N=k===null?null:C(k):l.directives.activeTag!==void 0?N=C(l.directives.activeTag):N=A??w??l.tagGroups[0]?.name??null;let _=A!==null&&N===A,T=_||N!==null&&M.has(N),R=Jst(o,a,T),G=Qst(o,a,T),I=Gt(E,G,45),H=Gt(o.colors.gray,o.bg,T?a?Dst:Pst:a?Ist:Rst),O=(mt,...St)=>{let Ft=Mt=>St.every(Jt=>wl(Mt,Jt)>=BF);if(Ft(mt))return mt;for(let Mt=10;Mt<=100;Mt+=10){let Jt=Gt(o.text,mt,Mt);if(Ft(Jt))return Jt}return o.text},D=O(o.textMuted,R,G),W=O(Gt(o.colors.blue,o.textMuted,50),G,R),z=l.regions.some(mt=>mt.color!==void 0),P=l.directives.noColorize!==!0&&!v&&!z&&M.size===0,B=new Map;if(P){let mt=new Map,St=re=>{for(let[pe,ce]of re){let Me=mt.get(pe);Me?Me.push(...ce):mt.set(pe,[...ce])}};if(St(kk(h)),p){St(kk(e.usStates));for(let[re,pe]of Object.entries(Zst)){let ce=mt.get(re);if(ce)for(let Me of pe){let Ge=mt.get(Me);Ge&&(ce.push(Me),Ge.push(re))}}}let{byIso:Ft,huesNeeded:Mt}=NF([...mt.keys()],mt),Jt=UM(o,Mt,a);for(let[re,pe]of Ft)B.set(re,Jt[pe])}let Y=mt=>Gt(mt,o.text,35),V=a?Gt(o.surface,o.text,28):o.bg,j=Gt(x,V,$k),K=mt=>{let St=S>b?(mt-b)/(S-b):1;if(L!==void 0)return em(L,x,St,{isDark:a});let Ft=$k+Math.max(0,Math.min(1,St))*(100-$k);return Gt(x,V,Ft)},$=(mt,St)=>{if(!St)return null;let Ft=l.tagGroups.find(re=>re.name.toLowerCase()===St.toLowerCase());if(!Ft)return null;let Mt=mt[qt(Ft.name)]??Ft.defaultValue;if(!Mt)return null;let Jt=Ft.entries.find(re=>re.value.toLowerCase()===Mt.toLowerCase());return Jt?.color?Gt(Jt.color,o.bg,a?YF:FF):null},U=mt=>{let St=mt?Dn(mt,o):null;return St?Gt(St,o.bg,a?YF:FF):null},X=mt=>{let St=U(mt.color);return St||(_?mt.value!==void 0?K(mt.value):R:P?(mt.iso&&B.get(mt.iso))??R:$(mt.tags,N)??R)},q=new Map(l.regions.map(mt=>[mt.iso,mt])),et=null;if(!l.directives.noLegend){let mt=l.tagGroups.map(St=>({name:St.name,entries:St.entries.map(Ft=>({value:Ft.value,color:Ft.color}))}));(mt.length>0||v)&&(et={tagGroups:mt,activeGroup:N,...v&&{ramp:{...l.directives.regionMetric!==void 0&&{metric:l.directives.regionMetric},min:b,max:S,low:L??j,high:x}}})}let tt=l.directives.noTitle?null:l.title,F=16,Q=Po;if(tt&&l.pois.length>0){let mt=(l.subtitle?50:30)+20/2;Q=Math.max(Po,mt+F)}let ot=kF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});ot>Q&&(Q=ot);let Z=[];if(tt){let mt=l.subtitle?2:1,St=Math.max(We(tt,20),l.subtitle?We(l.subtitle,20):0)+40;Z.push({x:i/2-St/2,y:10,w:St,h:20*(mt+.5)})}let lt=LF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});lt&&Z.push({x:lt.x,y:lt.y,w:lt.width,h:lt.height});let nt=r._calloutReserve,J=Po+(nt?.left??0),at=i-Po-(nt?.right??0),it=Q+(nt?.top??0),vt=s-Po-(nt?.bottom??0),Tt=[[J,it],[Math.max(J+1,at),Math.max(it+1,vt)]];if(c.fitExtent(Tt,d),!u&&l.projection!=="albers-usa"&&l.regions.length>0){let mt=1/0,St=-1/0;for(let Ft of l.regions){let Mt=Ft.iso?xp(e.worldCoarse,Ft.iso):null;if(Mt)for(let Jt of[Mt[0][0],Mt[1][0]])for(let re of[Mt[0][1],Mt[1][1]]){let pe=c([Jt,re]);pe&&Number.isFinite(pe[1])&&(pe[1]<mt&&(mt=pe[1]),pe[1]>St&&(St=pe[1]))}}if(mt<St){let Ft=it,Mt=vt,Jt=(Ft+Mt)/2-(mt+St)/2,re=Ft-mt,pe=Mt-St;re<=pe&&(Jt=Math.max(re,Math.min(pe,Jt)));let[ce,Me]=c.translate();c.translate([ce,Me+Jt])}}if(!u&&l.projection==="albers-usa"){let mt=Ba(c).bounds(d);if(Number.isFinite(mt[0][1])){let St=vt-it-(mt[1][1]-mt[0][1]);if(St>0){let Ft=mt[0][1]-it,Mt=St*.3-Ft,[Jt,re]=c.translate();c.translate([Jt,re+Mt])}}}let At,rt,pt=null;if(u&&!r.preferContain){let mt=Ba(c).bounds(d),St=mt[0][0],Ft=mt[0][1],Mt=mt[1][0]-St,Jt=mt[1][1]-Ft,re=l.title&&l.pois.length>0||ot>0?Q:0,pe=0,ce=re,Me=Mt>0?i/Mt:1,Ge=Jt>0?(s-re)/Jt:1;pt={sx:Me,sy:Ge,ox:pe,oy:ce,bx0:St,by0:Ft};let ct=(Yt,Et)=>[pe+(Yt-St)*Me,ce+(Et-Ft)*Ge],gt=c,wt=Qy({point(Yt,Et){let[Bt,Kt]=ct(Yt,Et);this.stream.point(Bt,Kt)}}),Ct=GF();At=Ba({stream:Yt=>gt.stream(wt.stream(Ct.stream(Yt)))}).digits(Gk),rt=(Yt,Et)=>{let Bt=gt([Yt,Et]);return Bt?ct(Bt[0],Bt[1]):null}}else{c.clipExtent([[0,0],[i,s]]);let mt=GF();At=Ba({stream:St=>c.stream(mt.stream(St))}).digits(Gk),rt=(St,Ft)=>c([St,Ft])??null}let ht=rlt(t,JSON.stringify([i,s,[[-100,40],[-120,37],[-80,40],[0,0],[60,30],[-60,-30],[150,60],[-150,-60],[100,-40],[-30,50]].map(([mt,St])=>rt(mt,St))])),dt=[],ut=[],yt=[],kt=l.regions.some(mt=>mt.iso==="US-AK")||l.pois.some(mt=>Bk(mt.lon,mt.lat)),Ot=l.regions.some(mt=>mt.iso==="US-HI")||l.pois.some(mt=>Fk(mt.lon,mt.lat));if(l.projection==="albers-usa"&&p&&(kt||Ot)){let Ft=s-Po,Mt=8,Jt=new Map,re=(gt,wt)=>{let Ct=c([gt,wt]);if(!Ct)return;let Yt=Math.floor(Ct[0]/Mt),Et=Jt.get(Yt);(Et===void 0||Ct[1]>Et)&&Jt.set(Yt,Ct[1])},pe=gt=>{if(Array.isArray(gt)&&typeof gt[0]=="number")re(gt[0],gt[1]);else if(Array.isArray(gt))for(let wt of gt)pe(wt)};for(let[gt,wt]of p)Yk.has(gt)||pe(wt.geometry.coordinates);let ce=gt=>{let wt=Math.floor(gt/Mt),Ct=-1/0;for(let Yt=wt-1;Yt<=wt+1;Yt++){let Et=Jt.get(Yt);Et!==void 0&&Et>Ct&&(Ct=Et)}return Ct},Me=(gt,wt)=>{let Yt=-1/0;for(let Et=0;Et<=24;Et++){let Bt=ce(gt+(wt-gt)*Et/24);Bt>Yt&&(Yt=Bt)}return Yt},Ge=(gt,wt,Ct,Yt)=>{let Et=p.get(gt);if(!Et)return Ct;let Bt=Ct,Kt=Math.min(Yt,i-Po-Bt-16);if(Kt<24)return Ct;let ue=Bt+Kt+16,_e=Me(Bt,ue),ke=_e>-1/0?_e+12:Ft-s*.42;wt.fitWidth(Kt,Et);let Re=Ba(wt).bounds(Et),an=(Number.isFinite(Re[0][0])?Re[1][1]-Re[0][1]:Kt)+16,Pe=ke,je=Math.min(Pe+an,Ft);je-Pe<an&&(Pe=je-an),wt.fitExtent([[Bt+8,Pe+8],[ue-8,je-8]],Et);let Ae=Ba(wt).digits(Gk),Ze=Ae(Et)??"";if(!Ze)return ue;let Oe;if(gt==="US-AK"){let Rr=f.get("CA"),Vo=Rr?Ae(Rr)??"":"";Vo&&(Oe={d:Vo,fill:P?B.get("CA")??H:H})}let qe=q.get(gt),De=P?B.get(gt)??R:R,xn=-1;qe?.layer==="us-state"&&(De=X(qe),xn=qe.lineNumber),dt.push({x:Bt,y:Pe,w:ue-Bt,h:je-Pe,points:[[Bt,Pe],[ue,Pe],[ue,je],[Bt,je]],projection:wt,...Oe&&{contextLand:Oe}}),ut.push({id:gt,d:Ze,fill:De,stroke:P?Y(De):E,lineNumber:xn,layer:"us-state",...qe?.value!==void 0&&{value:qe.value},...qe&&Object.keys(qe.tags).length>0&&{tags:qe.tags}});let Mn=Ba(wt).centroid(Et);if(Number.isFinite(Mn[0])){let Rr=Et.properties?.name??gt;yt.push({x:Mn[0],y:Mn[1],iso:gt,name:Rr,lineNumber:xn})}return ue},ct=Po;kt&&(ct=Ge("US-AK",Xst(),Po,i*.18)),Ot&&Ge("US-HI",jst(),kt?ct+24:Po,i*.12)}let Xt=l.projection==="albers-usa"&&!!p,bt=Xt?gs(d):l.extent,Nt=bt[1][0]-bt[0][0],Vt=bt[1][1]-bt[0][1],xt=Nt>=270||Vt>=130,Lt=(bt[0][0]+bt[1][0])/2,Dt=mt=>{let St=mt;for(;St<Lt-180;)St+=360;for(;St>Lt+180;)St-=360;return St},zt=mt=>{let St=1/0,Ft=-1/0,Mt=1/0,Jt=-1/0,re=[];for(let[Ct]of mt){let Yt=Dt(Ct);re.push(Yt),Yt<St&&(St=Yt),Yt>Ft&&(Ft=Yt),Ct<Mt&&(Mt=Ct),Ct>Jt&&(Jt=Ct)}re.sort((Ct,Yt)=>Ct-Yt);let pe=0;for(let Ct=1;Ct<re.length;Ct++)pe=Math.max(pe,re[Ct]-re[Ct-1]);re.length>1&&(pe=Math.max(pe,re[0]+360-re[re.length-1]));let ce=360-pe;if(ce>270||Jt-Mt>180&&ce<90)return!1;let Me=1/0,Ge=1/0,ct=-1/0,gt=-1/0,wt=!1;for(let[Ct,Yt]of mt){let Et=rt(Ct,Yt);!Et||!Number.isFinite(Et[0])||!Number.isFinite(Et[1])||(wt=!0,Et[0]<Me&&(Me=Et[0]),Et[0]>ct&&(ct=Et[0]),Et[1]<Ge&&(Ge=Et[1]),Et[1]>gt&&(gt=Et[1]))}return wt?!(ct<0||Me>i||gt<0||Ge>s):!1},$t=mt=>{if(xt)return mt;let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Ft=St.coordinates[0];return zt(Ft)?mt:null}if(St.type==="MultiPolygon"){let Ft=St.coordinates,Mt=Ft.filter(Jt=>zt(Jt[0]));return Mt.length?Mt.length===Ft.length?mt:{...mt,geometry:{...St,coordinates:Mt}}:null}return mt},ft=100,Wt=mt=>{let St=mt.map(([ce])=>ce).sort((ce,Me)=>ce-Me);if(St.length<2)return!1;let Ft=-1,Mt=0;for(let ce=1;ce<St.length;ce++){let Me=St[ce]-St[ce-1];Me>Ft&&(Ft=Me,Mt=ce)}if(St[0]+360-St[St.length-1]>=Ft)return!1;let re=360-Ft;return St[Mt-1]+360>180&&re<ft},he=mt=>{let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Ft=St.coordinates[0];return Wt(Ft)?null:mt}if(St.type==="MultiPolygon"){let Ft=St.coordinates,Mt=Ft.filter(Jt=>!Wt(Jt[0]));return Mt.length?Mt.length===Ft.length?mt:{...mt,geometry:{...St,coordinates:Mt}}:null}return mt},ne=[],se=(mt,St,Ft)=>{for(let[Mt,Jt]of mt){if(St==="us-state"&&g&&l.projection==="albers-usa"&&Kst.has(Mt)||St==="country"&&g&&Mt==="US"||St==="country"&&Mt==="AQ"&&!q.has("AQ"))continue;let re=q.get(Mt),pe=St+":"+Mt,ce=ht.get(pe);if(ce===void 0){let Kt=Ft?$t(Jt):he(Jt);if(!Kt){ht.set(pe,null);continue}let ue=At(Kt)??"",_e=u?tlt(ue,i,s):ue;if(!_e){ht.set(pe,null);continue}let ke=Hk[Mt],Re=ke?rt(ke[0],ke[1]):At.centroid(Kt),Xe=Re!=null&&Number.isFinite(Re[0])&&Number.isFinite(Re[1]);ce={d:_e,cx:Xe?Re[0]:void 0,cy:Xe?Re[1]:void 0},ht.set(pe,ce)}else if(ce===null)continue;let Me=ce.d,Ge=ce.cx!==void 0&&ce.cy!==void 0,ct=re?.layer===St,wt=St==="country"&&g&&Mt!=="US"?H:R,Ct=P?B.get(Mt)??wt:wt,Yt,Et=-1,Bt="base";ct?(Ct=X(re),Et=re.lineNumber,Bt=St,Yt=re.name):Yt=Jt.properties?.name,ne.push({id:Mt,d:Me,fill:Ct,stroke:P?Y(Ct):E,lineNumber:Et,layer:Bt,...Yt!==void 0&&{label:Yt},...Ge&&{labelX:ce.cx,labelY:ce.cy},...ct&&re.value!==void 0&&{value:re.value},...ct&&Object.keys(re.tags).length>0&&{tags:re.tags}})}};se(f,"country",!xt),p&&se(p,"us-state",!Xt&&!xt);let Zt=m&&e.naLakes?e.naLakes:e.lakes;if(Zt)for(let[,mt]of ru(Zt)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At(St)??"";Ft&&ne.push({id:"lake",d:Ft,fill:G,stroke:I,lineNumber:-1,layer:"base"})}let Ie=(mt,St,Ft)=>{let Mt=!1;for(let Jt of Ft)for(let re=0,pe=Jt.length-1;re<Jt.length;pe=re++){let[ce,Me]=Jt[re],[Ge,ct]=Jt[pe];Me>St!=ct>St&&mt<(Ge-ce)*(St-Me)/(ct-Me)+ce&&(Mt=!Mt)}return Mt},Ht=[...ne,...ut].map(mt=>{let St=Ep(mt.d),Ft=1/0,Mt=1/0,Jt=-1/0,re=-1/0;for(let pe of St)for(let ce of pe)ce[0]<Ft&&(Ft=ce[0]),ce[0]>Jt&&(Jt=ce[0]),ce[1]<Mt&&(Mt=ce[1]),ce[1]>re&&(re=ce[1]);return mt.bbox=[Ft,Mt,Jt,re],mt.rings=St,{fill:mt.fill,rings:St,minX:Ft,minY:Mt,maxX:Jt,maxY:re}}),Qt=(mt,St)=>{let Ft=G;for(let Mt of Ht)mt<Mt.minX||mt>Mt.maxX||St<Mt.minY||St>Mt.maxY||Ie(mt,St,Mt.rings)&&(Ft=Mt.fill);return Ft},Ut=mt=>{let St=wl(mt,o.textOnFillDark)>=wl(mt,o.textOnFillLight)?o.textOnFillDark:o.textOnFillLight,Ft=St===o.textOnFillLight?o.textOnFillDark:o.textOnFillLight;return{color:St,halo:wl(mt,St)<BF,haloColor:Ft}},fe=l.directives.noRelief!==!0,de=[],te=null;if(fe&&e.mountainRanges){for(let[,mt]of ru(e.mountainRanges)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At.area(St);if(!Number.isFinite(Ft)||Ft<Est)continue;let Mt=At.bounds(St);if(Mt[1][0]-Mt[0][0]<zF||Mt[1][1]-Mt[0][1]<zF)continue;let Jt=At(St)??"";Jt&&de.push({d:Jt})}if(de.length){let mt=a?o.bg:o.text,St=a?o.text:o.bg,Ft=P?a?o.surface:o.bg:R,Mt=Ns(Ft),Jt=Math.abs(Mt-Ns(mt))>.04?mt:St;te={color:Gt(Jt,Ft,kst),spacing:Sst,width:vst}}}let ae=null;if(l.directives.noCoastline!==!0){let mt=Math.min(i,s);ae={color:Gt(E,G,Ast),lines:Array.from({length:VF},(St,Ft)=>({d:(Lst+Ft*Nst)*mt,thickness:Mst*mt,opacity:UF+(Tst-UF)*Ft/(VF-1)})),minExtent:(xt?_st:Cst)*mt}}let Te=Gt(o.colors.blue,G,32),Je=[];if(e.rivers)for(let[,mt]of ru(e.rivers)){let St=xt?he(mt):$t(mt);if(!St)continue;let Ft=At(St)??"";Ft&&Je.push({d:Ft,color:Te,width:xst})}let sn=l.pois.map(mt=>Number(mt.meta.size)).filter(mt=>Number.isFinite(mt)&&mt>0),ze=sn.length?Math.min(...sn):0,Ce=sn.length?Math.max(...sn):0,ee=mt=>{let St=Number(mt.meta.size);if(!Number.isFinite(St)||St<=0||Ce<=0)return ust;let Ft=Ce>ze?(Math.sqrt(St)-Math.sqrt(ze))/(Math.sqrt(Ce)-Math.sqrt(ze)):1;return cb+Math.max(0,Math.min(1,Ft))*($F-cb)},oe=mt=>{let St=Math.max(0,Math.min(1,(mt-cb)/($F-cb)));return HF-St*(HF-fst)},Be=mt=>{let St=mt.color?Dn(mt.color,o):null;if(St)return{fill:St,stroke:Gt(St,o.text,18)};for(let Ft of l.tagGroups){let Mt=mt.tags[qt(Ft.name)];if(!Mt)continue;let re=Ft.entries.find(pe=>pe.value.toLowerCase()===Mt.toLowerCase())?.color;if(re)return{fill:re,stroke:Gt(re,o.text,18)}}return{fill:o.colors.orange,stroke:Gt(o.colors.orange,o.text,18)}},dn=mt=>{for(let St of l.tagGroups){let Ft=mt[qt(St.name)];if(!Ft)continue;let Mt=St.entries.find(Jt=>Jt.value.toLowerCase()===Ft.toLowerCase());if(Mt?.color)return Mt.color}return null},_n=new Map,He=new Set;for(let mt of l.routes)mt.stopIds.forEach((St,Ft)=>{Ft===0&&He.add(St),_n.has(St)||_n.set(St,Ft+1)});let Nn=new Map,jn=[],xo=[...l.pois].sort((mt,St)=>mt.lineNumber-St.lineNumber||(mt.id<St.id?-1:1)),Sr=[];for(let mt of xo){let St=rt(mt.lon,mt.lat);St&&Sr.push({p:mt,xy:St})}let An=(mt,St,Ft,Mt)=>{let{fill:Jt,stroke:re}=Be(mt.p),pe=ee(mt.p);Nn.set(mt.p.id,{cx:St,cy:Ft,r:pe});let ce=_n.get(mt.p.id);jn.push({id:mt.p.id,cx:St,cy:Ft,r:pe,fill:Jt,fillOpacity:oe(pe),stroke:re,lineNumber:mt.p.lineNumber,implicit:!!mt.p.implicit,isOrigin:He.has(mt.p.id),...ce!==void 0&&{routeNumber:ce},...Object.keys(mt.p.tags).length>0&&{tags:mt.p.tags},...Mt!==void 0&&{clusterId:Mt}})},In=[],Ar=new Set;for(let mt of l.edges)Ar.add(mt.fromId),Ar.add(mt.toId);for(let mt of l.routes)mt.stopIds.forEach(St=>Ar.add(St));let lr=mt=>ee(mt.p);for(let mt of Sr)Ar.has(mt.p.id)&&An(mt,mt.xy[0],mt.xy[1]);let Vr=[];for(let mt of Sr){if(Ar.has(mt.p.id))continue;let St=lr(mt),Ft=Vr.find(Mt=>Mt.some(Jt=>Math.hypot(Jt.xy[0]-mt.xy[0],Jt.xy[1]-mt.xy[1])<(St+lr(Jt))*$st));Ft?Ft.push(mt):Vr.push([mt])}for(let mt of Vr){if(mt.length===1){An(mt[0],mt[0].xy[0],mt[0].xy[1]);continue}let St=mt[0].p.id,Ft=mt.reduce((Et,Bt)=>Et+Bt.xy[0],0)/mt.length,Mt=mt.reduce((Et,Bt)=>Et+Bt.xy[1],0)/mt.length,Jt=Math.max(...mt.map(lr)),re=2*Jt+Wst,pe=Math.max(Ost,re/(2*Math.sin(Math.PI/Math.max(mt.length,2)))),ce=mt.map((Et,Bt)=>{if(mt.length<=Hst){let _e=-Math.PI/2+Bt*2*Math.PI/mt.length;return{e:Et,mx:Ft+Math.cos(_e)*pe,my:Mt+Math.sin(_e)*pe}}let Kt=Bt*Gst,ue=pe*Math.sqrt((Bt+1)/mt.length);return{e:Et,mx:Ft+Math.cos(Kt)*ue,my:Mt+Math.sin(Kt)*ue}}),Me=Ft-Jt,Ge=Ft+Jt,ct=Mt-Jt,gt=Mt+Jt;for(let{mx:Et,my:Bt,e:Kt}of ce){let ue=lr(Kt);Me=Math.min(Me,Et-ue),Ge=Math.max(Ge,Et+ue),ct=Math.min(ct,Bt-ue),gt=Math.max(gt,Bt+ue)}let wt=0,Ct=0;Me+wt<2&&(wt=2-Me),Ge+wt>i-2&&(wt=i-2-Ge),ct+Ct<2&&(Ct=2-ct),gt+Ct>s-2&&(Ct=s-2-gt);let Yt=[];for(let{e:Et,mx:Bt,my:Kt}of ce){let ue=Bt+wt,_e=Kt+Ct;An(Et,ue,_e,St),Yt.push({x2:ue,y2:_e,color:Be(Et.p).fill})}In.push({id:St,cx:Ft+wt,cy:Mt+Ct,count:mt.length,hitR:pe+Jt+6,legs:Yt})}let Zn=[],io=1.5,Oo=(mt,St,Ft,Mt,Jt,re,pe)=>{if(Jt!==0)return Jt;let ce=re*Fst;return pe&&Ft*(mt-pe.x)+Mt*(St-pe.y)<0?-ce:ce},lc=(mt,St,Ft,Mt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2,ce=St.cx-mt.cx,Me=St.cy-mt.cy,Ge=Math.hypot(ce,Me)||1,ct=Math.min(mt.r+io,Ge*.45),gt=Math.min(St.r+io,Ge*.45);if(!Ft&&Mt===0){let an=ce/Ge,Pe=Me/Ge,je=mt.cx+an*ct,Ae=mt.cy+Pe*ct,Ze=St.cx-an*gt,Oe=St.cy-Pe*gt;return`M${je},${Ae}L${Ze},${Oe}`}let wt=-Me/Ge,Ct=ce/Ge,Yt=Oo(re,pe,wt,Ct,Mt,Ge,Jt),Et=re+wt*Yt,Bt=pe+Ct*Yt,Kt=Math.hypot(Et-mt.cx,Bt-mt.cy)||1,ue=Math.hypot(St.cx-Et,St.cy-Bt)||1,_e=mt.cx+(Et-mt.cx)/Kt*ct,ke=mt.cy+(Bt-mt.cy)/Kt*ct,Re=St.cx-(St.cx-Et)/ue*gt,Xe=St.cy-(St.cy-Bt)/ue*gt;return`M${_e},${ke}Q${Et},${Bt} ${Re},${Xe}`},di=(mt,St,Ft,Mt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2;if(!Ft&&Mt===0)return{x:re,y:pe-4};let ce=St.cx-mt.cx,Me=St.cy-mt.cy,Ge=Math.hypot(ce,Me)||1,ct=-Me/Ge,gt=ce/Ge,wt=Oo(re,pe,ct,gt,Mt,Ge,Jt),Ct=wt*.5+Math.sign(wt||1)*8;return{x:re+ct*Ct,y:pe+gt*Ct}},ko=l.routes.flatMap(mt=>mt.legs).map(mt=>Number(mt.value)).filter(mt=>Number.isFinite(mt)&&mt>0),ma=ko.length?Math.min(...ko):0,ha=ko.length?Math.max(...ko):0,ui=mt=>{if(!Number.isFinite(mt)||mt<=0||ha<=0)return ac;let St=ha>ma?(mt-ma)/(ha-ma):1;return ac+St*(WF-ac)};for(let mt of l.routes){let St=mt.stopIds.map(Mt=>Nn.get(Mt)).filter(Mt=>!!Mt),Ft=St.length>=3?{x:St.reduce((Mt,Jt)=>Mt+Jt.cx,0)/St.length,y:St.reduce((Mt,Jt)=>Mt+Jt.cy,0)/St.length}:void 0;for(let Mt of mt.legs){let Jt=Nn.get(Mt.fromId),re=Nn.get(Mt.toId);if(!Jt||!re)continue;let pe=di(Jt,re,Mt.style==="arc",0,Ft),ce={curved:Mt.style==="arc",offset:0,center:Ft,labelX:pe.x,labelY:pe.y},Me=Mt.label!==void 0?Ut(Qt(ce.labelX,ce.labelY)):void 0,Ge=Number(Mt.value);Zn.push({d:lc(Jt,re,ce.curved,ce.offset,ce.center),width:ui(Ge),color:dn(Mt.tags)??Gt(o.text,o.bg,72),arrow:!0,fromId:Mt.fromId,toId:Mt.toId,...Number.isFinite(Ge)&&Ge>0&&{value:Ge},...Object.keys(Mt.tags).length>0&&{tags:Mt.tags},lineNumber:Mt.lineNumber,...Mt.label!==void 0&&{label:Mt.label,labelX:ce.labelX,labelY:ce.labelY,labelColor:Me.color,labelHalo:Me.halo,labelHaloColor:Me.haloColor}})}}let ga=l.edges.map(mt=>Number(mt.meta.width)).filter(mt=>Number.isFinite(mt)&&mt>0),fi=ga.length?Math.min(...ga):0,pi=ga.length?Math.max(...ga):0,ml=mt=>{let St=Number(mt.meta.width);if(!Number.isFinite(St)||St<=0||pi<=0)return ac;let Ft=pi>fi?(St-fi)/(pi-fi):1;return ac+Ft*(WF-ac)},Va=new Map;for(let mt of l.edges){let St=[mt.fromId,mt.toId].sort().join(" "),Ft=Va.get(St);Ft?Ft.push(mt):Va.set(St,[mt])}for(let mt of Va.values()){let St=[...mt].sort((Mt,Jt)=>Mt.lineNumber-Jt.lineNumber),Ft=St.length;St.forEach((Mt,Jt)=>{let re=Nn.get(Mt.fromId),pe=Nn.get(Mt.toId);if(!re||!pe)return;let ce=Ft>1?(Jt-(Ft-1)/2)*Bst:0,Me=Mt.style==="arc"||Ft>1,Ge=di(re,pe,Me,ce),ct={curved:Me,offset:ce,labelX:Ge.x,labelY:Ge.y},gt=Mt.label!==void 0?Ut(Qt(ct.labelX,ct.labelY)):void 0,wt=Number(Mt.meta.width);Zn.push({d:lc(re,pe,ct.curved,ct.offset),width:ml(Mt),color:dn(Mt.tags)??Gt(o.text,o.bg,66),arrow:Mt.directed,fromId:Mt.fromId,toId:Mt.toId,...Number.isFinite(wt)&&wt>0&&{value:wt},...Object.keys(Mt.tags).length>0&&{tags:Mt.tags},lineNumber:Mt.lineNumber,...Mt.label!==void 0&&{label:Mt.label,labelX:ct.labelX,labelY:ct.labelY,labelColor:gt.color,labelHalo:gt.halo,labelHaloColor:gt.haloColor}})})}let vr=[],ya=[...Z],ws=[],Vi=jn.map(mt=>({cx:mt.cx,cy:mt.cy,r:mt.r})),du=[];for(let mt of Zn){let St=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(mt.d);if(!St)continue;let Ft=+St[1],Mt=+St[2];if(St[3]!==void 0)du.push([Ft,Mt,+St[3],+St[4]]);else{let Jt=+St[5],re=+St[6],pe=+St[7],ce=+St[8],Me=8,Ge=Ft,ct=Mt;for(let gt=1;gt<=Me;gt++){let wt=gt/Me,Ct=1-wt,Yt=Ct*Ct*Ft+2*Ct*wt*Jt+wt*wt*pe,Et=Ct*Ct*Mt+2*Ct*wt*re+wt*wt*ce;du.push([Ge,ct,Yt,Et]),Ge=Yt,ct=Et}}}let Ui=mt=>Vi.some(St=>Uu(mt,St))||ya.some(St=>Sa(mt,St))||du.some(St=>N0(St[0],St[1],St[2],St[3],mt)),mi=l.directives.noRegionLabels!==!0,hi=new Set,to=l.directives.noRegionValue!==!0&&_,uu=mt=>to&&mt!==void 0?$m(mt):void 0,cc=i<wst,Xi=l.projection==="mercator"&&l.basemaps.subdivisions.includes("us-states")&&_,fu=6,dc=3,gr=1,ba=(mt,St=br)=>We(mt,St)+2*fu,Go=br+2*dc,Es=(mt,St,Ft=br)=>Math.max(ba(mt,Ft),St?We(St,Math.round(Ft*.82))+2*fu:0),pu=(mt,St=br)=>{let Ft=St+2*dc;return mt?Ft+gr+Math.round(St*.82):Ft},Op=22,uc=.06,fc=.32,mu=18,Vb=13,hu=15,Ub=Math.sqrt(Math.max(1,i*s)),Xb=(mt,St)=>{let Ft=Math.sqrt(Math.max(0,mt*St))/Ub;return Math.min(1,Math.max(0,(Ft-uc)/(fc-uc)))},gu=(mt,St,Ft,Mt,Jt,re,pe=br,ce)=>{let{color:Me,haloColor:Ge}=Ut(Mt),ct=ce??Me,gt=Math.round(pe*.82),wt=Math.max(We(Ft,pe),re?We(re,gt):0)/2,Ct=[St-pe*.55,St-pe*.1].some(Yt=>Qt(mt-wt,Yt)!==Mt||Qt(mt+wt,Yt)!==Mt);vr.push({x:mt,y:St,text:Ft,anchor:"middle",color:ct,halo:ce?!1:Ct,haloColor:Ge,...pe!==br&&{fontSize:pe},...re!==void 0&&{valueLine:re},lineNumber:Jt})},Ss=2,ta=(mt,St,Ft,Mt,Jt=br)=>{let re=Math.round(Jt*.82),pe=Math.max(We(Ft,Jt),Mt?We(Mt,re):0)+2*Ss,ce=Mt?Jt+gr+re:Jt;return{x:mt-pe/2,y:St-ce/2,w:pe,h:ce}};if(mi){let mt=new Set(l.poiFrameContainers),St=ne.map(Et=>{let Bt=mt.has(Et.id);if(Et.layer==="base"&&!Bt||Et.label===void 0)return null;let Kt=Et.layer==="us-state"||Et.id.startsWith("US-"),ue=Kt?p?.get(Et.id):f.get(Et.id);if(!ue)return null;let[[_e,ke],[Re,Xe]]=At.bounds(ue),an=Re-_e,Pe=Xe-ke,je=Kt&&!Xi?Et.id.replace(/^US-/,""):void 0,Ae=je!==void 0?cc?[je,Et.label]:Bt?[Et.label]:[Et.label,je]:[Et.label],Ze=Kt?void 0:Hk[Et.id],Oe=Ze?rt(Ze[0],Ze[1]):At.centroid(ue);return!Oe||!Number.isFinite(Oe[0])?null:{r:Et,c:Oe,boxW:an,boxH:Pe,area:an*Pe,candidates:Ae}}).filter(Et=>Et!==null).sort((Et,Bt)=>Bt.area-Et.area||Et.r.lineNumber-Bt.r.lineNumber),Ft=[...Z],Mt=[],Jt=Et=>Et===G||Et===R||Et===H,re=14,pe=jn.map(Et=>({x:Et.cx-Et.r-re,y:Et.cy-Et.r-re,w:2*(Et.r+re),h:2*(Et.r+re)})),ce=Math.max(46,Math.min(i,s)*.11),Me=4,Ge=9,ct=6,gt=ce*3,wt=ct,Ct=(Et,Bt,Kt,ue)=>{let _e=Math.atan2(ue,Kt),ke=gt;for(let Re=-2;Re<=2;Re++){let Xe=_e+Re*Math.PI/4,an=Math.cos(Xe),Pe=Math.sin(Xe),je=ct;for(;je<=gt;je+=ct){let Ae=Et+an*je,Ze=Bt+Pe*je;if(Ae<Po||Ze<Q||Ae>i-Po||Ze>s-Po||Qt(Ae,Ze)!==G)break}je<ke&&(ke=je)}return ke},Yt=(Et,Bt,Kt,ue,_e,ke=br,Re=Ge,Xe=ce)=>{let an=Es(ue,_e,ke),Pe=pu(_e!==void 0,ke),je=Math.SQRT1_2,Ae=[[0,-1],[0,1],[1,0],[-1,0],[je,-je],[je,je],[-je,-je],[-je,je]],Ze=null;for(let[Oe,qe]of Ae){let De=Et,xn=Bt,Mn=0,Rr=Math.ceil(Xe/Me)+1;for(;Mn<Rr&&Qt(De,xn)===Kt;)De+=Oe*Me,xn+=qe*Me,Mn++;if(Qt(De,xn)===Kt)continue;let Vo=(Math.abs(Oe)*an+Math.abs(qe)*Pe)/2,so=De+Oe*(Re+Vo),xa=xn+qe*(Re+Vo),kr={x:so-an/2,y:xa-Pe/2,w:an,h:Pe};if(kr.x<Po||kr.y<Q||kr.x+kr.w>i-Po||kr.y+kr.h>s-Po)continue;let gl=[kr.x+2,so,kr.x+kr.w-2],WL=[kr.y+2,xa,kr.y+kr.h-2],jt=!0;for(let pn of gl)for(let un of WL)if(!Jt(Qt(pn,un))){jt=!1;break}if(!jt||Ft.some(pn=>Sa(kr,pn))||pe.some(pn=>Sa(kr,pn))||Vi.some(pn=>Uu(kr,pn)))continue;let ge=so-Oe*(an/2),Le=xa-qe*(Pe/2),xe=Math.hypot(ge-Et,Le-Bt);if(xe>Xe||Mt.some(pn=>S_(Et,Bt,ge,Le,pn[0],pn[1],pn[2],pn[3]))||Ft.some(pn=>N0(Et,Bt,ge,Le,pn)))continue;let nn=Ct(so,xa,Oe,qe);(Ze===null||nn>Ze.clear+wt||nn>=Ze.clear-wt&&xe<Ze.len)&&(Ze={x:so,y:xa,rect:kr,leader:[Et,Bt,ge,Le],len:xe,clear:nn})}return Ze?{x:Ze.x,y:Ze.y,rect:Ze.rect,leader:Ze.leader}:null};for(let{r:Et,c:Bt,boxW:Kt,boxH:ue,candidates:_e}of St){let ke=uu(Et.value),Re=De=>!Ft.some(xn=>Sa(De,xn)),Xe=De=>!pe.some(xn=>Sa(De,xn)),an=q.has(Et.id),Pe=(De,xn,Mn)=>{let Rr=We(Mn,br)/2;return Qt(De-Rr,xn)===Et.fill&&Qt(De+Rr,xn)===Et.fill};if(an&&ke===void 0&&Et.label!==void 0){let De=_e[0],xn=-1;for(let Mn=mu;Mn>=br;Mn--){if(We(De,Mn)>Kt||Mn+2*dc>ue)continue;let Rr=ta(Bt[0],Bt[1],De,void 0,Mn);if(!Re(Rr)||!Xe(Rr)||Ui(Rr))continue;let Vo=We(De,Mn)/2;if(!(Qt(Bt[0]-Vo,Bt[1])!==Et.fill||Qt(Bt[0]+Vo,Bt[1])!==Et.fill)){xn=Mn;break}}if(xn>=Vb){let Mn=ta(Bt[0],Bt[1],De,void 0,xn);Ft.push(Mn),gu(Bt[0],Bt[1],De,Et.fill,Et.lineNumber,void 0,xn),hi.add(Et.id),ws.push({label:vr[vr.length-1],rect:Mn})}else{let Mn=Yt(Bt[0],Bt[1],Et.fill,Et.label,void 0,hu,Ge+hu,ce*2.2);if(Mn){Ft.push(Mn.rect),Mt.push(Mn.leader);let Rr=Gt(Et.fill,o.text,60);vr.push({x:Mn.x,y:Mn.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,fontSize:hu,leader:{x1:Mn.leader[0],y1:Mn.leader[1],x2:Mn.leader[2],y2:Mn.leader[3]},leaderColor:Rr,calloutDot:{x:Bt[0],y:Bt[1],color:Rr},lineNumber:Et.lineNumber}),hi.add(Et.id)}}continue}let je=[{x:Bt[0],y:Bt[1],guard:!1}];ke&&je.push({x:Bt[0],y:Bt[1]+ue*.26,guard:!0},{x:Bt[0],y:Bt[1]-ue*.26,guard:!0},{x:Bt[0]+Kt*.26,y:Bt[1],guard:!0},{x:Bt[0]-Kt*.26,y:Bt[1],guard:!0},{x:Bt[0]+Kt*.22,y:Bt[1]+ue*.22,guard:!0},{x:Bt[0]-Kt*.22,y:Bt[1]+ue*.22,guard:!0},{x:Bt[0]+Kt*.22,y:Bt[1]-ue*.22,guard:!0},{x:Bt[0]-Kt*.22,y:Bt[1]-ue*.22,guard:!0});let Ae;for(let De of je)if(!(De.guard&&Qt(De.x,De.y)!==Et.fill)){for(let xn of _e){let Mn=ta(De.x,De.y,xn);if(ke&&Es(xn,ke)<=Kt&&pu(!0)<=ue){let Rr=ta(De.x,De.y,xn,ke);if(Re(Rr)&&Xe(Mn)&&Pe(De.x,De.y,xn)){Ae={text:xn,valueLine:ke,ax:De.x,ay:De.y};break}}if(ba(xn)<=Kt&&Go<=ue&&Re(Mn)&&Xe(Mn)&&(ke===void 0||Pe(De.x,De.y,xn))){Ae={text:xn,ax:De.x,ay:De.y};break}}if(Ae)break}if(Ae===void 0&&Et.label!==void 0&&an){let De=Yt(Bt[0],Bt[1],Et.fill,Et.label,ke);if(De){Ft.push(De.rect),Mt.push(De.leader);let xn=Gt(Et.fill,o.text,60);vr.push({x:De.x,y:De.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,...ke!==void 0&&{valueLine:ke},leader:{x1:De.leader[0],y1:De.leader[1],x2:De.leader[2],y2:De.leader[3]},leaderColor:xn,calloutDot:{x:Bt[0],y:Bt[1],color:xn},lineNumber:Et.lineNumber}),hi.add(Et.id)}continue}if(Ae===void 0)continue;let Ze=Et.value===void 0&&Et.layer==="base",Oe=br;if(Ze){let De=Xb(Kt,ue),xn=Math.round(br+De*(Op-br)),Mn=Ae.valueLine!==void 0,Rr=so=>{let xa=We(Ae.text,so)/2;return[Ae.ax-xa,Ae.ax+xa].every(kr=>{let gl=Qt(kr,Ae.ay);return gl===Et.fill||Jt(gl)})},Vo=-1;for(let so=xn;so>=br;so--){if(Es(Ae.text,Ae.valueLine,so)>Kt||pu(Mn,so)>ue)continue;let xa=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,so),kr=ta(Ae.ax,Ae.ay,Ae.text,void 0,so);if(!(!Re(xa)||!Xe(kr)||Ui(kr))&&Rr(so)){Vo=so;break}}if(Vo<0){if(!mt.has(Et.id))continue;Oe=br}else Oe=Vo}let qe=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,Oe);Ft.push(qe),gu(Ae.ax,Ae.ay,Ae.text,Et.fill,Et.lineNumber,Ae.valueLine,Oe,Ze?D:void 0),hi.add(Et.id),ws.push({label:vr[vr.length-1],rect:qe})}for(let Et of yt){let Bt=cc?Et.iso.replace(/^US-/,""):Et.name,Kt=q.get(Et.iso),ue=uu(Kt?.value);gu(Et.x,Et.y,Bt,Kt?X(Kt):R,Et.lineNumber,ue),hi.add(Et.iso),ws.push({label:vr[vr.length-1],rect:ta(Et.x,Et.y,Bt,ue)})}}if(l.directives.noPoiLabels!==!0){let mt=[...jn].filter(jt=>jt.clusterId===void 0).sort((jt,ge)=>jt.lineNumber-ge.lineNumber||(jt.id<ge.id?-1:1)),St=new Map(l.pois.map(jt=>[jt.id,jt])),Ft=jt=>{let ge=St.get(jt.id);return ge?.label??ge?.name??jt.id},Mt=br*1.25,Jt=jt=>{let ge=Ft(jt);return{text:ge,w:We(ge,br)}},re=3,pe=Math.max(20,Math.round(Math.min(i,s)*.03)),ce=new Map;for(let jt of jn){if(jt.clusterId===void 0)continue;let ge=ce.get(jt.clusterId);ge?ge.push(jt):ce.set(jt.clusterId,[jt])}let Me=(jt,ge,Le)=>{switch(Le){case"right":return{x:jt.cx+jt.r+re,y:jt.cy-Mt/2,w:ge,h:Mt};case"left":return{x:jt.cx-jt.r-re-ge,y:jt.cy-Mt/2,w:ge,h:Mt};case"above":return{x:jt.cx-ge/2,y:jt.cy-jt.r-re-Mt,w:ge,h:Mt};case"below":return{x:jt.cx-ge/2,y:jt.cy+jt.r+re,w:ge,h:Mt};case"below-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy+xe,w:ge,h:Mt}}case"below-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-ge,y:jt.cy+xe,w:ge,h:Mt}}case"above-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy-xe-Mt,w:ge,h:Mt}}case"above-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-ge,y:jt.cy-xe-Mt,w:ge,h:Mt}}}},Ge=(jt,ge,Le,xe,nn)=>{let rn=Me(jt,Le,xe);ya.push(rn);let pn=xe==="right"||xe==="below-right"||xe==="above-right",un=xe==="left"||xe==="below-left"||xe==="above-left",cn=pn?"start":un?"end":"middle",Pn=pn?rn.x:un?rn.x+Le:jt.cx;vr.push({x:Pn,y:rn.y+Mt/2+br/3,text:ge,anchor:cn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,lineNumber:jt.lineNumber,...nn!==void 0&&{clusterMember:nn}})},ct=(jt,ge,Le)=>{let xe=Me(jt,ge,Le);return xe.x>=0&&xe.x+xe.w<=i&&xe.y>=0&&xe.y+xe.h<=s&&!Ui(xe)},gt=30,wt=[];for(let jt of mt){let ge=wt.find(Le=>Le.some(xe=>Math.hypot(xe.cx-jt.cx,xe.cy-jt.cy)<gt));ge?ge.push(jt):wt.push([jt])}let Yt=Mt+3,Et=16,Bt=jt=>jt.map(ge=>({p:ge,...Jt(ge)})).sort((ge,Le)=>ge.p.cy-Le.p.cy||(ge.text<Le.text?-1:1)),Kt=(jt,ge)=>{let Le=Math.min(...jt.map(Pn=>Pn.p.cx-Pn.p.r)),xe=Math.max(...jt.map(Pn=>Pn.p.cx+Pn.p.r)),nn=Math.max(...jt.map(Pn=>Pn.w)),rn=(Math.min(...jt.map(Pn=>Pn.p.cy))+Math.max(...jt.map(Pn=>Pn.p.cy)))/2,pn=ge==="right"?Math.min(xe+Et,i-pe-nn):Math.max(Le-Et,pe+nn),un=jt.length*Yt,cn=rn-un/2;return cn=Math.max(pe,Math.min(cn,s-un-pe)),jt.map((Pn,$o)=>{let Uo=cn+$o*Yt+Yt/2;return{o:Pn,colX:pn,rowCy:Uo,rect:{x:ge==="right"?pn:pn-Pn.w,y:Uo-Mt/2,w:Pn.w,h:Mt}}})},ue=(jt,ge)=>Kt(jt,ge).every(({rect:Le})=>Le.x>=0&&Le.x+Le.w<=i&&Le.y>=0&&Le.y+Le.h<=s&&!Ui(Le)),_e=1e3,ke=jt=>{let ge=[jt.x+jt.w*.15,jt.x+jt.w*.5,jt.x+jt.w*.85],Le=[jt.y+jt.h*.25,jt.y+jt.h*.75],xe=0;for(let pn of ge)for(let un of Le)Qt(pn,un)===G&&xe++;let nn=xe/(ge.length*Le.length),rn=Math.max(0,Math.min(jt.x,i-(jt.x+jt.w),jt.y,s-(jt.y+jt.h)));return _e*nn+rn*.1},Re=(jt,ge)=>{let Le=Kt(jt,ge);return Le.length===0?-1/0:Le.reduce((xe,{rect:nn})=>xe+ke(nn),0)/Le.length},Xe=jt=>Re(jt,"right")>=Re(jt,"left")?"right":"left",an=(jt,ge,Le)=>{for(let{o:xe,colX:nn,rowCy:rn,rect:pn}of Kt(jt,ge))ya.push(pn),vr.push({x:nn,y:rn+br/3,text:xe.text,anchor:ge==="right"?"start":"end",color:o.text,halo:!1,haloColor:o.bg,leader:{x1:xe.p.cx,y1:xe.p.cy,x2:ge==="right"?nn-2:nn+2,y2:rn},leaderColor:xe.p.fill,poiId:xe.p.id,lineNumber:xe.p.lineNumber,...Le!==void 0&&{clusterMember:Le}})},Pe=jt=>{let{text:ge,w:Le}=Jt(jt),xe=jt.cx+jt.r+re,nn="start";xe+Le>i&&(xe=jt.cx-jt.r-re-Le,nn="end");let rn=Math.max(0,Math.min(jt.cy-Mt/2,s-Mt));vr.push({x:nn==="start"?xe:xe+Le,y:rn+Mt/2+br/3,text:ge,anchor:nn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,hidden:!0,lineNumber:jt.lineNumber})},je=4,Ae=(jt,ge,Le)=>{let xe=jt.cx-ge,nn=jt.cy-Le;return Math.abs(nn)>=Math.abs(xe)?nn<=0?"above":"below":xe<0?"left":"right"},Ze=(jt,ge)=>{let Le=In.find(rn=>rn.id===ge);if(!Le||jt.length>je)return!1;let xe=[],nn=[];for(let{p:rn,text:pn,w:un}of jt){let cn=Ae(rn,Le.cx,Le.cy),$o=[cn,...["above","below","right","left"].filter(Uo=>Uo!==cn)].find(Uo=>{let Gr=Me(rn,un,Uo);return Gr.x>=0&&Gr.x+Gr.w<=i&&Gr.y>=0&&Gr.y+Gr.h<=s&&!Ui(Gr)&&!xe.some(pc=>Sa(pc,Gr))});if($o===void 0)return!1;xe.push(Me(rn,un,$o)),nn.push({p:rn,text:pn,w:un,side:$o})}for(let{p:rn,text:pn,w:un,side:cn}of nn)Ge(rn,pn,un,cn,ge);return!0};for(let[jt,ge]of ce){if(ge.length===0)continue;let Le=Bt(ge);if(Ze(Le,jt))continue;let xe=ue(Le,"right"),nn=ue(Le,"left"),rn=xe&&nn?Xe(Le):xe?"right":nn?"left":Xe(Le);an(Le,rn,jt)}let Oe=48,qe=8,De=.25,xn=(jt,ge,Le,xe,nn,rn)=>{let pn=nn-Le,un=rn-xe,cn=pn*pn+un*un,Pn=cn>0?((jt-Le)*pn+(ge-xe)*un)/cn:0;return Pn=Math.max(0,Math.min(1,Pn)),Math.hypot(jt-(Le+Pn*pn),ge-(xe+Pn*un))},Mn=(jt,ge)=>{let Le=jt.x+jt.w/2,xe=jt.y+jt.h/2,nn=Oe;for(let rn of jn)rn.id!==ge&&(nn=Math.min(nn,Math.hypot(rn.cx-Le,rn.cy-xe)-rn.r));for(let rn of du)nn=Math.min(nn,xn(Le,xe,rn[0],rn[1],rn[2],rn[3]));return Math.max(0,nn)},Rr={right:160,left:160,above:100,below:100,"below-right":0,"below-left":0,"above-right":0,"above-left":0},Vo=Object.keys(Rr),so=(jt,ge,Le)=>{let xe=Me(jt,ge,Le);return qe*Mn(xe,jt.id)+De*ke(xe)+Rr[Le]},xa=pst*Math.min(i,s),kr=[];for(let jt of wt){let ge=Bt(jt);if(jt.length===1){let{p:un,text:cn,w:Pn}=ge[0],$o=Vo.filter(Gr=>ct(un,Pn,Gr)).map(Gr=>({s:Gr,v:so(un,Pn,Gr)}));if($o.length===0){an(ge,Xe(ge));continue}let Uo=$o.reduce((Gr,pc)=>pc.v>Gr.v?pc:Gr).s;Ge(un,cn,Pn,Uo);continue}let Le=Math.min(...ge.map(un=>un.p.cx-un.p.r)),xe=Math.max(...ge.map(un=>un.p.cx+un.p.r)),nn=Math.min(...ge.map(un=>un.p.cy)),rn=Math.max(...ge.map(un=>un.p.cy));Math.hypot(xe-Le,rn-nn)>xa||ge.length>mst?ge.forEach(un=>Pe(un.p)):kr.push(ge)}for(let jt of kr){let ge=["right","left"].filter(xe=>ue(jt,xe)),Le=ge.length>1?Xe(jt):ge[0];Le?an(jt,Le):jt.forEach(xe=>Pe(xe.p))}let gl=r._poiClearancePass??0;if(gl<4&&jn.length>0){let jt=pe,ge=Math.floor(i*.3),Le=Math.floor(s*.3),xe=new Map(jn.map(cn=>[cn.id,cn])),nn=0,rn=0,pn=0,un=0;for(let cn of jn)nn=Math.max(nn,jt-(cn.cx-cn.r)),rn=Math.max(rn,cn.cx+cn.r+jt-i),pn=Math.max(pn,jt-(cn.cy-cn.r)),un=Math.max(un,cn.cy+cn.r+jt-s);for(let cn of vr){if(cn.poiId===void 0)continue;let Pn=xe.get(cn.poiId);if(!Pn)continue;if(cn.hidden||cn.leader){let E5=cn.hidden?Jt(Pn).w:We(cn.text,br),BL=Pn.r+Et+E5+jt;Pn.cx>=i/2?rn=Math.max(rn,Pn.cx+BL-i):nn=Math.max(nn,BL-Pn.cx);continue}let $o=We(cn.text,br),Uo=cn.anchor==="start"?cn.x:cn.anchor==="end"?cn.x-$o:cn.x-$o/2,Gr=cn.y-br/3-Mt/2,pc=Uo+$o,w5=Gr+Mt;nn=Math.max(nn,jt-Uo),rn=Math.max(rn,pc+jt-i),pn=Math.max(pn,jt-Gr),un=Math.max(un,w5+jt-s)}if(nn=Math.min(Math.max(0,Math.ceil(nn)),ge),rn=Math.min(Math.max(0,Math.ceil(rn)),ge),pn=Math.min(Math.max(0,Math.ceil(pn)),Le),un=Math.min(Math.max(0,Math.ceil(un)),Le),nn>=1||rn>=1||pn>=1||un>=1){let cn=r._calloutReserve,Pn=Math.min((cn?.left??0)+nn,ge),$o=Math.min((cn?.right??0)+rn,ge),Uo=Math.min((cn?.top??0)+pn,Le),Gr=Math.min((cn?.bottom??0)+un,Le);return zk(l,e,n,{...r,_poiClearancePass:gl+1,_calloutReserve:{...Pn>0&&{left:Pn},...$o>0&&{right:$o},...Uo>0&&{top:Uo},...Gr>0&&{bottom:Gr}}})}}}if(ws.length>0){let St=vr.filter(Ft=>Ft.poiId!==void 0&&Ft.hidden!==!0).map(Ft=>{let Mt=We(Ft.text,br);return{x:(Ft.anchor==="start"?Ft.x:Ft.anchor==="end"?Ft.x-Mt:Ft.x-Mt/2)-2,y:Ft.y-br,w:Mt+4,h:br*1.4+4}});for(let Ft of ws)if(St.some(Mt=>Sa(Mt,Ft.rect))){let Mt=vr.indexOf(Ft.label);Mt>=0&&vr.splice(Mt,1)}}if(Zn.some(mt=>mt.label!==void 0)){let mt=vr.filter(Mt=>!Mt.hidden).map(Mt=>{let Jt=ba(Mt.text);return{x:Mt.anchor==="start"?Mt.x:Mt.anchor==="end"?Mt.x-Jt:Mt.x-Jt/2,y:Mt.y-Go/2,w:Jt,h:Go}}),St=[],Ft=[.5,.42,.58,.34,.66,.28,.72];for(let Mt=0;Mt<Zn.length;Mt++){let Jt=Zn[Mt];if(Jt.label===void 0)continue;let re=Nn.get(Jt.fromId),pe=Nn.get(Jt.toId);if(!re||!pe)continue;let ce=ba(Jt.label),Me=pe.cx-re.cx,Ge=pe.cy-re.cy,ct=Math.hypot(Me,Ge)||1,gt=-Ge/ct,wt=Me/ct,Ct=Go+2,Yt=Jt.width??ac,Et=Yt/2+Go/2+3,Bt=Yt>=4?[Et,-Et,Et+Ct,-(Et+Ct),0]:[0,Ct,-Ct,2*Ct,-2*Ct],Kt=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(Jt.d),ue=Ae=>{if(Kt?.[5]!==void 0){let Ze=1-Ae;return[Ze*Ze*+Kt[1]+2*Ze*Ae*+Kt[5]+Ae*Ae*+Kt[7],Ze*Ze*+Kt[2]+2*Ze*Ae*+Kt[6]+Ae*Ae*+Kt[8]]}return Kt?.[3]!==void 0?[+Kt[1]+(+Kt[3]-+Kt[1])*Ae,+Kt[2]+(+Kt[4]-+Kt[2])*Ae]:[re.cx+Me*Ae,re.cy+Ge*Ae]},_e=[];for(let Ae of Bt)for(let Ze of Ft){let[Oe,qe]=ue(Ze);_e.push([Oe+gt*Ae,qe+wt*Ae-4])}let ke=([Ae,Ze])=>{let Oe={x:Ae-ce/2,y:Ze-Go/2,w:ce,h:Go};return!(Oe.x<0||Oe.x+ce>i||Oe.y<0||Oe.y+Oe.h>s||Vi.some(qe=>Uu(Oe,qe))||mt.some(qe=>Sa(qe,Oe))||St.some(qe=>Sa(qe,Oe)))},Re=ue(.5),[Xe,an]=_e.find(ke)??[Re[0],Re[1]-4],Pe=Ut(Qt(Xe,an));Zn[Mt]={...Jt,labelX:Xe,labelY:an,labelColor:Pe.color,labelHalo:Pe.halo,labelHaloColor:Pe.haloColor};let je={x:Xe-ce/2,y:an-Go/2,w:ce,h:Go};St.push(je),ya.push(je)}}if(l.directives.noContextLabels!==!0){for(let ct of vr){if(ct.hidden)continue;let gt=ba(ct.text),wt=ct.anchor==="start"?ct.x:ct.anchor==="end"?ct.x-gt:ct.x-gt/2;ya.push({x:wt,y:ct.y-Go/2,w:gt,h:Go})}for(let ct of dt)ya.push({x:ct.x,y:ct.y,w:ct.w,h:ct.h});let mt=[],St=[];for(let ct of f.values()){let gt=typeof ct.id=="string"?ct.id:String(ct.id??"");if(!gt||q.has(gt)||hi.has(gt)||g&&gt==="US")continue;let wt=!1;for(let ke of q.keys())if(ke.startsWith(gt+"-")){wt=!0;break}if(wt)continue;let Ct=At.bounds(ct),[Yt,Et]=Ct[0],[Bt,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Bt))continue;let ue=Hk[gt],_e=ue?rt(ue[0],ue[1]):At.centroid(ct);St.push({f:ct,iso:gt,name:ct.properties?.name??gt,bbox:[Yt,Et,Bt,Kt],anchor:_e&&Number.isFinite(_e[0])?[_e[0],_e[1]]:null,curatedLngLat:ue??null,area:(Bt-Yt)*(Kt-Et)})}let Ft=Dk(Math.max(Nt,Vt)),Mt=Ok(i,s,Ft),Jt=Ft!=="world",re=Mt+IF,pe=St.map((ct,gt)=>({idx:gt,area:ct.area})).filter(ct=>Number.isFinite(ct.area)&&ct.area>0).sort((ct,gt)=>gt.area-ct.area).slice(0,re),ce=new Set(pe.map(ct=>ct.idx));for(let ct=0;ct<St.length;ct++){let gt=St[ct],wt=gt.anchor,Ct;if(ce.has(ct)&&wt){let Yt=gs(gt.f),Et=Vst({geometry:gt.f.geometry,bounds:Yt,project:rt,width:i,height:s,curated:gt.curatedLngLat});Et.length&&(Ct=Et.map(Bt=>Bt.screen),wt=Ct[0])}mt.push({name:gt.name,bbox:gt.bbox,anchor:wt,curatedAnchor:!!gt.curatedLngLat,bordering:Jt,...Ct?{positions:Ct}:{}})}let Me=(l.poiFrameContainers??[]).some(ct=>ct.startsWith("US-"));if(p&&Me)for(let[ct,gt]of p){if(q.has(ct)||hi.has(ct))continue;let wt=$t(gt);if(!wt)continue;let Ct=At.bounds(wt),[Yt,Et]=Ct[0],[Bt,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Bt))continue;let ue=At.centroid(wt);mt.push({name:gt.properties?.name??ct,bbox:[Yt,Et,Bt,Kt],anchor:ue&&Number.isFinite(ue[0])?[ue[0],ue[1]]:null})}let Ge=PF({projection:l.projection,dLonSpan:Nt,dLatSpan:Vt,width:i,height:s,waterBodies:e.waterBodies,countries:mt,palette:o,countryTone:D,waterTone:W,project:rt,collides:Ui,overLand:(ct,gt)=>Qt(ct,gt)!==G});vr.push(...Ge)}let hl=[];if(l.directives.noCities!==!0){let ce=Math.log10(5e4),Me=Math.log10(15e6)-ce,Ge=wt=>wt>5e4?.7+Math.min(1,(Math.log10(wt)-ce)/Me)*(2.6-.7):.7,ct=jn.map(wt=>({x:wt.cx,y:wt.cy})),gt=[...e.gazetteer.cities].sort((wt,Ct)=>Ct[3]-wt[3]);for(let wt of gt){if(hl.length>=220)break;let Ct=wt[0],Yt=wt[1],Et=rt(Yt,Ct);if(!Et)continue;let[Bt,Kt]=Et;if(Bt<0||Bt>i||Kt<0||Kt>s)continue;let ue=!1;for(let _e of ct){let ke=_e.x-Bt,Re=_e.y-Kt;if(ke*ke+Re*Re<144){ue=!0;break}}ue||(ct.push({x:Bt,y:Kt}),hl.push({cx:Bt,cy:Kt,r:Ge(wt[3])}))}}return{width:i,height:s,background:G,title:tt,...l.subtitle!==void 0&&{subtitle:l.subtitle},...l.caption!==void 0&&{caption:l.caption},regions:ne,rivers:Je,relief:de,reliefHatch:te,coastlineStyle:ae,legs:Zn,pois:jn,cityDots:hl,clusters:In,labels:vr,legend:et,insets:dt,insetRegions:ut,projection:c,stretch:pt,diagnostics:[]}}var Po,Gk,OF,dst,$k,ust,cb,$F,HF,fst,ac,WF,br,Hk,pst,mst,BF,hst,gst,FF,YF,yst,bst,xst,wst,Est,zF,Sst,vst,kst,VF,Lst,Nst,Mst,UF,Tst,Cst,_st,Ast,Rst,Ist,Pst,Dst,Ost,Gst,$st,Hst,Wst,Bst,Fst,XF,Ust,Xst,jst,Kst,Bk,Fk,Zst,Yk,jF,nlt,Vk=st(()=>{"use strict";Ke();ab();Pv();tn();Nk();MF();xr();M0();Mr();b0();Ak();DF();Po=24,Gk=1,OF=.6,dst=1.25;$k=15,ust=6,cb=4,$F=22,HF=.92,fst=.55,ac=1.25,WF=8,br=11,Hk={US:[-98.5,39.5],RU:[45,58]},pst=.18,mst=7,BF=4.5,hst=12,gst=24,FF=60,YF=68,yst=24,bst=24,xst=1.3,wst=480,Est=12,zF=2,Sst=1.5,vst=.2,kst=26,VF=5,Lst=.0016,Nst=.0028,Mst=.0014,UF=.5,Tst=.1,Cst=6e-4,_st=6e-4,Ast=32,Rst=30,Ist=62,Pst=28,Dst=16,Ost=9,Gst=2.399963229728653,$st=1,Hst=8,Wst=4,Bst=16,Fst=.18;XF=new WeakMap;Ust=()=>up().parallels([29.5,45.5]).rotate([96,0]),Xst=()=>up().rotate([154,0]).center([-2,58.5]).parallels([55,65]),jst=()=>eb();Kst=new Set(["US-AK","US-HI"]),Bk=(t,e)=>e>=51&&(t<=-129||t>=172),Fk=(t,e)=>e>=18&&e<=23&&t>=-161&&t<=-154,Zst={CA:["US-AK","US-WA","US-ID","US-MT","US-ND","US-MN","US-MI","US-NY","US-VT","US-NH","US-ME"],MX:["US-CA","US-AZ","US-NM","US-TX"]},Yk=new Set(["US-AK","US-HI","US-AS","US-GU","US-MP","US-PR","US-VI"]);jF=new WeakMap,nlt=8});var t3={};ye(t3,{renderMap:()=>JF,renderMapForExport:()=>slt});function olt(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let[i,s]=n[o],[l,c]=n[a];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function qF(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e+"Z"}function KF(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e}function alt(t,e){if(!e)return[qF(t)];let n=t.length,r=.75,o=p=>Math.abs(p)<=r,a=p=>Math.abs(p-e.w)<=r,i=p=>Math.abs(p)<=r,s=p=>Math.abs(p-e.h)<=r,l=(p,m)=>o(p[0])&&o(m[0])||a(p[0])&&a(m[0])||i(p[1])&&i(m[1])||s(p[1])&&s(m[1]),c=-1;for(let p=0;p<n;p++)if(l(t[p],t[(p+1)%n])){c=p;break}if(c===-1)return[qF(t)];let d=[],u=[],f=(c+1)%n;for(let p=0;p<n;p++){let m=(f+p)%n,h=t[m],g=t[(m+1)%n];if(l(h,g)){u.length>=2&&d.push(KF(u)),u=[];continue}u.length===0&&u.push(h),u.push(g)}return u.length>=2&&d.push(KF(u)),d}function ZF(t,e,n){let r=[];for(let o of t){let a=o.rings??Ep(o.d);for(let i=0;i<a.length;i++){let s=a[i];if(s.length<3)continue;let l=1/0,c=1/0,d=-1/0,u=-1/0;for(let[h,g]of s)h<l&&(l=h),h>d&&(d=h),g<c&&(c=g),g>u&&(u=g);if(Math.max(d-l,u-c)<e)continue;let[f,p]=s[0],m=0;for(let h=0;h<a.length;h++)h!==i&&olt(f,p,a[h])&&m++;m%2!==1&&r.push(...alt(s,n))}}return r}function QF(t,e,n,r,o,a){let i=r.join(" ");if(!i)return;e.append("path").attr("id",n).attr("d",i).attr("fill","none");let s=`#${n}`,l=[...o.lines].sort((c,d)=>d.d-c.d);for(let c of l)t.append("use").attr("href",s).attr("stroke",o.color).attr("stroke-width",2*(c.d+c.thickness)).attr("stroke-opacity",c.opacity).attr("stroke-linejoin","round").attr("stroke-linecap","round"),t.append("use").attr("href",s).attr("stroke",a).attr("stroke-width",2*c.d).attr("stroke-linejoin","round").attr("stroke-linecap","round")}function JF(t,e,n,r,o,a,i,s){Rt(t).selectAll(":not([data-d3-tooltip])").remove();let l=i?.width??t.clientWidth,c=i?.height??t.clientHeight;if(l<=0||c<=0)return;let d=zk(e,n,{width:l,height:c},{palette:r,isDark:o,preferContain:i?.preferContain??!1,legendMode:i?"export":"preview",...s!==void 0&&{activeGroup:s}}),u=Rt(t).append("svg").attr("width",l).attr("height",c).attr("viewBox",`0 0 ${l} ${c}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It).style("background",d.background);u.append("rect").attr("width",l).attr("height",c).attr("fill",d.background);let f=u.append("defs"),p=ilt++,m=w=>`${w}__m${p}`,h=w=>Math.min(15,7+w*.95),g=r.bg,E=u.append("g").attr("class","dgmo-map-regions"),y=(w,k,N)=>{let _=w.append("path").attr("d",k.d).attr("fill",k.fill).attr("stroke",k.stroke).attr("stroke-width",N);if(k.label&&_.attr("data-region-name",k.label),k.id&&k.id!=="lake"&&_.attr("data-iso",k.id),k.labelX!==void 0&&k.labelY!==void 0&&_.attr("data-label-x",k.labelX).attr("data-label-y",k.labelY),k.layer!=="base"&&(_.classed("dgmo-map-region",!0).attr("data-region",k.id),k.value!==void 0&&_.attr("data-value",k.value),k.tags))for(let[T,R]of Object.entries(k.tags))_.attr(`data-tag-${T.toLowerCase()}`,R.toLowerCase());k.lineNumber>=0&&(_.attr("data-line-number",k.lineNumber),a&&_.style("cursor","pointer").on("click",()=>a(k.lineNumber)))};for(let w of d.regions)y(E,w,.5);if(d.relief.length&&d.reliefHatch){let w=d.reliefHatch,k=m("dgmo-relief-clip"),N=m("dgmo-relief-land"),_=f.append("clipPath").attr("id",k);for(let G of d.relief)_.append("path").attr("d",G.d);let T=f.append("clipPath").attr("id",N);for(let G of d.regions)G.id!=="lake"&&T.append("path").attr("d",G.d);let R=u.append("g").attr("clip-path",`url(#${N})`).style("pointer-events","none").append("g").attr("class","dgmo-map-relief").attr("clip-path",`url(#${k})`).attr("stroke",w.color).attr("stroke-width",w.width).attr("vector-effect","non-scaling-stroke");for(let G=w.spacing;G<c;G+=w.spacing)R.append("line").attr("x1",0).attr("y1",G).attr("x2",l).attr("y2",G)}if(d.coastlineStyle){let w=d.coastlineStyle,k=m("dgmo-map-water-mask"),N=f.append("mask").attr("id",k).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c);N.append("rect").attr("x",0).attr("y",0).attr("width",l).attr("height",c).attr("fill","white");let _=d.regions.filter(I=>I.id!=="lake").map(I=>I.d).join(" "),T=d.regions.filter(I=>I.id==="lake").map(I=>I.d).join(" ");if(_&&N.append("path").attr("d",_).attr("fill","black"),T&&N.append("path").attr("d",T).attr("fill","white"),d.insets.length){let I=Math.max(0,...w.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";N.append("path").attr("d",O).attr("fill","black").attr("stroke","black").attr("stroke-width",2*I).attr("stroke-linejoin","round")}}let R=u.append("g").attr("class","dgmo-map-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${k})`);QF(R,f,m("dgmo-map-coast"),ZF(d.regions,w.minExtent,{w:l,h:c}),w,d.background);let G=new Map;for(let I of d.regions){let H=G.get(I.stroke);H?H.push(I.d):G.set(I.stroke,[I.d])}for(let[I,H]of G)R.append("path").attr("d",H.join(" ")).attr("stroke",I).attr("stroke-width",.5).attr("stroke-linejoin","round")}if(d.rivers.length){let w=u.append("g").attr("class","dgmo-map-rivers").attr("fill","none").style("pointer-events","none");for(let k of d.rivers)w.append("path").attr("d",k.d).attr("stroke",k.color).attr("stroke-width",k.width).attr("stroke-linecap","round").attr("stroke-linejoin","round")}if(d.cityDots.length){let w=u.append("g").attr("class","dgmo-map-cities").attr("fill",r.textMuted).attr("fill-opacity",.28).style("pointer-events","none");for(let k of d.cityDots)w.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",k.r)}let b=!i&&!e.directives.noClusterPois,S=d.labels.filter(w=>w.poiId!==void 0&&!w.hidden);if(S.length){let w=m("dgmo-map-label-patch-blur");f.append("filter").attr("id",w).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%").append("feGaussianBlur").attr("in","SourceGraphic").attr("stdDeviation",2.5);let k=8,N=(_,T,R)=>{if(!_.length)return;let I=f.append("mask").attr("id",T).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c).append("g").attr("filter",`url(#${w})`),H=[];for(let D of _){let W=D.lines&&D.lines.length>1,z=W?Math.max(...D.lines.map(K=>_t(K,Fa))):_t(D.text,Fa),P=W?D.lines.length*(Fa+2):Fa,B=D.anchor==="start"?D.x+z/2:D.anchor==="end"?D.x-z/2:D.x,Y=D.y-Fa*.3,V=z+8,j=P+6;I.append("rect").attr("x",B-V/2).attr("y",Y-j/2).attr("width",V).attr("height",j).attr("rx",j/2).attr("fill","white"),H.push({x0:B-V/2-k,y0:Y-j/2-k,x1:B+V/2+k,y1:Y+j/2+k})}let O=u.append("g").attr("class","dgmo-map-label-patch").attr("mask",`url(#${T})`).style("pointer-events","none");R!==void 0&&O.attr("data-cluster-deco",R);for(let D of d.regions){let W,z,P,B;if(D.bbox)[W,z,P,B]=D.bbox;else{W=1/0,z=1/0,P=-1/0,B=-1/0;for(let V of Ep(D.d))for(let[j,K]of V)j<W&&(W=j),j>P&&(P=j),K<z&&(z=K),K>B&&(B=K)}H.some(V=>W<=V.x1&&P>=V.x0&&z<=V.y1&&B>=V.y0)&&O.append("path").attr("d",D.d).attr("fill",D.fill)}};if(b){N(S.filter(R=>R.clusterMember===void 0),m("dgmo-map-label-patch"));let _=new Map;for(let R of S){if(R.clusterMember===void 0)continue;let G=_.get(R.clusterMember);G?G.push(R):_.set(R.clusterMember,[R])}let T=0;for(let[R,G]of _)N(G,m(`dgmo-map-label-patch-c${T++}`),R)}else N(S,m("dgmo-map-label-patch"))}if(d.insets.length){let w=u.append("g").attr("class","dgmo-map-insets");d.insets.forEach((k,N)=>{let _=k.points.map((T,R)=>`${R?"L":"M"}${T[0]},${T[1]}`).join("")+"Z";if(w.append("path").attr("d",_).attr("fill",d.background).attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round"),k.contextLand){let T=m(`dgmo-map-inset-clip-${N}`);f.append("clipPath").attr("id",T).append("path").attr("d",_),w.append("path").attr("d",k.contextLand.d).attr("fill",k.contextLand.fill).attr("clip-path",`url(#${T})`)}});for(let k of d.insetRegions)y(w,k,.5);if(d.coastlineStyle){let k=d.coastlineStyle,N=m("dgmo-map-inset-water-mask"),_=f.append("mask").attr("id",N).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c),T=Math.max(0,...k.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";_.append("path").attr("d",O).attr("fill","white").attr("stroke","black").attr("stroke-width",2*T).attr("stroke-linejoin","round")}d.insets.forEach((H,O)=>{H.contextLand&&_.append("path").attr("d",H.contextLand.d).attr("fill","black").attr("clip-path",`url(#${m(`dgmo-map-inset-clip-${O}`)})`)});for(let H of d.insetRegions)H.id!=="lake"&&_.append("path").attr("d",H.d).attr("fill","black");for(let H of d.insetRegions)H.id==="lake"&&_.append("path").attr("d",H.d).attr("fill","white");let R=m("dgmo-map-inset-water-clip"),G=f.append("clipPath").attr("id",R);for(let H of d.insets){let O=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";G.append("path").attr("d",O)}let I=w.append("g").attr("clip-path",`url(#${R})`).append("g").attr("class","dgmo-map-inset-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${N})`);QF(I,f,m("dgmo-map-inset-coast"),ZF(d.insetRegions,k.minExtent),k,d.background);for(let H of d.insetRegions)I.append("path").attr("d",H.d).attr("stroke",H.stroke).attr("stroke-width",.5).attr("stroke-linejoin","round")}for(let k of d.insets){let N=k.points.map((_,T)=>`${T?"L":"M"}${_[0]},${_[1]}`).join("")+"Z";w.append("path").attr("d",N).attr("fill","none").attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round").style("pointer-events","none")}}let x=(w,k)=>{k<1||(w.attr("data-line-number",k),a&&w.style("cursor","pointer").on("click",()=>a(k)))},L=u.append("g").attr("class","dgmo-map-legs").attr("fill","none"),v=w=>{let k=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(w);if(!k)return null;let N=+k[1],_=+k[2],T,R,G,I;k[3]!==void 0?(T=+k[3],R=+k[4],G=N,I=_):(T=+k[7],R=+k[8],G=+k[5],I=+k[6]);let H=T-G,O=R-I,D=Math.hypot(H,O);return D>0?{ex:T,ey:R,tx:H/D,ty:O/D}:null};d.legs.forEach(w=>{let k=w.arrow?v(w.d):null,N=w.d,_=null;if(k){let R=h(w.width),G=Math.max(R*.5,w.width*.6+1),I=k.ex-k.tx*R,H=k.ey-k.ty*R,O=-k.ty,D=k.tx;_=`M${I+O*G},${H+D*G}L${k.ex},${k.ey}L${I-O*G},${H-D*G}z`,N=w.d.replace(/(-?[\d.]+),(-?[\d.]+)$/,`${I.toFixed(2)},${H.toFixed(2)}`)}let T=L.append("path").attr("d",N).attr("stroke",w.color).attr("stroke-width",w.width).attr("stroke-linecap","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[R,G]of Object.entries(w.tags))T.attr(`data-tag-${R.toLowerCase()}`,G.toLowerCase());if(x(T,w.lineNumber),w.value!==void 0&&(T.attr("data-value",w.value),T.append("title").text(w.label!==void 0?`${w.label}: ${w.value}`:`${w.value}`)),_){let R=L.append("path").attr("d",_).attr("fill",w.color).attr("stroke",w.color).attr("stroke-width",1).attr("stroke-linejoin","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[G,I]of Object.entries(w.tags))R.attr(`data-tag-${G.toLowerCase()}`,I.toLowerCase())}if(w.label!==void 0&&w.labelX!==void 0){let R=Sp(L,w.labelX,w.labelY??0,w.label,"middle",w.labelColor??r.textMuted,w.labelHaloColor??g,w.labelHalo??!0,Fa-1);x(R,w.lineNumber)}});let A=u.append("g").attr("class","dgmo-map-spider");for(let w of d.clusters){b&&A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.hitR).attr("fill","transparent").attr("data-cluster-hit",w.id).style("cursor","pointer");for(let k of w.legs)A.append("line").attr("x1",w.cx).attr("y1",w.cy).attr("x2",k.x2).attr("y2",k.y2).attr("stroke",k.color).attr("stroke-width",1).attr("data-cluster-deco",w.id).style("pointer-events","none");A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",2).attr("fill",Gt(r.textMuted,r.bg,40)).attr("data-cluster-deco",w.id).style("pointer-events","none")}let C=u.append("g").attr("class","dgmo-map-pois");for(let w of d.pois){w.isOrigin&&C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r+3).attr("fill","none").attr("stroke",w.stroke).attr("stroke-width",1.5);let k=C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r).attr("fill",w.fill).attr("fill-opacity",w.fillOpacity).attr("stroke",w.stroke).attr("stroke-width",1).attr("data-line-number",w.lineNumber).attr("data-poi",w.id);if(w.clusterId!==void 0&&k.attr("data-cluster-member",w.clusterId),w.tags)for(let[N,_]of Object.entries(w.tags))k.attr(`data-tag-${N.toLowerCase()}`,_.toLowerCase());a&&k.style("cursor","pointer").on("click",()=>a(w.lineNumber)),w.routeNumber!==void 0&&Sp(C,w.cx,w.cy+3,String(w.routeNumber),"middle",r.bg,w.fill,!1,Fa-2)}let M=u.append("g").attr("class","dgmo-map-labels");for(let w of d.labels){if(w.hidden){if(i)continue;Sp(M,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing).attr("data-poi",w.poiId??null).attr("data-poi-hidden","").style("opacity",0).style("pointer-events","none");continue}if(w.leader){let N=M.append("line").attr("x1",w.leader.x1).attr("y1",w.leader.y1).attr("x2",w.leader.x2).attr("y2",w.leader.y2).attr("stroke",w.leaderColor??Gt(r.textMuted,r.bg,60)).attr("stroke-width",w.leaderColor?1:.75);w.poiId!==void 0&&N.attr("data-poi",w.poiId),w.clusterMember!==void 0&&N.attr("data-cluster-member",w.clusterMember),x(N,w.lineNumber)}w.calloutDot&&M.append("circle").attr("cx",w.calloutDot.x).attr("cy",w.calloutDot.y).attr("r",2.5).attr("fill",w.calloutDot.color).attr("stroke",Gt(r.text,r.bg,55)).attr("stroke-width",.75);let k=Sp(M,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing,w.lines,w.valueLine);w.poiId!==void 0&&k.attr("data-poi",w.poiId).style("cursor","default"),w.clusterMember!==void 0&&k.attr("data-cluster-member",w.clusterMember),x(k,w.lineNumber)}if(b&&d.clusters.length){let w=u.append("g").attr("class","dgmo-map-cluster-badges");for(let k of d.clusters){let N=w.append("g").attr("data-cluster",k.id).style("opacity",0).style("pointer-events","none"),_=9;N.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",_).attr("fill",Gt(r.textMuted,r.bg,35)).attr("stroke",r.textMuted).attr("stroke-width",1),N.append("circle").attr("cx",k.cx).attr("cy",k.cy).attr("r",_+2.5).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1);let T=_+2.5;for(let R of k.legs){let G=Math.atan2(R.y2-k.cy,R.x2-k.cx);N.append("circle").attr("class","dgmo-map-cluster-bead").attr("cx",k.cx+T*Math.cos(G)).attr("cy",k.cy+T*Math.sin(G)).attr("r",1.8).attr("fill",R.color).attr("stroke",r.bg).attr("stroke-width",.5)}Sp(N,k.cx,k.cy+3,String(k.count),"middle",r.text,r.bg,!1,Fa)}}if(d.legend){let w=(d.title?50:0)+(d.subtitle?20:0)+8,k=u.append("g").attr("class","dgmo-map-legend").attr("transform",`translate(0, ${w})`),N=sb(d.legend);if(N.length>0){let _=lb(N,i?"export":"preview");fn(k,{..._,palette:r,isDark:o,width:l,activeGroup:d.legend.activeGroup})}}d.title&&u.append("text").attr("class","dgmo-map-title").attr("x",l/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.title),d.subtitle&&u.append("text").attr("class","dgmo-map-subtitle").attr("x",l/2).attr("y",50).attr("text-anchor","middle").attr("font-size",Fa+1).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.subtitle),d.caption&&u.append("text").attr("x",l/2).attr("y",c-8).attr("text-anchor","middle").attr("font-size",Fa).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.caption)}function slt(t,e,n,r,o,a){JF(t,e,n,r,o,void 0,a)}function Sp(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=t.append("text").attr("x",e).attr("y",n).attr("text-anchor",o).attr("font-size",l).attr("fill",a);if(u&&u.length>1){let m=l+2,h=-((u.length-1)/2)*m;u.forEach((g,E)=>{p.append("tspan").attr("x",e).attr("dy",E===0?h:m).text(g)})}else if(f!==void 0){let m=Math.round(l*.82);p.append("tspan").attr("x",e).attr("dy",-l*.28).text(r),p.append("tspan").attr("x",e).attr("dy",l*.92).attr("font-size",m).attr("fill-opacity",.72).text(f)}else p.text(r);return c&&p.attr("font-style","italic"),d&&p.attr("letter-spacing",d),s&&p.attr("paint-order","stroke fill").attr("stroke",i).attr("stroke-width",2).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-opacity",.55),p}var Fa,ilt,e3=st(()=>{"use strict";Xn();on();tn();en();Br();Ak();Vk();Fa=11;ilt=0});var a3={};ye(a3,{mapContentAspect:()=>o3,mapExportDimensions:()=>mlt});function o3(t,e,n=plt){let{projection:r,fitTarget:o}=wp(t,e);r.fitSize([n,n],o);let a=Ba(r).bounds(o),i=a[1][0]-a[0][0],s=a[1][1]-a[0][1],l=i/s;return Number.isFinite(l)&&l>0?l:flt}function mlt(t,e,n=1200,r){let o=r!==void 0&&Number.isFinite(r)&&r>0,a=o?r:o3(t,e),s=!o&&wp(t,e).fitIsGlobal?a/ult:a,l=o?a:Math.max(dlt,Math.min(clt,s)),c=n,d=Math.round(c/l),u=0;if(t.title&&t.pois.length>0){let m=(t.subtitle?50:30)+20/2;u+=Math.max(n3,m+llt)-n3}let f=!1;return d-u<r3&&(d=Math.round(u+r3),f=!0),{width:c,height:d,preferContain:o?f:l!==s||f}}var n3,llt,clt,dlt,ult,r3,flt,plt,i3=st(()=>{"use strict";ab();Vk();n3=24,llt=16,clt=3,dlt=.9,ult=1.12,r3=200,flt=1.5,plt=1e3});var Xk={};ye(Xk,{loadMapData:()=>xlt});async function hlt(){let[{readFile:t},{fileURLToPath:e},{dirname:n,resolve:r}]=await Promise.all([import("fs/promises"),import("url"),import("path")]);return{readFile:t,fileURLToPath:e,dirname:n,resolve:r}}async function ci(t,e,n){return JSON.parse(await t.readFile(t.resolve(e,n),"utf8"))}async function glt(t,e){for(let n of s3){let r=t.resolve(e,n);try{return await t.readFile(t.resolve(r,Ya.gazetteer),"utf8"),r}catch{}}throw new Error(`map data assets not found near ${e} (looked in ${s3.join(", ")}). Run \`pnpm build:map-data\` and \`pnpm build\`.`)}function ylt(t){let e=n=>!!n&&n.type==="Topology"&&!!n.objects;if(!e(t.worldCoarse)||!e(t.worldDetail)||!e(t.usStates)||!t.gazetteer||!Array.isArray(t.gazetteer.cities)||!t.gazetteer.byName)throw new Error("map data assets are malformed (failed shape validation)");return t}function blt(t){try{let e=wlt.url;if(e)return t.dirname(t.fileURLToPath(e))}catch{}return typeof __dirname<"u"?__dirname:process.cwd()}function xlt(){return Uk??=(async()=>{let t=await hlt(),e=await glt(t,blt(t)),[n,r,o,a,i,s,l,c,d,u,f]=await Promise.all([ci(t,e,Ya.worldCoarse),ci(t,e,Ya.worldDetail),ci(t,e,Ya.usStates),ci(t,e,Ya.lakes).catch(()=>{}),ci(t,e,Ya.rivers).catch(()=>{}),ci(t,e,Ya.mountainRanges).catch(()=>{}),ci(t,e,Ya.naLand).catch(()=>{}),ci(t,e,Ya.naLakes).catch(()=>{}),ci(t,e,Ya.waterBodies).catch(()=>{}),ci(t,e,Ya.airports).catch(()=>{}),ci(t,e,Ya.gazetteer)]);return ylt({worldCoarse:n,worldDetail:r,usStates:o,gazetteer:f,...a&&{lakes:a},...i&&{rivers:i},...s&&{mountainRanges:s},...l&&{naLand:l},...c&&{naLakes:c},...d&&{waterBodies:d},...u&&{airports:u}})})().catch(t=>{throw Uk=void 0,t}),Uk}var wlt,Ya,s3,Uk,jk=st(()=>{"use strict";wlt={};Ya={worldCoarse:"world-coarse.json",worldDetail:"world-detail.json",usStates:"us-states.json",lakes:"lakes.json",rivers:"rivers.json",mountainRanges:"mountain-ranges.json",naLand:"na-land.json",naLakes:"na-lakes.json",waterBodies:"water-bodies.json",airports:"airports.json",gazetteer:"gazetteer.json"},s3=["./data","./map-data","../map-data","../src/map/data"]});var h3={};ye(h3,{renderPyramid:()=>m3,renderPyramidForExport:()=>_lt});function m3(t,e,n,r,o,a){if(e.layers.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Elt),p=c.aesthetic(qk),m=e.layers.some(T=>T.description.length>0),h=!!e.title&&e.options["no-title"]!=="on",g=h?f:0,E=g+p,y=s-p,b=Math.max(60,y-E),S=i*Slt,x=i-S*2,L=e.layers.length,v=d3({width:i,usableWidth:x,sideMargin:S,bodyTop:E,bodyHeight:b,layers:e.layers,hasDescription:m,alternate:!1}),C=v.wraps.some(T=>T.overflows)&&m&&L>=2,M=C?d3({width:i,usableWidth:x,sideMargin:S,bodyTop:E,bodyHeight:b,layers:e.layers,hasDescription:!0,alternate:!0}):v,w=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c.isBelowFloor&&w.attr("width","100%"),w.append("style").text(".pyramid-desc-full{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-short{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-full{display:inline}.dgmo-pyramid-hidden{display:none}"),w.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),h){let T=w.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&T.on("click",()=>o(e.titleLineNumber))}let k=ir(n),N=(T,R)=>{if(T.color){let G=Dn(T.color,n);if(G)return G}return k[R%k.length]},_=w.append("g").attr("class","pyramid-body");for(let T=0;T<L;T++){let R=e.layers[T],G=M.pyramidTop+T*M.layerH,I=G+M.layerH,H=u3(T,L,M.baseWidth,e.inverted),O=u3(T+1,L,M.baseWidth,e.inverted),D=[[M.pyramidCx-H,G],[M.pyramidCx+H,G],[M.pyramidCx+O,I],[M.pyramidCx-O,I]].map($=>`${$[0]},${$[1]}`).join(" "),W=N(R,T),z=ie(n,W,r,{solid:e.options["solid-fill"]==="on"}),P=_.append("g").attr("class","pyramid-layer").attr("data-line-number",R.lineNumber);if(o){let $=R.lineNumber;P.style("cursor","pointer").on("click",()=>o($))}P.append("polygon").attr("points",D).attr("fill",z).attr("stroke",W).attr("stroke-width",2);let B=(G+I)/2,Y=ve(z,n.textOnFillLight,n.textOnFillDark),V=Math.min(H,O)*2>_t(R.label,M.labelFont),j=Y===n.textOnFillLight?n.textOnFillDark:n.textOnFillLight,K=P.append("text").attr("x",M.pyramidCx).attr("y",B).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",Y).attr("font-family",It).attr("font-size",M.labelFont).attr("font-weight",600);if(V||K.attr("paint-order","stroke fill").attr("stroke",j).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.6),gn(K,R.label,n),R.description.length>0){let $=C?T%2===0?"right":"left":"right",U=M.wraps[T];Alt(_,R,$,U,M,B,W,n,g+qk,s-qk,o)}}}function _lt(t,e,n,r,o){m3(t,e,n,r,void 0,o)}function d3(t){let{width:e,usableWidth:n,sideMargin:r,bodyTop:o,bodyHeight:a,layers:i,hasDescription:s,alternate:l}=t,c=i.length,u=n*(s?l?Llt:klt:vlt),f=a/l3,p=Math.min(u,f),m=p*l3,h;s?l?h=e/2:h=r+u/2:h=e/2;let g=o+(a-m)/2,E=m/c,y=f3(Math.round(E*.38),Nlt,Mlt),b=f3(Math.round(E*.22),Tlt,Clt),S=Math.round(b*1.35),x=h+p/2,L=h-p/2,v=x+c3,A=v+db+ub,C=Math.max(80,e-r-A),M=L-c3-db,w=Math.max(80,M-ub-r),k=r,N=i.map((_,T)=>{if(_.description.length===0)return{allLines:[],overflows:!1,shortLineCount:0};let G=(l?T%2===0?"right":"left":"right")==="right"?C:w,I=Plt(_.description,G,b),H=Math.max(1,Math.floor(E/S)-0),O=I.length>H,D=O?H:I.length;return{allLines:I,overflows:O,shortLineCount:D}});return{alternate:l,baseWidth:p,pyramidCx:h,pyramidTop:g,pyramidH:m,layerH:E,labelFont:y,descFont:b,descLineHeight:S,rightTextX:A,rightTextWidth:C,leftTextX:k,leftTextWidth:w,rightAccentX:v,leftAccentX:M,wraps:N}}function u3(t,e,n,r){return(!r?t/e:(e-t)/e)*n/2}function Alt(t,e,n,r,o,a,i,s,l,c,d){let{descFont:u,descLineHeight:f}=o,p=n==="right"?o.rightAccentX:o.leftAccentX,m=n==="right"?o.rightTextX:o.leftTextX,h=n==="right"?"start":"end",g=n==="right"?m:o.leftAccentX-ub,E=o.leftAccentX-ub,y=v=>{if(n==="right")return o.rightTextX;let A=0;for(let C of v)(C.kind==="bullet-first"||C.kind==="bullet-cont")&&(A=Math.max(A,_t(C.text,u)));return E-A-p3},b=c-l,S=Math.max(1,Math.floor(b/f)),x=Rlt(r.allLines,S);if(!r.overflows){Kk({parentG:t,layer:e,lines:r.allLines,className:"pyramid-desc",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(r.allLines),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"});return}let L=Ilt(r);Kk({parentG:t,layer:e,lines:L,className:"pyramid-desc pyramid-desc-short",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(L),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"}),Kk({parentG:t,layer:e,lines:x,className:"pyramid-desc pyramid-desc-full",accentX:p,accentColor:i,textX:g,textAnchor:h,side:n,bulletColLeftX:y(x),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"full"})}function Rlt(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function Ilt(t){if(!t.overflows)return t.allLines.slice();let e=t.allLines.slice(0,t.shortLineCount);if(e.length===0)return[];let n=e[e.length-1];return e[e.length-1]={...n,text:n.text.endsWith("\u2026")?n.text:`${n.text} \u2026`},e}function Kk(t){let{parentG:e,layer:n,lines:r,className:o,accentX:a,accentColor:i,textX:s,textAnchor:l,bulletColLeftX:c,midY:d,descFont:u,descLineHeight:f,palette:p,topBound:m,bottomBound:h,onClickItem:g,variant:E}=t;if(r.length===0)return;let y=r.length*f,b=d-y/2+f/2,S=Math.max(4,Math.round(u*.3)),x=b-f/2-S,L=b+(r.length-1)*f+f/2+S,v=0;x<m?v=m-x:L>h&&(v=h-L),b+=v;let A=b-f/2-S,C=y+S*2,M=e.append("g").attr("class",o).attr("data-line-number",n.lineNumber).attr("data-variant",E);if(g){let w=n.lineNumber;M.style("cursor","pointer").on("click",()=>g(w))}M.append("rect").attr("x",a).attr("y",A).attr("width",db).attr("height",C).attr("rx",db/2).attr("fill",i);for(let w=0;w<r.length;w++){let k=r[w],N=b+w*f,_=k.kind==="bullet-first"||k.kind==="bullet-cont";k.kind==="bullet-first"&&M.append("text").attr("x",c).attr("y",N).attr("dy","0.35em").attr("text-anchor","start").attr("fill",p.text).attr("font-family",It).attr("font-size",u).attr("font-weight",w===0?500:400).text("\u2022");let T=M.append("text").attr("x",_?c+p3:s).attr("y",N).attr("dy","0.35em").attr("text-anchor",_?"start":l).attr("fill",p.text).attr("font-family",It).attr("font-size",u).attr("font-weight",w===0?500:400);gn(T,k.text,p)}}function Plt(t,e,n){let r=n*Bo,o=Math.max(8,Math.floor(e/r)),a=t.map(s=>s.startsWith("- ")?"\u2022 "+s.slice(2):s),i=[];for(let s of a){if(s===""){i.push({text:"",kind:"plain"});continue}i.push(...Ko([s],o))}return i}function f3(t,e,n){return Math.max(e,Math.min(n,t))}var Elt,Slt,qk,vlt,klt,Llt,l3,c3,db,ub,p3,Nlt,Mlt,Tlt,Clt,g3=st(()=>{"use strict";Xn();on();tn();xr();_o();en();Hs();fr();Elt=50,Slt=.03,qk=16,vlt=.78,klt=.58,Llt=.42,l3=.85,c3=28,db=3,ub=12,p3=10,Nlt=12,Mlt=22,Tlt=11,Clt=15});var k3={};ye(k3,{renderRing:()=>v3,renderRingForExport:()=>Vlt});function v3(t,e,n,r,o,a){if(e.layers.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Dlt),p=c.aesthetic(Glt),m=e.layers.length,h=e.layers.some(U=>U.description.length>0),g=!!e.title&&e.options["no-title"]!=="on",y=(g?f:0)+p,b=s-p,S=Math.max(60,b-y),x=i*Olt,L=i-x*2,v=h?Hlt:$lt,A=L*v,w=Math.min(A,S)/2,k=w/m,N=y+S/2,_=h?x+L*v/2:i/2,T=_+w+Wlt,R=T+Zk+Blt,G=Math.max(80,i-x-R),I=Math.round(k*.45),H=I>=w3,O=S3(I,w3,Ylt),D=h?S3(Math.round(G/30),E3,zlt):E3,W=Math.round(D*1.35),z=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",It);if(c.isBelowFloor&&z.attr("width","100%"),z.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),g){let U=z.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&U.on("click",()=>o(e.titleLineNumber))}let P=ir(n),B=(U,X)=>{if(U.color){let q=Dn(U.color,n);if(q)return q}return P[X%P.length]},Y=e.options["solid-fill"]==="on",V=e.layers.map((U,X)=>B(U,X)),j=V.map(U=>ie(n,U,r,{solid:Y})),K=z.append("g").attr("class","ring-body"),$=n.text;for(let U=0;U<m;U++){let X=e.layers[U],q=(U+1)*k,et=U*k,tt=j[U],F=K.append("g").attr("class","ring-layer").attr("data-line-number",X.lineNumber);if(o){let Q=X.lineNumber;F.style("cursor","pointer").on("click",()=>o(Q))}if(U===0)F.append("circle").attr("cx",_).attr("cy",N).attr("r",q).attr("fill",tt).attr("stroke",$).attr("stroke-width",y3).attr("stroke-opacity",b3);else{let Q=`M ${_-q} ${N} A ${q} ${q} 0 1 0 ${_+q} ${N} A ${q} ${q} 0 1 0 ${_-q} ${N} M ${_-et} ${N} A ${et} ${et} 0 1 0 ${_+et} ${N} A ${et} ${et} 0 1 0 ${_-et} ${N} Z`;F.append("path").attr("d",Q).attr("fill-rule","evenodd").attr("fill",tt).attr("stroke",$).attr("stroke-width",y3).attr("stroke-opacity",b3)}}if(H){let U=z.append("g").attr("class","ring-labels");for(let X=0;X<m;X++){let q=e.layers[X],et=j[X],F=X===0?N:N-(X+.5)*k,Q=O,ot=ve(et,n.textOnFillLight,n.textOnFillDark),lt=U.append("g").attr("class","ring-label-group").attr("data-line-number",q.lineNumber).append("text").attr("class","ring-label").attr("x",_).attr("y",F).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",ot).attr("font-family",It).attr("font-size",Q).attr("font-weight",600).style("pointer-events","none");gn(lt,q.label,n,Q)}}(h||!H)&&Ult({parentG:z.append("g").attr("class","ring-descriptions"),layers:e.layers,colors:V,accentX:T,textX:R,textWidth:G,topY:y,bottomY:b,descFont:D,descLineHeight:W,palette:n,...o!==void 0&&{onClickItem:o}})}function Vlt(t,e,n,r,o){v3(t,e,n,r,void 0,o)}function Ult(t){let{parentG:e,layers:n,colors:r,accentX:o,textX:a,textWidth:i,topY:s,bottomY:l,descFont:c,descLineHeight:d,palette:u,onClickItem:f}=t,p=Math.max(8,Math.floor(i/(c*Bo))),m=Math.round(c*1.3),h=Math.max(8,Math.round(c*.6)),g=l-s,E=v=>{let A=n.map(w=>Xlt(Ko(w.description.slice(),p),v)),C=A.map(w=>m+w.length*d),M=C.reduce((w,k)=>w+k,0)+h*Math.max(0,n.length-1);return{wraps:A,blockHeights:C,totalH:M}},y=E(x3);for(let v=x3-1;v>=0&&y.totalH>g;v--)y=E(v);let{wraps:b,blockHeights:S,totalH:x}=y,L=s+Math.max(0,(g-x)/2);for(let v=0;v<n.length;v++){let A=n[v],C=b[v],M=S[v],w=e.append("g").attr("class","ring-desc").attr("data-line-number",A.lineNumber);if(f){let _=A.lineNumber;w.style("cursor","pointer").on("click",()=>f(_))}w.append("rect").attr("x",o).attr("y",L).attr("width",Zk).attr("height",M).attr("rx",Zk/2).attr("fill",r[v]);let k=w.append("text").attr("x",a).attr("y",L+Math.round(m*.7)).attr("text-anchor","start").attr("fill",u.text).attr("font-family",It).attr("font-size",c).attr("font-weight",600);gn(k,A.label,u,c);let N=L+m+Math.round(d*.4);for(let _ of C){let T=_.kind==="bullet-first"||_.kind==="bullet-cont";_.kind==="bullet-first"&&w.append("text").attr("x",a).attr("y",N).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",It).attr("font-size",c).text("\u2022");let R=w.append("text").attr("x",T?a+Flt:a).attr("y",N).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",It).attr("font-size",c);gn(R,_.text,u,c),N+=d}L+=M+h}}function Xlt(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function S3(t,e,n){return Math.max(e,Math.min(n,t))}var Dlt,Olt,Glt,$lt,Hlt,Wlt,Zk,Blt,Flt,y3,b3,x3,w3,Ylt,E3,zlt,L3=st(()=>{"use strict";Xn();on();tn();xr();_o();en();Hs();fr();Dlt=50,Olt=.03,Glt=16,$lt=.78,Hlt=.58,Wlt=28,Zk=3,Blt=12,Flt=10,y3=1,b3=.4,x3=4,w3=12,Ylt=22,E3=11,zlt=15});function M3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>M3(e))}}function jlt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function N3(t,e){let n=t*.32,r=t/(Math.max(1,e)+1);return Math.min(n,r)}function T3(t,e){let n=e.maxDepth??1/0,r=Math.max(1,e.radius),o={label:"__root",children:t.map(m=>M3(m))},a=Ri(o).sum(m=>m.children?.length?0:m.value??0),i=a.value??0;if(i<=0)return{cells:[],total:0,discRadius:e.discRadius??N3(r,1),maxDepthReached:0,isEmpty:!0};let s=NE().size([2*Math.PI,1])(a),l=s.height,c=Math.min(r-1,e.discRadius??N3(r,l)),u=Math.max(1,r-c)/Math.max(1,l);(s.children??[]).forEach((m,h)=>{m.each(g=>{g._topIndex=h})});let f=[],p=0;for(let m of s.descendants()){if(m.depth===0||m.depth>n)continue;let h=!!m.children&&m.children.length>0;m.depth>p&&(p=m.depth);let g=[],E=m;for(;E&&E.depth>0;)g.unshift(E.data.label),E=E.parent;let y=c+(m.depth-1)*u,b=c+m.depth*u,S=jlt(m);f.push({node:m.data.ref??null,label:m.data.label,startAngle:m.x0,endAngle:m.x1,innerR:y,outerR:b,depth:m.depth,value:m.value??0,isContainer:h,isCollapsed:!1,topIndex:m._topIndex??0,pctOfRoot:i>0?(m.value??0)/i:0,pctOfParent:m.parent&&(m.parent.value??0)>0?(m.value??0)/(m.parent.value??1):1,...S!==void 0&&{heat:S},path:g,...m.data.lineNumber!==void 0&&{lineNumber:m.data.lineNumber}})}return{cells:f,total:i,discRadius:c,maxDepthReached:p,isEmpty:!1}}var C3=st(()=>{"use strict";Xh()});function qlt(t,e,n){if(e<=1)return t;let r=Math.max(55,100-(e-1)*18);return Gt(t,n,r)}function pb(t,e){let n=e??t.defaultColorMode;return n==="tag"&&t.tagGroups.length===0&&(n=t.hasHeat?"heat":"branch"),n==="heat"&&!t.hasHeat&&(n="branch"),n}function mb(t,e){if(e.mode==="heat")return t.heat!==void 0&&e.heat?e.heat.scale(t.heat):Qk;if(e.mode==="tag")return t.node?ar(t.node.metadata,e.tagGroups,e.activeGroup)??Qk:Qk;let n=t.path[0]??t.label,r=(e.rootIndexByLabel.get(n)??t.topIndex)+e.colorOffset,o=e.seriesColors[r%e.seriesColors.length];return qlt(o,t.depth,e.bg)}function hb(t,e){if(!t.hasHeat)return null;let n=[],r=f=>{for(let p of f)typeof p.heat=="number"&&n.push(p.heat),r(p.children)};if(r(t.roots),n.length===0)return null;let o=Math.min(...n),a=Math.max(...n),i=o<0&&a>0,s=e.surface,l=t.options.heatColors.map(f=>Dn(f,e)??f).filter(f=>!!f),c,d;if(l.length>=2){c=[l[0],s,l[1]];let f=i?0:(o+a)/2;d=[o,f,a]}else l.length===1?(c=[s,l[0]],d=[o,a]):i?(c=[e.colors.red,s,e.colors.green],d=[o,0,a]):(c=[s,e.primary],d=[o,a]);if(d[0]===d[d.length-1]){let f=c[c.length-1];return{scale:()=>f,min:o,max:a,stops:c,signed:i}}let u=or().domain(d).range(c).clamp(!0);return{scale:f=>Klt(u(f)),min:o,max:a,stops:c,signed:i}}function Klt(t){if(t.startsWith("#"))return t;let e=t.match(/rgba?\(([^)]+)\)/);if(!e)return t;let n=e[1].split(",").map(o=>Math.round(parseFloat(o))),r=o=>Math.max(0,Math.min(255,o||0)).toString(16).padStart(2,"0");return`#${r(n[0]??0)}${r(n[1]??0)}${r(n[2]??0)}`}function ou(t){let e=Math.abs(t);return e>=1e9?fb(t/1e9)+"B":e>=1e6?fb(t/1e6)+"M":e>=1e3?fb(t/1e3)+"k":fb(Math.round(t*100)/100)}function fb(t){return parseFloat(t.toFixed(t<10&&!Number.isInteger(t)?1:0)).toString()}function vp(t){let e=t*100;return e>=10?`${Math.round(e)}%`:e>=1?`${e.toFixed(0)}%`:`${e.toFixed(1)}%`}function gb(t,e,n,r,o){let a=[],i=new Map,s=null;if(e.tagGroups.length>0){let l=e.tagGroups[0],c=new Set,d=u=>{for(let f of u){let p=f.metadata[qt(l.name)];p&&c.add(p.toLowerCase()),d(f.children)}};d(e.roots),a.push({name:l.name,entries:l.entries.filter(u=>c.has(u.value.toLowerCase())).map(u=>({value:u.value,color:u.color}))}),i.set(l.name,"tag"),t==="tag"&&(s=l.name)}if(n){let l=e.options.heatLabel??"Value";a.push({name:l,entries:[],gradient:{min:n.min,max:n.max,low:n.stops[0],high:n.stops[n.stops.length-1]}}),i.set(l,"heat"),t==="heat"&&(s=l)}return a.push({name:"Branch",entries:e.roots.map((l,c)=>({value:l.label,color:r[(c+o)%r.length]}))}),i.set("Branch","branch"),(t==="branch"||s===null)&&(s="Branch"),{groups:a,activeGroup:s,modeByName:i}}var Qk,Jk=st(()=>{"use strict";qa();xr();tn();Ke();Qk="#cbd5e1"});var R3={};ye(R3,{renderTreemapRadial:()=>A3,renderTreemapRadialForExport:()=>Jlt});function Jlt(t,e,n,r,o,a){A3(t,e,n,r,o,{exportMode:!0,...a})}function A3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=a.exportMode??!1,u=ir(n),f=hb(e,n),p=c.noLegend?null:gb(l,e,f,u,a.colorOffset??0),h=(p?Tr({groups:p.groups,position:_3,mode:"preview"},i)+Wn:0)+yb,g=Math.max(1,i-yb*2),E=Math.max(1,s-h-yb),y=Math.max(1,Math.min(g,E)/2-yb),b=i/2,S=h+E/2,x=T3(e.roots,{radius:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),L=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap dgmo-treemap-radial").style("font-family",It),v=L.append("defs");L.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg);let A=L.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${S})`),C=e.tagGroups.length>0?e.tagGroups[0].name:null,M=new Map(e.roots.map((_,T)=>[_.label,T])),w={mode:l,heat:f,tagGroups:e.tagGroups,activeGroup:C,rootIndexByLabel:M,seriesColors:u,colorOffset:a.colorOffset??0,bg:n.bg},k=_l().startAngle(_=>_.startAngle).endAngle(_=>_.endAngle).innerRadius(_=>_.innerR).outerRadius(_=>_.outerR).padAngle(.004).padRadius(y),N=0;if(!x.isEmpty)for(let _ of x.cells){let T=mb(_,w),R=A.append("g").attr("class","dgmo-treemap-cell").attr("data-node-path",_.path.join(" / "));if(_.lineNumber!==void 0&&R.attr("data-line-number",_.lineNumber),_.heat!==void 0&&R.attr("data-heat",_.heat),_.node&&C){let G=qt(C),I=_.node.metadata[G];I&&R.attr(`data-tag-${G}`,I)}R.append("path").attr("class",_.isContainer?"dgmo-treemap-arc branch":"dgmo-treemap-arc").attr("d",k(_)??"").attr("fill",T).attr("stroke",n.bg).attr("stroke-width",1),ect(R,v,`dgmo-arc-lbl-${N++}`,_,c,n,T)}if(tct(A,e,x.discRadius,x.total,x.isEmpty,n),p){let _=L.append("g").attr("class","dgmo-treemap-legend").attr("transform","translate(0, 0)");fn(_,{groups:p.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:d?"export":"preview",position:_3,activeGroup:p.activeGroup,showInactivePills:!d,showEmptyGroups:!d})}}function tct(t,e,n,r,o,a){let i=t.append("g").attr("class","dgmo-treemap-disc");i.append("circle").attr("r",n).attr("fill",a.surface).attr("stroke",a.bg).attr("stroke-width",1);let s=ve(a.surface,a.textOnFillLight,a.textOnFillDark),l=n*1.7;if(o){i.append("text").attr("class","dgmo-treemap-empty").attr("text-anchor","middle").attr("y",4).attr("fill",s).attr("font-size",bb(13,n)).text(xb("No values to chart",l,13));return}let c=e.title??"",d=ou(r),u=bb(15,n),f=bb(22,n);if(c){let p=i.append("text").attr("class","dgmo-treemap-disc-title").attr("text-anchor","middle").attr("y",-4).attr("fill",s).attr("font-size",u).attr("font-weight",600).text(xb(c,l,u));e.titleLineNumber!==null&&p.attr("data-line-number",e.titleLineNumber)}i.append("text").attr("class","dgmo-treemap-disc-total").attr("text-anchor","middle").attr("y",c?u:8).attr("fill",s).attr("font-size",f).attr("font-weight",700).text(xb(d,l,f))}function ect(t,e,n,r,o,a,i){let s=r.endAngle-r.startAngle;if(s<Zlt)return;let l=r.outerR-r.innerR;if(l<10)return;let c=ve(i,a.textOnFillLight,a.textOnFillDark),d=(r.innerR+r.outerR)/2,u=bb(13,l),p=[o.noValues?"":ou(r.value),o.noPercent?"":vp(r.pctOfRoot)].filter(Boolean).join(" \xB7 "),m=p?`${r.label} ${p}`:r.label,h=s*d*.94,g=u,E=_t(m,u);E>h&&(g=Math.max(Qlt,Math.floor(u*h/E)));let y=xb(m,h,g);y&&nct(t,e,n,r,d,g,y,c)}function nct(t,e,n,r,o,a,i,s){let l=(r.startAngle+r.endAngle)/2,c=l>Math.PI/2&&l<3*Math.PI/2,d=c?o+a*.32:o-a*.32,[u,f]=c?[r.endAngle,r.startAngle]:[r.startAngle,r.endAngle],p=Math.sin(u)*d,m=-Math.cos(u)*d,h=Math.sin(f)*d,g=-Math.cos(f)*d,E=c?0:1,y=`M ${p.toFixed(2)} ${m.toFixed(2)} A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 ${E} ${h.toFixed(2)} ${g.toFixed(2)}`;e.append("path").attr("id",n).attr("d",y),t.append("text").attr("class","dgmo-treemap-label").attr("font-size",a).attr("font-weight",600).attr("fill",s).append("textPath").attr("href",`#${n}`).attr("startOffset","50%").attr("text-anchor","middle").text(i)}function bb(t,e){return Math.max(8,Math.min(t,Math.round(e*.9)))}function xb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var yb,_3,Zlt,Qlt,I3=st(()=>{"use strict";Xn();Eo();on();tn();Ke();en();Br();To();Mr();C3();Jk();yb=12,_3={placement:"top-center",titleRelation:"below-title"},Zlt=6*Math.PI/180,Qlt=8});function P3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>P3(e))}}function rct(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function D3(t,e){let n=e.maxDepth??1/0,r={label:"__root",children:t.map(l=>P3(l))},o=Ri(r).sum(l=>l.children?.length?0:l.value??0).sort((l,c)=>(c.value??0)-(l.value??0)),a=AE().tile(yf).size([e.width,e.height]).paddingOuter(e.paddingOuter??3).paddingTop(e.headerH>0?e.headerH:e.paddingInner??2).paddingInner(e.paddingInner??2).round(!0)(o),i=a.value??0;(a.children??[]).forEach((l,c)=>{l.each(d=>{d._topIndex=c})});let s=[];for(let l of a.descendants()){if(l.depth===0||l.depth>n)continue;let c=!!l.children&&l.children.length>0,d=c&&l.depth>=n,u=c&&!d,f=[],p=l;for(;p&&p.depth>0;)f.unshift(p.data.label),p=p.parent;let m=rct(l);s.push({node:l.data.ref??null,label:l.data.label,x0:l.x0,y0:l.y0,x1:l.x1,y1:l.y1,depth:l.depth,value:l.value??0,isContainer:u,isCollapsed:d,topIndex:l._topIndex??0,pctOfRoot:i>0?(l.value??0)/i:0,pctOfParent:l.parent&&(l.parent.value??0)>0?(l.value??0)/(l.parent.value??1):1,...m!==void 0&&{heat:m},path:f,...l.data.lineNumber!==void 0&&{lineNumber:l.data.lineNumber}})}return{cells:s,total:i}}var O3=st(()=>{"use strict";Xh()});var W3={};ye(W3,{renderTreemap:()=>H3,renderTreemapForExport:()=>sct});function sct(t,e,n,r,o,a){H3(t,e,n,r,o,{exportMode:!0,...a})}function H3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=c.solidFill,u=a.exportMode??!1,f=ir(n),p=!!e.title,m=p?act:0,h=hb(e,n),g=c.noLegend?null:gb(l,e,h,f,a.colorOffset??0),E=g?Tr({groups:g.groups,position:G3,mode:"preview"},i)+Wn:0,y=c.noHeaders?0:oct,b=wb,S=m+E+wb,x=Math.max(1,i-wb*2),L=Math.max(1,s-S-wb),v=D3(e.roots,{width:x,height:L,headerH:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),A=Rt(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap").style("font-family",It);if(A.append("style").text(".dgmo-treemap-focus{opacity:.3;transition:opacity .12s}.dgmo-treemap-cell:hover .dgmo-treemap-focus{opacity:.7}"),A.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),p){let T=A.append("text").attr("class","chart-title").attr("x",i/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&T.attr("data-line-number",e.titleLineNumber)}let C=A.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${S})`),M=f,w=a.colorOffset??0,k=e.tagGroups.length>0?e.tagGroups[0].name:null,N=new Map(e.roots.map((T,R)=>[T.label,R])),_={mode:l,heat:h,tagGroups:e.tagGroups,activeGroup:k,rootIndexByLabel:N,seriesColors:M,colorOffset:w,bg:n.bg};for(let T of v.cells){let R=Math.max(0,T.x1-T.x0),G=Math.max(0,T.y1-T.y0);if(R<=0||G<=0)continue;let I=mb(T,_),H=T.isContainer||d?I:Gt(I,n.bg,ict),O=T.isContainer||T.isCollapsed,D=C.append("g").attr("class","dgmo-treemap-cell").attr("transform",`translate(${T.x0},${T.y0})`).attr("data-node-path",T.path.join(" / "));if(T.lineNumber!==void 0&&D.attr("data-line-number",T.lineNumber),T.heat!==void 0&&D.attr("data-heat",T.heat),T.node&&k){let Y=qt(k),V=T.node.metadata[Y];V&&D.attr(`data-tag-${Y}`,V)}let W=D.append("rect").attr("class",T.isContainer?"dgmo-treemap-rect branch":"dgmo-treemap-rect").attr("width",R).attr("height",G).attr("rx",2).attr("fill",H).attr("fill-opacity",1).attr("stroke",n.bg).attr("stroke-width",T.isContainer?1:0);if(O&&a.onClickItem&&T.lineNumber!==void 0){let Y=T.lineNumber;W.style("cursor","pointer").on("click",()=>a.onClickItem(Y))}let z=ve(H,n.textOnFillLight,n.textOnFillDark);if(T.isContainer&&y>0&&R>34&&G>y){let Y=[];c.noValues||Y.push(ou(T.value)),c.noPercent||Y.push(vp(T.pctOfRoot));let V=Y.join(" \xB7 "),j=O?16:4,K=V.length>0&&R>110,$=K?_t(V,10.5):0,U=R-8-j-(K?$+10:0);D.append("text").attr("class","dgmo-treemap-header").attr("x",6).attr("y",13).attr("font-size",11).attr("font-weight",700).attr("fill",z).text(Sb(T.label,Math.max(0,U),11)),K&&D.append("text").attr("class","dgmo-treemap-header-value").attr("x",R-j-4).attr("y",13).attr("text-anchor","end").attr("font-size",10.5).attr("fill",z).attr("opacity",.75).text(V)}let P=Math.max(4,Math.min(14,Math.floor(Math.min(R,G)/5))),B=7;if(!T.isContainer&&R>=2*P+8&&G>=2*P+8){let Y=R-2*P;if(_t(T.label,B)*1.06>Y&&G>R*1.25&&G-2*P>Y){lct(D,T.label,R,G,P,z),O&&R>30&&G>22&&$3(D,R,z,9);continue}let j=Lp(Math.round(Math.min(R/3.6,G/3.4)),B,72),K=_t(T.label,j)*1.06;K>Y&&(j=Math.max(B,Math.floor(j*Y/K)));let U=.95-Lp((j-B)/(72-B),0,1)*.5,X=Lp(Math.round(j*.42),11,28),q=Math.max(.45,U-.1),et=P+Math.round(j*.78);D.append("text").attr("class","dgmo-treemap-label").attr("x",P).attr("y",et).attr("font-size",j).attr("font-weight",600).attr("fill",z).attr("opacity",U).text(Sb(T.label,Y,j));let tt=[c.noValues?"":ou(T.value),c.noPercent?"":vp(T.pctOfRoot)].filter(Boolean),F=tt.join(" \xB7 "),Q=et,ot=(Z,lt,nt,J)=>{D.append("text").attr("class","dgmo-treemap-value").attr("x",P).attr("y",lt).attr("font-size",nt).attr("fill",z).attr("opacity",J).text(Z)};if(F){let Z=_t(F,X)<=Y,lt=et+Eb(j,X),nt=lt+kp(X)<=G-P;if(Z&&nt)ot(F,lt,X,q);else if(Z){let J=Lp(Math.round(j*.5),11,Math.max(11,X)),at=Sb(T.label,Y,j),it=_t(at,j)*1.12,vt=Math.max(12,Math.round(j*.25));P+it+vt+_t(F,J)<=R-P&&D.append("text").attr("class","dgmo-treemap-value").attr("x",P+it+vt).attr("y",Q).attr("font-size",J).attr("fill",z).attr("opacity",q).text(F)}else if(tt.length===2){let J=Eb(j,X);et+J+kp(X)<=G-P&&(et+=J,ot(tt[0],et,X,q));let at=Math.max(10,Math.round(X*.9)),it=Eb(X,at);et+it+kp(at)<=G-P&&(et+=it,ot(tt[1],et,at,q))}else{let J=et+Eb(j,X);J+kp(X)<=G-P&&ot(F,J,X,q)}}}O&&R>30&&G>22&&$3(D,R,z,9)}if(g){let T=A.append("g").attr("class","dgmo-treemap-legend").attr("transform",`translate(0, ${m})`);fn(T,{groups:g.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:u?"export":"preview",position:G3,activeGroup:g.activeGroup,showInactivePills:!u,showEmptyGroups:!u,...a.onSelectMode!==void 0&&{callbacks:{onGroupToggle:R=>{let G=g.modeByName.get(R);G&&a.onSelectMode(G)}}}})}}function $3(t,e,n,r){let a=e-4.5-5,i=t.append("g").attr("class","dgmo-treemap-focus").attr("data-export-ignore","true");i.append("rect").attr("x",a-9).attr("y",r-9).attr("width",18).attr("height",18).attr("fill","transparent"),i.append("circle").attr("cx",a).attr("cy",r).attr("r",4.5).attr("fill","none").attr("stroke",n).attr("stroke-width",1.25),i.append("circle").attr("cx",a).attr("cy",r).attr("r",1.4).attr("fill",n)}function lct(t,e,n,r,o,a){let s=r-2*o,l=n-2*o,c=Lp(Math.round(Math.min(l/.8,14)),6,22),d=_t(e,c)*1.06;d>s&&(c=Math.max(6,Math.floor(c*s/d)));let u=Sb(e,s,c);u&&t.append("text").attr("class","dgmo-treemap-label").attr("transform",`translate(${n/2},${r/2}) rotate(-90)`).attr("y",Math.round(c*.28)).attr("text-anchor","middle").attr("font-size",c).attr("font-weight",600).attr("fill",a).attr("opacity",.95).text(u)}function kp(t){return Math.ceil(t*.26)}function Eb(t,e,n=4){return kp(t)+n+Math.round(e*.72)}function Lp(t,e,n){return Math.max(e,Math.min(n,t))}function Sb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var wb,oct,act,ict,G3,B3=st(()=>{"use strict";Xn();on();tn();Ke();en();Br();To();Mr();O3();Jk();wb=12,oct=18,act=36,ict=50,G3={placement:"top-center",titleRelation:"below-title"}});function Y3(t,e={}){let n=e.collapsed??new Set,r=V3(t,0,0,null,n);return{width:r.w,height:r.h,items:r.items}}function eL(t){return Math.max(1,...t.rows.map(e=>e.reduce((n,r)=>n+(r.span||1),0)))}function uct(t){return Math.max(rL,Math.min(cct,_t(t.label,dct)+2*Np+14))}function z3(t){let e=rL;for(let n of t.rows)for(let r of n){if(!ti(r))continue;let o=r.grid?fct(r.grid)+2*Np:uct(r);e=Math.max(e,o/(r.span||1))}return e}function fct(t){let e=t.cols??eL(t);return e*z3(t)+(e+1)*vo}function V3(t,e,n,r,o){let a=t.cols??eL(t),i=r??z3(t),s=a*i+(a+1)*vo,l=n+vo,c=[],d=e+vo;for(let f of t.rows){let p=e+vo,m=tL,h=[];for(let g of f){let E=g.span||1,y=E*i+(E-1)*vo;if(!ti(g)){h.push({type:"empty",x:p,y:l,w:y,h:tL}),p+=y+vo,d=Math.max(d,p-vo);continue}if(g.grid&&o.has(g.id)){let b={type:"collapsed",x:p,y:l,w:y,h:F3,label:g.label,node:g,lineNumber:g.lineNumber};h.push(b),m=Math.max(m,F3),p+=y+vo,d=Math.max(d,p-vo);continue}if(g.grid){let b=g.grid.cols??eL(g.grid),S=Math.max(rL*.66,(y-2*Np-(b+1)*vo)/b),x=V3(g.grid,p+Np,l+vb,S,o),L=vb+x.h+Np;h.push({type:"container",x:p,y:l,w:y,h:L,label:g.label,node:g,lineNumber:g.lineNumber,inner:x.items}),m=Math.max(m,L),p+=y+vo,d=Math.max(d,p-vo);continue}h.push({type:"leaf",x:p,y:l,w:y,h:tL,label:g.label,node:g,lineNumber:g.lineNumber}),p+=y+vo,d=Math.max(d,p-vo)}c.push(...h),l+=m+vo}let u=Math.max(s,d-e+vo);return{x:e,y:n,w:u,h:l-n,items:c}}var vo,Np,tL,vb,F3,nL,rL,cct,dct,U3=st(()=>{"use strict";en();_h();vo=12,Np=10,tL=46,vb=28,F3=46,nL=6,rL=104,cct=250,dct=13});var Q3={};ye(Q3,{authoredCollapsedIds:()=>Z3,renderBlock:()=>q3,renderBlockForExport:()=>hct});function hct(t,e,n,r,o,a){q3(t,e,n,r,o,{exportMode:!0,...a})}function q3(t,e,n,r,o,a={}){if(e.error||e.top.rows.length===0)return;Rt(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.options,s=!!e.title,l=s?pct:0,c=a.collapsed??Z3(e),d=Y3(e.top,{collapsed:c}),u=i.noLegend?null:xct(e),f,p;a.exportMode?f=Math.max(d.width,mct)+au*2:f=o?.width??t.clientWidth;let m=u?Tr({groups:u.groups,position:X3,mode:"preview"},f)+Wn:0,h=l+m+au;if(a.exportMode?p=h+d.height+au:p=o?.height??t.clientHeight,f<=0||p<=0)return;let g=au,E=Math.max(1,f-au*2),y=Math.max(1,p-h-au),b=Math.min(1,E/d.width,y/d.height),S=g+(E-d.width*b)/2,x=h,L=Rt(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-block").style("font-family",It);if(s){let M=L.append("text").attr("class","chart-title").attr("x",f/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",It).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&M.attr("data-line-number",e.titleLineNumber)}let v=e.tagGroups.length>0?e.tagGroups[0].name:null,A=Gt(n.text,n.bg,22),C=L.append("g").attr("class","dgmo-block-cells").attr("transform",`translate(${S},${x}) scale(${b})`);if(K3(C,d.items,{palette:n,tagGroups:e.tagGroups,activeGroup:v,activeKey:v?qt(v):null,neutral:A,solidFill:i.solidFill,onToggle:a.onToggle}),u){let M=L.append("g").attr("class","dgmo-block-legend").attr("transform",`translate(0, ${l})`);fn(M,{groups:u.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:f,mode:a.exportMode?"export":"preview",position:X3,activeGroup:u.activeGroup})}}function gct(t,e){return!t||!e.activeGroup?null:ar(t.metadata,e.tagGroups,e.activeGroup)??null}function oL(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}function K3(t,e,n,r=[]){let{palette:o,solidFill:a}=n;for(let i of e){if(i.type==="empty"){t.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",7).attr("fill","none").attr("stroke",n.neutral).attr("stroke-width",1).attr("stroke-dasharray","3 4").attr("opacity",.7);continue}let s=i.node,l=[...r,s.id],c=gct(s,n),d=c??n.neutral,u=t.append("g").attr("class","dgmo-block-cell").attr("data-block-id",s.id).attr("data-block-path",l.join(" / "));if(i.lineNumber!==void 0&&u.attr("data-line-number",i.lineNumber),n.activeKey){let p=s.metadata[n.activeKey];p&&u.attr(`data-tag-${n.activeKey}`,p)}if(i.type==="collapsed"){let p=c?a?c:Gt(c,o.bg,12):o.surface,m=`dgmo-block-clip-${yct++}`;u.append("clipPath").attr("id",m).append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+4).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",700).attr("fill",o.text).text(oL(i.label??"",i.w-24,12.5)),u.append("rect").attr("x",i.x).attr("y",i.y+i.h-nL).attr("width",i.w).attr("height",nL).attr("fill",a&&c?o.text:d).attr("clip-path",`url(#${m})`),j3(u,i,n,i.h);continue}if(i.type==="container"){let p=c?a?c:Gt(c,o.bg,7):o.surface;u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5);let m=Math.min(i.w,i.h*2.5),h=Math.max(13,Math.min(20,Math.round(13+(m-220)/70))),E=.92-(h-13)/7*.3,y=i.y+Math.round(h*.7)+7;u.append("text").attr("x",i.x+i.w/2).attr("y",y).attr("text-anchor","middle").attr("font-size",h).attr("font-weight",700).attr("fill",o.text).attr("opacity",E).text(oL(i.label??"",i.w-24,h)),j3(u,i,n,vb),i.inner&&K3(t,i.inner,n,l);continue}let f=c?a?c:Gt(c,o.bg,14):o.bg;u.attr("data-leaf","true"),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",8).attr("fill",f).attr("stroke",d).attr("stroke-width",1.25),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+5).attr("text-anchor","middle").attr("font-size",13).attr("font-weight",600).attr("fill",o.text).text(oL(i.label??"",i.w-16,13))}}function j3(t,e,n,r){if(!n.onToggle||!e.node||e.lineNumber===void 0)return;let o=e.node.id,a=e.lineNumber;t.append("rect").attr("x",e.x).attr("y",e.y).attr("width",e.w).attr("height",r).attr("rx",10).attr("fill","transparent").style("cursor","pointer").on("click",()=>n.onToggle(o,a))}function Z3(t){let e=new Set;return bct(t,e),e}function bct(t,e){let n=r=>{for(let o of r.rows)for(let a of o)ti(a)&&(a.collapsed&&a.grid&&e.add(a.id),a.grid&&n(a.grid))};n(t.top)}function xct(t){if(t.tagGroups.length===0)return null;let e=t.tagGroups[0],n=qt(e.name),r=new Set,o=i=>{for(let s of i.rows)for(let l of s)if(ti(l)){let c=l.metadata[n];c&&r.add(c.toLowerCase()),l.grid&&o(l.grid)}};o(t.top);let a=e.entries.filter(i=>r.has(i.value.toLowerCase())).map(i=>({value:i.value,color:i.color}));return a.length===0?null:{groups:[{name:e.name,entries:a}],activeGroup:e.name}}var au,pct,mct,X3,yct,J3=st(()=>{"use strict";Xn();on();tn();Ke();Br();To();Mr();en();_h();U3();au=12,pct=36,mct=220,X3={placement:"top-center",titleRelation:"below-title"};yct=0});var f4={};ye(f4,{MARKER_LABELS:()=>Lb,renderRaci:()=>d4,renderRaciForExport:()=>Xct});function wct(t){let e=new Map;if(t.diagnostics.length===0)return e;let n=[];for(let r of t.tasksWithoutPhase)n.push(r);for(let r of t.phases)for(let o of r.tasks)n.push(o);for(let r of t.diagnostics){if(r.line<=0)continue;let o=n.find(s=>r.line>=s.lineNumber&&r.line<=s.endLineNumber);if(!o)continue;let a=e.get(o.id);a?r.line<a.firstLine&&(a.firstLine=r.line):(a={errors:[],warnings:[],firstLine:r.line},e.set(o.id,a));let i={line:r.line,message:r.message};r.severity==="error"?a.errors.push(i):a.warnings.push(i)}return e}function Ect(t){let e=t.match(/^Task '[^']*'\s+(.+)$/);if(e){let n=e[1];return n.charAt(0).toUpperCase()+n.slice(1)}return t.replace(/\s+on task '[^']*'/,"")}function Sct(t,e,n,r,o){let a=Math.min(o,n/2,r/2);return`M ${t} ${e+a} A ${a} ${a} 0 0 1 ${t+a} ${e} H ${t+n-a} A ${a} ${a} 0 0 1 ${t+n} ${e+a} V ${e+r} H ${t} Z`}function o4(t,e){let n=new Map(e.map((r,o)=>[r,o]));return[...t].sort((r,o)=>(n.get(r)??99)-(n.get(o)??99))}function aL(t,e){return e.colors[r4[t%r4.length]]}function lL(t,e){switch(t){case"R":return e.colors.green;case"A":return e.colors.red;case"S":return e.colors.teal;case"C":return e.colors.yellow;case"I":return e.colors.gray;case"D":return e.colors.purple}}function d4(t,e,n,r,o,a){let i=typeof o=="function"?{onClickLine:o}:o??{},s=i.onClickLine,l=i.onMarkerDragStart,c=i.hideLegend??!1,d=i.collapsedPhases??new Set,u=(i.hideTitle??!1)||e.options["no-title"]==="on";Rt(t).selectAll(":not([data-d3-tooltip])").remove();let f=a?.width??t.clientWidth,p=a?.height??t.clientHeight;if(f<=0||p<=0)return;let m=[...as(e)];if(m.length===0&&e.phases.length===0)return;let h=e.options["solid-fill"]==="on",g=nr(n,r),E=Math.max(1,e.roles.length),y=E*n4+e4+2*t4,b=a?Ee.identity():Ee.from(f,y),S=b.text(20),x=b.structural(30),L=b.aesthetic(t4),v=b.aesthetic(kct),A=b.structural(vct),C=b.structural(Rct),M=b.structural(a4),w=b.structural(Ict),k=b.structural(Pct),N=b.structural(e4),_=b.structural(Dct),T=b.structural(n4),R=b.structural(Oct),G=b.text(c4),I=b.text(Fct),H=b.text(Yct),O=b.text(Wct),D=b.text(l4),W=b.structural(Gct),z=b.structural($ct),P=b.structural(Hct),B=b.structural(Lct),Y=b.structural(Nct),V=b.structural(Mct),j=b.structural(Tct),K=b.aesthetic(Cct),$=b.text(_ct),U=b.text(Act),X=b.structural(i4),q=b.structural(s4),et=b.structural(1.5),tt=b.structural(zct),F=Math.max(0,f-2*L),Q=Math.max(_,Math.min(T,Math.floor((F-k)/E))),ot=F-Q*E;ot>N&&(ot=N,Q=Math.max(_,Math.floor((F-ot)/E))),ot<k&&(ot=k);let Z=wct(e),lt=[];for(let te of e.tasksWithoutPhase)lt.push({kind:"task",task:te});for(let te of e.phases){let ae=d.has(te.id);if(lt.push({kind:"phase",phase:te,collapsed:ae}),!ae)for(let Te of te.tasks)lt.push({kind:"task",task:Te})}let J=!u||!c?A:v,at=(A-B)/2,it=J+v,Tt=it+C,At=[],rt=ot-16,pt=new Map;for(let te of lt)if(te.kind==="task"){let ae=Z.get(te.task.id);pt.set(te.task.id,u4(te.task,ae,rt,G,D,M,q,X))}for(let te of lt)if(At.push(Tt),te.kind==="phase")Tt+=w;else{let ae=pt.get(te.task.id);Tt+=ae?.rowHeight??M}let ht=Tt+P,dt=ht+v,ut=a?dt:Math.max(p,dt),yt=Rt(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",f).attr("height",ut).attr("viewBox",`0 0 ${f} ${ut}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",It).style("background","transparent");b.isBelowFloor&&yt.attr("width","100%");let kt=Lb[e.variant],Ot=Object.keys(kt).filter(te=>kt[te]!==void 0),Xt=Ot.length,bt=Y*Math.max(0,Xt-1),Nt=Ot.reduce((te,ae)=>Math.max(te,_t(kt[ae]??"",$)),0),Vt=Math.max(V,Math.ceil(36+Nt+8)),xt=Xt*Vt+bt,Lt=Xt*j+bt,Dt=e.title&&!u?_t(e.title,S):0,zt="full",$t=xt,ft=Vt;c?$t=0:F-Dt-K<xt&&(zt="letters",$t=Lt,ft=j);let Wt=L+F-$t,he=c?F:Wt-L-K;e.title&&!u&&yt.append("text").attr("x",L).attr("y",x).attr("text-anchor","start").attr("font-size",S).attr("font-weight","700").attr("fill",n.text).text(tr(e.title,S,he)),!c&&Xt>0&&Uct(yt,Ot,e.variant,Wt,at,zt,ft,n,g,h,l,Y,B,tt,et,U,$);let ne=te=>L+ot+te*Q,se=ht-it;if(e.phases.length===0){let te=yt.append("g").attr("class","raci-row-bands");lt.forEach((ae,Te)=>{if(ae.kind!=="task")return;let Je=e.tasksWithoutPhase.indexOf(ae.task);if(Je<0)return;let sn=At[Te],ze=pt.get(ae.task.id)?.rowHeight??M;te.append("rect").attr("class","raci-row-band").attr("data-task-id",ae.task.id).attr("x",L).attr("y",sn+2).attr("width",F).attr("height",ze-4).attr("rx",6).attr("fill",Gt(aL(Je,n),g,12))})}let Zt=yt.append("g").attr("class","raci-columns");e.roles.forEach((te,ae)=>{let Te=ne(ae)+z,Je=Q-2*z,sn=e.roleColors[ae]??aL(ae,n),ze=Gt(sn,nr(n,r),16),Ce=Gt(sn,nr(n,r),30),ee=Zt.append("g").attr("class","raci-column").attr("data-role-id",te);ee.append("rect").attr("class","raci-column-body").attr("x",Te).attr("y",it).attr("width",Je).attr("height",se).attr("rx",W).attr("fill",ze),ee.append("path").attr("class","raci-column-header").attr("d",Sct(Te,it,Je,C,W)).attr("fill",Ce);let oe=ne(ae)+Q/2;ee.append("text").attr("class","raci-column-label").attr("x",oe).attr("y",it+C/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",I).attr("font-weight",600).attr("fill",n.text).text(tr(e.roleDisplayNames[ae]??"",I,Q-2*R))});let Ie=Z.size>0,Ht=22,Qt=z+4,Ut=Q-2*Qt,fe=!0;for(let te of lt)if(!(te.kind!=="phase"||!te.collapsed)){for(let ae of e.roles){let Te=new Set;for(let ze of te.phase.tasks){let Ce=ze.roleAssignments.find(ee=>ee.id===ae);if(Ce)for(let ee of Ce.markers)Te.add(ee)}if(Te.size===0)continue;let Je=Mp*Math.max(0,Te.size-1);if((Ut-Je)/Te.size<Ht){fe=!1;break}}if(!fe)break}for(let te=0;te<lt.length;te++){let ae=lt[te],Te=At[te];if(ae.kind==="phase"){let Je=e.phases.indexOf(ae.phase);jct(yt,ae.phase,L,Te,F,n,ae.collapsed,aL(Math.max(0,Je),n),e.roles,ne,Q,e.variant,g,h,fe,w,H,z,tt)}else qct(yt,ae.task,e,L,Te,ot,ne,Q,n,g,h,Z,Ie,pt.get(ae.task.id),s,l,G,D,R,M,z,tt,et,O,$,q,X)}m.some(te=>te.roleAssignments.some(ae=>ae.markers.length>0))||yt.append("text").attr("x",f/2).attr("y",dt-v-2).attr("text-anchor","middle").attr("font-size",12).attr("fill",n.textMuted).text("Drag a marker from the legend onto any cell. Drag a marker out to remove."),Vct(yt)}function Vct(t){let e=t.node();if(!e)return;let n=null,r=a=>{let i=a;for(;i&&i!==e;){let s=i.getAttribute&&i.getAttribute("data-role-id");if(s)return s;i=i.parentElement}return null},o=a=>{a!==n&&(n&&t.selectAll(`.raci-cell[data-role-id="${n}"], .raci-column[data-role-id="${n}"]`).classed("raci-col-active",!1),n=a,a?(t.attr("data-hover-col",a),t.selectAll(`.raci-cell[data-role-id="${a}"], .raci-column[data-role-id="${a}"]`).classed("raci-col-active",!0)):t.attr("data-hover-col",null))};t.on("mouseover",a=>o(r(a.target))),t.on("mouseleave",()=>o(null))}function Uct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g){if(e.length===0)return;let E=Lb[n],y=t.append("g").attr("class","raci-legend").attr("aria-label",`${n.toUpperCase()} marker legend`);e.forEach((b,S)=>{let x=r+S*(i+u),L=lL(b,s),v=E[b],A=y.append("g").attr("class","raci-legend-chip").attr("data-marker",b).style("cursor","grab");if(a==="letters"){let _=c?L:Gt(L,l,kb),T=c?Gt(L,l,70):L;A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",_).attr("stroke",T).attr("stroke-width",m),A.append("text").attr("x",x+i/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",700).attr("fill",c?ve(_,s.textOnFillLight,s.textOnFillDark):s.text).text(b);return}let C=c?L:Gt(L,l,kb),M=Gt(L,l,70);A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",C).attr("stroke",M).attr("stroke-width",m);let w=4,k=24,N=c?Gt(L,l,70):Gt(L,l,55);A.append("rect").attr("x",x+w).attr("y",o+w).attr("width",k).attr("height",f-2*w).attr("rx",4).attr("fill",N),A.append("text").attr("x",x+w+k/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",700).attr("fill",c?ve(N,s.textOnFillLight,s.textOnFillDark):s.text).text(b),A.append("text").attr("x",x+w+k+8).attr("y",o+f/2).attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",600).attr("fill",s.text).text(tr(v,g,i-k-w*2-12))})}function Xct(t,e,n,r,o){d4(t,e,n,r,{},o)}function jct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g,E,y){let b=t.append("g").attr("class","raci-phase").attr("data-section",`phase-${e.id}`).attr("data-section-toggle","").attr("data-line-number",String(e.lineNumber)).attr("data-phase-id",e.id).attr("data-collapsed",i?"1":"0").style("cursor","pointer"),S=Gt(e.color??s,a.bg,30);b.append("rect").attr("x",n).attr("y",r+4).attr("width",o).attr("height",h-8).attr("fill",S).attr("rx",4);let x=n+12,L=r+h/2;if(b.append("text").attr("x",x).attr("y",L).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",It).attr("font-size",9).attr("fill",a.text).attr("opacity",.6).text(i?"\u25B6":"\u25BC"),b.append("text").attr("x",n+26).attr("y",r+(h-4)/2+2).attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",600).attr("fill",a.text).text(e.displayName),i){let v=e.tasks.length;if(v>0){let _=_t(e.displayName,g);b.append("text").attr("x",n+26+_+10).attr("y",r+(h-4)/2+2).attr("dominant-baseline","central").attr("font-size",g-1).attr("font-weight",500).attr("fill",a.textMuted).text(`${v} ${v===1?"task":"tasks"}`)}if(!m)return;let A=rd[u].alphabet,C=E+4,M=d-2*C,w=24,k=13,N=r+(h-w)/2;l.forEach((_,T)=>{let R=new Set;for(let D of e.tasks){let W=D.roleAssignments.find(z=>z.id===_);if(W)for(let z of W.markers)R.add(z)}if(R.size===0)return;let G=o4([...R],A),I=Mp*Math.max(0,G.length-1),H=(M-I)/G.length,O=c(T)+C;G.forEach((D,W)=>{let z=O+W*(H+Mp),P=lL(D,a),B=p?P:Gt(P,f,kb),Y=p?Gt(P,f,70):P,V=b.append("g").attr("class","raci-phase-summary");V.append("rect").attr("x",z).attr("y",N).attr("width",H).attr("height",w).attr("rx",y).attr("fill",B).attr("stroke",Y).attr("stroke-width",1.25),V.append("text").attr("x",z+H/2).attr("y",N+w/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",k).attr("font-weight",700).attr("fill",p?ve(B,a.textOnFillLight,a.textOnFillDark):a.text).text(D)})})}}function qct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,h,g,E,y,b,S,x,L,v,A,C,M){let w=t.append("g").attr("class","raci-task-row").attr("data-task-id",e.id).attr("data-line-number",String(e.lineNumber)),k=r+8,N=a-16,_=p??u4(e,u?.get(e.id),N,g,E,b,C,M),{nameLines:T,descLines:R,violations:G,rowHeight:I}=_,H=w.append("g").attr("class","raci-task-label-area");H.append("rect").attr("class","raci-task-label-zone").attr("x",r).attr("y",o).attr("width",a).attr("height",I).attr("fill","transparent").attr("pointer-events","all");let O=o+g/2+6,D=H.append("text").attr("class","raci-task-label").attr("x",k).attr("y",O).attr("dominant-baseline","central").attr("font-size",g).attr("fill",l.text);T.forEach((B,Y)=>{let V=D.append("tspan").attr("x",k).text(B);Y>0&&V.attr("dy",iL)});let W=O+Math.max(0,T.length-1)*iL+g/2+4+C;if(R.length>0){let B=H.append("text").attr("class","raci-task-description").attr("x",k).attr("y",W).attr("dominant-baseline","central").attr("font-size",E).attr("fill",l.textMuted);R.forEach((Y,V)=>{let j=B.append("tspan").attr("x",k).text(Y);V>0&&j.attr("dy",sL)}),W+=R.length*sL}for(let B of G){let Y=B.severity==="error"?l.colors.red:l.colors.orange,V=H.append("g").attr("class","raci-violation-line").attr("data-severity",B.severity).style("cursor",m?"pointer":"default"),j=g-2,K=V.append("text").attr("x",k).attr("y",W).attr("dominant-baseline","central").attr("font-size",j).attr("fill",Y);if(B.lines.forEach(($,U)=>{Kct($).forEach((q,et)=>{let tt=K.append("tspan").text(q.text);U>0&&et===0&&tt.attr("x",k).attr("dy",M),q.bold&&tt.attr("font-weight",700)})}),m){let $=B.sourceLine;V.on("click",U=>{U.stopPropagation(),m($)})}W+=B.lines.length*M}let z=new Map;for(let B of e.roleAssignments)z.set(B.id,B.markers);let P=rd[n.variant].alphabet;n.roles.forEach((B,Y)=>{let V=S+4,j=i(Y)+V,K=o+y,$=s-2*V,U=b-2*y,X=z.get(B)??[],q=o4(X,P),et=e.roleAssignments.find(Z=>Z.id===B),tt=w.append("g").attr("class","raci-cell").attr("data-task-id",e.id).attr("data-role-id",B);et&&tt.attr("data-line-number",String(et.lineNumber)),tt.append("rect").attr("class","raci-cell-hit").attr("x",i(Y)+S).attr("y",o).attr("width",s-2*S).attr("height",b).attr("fill","transparent").attr("pointer-events","all");let F=Mp*(q.length-1),Q=q.length>0?($-F)/q.length:0,ot=Lb[n.variant];q.forEach((Z,lt)=>{let nt=lL(Z,l),J=d?nt:Gt(nt,c,kb),at=nt,it=j+lt*(Q+Mp),vt=tt.append("g").attr("class","raci-marker-slice").attr("data-marker",Z).style("cursor","grab");vt.append("rect").attr("x",it).attr("y",K).attr("width",Q).attr("height",U).attr("rx",x).attr("fill",J).attr("stroke",at).attr("stroke-width",L);let Tt=ot[Z]??Z,rt=_t(Tt,A)+16<=Q,pt=rt?Tt:Z,ht=rt?A:v;vt.append("text").attr("x",it+Q/2).attr("y",K+U/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",ht).attr("font-weight",Bct).attr("fill",d?ve(J,l.textOnFillLight,l.textOnFillDark):l.text).text(pt)}),tt.append("rect").attr("class","raci-cell-drop-preview").attr("x",j).attr("y",K).attr("width",$).attr("height",U).attr("rx",x).attr("fill","transparent").attr("stroke","transparent").attr("pointer-events","none"),m&&et&&tt.on("click",()=>m(et.lineNumber))})}function u4(t,e,n,r=c4,o=l4,a=a4,i=s4,s=i4){let l=Tn(t.displayName,r,n,{hardBreak:!0}),c=t.description?.trim()??"",d=c.length>0?c.split(`
309
309
  `).flatMap(g=>Tn(g,o,n,{hardBreak:!0})):[],u=[];if(e){let g=(E,y)=>{for(let b of E){let S=Ect(b.message);u.push({severity:y,sourceLine:b.line,text:S,lines:Tn(S,r-2,n,{hardBreak:!0})})}};g(e.errors,"error"),g(e.warnings,"warning")}let f=u.reduce((g,E)=>g+E.lines.length,0),p=d.length>0||u.length>0,m=Math.max(0,l.length-1)*iL,h=a+m+(p?i:0)+d.length*sL+f*s;return{nameLines:l,descLines:d,violations:u,rowHeight:h}}function Kct(t){let e=[],n=/'([^']+)'/g,r=0,o;for(;(o=n.exec(t))!==null;)o.index>r&&e.push({text:t.slice(r,o.index),bold:!1}),e.push({text:o[1],bold:!0}),r=o.index+o[0].length;return r<t.length&&e.push({text:t.slice(r),bold:!1}),e}var Lb,vct,t4,kct,Lct,Nct,Mct,Tct,Cct,_ct,Act,Rct,a4,Ict,Pct,e4,Dct,n4,Oct,i4,s4,l4,Gct,$ct,Hct,Wct,Bct,c4,Fct,Yct,kb,zct,r4,Mp,iL,sL,p4=st(()=>{"use strict";Xn();on();tn();Rh();Kw();fr();en();Lb={raci:{R:"Responsible",A:"Accountable",C:"Consulted",I:"Informed"},rasci:{R:"Responsible",A:"Accountable",S:"Support",C:"Consulted",I:"Informed"},daci:{D:"Driver",A:"Approver",C:"Contributor",I:"Informed"}},vct=50,t4=24,kct=16,Lct=28,Nct=8,Mct=96,Tct=28,Cct=16,_ct=12,Act=14,Rct=36,a4=36,Ict=40,Pct=200,e4=360,Dct=64,n4=120,Oct=4,i4=14,s4=8,l4=11,Gct=8,$ct=8,Hct=14,Wct=14,Bct=600,c4=13,Fct=12,Yct=13,kb=25,zct=6,r4=["blue","orange","green","purple","yellow","cyan","red","teal"];Mp=4;iL=16,sL=16});function m4(t,e){if(e.size===0)return{participants:t.participants,messages:t.messages,elements:t.elements,groups:t.groups,collapsedGroupIds:new Map};let n=new Map,r=new Set;for(let d of t.groups)if(e.has(d.lineNumber)){r.add(d.name);for(let u of d.participantIds)n.set(u,d.name)}let o=[],a=new Set;for(let d of t.participants){let u=n.get(d.id);if(u){if(!a.has(u)){a.add(u);let f=t.groups.find(p=>p.name===u&&e.has(p.lineNumber));o.push({id:u,label:u,type:"default",lineNumber:f.lineNumber})}}else r.has(d.id)||o.push(d)}let i=d=>n.get(d)??d,s=t.messages.map(d=>({...d,from:i(d.from),to:i(d.to)})),l=Nb(t.elements,n),c=t.groups.filter(d=>!e.has(d.lineNumber));return{participants:o,messages:s,elements:l,groups:c,collapsedGroupIds:n}}function Nb(t,e){let n=o=>e.get(o)??o,r=[];for(let o of t)if(Fo(o))r.push(o);else if(Zr(o))r.push({...o,participantId:n(o.participantId)});else if(Ir(o))r.push({...o,children:Nb(o.children,e),elseChildren:Nb(o.elseChildren,e),...o.elseIfBranches?{elseIfBranches:o.elseIfBranches.map(a=>({...a,children:Nb(a.children,e)}))}:{}});else{let a=o,i=n(a.from),s=n(a.to);if(i===s&&i!==a.from&&!a.label)continue;r.push({...a,from:i,to:s})}return r}var h4=st(()=>{"use strict";Dc()});function Zct(t,e){for(let n of e)if(n.metadata)for(let r of n.participantIds){let o=t.get(r);if(o)for(let[a,i]of Object.entries(n.metadata))a in o||(o[a]=i)}}function Qct(t,e,n,r){let o=new Map;for(let a of t){if(r.get(a.id)?.[n])continue;let s=new Set;for(let l of e)l.to===a.id&&l.metadata?.[n]&&s.add(l.metadata[n]);s.size===1&&o.set(a.id,[...s][0])}return o}function g4(t,e){let n={participants:new Map,messages:new Map},r=t.tagGroups.find(s=>s.name.toLowerCase()===e.toLowerCase());if(!r){for(let s of t.participants)n.participants.set(s.id,void 0);for(let s of t.messages)n.messages.set(s.lineNumber,void 0);return n}let o=qt(r.name),a=new Map;for(let s of t.participants)a.set(s.id,{...s.metadata||{}});Zct(a,t.groups);let i=Qct(t.participants,t.messages,o,a);for(let[s,l]of i){let c=a.get(s);c[o]=l}if(r.defaultValue)for(let s of t.participants){let l=a.get(s.id);o in l||(l[o]=r.defaultValue)}for(let s of t.participants){let l=a.get(s.id);n.participants.set(s.id,l[o]||void 0)}for(let s of t.messages)n.messages.set(s.lineNumber,s.metadata?.[o]||void 0);return n}var y4=st(()=>{"use strict";Ke()});var N4={};ye(N4,{applyGroupOrdering:()=>L4,applyPositionOverrides:()=>k4,buildNoteMessageMap:()=>vdt,buildRenderSequence:()=>S4,computeActivations:()=>v4,groupMessagesBySection:()=>E4,parseInlineMarkdown:()=>Il,renderSequenceDiagram:()=>Sdt,truncateBareUrl:()=>O0});function b4(t,e,n){let r=t.split(`
310
310
  `).map(o=>o.startsWith("- ")?"\u2022 "+o.slice(2):o);return Ko(r,e,o=>_t(o,n))}function w4(t,e,n){if(_t(t,n)<=e)return[t];if(t.includes(" "))return cL(t.split(" "),e,n);if(/[-_:/]/.test(t)){let o=t.split(/[-_:/]+/);return cL(o,e,n)}let r=t.replace(/([a-z])([A-Z])/g,"$1\0$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1\0$2").split("\0");return r.length>1?cL(r,e,n):[t]}function cL(t,e,n){let r=[],o="";for(let a of t){let i=o?o+a:a;_t(i,n)>e&&o?(r.push(o),o=a):o=i}return o&&r.push(o),r}function ydt(t,e,n,r,o,a=iu,i=ic){t.append("rect").attr("x",-a/2).attr("y",0).attr("width",a).attr("height",i).attr("rx",2).attr("ry",2).attr("fill",Tp(e,n,r,o)).attr("stroke",Cp(e,r)).attr("stroke-width",ua)}function bdt(t,e,n,r=ic){let o=r/ic,a=8*o,i=0,s=10*o,l=19*o,c=r*.65,d=r-2*o,u=24*o,f=16*o,p=12*o,m=Cp(e,n),h=Math.max(1.2,2.5*o);t.append("circle").attr("cx",i).attr("cy",s).attr("r",a).attr("fill","none").attr("stroke",m).attr("stroke-width",h),t.append("line").attr("x1",i).attr("y1",l).attr("x2",i).attr("y2",c).attr("stroke",m).attr("stroke-width",h),t.append("line").attr("x1",i-f).attr("y1",u).attr("x2",i+f).attr("y2",u).attr("stroke",m).attr("stroke-width",h),t.append("line").attr("x1",i).attr("y1",c).attr("x2",i-p).attr("y2",d).attr("stroke",m).attr("stroke-width",h),t.append("line").attr("x1",i).attr("y1",c).attr("x2",i+p).attr("y2",d).attr("stroke",m).attr("stroke-width",h)}function xdt(t,e,n,r,o,a=iu,i=ic){let c=i-14,d=Tp(e,n,r,o),u=Cp(e,r);t.append("ellipse").attr("cx",0).attr("cy",7+c).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua),t.append("rect").attr("class","participant-body").attr("x",-a/2).attr("y",7).attr("width",a).attr("height",c).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",-a/2).attr("y1",7).attr("x2",-a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua),t.append("line").attr("x1",a/2).attr("y1",7).attr("x2",a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua),t.append("ellipse").attr("cx",0).attr("cy",7).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua)}function wdt(t,e,n,r,o,a=iu,i=ic){let l=-a/2+10,c=a-20,d=Tp(e,n,r,o),u=Cp(e,r);t.append("ellipse").attr("cx",l+c).attr("cy",i/2).attr("rx",10).attr("ry",i/2).attr("fill",d).attr("stroke",u).attr("stroke-width",ua),t.append("rect").attr("class","participant-body").attr("x",l).attr("y",0).attr("width",c).attr("height",i).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",l).attr("y1",0).attr("x2",l+c).attr("y2",0).attr("stroke",u).attr("stroke-width",ua),t.append("line").attr("x1",l).attr("y1",i).attr("x2",l+c).attr("y2",i).attr("stroke",u).attr("stroke-width",ua),t.append("ellipse").attr("cx",l).attr("cy",i/2).attr("rx",10).attr("ry",i/2).attr("fill",d).attr("stroke",u).attr("stroke-width",ua)}function Edt(t,e,n,r,o,a=iu,i=ic){let c=i-14,d=Tp(e,n,r,o),u=Cp(e,r),f="4 3";t.append("ellipse").attr("cx",0).attr("cy",7+c).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("rect").attr("class","participant-body").attr("x",-a/2).attr("y",7).attr("width",a).attr("height",c).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",-a/2).attr("y1",7).attr("x2",-a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("line").attr("x1",a/2).attr("y1",7).attr("x2",a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("ellipse").attr("cx",0).attr("cy",7).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f)}function E4(t,e){let n=[],r=null,o=new Map;e.forEach((i,s)=>o.set(i.lineNumber,s));let a=i=>{let s=[];for(let l of i)if(Ir(l)){if(s.push(...a(l.children),...a(l.elseChildren)),l.elseIfBranches)for(let c of l.elseIfBranches)s.push(...a(c.children))}else{if(Fo(l)||Zr(l))continue;{let c=o.get(l.lineNumber)??-1;c>=0&&s.push(c)}}return s};for(let i of t)if(Fo(i))r={section:i,messageIndices:[]},n.push(r);else if(r){if(Ir(i))r.messageIndices.push(...a([i]));else if(!Zr(i)){let s=o.get(i.lineNumber)??-1;s>=0&&r.messageIndices.push(s)}}return n}function S4(t){let e=[],n=[];for(let r=0;r<t.length;r++){let o=t[r];for(;n.length>0;){let a=n[n.length-1];if(a.to===o.from)break;n.pop(),e.push({type:"return",from:a.to,to:a.from,label:"",messageIndex:a.messageIndex})}if(n.length>0&&!o.async&&o.from!==o.to){let a=n[n.length-1];if(a.from===o.to&&a.to===o.from){n.pop(),e.push({type:"return",from:o.from,to:o.to,label:o.label,messageIndex:r});continue}}e.push({type:"call",from:o.from,to:o.to,label:o.label,messageIndex:r,...o.async?{async:!0}:{}}),!o.async&&(o.from===o.to?e.push({type:"return",from:o.to,to:o.from,label:"",messageIndex:r}):n.push({from:o.from,to:o.to,messageIndex:r}))}for(;n.length>0;){let r=n.pop();e.push({type:"return",from:r.to,to:r.from,label:"",messageIndex:r.messageIndex})}return e}function v4(t){let e=[],n=new Map,r=o=>(n.has(o)||n.set(o,[]),n.get(o));for(let o=0;o<t.length;o++){let a=t[o];if(a.type==="call")r(a.to).push(o);else{let i=r(a.from);if(i.length>0){let s=i.pop();e.push({participantId:a.from,startStep:s,endStep:o,depth:i.length})}}}return e}function k4(t){if(!t.some(s=>s.position!==void 0))return[...t];let e=t.length,n=[],r=[];for(let s of t)if(s.position!==void 0){let l=s.position<0?e+s.position:s.position;l=Math.max(0,Math.min(e-1,l)),n.push({participant:s,index:l})}else r.push(s);n.sort((s,l)=>s.index-l.index);let o=new Array(e).fill(null),a=new Set;for(let{participant:s,index:l}of n){let c=l;if(a.has(c))for(let d=1;d<e;d++){if(c+d<e&&!a.has(c+d)){c=c+d;break}if(c-d>=0&&!a.has(c-d)){c=c-d;break}}o[c]=s,a.add(c)}let i=0;for(let s=0;s<e;s++)o[s]===null&&(o[s]=r[i++]);return o}function L4(t,e,n=[]){if(e.length===0)return[...t];let r=new Map;for(let c of e)for(let d of c.participantIds)r.set(d,c);let o=[],a=new Set;for(let c of n)for(let d of[c.from,c.to])a.has(d)||(a.add(d),o.push(d));for(let c of t)a.has(c.id)||(a.add(c.id),o.push(c.id));let i=[],s=new Set,l=new Set;for(let c of o){if(s.has(c))continue;let d=r.get(c);if(d&&!l.has(d)){l.add(d);for(let u of d.participantIds){let f=t.find(p=>p.id===u);f&&!s.has(u)&&(i.push(f),s.add(u))}}else if(!d){let u=t.find(f=>f.id===c);u&&(i.push(u),s.add(c))}}return i}function Sdt(t,e,n,r,o,a){Rt(t).selectAll("*").remove();let{title:i,options:s}=e,l=s["solid-fill"]==="on",c=a?.collapsedGroups?new Set(a.collapsedGroups):new Set(e.groups.filter(ct=>ct.collapsed).map(ct=>ct.lineNumber)),d=c.size>0?m4(e,c):null,u=d?d.messages:e.messages,f=d?d.elements:e.elements,p=d?d.groups:e.groups,m=a?.collapsedSections,h=d?d.participants:e.participants,g=k4(L4(h,p,u));if(g.length===0)return;let E=new Set;if(p.length>0){let ct=new Map;for(let wt=0;wt<p.length;wt++)for(let Ct of p[wt].participantIds)ct.set(Ct,wt);let gt=-1;for(let wt=1;wt<g.length;wt++){let Ct=ct.get(g[wt-1].id)??gt,Yt=ct.get(g[wt].id)??gt;Yt!==Ct&&!(Yt===gt&&Ct===gt)&&E.add(g[wt].id)}}let y=E.size,b=225,S=dL;for(let ct of g){let gt=w4(ct.label,Tb(dL),Mb);if(gt.length===0)continue;let Ct=Math.max(...gt.map(Yt=>_t(Yt,Mb)))+10;S=Math.max(S,Ct)}S=Math.min(b,S);let x=Math.max(Jct,S+30),L=Math.max(g.length*x,S+40),v=a?.exportWidth??t.getBoundingClientRect().width,A=a?.exportWidth?Ee.identity():Ee.from(v,L),C=A.structural(x),M=A.structural(S),w=A.structural(x4),k=A.aesthetic(tdt),N=A.aesthetic(edt),_=A.aesthetic(ndt),T=A.structural(rdt),R=A.structural(odt),G=A.structural(adt),I=A.structural(idt),H=A.structural(sdt),O=A.structural(ldt),D=A.structural(cdt),W=A.text(ddt),z=A.structural(udt),P=A.structural(fdt),B=A.structural(pdt),Y=mdt,V=A.structural(hdt),j=I-O*2-H,K=C-B-P,$=A.text(Mb),U=Tb(M),X=new Map;g.forEach((ct,gt)=>X.set(ct.id,gt));let q=ct=>{let gt=X.get(ct.participantId);return gt===void 0?ct.position:ct.position==="right"&&gt===g.length-1&&gt>0?"left":ct.position==="left"&&gt===0&&g.length>1?"right":ct.position},et=B/2+V+P-(B+P),tt=(ct,gt,wt=!1)=>{let Ct=X.get(ct);if(Ct===void 0||!(gt==="right"?Ct<g.length-1:Ct>0))return I;let Et=wt&&gt==="right"?K-et:K;return Math.min(I,Et)},F=ct=>ct-O*2-H,Q=s.activations?.toLowerCase()==="off",ot=Hr(e.tagGroups.filter(ct=>ct.entries.length>0),s["active-tag"],a?.activeTagGroup)??void 0,Z,lt=new Map;if(ot){Z=g4(e,ot);let ct=e.tagGroups.find(gt=>gt.name.toLowerCase()===ot.toLowerCase());if(ct)for(let gt of ct.entries)lt.set(gt.value.toLowerCase(),gt.color)}let nt=ct=>ct?lt.get(ct.toLowerCase()):void 0,J=ot?qt(ot):void 0,at=new Set;if(m&&m.size>0){let ct=E4(f,u);for(let gt of ct)if(m.has(gt.section.lineNumber))for(let wt of gt.messageIndices)at.add(wt)}let it=S4(u),vt=ct=>(at.size===0||!at.has(ct.messageIndex))&&(ct.type==="call"||!!ct.label),Tt=[],At=new Array(it.length);for(let ct=0;ct<it.length;ct++){let gt=it[ct];At[ct]=Tt.length,vt(gt)&&Tt.push(gt)}let rt=Math.max(Tt.length-1,0),pt=ct=>Math.min(Math.max(ct,0),rt),ht=Q?[]:v4(it).map(ct=>({...ct,startStep:pt(At[ct.startStep]??0),endStep:pt(At[ct.endStep]??0)})),dt=35,ut=30,yt=15,kt=42,Ot=new Map,Xt=new Map;Tt.forEach((ct,gt)=>{Ot.has(ct.messageIndex)||Ot.set(ct.messageIndex,gt),Xt.set(ct.messageIndex,gt)});let bt=ct=>{let gt=-1,wt=-1;for(let Ct=0;Ct<u.length;Ct++){let Yt=u[Ct];Yt.lineNumber<ct.lineNumber&&Yt.lineNumber>wt&&(wt=Yt.lineNumber,gt=Ct)}return gt>=0&&at.has(gt)||gt<0?-1:Xt.get(gt)??-1},Nt=ct=>{let gt=-1,wt=-1;for(let Yt=0;Yt<u.length;Yt++){let Et=u[Yt];Et.lineNumber<ct.lineNumber&&Et.lineNumber>wt&&(wt=Et.lineNumber,gt=Yt)}if(gt<0)return!1;let Ct=u[gt];return Ct.from===Ct.to},Vt=A.structural(8),xt=ct=>Nt(ct)?Y+ne+Vt:ne,Lt=new Map;u.forEach((ct,gt)=>Lt.set(ct.lineNumber,gt));let Dt=ct=>{for(let gt of ct)if(Ir(gt)){let wt=Dt(gt.children);if(wt>=0)return wt;if(gt.elseIfBranches)for(let Yt of gt.elseIfBranches){let Et=Dt(Yt.children);if(Et>=0)return Et}let Ct=Dt(gt.elseChildren);if(Ct>=0)return Ct}else if(!Fo(gt)&&!Zr(gt)){let wt=Lt.get(gt.lineNumber)??-1;if(wt>=0&&!at.has(wt))return wt}return-1},zt=35,$t=45,ft=new Map,Wt=(ct,gt)=>{ft.set(ct,(ft.get(ct)||0)+gt)},he=ct=>{for(let gt=0;gt<ct.length;gt++){let wt=ct[gt];if(Fo(wt)||!Ir(wt))continue;let Ct=Dt(wt.children);if(Ct>=0&&Wt(Ct,ut),wt.elseIfBranches)for(let Et of wt.elseIfBranches){let Bt=Dt(Et.children);Bt>=0&&Wt(Bt,ut),he(Et.children)}let Yt=Dt(wt.elseChildren);if(Yt>=0&&Wt(Yt,ut),he(wt.children),he(wt.elseChildren),gt+1<ct.length){let Et=Dt([ct[gt+1]]);Et>=0&&Wt(Et,yt)}}};f&&f.length>0&&he(f);let ne=A.structural(14),se=A.aesthetic(35),Zt=(ct,gt=j)=>b4(ct,gt,W).length*z+D*2,Ie=0,Ht=ct=>{for(let gt=0;gt<ct.length;gt++){let wt=ct[gt];if(Zr(wt)){let Yt=xt(wt),Et=gt;for(;Et<ct.length&&Zr(ct[Et]);){let _e=ct[Et],ke=Nt(_e),Re=tt(_e.participantId,_e.position,ke),Xe=Zt(_e.text,F(Re));Yt+=Xe+ne,Et++}let Bt=Math.max(se,Yt*.3);Yt+=Bt-ne;let Kt=Math.max(0,Yt-dt),ue=-1;for(let _e=Et;_e<ct.length&&(ue=Dt([ct[_e]]),!(ue>=0));_e++);Et<ct.length&&Ir(ct[Et])&&(Kt+=kt-ut),ue>=0?Wt(ue,Kt):Ie=Math.max(Ie,Kt),gt=Et-1}else if(Ir(wt)){if(Ht(wt.children),wt.elseIfBranches)for(let Ct of wt.elseIfBranches)Ht(Ct.children);Ht(wt.elseChildren)}}};f&&f.length>0&&Ht(f);let Qt=[],Ut=[];{let ct=new Map;u.forEach((Yt,Et)=>ct.set(Yt.lineNumber,Et));let gt=Yt=>ct.get(Yt.lineNumber)??-1,wt=Yt=>{let Et=[];for(let Bt of Yt.children)if(Ir(Bt))Et.push(...wt(Bt));else if(!Fo(Bt)&&!Zr(Bt)){let Kt=gt(Bt);Kt>=0&&Et.push(Kt)}if(Yt.elseIfBranches){for(let Bt of Yt.elseIfBranches)for(let Kt of Bt.children)if(Ir(Kt))Et.push(...wt(Kt));else if(!Fo(Kt)&&!Zr(Kt)){let ue=gt(Kt);ue>=0&&Et.push(ue)}}for(let Bt of Yt.elseChildren)if(Ir(Bt))Et.push(...wt(Bt));else if(!Fo(Bt)&&!Zr(Bt)){let Kt=gt(Bt);Kt>=0&&Et.push(Kt)}return Et},Ct=Qt;for(let Yt of f)if(Fo(Yt)){let Et={section:Yt,msgIndices:[]};Ut.push(Et),Ct=Et.msgIndices}else if(Ir(Yt))Ct.push(...wt(Yt));else{let Et=gt(Yt);Et>=0&&Ct.push(Et)}}let fe=new Map;it.forEach((ct,gt)=>{fe.has(ct.messageIndex)||fe.set(ct.messageIndex,gt)});let de=new Map;{let ct=0;for(let gt=0;gt<it.length;gt++){let wt=it[gt];!at.has(wt.messageIndex)&&(wt.type==="call"||wt.label)&&(de.set(gt,ct),ct++)}}let te=ct=>{for(let gt=ct;gt<it.length;gt++){let wt=de.get(gt);if(wt!==void 0)return wt}return null},ae=new Map,Te=[];for(let ct of Ut){if(ct.msgIndices.length===0){Te.push(ct.section);continue}let gt=ct.msgIndices[0],wt=fe.get(gt);if(wt===void 0){Te.push(ct.section);continue}let Ct=te(wt);if(Ct===null){Te.push(ct.section);continue}let Yt=ae.get(Ct)||[];Yt.push(ct.section),ae.set(Ct,Yt)}let Je=new Map;for(let ct of Ut)Je.set(ct.section.lineNumber,ct.msgIndices.length);let sn=15,ze=22,Ce=8,ee=11,oe=!!i&&s["no-title"]!=="on",Be=oe?N:0,dn=8,He={groups:e.tagGroups.filter(ct=>ct.entries.length>0).map(ct=>({name:ct.name,entries:ct.entries.map(gt=>({value:gt.value,color:gt.color}))})),position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},Nn=e.tagGroups.length>0?Tr(He,v)+dn:0,jn=e.groups.length>0?ze+ee:0,xo=k+Be+Nn+_+jn,Sr=xo+w,An=g.some(ct=>ct.type==="actor"),In=T+(An?20:0)+(e.groups.length>0?Ce:0),Ar=[],lr=new Map,Vr;{let ct=Sr+In;for(let gt=0;gt<Tt.length;gt++){let wt=ae.get(gt);if(wt)for(let Et of wt)ct+=zt,lr.set(Et.lineNumber,ct),ct+=$t;let Ct=Tt[gt];if(Ot.get(Ct.messageIndex)===gt){let Et=ft.get(Ct.messageIndex)||0;ct+=Et}Ar.push(ct);let Yt=Ct.type==="call"&&Ct.from===Ct.to;ct+=Yt?Y+25:dt}for(let gt of Te)ct+=zt,lr.set(gt.lineNumber,ct),ct+=$t;ct+=Ie,Vr=ct}let Zn=ct=>Ar[ct],io=new Map;{let ct=gt=>{for(let wt=0;wt<gt.length;wt++){let Ct=gt[wt];if(Zr(Ct)){let Yt=bt(Ct);if(Yt<0)continue;let Et=wt>0&&Zr(gt[wt-1])?gt[wt-1]:null,Bt=Et?io.get(Et):void 0,Kt;if(Bt!==void 0&&Et){let ue=tt(Et.participantId,q(Et),Nt(Et)),_e=Zt(Et.text,F(ue));Kt=Bt+_e+ne}else Kt=Zn(Yt)+xt(Ct);io.set(Ct,Kt)}else if(Ir(Ct)){if(ct(Ct.children),Ct.elseIfBranches)for(let Yt of Ct.elseIfBranches)ct(Yt.children);ct(Ct.elseChildren)}}};f&&f.length>0&&ct(f)}let Oo=Tt[Tt.length-1],di=Oo?.type==="call"&&Oo.from===Oo.to?Y+25:dt,ko=Tt.length>0?Math.max(Ar[Ar.length-1]+di,Vr):Vr;for(let[ct,gt]of io){let wt=tt(ct.participantId,q(ct),Nt(ct)),Ct=Zt(ct.text,F(wt));ko=Math.max(ko,gt+Ct+se)}let ha=ko-Sr+R,ui=g.length>1?g.length-1:0,ga=ui-y,fi=C,pi=C;y>0&&ui>0&&(fi=C*.88,pi=(ui*C-ga*fi)/y);let ml=g[g.length-1]?.id,Va=M/2;if(ml){e.groups.some(wt=>wt.participantIds.includes(ml))&&(Va=Math.max(Va,M/2+sn));for(let wt of Tt)if(wt.from===wt.to&&wt.from===ml){let Ct=B+V,Yt=0;wt.label&&(Yt=_t(wt.label,12)+15),Va=Math.max(Va,Ct+Yt)}let ct=30,gt=wt=>{for(let Ct of wt)if(Ir(Ct)){let Yt=Et=>Et.some(Bt=>!Ir(Bt)&&!Zr(Bt)&&!Fo(Bt)&&"from"in Bt&&(Bt.from===ml||Bt.to===ml));if(Yt(Ct.children)||Yt(Ct.elseChildren)||Ct.elseIfBranches?.some(Et=>Yt(Et.children))||gt(Ct.children)||gt(Ct.elseChildren)||Ct.elseIfBranches?.some(Et=>gt(Et.children)))return!0}return!1};f&&gt(f)&&(Va=Math.max(Va,M/2+ct))}let vr=Math.max(Va+10,C/2),ya=C/2,ws=g.length*C,Vi=Math.max(ya+ws+vr,M+40),Ui=xo+w+Math.max(ha,40)+40,mi=Math.max(Vi,v),hi=ya+Math.max(0,(mi-Vi)/2),to=new Map,uu=()=>{let ct=hi;to.clear(),g.forEach((gt,wt)=>{if(to.set(gt.id,ct),wt<g.length-1){let Ct=g[wt+1].id;ct+=E.has(Ct)?pi:fi}})};uu();let cc=0,Xi=mi;for(let ct of Tt){if(!ct.label)continue;let gt=_t(ct.label,12);if(ct.from===ct.to){let wt=to.get(ct.from);if(wt!==void 0){let Ct=wt+B/2+V+5+gt;Xi=Math.max(Xi,Ct)}}else{let wt=to.get(ct.from),Ct=to.get(ct.to);if(wt!==void 0&&Ct!==void 0){let Yt=(wt+Ct)/2;cc=Math.min(cc,Yt-gt/2),Xi=Math.max(Xi,Yt+gt/2)}}}if(f){let ct=gt=>{for(let wt of gt)if(Zr(wt)){let Ct=wt,Yt=q(Ct);if(Yt==="right"){let Et=to.get(Ct.participantId);if(Et!==void 0){let Bt=Nt(Ct),Kt=Bt?B/2+V+P:B+P,ue=tt(Ct.participantId,Yt,Bt);Xi=Math.max(Xi,Et+Kt+ue)}}}else if(Ir(wt)&&(ct(wt.children),ct(wt.elseChildren),wt.elseIfBranches))for(let Ct of wt.elseIfBranches)ct(Ct.children)};ct(f)}let fu=Math.max(0,-cc),dc=Math.max(0,Xi-mi);(fu>0||dc>0)&&(ya+=fu,vr+=dc,Vi=Math.max(ya+ws+vr,M+40),mi=Math.max(Vi,v),hi=ya+Math.max(0,(mi-Vi)/2),uu());let gr=Rt(t).append("svg").attr("width","100%").attr("height",Ui).attr("viewBox",`0 0 ${mi} ${Ui}`).attr("preserveAspectRatio","xMidYMin meet").attr("class","sequence-diagram").style("font-family",It),ba=gr.append("defs");ba.append("marker").attr("id","seq-arrowhead").attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polygon").attr("points",`0,0 ${G},${G/2} 0,${G}`).attr("fill",n.text),ba.append("marker").attr("id","seq-arrowhead-open").attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polyline").attr("points",`0,0 ${G},${G/2} 0,${G}`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2),ba.append("marker").attr("id","seq-arrowhead-async").attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polyline").attr("points",`0,0 ${G},${G/2} 0,${G}`).attr("fill","none").attr("stroke",n.text).attr("stroke-width",1.2);let Go=`0,0 ${G},${G/2} 0,${G}`;for(let[,ct]of lt){let gt=ct.replace("#","");ba.append("marker").attr("id",`seq-arrowhead-c${gt}`).attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polygon").attr("points",Go).attr("fill",ct),ba.append("marker").attr("id",`seq-arrowhead-async-c${gt}`).attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polyline").attr("points",Go).attr("fill","none").attr("stroke",ct).attr("stroke-width",1.2),ba.append("marker").attr("id",`seq-arrowhead-open-c${gt}`).attr("viewBox",`0 0 ${G} ${G}`).attr("refX",G).attr("refY",G/2).attr("markerWidth",G).attr("markerHeight",G).attr("orient","auto").append("polyline").attr("points",Go).attr("fill","none").attr("stroke",ct).attr("stroke-width",1.2)}let Es=(ct,gt)=>{if(gt){let wt=gt.replace("#","");switch(ct){case"call":return`url(#seq-arrowhead-c${wt})`;case"async":return`url(#seq-arrowhead-async-c${wt})`;case"return":return`url(#seq-arrowhead-open-c${wt})`}}switch(ct){case"call":return"url(#seq-arrowhead)";case"async":return"url(#seq-arrowhead-async)";case"return":return"url(#seq-arrowhead-open)"}};if(oe){let ct=gr.append("text").attr("class","chart-title").attr("x",mi/2).attr("y",A.structural(30)).attr("text-anchor","middle").attr("fill",n.text).attr("font-size",A.text(20)).attr("font-weight","700").text(i);e.titleLineNumber&&ct.attr("data-line-number",e.titleLineNumber)}let pu=e.tagGroups.length>0,Op=new Set,uc=new Map;for(let ct of e.groups)c.has(ct.lineNumber)&&(Op.add(ct.name),uc.set(ct.name,{lineNumber:ct.lineNumber,...ct.metadata!==void 0&&{metadata:ct.metadata}}));for(let ct of p){if(ct.participantIds.length===0)continue;let gt=ct.participantIds.map(Re=>to.get(Re)).filter(Re=>Re!==void 0);if(gt.length===0)continue;let wt=Math.min(...gt)-M/2-sn,Ct=Math.max(...gt)+M/2+sn,Yt=xo-ze,Et=w+ze+Ce,Bt=J&&ct.metadata?.[J],Kt=nt(Bt||void 0),ue=Kt?Gt(Kt,nr(n,r),r?15:20):r?n.surface:n.bg,_e=Kt||n.textMuted,ke=gr.append("g").attr("class","group-box-wrapper").attr("data-group-toggle","").attr("data-group-line",String(ct.lineNumber)).attr("tabindex","0").attr("role","button").attr("aria-expanded","true").attr("cursor","pointer");ke.append("title").text("Click to collapse"),ke.append("rect").attr("x",wt).attr("y",Yt).attr("width",Ct-wt).attr("height",Et).attr("rx",6).attr("fill",ue).attr("stroke",_e).attr("stroke-width",1).attr("stroke-opacity",.5).attr("pointer-events","none").attr("class","group-box"),ke.append("rect").attr("x",wt).attr("y",Yt).attr("width",Ct-wt).attr("height",xo-Yt).attr("fill","transparent").attr("class","group-label-hit"),ke.append("text").attr("x",(wt+Ct)/2).attr("y",Yt+ee+4).attr("text-anchor","middle").attr("fill",_e).attr("font-size",ee).attr("font-weight","bold").attr("opacity",.7).attr("pointer-events","none").attr("class","group-label").text(ct.name)}let fc=Sr;g.forEach(ct=>{let gt=to.get(ct.id),wt=xo,Ct=Z?.participants.get(ct.id),Yt=nt(Ct),Et=J&&Ct?{key:J,value:Ct.toLowerCase()}:void 0,Bt=Op.has(ct.id),Kt=Yt;if(Bt&&!Kt){let Re=uc.get(ct.id);Re?.metadata&&J&&(Kt=nt(Re.metadata[J]))}if(kdt(gr,ct,gt,wt,n,r,Kt,Et,l,M,w,U,$),Bt){let Re=uc.get(ct.id),Xe=Kt||n.textMuted,an=6,Pe=M,je=w+ze+Ce,Ae=`clip-drill-group-${ct.id.replace(/[^a-zA-Z0-9-]/g,"-")}`,Ze=gr.select(`.participant[data-participant-id="${ct.id}"]`);Ze.attr("data-group-toggle","").attr("data-group-line",String(Re.lineNumber)).attr("tabindex","0").attr("role","button").attr("aria-expanded","false").attr("cursor","pointer"),Ze.append("title").text("Click to expand");let Oe=Kt?Gt(Kt,nr(n,r),r?30:40):r?Gt(n.overlay,n.surface,50):Gt(n.bg,n.surface,50),qe=Kt||n.border;Ze.append("rect").attr("x",-Pe/2).attr("y",-ze).attr("width",Pe).attr("height",je).attr("rx",6).attr("fill",Oe).attr("stroke",qe).attr("stroke-width",1.5),Ze.append("text").attr("x",0).attr("y",-ze+je/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",n.text).attr("font-size",A.text(13)).attr("font-weight",500).text(ct.label),Ze.append("clipPath").attr("id",Ae).append("rect").attr("x",-Pe/2).attr("y",-ze).attr("width",Pe).attr("height",je).attr("rx",6),Ze.append("rect").attr("class","sequence-drill-bar").attr("x",-Pe/2).attr("y",-ze+je-an).attr("width",Pe).attr("height",an).attr("fill",Xe).attr("clip-path",`url(#${Ae})`)}let ue=Bt?fc+Ce:ct.type==="actor"?fc+gdt:fc,_e=Bt?Kt||n.textMuted:Yt||n.textMuted,ke=gr.append("line").attr("x1",gt).attr("y1",ue).attr("x2",gt).attr("y2",fc+ha).attr("stroke",_e).attr("stroke-width",1).attr("stroke-dasharray","6 4").attr("class","lifeline").attr("data-participant-id",ct.id);J&&Ct&&ke.attr(`data-tag-${J}`,Ct.toLowerCase())});let mu=30,Vb=15,hu=18,Ub=B/2+V,Xb=10,gu=Math.max(...Array.from(to.values())),Ss=ct=>{let gt=[];for(let wt of ct)if(Ir(wt)){if(gt.push(...Ss(wt.children),...Ss(wt.elseChildren)),wt.elseIfBranches)for(let Ct of wt.elseIfBranches)gt.push(...Ss(Ct.children))}else if(!Fo(wt)&&!Zr(wt)){let Ct=u.indexOf(wt);Ct>=0&&gt.push(Ct)}return gt},ta=[],hl=[],mt=(ct,gt)=>{for(let wt of ct){if(!Ir(wt))continue;let Ct=Ss(wt.children),Yt=[];if(wt.elseIfBranches)for(let Oe of wt.elseIfBranches)Yt.push({label:Oe.label,indices:Ss(Oe.children),lineNumber:Oe.lineNumber});let Et=Ss(wt.elseChildren),Bt=[...Ct,...Yt.flatMap(Oe=>Oe.indices),...Et];if(Bt.length===0)continue;let Kt=1/0,ue=-1/0;for(let Oe of Bt){let qe=Ot.get(Oe),De=Xt.get(Oe);qe!==void 0&&(Kt=Math.min(Kt,qe)),De!==void 0&&(ue=Math.max(ue,De))}if(Kt===1/0)continue;let _e=new Set;for(let Oe of Bt){let qe=u[Oe];_e.add(qe.from),_e.add(qe.to)}let ke=1/0,Re=-1/0;for(let Oe of _e){let qe=to.get(Oe);qe!==void 0&&(ke=Math.min(ke,qe),Re=Math.max(Re,qe))}let Xe=0,an=!1;for(let Oe of Bt){let qe=u[Oe];if(qe.from===qe.to){let De=to.get(qe.from);if(De!==void 0){let Mn=De+Ub-(Re+mu)+Xb;Mn>0&&(Xe=Math.max(Xe,Mn))}Xt.get(Oe)===ue&&(an=!0)}}let Pe=ke-mu,je=Zn(Kt)-kt,Ae=Re-ke+mu*2+Xe,Ze=Zn(ue)-Zn(Kt)+kt+Vb+(an?Y:0);gr.append("rect").attr("x",Pe).attr("y",je).attr("width",Ae).attr("height",Ze).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1).attr("stroke-dasharray","2 3").attr("rx",3).attr("ry",3).attr("class","block-frame").attr("data-block-line",String(wt.lineNumber)),ta.push({x:Pe+6,y:je+hu-4,text:`${wt.type} ${wt.label}`,bold:!1,italic:!1,blockLine:wt.lineNumber});for(let Oe of Yt)if(Oe.indices.length>0){let qe=1/0;for(let De of Oe.indices){let xn=Ot.get(De);xn!==void 0&&(qe=Math.min(qe,xn))}if(qe<1/0){let De=Zn(qe)-ut;hl.push({x1:Pe,y1:De,x2:Pe+Ae,y2:De,blockLine:Oe.lineNumber}),ta.push({x:Pe+6,y:De+14,text:`else if ${Oe.label}`,bold:!1,italic:!1,blockLine:Oe.lineNumber})}}if(Et.length>0){let Oe=1/0;for(let qe of Et){let De=Ot.get(qe);De!==void 0&&(Oe=Math.min(Oe,De))}if(Oe<1/0){let qe=Zn(Oe)-ut;hl.push({x1:Pe,y1:qe,x2:Pe+Ae,y2:qe,...wt.elseLineNumber!==void 0&&{blockLine:wt.elseLineNumber}}),ta.push({x:Pe+6,y:qe+14,text:"else",bold:!1,italic:!1,...wt.elseLineNumber!==void 0&&{blockLine:wt.elseLineNumber}})}}if(mt(wt.children,gt+1),wt.elseIfBranches)for(let Oe of wt.elseIfBranches)mt(Oe.children,gt+1);mt(wt.elseChildren,gt+1)}};f&&f.length>0&&mt(f,0);let St=A.structural(6);ht.forEach(ct=>{let gt=to.get(ct.participantId);if(gt===void 0)return;let wt=gt-B/2+ct.depth*St,Ct=Zn(ct.startStep),Yt=Zn(ct.endStep),Et=[];for(let an=ct.startStep;an<=ct.endStep;an++){let Pe=Tt[an];if(!Pe)continue;let je=u[Pe.messageIndex];je&&Et.push(je.lineNumber)}let Bt=Tt[ct.startStep],Kt=Bt!==void 0?u[Bt.messageIndex]:void 0,ue=Kt?Z?.messages.get(Kt.lineNumber):void 0,ke=nt(ue)||n.primary;gr.append("rect").attr("x",wt).attr("y",Ct).attr("width",B).attr("height",Yt-Ct).attr("fill",nr(n,r));let Re=ie(n,ke,r,{solid:l}),Xe=gr.append("rect").attr("x",wt).attr("y",Ct).attr("width",B).attr("height",Yt-Ct).attr("fill",Re).attr("stroke",ke).attr("stroke-width",1).attr("stroke-opacity",.5).attr("data-participant-id",ct.participantId).attr("data-msg-lines",Et.join(",")).attr("data-line-number",Et[0]??"").attr("class","activation");J&&ue&&Xe.attr(`data-tag-${J}`,ue.toLowerCase())});for(let ct of hl){let gt=gr.append("line").attr("x1",ct.x1).attr("y1",ct.y1).attr("x2",ct.x2).attr("y2",ct.y2).attr("stroke",n.textMuted).attr("stroke-width",1).attr("stroke-dasharray","2 3").attr("class","block-divider");ct.blockLine!==void 0&&gt.attr("data-block-line",String(ct.blockLine))}for(let ct of ta){let gt=gr.append("text").attr("x",ct.x).attr("y",ct.y).attr("fill",n.text).attr("font-size",11).attr("class","block-label").text(ct.text);ct.bold&&gt.attr("font-weight","bold"),ct.italic&&gt.attr("font-style","italic"),ct.blockLine!==void 0&&gt.attr("data-block-line",String(ct.blockLine))}let Ft=(ct,gt)=>{let wt=-1;for(let Ct of ht)Ct.participantId===ct&&Ct.startStep<=gt&&gt<=Ct.endStep&&Ct.depth>wt&&(wt=Ct.depth);return wt},Mt=(ct,gt,wt)=>{let Ct=to.get(ct),Yt=Ft(ct,gt);if(Yt<0)return Ct;let Et=Yt*St;return wt==="right"?Ct+B/2+Et:Ct-B/2+Et},Jt=Math.min(...Array.from(to.values())),re=gu,pe=Jt-M/2-10,ce=re+M/2+10;for(let ct of Ut){let gt=ct.section,wt=lr.get(gt.lineNumber);if(wt===void 0)continue;let Ct=m?.has(gt.lineNumber)??!1,Yt=n.textMuted,Et=gr.append("g").attr("data-section-toggle","").attr("data-line-number",String(gt.lineNumber)).attr("data-section","").attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!Ct)),Bt=22,Kt=pe-10,ue=ce-pe+20,_e=Ct?r?.35:.25:r?.1:.08;Et.append("rect").attr("x",Kt).attr("y",wt-Bt/2).attr("width",ue).attr("height",Bt).attr("fill",Yt).attr("opacity",_e).attr("rx",2).attr("pointer-events","none").attr("class","section-divider");let ke=Je.get(gt.lineNumber)??0,Re=Ct?`${gt.label} (${ke} ${ke===1?"message":"messages"})`:gt.label,Xe=(pe+ce)/2,an=Math.max(80,_t(Re,11)+24);Et.append("rect").attr("x",Xe-an/2).attr("y",wt-Bt/2).attr("width",an).attr("height",Bt).attr("fill","transparent").attr("class","section-label-hit"),Et.append("text").attr("x",Xe).attr("y",wt+4).attr("text-anchor","middle").attr("fill",Yt).attr("font-size",11).attr("font-weight","bold").attr("class","section-label").text(Re)}Tt.forEach((ct,gt)=>{let wt=to.get(ct.from),Ct=to.get(ct.to);if(wt===void 0||Ct===void 0)return;let Yt=Zn(gt),Et=20,Bt=u[ct.messageIndex],Kt=Bt?Z?.messages.get(Bt.lineNumber):void 0,ue=nt(Kt);if(ct.type==="call"){let _e=ue||n.text;if(ct.from===ct.to){let ke=Mt(ct.from,gt,"right"),Re=ke+V,Xe=ke;gr.append("rect").attr("x",Xe).attr("y",Yt-5).attr("width",V).attr("height",Y+10).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));let an=gr.append("path").attr("d",`M ${ke} ${Yt} H ${Re} V ${Yt+Y} H ${ke}`).attr("fill","none").attr("stroke",_e).attr("stroke-width",1.2).attr("marker-end",Es("call",ue)).attr("class","message-arrow self-call").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&an.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let Pe=gr.append("text").attr("x",Re+5).attr("y",Yt+Y/2+4).attr("text-anchor","start").attr("fill",_e).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",12).attr("class","message-label").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));J&&Kt&&Pe.attr(`data-tag-${J}`,Kt.toLowerCase()),Pe.text(ct.label)}}else{let ke=wt<Ct,Re=Mt(ct.from,gt,ke?"right":"left"),Xe=Mt(ct.to,gt,ke?"left":"right");gr.append("rect").attr("x",Math.min(Re,Xe)).attr("y",Yt-Et/2).attr("width",Math.abs(Xe-Re)).attr("height",Et).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));let an=ct.async?Es("async",ue):Es("call",ue),Pe=gr.append("line").attr("x1",Re).attr("y1",Yt).attr("x2",Xe).attr("y2",Yt).attr("stroke",_e).attr("stroke-width",1.2).attr("marker-end",an).attr("class","message-arrow").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&Pe.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let je=(Re+Xe)/2,Ae=gr.append("text").attr("x",je).attr("y",Yt-8).attr("text-anchor","middle").attr("fill",_e).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",12).attr("class","message-label").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));J&&Kt&&Ae.attr(`data-tag-${J}`,Kt.toLowerCase()),Ae.text(ct.label)}}}else{if(ct.from===ct.to)return;let _e=wt<Ct,ke=Mt(ct.from,gt,_e?"right":"left"),Re=Mt(ct.to,gt,_e?"left":"right"),Xe=ue||n.textMuted;gr.append("rect").attr("x",Math.min(ke,Re)).attr("y",Yt-Et/2).attr("width",Math.abs(Re-ke)).attr("height",Et).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));let an=gr.append("line").attr("x1",ke).attr("y1",Yt).attr("x2",Re).attr("y2",Yt).attr("stroke",Xe).attr("stroke-width",1).attr("stroke-dasharray","6 4").attr("marker-end",Es("return",ue)).attr("class","return-arrow").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&an.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let Pe=(ke+Re)/2,je=gr.append("text").attr("x",Pe).attr("y",Yt-6).attr("text-anchor","middle").attr("fill",Xe).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",11).attr("class","message-label").attr("data-line-number",String(Bt.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(gt));J&&Kt&&je.attr(`data-tag-${J}`,Kt.toLowerCase()),je.text(ct.label)}}});let Me=r?Gt(n.surface,n.bg,50):Gt(n.bg,n.surface,15),Ge=ct=>{for(let gt of ct)if(Zr(gt)){let wt=to.get(gt.participantId);if(wt===void 0)continue;let Ct=io.get(gt);if(Ct===void 0)continue;let Yt=q(gt),Et=Yt==="right",Bt=Nt(gt),Kt=tt(gt.participantId,Yt,Bt),ue=F(Kt),_e=b4(gt.text,ue,W),ke=_e.length*z+D*2,Re=Math.max(..._e.map(Ze=>_t(Ze.text,W))),Xe=Math.min(Kt,Math.max(80,Re+O*2+H)),an=Bt&&Et?B/2+V+P:B+P,Pe=Et?wt+an:wt-B-P-Xe,je=gr.append("g").attr("class","note").attr("data-note-toggle","").attr("data-line-number",String(gt.lineNumber)).attr("data-line-end",String(gt.endLineNumber));je.append("path").attr("d",[`M ${Pe} ${Ct}`,`L ${Pe+Xe-H} ${Ct}`,`L ${Pe+Xe} ${Ct+H}`,`L ${Pe+Xe} ${Ct+ke}`,`L ${Pe} ${Ct+ke}`,"Z"].join(" ")).attr("fill",Me).attr("stroke",n.textMuted).attr("stroke-width",.75).attr("class","note-box"),je.append("path").attr("d",[`M ${Pe+Xe-H} ${Ct}`,`L ${Pe+Xe-H} ${Ct+H}`,`L ${Pe+Xe} ${Ct+H}`].join(" ")).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",.75).attr("class","note-fold");let Ae=10;_e.forEach((Ze,Oe)=>{let qe=Ct+D+(Oe+1)*z-3,De=Ze.kind==="plain"?0:Ae;Ze.kind==="bullet-first"&&je.append("text").attr("x",Pe+O).attr("y",qe).attr("fill",n.text).attr("font-size",W).text("\u2022");let xn=je.append("text").attr("x",Pe+O+De).attr("y",qe).attr("fill",n.text).attr("font-size",W).attr("class","note-text");gn(xn,Ze.text,n,W)})}else if(Ir(gt)){if(Ge(gt.children),gt.elseIfBranches)for(let wt of gt.elseIfBranches)Ge(wt.children);Ge(gt.elseChildren)}};if(f&&f.length>0&&Ge(f),pu){let ct=k+Be,gt={},wt=gr.append("g").attr("class","sequence-legend").attr("transform",`translate(0,${ct})`);fn(wt,{...He,palette:n,isDark:r,width:mi,activeGroup:ot??null,controlsExpanded:!1,callbacks:gt})}}function vdt(t){let e=new Map,n=-1,r=o=>{for(let a of o)if(Zr(a))n>=0&&e.set(a.lineNumber,n);else if(Ir(a)){if(r(a.children),a.elseIfBranches)for(let i of a.elseIfBranches)r(i.children);r(a.elseChildren)}else Fo(a)||(n=a.lineNumber)};return r(t),e}function kdt(t,e,n,r,o,a,i,s,l,c=iu,d=ic,u=Tb(iu),f=Mb){let p=t.append("g").attr("transform",`translate(${n}, ${r})`).attr("class","participant").attr("data-participant-id",e.id);switch(s&&p.attr(`data-tag-${s.key}`,s.value),e.type){case"actor":bdt(p,o,i,d);break;case"database":xdt(p,o,a,i,l,c,d);break;case"queue":wdt(p,o,a,i,l,c,d);break;case"cache":Edt(p,o,a,i,l,c,d);break;default:ydt(p,o,a,i,l,c,d);break}let m=e.type==="actor",h=w4(e.label,u,f),g=f,E=g+2,y=m?o.text:ve(Tp(o,a,i,l),o.textOnFillLight,o.textOnFillDark),b=p.append("text").attr("x",0).attr("text-anchor","middle").attr("fill",y).attr("font-size",g).attr("font-weight",500),S=Tb(c),x=L=>tr(L,g,S);if(h.length===1)b.attr("y",m?d+14:d/2+5).text(x(e.label));else{let L=h.length*E,v=m?d+14-(h.length-1)*E/2:d/2+5-(L-E)/2;h.forEach((A,C)=>{b.append("tspan").attr("x",0).attr("dy",C===0?`${v}px`:`${E}px`).text(x(A))})}}var Jct,dL,x4,Mb,tdt,edt,ndt,rdt,odt,adt,idt,sdt,ldt,cdt,ddt,udt,fdt,pdt,mdt,hdt,gdt,Tb,Tp,Cp,ua,iu,ic,M4=st(()=>{"use strict";Ke();Xn();tn();_o();on();Dc();h4();Hs();en();y4();Ke();To();Br();fr();Jct=160,dL=120,x4=50,Mb=13,tdt=20,edt=30,ndt=10,rdt=50,odt=30,adt=8,idt=200,sdt=10,ldt=8,cdt=6,ddt=10,udt=14,fdt=15,pdt=10,mdt=25,hdt=30,gdt=22;Tb=t=>t-10;Tp=(t,e,n,r)=>n?ie(t,n,e,{...r!==void 0&&{solid:r}}):e?Gt(t.overlay,t.surface,50):Gt(t.bg,t.surface,50),Cp=(t,e)=>e||t.border,ua=1.5,iu=dL,ic=x4});var P4=FL((rOt,Ib)=>{"use strict";var mL=(function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function o(i,s){if(!r[i]){r[i]={};for(var l=0;l<i.length;l++)r[i][i.charAt(l)]=l}return r[i][s]}var a={compressToBase64:function(i){if(i==null)return"";var s=a._compress(i,6,function(l){return e.charAt(l)});switch(s.length%4){default:case 0:return s;case 1:return s+"===";case 2:return s+"==";case 3:return s+"="}},decompressFromBase64:function(i){return i==null?"":i==""?null:a._decompress(i.length,32,function(s){return o(e,i.charAt(s))})},compressToUTF16:function(i){return i==null?"":a._compress(i,15,function(s){return t(s+32)})+" "},decompressFromUTF16:function(i){return i==null?"":i==""?null:a._decompress(i.length,16384,function(s){return i.charCodeAt(s)-32})},compressToUint8Array:function(i){for(var s=a.compress(i),l=new Uint8Array(s.length*2),c=0,d=s.length;c<d;c++){var u=s.charCodeAt(c);l[c*2]=u>>>8,l[c*2+1]=u%256}return l},decompressFromUint8Array:function(i){if(i==null)return a.decompress(i);for(var s=new Array(i.length/2),l=0,c=s.length;l<c;l++)s[l]=i[l*2]*256+i[l*2+1];var d=[];return s.forEach(function(u){d.push(t(u))}),a.decompress(d.join(""))},compressToEncodedURIComponent:function(i){return i==null?"":a._compress(i,6,function(s){return n.charAt(s)})},decompressFromEncodedURIComponent:function(i){return i==null?"":i==""?null:(i=i.replace(/ /g,"+"),a._decompress(i.length,32,function(s){return o(n,i.charAt(s))}))},compress:function(i){return a._compress(i,16,function(s){return t(s)})},_compress:function(i,s,l){if(i==null)return"";var c,d,u={},f={},p="",m="",h="",g=2,E=3,y=2,b=[],S=0,x=0,L;for(L=0;L<i.length;L+=1)if(p=i.charAt(L),Object.prototype.hasOwnProperty.call(u,p)||(u[p]=E++,f[p]=!0),m=h+p,Object.prototype.hasOwnProperty.call(u,m))h=m;else{if(Object.prototype.hasOwnProperty.call(f,h)){if(h.charCodeAt(0)<256){for(c=0;c<y;c++)S=S<<1,x==s-1?(x=0,b.push(l(S)),S=0):x++;for(d=h.charCodeAt(0),c=0;c<8;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1}else{for(d=1,c=0;c<y;c++)S=S<<1|d,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=0;for(d=h.charCodeAt(0),c=0;c<16;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1}g--,g==0&&(g=Math.pow(2,y),y++),delete f[h]}else for(d=u[h],c=0;c<y;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1;g--,g==0&&(g=Math.pow(2,y),y++),u[m]=E++,h=String(p)}if(h!==""){if(Object.prototype.hasOwnProperty.call(f,h)){if(h.charCodeAt(0)<256){for(c=0;c<y;c++)S=S<<1,x==s-1?(x=0,b.push(l(S)),S=0):x++;for(d=h.charCodeAt(0),c=0;c<8;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1}else{for(d=1,c=0;c<y;c++)S=S<<1|d,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=0;for(d=h.charCodeAt(0),c=0;c<16;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1}g--,g==0&&(g=Math.pow(2,y),y++),delete f[h]}else for(d=u[h],c=0;c<y;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1;g--,g==0&&(g=Math.pow(2,y),y++)}for(d=2,c=0;c<y;c++)S=S<<1|d&1,x==s-1?(x=0,b.push(l(S)),S=0):x++,d=d>>1;for(;;)if(S=S<<1,x==s-1){b.push(l(S));break}else x++;return b.join("")},decompress:function(i){return i==null?"":i==""?null:a._decompress(i.length,32768,function(s){return i.charCodeAt(s)})},_decompress:function(i,s,l){var c=[],d,u=4,f=4,p=3,m="",h=[],g,E,y,b,S,x,L,v={val:l(0),position:s,index:1};for(g=0;g<3;g+=1)c[g]=g;for(y=0,S=Math.pow(2,2),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;switch(d=y){case 0:for(y=0,S=Math.pow(2,8),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;L=t(y);break;case 1:for(y=0,S=Math.pow(2,16),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;L=t(y);break;case 2:return""}for(c[3]=L,E=L,h.push(L);;){if(v.index>i)return"";for(y=0,S=Math.pow(2,p),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;switch(L=y){case 0:for(y=0,S=Math.pow(2,8),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;c[f++]=t(y),L=f-1,u--;break;case 1:for(y=0,S=Math.pow(2,16),x=1;x!=S;)b=v.val&v.position,v.position>>=1,v.position==0&&(v.position=s,v.val=l(v.index++)),y|=(b>0?1:0)*x,x<<=1;c[f++]=t(y),L=f-1,u--;break;case 2:return h.join("")}if(u==0&&(u=Math.pow(2,p),p++),c[L])m=c[L];else if(L===f)m=E+E.charAt(0);else return null;h.push(m),c[f++]=E+m.charAt(0),u--,E=m,u==0&&(u=Math.pow(2,p),p++)}}};return a})();typeof define=="function"&&define.amd?define(function(){return mL}):typeof Ib<"u"&&Ib!=null?Ib.exports=mL:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return mL})});var Zut={};ye(Zut,{VERSION:()=>Yb,default:()=>Kut,findScriptTag:()=>p5,initialize:()=>$L,parseConfig:()=>g5,resolveTheme:()=>DL,run:()=>HL,selectTargets:()=>y5});Ki();Ke();Zi();qa();Eo();No();en();fr();Zi();function VC(t,e,n){if(t.length===0)return[];let r=t.map((i,s)=>({...i,idx:s})).sort((i,s)=>i.naturalY-s.naturalY),o=new Array(t.length),a=-1/0;for(let i of r){let s=i.height/2,l=Math.max(i.naturalY-s,a+e);n!==void 0&&(l=Math.min(l,n-i.height)),o[i.idx]=l+s,a=l+i.height}return o}var Rm={top:80,bottom:40,left:80},HY=14;function UC(t,e,n,r,o,a){let{periods:i,data:s}=e,l=e.noTitle?null:e.title;if(s.length===0||i.length<2)return;let c=Xa(t,n,a);if(!c)return;let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:h,colors:g}=c,E=Rm.left+i.length*100+150,y=a?Ee.identity():Ee.from(u,E),b=y.aesthetic(Rm.top),S=y.aesthetic(Rm.bottom),x=y.aesthetic(Rm.left),L=y.text(HY),v=y.text(18),A=y.text(16),C=y.structural(15),M=`${y.structural(4)},${y.structural(4)}`,w=y.structural(2.5),k=y.structural(14),N=y.structural(4),_=y.structural(1.5),T=y.structural(10),R=y.structural(10);d.attr("preserveAspectRatio","xMidYMin meet"),y.isBelowFloor&&d.attr("width","100%");let G=s.reduce((Q,ot)=>{let Z=`${ot.values[ot.values.length-1]} \u2014 ${ot.label}`;return Z.length>Q.length?Z:Q},""),I=_t(G,L),H=Math.floor(u*.35),O=Math.min(Math.max(I+y.aesthetic(30),y.aesthetic(120)),H),D=u-x-O,W=f-b-S,z=s.flatMap(Q=>Q.values),[P,B]=wc(z),Y=(B-P)*.1||1,V=or().domain([P-Y,B+Y]).range([W,0]),j=Ts().domain(i).range([0,D]).padding(0),K=d.append("g").attr("transform",`translate(${x},${b})`),$=nm(t,n,r);co(d,l,e.titleLineNumber,u,p,o);for(let Q of i){let ot=j(Q);K.append("text").attr("x",ot).attr("y",-C).attr("text-anchor","middle").attr("fill",p).attr("font-size",`${v}px`).attr("font-weight","600").text(Q),K.append("line").attr("x1",ot).attr("y1",0).attr("x2",ot).attr("y2",W).attr("stroke",m).attr("stroke-width",1).attr("stroke-dasharray",M)}let U=Kn().x((Q,ot)=>j(i[ot])).y(Q=>V(Q)),X=s.map((Q,ot)=>{let Z=Q.color??g[ot%g.length],lt=Q.values[0],nt=Q.values[Q.values.length-1],J=nt-lt,at=lt!==0?J/lt*100:null,it=J>0?"+":"",vt=[`${it}${parseFloat(J.toFixed(2))}`];at!==null&&vt.push(`${it}${at.toFixed(1)}%`);let Tt=vt.join("<br>"),At=j(i[i.length-1]),rt=`${nt} \u2014 ${Q.label}`,pt=O-y.aesthetic(15),ht=1,dt=null;if(_t(rt,L)>pt){let kt=Tn(rt,L,pt);ht=kt.length,dt=kt}let ut=L*1.2,yt=ht===1?L:ht*ut;return{item:Q,idx:ot,color:Z,firstVal:lt,lastVal:nt,tipHtml:Tt,lastX:At,labelText:rt,wrappedLines:dt,labelHeight:yt}}),q=A*1.25,et=new Map;for(let Q=0;Q<i.length-1;Q++){let ot=s.map(Z=>({naturalY:V(Z.values[Q]),height:q}));et.set(Q,VC(ot,4,W))}let tt=X.map(Q=>({naturalY:V(Q.lastVal),height:Math.max(Q.labelHeight,L*1.4)})),F=VC(tt,4,W);s.forEach((Q,ot)=>{let Z=X[ot],lt=Z.color,nt=K.append("g").attr("class","slope-series").attr("data-line-number",String(Q.lineNumber));nt.append("path").datum(Q.values).attr("fill","none").attr("stroke",lt).attr("stroke-width",w).attr("d",U),nt.append("path").datum(Q.values).attr("fill","none").attr("stroke","transparent").attr("stroke-width",k).attr("d",U).style("cursor",o?"pointer":"default").on("mouseenter",it=>jo($,Z.tipHtml,it)).on("mousemove",it=>jo($,Z.tipHtml,it)).on("mouseleave",()=>Ms($)).on("click",()=>{o&&Q.lineNumber&&o(Q.lineNumber)}),Q.values.forEach((it,vt)=>{let Tt=j(i[vt]),At=V(it);nt.append("circle").attr("cx",Tt).attr("cy",At).attr("r",N).attr("fill",lt).attr("stroke",h).attr("stroke-width",_).style("cursor",o?"pointer":"default").on("mouseenter",ht=>jo($,Z.tipHtml,ht)).on("mousemove",ht=>jo($,Z.tipHtml,ht)).on("mouseleave",()=>Ms($)).on("click",()=>{o&&Q.lineNumber&&o(Q.lineNumber)});let rt=vt===0;if(!(vt===i.length-1)){let ht=et.get(vt)[ot];nt.append("text").attr("x",rt?Tt-T:Tt).attr("y",ht).attr("dy","0.35em").attr("text-anchor",rt?"end":"middle").attr("fill",lt).attr("font-size",`${A}px`).text(it.toString())}});let J=F[ot],at=nt.append("text").attr("x",Z.lastX+R).attr("y",J).attr("text-anchor","start").attr("fill",lt).attr("font-size",`${L}px`).attr("font-weight","500");if(!Z.wrappedLines)at.attr("dy","0.35em").text(Z.labelText);else{let it=L*1.2,Tt=-((Z.wrappedLines.length-1)*it)/2;Z.wrappedLines.forEach((At,rt)=>{at.append("tspan").attr("x",Z.lastX+R).attr("dy",rt===0?`${Tt+L*.35}px`:`${it}px`).text(At)})}})}d0();qa();Xn();No();fr();Zi();function WY(t,e,n){let r=new Set;for(let a of t)r.add(a.source),r.add(a.target);let o=Array.from(r);if(e==="name")return o.slice().sort((a,i)=>a.localeCompare(i));if(e==="degree"){let a=new Map;for(let i of o)a.set(i,0);for(let i of t)a.set(i.source,a.get(i.source)+i.value),a.set(i.target,a.get(i.target)+i.value);return o.slice().sort((i,s)=>{let l=a.get(s)-a.get(i);return l!==0?l:i.localeCompare(s)})}if(e==="group"){if(n.length>0){let d=[],u=new Set;for(let f of n)for(let p of f.nodes)u.has(p)||(d.push(p),u.add(p));for(let f of o)u.has(f)||(d.push(f),u.add(f));return d}let a=new Map;for(let d of o)a.set(d,new Set);for(let d of t)a.get(d.source).add(d.target),a.get(d.target).add(d.source);let i=new Map;for(let d of o)i.set(d,0);for(let d of t)i.set(d.source,i.get(d.source)+d.value),i.set(d.target,i.get(d.target)+d.value);let s=new Set,l=[],c=new Set(o);for(;c.size>0;){let d="",u=-1;for(let m of c)i.get(m)>u&&(u=i.get(m),d=m);let f=[],p=[d];for(s.add(d),c.delete(d);p.length>0;){let m=p.shift();f.push(m);for(let h of a.get(m))s.has(h)||(s.add(h),c.delete(h),p.push(h))}l.push(f)}return l.sort((d,u)=>u.length-d.length),l.flat()}return o}var BY=60,u0=40,FY=60,XC=40,jC=120,YY=5,zY=1.5,VY=11,UY=12,qC=60,XY=40,jY=4,qY=6,KY=14,ZY=4,QY=14,JY=20,tz=1.5,ez=6,nz=1;function KC(t,e,n,r,o,a){let{links:i,orientation:s,arcOrder:l,arcNodeGroups:c}=e,d=e.noTitle?null:e.title;if(i.length===0)return;let u=Xa(t,n,a);if(!u)return;let{svg:f,width:p,height:m,textColor:h,mutedColor:g,bgColor:E,colors:y}=u,b=s==="vertical",S=WY(i,l,c),x=b?jC+u0+qC*2+100:S.length*20+XC+u0,L=a?Ee.identity():Ee.from(p,x),v=L.aesthetic(BY),A=L.aesthetic(u0),C=L.aesthetic(FY),M=b?L.aesthetic(jC):L.aesthetic(XC),w=L.structural(YY),k=L.structural(zY),N=L.text(VY),_=L.text(UY),T=L.aesthetic(qC),R=L.aesthetic(XY),G=L.structural(jY),I=L.structural(qY),H=L.structural(KY),O=L.structural(ZY),D=L.structural(QY),W=L.structural(JY),z=L.structural(tz),P=L.structural(ez),B=`${L.structural(4)},${L.structural(4)}`,Y=L.structural(nz);f.attr("preserveAspectRatio","xMidYMin meet"),L.isBelowFloor&&f.attr("width","100%");let V={top:v,right:A,bottom:C,left:M},j=p-V.left-V.right,K=m-V.top-V.bottom,$=new Map;for(let J of c)if(J.color)for(let at of J.nodes)$.has(at)||$.set(at,J.color);let U=new Map;for(let J of c)U.set(J.name,new Set(J.nodes));let X=i.map(J=>J.value),[q,et]=wc(X),tt=or().domain([q,et]).range([z,P]),F=f.append("g").attr("transform",`translate(${V.left},${V.top})`);co(f,d,e.titleLineNumber,p,h,o);let Q=new Map;for(let J of S)Q.set(J,new Set);for(let J of i)Q.get(J.source).add(J.target),Q.get(J.target).add(J.source);let ot=.1;function Z(J){let at=Q.get(J);F.selectAll(".arc-link").each(function(){let it=Rt(this),vt=it.attr("data-source"),Tt=it.attr("data-target"),At=vt===J||Tt===J;it.attr("stroke-opacity",At?.85:ot)}),F.selectAll(".arc-node").each(function(){let it=Rt(this),vt=it.attr("data-node"),Tt=vt===J||at.has(vt);it.attr("opacity",Tt?1:ot)})}function lt(){F.selectAll(".arc-link").attr("stroke-opacity",.7),F.selectAll(".arc-node").attr("opacity",1),F.selectAll(".arc-group-band").attr("fill-opacity",.06),F.selectAll(".arc-group-label").attr("fill-opacity",.5)}function nt(J){let at=U.get(J);at&&(F.selectAll(".arc-link").each(function(){let it=Rt(this),vt=at.has(it.attr("data-source"))||at.has(it.attr("data-target"));it.attr("stroke-opacity",vt?.85:ot)}),F.selectAll(".arc-node").each(function(){let it=Rt(this);it.attr("opacity",at.has(it.attr("data-node"))?1:ot)}),F.selectAll(".arc-group-band").each(function(){let it=Rt(this);it.attr("fill-opacity",it.attr("data-group")===J?.18:.03)}),F.selectAll(".arc-group-label").each(function(){let it=Rt(this);it.attr("fill-opacity",it.attr("data-group")===J?1:.2)}))}if(b){let J=Ts().domain(S).range([0,K]).padding(.5),at=j/2;if(c.length>0){let it=(J.step?.()??20)*.4;for(let vt of c){let Tt=vt.nodes.filter(ht=>S.includes(ht));if(Tt.length===0)continue;let At=Tt.map(ht=>J(ht)),rt=Math.min(...At)-it,pt=Math.max(...At)+it;F.append("rect").attr("class","arc-group-band").attr("data-group",vt.name).attr("data-line-number",String(vt.lineNumber)).attr("x",at-T).attr("y",rt).attr("width",T*2).attr("height",pt-rt).attr("rx",G).attr("fill",h).attr("fill-opacity",.06).style("cursor","pointer").on("mouseenter",()=>nt(vt.name)).on("mouseleave",lt).on("click",()=>{o&&o(vt.lineNumber)}),F.append("text").attr("class","arc-group-label").attr("data-group",vt.name).attr("data-line-number",String(vt.lineNumber)).attr("x",at-T+I).attr("y",rt+H).attr("fill",h).attr("font-size",`${_}px`).attr("font-weight","600").attr("fill-opacity",.5).style("cursor",o?"pointer":"default").text(vt.name).on("mouseenter",()=>nt(vt.name)).on("mouseleave",lt).on("click",()=>{o&&o(vt.lineNumber)})}}F.append("line").attr("x1",at).attr("y1",0).attr("x2",at).attr("y2",K).attr("stroke",g).attr("stroke-width",Y).attr("stroke-dasharray",B),i.forEach((it,vt)=>{let Tt=J(it.source),At=J(it.target),rt=(Tt+At)/2,pt=Math.abs(At-Tt),ht=at+pt*.4,dt=it.color??y[vt%y.length];F.append("path").attr("class","arc-link").attr("data-source",it.source).attr("data-target",it.target).attr("data-line-number",String(it.lineNumber)).attr("d",`M ${at},${Tt} Q ${ht},${rt} ${at},${At}`).attr("fill","none").attr("stroke",dt).attr("stroke-width",tt(it.value)).attr("stroke-opacity",.7).style("cursor",o?"pointer":"default").on("click",()=>{o&&it.lineNumber&&o(it.lineNumber)})});for(let it of S){let vt=J(it),Tt=$.get(it)??h,At=i.find(pt=>pt.source===it||pt.target===it),rt=F.append("g").attr("class","arc-node").attr("data-node",it).attr("data-line-number",At?.lineNumber?String(At.lineNumber):null).style("cursor","pointer").on("mouseenter",()=>Z(it)).on("mouseleave",lt).on("click",()=>{o&&At?.lineNumber&&o(At.lineNumber)});rt.append("circle").attr("cx",at).attr("cy",vt).attr("r",w).attr("fill",Tt).attr("stroke",E).attr("stroke-width",k),rt.append("text").attr("x",at-D).attr("y",vt).attr("dy","0.35em").attr("text-anchor","end").attr("fill",h).attr("font-size",`${N}px`).text(it)}}else{let J=Ts().domain(S).range([0,j]).padding(.5),at=K/2;if(a){let it=0;for(let rt of i){let pt=J(rt.source),ht=J(rt.target);pt!=null&&ht!=null&&(it=Math.max(it,Math.abs(ht-pt)))}let vt=it*.2+w,Tt=Math.max(R,W+N);at=vt;let At=V.top+vt+Tt+V.bottom;f.attr("height",At).attr("viewBox",`0 0 ${p} ${At}`)}if(c.length>0){let it=(J.step?.()??20)*.4;for(let vt of c){let Tt=vt.nodes.filter(ht=>S.includes(ht));if(Tt.length===0)continue;let At=Tt.map(ht=>J(ht)),rt=Math.min(...At)-it,pt=Math.max(...At)+it;F.append("rect").attr("class","arc-group-band").attr("data-group",vt.name).attr("data-line-number",String(vt.lineNumber)).attr("x",rt).attr("y",at-R).attr("width",pt-rt).attr("height",R*2).attr("rx",G).attr("fill",h).attr("fill-opacity",.06).style("cursor","pointer").on("mouseenter",()=>nt(vt.name)).on("mouseleave",lt).on("click",()=>{o&&o(vt.lineNumber)}),F.append("text").attr("class","arc-group-label").attr("data-group",vt.name).attr("data-line-number",String(vt.lineNumber)).attr("x",(rt+pt)/2).attr("y",at+R-O).attr("text-anchor","middle").attr("fill",h).attr("font-size",`${_}px`).attr("font-weight","600").attr("fill-opacity",.5).style("cursor",o?"pointer":"default").text(vt.name).on("mouseenter",()=>nt(vt.name)).on("mouseleave",lt).on("click",()=>{o&&o(vt.lineNumber)})}}F.append("line").attr("x1",0).attr("y1",at).attr("x2",j).attr("y2",at).attr("stroke",g).attr("stroke-width",Y).attr("stroke-dasharray",B),i.forEach((it,vt)=>{let Tt=J(it.source),At=J(it.target),rt=(Tt+At)/2,pt=Math.abs(At-Tt),ht=at-pt*.4,dt=it.color??y[vt%y.length];F.append("path").attr("class","arc-link").attr("data-source",it.source).attr("data-target",it.target).attr("data-line-number",String(it.lineNumber)).attr("d",`M ${Tt},${at} Q ${rt},${ht} ${At},${at}`).attr("fill","none").attr("stroke",dt).attr("stroke-width",tt(it.value)).attr("stroke-opacity",.7).style("cursor",o?"pointer":"default").on("click",()=>{o&&it.lineNumber&&o(it.lineNumber)})});for(let it of S){let vt=J(it),Tt=$.get(it)??h,At=i.find(pt=>pt.source===it||pt.target===it),rt=F.append("g").attr("class","arc-node").attr("data-node",it).attr("data-line-number",At?.lineNumber?String(At.lineNumber):null).style("cursor","pointer").on("mouseenter",()=>Z(it)).on("mouseleave",lt).on("click",()=>{o&&At?.lineNumber&&o(At.lineNumber)});rt.append("circle").attr("cx",vt).attr("cy",at).attr("r",w).attr("fill",Tt).attr("stroke",E).attr("stroke-width",k),rt.append("text").attr("x",vt).attr("y",at+W).attr("text-anchor","middle").attr("fill",h).attr("font-size",`${N}px`).text(it)}}}f0();w0();E0();Xn();var x_=yu(b_(),1);on();en();Zi();yi();function Yz(t){return t==="mixed"?()=>Math.random()>.5?0:90:t==="angled"?()=>Math.round(Math.random()*30-15):()=>0}function zz(){try{if(typeof document>"u")return!1;let t=document.createElement("canvas");return typeof t.getContext=="function"&&!!t.getContext("2d")}catch{return!1}}function Vz(t,e){return _t(t,e)}function Uz(t,e,n,r,o){let a=[...t].sort((c,d)=>d.size-c.size),i=[],s=Math.sqrt(e*e+n*n)/2,l=e>0?n/e:1;for(let c of a){let d=o(),u=Vz(c.text,c.size)+r*2,f=c.size+r*2,p=d*Math.PI/180,m=Math.abs(Math.cos(p)),h=Math.abs(Math.sin(p)),g=(u*m+f*h)/2,E=(u*h+f*m)/2,y=null;for(let b=0;b<4e3;b++){let S=b*.25,x=S*1.4;if(x>s)break;let L=Math.cos(S)*x,v=Math.sin(S)*x*l;if(L-g<-e/2||L+g>e/2||v-E<-n/2||v+E>n/2)continue;let A=!1;for(let C of i)if(Math.abs(L-C.x)<g+C.halfW&&Math.abs(v-C.y)<E+C.halfH){A=!0;break}if(!A){y={x:L,y:v};break}}y&&i.push({...c,rotate:d,x:y.x,y:y.y,halfW:g,halfH:E})}return i}function w_(t,e,n,r,o){return new Promise(a=>{Rt(t).selectAll(":not([data-d3-tooltip])").remove();let{words:i,cloudOptions:s}=e,l=e.noTitle?null:e.title;if(i.length===0){a();return}let c=o?.width??t.clientWidth,d=o?.height??t.clientHeight;if(c<=0||d<=0){a();return}let u=l?40:0,f=d-u,p=n.text,m=n.bg,h=ir(n),{minSize:g,maxSize:E}=s,y=i.map(k=>k.weight),b=Math.min(...y),x=Math.max(...y)-b||1,L=k=>{let N=(k-b)/x;return g+Math.sqrt(N)*(E-g)},v=Yz(s.rotate),A=Rt(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMid meet").style("background",m);co(A,l,e.titleLineNumber,c,p);let C=A.append("g").attr("transform",`translate(${c/2},${u+f/2})`),M=i.map(k=>({...k,size:L(k.weight)})),w=k=>{C.selectAll("text").data(k).join("text").style("font-size",N=>`${N.size}px`).style("font-family",It).style("font-weight","600").style("fill",(N,_)=>h[_%h.length]).attr("text-anchor","middle").attr("transform",N=>`translate(${N.x},${N.y}) rotate(${N.rotate})`).text(N=>N.text),a()};if(!zz()){w(Uz(M,c,f,2,v));return}(0,x_.default)().size([c,f]).words(M).padding(2).rotate(v).fontSize(k=>k.size).font(It).on("end",w).start()})}v0();en();fr();Zi();tn();function Xz(t,e,n,r,o,a,i){if(t.length===0)return[];let s=1/0,l=-1/0,c=1/0,d=-1/0;for(let S of t)s=Math.min(s,S.x-S.r),l=Math.max(l,S.x+S.r),c=Math.min(c,S.y-S.r),d=Math.max(d,S.y+S.r);let u=l-s,f=d-c,p=e-r-o,m=n-a-i,h=Math.min(p/u,m/f),g=(s+l)/2,E=(c+d)/2,y=r+p/2,b=a+m/2;return t.map(S=>({x:(S.x-g)*h+y,y:(S.y-E)*h+b,r:S.r*h}))}function Vu(t,e){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=e.r*e.r+1e-6}function k0(t,e){let r=1/0,o=-1/0,a=1/0,i=-1/0;for(let f of t)r=Math.min(r,f.x-f.r),o=Math.max(o,f.x+f.r),a=Math.min(a,f.y-f.r),i=Math.max(i,f.y+f.r);let s=(o-r)/50,l=(i-a)/50,c=0,d=0,u=0;for(let f=0;f<=50;f++){let p=r+f*s;for(let m=0;m<=50;m++){let h=a+m*l,g=!0;for(let E=0;E<t.length;E++)if(Vu({x:p,y:h},t[E])!==e[E]){g=!1;break}g&&(c+=p,d+=h,u++)}}if(u===0){let f=0,p=0,m=0;for(let h=0;h<t.length;h++)e[h]&&(f+=t[h].x,p+=t[h].y,m++);return{x:f/(m||1),y:p/(m||1)}}return{x:c/u,y:d/u}}function E_(t,e,n,r,o,a){let{vennSets:i,vennOverlaps:s}=e,l=e.solidFill===!0,c=e.noTitle?null:e.title;if(i.length<2||i.length>3)return;let d=Xa(t,n,a);if(!d)return;let{svg:u,width:f,height:p,textColor:m,colors:h}=d,g=i.length,E=g===2?500:600,y=a?Ee.identity():Ee.from(f,E),b=c?y.aesthetic(40):0;u.attr("preserveAspectRatio","xMidYMid meet"),y.isBelowFloor&&u.attr("width","100%");let S=100,x=S*1.4,L;if(g===2)L=[{x:-x/2,y:0,r:S},{x:x/2,y:0,r:S}];else{let bt=x,Nt=Math.sqrt(3)/2*bt;L=[{x:-bt/2,y:Nt/3,r:S},{x:bt/2,y:Nt/3,r:S},{x:0,y:-(2*Nt)/3,r:S}]}let v=i.map((bt,Nt)=>bt.color??h[Nt%h.length]),A=L.reduce((bt,Nt)=>bt+Nt.x,0)/g,C=L.reduce((bt,Nt)=>bt+Nt.y,0)/g,M=y.aesthetic(30),w=y.aesthetic(30),k=y.aesthetic(30),N=y.aesthetic(30),_=y.structural(20),T=y.aesthetic(8),R=y.aesthetic(4),G=y.text(14);for(let bt=0;bt<g;bt++){let Nt=_t(i[bt].name,G)+_+T+R,Vt=L[bt].x-A,xt=L[bt].y-C;if(Math.abs(Vt)>=Math.abs(xt))Vt>=0?w=Math.max(w,Nt):M=Math.max(M,Nt);else{let Lt=Nt*.5;xt>=0?N=Math.max(N,Lt+y.aesthetic(20)):k=Math.max(k,Lt+y.aesthetic(20))}}let I=y.text(13),H=y.structural(16),O=y.structural(18),D=y.aesthetic(6),W=y.aesthetic(12),z=Math.max(y.structural(80),Math.min(y.structural(170),f*.18));function P(bt){let Nt=L.map((Vt,xt)=>xt).filter(Vt=>!bt.includes(Vt));if(Nt.length>0){let Vt=0,xt=0;for(let Wt of Nt)Vt+=L[Wt].x,xt+=L[Wt].y;Vt/=Nt.length,xt/=Nt.length;let Lt=0,Dt=0;for(let Wt of bt)Lt+=L[Wt].x,Dt+=L[Wt].y;Lt/=bt.length,Dt/=bt.length;let zt=Lt-Vt,$t=Dt-xt,ft=Math.sqrt(zt*zt+$t*$t);if(ft>=1e-6)return{x:zt/ft,y:$t/ft}}return g===3?{x:0,y:-1}:{x:0,y:1}}let B=new Map;for(let bt of s){if(!bt.label)continue;let Nt=bt.sets.map($t=>i.findIndex(ft=>ft.name===$t));if(Nt.some($t=>$t<0))continue;let Vt=Tn(bt.label,I,z);B.set(bt,Vt);let xt=P(Nt),Lt=Vt.reduce(($t,ft)=>Math.max($t,_t(ft,I)),0),Dt=Vt.length*H,zt=O+D+W;if(Math.abs(xt.x)>=Math.abs(xt.y)){let $t=Lt+zt;xt.x>=0?w=Math.max(w,$t):M=Math.max(M,$t);let ft=Dt/2;xt.y>=0?N=Math.max(N,ft+8):k=Math.max(k,ft+8)}else{let ft=Nt.length===3&&g===3&&xt.y<0?32:0,Wt=Dt+zt+ft;xt.y>=0?N=Math.max(N,Wt):k=Math.max(k,Wt)}}let Y=p-b,V=f*.32,j=Y*.4;M=Math.min(M,V),w=Math.min(w,V),k=Math.min(k,j),N=Math.min(N,j);let K=Xz(L,f,Y,M,w,k,N).map(bt=>({...bt,y:bt.y+b})),$=K[0].r;u.append("style").text("circle:focus, circle:focus-visible { outline-solid: none !important; }"),co(u,c,e.titleLineNumber,f,m,o);let U=[],X=u.append("g");K.forEach((bt,Nt)=>{let Vt=X.append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r).attr("fill",v[Nt]).attr("fill-opacity",l?.6:.35).attr("stroke",v[Nt]).attr("stroke-width",y.structural(2)).style("pointer-events","none");U.push(Vt)});let q=u.append("defs");K.forEach((bt,Nt)=>{q.append("clipPath").attr("id",`vcp-${Nt}`).append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r)});let et=K.map((bt,Nt)=>[Nt]);g===2?et.push([0,1]):et.push([0,1],[0,2],[1,2],[0,1,2]);let tt=u.append("g").style("pointer-events","none"),F=new Map;for(let bt of et){let Nt=bt.join("-"),Vt=Array.from({length:g},(zt,$t)=>$t).filter(zt=>!bt.includes(zt)),xt=`vcp-${bt[0]}`;for(let zt=1;zt<bt.length;zt++){let $t=`vcp-n-${bt.slice(0,zt+1).join("-")}`,ft=bt[zt];q.append("clipPath").attr("id",$t).append("circle").attr("cx",K[ft].x).attr("cy",K[ft].y).attr("r",K[ft].r).attr("clip-path",`url(#${xt})`),xt=$t}let Lt=null;if(bt.length===1)Lt=i[bt[0]].lineNumber;else{let zt=bt.map(ft=>i[ft].name).sort();Lt=s.find(ft=>ft.sets.length===zt.length&&ft.sets.every((Wt,he)=>Wt===zt[he]))?.lineNumber??null}let Dt=tt.append("rect").attr("x",0).attr("y",0).attr("width",f).attr("height",p).attr("fill","white").attr("fill-opacity",0).attr("class","venn-region-overlay").attr("data-line-number",Lt!=null?String(Lt):"0").attr("clip-path",`url(#${xt})`);if(Vt.length>0){let zt=`vvm-${Nt}`,$t=q.append("mask").attr("id",zt);$t.append("rect").attr("x",0).attr("y",0).attr("width",f).attr("height",p).attr("fill","white");for(let ft of Vt)$t.append("circle").attr("cx",K[ft].x).attr("cy",K[ft].y).attr("r",K[ft].r).attr("fill","black");Dt.attr("mask",`url(#${zt})`)}F.set(Nt,Dt)}let Q=new Map;function ot(bt,Nt){Q.has(bt)||Q.set(bt,[]),Q.get(bt).push(Nt)}function Z(bt){Q.forEach((Nt,Vt)=>{let xt=bt===null||Vt===bt?1:.2;Nt.forEach(Lt=>Lt.attr("opacity",xt))})}let lt=bt=>{let Nt=[...bt].sort((Vt,xt)=>Vt-xt).join("-");F.forEach((Vt,xt)=>Vt.attr("fill-opacity",xt===Nt?0:.55)),Z(Nt)},nt=()=>{F.forEach(bt=>bt.attr("fill-opacity",0)),Z(null)},J=K.reduce((bt,Nt)=>bt+Nt.x,0)/g,at=K.reduce((bt,Nt)=>bt+Nt.y,0)/g;function it(bt,Nt,Vt){let xt=K[Vt],Lt=Nt-xt.y,Dt=Math.sqrt(Math.max(0,xt.r*xt.r-Lt*Lt)),zt=xt.x-Dt,$t=xt.x+Dt;for(let ft=0;ft<g;ft++){if(ft===Vt)continue;let Wt=K[ft],he=Nt-Wt.y;if(Math.abs(he)>=Wt.r)continue;let ne=Math.sqrt(Wt.r*Wt.r-he*he),se=Wt.x-ne,Zt=Wt.x+ne;if(se<=zt&&Zt>=$t)return 0;se<=zt&&Zt>zt&&(zt=Zt),Zt>=$t&&se<$t&&($t=se)}return Math.max(0,$t-zt)}let vt=y.text(10),Tt=y.text(22),At=y.aesthetic(12),rt=u.append("g"),pt=K.map(()=>null);K.forEach((bt,Nt)=>{let Vt=i[Nt].name,xt=K.map((se,Zt)=>Zt===Nt),Lt=k0(K,xt),Dt=it(Lt.x,Lt.y,Nt),zt=_t(Vt,1),$t=Math.min(Tt,Math.max(vt,(Dt-At*2)/zt)),ft=_t(Vt,$t),Wt=ft+At*2<Dt&&Vu({x:Lt.x,y:Lt.y-$t/2},bt)&&Vu({x:Lt.x,y:Lt.y+$t/2},bt),he=String(Nt),ne=rt.append("g").style("cursor","default").on("mouseenter",()=>lt([Nt])).on("mouseleave",()=>nt());if(ot(he,ne),Wt)ne.append("text").attr("x",Lt.x).attr("y",Lt.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",m).attr("font-size",`${Math.round($t)}px`).attr("font-weight","bold").text(Vt),pt[Nt]={x:Lt.x-ft/2,y:Lt.y-$t/2,w:ft,h:$t};else{let se=bt.x-J,Zt=bt.y-at,Ie=Math.sqrt(se*se+Zt*Zt);Ie<1e-6?(se=1,Zt=0):(se/=Ie,Zt/=Ie);let Ht=bt.x+se*bt.r,Qt=bt.y+Zt*bt.r,Ut=Ht+se*T,fe=Qt+Zt*T,de=Ut+se*_,te=fe+Zt*_;ne.append("line").attr("x1",Ut).attr("y1",fe).attr("x2",de).attr("y2",te).attr("stroke",m).attr("stroke-width",y.structural(1));let ae=de>=J,Te=ae?"start":"end",Je=de+(ae?R:-R),sn=te,ze=_t(Vt,G);ae?Je=Math.min(Je,f-ze-4):Je=Math.max(Je,ze+4);let Ce=Math.max(G,Math.min(p-4,sn));ne.append("text").attr("x",Je).attr("y",Ce).attr("text-anchor",Te).attr("dominant-baseline","central").attr("fill",m).attr("font-size",`${G}px`).attr("font-weight","bold").text(Vt);let ee=_t(Vt,G);pt[Nt]={x:ae?Je:Je-ee,y:Ce-G/2,w:ee,h:G}}});function ht(bt,Nt,Vt,xt,Lt,Dt=4){let zt=Vt-bt,$t=xt-Nt,ft=[];for(let se of Lt){let Zt=se.x-Dt,Ie=se.y-Dt,Ht=se.w+2*Dt,Qt=se.h+2*Dt,Ut=0,fe=1;if(Math.abs(zt)<1e-9){if(bt<Zt||bt>Zt+Ht)continue}else{let de=(Zt-bt)/zt,te=(Zt+Ht-bt)/zt;Ut=Math.max(Ut,Math.min(de,te)),fe=Math.min(fe,Math.max(de,te))}if(Math.abs($t)<1e-9){if(Nt<Ie||Nt>Ie+Qt)continue}else{let de=(Ie-Nt)/$t,te=(Ie+Qt-Nt)/$t;Ut=Math.max(Ut,Math.min(de,te)),fe=Math.min(fe,Math.max(de,te))}Ut<fe&&ft.push([Math.max(0,Ut),Math.min(1,fe)])}ft.sort((se,Zt)=>se[0]-Zt[0]);let Wt=[];for(let se of ft){let Zt=Wt[Wt.length-1];!Zt||se[0]>Zt[1]?Wt.push([se[0],se[1]]):Zt[1]=Math.max(Zt[1],se[1])}let he=[],ne=0;for(let[se,Zt]of Wt)se>ne&&he.push({x1:bt+zt*ne,y1:Nt+$t*ne,x2:bt+zt*se,y2:Nt+$t*se}),ne=Math.max(ne,Zt);return ne<1&&he.push({x1:bt+zt*ne,y1:Nt+$t*ne,x2:Vt,y2:xt}),he}function dt(bt,Nt){let Vt=K.map((xt,Lt)=>Lt).filter(xt=>!Nt.includes(xt));if(Vt.length>0){let xt=0,Lt=0;for(let ft of Vt)xt+=K[ft].x,Lt+=K[ft].y;xt/=Vt.length,Lt/=Vt.length;let Dt=bt.x-xt,zt=bt.y-Lt,$t=Math.sqrt(Dt*Dt+zt*zt);if($t>=1e-6){let ft=Math.abs(Dt/$t)<1e-9?0:Dt/$t,Wt=Math.abs(zt/$t)<1e-9?0:zt/$t;return{x:ft,y:Wt}}}return g===3?{x:0,y:-1}:{x:0,y:1}}function ut(bt,Nt,Vt){let xt=1/0;for(let Lt of Vt){let Dt=K[Lt],zt=bt.x-Dt.x,$t=bt.y-Dt.y,ft=zt*Nt.x+$t*Nt.y,Wt=zt*zt+$t*$t-Dt.r*Dt.r,he=ft*ft-Wt;if(he<0)continue;let ne=-ft+Math.sqrt(he);ne>0&&ne<xt&&(xt=ne)}return isFinite(xt)?{x:bt.x+Nt.x*xt,y:bt.y+Nt.y*xt}:{x:bt.x,y:bt.y}}function yt(bt,Nt,Vt){let xt=1/0,Lt=-1/0,Dt=1/0,zt=-1/0;for(let se of K)xt=Math.min(xt,se.x-se.r),Lt=Math.max(Lt,se.x+se.r),Dt=Math.min(Dt,se.y-se.r),zt=Math.max(zt,se.y+se.r);let $t=3,ft=400,Wt=Nt.x===0||Nt.y===0,he={x:bt.x,y:bt.y},ne=!1;for(let se=0;se<ft;se++){let Zt={x:he.x+Nt.x*$t,y:he.y+Nt.y*$t};if(he=Zt,!(!ne&&(ne=!Vt.every(Ht=>Vu(Zt,K[Ht])),!ne)||K.some(Ht=>Vu(Zt,Ht)))){if(Wt){let Ht=Nt.x>0?Zt.x>=Lt:Zt.x<=xt,Qt=Nt.y>0?Zt.y>=zt:Zt.y<=Dt;if(Nt.x!==0&&!Ht||Nt.y!==0&&!Qt)continue}break}}return he}for(let bt of s){if(!bt.label)continue;let Nt=bt.sets.map(He=>i.findIndex(Nn=>Nn.name===He));if(Nt.some(He=>He<0))continue;let Vt=B.get(bt)??[bt.label],xt=K.map((He,Nn)=>Nt.includes(Nn)),Lt=k0(K,xt),Dt=dt(Lt,Nt),zt=Nt.length===3&&g===3,$t=zt&&Dt.y<0?32:0,ft=O+$t,Wt=ut(Lt,Dt,Nt),he=yt(Lt,Dt,Nt),ne=he.x+Dt.x*ft,se=he.y+Dt.y*ft,Zt=Math.abs(Dt.x)>=Math.abs(Dt.y),Ie,Ht="central";Zt?Ie=Dt.x>=0?"start":"end":(Ie="middle",Ht=Dt.y>=0?"hanging":"auto");let Qt,Ut;if(Zt){let He=Dt.x>=0?1:-1;Qt=ne+He*D,Ut=se}else{let He=Dt.y>=0?1:-1;Qt=ne,Ut=se+He*D}let fe=Vt.reduce((He,Nn)=>Math.max(He,_t(Nn,I)),0),de=Vt.length*H;Ie==="start"?Qt=Math.min(Qt,f-fe-4):Ie==="end"?Qt=Math.max(Qt,fe+4):Qt=Math.max(fe/2+4,Math.min(f-fe/2-4,Qt));let te,ae;Ht==="hanging"?(te=Ut,ae=Ut+de):Ht==="auto"?(ae=Ut,te=Ut-de):(te=Ut-de/2,ae=Ut+de/2),te<b+6?Ut+=b+6-te:ae>p-4&&(Ut-=ae-(p-4));let Te=Ht==="hanging"?Ut:Ht==="auto"?Ut-(Vt.length-1)*H:Ut-(Vt.length-1)*H/2,Je=zt?Lt.x:Wt.x,sn=zt?Lt.y:Wt.y,ze=v[Nt[0]];for(let He=1;He<Nt.length;He++){let Nn=He/(He+1)*100;ze=Gt(ze,v[Nt[He]],Nn)}let Ce=Gt(ze,m,90),ee=[...Nt].sort((He,Nn)=>He-Nn).join("-"),oe=rt.append("g").style("cursor","default").on("mouseenter",()=>lt(Nt)).on("mouseleave",()=>nt());ot(ee,oe);let Be=pt.filter(He=>He!==null),dn=ht(Je,sn,ne,se,Be,4);for(let He of dn)oe.append("line").attr("x1",He.x1).attr("y1",He.y1).attr("x2",He.x2).attr("y2",He.y2).attr("stroke",Ce).attr("stroke-width",y.structural(1.25)).attr("opacity",.85);let _n=oe.append("text").attr("text-anchor",Ie).attr("dominant-baseline",Ht).attr("fill",Ce).attr("font-size",`${I}px`).attr("font-weight","600");Vt.forEach((He,Nn)=>{let jn=_n.append("tspan").attr("x",Qt);Nn===0?jn.attr("y",Te):jn.attr("dy",H),jn.text(He)})}let kt=u.append("g");K.forEach((bt,Nt)=>{kt.append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r).attr("fill","transparent").attr("stroke","none").attr("class","venn-hit-target").attr("data-line-number",String(i[Nt].lineNumber)).style("cursor",o?"pointer":"default").style("outline-solid","none").on("mouseenter",()=>{lt([Nt])}).on("mouseleave",()=>{nt()}).on("click",function(){this.blur?.(),o&&i[Nt].lineNumber&&o(i[Nt].lineNumber)})});let Ot=$*.35,Xt=[];if(g===2)Xt.push({idxs:[0,1],sets:[i[0].name,i[1].name].sort()});else{for(let bt=0;bt<g;bt++)for(let Nt=bt+1;Nt<g;Nt++)Xt.push({idxs:[bt,Nt],sets:[i[bt].name,i[Nt].name].sort()});Xt.push({idxs:[0,1,2],sets:[i[0].name,i[1].name,i[2].name].sort()})}for(let bt of Xt){let{idxs:Nt,sets:Vt}=bt,xt=K.map((zt,$t)=>Nt.includes($t)),Lt=k0(K,xt),Dt=s.find(zt=>zt.sets.length===Vt.length&&zt.sets.every(($t,ft)=>$t===Vt[ft]));kt.append("circle").attr("cx",Lt.x).attr("cy",Lt.y).attr("r",Ot).attr("fill","transparent").attr("stroke","none").attr("class","venn-hit-target").attr("data-line-number",Dt?String(Dt.lineNumber):"").style("cursor",o&&Dt?"pointer":"default").style("outline-solid","none").on("mouseenter",()=>{lt(Nt)}).on("mouseleave",()=>{nt()}).on("click",function(){this.blur?.(),o&&Dt&&o(Dt.lineNumber)})}}L0();qa();Xn();M0();en();fr();Zi();tn();function k_(t,e,n,r,o,a){let{quadrantLabels:i,quadrantPoints:s,quadrantXAxis:l,quadrantYAxis:c,quadrantTitleLineNumber:d,quadrantXAxisLineNumber:u,quadrantYAxisLineNumber:f}=e,p=e.noTitle?null:e.title;if(s.length===0)return;let m=Xa(t,n,a);if(!m)return;let{svg:h,width:g,height:E,textColor:y}=m,b=n.border,x=a?Ee.identity():Ee.from(g,600);h.attr("preserveAspectRatio","xMidYMid meet"),x.isBelowFloor&&h.attr("width","100%");let L=[n.colors.blue,n.colors.green,n.colors.yellow,n.colors.purple],v=!!l,A=!!c,C={top:p?x.aesthetic(60):x.aesthetic(30),right:x.aesthetic(30),bottom:v?x.aesthetic(70):x.aesthetic(40),left:A?x.aesthetic(80):x.aesthetic(40)},M=g-C.left-C.right,w=E-C.top-C.bottom,k=or().domain([0,1]).range([0,M]),N=or().domain([0,1]).range([w,0]);co(h,p,d,g,y,o);let _=h.append("g").attr("transform",`translate(${C.left}, ${C.top})`),T=nr(n,r),R=(J,at)=>J?.color??L[at%L.length],G=(J,at)=>Gt(R(J,at),T,30),I=[{position:"top-left",x:0,y:0,w:M/2,h:w/2,labelX:M/4,labelY:w/4,label:i.topLeft,colorIdx:1},{position:"top-right",x:M/2,y:0,w:M/2,h:w/2,labelX:M*3/4,labelY:w/4,label:i.topRight,colorIdx:0},{position:"bottom-left",x:0,y:w/2,w:M/2,h:w/2,labelX:M/4,labelY:w*3/4,label:i.bottomLeft,colorIdx:2},{position:"bottom-right",x:M/2,y:w/2,w:M/2,h:w/2,labelX:M*3/4,labelY:w*3/4,label:i.bottomRight,colorIdx:3}],H=_.selectAll("rect.quadrant").data(I).enter().append("rect").attr("class","quadrant").attr("x",J=>J.x).attr("y",J=>J.y).attr("width",J=>J.w).attr("height",J=>J.h).attr("fill",J=>G(J.label,J.colorIdx)).attr("stroke",J=>R(J.label,J.colorIdx)).attr("stroke-width",x.structural(2)),O="rgba(0,0,0,0.4)",D=Gt(y,T,35),W=x.text(48),z=x.text(14),P=x.aesthetic(40),B=(J,at,it)=>{let vt=at-P,Tt=it-P;if(_t(J,W)<=vt){let ut=Math.min(W,Tt);return{lines:[J],fontSize:Math.max(z,Math.round(ut))}}let At=ut=>Tn(J,ut,vt),rt=z,pt=W,ht=At(rt),dt=rt;for(;rt<=pt;){let ut=Math.round((rt+pt)/2),yt=At(ut),kt=yt.length*ut*1.2;Math.max(...yt.map(Xt=>_t(Xt,ut)))<=vt&&kt<=Tt?(dt=ut,ht=yt,rt=ut+1):pt=ut-1}return{lines:ht,fontSize:Math.max(z,dt)}},Y=M/2,V=w/2,j=I.filter(J=>J.label!==null),K=new Map(j.map(J=>[J.label.text,B(J.label.text,Y,V)])),$=(J,at)=>{let it=K.get(at.label.text),vt=Rt(J);if(vt.text(null).attr("font-size",`${it.fontSize}px`).attr("font-weight","700"),it.lines.length===1)vt.text(it.lines[0]);else{let Tt=it.fontSize*1.2,rt=-(it.lines.length*Tt)/2+Tt/2;it.lines.forEach((pt,ht)=>{vt.append("tspan").attr("x",at.labelX).attr("dy",ht===0?`${rt}px`:`${Tt}px`).text(pt)})}},U=_.selectAll("text.quadrant-label").data(j).enter().append("text").attr("class","quadrant-label").attr("x",J=>J.labelX).attr("y",J=>J.labelY).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",D).attr("data-line-number",J=>J.label?.lineNumber?String(J.label.lineNumber):null).style("cursor",J=>o&&J.label?.lineNumber?"pointer":"default").each(function(J){$(this,J)});o&&U.on("click",(J,at)=>{at.label?.lineNumber&&o(at.label.lineNumber)}).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)});let X=x.text(18),q=x.aesthetic(20),et=x.aesthetic(22);if(l){let J=h.append("text").attr("class","quadrant-axis-label").attr("x",C.left+M/4).attr("y",E-q).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("data-line-number",u?String(u):null).style("cursor",o&&u?"pointer":"default").text(l[0]),at=h.append("text").attr("class","quadrant-axis-label").attr("x",C.left+M*3/4).attr("y",E-q).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("data-line-number",u?String(u):null).style("cursor",o&&u?"pointer":"default").text(l[1]);o&&u&&[J,at].forEach(it=>{it.on("click",()=>o(u)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)})})}if(c){let J=C.top+w*3/4,at=C.top+w/4,it=h.append("text").attr("class","quadrant-axis-label").attr("x",et).attr("y",J).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("transform",`rotate(-90, ${et}, ${J})`).attr("data-line-number",f?String(f):null).style("cursor",o&&f?"pointer":"default").text(c[0]),vt=h.append("text").attr("class","quadrant-axis-label").attr("x",et).attr("y",at).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("transform",`rotate(-90, ${et}, ${at})`).attr("data-line-number",f?String(f):null).style("cursor",o&&f?"pointer":"default").text(c[1]);o&&f&&[it,vt].forEach(Tt=>{Tt.on("click",()=>o(f)).on("mouseenter",function(){Rt(this).attr("opacity",.7)}).on("mouseleave",function(){Rt(this).attr("opacity",1)})})}_.append("line").attr("x1",M/2).attr("y1",0).attr("x2",M/2).attr("y2",w).attr("stroke",b).attr("stroke-width",1),_.append("line").attr("x1",0).attr("y1",w/2).attr("x2",M).attr("y2",w/2).attr("stroke",b).attr("stroke-width",1);let tt=(J,at)=>J>=.5&&at>=.5?"top-right":J<.5&&at>=.5?"top-left":J<.5&&at<.5?"bottom-left":"bottom-right",F=x.structural(6),Q=x.text(12),ot=j.map(J=>{let at=K.get(J.label.text),it=Math.max(...at.lines.map(Tt=>_t(Tt,at.fontSize))),vt=at.lines.length*at.fontSize*1.2;return{x:J.labelX-it/2,y:J.labelY-vt/2,w:it,h:vt}}),Z=s.map(J=>({label:J.label,cx:k(J.x),cy:N(J.y)})),lt=v_(Z,{left:0,top:0,right:M,bottom:w},ot,F,Q),nt=_.append("g").attr("class","points");s.forEach((J,at)=>{let it=k(J.x),vt=N(J.y),Tt=tt(J.x,J.y),At=I.find(Ot=>Ot.position===Tt),rt=At?.label?.color??L[At?.colorIdx??0],pt=lt[at],ht=nt.append("g").attr("class","point-group").attr("data-line-number",String(J.lineNumber)).attr("data-quadrant",Tt);pt.connectorLine&&ht.append("line").attr("x1",pt.connectorLine.x1).attr("y1",pt.connectorLine.y1).attr("x2",pt.connectorLine.x2).attr("y2",pt.connectorLine.y2).attr("stroke",rt).attr("stroke-width",1).attr("opacity",.5),ht.append("circle").attr("cx",it).attr("cy",vt).attr("r",F).attr("fill","#ffffff").attr("stroke",rt).attr("stroke-width",x.structural(2));let dt=ht.append("text").attr("x",pt.x).attr("y",pt.y).attr("text-anchor",pt.anchor).attr("dominant-baseline","central").attr("fill",y).attr("font-size",`${Q}px`).attr("font-weight","700").style("text-shadow",`0 1px 2px ${O}`).style("transition","y 120ms ease-out");dt.append("tspan").text(J.label);let ut=dt.append("tspan").attr("class","point-coords").attr("x",pt.x).attr("dy",`${Q}px`).attr("font-size",`${x.text(10)}px`).attr("font-weight","500").attr("opacity",0).text(`${J.x.toFixed(2)}, ${J.y.toFixed(2)}`),yt=x.structural(14),kt=pt.y<vt?-yt:yt;ht.style("cursor",o?"pointer":"default").on("mouseenter",()=>{ht.select("circle").attr("r",x.structural(8)),dt.attr("y",pt.y+kt),ut.attr("opacity",1),H.attr("opacity",Ot=>Ot.position===Tt?1:.3),U.attr("opacity",Ot=>Ot.position===Tt?1:.3),nt.selectAll("g.point-group").filter((Ot,Xt)=>Xt!==at).attr("opacity",.3)}).on("mouseleave",()=>{ht.select("circle").attr("r",F),dt.attr("y",pt.y),ut.attr("opacity",0),H.attr("opacity",1),U.attr("opacity",1),nt.selectAll("g.point-group").attr("opacity",1)}).on("click",()=>{o&&J.lineNumber&&o(J.lineNumber)})}),H.style("cursor",o?"pointer":"default").on("mouseenter",function(J,at){H.attr("opacity",it=>it.position===at.position?1:.3),U.attr("opacity",it=>it.position===at.position?1:.3),nt.selectAll("g.point-group").each(function(it,vt){let Tt=s[vt],At=tt(Tt.x,Tt.y);Rt(this).attr("opacity",At===at.position?1:.2)})}).on("mouseleave",()=>{H.attr("opacity",1),U.attr("opacity",1),nt.selectAll("g.point-group").attr("opacity",1)}).on("click",(J,at)=>{o&&at.label?.lineNumber&&o(at.label.lineNumber)})}T0();var Ldt={org:Tdt,sitemap:Cdt,kanban:_dt,class:Adt,er:Rdt,"boxes-and-lines":Idt,swimlane:Pdt,"version-control":Mdt,mindmap:Ddt,wireframe:Odt,c4:Gdt,flowchart:$dt,infra:Hdt,pert:Wdt,gantt:Bdt,state:Fdt,"tech-radar":Ydt,"journey-map":zdt,cycle:Vdt,map:Udt,pyramid:Xdt,ring:jdt,treemap:qdt,block:Kdt,raci:Zdt,slope:Qdt,arc:Jdt,timeline:tut,"event-line":Ndt,wordcloud:eut,venn:nut,quadrant:rut};function uL(t,e,n){if(e==="arc"){let r=Ic(t,n);if(!r.error&&r.layout==="chord"&&r.links.length)return{content:[`chord ${r.title??""}`.trimEnd(),...r.links.map(a=>`${a.source} -> ${a.target} ${a.value}`)].join(`
311
311
  `),type:"chord"}}return null}async function T4(t,e,n,r,o){let a=o?.exportMode??!1,{parseDgmoChartType:i}=await Promise.resolve().then(()=>(rE(),nR)),s=i(t),l=uL(t,s,n),c=l?.content??t,d=l?.type??s;if(d!==null){let{supportsD3DataChart:p,renderDataChartD3:m}=await Promise.resolve().then(()=>(lE(),GR));if(p(d))return m(c,e,n)}let u={content:c,theme:e,palette:n,viewState:r,options:o,exportMode:a,isDark:e==="dark"};return((d!==null?Ldt[d]:void 0)??out)(u)}function fa(t){return t.viewState?.tag??t.options?.tagGroup}async function Ndt(t){let{content:e,theme:n,palette:r}=t,{parseEventLine:o}=await Promise.resolve().then(()=>(pw(),v2)),{renderEventLineForExport:a}=await Promise.resolve().then(()=>(ZR(),KR)),i=await Yn(n,r),s=o(e,i);if(s.error||s.events.length===0)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr},fa(t)),zn(l,n,i)}async function Mdt(t){let{content:e,theme:n,palette:r}=t,{parseVersionControl:o}=await Promise.resolve().then(()=>(mw(),N2)),{renderVersionControlForExport:a}=await Promise.resolve().then(()=>(nI(),eI)),i=await Yn(n,r),s=o(e,i);if(s.error||s.nodes.length===0)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr}),zn(l,n,i)}function C4(t,e){let n=t?t.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean):[],r=new Set([...n,...e??[]]);return r.size>0?r:void 0}async function Tdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseOrg:i}=await Promise.resolve().then(()=>(tf(),a2)),{layoutOrg:s}=await Promise.resolve().then(()=>(OE(),UI)),{collapseOrgTree:l}=await Promise.resolve().then(()=>(JI(),QI)),{renderOrg:c}=await Promise.resolve().then(()=>(iP(),aP)),d=t.isDark,u=await Yn(n,r),f=i(e,u);if(f.error)return"";let p=o?.cg?new Set(o.cg):void 0,m=Hr(f.tagGroups,f.options["active-tag"],fa(t)),h=C4(f.options.hide,o?.ha),{parsed:g,hiddenCounts:E}=p&&p.size>0?l(f,p):{parsed:f,hiddenCounts:new Map},y=s(g,E.size>0?E:void 0,m,h,!1),b=20,S=g.title?30:0,x=y.width+b*2,L=y.height+b*2+S,v=rr(x,L);return c(v,g,y,u,d,void 0,{width:x,height:L},m,h,void 0,a),zn(v,n,u)}async function Cdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseSitemap:i}=await Promise.resolve().then(()=>(ef(),ew)),{layoutSitemap:s}=await Promise.resolve().then(()=>(e1(),t1)),{collapseSitemapTree:l}=await Promise.resolve().then(()=>(lD(),sD)),{renderSitemap:c}=await Promise.resolve().then(()=>(fD(),uD)),d=t.isDark,u=await Yn(n,r),f=i(e,u);if(f.error||f.roots.length===0)return"";let p=o?.cg?new Set(o.cg):void 0,m=Hr(f.tagGroups,f.options["active-tag"],fa(t)),h=C4(f.options.hide,o?.ha),{parsed:g,hiddenCounts:E}=p&&p.size>0?l(f,p):{parsed:f,hiddenCounts:new Map},y=s(g,E.size>0?E:void 0,m,h,!0),b=20,S=g.title?30:0,x=y.width+b*2,L=y.height+b*2+S,v=rr(x,L);return c(v,g,y,u,d,void 0,{width:x,height:L},m,h,a),zn(v,n,u)}async function _dt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseKanban:i}=await Promise.resolve().then(()=>(mh(),M2)),{renderKanban:s}=await Promise.resolve().then(()=>(SD(),ED)),l=await Yn(n,r),c=i(e,l);if(c.error||c.columns.length===0)return"";let d=document.createElement("div");d.style.position="absolute",d.style.left="-9999px",document.body.appendChild(d);let u=o?.cl?new Set(o.cl):void 0,f=c.columns.filter(m=>m.collapsed).map(m=>m.id),p=o?.cc||f.length>0?new Set([...f,...o?.cc??[]]):void 0;return s(d,c,l,t.isDark,{activeTagGroup:Hr(c.tagGroups,c.options["active-tag"],fa(t)),currentSwimlaneGroup:o?.swim??c.options["lane-by"]??null,...u!==void 0&&{collapsedLanes:u},...p!==void 0&&{collapsedColumns:p},...o?.cm!==void 0&&{compactMeta:o.cm},exportMode:a}),zn(d,n,l)}async function Adt(t){let{content:e,theme:n,palette:r,exportMode:o}=t,{parseClassDiagram:a}=await Promise.resolve().then(()=>(Qu(),J_)),{layoutClassDiagram:i}=await Promise.resolve().then(()=>(d1(),kD)),{renderClassDiagram:s}=await Promise.resolve().then(()=>(AD(),_D)),l=await Yn(n,r),c=a(e,l);if(c.error||c.classes.length===0)return"";let d=i(c),u=20,f=c.title?40:0,p=d.width+u*2,m=d.height+u*2+f,h=rr(p,m);return s(h,c,d,l,t.isDark,void 0,{width:p,height:m},void 0,o),zn(h,n,l)}async function Rdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseERDiagram:i}=await Promise.resolve().then(()=>(Ju(),r2)),{layoutERDiagram:s}=await Promise.resolve().then(()=>(h1(),ID)),{renderERDiagram:l}=await Promise.resolve().then(()=>(FD(),BD)),c=await Yn(n,r),d=i(e,c);if(d.error||d.tables.length===0)return"";let u=s(d),f=20,p=d.title?40:0,m=u.width+f*2,h=u.height+f*2+p,g=rr(m,h);return l(g,d,u,c,t.isDark,void 0,{width:m,height:h},Hr(d.tagGroups,d.options["active-tag"],fa(t)),o?.sem??(d.options["no-semantic-colors"]==="on"?!1:void 0),a),zn(g,n,c)}async function Idt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseBoxesAndLines:i}=await Promise.resolve().then(()=>(Mw(),uA)),s=await Yn(n,r),l=i(e,s);if(l.error||l.nodes.length===0)return"";let c;if(o?.htv){c=new Map;for(let[b,S]of Object.entries(o.htv))c.set(b,new Set(S))}let{renderBoxesAndLinesForExport:d}=await Promise.resolve().then(()=>(KD(),qD)),{layoutBoxesAndLines:u}=await Promise.resolve().then(()=>(Nf(),xO)),f=await u(l),p=20,m=l.title?40:0,h=f.width+p*2,g=f.height+p*2+m,E=rr(h,g),y=fa(t);return d(E,l,f,s,t.isDark,{exportDims:{width:h,height:g},...y!==void 0&&{activeTagGroup:y},...c!==void 0&&{hiddenTagValues:c},exportMode:a}),zn(E,n,s)}async function Pdt(t){let{content:e,theme:n,palette:r}=t,{parseSwimlane:o}=await Promise.resolve().then(()=>(Tw(),hA)),{layoutSwimlane:a}=await Promise.resolve().then(()=>(AO(),_O)),{renderSwimlaneForExport:i}=await Promise.resolve().then(()=>(GO(),OO)),s=await Yn(n,r),l=o(e,s);if(l.error||l.nodes.length===0)return"";let c=a(l),d=20,u=l.title?40:0,f=c.width+d*2,p=c.height+d*2+u,m=rr(f,p);return i(m,l,c,s,t.isDark,{exportDims:{width:f,height:p},activeTagGroup:Hr(l.tagGroups,l.options["active-tag"],fa(t)),exportMode:t.exportMode}),zn(m,n,s)}async function Ddt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseMindmap:i}=await Promise.resolve().then(()=>(kh(),gA)),{layoutMindmap:s}=await Promise.resolve().then(()=>(Y1(),zO)),{collapseMindmapTree:l}=await Promise.resolve().then(()=>(XO(),UO)),{renderMindmap:c}=await Promise.resolve().then(()=>(ZO(),KO)),d=t.isDark,u=await Yn(n,r),f=i(e,u);if(f.error)return"";let p=new Set(o?.cg??[]),m=w=>{for(let k of w)k.collapsed&&p.add(k.id),k.children.length&&m(k.children)};m(f.roots);let h=Hr(f.tagGroups,f.options["active-tag"],fa(t)),g=f.options["no-descriptions"]==="true"||o?.hd===!0,{roots:E,hiddenCounts:y}=p&&p.size>0?l(f.roots,p):{roots:f.roots,hiddenCounts:new Map},b={...f,roots:E},S=s(b,u,{interactive:!1,...y.size>0&&{hiddenCounts:y},activeTagGroup:h,hideDescriptions:g}),x=20,L=b.title?30:0,v=S.width+x*2,A=S.height+x*2+L,C=rr(v,A),M=o?.cbd??f.options["color-by-depth"]==="on";return c(C,b,S,u,d,void 0,{width:v,height:A},void 0,g,M?null:h,M?{colorByDepth:!0,exportMode:a}:{exportMode:a}),zn(C,n,u)}async function Odt(t){let{content:e,theme:n,palette:r}=t,{parseWireframe:o}=await Promise.resolve().then(()=>(Aw(),vA)),{layoutWireframe:a}=await Promise.resolve().then(()=>(rG(),nG)),{renderWireframe:i}=await Promise.resolve().then(()=>(dG(),cG)),s=await Yn(n,r),l=o(e);if(l.error||l.roots.length===0&&l.modals.length===0)return"";let c=a(l),d=c.width,u=c.height,f=rr(d,u);return i(f,l,c,s,t.isDark,void 0,{width:d,height:u},n),zn(f,n,s)}async function Gdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseC4:i}=await Promise.resolve().then(()=>(hh(),R2)),{layoutC4Context:s,layoutC4Containers:l,layoutC4Components:c,layoutC4Deployment:d}=await Promise.resolve().then(()=>(Q1(),bG)),{renderC4Context:u,renderC4Containers:f}=await Promise.resolve().then(()=>(GG(),OG)),p=await Yn(n,r),m=i(e,p);if(m.error||m.elements.length===0)return"";let h=t.options?.c4Level??o?.c4l??"context",g=t.options?.c4System??o?.c4s,E=t.options?.c4Container??o?.c4c,y=h==="deployment"?d(m):h==="components"&&g&&E?c(m,g,E):h==="containers"&&g?l(m,g):s(m);if(y.nodes.length===0)return"";let b=20,S=m.title?40:0,x=y.width+b*2,L=y.height+b*2+S,v=rr(x,L);return(h==="deployment"||h==="components"&&g&&E||h==="containers"&&g?f:u)(v,m,y,p,t.isDark,void 0,{width:x,height:L},Hr(m.tagGroups,m.options["active-tag"],fa(t)),a),zn(v,n,p)}async function $dt(t){let{content:e,theme:n,palette:r}=t,{parseFlowchart:o}=await Promise.resolve().then(()=>(Ku(),X_)),{layoutGraph:a}=await Promise.resolve().then(()=>(Pf(),rS)),{renderFlowchart:i}=await Promise.resolve().then(()=>(BG(),WG)),s=await Yn(n,r),l=o(e,s);if(l.error||l.nodes.length===0)return"";let c=a(l),d=rr(ur,yr);return i(d,l,c,s,t.isDark,void 0,{width:ur,height:yr}),zn(d,n,s)}async function Hdt(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parseInfra:a}=await Promise.resolve().then(()=>(bh(),Z2)),{computeInfra:i}=await Promise.resolve().then(()=>(fS(),YG)),{layoutInfra:s}=await Promise.resolve().then(()=>(gS(),JG)),{renderInfra:l,computeInfraLegendGroups:c}=await Promise.resolve().then(()=>(b$(),y$)),d=await Yn(n,r),u=a(e);if(u.error||u.nodes.length===0)return"";let f=i(u),p=s(f),m=Hr(u.tagGroups,u.options["active-tag"],fa(t)),h=!!u.title&&u.options["no-title"]!=="on",g=h?40:0,E=[...u.tagGroups],b=c(p.nodes,E,d).length>0?28:0,S=p.width,x=p.height+g+b,L=rr(S,x);l(L,p,d,t.isDark,h?u.title:null,h?u.titleLineNumber:null,E,m,!1,null,null,!0,o?.cg?new Set(o.cg):null);let v=L.querySelector("svg");return v&&(v.setAttribute("width",String(S)),v.setAttribute("height",String(x))),zn(L,n,d)}async function Wdt(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parsePert:a}=await Promise.resolve().then(()=>(sf(),m2)),{analyzePert:i}=await Promise.resolve().then(()=>(LS(),T$)),{layoutPert:s}=await Promise.resolve().then(()=>(TS(),D$)),{renderPert:l,measurePertAnalysisBlock:c}=await Promise.resolve().then(()=>(sH(),iH)),d=await Yn(n,r),u=a(e,{palette:d});if(u.error||u.activities.length===0)return"";let f=i(u),p=s(f),m=u.title&&!u.options.noTitle?80:0,h=20,g=o?.an??!u.options.noAnalysis,E=o?.fl===!0,y=p.width+h*2,b=g||E?c(f,y-2*h,{showSummary:!1,showTornado:g,showScurve:g,showFieldLegend:E}):{width:0,height:0},S=p.height+h*2+m+b.height,x=rr(y,S);return l(x,f,p,d,t.isDark,{title:u.title,exportDims:{width:y,height:S},showSummary:!1,showTornado:g,showScurve:g,showFieldLegend:E}),zn(x,n,d)}async function Bdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseGantt:i}=await Promise.resolve().then(()=>(ww(),oA)),{calculateSchedule:s}=await Promise.resolve().then(()=>(hH(),mH)),{renderGantt:l}=await Promise.resolve().then(()=>(HH(),$H)),c=await Yn(n,r),d=i(e,c),u=s(d);if(u.tasks.length===0)return"";let f=1200,p=800,m=rr(f,p),h=u.groups.filter(S=>S.collapsed).map(S=>S.name),g=o?.cg||h.length>0?new Set([...h,...o?.cg??[]]):void 0,E=u.options.sort==="tag"?u.options.defaultSwimlaneGroup??void 0:void 0,y=o?.swim??E,b=o?.cl?new Set(o.cl):void 0;return l(m,u,c,t.isDark,{...g!==void 0&&{collapsedGroups:g},...y!==void 0&&{currentSwimlaneGroup:y},...b!==void 0&&{collapsedLanes:b},currentActiveGroup:Hr(u.tagGroups,u.options.activeTag??void 0,fa(t)),exportMode:a},{width:f,height:p}),zn(m,n,c)}async function Fdt(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parseState:a}=await Promise.resolve().then(()=>(Zu(),q_)),{layoutGraph:i}=await Promise.resolve().then(()=>(Pf(),rS)),{renderState:s}=await Promise.resolve().then(()=>(FH(),BH)),{collapseStateGroups:l}=await Promise.resolve().then(()=>(zH(),YH)),c=await Yn(n,r),d=a(e,c);if(d.error||d.nodes.length===0)return"";let u=(d.groups??[]).filter(y=>y.collapsed).map(y=>y.id),f=new Set([...u,...o?.cg??[]]),{parsed:p,collapsedChildCounts:m,originalGroups:h}=f.size>0?l(d,f):{parsed:d,collapsedChildCounts:new Map,originalGroups:d.groups??[]},g=i(p,{collapsedChildCounts:m,originalGroups:h}),E=rr(ur,yr);return s(E,p,g,c,t.isDark,void 0,{width:ur,height:yr}),zn(E,n,c)}async function Ydt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseTechRadar:i}=await Promise.resolve().then(()=>(Pw(),kA)),{renderTechRadarForExport:s}=await Promise.resolve().then(()=>(sW(),iW)),l=await Yn(n,r),c=i(e);if(c.error||c.quadrants.length===0)return"";let d=1300,u=1500,f=rr(d,u);return s(f,c,l,t.isDark,{width:d,height:u},o,a),zn(f,n,l)}async function zdt(t){let{content:e,theme:n,palette:r,exportMode:o}=t,{parseJourneyMap:a}=await Promise.resolve().then(()=>(Ch(),TA)),{renderJourneyMap:i}=await Promise.resolve().then(()=>(SW(),EW)),{layoutJourneyMap:s}=await Promise.resolve().then(()=>(uv(),fW)),l=await Yn(n,r),c=a(e,l);if(c.error||c.phases.length===0&&c.steps.length===0)return"";let d=s(c,l,{isDark:t.isDark}),u=rr(d.totalWidth,d.totalHeight);return i(u,c,l,t.isDark,{exportDims:{width:d.totalWidth,height:d.totalHeight},exportMode:o}),zn(u,n,l)}async function Vdt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseCycle:i}=await Promise.resolve().then(()=>(Ow(),LA)),{renderCycleForExport:s}=await Promise.resolve().then(()=>(GW(),OW)),l=await Yn(n,r),c=i(e);if(c.error||c.nodes.length===0)return"";let d=rr(ur,yr);return s(d,c,l,t.isDark,{width:ur,height:yr},o,a),zn(d,n,l)}async function Udt(t){let{content:e,theme:n,palette:r,options:o}=t,{parseMap:a}=await Promise.resolve().then(()=>(Eh(),kw)),{resolveMap:i}=await Promise.resolve().then(()=>(_k(),Ck)),{renderMapForExport:s}=await Promise.resolve().then(()=>(e3(),t3)),{mapExportDimensions:l}=await Promise.resolve().then(()=>(i3(),a3)),c=await Yn(n,r),d=a(e,c),u=o?.mapData;if(!u){let{loadMapData:h}=await Promise.resolve().then(()=>(jk(),Xk));try{u=await h()}catch{return""}}let f=i(d,u),p=l(f,u,ur,o?.mapAspect),m=rr(p.width,p.height);return s(m,f,u,c,t.isDark,p),zn(m,n,c)}async function Xdt(t){let{content:e,theme:n,palette:r}=t,{parsePyramid:o}=await Promise.resolve().then(()=>($w(),_A)),{renderPyramidForExport:a}=await Promise.resolve().then(()=>(g3(),h3)),i=await Yn(n,r),s=o(e);if(s.error||s.layers.length===0)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr}),zn(l,n,i)}async function jdt(t){let{content:e,theme:n,palette:r}=t,{parseRing:o}=await Promise.resolve().then(()=>(Ww(),IA)),{renderRingForExport:a}=await Promise.resolve().then(()=>(L3(),k3)),i=await Yn(n,r),s=o(e);if(s.error||s.layers.length===0)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr}),zn(l,n,i)}async function qdt(t){let{content:e,theme:n,palette:r}=t,{parseTreemap:o}=await Promise.resolve().then(()=>(Fw(),OA)),a=await Yn(n,r),i=o(e,a);if(i.error||i.roots.length===0)return"";let s=rr(ur,yr),l={width:ur,height:yr};if(i.options.radial){let{renderTreemapRadialForExport:c}=await Promise.resolve().then(()=>(I3(),R3));c(s,i,a,t.isDark,l)}else{let{renderTreemapForExport:c}=await Promise.resolve().then(()=>(B3(),W3));c(s,i,a,t.isDark,l)}return zn(s,n,a)}async function Kdt(t){let{content:e,theme:n,palette:r}=t,{parseBlock:o}=await Promise.resolve().then(()=>(zw(),GA)),{renderBlockForExport:a}=await Promise.resolve().then(()=>(J3(),Q3)),i=await Yn(n,r),s=o(e,i);if(s.error||s.top.rows.length===0)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr}),zn(l,n,i)}async function Zdt(t){let{content:e,theme:n,palette:r}=t,{parseRaci:o}=await Promise.resolve().then(()=>(Rh(),VA)),{renderRaciForExport:a}=await Promise.resolve().then(()=>(p4(),f4)),i=await Yn(n,r),s=o(e,i);if(s.error)return"";let l=rr(ur,yr);return a(l,s,i,t.isDark,{width:ur,height:yr}),zn(l,n,i)}function su(){return{container:rr(ur,yr),dims:{width:ur,height:yr}}}async function Qdt(t){let{content:e,theme:n,palette:r}=t,o=Im(e,r);if(o.error||o.data.length===0)return"";let a=await Yn(n,r),{container:i,dims:s}=su();return UC(i,o,a,t.isDark,void 0,s),zn(i,n,a)}async function Jdt(t){let{content:e,theme:n,palette:r}=t,o=Ic(e,r);if(o.error||o.links.length===0)return"";let a=await Yn(n,r),{container:i,dims:s}=su();return KC(i,o,a,t.isDark,void 0,s),zn(i,n,a)}async function tut(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,i=Xm(e,r);if(i.error||i.timelineEvents.length===0)return"";let s=await Yn(n,r),{container:l,dims:c}=su();return Um(l,i,s,t.isDark,void 0,c,Hr(i.timelineTagGroups,i.timelineActiveTag,fa(t)),o?.swim??i.timelineDefaultSwimlaneTG,void 0,void 0,a),zn(l,n,s)}async function eut(t){let{content:e,theme:n,palette:r}=t,o=Km(e,r);if(o.error||o.words.length===0)return"";let a=await Yn(n,r),{container:i,dims:s}=su();return await w_(i,o,a,t.isDark,s),zn(i,n,a)}async function nut(t){let{content:e,theme:n,palette:r}=t,o=Zm(e,r);if(o.error||o.vennSets.length<2)return"";let a=await Yn(n,r),{container:i,dims:s}=su();return E_(i,o,a,t.isDark,void 0,s),zn(i,n,a)}async function rut(t){let{content:e,theme:n,palette:r}=t,o=Qm(e,r);if(o.error||o.quadrantPoints.length===0)return"";let a=await Yn(n,r),{container:i,dims:s}=su();return k_(i,o,a,t.isDark,void 0,s),zn(i,n,a)}async function out(t){let{content:e,theme:n,palette:r,viewState:o}=t,a=lo(e,r);if(a.type!=="sequence")if(a.error){if(!/->|~>|<-/.test(e))return""}else return"";let i=await Yn(n,r),s=t.isDark,l=rr(ur,yr),{parseSequenceDgmo:c}=await Promise.resolve().then(()=>(Dc(),__)),{renderSequenceDiagram:d}=await Promise.resolve().then(()=>(M4(),N4)),u=c(e,i);if(u.error||u.participants.length===0)return"";let f=o?.cs?new Set(o.cs):void 0,p=o?.cg?new Set(o.cg.map(Number).filter(h=>Number.isFinite(h))):void 0,m=fa(t);return d(l,u,i,s,void 0,{exportWidth:ur,...m!==void 0&&{activeTagGroup:m},...f!==void 0&&{collapsedSections:f},...p!==void 0&&{collapsedGroups:p}}),zn(l,n,i)}lE();var _b="filter:saturate(1.4) brightness(1.06)",aut="transition:filter .12s ease, opacity .12s ease";function Cb(t){let e="";for(let n of t){let r=n.codePointAt(0);n==='"'?e+='\\"':n==="\\"?e+="\\\\":n==="<"?e+="\\3c ":r<32||r===127?e+="\\"+r.toString(16)+" ":e+=n}return e}function iut(t){return`${t}:hover{${_b}}`}function sut(t,e,n,r,o){let a=Cb(n),i=`svg:has(${t}[${e}="${a}"]:hover)`;return r==="lift"?`${i} ${t}[${e}="${a}"]{${_b}}`:`${i} ${t}:not([${e}="${a}"]){opacity:${o}}`}function lut(t,e,n,r,o){let a=Cb(n.toLowerCase()),i=Cb(n),s=`svg:has([data-legend-entry="${a}"]:hover)`;return r==="lift"?`${s} ${t}[${e}="${i}"]{${_b}}`:`${s} ${t}:not([${e}="${i}"]){opacity:${o}}`}function cut(t,e,n){let r=Cb(e),{hoverSelector:o,hoverAttr:a,edgeSelector:i,fromAttr:s,toAttr:l}=t;return`${`svg:has(${o}[${a}="${r}"]:hover)`} ${i}:not([${s}="${r}"]):not([${l}="${r}"]){opacity:${n}}`}function dut(t,e={},n){let r=n??t.emphasis??"lift",o=t.dimOpacity??.4,a=t.selfEmphasis!==!1,i=e.values??[],s=e.ids??[],l=[];a&&(l.push(iut(t.markSelector)),t.animatesOpacity||l.push(`${t.markSelector}{${aut}}`));let c=[];if(t.strategy==="structural"&&t.groupSelector){let u=t.groupSelector;c.push(r==="lift"?`svg:has(${u}:hover) ${u}:hover{${_b}}`:`svg:has(${u}:hover) ${u}:not(:hover){opacity:${o}}`)}else if(t.strategy==="enumerated"&&t.groupAttr){let u=t.legend?i.length:0;if(i.length+u>40)l.push(`/* hover: ${i.length} groups exceeds cap 40; self-emphasis only */`);else{for(let f of i)c.push(sut(t.markSelector,t.groupAttr,f,r,o));if(t.legend)for(let f of i)c.push(lut(t.markSelector,t.groupAttr,f,r,o))}}else if(t.strategy==="connection")if(s.length>40)l.push(`/* hover: ${s.length} nodes exceeds cap 40; self-emphasis only */`);else for(let u of s)c.push(cut(t,u,o));let d=[...l];return c.length&&d.push(`@media (hover:hover){${c.join("")}}`),d.join("")}var uut={pie:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},bar:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},funnel:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},heatmap:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},"polar-area":{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},gantt:{markSelector:".gantt-task",strategy:"enumerated",groupAttr:"data-group"},timeline:{markSelector:".tl-event",strategy:"enumerated",groupAttr:"data-group"},raci:{markSelector:"[data-role-id]",strategy:"enumerated",groupAttr:"data-role-id"},sequence:{markSelector:".participant",strategy:"connection",hoverSelector:".participant",hoverAttr:"data-participant-id",edgeSelector:".message-arrow",fromAttr:"data-from",toAttr:"data-to"},arc:{markSelector:".arc-node",strategy:"connection",hoverSelector:".arc-node",hoverAttr:"data-node",edgeSelector:".arc-link",fromAttr:"data-source",toAttr:"data-target"},pert:{markSelector:".pert-node",strategy:"connection",hoverSelector:".pert-node",hoverAttr:"data-activity-id",edgeSelector:".pert-edge",fromAttr:"data-source",toAttr:"data-target"},treemap:{markSelector:".dgmo-treemap-cell",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},block:{markSelector:".dgmo-block-cell",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},"event-line":{markSelector:".dgmo-event-dot",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},flowchart:{markSelector:".fc-node",strategy:"connection",hoverSelector:".fc-node",hoverAttr:"data-node-id",edgeSelector:".fc-edge-group",fromAttr:"data-source",toAttr:"data-target"},state:{markSelector:".st-node",strategy:"connection",hoverSelector:".st-node",hoverAttr:"data-node-id",edgeSelector:".st-edge-group",fromAttr:"data-source",toAttr:"data-target"},"boxes-and-lines":{markSelector:".bl-node",strategy:"connection",hoverSelector:".bl-node",hoverAttr:"data-node-id",edgeSelector:".bl-edge-group",fromAttr:"data-from",toAttr:"data-to"},infra:{markSelector:".infra-node",strategy:"connection",hoverSelector:".infra-node",hoverAttr:"data-infra-node",edgeSelector:".infra-edge",fromAttr:"data-from",toAttr:"data-to"},c4:{markSelector:".c4-card",strategy:"connection",hoverSelector:".c4-card",hoverAttr:"data-node-id",edgeSelector:".c4-edge-group",fromAttr:"data-source",toAttr:"data-target"},class:{markSelector:".cd-class",strategy:"connection",hoverSelector:".cd-class",hoverAttr:"data-node-id",edgeSelector:".cd-edge-group",fromAttr:"data-source",toAttr:"data-target"},er:{markSelector:".er-table",strategy:"connection",hoverSelector:".er-table",hoverAttr:"data-node-id",edgeSelector:".er-edge-group",fromAttr:"data-source",toAttr:"data-target"},org:{markSelector:".org-node",strategy:"connection",hoverSelector:".org-node",hoverAttr:"data-node-id",edgeSelector:".org-edge",fromAttr:"data-from",toAttr:"data-to"},sitemap:{markSelector:".sitemap-node",strategy:"connection",hoverSelector:".sitemap-node",hoverAttr:"data-node-id",edgeSelector:".sitemap-edge-group",fromAttr:"data-from",toAttr:"data-to"},cycle:{markSelector:".cycle-node",strategy:"connection",hoverSelector:".cycle-node",hoverAttr:"data-node-index",edgeSelector:".cycle-edge",fromAttr:"data-from",toAttr:"data-to"},scatter:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-category",legend:!0},quadrant:{markSelector:".point-group",strategy:"enumerated",groupAttr:"data-quadrant"},"version-control":{markSelector:"[data-branch]",strategy:"enumerated",groupAttr:"data-branch"},kanban:{markSelector:".kanban-column",strategy:"structural",groupSelector:".kanban-column",emphasis:"dim",selfEmphasis:!1},line:{markSelector:"g.dgmo-series",strategy:"structural",groupSelector:"g.dgmo-series",emphasis:"dim",selfEmphasis:!1},swimlane:{markSelector:"[data-lane]",strategy:"enumerated",groupAttr:"data-lane"},"tech-radar":{markSelector:"[data-trend]",strategy:"enumerated",groupAttr:"data-quadrant"},"journey-map":{markSelector:".journey-face",strategy:"enumerated",groupAttr:"data-score"},mindmap:{markSelector:".mindmap-node",strategy:"enumerated",groupAttrMode:"tag-active"},pyramid:{markSelector:".pyramid-layer",strategy:"self"},ring:{markSelector:".ring-layer",strategy:"self"},slope:{markSelector:".slope-series",strategy:"self"},function:{markSelector:".dgmo-datum",strategy:"self"},map:{markSelector:"[data-poi]",strategy:"enumerated",groupAttrMode:"tag-active"}};function fut(t,e){if(typeof document>"u")return{};let n=document.createElement("div");n.innerHTML=t;let r=n.querySelector("svg");if(!r)return{};if(e.strategy==="enumerated"){let o=e.groupAttr;if(e.groupAttrMode==="tag-active"){let s=r.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");if(s)o=`data-tag-${s}`;else{let l=new Set;if(r.querySelectorAll(e.markSelector).forEach(c=>{for(let d of Array.from(c.attributes))d.name.startsWith("data-tag-")&&l.add(d.name)}),l.size!==1)return{};o=[...l][0]}}if(!o)return{};let a=o,i=new Set;return r.querySelectorAll(`${e.markSelector}[${a}]`).forEach(s=>{let l=s.getAttribute(a);l!=null&&i.add(l)}),{values:[...i],groupAttr:a}}if(e.strategy==="connection"&&e.hoverSelector&&e.hoverAttr){let o=new Set;return r.querySelectorAll(`${e.hoverSelector}[${e.hoverAttr}]`).forEach(a=>{let i=a.getAttribute(e.hoverAttr);i!=null&&o.add(i)}),{ids:[...o]}}return{}}function fL(t,e,n){if(!n?.bakeHover||!t||!e)return t;let r=uut[e];if(!r)return t;let o=fut(t,r),a=o.groupAttr?{...r,groupAttr:o.groupAttr}:r,i=dut(a,o,n.emphasis);if(!i)return t;let s=t.match(/<svg\b[^>]*>/);if(s?.index==null)return t;let l=s.index+s[0].length;return`${t.slice(0,l)}<style>${i}</style>${t.slice(l)}`}rE();Ua();var R4=["document","window","navigator","HTMLElement","SVGElement"],pL=0,Ab=null,Rb=!1;async function put(){let{JSDOM:t}=await mut(),n=new t("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/"}).window,r={document:n.document,window:n,navigator:n.navigator,HTMLElement:n.HTMLElement,SVGElement:n.SVGElement};for(let o of R4)Object.defineProperty(globalThis,o,{value:r[o],configurable:!0});Rb=!0}async function _4(){typeof document<"u"&&!Rb||(pL++,Ab||(Ab=put()),await Ab)}function A4(){if(Rb&&!(--pL>0)){for(let t of R4)delete globalThis[t];Rb=!1,Ab=null,pL=0}}async function mut(){return import(["js","dom"].join(""))}async function I4(t,e){let n=e?.theme??"light",r=e?.palette??"slate",o=e?.bakeHover??!0,a=Qp(r)[n==="dark"?"dark":"light"],i=nE(t),s=i.diagnostics,l=uL(t,i.chartType,a),c=l?.content??t,d=l?.type??i.chartType,u=l?"data-chart":d?tE(d):null,f=e?.viewState??(e?.legendState?{...e.legendState.activeGroup!==void 0&&{tag:e.legendState.activeGroup},...e.legendState.hiddenAttributes!==void 0&&{ha:e.legendState.hiddenAttributes}}:void 0);if(u==="data-chart"){await _4();try{let m=await sE(c,n,a);return{svg:fL(m,d,{bakeHover:o}),diagnostics:s}}finally{A4()}}await _4();let p;try{p=await T4(c,n,a,f,{...e?.c4Level!==void 0&&{c4Level:e.c4Level},...e?.c4System!==void 0&&{c4System:e.c4System},...e?.c4Container!==void 0&&{c4Container:e.c4Container},...e?.tagGroup!==void 0&&{tagGroup:e.tagGroup},...e?.mapData!==void 0&&{mapData:e.mapData}}),p=fL(p,d,{bakeHover:o})}finally{A4()}if(d==="map")try{let[{parseMap:m},{resolveMap:h},{loadMapData:g}]=await Promise.all([Promise.resolve().then(()=>(Eh(),kw)),Promise.resolve().then(()=>(_k(),Ck)),Promise.resolve().then(()=>(jk(),Xk))]),E=e?.mapData??await g();s=[...h(m(t),E).diagnostics]}catch{}return{svg:p,diagnostics:s}}Ua();yi();var Pb=yu(P4(),1),hut="https://online.diagrammo.app",D4=8192;function gut(t){return Object.keys(t).length===0?"":(0,Pb.compressToEncodedURIComponent)(JSON.stringify(t))}function O4(t,e){let n=e?.baseUrl??hut,r=(0,Pb.compressToEncodedURIComponent)(t),o=new TextEncoder().encode(r).byteLength;if(o>D4)return{error:"too-large",compressedSize:o,limit:D4};let a=`dgmo=${r}`;if(e?.viewState){let i=gut(e.viewState);i&&(a+=`&vs=${i}`)}return e?.palette&&e.palette!=="nord"&&(a+=`&pal=${encodeURIComponent(e.palette)}`),e?.theme&&e.theme!=="dark"&&(a+=`&th=${encodeURIComponent(e.theme)}`),e?.filename&&(a+=`&fn=${encodeURIComponent(e.filename)}`),{url:`${n}?${a}#${a}`}}var yut=0,_p=class{constructor(e,n){this.from=e,this.to=n}},hr=class{constructor(e={}){this.id=yut++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=za.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}};hr.closedBy=new hr({deserialize:t=>t.split(" ")});hr.openedBy=new hr({deserialize:t=>t.split(" ")});hr.group=new hr({deserialize:t=>t.split(" ")});hr.isolate=new hr({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});hr.contextHash=new hr({perNode:!0});hr.lookAhead=new hr({perNode:!0});hr.mounted=new hr({perNode:!0});var sc=class{constructor(e,n,r,o=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=o}static get(e){return e&&e.props&&e.props[hr.mounted.id]}},but=Object.create(null),za=class t{constructor(e,n,r,o=0){this.name=e,this.props=n,this.id=r,this.flags=o}static define(e){let n=e.props&&e.props.length?Object.create(null):but,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new t(e.name||"",n,e.id,r);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(o)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[a[0].id]=a[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(hr.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let o of r.split(" "))n[o]=e[r];return r=>{for(let o=r.prop(hr.group),a=-1;a<(o?o.length:0);a++){let i=n[a<0?r.name:o[a]];if(i)return i}}}};za.none=new za("",Object.create(null),0,8);var Gb=class t{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let r of this.types){let o=null;for(let a of e){let i=a(r);if(i){o||(o=Object.assign({},r.props));let s=i[1],l=i[0];l.combine&&l.id in o&&(s=l.combine(o[l.id],s)),o[l.id]=s}}n.push(o?new za(r.name,o,r.id,r.flags):r)}return new t(n)}},Db=new WeakMap,G4=new WeakMap,jr;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(jr||(jr={}));var zo=class t{constructor(e,n,r,o,a){if(this.type=e,this.children=n,this.positions=r,this.length=o,this.props=null,a&&a.length){this.props=Object.create(null);for(let[i,s]of a)this.props[typeof i=="number"?i:i.id]=s}}toString(){let e=sc.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let o=r.toString();o&&(n&&(n+=","),n+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Ip(this.topNode,e)}cursorAt(e,n=0,r=0){let o=Db.get(this)||this.topNode,a=new Ip(o);return a.moveTo(e,n),Db.set(this,a._tree),a}get topNode(){return new zi(this,0,0,null)}resolve(e,n=0){let r=Ap(Db.get(this)||this.topNode,e,n,!1);return Db.set(this,r),r}resolveInner(e,n=0){let r=Ap(G4.get(this)||this.topNode,e,n,!0);return G4.set(this,r),r}resolveStack(e,n=0){return xut(this,e,n)}iterate(e){let{enter:n,leave:r,from:o=0,to:a=this.length}=e,i=e.mode||0,s=(i&jr.IncludeAnonymous)>0;for(let l=this.cursor(i|jr.IncludeAnonymous);;){let c=!1;if(l.from<=a&&l.to>=o&&(!s&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(s||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:EL(za.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,o)=>new t(this.type,n,r,o,this.propValues),e.makeTree||((n,r,o)=>new t(za.none,n,r,o)))}static build(e){return wut(e)}};zo.empty=new zo(za.none,[],[],0);var hL=class t{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new t(this.buffer,this.index)}},fl=class t{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return za.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],o=this.set.types[n],a=o.name;if(/\W/.test(a)&&!o.isError&&(a=JSON.stringify(a)),e+=4,r==e)return a;let i=[];for(;e<r;)i.push(this.childString(e)),e=this.buffer[e+3];return a+"("+i.join(",")+")"}findChild(e,n,r,o,a){let{buffer:i}=this,s=-1;for(let l=e;l!=n&&!(W4(a,o,i[l+1],i[l+2])&&(s=l,r>0));l=i[l+3]);return s}slice(e,n,r){let o=this.buffer,a=new Uint16Array(n-e),i=0;for(let s=e,l=0;s<n;){a[l++]=o[s++],a[l++]=o[s++]-r;let c=a[l++]=o[s++]-r;a[l++]=o[s++]-e,i=Math.max(i,c)}return new t(a,i,this.set)}};function W4(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ap(t,e,n,r){for(var o;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let i=!r&&t instanceof zi&&t.index<0?null:t.parent;if(!i)return t;t=i}let a=r?0:jr.IgnoreOverlays;if(r)for(let i=t,s=i.parent;s;i=s,s=i.parent)i instanceof zi&&i.index<0&&((o=s.enter(e,n,a))===null||o===void 0?void 0:o.from)!=i.from&&(t=s);for(;;){let i=t.enter(e,n,a);if(!i)return t;t=i}}var $b=class{cursor(e=0){return new Ip(this,e)}getChild(e,n=null,r=null){let o=$4(this,e,n,r);return o.length?o[0]:null}getChildren(e,n=null,r=null){return $4(this,e,n,r)}resolve(e,n=0){return Ap(this,e,n,!1)}resolveInner(e,n=0){return Ap(this,e,n,!0)}matchContext(e){return gL(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let o=n.lastChild;if(!o||o.to!=n.to)break;o.type.isError&&o.from==o.to?(r=n,n=o.prevSibling):n=o}return r}get node(){return this}get next(){return this.parent}},zi=class t extends $b{constructor(e,n,r,o){super(),this._tree=e,this.from=n,this.index=r,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,o,a=0){for(let i=this;;){for(let{children:s,positions:l}=i._tree,c=n>0?s.length:-1;e!=c;e+=n){let d=s[e],u=l[e]+i.from,f;if(!(!(a&jr.EnterBracketed&&d instanceof zo&&(f=sc.get(d))&&!f.overlay&&f.bracketed&&r>=u&&r<=u+d.length)&&!W4(o,r,u,u+d.length))){if(d instanceof fl){if(a&jr.ExcludeBuffers)continue;let p=d.findChild(0,d.buffer.length,n,r-u,o);if(p>-1)return new Rp(new yL(i,d,e,u),null,p)}else if(a&jr.IncludeAnonymous||!d.type.isAnonymous||wL(d)){let p;if(!(a&jr.IgnoreMounts)&&(p=sc.get(d))&&!p.overlay)return new t(p.tree,u,e,i);let m=new t(d,u,e,i);return a&jr.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?d.children.length-1:0,n,r,o,a)}}}if(a&jr.IncludeAnonymous||!i.type.isAnonymous||(i.index>=0?e=i.index+n:e=n<0?-1:i._parent._tree.children.length,i=i._parent,!i))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,r=0){let o;if(!(r&jr.IgnoreOverlays)&&(o=sc.get(this._tree))&&o.overlay){let a=e-this.from,i=r&jr.EnterBracketed&&o.bracketed;for(let{from:s,to:l}of o.overlay)if((n>0||i?s<=a:s<a)&&(n<0||i?l>=a:l>a))return new t(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function $4(t,e,n,r){let o=t.cursor(),a=[];if(!o.firstChild())return a;if(n!=null){for(let i=!1;!i;)if(i=o.type.is(n),!o.nextSibling())return a}for(;;){if(r!=null&&o.type.is(r))return a;if(o.type.is(e)&&a.push(o.node),!o.nextSibling())return r==null?a:[]}}function gL(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}var yL=class{constructor(e,n,r,o){this.parent=e,this.buffer=n,this.index=r,this.start=o}},Rp=class t extends $b{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:o}=this.context,a=o.findChild(this.index+4,o.buffer[this.index+3],e,n-this.context.start,r);return a<0?null:new t(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,r=0){if(r&jr.ExcludeBuffers)return null;let{buffer:o}=this.context,a=o.findChild(this.index+4,o.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return a<0?null:new t(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,o=this.index+4,a=r.buffer[this.index+3];if(a>o){let i=r.buffer[this.index+1];e.push(r.slice(o,a,i)),n.push(0)}return new zo(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function B4(t){if(!t.length)return null;let e=0,n=t[0];for(let a=1;a<t.length;a++){let i=t[a];(i.from>n.from||i.to<n.to)&&(n=i,e=a)}let r=n instanceof zi&&n.index<0?null:n.parent,o=t.slice();return r?o[e]=r:o.splice(e,1),new bL(o,n)}var bL=class{constructor(e,n){this.heads=e,this.node=n}get next(){return B4(this.heads)}};function xut(t,e,n){let r=t.resolveInner(e,n),o=null;for(let a=r instanceof zi?r:r.context.parent;a;a=a.parent)if(a.index<0){let i=a.parent;(o||(o=[r])).push(i.resolve(e,n)),a=i}else{let i=sc.get(a.tree);if(i&&i.overlay&&i.overlay[0].from<=e&&i.overlay[i.overlay.length-1].to>=e){let s=new zi(i.tree,i.overlay[0].from+a.from,-1,a);(o||(o=[r])).push(Ap(s,e,n,!1))}}return o?B4(o):r}var Ip=class{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~jr.EnterBracketed,e instanceof zi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:o}=this.buffer;return this.type=n||o.set.types[o.buffer[e]],this.from=r+o.buffer[e+1],this.to=r+o.buffer[e+2],!0}yield(e){return e?e instanceof zi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:o}=this.buffer,a=o.findChild(this.index+4,o.buffer[this.index+3],e,n-this.buffer.start,r);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&jr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&jr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&jr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let o=r<0?0:this.stack[r]+4;if(this.index!=o)return this.yieldBuf(n.findChild(o,this.index,-1,0,4))}else{let o=n.buffer[this.index+3];if(o<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(o)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(o.buffer.buffer[a+3]<this.index)return!1;({index:n,parent:r}=o)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let a=n+e,i=e<0?-1:r._tree.children.length;a!=i;a+=e){let s=r._tree.children[a];if(this.mode&jr.IncludeAnonymous||s instanceof fl||!s.type.isAnonymous||wL(s))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)t:for(let o=this.index,a=this.stack.length;a>=0;){for(let i=e;i;i=i._parent)if(i.index==o){if(o==this.index)return i;n=i,r=a+1;break t}o=this.stack[--a]}for(let o=r;o<this.stack.length;o++)n=new Rp(this.buffer,n,this.stack[o]);return this.bufferNode=new Rp(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(o=!0)}for(;;){if(o&&n&&n(this),o=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,o=!0}}}matchContext(e){if(!this.buffer)return gL(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let o=e.length-1,a=this.stack.length-1;o>=0;a--){if(a<0)return gL(this._tree,e,o);let i=r[n.buffer[this.stack[a]]];if(!i.isAnonymous){if(e[o]&&e[o]!=i.name)return!1;o--}}return!0}};function wL(t){return t.children.some(e=>e instanceof fl||!e.type.isAnonymous||wL(e))}function wut(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:o=1024,reused:a=[],minRepeatType:i=r.types.length}=t,s=Array.isArray(n)?new hL(n,n.length):n,l=r.types,c=0,d=0;function u(x,L,v,A,C,M){let{id:w,start:k,end:N,size:_}=s,T=d,R=c;if(_<0)if(s.next(),_==-1){let D=a[w];v.push(D),A.push(k-x);return}else if(_==-3){c=w;return}else if(_==-4){d=w;return}else throw new RangeError(`Unrecognized record size: ${_}`);let G=l[w],I,H,O=k-x;if(N-k<=o&&(H=g(s.pos-L,C))){let D=new Uint16Array(H.size-H.skip),W=s.pos-H.size,z=D.length;for(;s.pos>W;)z=E(H.start,D,z);I=new fl(D,N-H.start,r),O=H.start-x}else{let D=s.pos-_;s.next();let W=[],z=[],P=w>=i?w:-1,B=0,Y=N;for(;s.pos>D;)P>=0&&s.id==P&&s.size>=0?(s.end<=Y-o&&(m(W,z,k,B,s.end,Y,P,T,R),B=W.length,Y=s.end),s.next()):M>2500?f(k,D,W,z):u(k,D,W,z,P,M+1);if(P>=0&&B>0&&B<W.length&&m(W,z,k,B,k,Y,P,T,R),W.reverse(),z.reverse(),P>-1&&B>0){let V=p(G,R);I=EL(G,W,z,0,W.length,0,N-k,V,V)}else I=h(G,W,z,N-k,T-N,R)}v.push(I),A.push(O)}function f(x,L,v,A){let C=[],M=0,w=-1;for(;s.pos>L;){let{id:k,start:N,end:_,size:T}=s;if(T>4)s.next();else{if(w>-1&&N<w)break;w<0&&(w=_-o),C.push(k,N,_),M++,s.next()}}if(M){let k=new Uint16Array(M*4),N=C[C.length-2];for(let _=C.length-3,T=0;_>=0;_-=3)k[T++]=C[_],k[T++]=C[_+1]-N,k[T++]=C[_+2]-N,k[T++]=T;v.push(new fl(k,C[2]-N,r)),A.push(N-x)}}function p(x,L){return(v,A,C)=>{let M=0,w=v.length-1,k,N;if(w>=0&&(k=v[w])instanceof zo){if(!w&&k.type==x&&k.length==C)return k;(N=k.prop(hr.lookAhead))&&(M=A[w]+k.length+N)}return h(x,v,A,C,M,L)}}function m(x,L,v,A,C,M,w,k,N){let _=[],T=[];for(;x.length>A;)_.push(x.pop()),T.push(L.pop()+v-C);x.push(h(r.types[w],_,T,M-C,k-M,N)),L.push(C-v)}function h(x,L,v,A,C,M,w){if(M){let k=[hr.contextHash,M];w=w?[k].concat(w):[k]}if(C>25){let k=[hr.lookAhead,C];w=w?[k].concat(w):[k]}return new zo(x,L,v,A,w)}function g(x,L){let v=s.fork(),A=0,C=0,M=0,w=v.end-o,k={size:0,start:0,skip:0};t:for(let N=v.pos-x;v.pos>N;){let _=v.size;if(v.id==L&&_>=0){k.size=A,k.start=C,k.skip=M,M+=4,A+=4,v.next();continue}let T=v.pos-_;if(_<0||T<N||v.start<w)break;let R=v.id>=i?4:0,G=v.start;for(v.next();v.pos>T;){if(v.size<0)if(v.size==-3||v.size==-4)R+=4;else break t;else v.id>=i&&(R+=4);v.next()}C=G,A+=_,M+=R}return(L<0||A==x)&&(k.size=A,k.start=C,k.skip=M),k.size>4?k:void 0}function E(x,L,v){let{id:A,start:C,end:M,size:w}=s;if(s.next(),w>=0&&A<i){let k=v;if(w>4){let N=s.pos-(w-4);for(;s.pos>N;)v=E(x,L,v)}L[--v]=k,L[--v]=M-x,L[--v]=C-x,L[--v]=A}else w==-3?c=A:w==-4&&(d=A);return v}let y=[],b=[];for(;s.pos>0;)u(t.start||0,t.bufferStart||0,y,b,-1,0);let S=(e=t.length)!==null&&e!==void 0?e:y.length?b[0]+y[0].length:0;return new zo(l[t.topID],y.reverse(),b.reverse(),S)}var H4=new WeakMap;function Ob(t,e){if(!t.isAnonymous||e instanceof fl||e.type!=t)return 1;let n=H4.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof zo)){n=1;break}n+=Ob(t,r)}H4.set(e,n)}return n}function EL(t,e,n,r,o,a,i,s,l){let c=0;for(let m=r;m<o;m++)c+=Ob(t,e[m]);let d=Math.ceil(c*1.5/8),u=[],f=[];function p(m,h,g,E,y){for(let b=g;b<E;){let S=b,x=h[b],L=Ob(t,m[b]);for(b++;b<E;b++){let v=Ob(t,m[b]);if(L+v>=d)break;L+=v}if(b==S+1){if(L>d){let v=m[S];p(v.children,v.positions,0,v.children.length,h[S]+y);continue}u.push(m[S])}else{let v=h[b-1]+m[b-1].length-x;u.push(EL(t,m,h,S,b,x,v,null,l))}f.push(x+y-a)}}return p(e,n,r,o,0),(s||l)(u,f,i)}var Hb=class{startParse(e,n,r){return typeof e=="string"&&(e=new xL(e)),r=r?r.length?r.map(o=>new _p(o.from,o.to)):[new _p(0,0)]:[new _p(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let o=this.startParse(e,n,r);for(;;){let a=o.advance();if(a)return a}}},xL=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}};var aOt=new hr({perNode:!0});var vL=class t{constructor(e,n,r,o,a,i,s,l,c,d=0,u){this.p=e,this.stack=n,this.state=r,this.reducePos=o,this.pos=a,this.score=i,this.buffer=s,this.bufferBase=l,this.curContext=c,this.lookAhead=d,this.parent=u}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let o=e.parser.context;return new t(e,[],n,r,r,0,[],0,o?new Wb(o,o.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,o=e&65535,{parser:a}=this.p,i=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),s=a.dynamicPrecedence(o);if(s&&(this.score+=s),r==0){o<a.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(a.getGoto(this.state,o,!0),this.reducePos),o<a.minRepeatTerm&&this.storeNode(o,this.reducePos,this.reducePos,i?8:4,!0),this.reduceContext(o,this.reducePos);return}let l=this.stack.length-(r-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from;o<a.minRepeatTerm&&c==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let d=this.reducePos-c;d>=2e3&&!(!((n=this.p.parser.nodeSet.types[o])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=d):this.p.lastBigReductionSize<d&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=d));let u=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-u;if(o<a.minRepeatTerm||e&131072){let p=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(o,c,p,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let p=this.stack[l-3];this.state=a.getGoto(p,o,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(o,c)}storeNode(e,n,r,o=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let i=this.buffer.length;if(i>0&&this.buffer[i-4]==0&&this.buffer[i-1]>-1){if(n==r)return;if(this.buffer[i-2]>=n){this.buffer[i-2]=r;return}}}if(!a||this.pos==r)this.buffer.push(e,n,r,o);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let s=!1;for(let l=i;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){s=!0;break}if(s)for(;i>0&&this.buffer[i-2]>r;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,o>4&&(o-=4)}this.buffer[i]=e,this.buffer[i+1]=n,this.buffer[i+2]=r,this.buffer[i+3]=o}}shift(e,n,r,o){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let a=e,{parser:i}=this.p;this.pos=o;let s=i.stateFlag(a,1);!s&&(o>r||n<=i.maxNode)&&(this.reducePos=o),this.pushState(a,s?r:Math.min(r,this.reducePos)),this.shiftContext(n,r),n<=i.maxNode&&this.buffer.push(n,r,o,4)}else this.pos=o,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,o,4)}apply(e,n,r,o){e&65536?this.reduce(e):this.shift(e,n,r,o)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let o=this.pos;this.reducePos=this.pos=o+e.length,this.pushState(n,o),this.buffer.push(r,o,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(n&&e.buffer[n-4]==0&&(n-=4);n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),o=e.bufferBase+n;for(;e&&o==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,o,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new kL(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let o=[];for(let a=0,i;a<n.length;a+=2)(i=n[a+1])!=this.state&&this.p.parser.hasAction(i,e)&&o.push(n[a],i);if(this.stack.length<120)for(let a=0;o.length<8&&a<n.length;a+=2){let i=n[a+1];o.some((s,l)=>l&1&&s==i)||o.push(n[a],i)}n=o}let r=[];for(let o=0;o<n.length&&r.length<4;o+=2){let a=n[o+1];if(a==this.state)continue;let i=this.split();i.pushState(a,this.pos),i.storeNode(0,i.pos,i.pos,4,!0),i.shiftContext(n[o],this.pos),i.reducePos=this.pos,i.score-=200,r.push(i)}return r}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let r=n>>19,o=n&65535,a=this.stack.length-r*3;if(a<0||e.getGoto(this.stack[a],o,!1)<0){let i=this.findForcedReduction();if(i==null)return!1;n=i}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(o,a)=>{if(!n.includes(o))return n.push(o),e.allActions(o,i=>{if(!(i&393216))if(i&65536){let s=(i>>19)-a;if(s>1){let l=i&65535,c=this.stack.length-s*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return s<<19|65536|l}}else{let s=r(i,a+1);if(s!=null)return s}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new Wb(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Wb=class{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}},kL=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let o=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=o}},LL=class t{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new t(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Pp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,o=0;r<t.length;){let a=0;for(;;){let i=t.charCodeAt(r++),s=!1;if(i==126){a=65535;break}i>=92&&i--,i>=34&&i--;let l=i-32;if(l>=46&&(l-=46,s=!0),a+=l,s)break;a*=46}n?n[o++]=a:n=new e(a)}return n}var lu=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},F4=new lu,NL=class{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=F4,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,o=this.rangeIndex,a=this.pos+e;for(;a<r.from;){if(!o)return null;let i=this.ranges[--o];a-=r.from-i.to,r=i}for(;n<0?a>r.to:a>=r.to;){if(o==this.ranges.length-1)return null;let i=this.ranges[++o];a+=i.from-r.to,r=i}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,o;if(n>=0&&n<this.chunk.length)r=this.pos+e,o=this.chunk.charCodeAt(n);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(r=a,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)o=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let i=this.rangeIndex,s=this.range;for(;s.to<=r;)s=this.ranges[++i];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>s.to&&(this.chunk2=this.chunk2.slice(0,s.to-r)),o=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),o}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=F4,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(e>=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let o of this.ranges){if(o.from>=n)break;o.to>e&&(r+=this.input.read(Math.max(o.from,e),Math.min(o.to,n)))}return r}},pl=class{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;X4(this.data,e,n,this.id,r.data,r.tokenPrecTable)}};pl.prototype.contextual=pl.prototype.fallback=pl.prototype.extend=!1;var ML=class{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?Pp(e):e}token(e,n){let r=e.pos,o=0;for(;;){let a=e.next<0,i=e.resolveOffset(1,1);if(X4(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(a||o++,i==null)break;e.reset(i,e.token)}o&&(e.reset(r,e.token),e.acceptToken(this.elseToken,o))}};ML.prototype.contextual=pl.prototype.fallback=pl.prototype.extend=!1;function X4(t,e,n,r,o,a){let i=0,s=1<<r,{dialect:l}=n.p.parser;t:for(;(s&t[i])!=0;){let c=t[i+1];for(let p=i+3;p<c;p+=2)if((t[p+1]&s)>0){let m=t[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||Sut(m,e.token.value,o,a))){e.acceptToken(m);break}}let d=e.next,u=0,f=t[i+2];if(e.next<0&&f>u&&t[c+f*3-3]==65535){i=t[c+f*3-1];continue t}for(;u<f;){let p=u+f>>1,m=c+p+(p<<1),h=t[m],g=t[m+1]||65536;if(d<h)f=p;else if(d>=g)u=p+1;else{i=t[m+2],e.advance();continue t}}break}}function Y4(t,e,n){for(let r=e,o;(o=t[r])!=65535;r++)if(o==n)return r-e;return-1}function Sut(t,e,n,r){let o=Y4(n,r,e);return o<0||Y4(n,r,t)<o}var pa=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),SL=null;function z4(t,e,n){let r=t.cursor(jr.IncludeAnonymous);for(r.moveTo(e);;)if(!(n<0?r.childBefore(e):r.childAfter(e)))for(;;){if((n<0?r.to<e:r.from>e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}var TL=class{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?z4(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?z4(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let r=this.trees[n],o=this.index[n];if(o==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=r.children[o],i=this.start[n]+r.positions[o];if(i>e)return this.nextStart=i,null;if(a instanceof zo){if(i==e){if(i<this.safeFrom)return null;let s=i+a.length;if(s<=this.safeTo){let l=a.prop(hr.lookAhead);if(!l||s+l<this.fragment.to)return a}}this.index[n]++,i+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(i),this.index.push(0))}else this.index[n]++,this.nextStart=i+a.length}}},CL=class{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new lu)}getActions(e){let n=0,r=null,{parser:o}=e.p,{tokenizers:a}=o,i=o.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<a.length;c++){if((1<<c&i)==0)continue;let d=a[c],u=this.tokens[c];if(!(r&&!d.fallback)&&((d.contextual||u.start!=e.pos||u.mask!=i||u.context!=s)&&(this.updateCachedToken(u,d,e),u.mask=i,u.context=s),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=n;if(u.extended>-1&&(n=this.addActions(e,u.extended,u.end,n)),n=this.addActions(e,u.value,u.end,n),!d.extend&&(r=u,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new lu,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new lu,{pos:r,p:o}=e;return n.start=r,n.end=Math.min(r+1,o.stream.end),n.value=r==o.stream.end?o.parser.eofTerm:0,n}updateCachedToken(e,n,r){let o=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(o,e),r),e.value>-1){let{parser:a}=r.p;for(let i=0;i<a.specialized.length;i++)if(a.specialized[i]==e.value){let s=a.specializers[i](this.stream.read(e.start,e.end),r);if(s>=0&&r.p.parser.dialect.allows(s>>1)){(s&1)==0?e.value=s>>1:e.extended=s>>1;break}}}else e.value=0,e.end=this.stream.clipPos(o+1)}putAction(e,n,r,o){for(let a=0;a<o;a+=3)if(this.actions[a]==e)return o;return this.actions[o++]=e,this.actions[o++]=n,this.actions[o++]=r,o}addActions(e,n,r,o){let{state:a}=e,{parser:i}=e.p,{data:s}=i;for(let l=0;l<2;l++)for(let c=i.stateSlot(a,l?2:1);;c+=3){if(s[c]==65535)if(s[c+1]==1)c=xs(s,c+2);else{o==0&&s[c+1]==2&&(o=this.putAction(xs(s,c+2),n,r,o));break}s[c]==n&&(o=this.putAction(xs(s,c+1),n,r,o))}return o}},_L=class{constructor(e,n,r,o){this.parser=e,this.input=n,this.ranges=o,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new NL(n,o),this.tokens=new CL(e,this.stream),this.topTerm=e.top[1];let{from:a}=o[0];this.stacks=[vL.start(this,e.top[0],a)],this.fragments=r.length&&this.stream.end-a>e.bufferLength*4?new TL(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],o,a;if(this.bigReductionCount>300&&e.length==1){let[i]=e;for(;i.forceReduce()&&i.stack.length&&i.stack[i.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let i=0;i<e.length;i++){let s=e[i];for(;;){if(this.tokens.mainToken=null,s.pos>n)r.push(s);else{if(this.advanceStack(s,r,e))continue;{o||(o=[],a=[]),o.push(s);let l=this.tokens.getMainToken(s);a.push(l.value,l.end)}}break}}if(!r.length){let i=o&&vut(o);if(i)return pa&&console.log("Finish with "+this.stackID(i)),this.stackToTree(i);if(this.parser.strict)throw pa&&o&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&o){let i=this.stoppedAt!=null&&o[0].pos>this.stoppedAt?o[0]:this.runRecovery(o,a,r);if(i)return pa&&console.log("Force-finish "+this.stackID(i)),this.stackToTree(i.forceAll())}if(this.recovering){let i=this.recovering==1?1:this.recovering*3;if(r.length>i)for(r.sort((s,l)=>l.score-s.score);r.length>i;)r.pop();r.some(s=>s.reducePos>n)&&this.recovering--}else if(r.length>1){t:for(let i=0;i<r.length-1;i++){let s=r[i];for(let l=i+1;l<r.length;l++){let c=r[l];if(s.sameState(c)||s.buffer.length>500&&c.buffer.length>500)if((s.score-c.score||s.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(i--,1);continue t}}}r.length>12&&(r.sort((i,s)=>s.score-i.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let i=1;i<r.length;i++)r[i].pos<this.minStackPos&&(this.minStackPos=r[i].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,r){let o=e.pos,{parser:a}=this,i=pa?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&o>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,d=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(o);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?a.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(hr.contextHash)||0)==d))return e.useNode(u,f),pa&&console.log(i+this.stackID(e)+` (via reuse of ${a.getName(u.type.id)})`),!0;if(!(u instanceof zo)||u.children.length==0||u.positions[0]>0)break;let p=u.children[0];if(p instanceof zo&&u.positions[0]==0)u=p;else break}}let s=a.stateSlot(e.state,4);if(s>0)return e.reduce(s),pa&&console.log(i+this.stackID(e)+` (via always-reduce ${a.getName(s&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let d=l[c++],u=l[c++],f=l[c++],p=c==l.length||!r,m=p?e:e.split(),h=this.tokens.mainToken;if(m.apply(d,u,h?h.start:m.pos,f),pa&&console.log(i+this.stackID(m)+` (via ${(d&65536)==0?"shift":`reduce of ${a.getName(d&65535)}`} for ${a.getName(u)} @ ${o}${m==e?"":", split"})`),p)return!0;m.pos>o?n.push(m):r.push(m)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return V4(e,n),!0}}runRecovery(e,n,r){let o=null,a=!1;for(let i=0;i<e.length;i++){let s=e[i],l=n[i<<1],c=n[(i<<1)+1],d=pa?this.stackID(s)+" -> ":"";if(s.deadEnd&&(a||(a=!0,s.restart(),pa&&console.log(d+this.stackID(s)+" (restarted)"),this.advanceFully(s,r))))continue;let u=s.split(),f=d;for(let p=0;p<10&&u.forceReduce()&&(pa&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));p++)pa&&(f=this.stackID(u)+" -> ");for(let p of s.recoverByInsert(l))pa&&console.log(d+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,r);this.stream.end>s.pos?(c==s.pos&&(c++,l=0),s.recoverByDelete(l,c),pa&&console.log(d+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),V4(s,r)):(!o||o.score<u.score)&&(o=u)}return o}stackToTree(e){return e.close(),zo.build({buffer:LL.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(SL||(SL=new WeakMap)).get(e);return n||SL.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}};function V4(t,e){for(let n=0;n<e.length;n++){let r=e[n];if(r.pos==t.pos&&r.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}var AL=class{constructor(e,n,r){this.source=e,this.flags=n,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}};var Bb=class t extends Hb{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let s=0;s<e.repeatNodeCount;s++)n.push("");let r=Object.keys(e.topRules).map(s=>e.topRules[s][1]),o=[];for(let s=0;s<n.length;s++)o.push([]);function a(s,l,c){o[s].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let s of e.nodeProps){let l=s[0];typeof l=="string"&&(l=hr[l]);for(let c=1;c<s.length;){let d=s[c++];if(d>=0)a(d,l,s[c++]);else{let u=s[c+-d];for(let f=-d;f>0;f--)a(s[c++],l,u);c++}}}this.nodeSet=new Gb(n.map((s,l)=>za.define({name:l>=this.minRepeatTerm?void 0:s,id:l,props:o[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let i=Pp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let s=0;s<this.specializerSpecs.length;s++)this.specialized[s]=this.specializerSpecs[s].term;this.specializers=this.specializerSpecs.map(U4),this.states=Pp(e.states,Uint32Array),this.data=Pp(e.stateData),this.goto=Pp(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(s=>typeof s=="number"?new pl(i,s):s),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let o=new _L(this,e,n,r);for(let a of this.wrappers)o=a(o,e,n,r);return o}getGoto(e,n,r=!1){let o=this.goto;if(n>=o[0])return-1;for(let a=o[n+1];;){let i=o[a++],s=i&1,l=o[a++];if(s&&r)return l;for(let c=a+(i>>1);a<c;a++)if(o[a]==e)return l;if(s)return-1}}hasAction(e,n){let r=this.data;for(let o=0;o<2;o++)for(let a=this.stateSlot(e,o?2:1),i;;a+=3){if((i=r[a])==65535)if(r[a+1]==1)i=r[a=xs(r,a+2)];else{if(r[a+1]==2)return xs(r,a+2);break}if(i==n||i==0)return xs(r,a+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),o=r?n(r):void 0;for(let a=this.stateSlot(e,1);o==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=xs(this.data,a+2);else break;o=n(xs(this.data,a+1))}return o}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=xs(this.data,r+2);else break;if((this.data[r+2]&1)==0){let o=this.data[r+1];n.some((a,i)=>i&1&&a==o)||n.push(this.data[r],o)}}return n}configure(e){let n=Object.assign(Object.create(t.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let o=e.tokenizers.find(a=>a.from==r);return o?o.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,o)=>{let a=e.specializers.find(s=>s.from==r.external);if(!a)return r;let i=Object.assign(Object.assign({},r),{external:a.to});return n.specializers[o]=U4(i),i})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let a of e.split(" ")){let i=n.indexOf(a);i>=0&&(r[i]=!0)}let o=null;for(let a=0;a<n.length;a++)if(!r[a])for(let i=this.dialects[n[a]],s;(s=this.data[i++])!=65535;)(o||(o=new Uint8Array(this.maxTerm+1)))[s]=1;return new AL(e,r,o)}static deserialize(e){return new t(e)}};function xs(t,e){return t[e]|t[e+1]<<16}function vut(t){let e=null;for(let n of t){let r=n.p.stoppedAt;(n.pos==n.p.stream.end||r!=null&&n.pos>r)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function U4(t){if(t.external){let e=t.extend?1:0;return(n,r)=>t.external(n,r)<<1|e}return t.get}Gl();var j4=new Set(["sequence","flowchart","class","er","org","kanban","c4","state","sitemap","infra","gantt","pert","boxes-and-lines","swimlane","version-control","wireframe","tech-radar","mindmap","journey-map","pyramid","ring","treemap","block","raci","cycle","bar","line","pie","polar-area","radar","scatter","sankey","function","heatmap","funnel","slope","wordcloud","arc","timeline","event-line","venn","quadrant","map"]);var q4="tag",K4=new Set([...H2]),Z4=new Set([...W2]),Q4=new Set([...B2]),J4=new Set([...F2]);function RL(t){return j4.has(t)?1:t===q4?2:K4.has(t)?3:Z4.has(t)?4:Q4.has(t)?5:J4.has(t)?5:-1}var t5=Bb.deserialize({version:14,states:"!WQVQPOOOOQO'#DU'#DUOOQO'#DP'#DPO%]QPO'#CdOOQO'#DO'#DOQVQPOOOOQO-E6}-E6}OOQO,59O,59OOOQO-E6|-E6|",stateData:"&Q~OvOS~OPPOQPORPOSPOTPOVSOXPOYPOZPO[PO]PO^PO_PO`POaPObPOcPOdPOePOfPOgPOhPOiPOjPOkPOlPOmPOnPOoPOpPOqPOwSO~OPPOQPORPOSPOTPOXPOYPOZPO[PO]PO^PO_PO`POaPObPOcPOdPOePOfPOgPOhPOiPOjPOkPOlPOmPOnPOoPOpPOqPO~OwVO~P#]OVXYZ[]^_`ghijklmnabcdefopqk~",goto:"!byPPPPPPPPzPPPPPPPPPPPPPPPPPPPPPPPPP!O!UPPPP!]TSOTQTORWTSROTRURVQORT",nodeNames:"\u26A0 ChartType TagKeyword DirectiveKeyword ControlKeyword ModifierKeyword Document Comment ContentLine SyncArrow AsyncArrow Duration DateLiteral Percentage Number SectionMarker Url OpenBracket CloseBracket OpenParen CloseParen OpenAngle CloseAngle Pipe Colon Comma Plus Dash Tilde Star Question QuotedString Identifier Punct",maxTerm:40,skippedNodes:[0],repeatNodeCount:2,tokenData:"<v~RzOX#uXY#zYZ$VZp#upq#zqr#urs$[st#uux#uxy%eyz%lz{%s{|%z|}&R}!O&Y!O!P#u!P!Q&i!Q!['Y![!]/{!]!^#u!^!_0S!_!`0Z!`!a0h!a!b0o!b!c#u!c!}0v!}#O3|#O#P#u#P#Q4R#Q#R#u#R#S0v#S#T#u#T#[0v#[#]4Y#]#o0v#o#p#u#p#q<Y#q#r#u#r#s<a#s;'S#u;'S;=`<p<%lO#u~#zOq~~$PQv~XY#zpq#z~$[Ow~~$aUq~OY$sZr$srs%Ys;'S$s;'S;=`%_<%lO$s~$vUOY$sZr$srs%Ys;'S$s;'S;=`%_<%lO$s~%_Oo~~%bP;=`<%l$s~%lOc~q~~%sOd~q~~%zOm~q~~&ROj~q~~&YOi~q~~&aPk~q~!`!a&d~&iOX~~&nPq~!P!Q&q~&vSV~OY&qZ;'S&q;'S;=`'S<%lO&q~'VP;=`<%l&q~'a]^~q~uv(Y|}(_!O!P)[!Q![*{#R#S/g#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~(_O]~~(bP!Q![(e~(hP!Q![(k~(nP!Q![(q~(vQ^~|}(_!O!P(|~)PP!Q![)S~)XP^~!Q![)S~)_P!Q![)b~)gY^~uv(Y!Q![)b#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~*YP#W#X*]~*bPZ~!a!b*e~*jOZ~~*oQZ~!a!b*e#]#^*u~*xP#b#c*]~+Q]^~uv(Y|}(_!O!P)[!Q![+y#R#S/g#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~,O]^~uv(Y|}(_!O!P)[!Q![,w#R#S/g#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~,|]^~uv(Y}!O-u!O!P)[!Q![.l#R#S/g#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~-xP!Q![-{~.OP!Q![.R~.WP[~}!O.Z~.^P!Q![.a~.dP!Q![.g~.lO[~~.q[^~uv(Y!O!P)[!Q![.l#R#S/g#U#V*V#W#X*]#[#]*]#a#b*j#e#f*]#g#h*]#k#l*]#m#n*]~/jP!Q![/m~/rR^~!O!P(|!Q![/m#R#S/g~0SOh~q~~0ZOe~q~~0`Pq~!_!`0c~0hO_~~0oOf~q~~0vOn~q~~0}_p~q~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#o1|~2R_p~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#o1|~3T]qr1|st1|vw1|wx1|{|1|!O!P1|!P!Q1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#o1|~4ROa~~4YOb~q~~4aap~q~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#h1|#h#i5f#i#o1|~5kap~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#h1|#h#i6p#i#o1|~6uap~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#d1|#d#e7z#e#o1|~8Pbp~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|![!]9X!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#g1|#g#h;R#h#o1|~9[P!P!Q9_~9bP!P!Q9e~9hYOX:WZp:Wqy:Wz|:W}!`:W!a#P:W#Q#p:W#q;'S:W;'S;=`:{<%lO:W~:]Y`~OX:WZp:Wqy:Wz|:W}!`:W!a#P:W#Q#p:W#q;'S:W;'S;=`:{<%lO:W~;OP;=`<%l:W~;W`p~qr1|st1|vw1|wx1|{|1|}!O3Q!O!P1|!P!Q1|!Q![1|![!]9X!_!`1|!a!b1|!b!c1|!c!}1|#R#S1|#T#o1|~<aOg~q~~<hPl~q~!`!a<k~<pOY~~<sP;=`<%l#u",tokenizers:[0],topRules:{Document:[0,6]},specialized:[{term:32,get:(t,e)=>RL(t,e)<<1,external:RL}],tokenPrec:204});Gl();var IL={Comment:"comment",ChartType:"chartType",TagKeyword:"definitionKeyword",DirectiveKeyword:"keyword",ControlKeyword:"controlKeyword",ModifierKeyword:"modifier",SyncArrow:"operator",AsyncArrow:"operator",Dash:"operator",Tilde:"operator",Star:"operator",Question:"operator",Duration:"number",DateLiteral:"number",Number:"number",Percentage:"number",SectionMarker:"heading",Url:"url",OpenBracket:"bracket",CloseBracket:"bracket",OpenParen:"bracket",CloseParen:"bracket",OpenAngle:"bracket",CloseAngle:"bracket",Pipe:"deprecatedSyntax",Colon:"separator",Plus:"separator",Comma:"punctuation",Punct:"punctuation",QuotedString:"string",Identifier:"default"},Lut=new Set(["ChartType","TagKeyword","DirectiveKeyword","ControlKeyword","ModifierKeyword","Number","Percentage","Duration","DateLiteral"]),Nut=new Set(["TagKeyword","DirectiveKeyword","ControlKeyword","ModifierKeyword","SectionMarker","Comment","Duration","DateLiteral"]);function e5(t){let e=t5.parse(t),n=[],r=0,o=e.cursor();function a(){for(;;)if(!o.firstChild()){for(i();!o.nextSibling();)if(!o.parent())return}}function i(){let s=o.from,l=o.to;if(s>r&&n.push({text:t.slice(r,s),role:"default"}),l>s){let c=IL[o.name]??"default";n.push({text:t.slice(s,l),role:c})}r=l}return a(),r<t.length&&n.push({text:t.slice(r,t.length),role:"default"}),Tut(n),Cut(n),Aut(n),n}var Mut=new Set(["emotion","role","icon","location","email","phone","type","domain","assignee","due","status","progress","offset","confidence","width","fanout","description","score","pain","opportunity","thought","collapsed","tech","span","split","size","value","label","style","heat",...Y2]);function Tut(t){for(let e=0;e<t.length-1;e++){let n=t[e];if(n.role!=="default"||!Mut.has(n.text))continue;let r=e+1;for(;r<t.length&&t[r].role==="default"&&t[r].text.trim()==="";)r++;r<t.length&&t[r].text===":"&&t[r].role==="separator"&&(n.role="propertyName")}}function Cut(t){let e={};for(let[o,a]of Object.entries(IL))(e[a]??=[]).push(o);let n=[[]];for(let o=0;o<t.length;o++){let a=t[o],i=n[n.length-1],s=a.role,l="";for(let[c,d]of Object.entries(IL))if(d===s){l=c;break}if(s==="operator"){let c=a.text;c==="->"||c.endsWith("->")?l="SyncArrow":c==="~>"||c.endsWith("~>")?l="AsyncArrow":c==="-"?l="Dash":c==="~"?l="Tilde":c==="*"?l="Star":c==="?"&&(l="Question")}else if(s==="number"){let c=a.text;/^\d+[smhd]$/i.test(c)?l="Duration":/^\d{4}-\d{2}-\d{2}/.test(c)?l="DateLiteral":c.endsWith("%")?l="Percentage":l="Number"}else if(s==="bracket"){let c=a.text;c==="["?l="OpenBracket":c==="]"?l="CloseBracket":c==="("?l="OpenParen":c===")"?l="CloseParen":c==="<"?l="OpenAngle":c===">"&&(l="CloseAngle")}else s==="separator"?a.text===":"?l="Colon":a.text==="+"&&(l="Plus"):s==="deprecatedSyntax"?a.text==="|"&&(l="Pipe"):s==="punctuation"&&(a.text===","?l="Comma":l="Punct");i.push({idx:o,nodeName:l}),a.text.includes(`
@@ -525,7 +525,7 @@ pre.dgmo, code.language-dgmo, pre > code.language-dgmo,
525
525
  .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-comment,
526
526
  .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-noteContent,
527
527
  .dgmo-rendered.dgmo-theme-dark .dgmo-source-pre .dgmo-tok-punctuation { color: #616e88; }
528
- `;qu();var Yb="0.44.0",r5="https://online.diagrammo.app",Iut=200,Put=1200,Dut="[dgmo]",Out=/[\x00-\x1F‪-‮⁦-⁩]/g,PL="dgmoAutoStyles";function Gut(...t){typeof console<"u"&&console.warn&&console.warn(Dut,...t)}function o5(t){t.querySelectorAll("script, foreignObject").forEach(r=>r.remove());let n=[t,...Array.from(t.querySelectorAll("*"))];for(let r of n){for(let o of Array.from(r.attributes))o.name.toLowerCase().startsWith("on")&&r.removeAttribute(o.name);if(r.hasAttribute("href")&&vi(r.getAttribute("href"))===null&&r.removeAttribute("href"),r.hasAttributeNS("http://www.w3.org/1999/xlink","href")){let o=r.getAttributeNS("http://www.w3.org/1999/xlink","href");vi(o)===null&&r.removeAttributeNS("http://www.w3.org/1999/xlink","href")}}}function DL(t){if(t==="light"||t==="dark"||t==="transparent")return t;if(typeof document>"u")return"light";let e=document.documentElement,n=e.getAttribute("data-theme");return n==="dark"?"dark":n==="light"?"light":e.classList.contains("dark")?"dark":e.classList.contains("light")?"light":typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function OL(){if(typeof document>"u")return;let t=document.documentElement;if(t?.dataset?.[PL]==="1")return;if(document.querySelector('link[rel="stylesheet"][href*="auto.css"]')){t&&t.dataset&&(t.dataset[PL]="1");return}let n=document.createElement("style");n.setAttribute("data-dgmo-auto",""),n.textContent=n5,document.head.appendChild(n),t&&t.dataset&&(t.dataset[PL]="1")}function a5(t){let e=t.split(`
528
+ `;qu();var Yb="0.45.0",r5="https://online.diagrammo.app",Iut=200,Put=1200,Dut="[dgmo]",Out=/[\x00-\x1F‪-‮⁦-⁩]/g,PL="dgmoAutoStyles";function Gut(...t){typeof console<"u"&&console.warn&&console.warn(Dut,...t)}function o5(t){t.querySelectorAll("script, foreignObject").forEach(r=>r.remove());let n=[t,...Array.from(t.querySelectorAll("*"))];for(let r of n){for(let o of Array.from(r.attributes))o.name.toLowerCase().startsWith("on")&&r.removeAttribute(o.name);if(r.hasAttribute("href")&&vi(r.getAttribute("href"))===null&&r.removeAttribute("href"),r.hasAttributeNS("http://www.w3.org/1999/xlink","href")){let o=r.getAttributeNS("http://www.w3.org/1999/xlink","href");vi(o)===null&&r.removeAttributeNS("http://www.w3.org/1999/xlink","href")}}}function DL(t){if(t==="light"||t==="dark"||t==="transparent")return t;if(typeof document>"u")return"light";let e=document.documentElement,n=e.getAttribute("data-theme");return n==="dark"?"dark":n==="light"?"light":e.classList.contains("dark")?"dark":e.classList.contains("light")?"light":typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function OL(){if(typeof document>"u")return;let t=document.documentElement;if(t?.dataset?.[PL]==="1")return;if(document.querySelector('link[rel="stylesheet"][href*="auto.css"]')){t&&t.dataset&&(t.dataset[PL]="1");return}let n=document.createElement("style");n.setAttribute("data-dgmo-auto",""),n.textContent=n5,document.head.appendChild(n),t&&t.dataset&&(t.dataset[PL]="1")}function a5(t){let e=t.split(`
529
529
  `).map(n=>n.trim()).find(n=>n.length>0);return e?e.replace(Out,"").slice(0,Iut):"DGMO diagram"}function $ut(t){let e=document.createDocumentFragment(),n;try{n=e5(t)}catch{return e.appendChild(document.createTextNode(t)),e}for(let r of n){if(!r.text)continue;let o=document.createElement("span");o.className=`dgmo-tok-${r.role}`,o.textContent=r.text,e.appendChild(o)}return e}var i5='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="5.5" y="5.5" width="8" height="8" rx="1.5"/><path d="M10.5 5.5V3a1.5 1.5 0 0 0-1.5-1.5H3A1.5 1.5 0 0 0 1.5 3v6A1.5 1.5 0 0 0 3 10.5h2.5"/></svg>',Hut='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3 8.5 6.5 12 13 4.5"/></svg>',Wut='<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 2h5v5"/><path d="M14 2L7 9"/><path d="M13 9v4a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4"/></svg>';function Fb(t,e){t.innerHTML=e}function s5(t,e,n){let r=document.createElement("div");r.className="dgmo-source-panel";let o=document.createElement("button");o.type="button",o.className="dgmo-source-toggle",o.setAttribute("aria-expanded","false");let a=document.createElement("span");a.className="dgmo-chevron",a.setAttribute("aria-hidden","true"),a.textContent="\u25B8",o.appendChild(a);let i=document.createElement("span");i.textContent="DGMO source",o.appendChild(i);let s=document.createElement("div");s.className="dgmo-source-body";let l=document.createElement("pre");l.className="dgmo-source-pre",l.appendChild($ut(t)),s.appendChild(l);let c=document.createElement("div");c.className="dgmo-source-actions";let d=document.createElement("button");if(d.type="button",d.className="dgmo-btn dgmo-btn-copy",d.setAttribute("aria-label","Copy DGMO source"),d.title="Copy source",Fb(d,i5),d.addEventListener("click",()=>{But(t,d)}),c.appendChild(d),n){let u=document.createElement("a");u.className="dgmo-btn dgmo-btn-editor",u.target="_blank",u.rel="noopener noreferrer",u.setAttribute("aria-label","Open in editor"),Fb(u,Wut),e?(u.href=e,u.title="Open in editor"):(u.setAttribute("aria-disabled","true"),u.title="Diagram too large for share link; copy source and paste into editor",u.addEventListener("click",f=>f.preventDefault())),c.appendChild(u)}return s.appendChild(c),r.appendChild(o),r.appendChild(s),o.addEventListener("click",()=>{let u=s.classList.toggle("dgmo-open");o.setAttribute("aria-expanded",u?"true":"false")}),r}async function But(t,e){let n=!1;try{navigator?.clipboard?.writeText&&(await navigator.clipboard.writeText(t),n=!0)}catch{}if(!n&&typeof document<"u")try{let r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r),r.select(),n=document.execCommand("copy"),document.body.removeChild(r)}catch{n=!1}n?(Fb(e,Hut),e.classList.add("dgmo-btn-copied"),setTimeout(()=>{Fb(e,i5),e.classList.remove("dgmo-btn-copied")},Put)):Gut("clipboard write failed")}function cu(t){let e=document.createElement("div");e.className="dgmo-error-banner",e.setAttribute("role","alert");let n=document.createElement("div");if(n.className="dgmo-error-banner-title",n.textContent=`${t.severity??"error"}: ${t.message}`,e.appendChild(n),t.line!==void 0&&t.line>0){let r=document.createElement("div");r.className="dgmo-error-banner-loc",r.textContent=t.column!==void 0?`at ${t.line}:${t.column}`:`at line ${t.line}`,e.appendChild(r)}return e}function l5(t,e){let n=O4(t,{baseUrl:e.editorBase,palette:e.palette,theme:e.theme});if(!n.url)return null;let r=`utm_source=${encodeURIComponent(e.utmSource)}&utm_medium=html&utm_campaign=${encodeURIComponent(e.campaign)}`,o=n.url.indexOf("#"),a;if(o===-1){let i=n.url.includes("?")?"&":"?";a=n.url+i+r}else{let i=n.url.slice(0,o),s=n.url.slice(o+1),l=i.includes("?")?"&":"?",c=s.length>0?"&":"";a=i+l+r+"#"+s+c+r}return vi(a)?a:null}var Fut={theme:"auto",palette:"slate",showSource:!0,showEditorLink:!0},zb={...Fut},Dp=new Set,c5=256*1024,Yut="[dgmo:auto]";function Do(...t){typeof console<"u"&&console.warn&&console.warn(Yut,...t)}function u5(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f5(t){try{return Jp().some(e=>e.id===t)}catch{return!1}}function p5(){if(typeof document>"u")return null;let t=document.currentScript;if(t&&t instanceof HTMLScriptElement)return t;let e=document.querySelectorAll('script[src*="auto.js"], script[src*="auto.min.js"]');return e.length===0?null:e[e.length-1]}var zut=["theme","palette","showSource","showEditorLink"],m5=["__proto__","constructor","prototype"],Vut=["auto","light","dark","transparent"];function h5(t){return typeof t=="string"&&Vut.includes(t)}function g5(t){if(!t)return{};let e;try{e=JSON.parse(t)}catch(r){return Do("data-config: invalid JSON",r),{}}if(!u5(e))return Do("data-config: not an object"),{};for(let r of m5)if(Object.prototype.hasOwnProperty.call(e,r))return Do("data-config: rejected (prototype-pollution key:",r,")"),{};let n={};for(let[r,o]of Object.entries(e)){if(!zut.includes(r)){Do("data-config: dropping unknown key",r);continue}if(r==="theme"){if(!h5(o)){Do("data-config: rejected theme",o);continue}n.theme=o}else if(r==="palette"){if(typeof o!="string"||!f5(o)){Do("data-config: rejected palette",o);continue}n.palette=o}else if(r==="showSource"){if(typeof o!="boolean"){Do("data-config: rejected showSource",o);continue}n.showSource=o}else if(r==="showEditorLink"){if(typeof o!="boolean"){Do("data-config: rejected showEditorLink",o);continue}n.showEditorLink=o}}return n}function y5(t=document){let e=t.querySelectorAll(".dgmo:not([data-dgmo-processed]), .language-dgmo:not([data-dgmo-processed])");return Array.from(e).filter(n=>!n.closest(".dgmo-rendered"))}function Uut(t){if(t.tagName==="CODE"){let e=t.parentElement;if(e?.tagName==="PRE"){let n=Array.from(e.childNodes).filter(r=>r.nodeType===1||r.nodeType===3&&(r.textContent||"").trim().length>0);if(n.length===1&&n[0]===t)return e}}return t}async function b5(t){if(!(t instanceof HTMLElement))return{};if(t.dataset.dgmoProcessed==="true")return{};t.dataset.dgmoProcessed="true";let e=t.textContent||"";if(new TextEncoder().encode(e).byteLength>c5){t.style.visibility="";let E=cu({message:`DGMO source too large to render \u2014 ${c5/1024} KB max`,severity:"error"});return t.parentElement?.insertBefore(E,t),Do("source exceeds 256 KB cap"),{}}let r=zb,o=r.theme==="transparent"?"transparent":DL(r.theme),a=o==="transparent"?"transparent":o,i=a5(e),s=t.dataset.showSource,l=r.showSource;s==="true"?l=!0:s==="false"?l=!1:s!==void 0&&Do("data-show-source: invalid value",s,'\u2014 expected "true" or "false"');let c;try{c=await I4(e,{theme:a,palette:r.palette})}catch(E){t.style.visibility="";let y=E instanceof Error?E.message:"Render failed unexpectedly",b=cu({message:y,severity:"error"});return t.parentElement?.insertBefore(b,t),Do("render() rejected:",E),{}}if(c.diagnostics&&c.diagnostics.length>0){t.style.visibility="";let E=c.diagnostics[0],y=cu({message:E.message,severity:E.severity,line:E.line,...E.column!==void 0&&{column:E.column}});return t.parentElement?.insertBefore(y,t),Do("diagnostic:",E.message,E.line,E.column),{}}if(!c.svg){t.style.visibility="";let E=cu({message:"Empty SVG returned from renderer",severity:"error"});return t.parentElement?.insertBefore(E,t),{}}let d=document.createElement("div"),u=o==="dark"?"dgmo-theme-dark":o==="transparent"?"dgmo-theme-transparent":"dgmo-theme-light";d.className=`dgmo-rendered ${u}`,d.dataset.dgmoProcessed="true";let f=document.createElement("div");f.innerHTML=c.svg;let p=f.querySelector("svg");if(!p){t.style.visibility="";let E=cu({message:"Empty SVG returned from renderer",severity:"error"});return t.parentElement?.insertBefore(E,t),{}}if(o5(p),p.setAttribute("role","img"),p.setAttribute("aria-label",i),d.appendChild(p),l){let E=null;r.showEditorLink&&(E=l5(e,{palette:r.palette,theme:o==="dark"?"dark":"light",editorBase:r5,campaign:Yb,utmSource:"auto-embed"}));let y=s5(e,E,r.showEditorLink);d.appendChild(y)}let h={wrapper:d,source:e,perElementShowSource:s==="true"?!0:s==="false"?!1:null};return Dp.add(h),Uut(t).replaceWith(d),{wrapper:d}}function $L(t={}){if(!u5(t))return;for(let n of m5)if(Object.prototype.hasOwnProperty.call(t,n)){Do("initialize: rejected (prototype-pollution key:",n,")");return}let e={...zb};h5(t.theme)&&(e.theme=t.theme),typeof t.palette=="string"&&f5(t.palette)&&(e.palette=t.palette),typeof t.showSource=="boolean"&&(e.showSource=t.showSource),typeof t.showEditorLink=="boolean"&&(e.showEditorLink=t.showEditorLink),zb=e}async function HL(t={}){OL();for(let n of Array.from(Dp))document.contains(n.wrapper)||Dp.delete(n);let e;if(t.nodes){e=("length"in t.nodes&&typeof t.nodes!="string"?Array.from(t.nodes):[]).filter(o=>o instanceof Element&&(o.matches(".dgmo, .language-dgmo")||o.querySelector(".dgmo, .language-dgmo")!==null));let r=[];for(let o of e)o.matches(".dgmo, .language-dgmo")&&r.push(o),o.querySelectorAll(".dgmo:not([data-dgmo-processed]), .language-dgmo:not([data-dgmo-processed])").forEach(i=>r.push(i));e=Array.from(new Set(r)).filter(o=>!o.closest(".dgmo-rendered"))}else e=y5();await Promise.all(e.map(n=>b5(n).catch(()=>({}))))}function Xut(){if(zb.theme==="auto")for(let t of Array.from(Dp)){let e=document.createElement("pre");e.className="dgmo",e.textContent=t.source,t.perElementShowSource!==null&&(e.dataset.showSource=String(t.perElementShowSource)),t.wrapper.replaceWith(e),Dp.delete(t),b5(e)}}function jut(){if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=()=>Xut();t.addEventListener?t.addEventListener("change",e):"addListener"in t&&typeof t.addListener=="function"&&t.addListener(e)}function GL(){if(typeof document>"u")return;document.querySelectorAll(".dgmo:not(.dgmo-rendered), .language-dgmo").forEach(e=>{e.closest(".dgmo-rendered")||(e.style.visibility="visible")}),document.documentElement&&document.documentElement.dataset&&(document.documentElement.dataset.dgmoAutoFailed="1")}function qut(){try{OL();let t=p5(),e=t?.getAttribute("data-auto"),n=t?.getAttribute("data-config");if(n){let o=g5(n);$L(o)}if(jut(),typeof window<"u"&&window.setTimeout(()=>{document.querySelectorAll(".dgmo:not(.dgmo-rendered):not([data-dgmo-processed])").length>0&&(Do("safety timeout: un-hiding unrendered sources"),GL())},3e4),e==="false")return;let r=()=>{HL().catch(o=>{Do("run() crashed:",o),GL()})};typeof document<"u"&&document.readyState!=="loading"?r():typeof document<"u"&&document.addEventListener("DOMContentLoaded",r,{once:!0})}catch(t){Do("bootstrap failed:",t),GL()}}var x5=Object.freeze({initialize:$L,run:HL,version:Yb});function d5(t,e){try{Object.defineProperty(t,e,{value:x5,writable:!1,configurable:!1,enumerable:!0})}catch{}}typeof window<"u"&&(d5(window,"dgmo"),d5(window,"diagrammo"),qut());var Kut=x5;return zL(Zut);})();
530
530
  /*! Bundled license information:
531
531