@theruansilva/omp-web 2.3.1 → 2.3.2
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/client/assets/{CodeViewer-DHlYSlFA.js → CodeViewer-CCLKHm96.js} +1 -1
- package/dist/client/assets/{TerminalPanel-B7ErBads.js → TerminalPanel-Cz-DYrx6.js} +1 -1
- package/dist/client/assets/{UnifiedDiffViewer-Bsxe8vEO.js → UnifiedDiffViewer-DNmO4uBQ.js} +1 -1
- package/dist/client/assets/{abnfDiagram-O67JEVCF-Bd6-T6CG.js → abnfDiagram-O67JEVCF-XZ1qQ8z4.js} +1 -1
- package/dist/client/assets/{arc-Cx4UzFEe.js → arc-oozMt-rC.js} +1 -1
- package/dist/client/assets/{architectureDiagram-NJMV4G6O-DNZZOJHJ.js → architectureDiagram-NJMV4G6O-DtWgCy1z.js} +1 -1
- package/dist/client/assets/{blockDiagram-BEXU5L5S-DLGMX1ky.js → blockDiagram-BEXU5L5S-BBoE7P9Y.js} +1 -1
- package/dist/client/assets/{c4Diagram-YGBWAQC7-ZicrYBFE.js → c4Diagram-YGBWAQC7-DvjNg-67.js} +1 -1
- package/dist/client/assets/channel-B849ahM4.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-BTdneniS.js → chunk-2Q5K7J3B-yf0a7mN4.js} +1 -1
- package/dist/client/assets/{chunk-3FUC2YCW-DClqbl7t.js → chunk-3FUC2YCW-1VltF9kB.js} +2 -2
- package/dist/client/assets/{chunk-5VM5RSS4-xVtxN_Sa.js → chunk-5VM5RSS4-BanBytP-.js} +1 -1
- package/dist/client/assets/{chunk-GTNCS2PH-Da56Sthk.js → chunk-GTNCS2PH-DEE2gCa9.js} +1 -1
- package/dist/client/assets/{chunk-GWA4HPMP-D40kcLEo.js → chunk-GWA4HPMP-DWBspe_I.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-CVgZV6Wp.js → chunk-JWPE2WC7-Be3sOMxP.js} +1 -1
- package/dist/client/assets/{chunk-NETBCI7D-DNI4Nu1k.js → chunk-NETBCI7D-DUiv7lTo.js} +1 -1
- package/dist/client/assets/{chunk-WEXAMYUT-IVsvOCJJ.js → chunk-WEXAMYUT-8OgC9IZ9.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-ByZI65OQ.js → chunk-XXDRQBXY-Bcwqpw0e.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-NBCMYWYE-CT9N6_lF.js → classDiagram-v2-NBCMYWYE-CIkJY9Ou.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CBJJYOd5.js → cose-bilkent-JH36ORCC-CyHRIgUx.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-BUpMG_46.js → cynefin-OW5HDTMX-BnXIWj_c.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-VND7K2PF-otEJqM7K.js → cynefinDiagram-VND7K2PF-BWnjhGsJ.js} +1 -1
- package/dist/client/assets/{dagre-6A5THRUB-qquzH4Ev.js → dagre-6A5THRUB-DWT5RQye.js} +1 -1
- package/dist/client/assets/{diagram-22UHCM2B-HDLtgJRK.js → diagram-22UHCM2B-DP58QDft.js} +1 -1
- package/dist/client/assets/{diagram-3UASUU5V-Bc2_UO5k.js → diagram-3UASUU5V-DbO0luGb.js} +1 -1
- package/dist/client/assets/{diagram-ATOU4E4O-DR72H135.js → diagram-ATOU4E4O-DujESIkQ.js} +1 -1
- package/dist/client/assets/{diagram-CDSNMT55-hNm66Cr9.js → diagram-CDSNMT55-4dwnMZ-w.js} +1 -1
- package/dist/client/assets/{diagram-MLGK6HIB-ChaEhVd4.js → diagram-MLGK6HIB-B9wJ9DgU.js} +1 -1
- package/dist/client/assets/{diagram-MPIPVDR6-gYxYar4V.js → diagram-MPIPVDR6-B7VqKNt7.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-ZINNZB2B-CRQjE5YW.js → ebnfDiagram-ZINNZB2B-DeWm3AYC.js} +1 -1
- package/dist/client/assets/{elk-276RUBZZ-OZ3Zw5zt.js → elk-276RUBZZ-CoNCqJcP.js} +1 -1
- package/dist/client/assets/{erDiagram-OPXOYQCR-CB71jEyA.js → erDiagram-OPXOYQCR-D9OB6b4G.js} +1 -1
- package/dist/client/assets/{flowDiagram-KWPJA3E3-CYfjFu_3.js → flowDiagram-KWPJA3E3-B0w84_XU.js} +1 -1
- package/dist/client/assets/{ganttDiagram-FUAMR5RP-BE7B_UzV.js → ganttDiagram-FUAMR5RP-DuTuwJBe.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-X574FWY7-HBid3FDo.js → gitGraphDiagram-X574FWY7-BUuBUocx.js} +1 -1
- package/dist/client/assets/{index-C-cQEbCY.js → index-BW6XEiuj.js} +90 -82
- package/dist/client/assets/{infoDiagram-VRGFBTTK-4JprhzHA.js → infoDiagram-VRGFBTTK-CGKca5hP.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-UAP9bqUn.js → ishikawaDiagram-OU5B5YK6-DHRV6yYl.js} +1 -1
- package/dist/client/assets/{journeyDiagram-ZHPQQLJL-j9c9R8jU.js → journeyDiagram-ZHPQQLJL-CvVcj_qr.js} +1 -1
- package/dist/client/assets/{kanban-definition-PNTS6WVX-DWQBxist.js → kanban-definition-PNTS6WVX-CFVMh7as.js} +1 -1
- package/dist/client/assets/{linear-T6d_7ZeJ.js → linear-DasKveCN.js} +1 -1
- package/dist/client/assets/{mindmap-definition-NLK3R4M7-CvMFAKuS.js → mindmap-definition-NLK3R4M7-CwZQvHXR.js} +1 -1
- package/dist/client/assets/{pegDiagram-GJSIUBJH-hvF632kF.js → pegDiagram-GJSIUBJH-BNXgc7-g.js} +1 -1
- package/dist/client/assets/{pieDiagram-5QR66LMP-BXICkLn_.js → pieDiagram-5QR66LMP-BJ2L-dQa.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-O4NWA36T-CnFY0fxq.js → quadrantDiagram-O4NWA36T-zlLKeeUR.js} +1 -1
- package/dist/client/assets/{railroadDiagram-XR7U4H2S-BeRVo7yu.js → railroadDiagram-XR7U4H2S-ChQ2Bzn8.js} +1 -1
- package/dist/client/assets/{requirementDiagram-PLB6GJNP-DmnKxfFp.js → requirementDiagram-PLB6GJNP-Cnj6GBT0.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-IPEJSGJF-Bz1YIaMr.js → sankeyDiagram-IPEJSGJF-D7QbwNbF.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-PO4LG4MO-4cmBIYSV.js → sequenceDiagram-PO4LG4MO-DTCmIrg-.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-B6mTYfgL.js → sizeCapture-INFHLROL-ibwuZV0j.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-GCMORJYK-BKkiHc4R.js → stateDiagram-v2-GCMORJYK-LRnQ_KvI.js} +1 -1
- package/dist/client/assets/{swimlanes-2SLR337P-CBONvDhF.js → swimlanes-2SLR337P-Bf3UNf_T.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-CAjvJtrv.js +8 -0
- package/dist/client/assets/{timeline-definition-EJHVYXUP-BG9z7YWj.js → timeline-definition-EJHVYXUP-C-hFa0Xg.js} +1 -1
- package/dist/client/assets/{usecaseDiagram-POWQR4AR--yXc6tgF.js → usecaseDiagram-POWQR4AR-CeJlL3Iz.js} +1 -1
- package/dist/client/assets/{vennDiagram-UO4OBE2U-DYr42cwJ.js → vennDiagram-UO4OBE2U-JRvs9XFy.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VNRHLVJA-DksCy2aR.js → wardleyDiagram-VNRHLVJA-BrFqMbb0.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PMCCYNJV-DPxnNxcI.js → xychartDiagram-PMCCYNJV-Bxzt39ml.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-Cy0oVDAk.js +0 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-DUA_t92u.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as xt}from"./chunk-JWPE2WC7-
|
|
1
|
+
import{p as xt}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{s as gt,g as $t,t as bt,q as wt,a as Ct,b as vt,_ as s,l as Y,Q as Dt,d as kt,A as At,N as Q,L as U,O as Tt,R as ot}from"./index-BW6XEiuj.js";import{p as Bt}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),Lt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),zt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(Y.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>Q({...Tt.cynefin,...U().cynefin}),"getConfig"),Pt=s(()=>{At(),H=rt()},"clear"),O={getDomains:St,getTransitions:Mt,setDomains:Lt,setTransitions:zt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,O),O.setDomains(t.domains),O.setTransitions(t.transitions)},"populate"),Rt={parse:s(async t=>{const e=await Bt("cynefin",t);Y.debug(e),It(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,R=e/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*17)*m*2-m;d.push({x:c+p,y:o*R})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*31+7),W=p.x+h,_=f,F=i.x-h;D+=` C${W},${_} ${F},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,R=t/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*23)*m*2-m;d.push({x:o*R,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,h=m*1.5*b*E(n+o*37+11),W=f,_=p.y+h,F=f,L=i.y-h;D+=` C${W},${_} ${F},${L} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Wt=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),_t=s(()=>{const t=ot(),e=U();return Q(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Ft=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),R=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=_t();Y.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,W=o.boundaryAmplitude,_=i+b*2,F=f+b*2,L={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,F,_,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${_} ${F}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const A=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Wt(i,f),Z=it(o.seed,e),mt=A.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",L[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=A.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,W)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,W)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;A.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",L.confusion).attr("fill-opacity",.5);const J=A.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=A.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=A.append("g").attr("class","cynefin-items"),T=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let z=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,z=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...z].forEach((g,S)=>{const w=B+S*(T+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",L[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",T/2)}),N>0){const g=B+z.length*(T+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",T/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",T).attr("rx",4).attr("ry",4).attr("fill",L[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",T/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=A.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const z=V[y.from],N=V[y.to];if(!z||!N)return;if(y.from===y.to){Y.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=z.cx,g=z.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}R&&A.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(R)},"draw"),Vt={draw:Ft},Et=s(()=>{const t=ot(),e=U();return Q(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
|
|
2
2
|
.cynefinDomain {
|
|
3
3
|
stroke: none;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as ce,a as Wn,c as qn,b as Hn,f as Te,e as T,i as zn}from"./chunk-3FUC2YCW-DClqbl7t.js";import{_ as x,c as Jn,l as m,bL as Kn,bM as Zn,aE as Qn,aC as Se,an as Ce,al as er,az as nr,bd as rr}from"./index-C-cQEbCY.js";import{i as U,a as O,d as Ie,e as H,b as z,c as tn,f as le,g as an,h as tr,j as on,s as ar,o as ir,k as or,l as he,m as sr,r as dr,U as Re,S as ke,n as pe,p as ge,q as V,t as sn,u as dn,v as ur,w as I,x as fr,y as cr,z as lr,A as Me,B as hr,C as un,D as M,E as pr,F as gr,H as vr,I as X,J as fn,K as cn,L as br,M as ve,N as ln,O as wr,P as hn,Q as mr,R as yr,G as N,T as l,V as xr,W as L,X as $,Y as R,Z as J}from"./graph-D8UmR1vK.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var Er=/\s/;function Lr(e){for(var n=e.length;n--&&Er.test(e.charAt(n)););return n}var Or=/^\s+/;function Nr(e){return e&&e.slice(0,Lr(e)+1).replace(Or,"")}var _e=NaN,Pr=/^[-+]0x[0-9a-f]+$/i,Tr=/^0b[01]+$/i,Sr=/^0o[0-7]+$/i,Cr=parseInt;function Ir(e){if(typeof e=="number")return e;if(U(e))return _e;if(O(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=O(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Nr(e);var r=Tr.test(e);return r||Sr.test(e)?Cr(e.slice(2),r?2:8):Pr.test(e)?_e:+e}var Ae=1/0,Rr=17976931348623157e292;function G(e){if(!e)return e===0?e:0;if(e=Ir(e),e===Ae||e===-Ae){var n=e<0?-1:1;return n*Rr}return e===e?e:0}function kr(e){var n=G(e),r=n%1;return n===n?r?n-r:n:0}var je=Object.create,Mr=(function(){function e(){}return function(n){if(!O(n))return{};if(je)return je(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function _r(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r<t;)n[r]=e[r];return n}function K(e,n,r){n=="__proto__"&&Ie?Ie(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}var Ar=Object.prototype,jr=Ar.hasOwnProperty;function Z(e,n,r){var t=e[n];(!(jr.call(e,n)&&H(t,r))||r===void 0&&!(n in e))&&K(e,n,r)}function Dr(e,n,r,t){var a=!r;r||(r={});for(var o=-1,i=n.length;++o<i;){var s=n[o],d=void 0;d===void 0&&(d=e[s]),a?K(r,s,d):Z(r,s,d)}return r}function j(e,n,r){if(!O(r))return!1;var t=typeof n;return(t=="number"?z(r)&&tn(n,r.length):t=="string"&&n in r)?H(r[n],e):!1}function Br(e){return le(function(n,r){var t=-1,a=r.length,o=a>1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(a--,o):void 0,i&&j(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),n=Object(n);++t<a;){var s=r[t];s&&e(n,s,t,o)}return n})}function $r(e){var n=[];if(e!=null)for(var r in Object(e))n.push(r);return n}var Fr=Object.prototype,Xr=Fr.hasOwnProperty;function Gr(e){if(!O(e))return $r(e);var n=an(e),r=[];for(var t in e)t=="constructor"&&(n||!Xr.call(e,t))||r.push(t);return r}function Q(e){return z(e)?tr(e,!0):Gr(e)}function _(e){var n=e==null?0:e.length;return n?on(e):[]}function Yr(e){return ar(ir(e,void 0,_),e+"")}var pn=or(Object.getPrototypeOf,Object),Ur="[object Object]",Vr=Function.prototype,Wr=Object.prototype,gn=Vr.toString,qr=Wr.hasOwnProperty,Hr=gn.call(Object);function zr(e){if(!he(e)||sr(e)!=Ur)return!1;var n=pn(e);if(n===null)return!0;var r=qr.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&gn.call(r)==Hr}var vn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,De=vn&&typeof module=="object"&&module&&!module.nodeType&&module,Jr=De&&De.exports===vn,Be=Jr?dr.Buffer:void 0,$e=Be?Be.allocUnsafe:void 0;function bn(e,n){if(n)return e.slice();var r=e.length,t=$e?$e(r):new e.constructor(r);return e.copy(t),t}var Kr=Object.prototype,Zr=Kr.hasOwnProperty;function Qr(e){var n=e.length,r=new e.constructor(n);return n&&typeof e[0]=="string"&&Zr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function be(e){var n=new e.constructor(e.byteLength);return new Re(n).set(new Re(e)),n}function et(e,n){var r=be(e.buffer);return new e.constructor(r,e.byteOffset,e.byteLength)}var nt=/\w*$/;function rt(e){var n=new e.constructor(e.source,nt.exec(e));return n.lastIndex=e.lastIndex,n}var Fe=ke?ke.prototype:void 0,Xe=Fe?Fe.valueOf:void 0;function tt(e){return Xe?Object(Xe.call(e)):{}}function wn(e,n){var r=n?be(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var at="[object Boolean]",it="[object Date]",ot="[object Map]",st="[object Number]",dt="[object RegExp]",ut="[object Set]",ft="[object String]",ct="[object Symbol]",lt="[object ArrayBuffer]",ht="[object DataView]",pt="[object Float32Array]",gt="[object Float64Array]",vt="[object Int8Array]",bt="[object Int16Array]",wt="[object Int32Array]",mt="[object Uint8Array]",yt="[object Uint8ClampedArray]",xt="[object Uint16Array]",Et="[object Uint32Array]";function Lt(e,n,r){var t=e.constructor;switch(n){case lt:return be(e);case at:case it:return new t(+e);case ht:return et(e);case pt:case gt:case vt:case bt:case wt:case mt:case yt:case xt:case Et:return wn(e,r);case ot:return new t;case st:case ft:return new t(e);case dt:return rt(e);case ut:return new t;case ct:return tt(e)}}function mn(e){return typeof e.constructor=="function"&&!an(e)?Mr(pn(e)):{}}var Ot="[object Map]";function Nt(e){return he(e)&&pe(e)==Ot}var Ge=V&&V.isMap,Pt=Ge?ge(Ge):Nt,Tt="[object Set]";function St(e){return he(e)&&pe(e)==Tt}var Ye=V&&V.isSet,Ct=Ye?ge(Ye):St,It=1,yn="[object Arguments]",Rt="[object Array]",kt="[object Boolean]",Mt="[object Date]",_t="[object Error]",xn="[object Function]",At="[object GeneratorFunction]",jt="[object Map]",Dt="[object Number]",En="[object Object]",Bt="[object RegExp]",$t="[object Set]",Ft="[object String]",Xt="[object Symbol]",Gt="[object WeakMap]",Yt="[object ArrayBuffer]",Ut="[object DataView]",Vt="[object Float32Array]",Wt="[object Float64Array]",qt="[object Int8Array]",Ht="[object Int16Array]",zt="[object Int32Array]",Jt="[object Uint8Array]",Kt="[object Uint8ClampedArray]",Zt="[object Uint16Array]",Qt="[object Uint32Array]",y={};y[yn]=y[Rt]=y[Yt]=y[Ut]=y[kt]=y[Mt]=y[Vt]=y[Wt]=y[qt]=y[Ht]=y[zt]=y[jt]=y[Dt]=y[En]=y[Bt]=y[$t]=y[Ft]=y[Xt]=y[Jt]=y[Kt]=y[Zt]=y[Qt]=!0;y[_t]=y[xn]=y[Gt]=!1;function Y(e,n,r,t,a,o){var i,s=n&It;if(i!==void 0)return i;if(!O(e))return e;var d=I(e);if(d)i=Qr(e);else{var u=pe(e),f=u==xn||u==At;if(sn(e))return bn(e,s);if(u==En||u==yn||f&&!a)i=f?{}:mn(e);else{if(!y[u])return a?e:{};i=Lt(e,u,s)}}o||(o=new dn);var c=o.get(e);if(c)return c;o.set(e,i),Ct(e)?e.forEach(function(p){i.add(Y(p,n,r,p,e,o))}):Pt(e)&&e.forEach(function(p,g){i.set(g,Y(p,n,r,g,e,o))});var h=fr,v=d?void 0:h(e);return ur(v||e,function(p,g){v&&(g=p,p=e[g]),Z(i,g,Y(p,n,r,g,e,o))}),i}var ea=1,na=4;function ra(e){return Y(e,ea|na)}var Ln=Object.prototype,ta=Ln.hasOwnProperty,aa=le(function(e,n){e=Object(e);var r=-1,t=n.length,a=t>2?n[2]:void 0;for(a&&j(n[0],n[1],a)&&(t=1);++r<t;)for(var o=n[r],i=Q(o),s=-1,d=i.length;++s<d;){var u=i[s],f=e[u];(f===void 0||H(f,Ln[u])&&!ta.call(e,u))&&(e[u]=o[u])}return e});function se(e,n,r){(r!==void 0&&!H(e[n],r)||r===void 0&&!(n in e))&&K(e,n,r)}function de(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}function ia(e){return Dr(e,Q(e))}function oa(e,n,r,t,a,o,i){var s=de(e,r),d=de(n,r),u=i.get(d);if(u){se(e,r,u);return}var f=o?o(s,d,r+"",e,n,i):void 0,c=f===void 0;if(c){var h=I(d),v=!h&&sn(d),p=!h&&!v&&cr(d);f=d,h||v||p?I(s)?f=s:lr(s)?f=_r(s):v?(c=!1,f=bn(d,!0)):p?(c=!1,f=wn(d,!0)):f=[]:zr(d)||Me(d)?(f=s,Me(s)?f=ia(s):(!O(s)||hr(s))&&(f=mn(d))):c=!1}c&&(i.set(d,f),a(f,d,t,o,i),i.delete(d)),se(e,r,f)}function On(e,n,r,t,a){e!==n&&un(n,function(o,i){if(a||(a=new dn),O(o))oa(e,n,i,r,On,t,a);else{var s=t?t(de(e,i),o,i+"",e,n,a):void 0;s===void 0&&(s=o),se(e,i,s)}},Q)}function W(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}function sa(e){return function(n,r,t){var a=Object(n);if(!z(n)){var o=M(r);n=pr(n),r=function(s){return o(a[s],s,a)}}var i=e(n,r,t);return i>-1?a[o?n[i]:i]:void 0}}var da=Math.max;function ua(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:kr(r);return a<0&&(a=da(t+a,0)),gr(e,M(n),a)}var we=sa(ua);function Nn(e,n){var r=-1,t=z(e)?Array(e.length):[];return vr(e,function(a,o,i){t[++r]=n(a,o,i)}),t}function E(e,n){var r=I(e)?X:Nn;return r(e,M(n))}function fa(e,n){return e==null?e:un(e,fn(n),Q)}function ca(e,n){return e&&cn(e,fn(n))}function la(e,n){return e>n}var ha=Object.prototype,pa=ha.hasOwnProperty;function ga(e,n){return e!=null&&pa.call(e,n)}function Pn(e,n){return e!=null&&br(e,n,ga)}function Tn(e,n){return e<n}function ee(e,n){var r={};return n=M(n),cn(e,function(t,a,o){K(r,a,n(t,a,o))}),r}function me(e,n,r){for(var t=-1,a=e.length;++t<a;){var o=e[t],i=n(o);if(i!=null&&(s===void 0?i===i&&!U(i):r(i,s)))var s=i,d=o}return d}function S(e){return e&&e.length?me(e,ve,la):void 0}var ue=Br(function(e,n,r){On(e,n,r)});function D(e){return e&&e.length?me(e,ve,Tn):void 0}function ye(e,n){return e&&e.length?me(e,M(n),Tn):void 0}function va(e,n,r,t){if(!O(e))return e;n=ln(n,e);for(var a=-1,o=n.length,i=o-1,s=e;s!=null&&++a<o;){var d=wr(n[a]),u=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(a!=i){var f=s[d];u=void 0,u===void 0&&(u=O(f)?f:tn(n[a+1])?[]:{})}Z(s,d,u),s=s[d]}return e}function ba(e,n,r){for(var t=-1,a=n.length,o={};++t<a;){var i=n[t],s=hn(e,i);r(s,i)&&va(o,ln(i,e),s)}return o}function wa(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function ma(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,o=U(e),i=n!==void 0,s=n===null,d=n===n,u=U(n);if(!s&&!u&&!o&&e>n||o&&i&&d&&!s&&!u||t&&i&&d||!r&&d||!a)return 1;if(!t&&!o&&!u&&e<n||u&&r&&a&&!t&&!o||s&&r&&a||!i&&a||!d)return-1}return 0}function ya(e,n,r){for(var t=-1,a=e.criteria,o=n.criteria,i=a.length,s=r.length;++t<i;){var d=ma(a[t],o[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function xa(e,n,r){n.length?n=X(n,function(o){return I(o)?function(i){return hn(i,o.length===1?o[0]:o)}:o}):n=[ve];var t=-1;n=X(n,ge(M));var a=Nn(e,function(o,i,s){var d=X(n,function(u){return u(o)});return{criteria:d,index:++t,value:o}});return wa(a,function(o,i){return ya(o,i,r)})}function Ea(e,n){return ba(e,n,function(r,t){return mr(e,t)})}var q=Yr(function(e,n){return e==null?{}:Ea(e,n)}),La=Math.ceil,Oa=Math.max;function Na(e,n,r,t){for(var a=-1,o=Oa(La((n-e)/(r||1)),0),i=Array(o);o--;)i[++a]=e,e+=r;return i}function Pa(e){return function(n,r,t){return t&&typeof t!="number"&&j(n,r,t)&&(r=t=void 0),n=G(n),r===void 0?(r=n,n=0):r=G(r),t=t===void 0?n<r?1:-1:G(t),Na(n,r,t)}}var k=Pa(),F=le(function(e,n){if(e==null)return[];var r=n.length;return r>1&&j(e,n[0],n[1])?n=[]:r>2&&j(n[0],n[1],n[2])&&(n=[n[0]]),xa(e,on(n),[])}),Ta=0;function xe(e){var n=++Ta;return yr(e)+n}function Sa(e,n,r){for(var t=-1,a=e.length,o=n.length,i={};++t<a;){var s=t<o?n[t]:void 0;r(i,e[t],s)}return i}function Ca(e,n){return Sa(e||[],n||[],Z)}class Ia{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return Ue(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&Ue(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Ra)),t=t._prev;return"["+n.join(", ")+"]"}}function Ue(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ra(e,n){if(e!=="_next"&&e!=="_prev")return n}var ka=xr(1);function Ma(e,n){if(e.nodeCount()<=1)return[];var r=Aa(e,n||ka),t=_a(r.graph,r.buckets,r.zeroIdx);return _(E(t,function(a){return e.outEdges(a.v,a.w)}))}function _a(e,n,r){for(var t=[],a=n[n.length-1],o=n[0],i;e.nodeCount();){for(;i=o.dequeue();)re(e,n,r,i);for(;i=a.dequeue();)re(e,n,r,i);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(i=n[s].dequeue(),i){t=t.concat(re(e,n,r,i,!0));break}}}return t}function re(e,n,r,t,a){var o=a?[]:void 0;return l(e.inEdges(t.v),function(i){var s=e.edge(i),d=e.node(i.v);a&&o.push({v:i.v,w:i.w}),d.out-=s,fe(n,r,d)}),l(e.outEdges(t.v),function(i){var s=e.edge(i),d=i.w,u=e.node(d);u.in-=s,fe(n,r,u)}),e.removeNode(t.v),o}function Aa(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var o=k(a+t+3).map(function(){return new Ia}),i=t+1;return l(r.nodes(),function(s){fe(o,i,r.node(s))}),{graph:r,buckets:o,zeroIdx:i}}function fe(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function ja(e){var n=e.graph().acyclicer==="greedy"?Ma(e,r(e)):Da(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,xe("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Da(e){var n=[],r={},t={};function a(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,l(e.outEdges(o),function(i){Object.prototype.hasOwnProperty.call(r,i.w)?n.push(i):a(i.w)}),delete r[o])}return l(e.nodes(),a),n}function Ba(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function A(e,n,r,t){var a;do a=xe(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function $a(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function Sn(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Ve(e,n){var r=e.x,t=e.y,a=n.x-r,o=n.y-t,i=e.width/2,s=e.height/2;if(!a&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(o)*i>Math.abs(a)*s?(o<0&&(s=-s),d=s*a/o,u=s):(a<0&&(i=-i),d=i,u=i*o/a),{x:r+d,y:t+u}}function ne(e){var n=E(k(Cn(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;L(a)||(n[a][t.order]=r)}),n}function Fa(e){var n=D(E(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);Pn(t,"rank")&&(t.rank-=n)})}function Xa(e){var n=D(E(e.nodes(),function(o){return e.node(o).rank})),r=[];l(e.nodes(),function(o){var i=e.node(o).rank-n;r[i]||(r[i]=[]),r[i].push(o)});var t=0,a=e.graph().nodeRankFactor;l(r,function(o,i){L(o)&&i%a!==0?--t:t&&l(o,function(s){e.node(s).rank+=t})})}function We(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),A(e,"border",a,n)}function Cn(e){return S(E(e.nodes(),function(n){var r=e.node(n).rank;if(!L(r))return r}))}function Ga(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ya(e,n){return n()}function Ua(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,i=a.maxRank+1;o<i;++o)qe(e,"borderLeft","_bl",r,a,o),qe(e,"borderRight","_br",r,a,o)}}l(e.children(),n)}function qe(e,n,r,t,a,o){var i={width:0,height:0,rank:o,borderType:n},s=a[n][o-1],d=A(e,"border",i,r);a[n][o]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Va(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&In(e)}function Wa(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&qa(e),(n==="lr"||n==="rl")&&(Ha(e),In(e))}function In(e){l(e.nodes(),function(n){He(e.node(n))}),l(e.edges(),function(n){He(e.edge(n))})}function He(e){var n=e.width;e.width=e.height,e.height=n}function qa(e){l(e.nodes(),function(n){te(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,te),Object.prototype.hasOwnProperty.call(r,"y")&&te(r)})}function te(e){e.y=-e.y}function Ha(e){l(e.nodes(),function(n){ae(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,ae),Object.prototype.hasOwnProperty.call(r,"x")&&ae(r)})}function ae(e){var n=e.x;e.x=e.y,e.y=n}function za(e){e.graph().dummyChains=[],l(e.edges(),function(n){Ja(e,n)})}function Ja(e,n){var r=n.v,t=e.node(r).rank,a=n.w,o=e.node(a).rank,i=n.name,s=e.edge(n),d=s.labelRank;if(o!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<o;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=A(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},i),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},i)}}function Ka(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function Ee(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var o=D(E(e.outEdges(t),function(i){return r(i.w)-e.edge(i).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),a.rank=o}l(e.sources(),r)}function B(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function Rn(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,o;Za(n,e)<t;)a=Qa(n,e),o=n.hasNode(a.v)?B(e,a):-B(e,a),ei(n,e,o);return n}function Za(e,n){function r(t){l(n.nodeEdges(t),function(a){var o=a.v,i=t===o?a.w:o;!e.hasNode(i)&&!B(n,a)&&(e.setNode(i,{}),e.setEdge(t,i,{}),r(i))})}return l(e.nodes(),r),e.nodeCount()}function Qa(e,n){return ye(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return B(n,r)})}function ei(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function ni(){}ni.prototype=new Error;function kn(e,n,r){I(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],o={};return l(n,function(i){if(!e.hasNode(i))throw new Error("Graph does not have node: "+i);Mn(e,i,r==="post",o,t,a)}),a}function Mn(e,n,r,t,a,o){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||o.push(n),l(a(n),function(i){Mn(e,i,r,t,a,o)}),r&&o.push(n))}function ri(e,n){return kn(e,n,"post")}function ti(e,n){return kn(e,n,"pre")}C.initLowLimValues=Oe;C.initCutValues=Le;C.calcCutValue=_n;C.leaveEdge=jn;C.enterEdge=Dn;C.exchangeEdges=Bn;function C(e){e=$a(e),Ee(e);var n=Rn(e);Oe(n),Le(n,e);for(var r,t;r=jn(n);)t=Dn(n,e,r),Bn(n,e,r,t)}function Le(e,n){var r=ri(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){ai(e,n,t)})}function ai(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=_n(e,n,r)}function _n(e,n,r){var t=e.node(r),a=t.parent,o=!0,i=n.edge(r,a),s=0;return i||(o=!1,i=n.edge(a,r)),s=i.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===o,h=n.edge(d).weight;if(s+=c?h:-h,oi(e,r,f)){var v=e.edge(r,f).cutvalue;s+=c?-v:v}}}),s}function Oe(e,n){arguments.length<2&&(n=e.nodes()[0]),An(e,{},1,n)}function An(e,n,r,t,a){var o=r,i=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=An(e,n,r,s,t))}),i.low=o,i.lim=r++,a?i.parent=a:delete i.parent,r}function jn(e){return we(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Dn(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var o=e.node(t),i=e.node(a),s=o,d=!1;o.lim>i.lim&&(s=i,d=!0);var u=$(n.edges(),function(f){return d===ze(e,e.node(f.v),s)&&d!==ze(e,e.node(f.w),s)});return ye(u,function(f){return B(n,f)})}function Bn(e,n,r,t){var a=r.v,o=r.w;e.removeEdge(a,o),e.setEdge(t.v,t.w,{}),Oe(e),Le(e,n),ii(e,n)}function ii(e,n){var r=we(e.nodes(),function(a){return!n.node(a).parent}),t=ti(e,r);t=t.slice(1),l(t,function(a){var o=e.node(a).parent,i=n.edge(a,o),s=!1;i||(i=n.edge(o,a),s=!0),n.node(a).rank=n.node(o).rank+(s?i.minlen:-i.minlen)})}function oi(e,n,r){return e.hasEdge(n,r)}function ze(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function si(e){switch(e.graph().ranker){case"network-simplex":Je(e);break;case"tight-tree":ui(e);break;case"longest-path":di(e);break;default:Je(e)}}var di=Ee;function ui(e){Ee(e),Rn(e)}function Je(e){C(e)}function fi(e){var n=A(e,"root",{},"_root"),r=ci(e),t=S(R(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(i){e.edge(i).minlen*=a});var o=li(e)+1;l(e.children(),function(i){$n(e,n,a,o,t,r,i)}),e.graph().nodeRankFactor=a}function $n(e,n,r,t,a,o,i){var s=e.children(i);if(!s.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var d=We(e,"_bt"),u=We(e,"_bb"),f=e.node(i);e.setParent(d,i),f.borderTop=d,e.setParent(u,i),f.borderBottom=u,l(s,function(c){$n(e,n,r,t,a,o,c);var h=e.node(c),v=h.borderTop?h.borderTop:c,p=h.borderBottom?h.borderBottom:c,g=h.borderTop?t:2*t,b=v!==p?1:a-o[i]+1;e.setEdge(d,v,{weight:g,minlen:b,nestingEdge:!0}),e.setEdge(p,u,{weight:g,minlen:b,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,d,{weight:0,minlen:a+o[i]})}function ci(e){var n={};function r(t,a){var o=e.children(t);o&&o.length&&l(o,function(i){r(i,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function li(e){return J(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function hi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function pi(e,n,r){var t={},a;l(r,function(o){for(var i=e.parent(o),s,d;i;){if(s=e.parent(i),s?(d=t[s],t[s]=i):(d=a,a=i),d&&d!==i){n.setEdge(d,i);return}i=s}})}function gi(e,n,r){var t=vi(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return l(e.nodes(),function(o){var i=e.node(o),s=e.parent(o);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(a.setNode(o),a.setParent(o,s||t),l(e[r](o),function(d){var u=d.v===o?d.w:d.v,f=a.edge(u,o),c=L(f)?0:f.weight;a.setEdge(u,o,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&a.setNode(o,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),a}function vi(e){for(var n;e.hasNode(n=xe("_root")););return n}function bi(e,n){for(var r=0,t=1;t<n.length;++t)r+=wi(e,n[t-1],n[t]);return r}function wi(e,n,r){for(var t=Ca(r,E(r,function(u,f){return f})),a=_(E(n,function(u){return F(E(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var i=2*o-1;o-=1;var s=E(new Array(i),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+o;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function mi(e){var n={},r=$(e.nodes(),function(s){return!e.children(s).length}),t=S(E(r,function(s){return e.node(s).rank})),a=E(k(t+1),function(){return[]});function o(s){if(!Pn(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),o)}}var i=F(r,function(s){return e.node(s).rank});return l(i,o),a}function yi(e,n){return E(n,function(r){var t=e.inEdges(r);if(t.length){var a=J(t,function(o,i){var s=e.edge(i),d=e.node(i.v);return{sum:o.sum+s.weight*d.order,weight:o.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function xi(e,n){var r={};l(e,function(a,o){var i=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:o};L(a.barycenter)||(i.barycenter=a.barycenter,i.weight=a.weight)}),l(n.edges(),function(a){var o=r[a.v],i=r[a.w];!L(o)&&!L(i)&&(i.indegree++,o.out.push(r[a.w]))});var t=$(r,function(a){return!a.indegree});return Ei(t)}function Ei(e){var n=[];function r(o){return function(i){i.merged||(L(i.barycenter)||L(o.barycenter)||i.barycenter>=o.barycenter)&&Li(o,i)}}function t(o){return function(i){i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return E($(n,function(o){return!o.merged}),function(o){return q(o,["vs","i","barycenter","weight"])})}function Li(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function Oi(e,n){var r=Ga(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=F(r.rhs,function(f){return-f.i}),o=[],i=0,s=0,d=0;t.sort(Ni(!!n)),d=Ke(o,a,d),l(t,function(f){d+=f.vs.length,o.push(f.vs),i+=f.barycenter*f.weight,s+=f.weight,d=Ke(o,a,d)});var u={vs:_(o)};return s&&(u.barycenter=i/s,u.weight=s),u}function Ke(e,n,r){for(var t;n.length&&(t=W(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ni(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function Fn(e,n,r,t){var a=e.children(n),o=e.node(n),i=o?o.borderLeft:void 0,s=o?o.borderRight:void 0,d={};i&&(a=$(a,function(p){return p!==i&&p!==s}));var u=yi(e,a);l(u,function(p){if(e.children(p.v).length){var g=Fn(e,p.v,r,t);d[p.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&Ti(p,g)}});var f=xi(u,r);Pi(f,d);var c=Oi(f,t);if(i&&(c.vs=_([i,c.vs,s]),e.predecessors(i).length)){var h=e.node(e.predecessors(i)[0]),v=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+v.order)/(c.weight+2),c.weight+=2}return c}function Pi(e,n){l(e,function(r){r.vs=_(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Ti(e,n){L(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function Si(e){var n=Cn(e),r=Ze(e,k(1,n+1),"inEdges"),t=Ze(e,k(n-1,-1,-1),"outEdges"),a=mi(e);Qe(e,a);for(var o=Number.POSITIVE_INFINITY,i,s=0,d=0;d<4;++s,++d){Ci(s%2?r:t,s%4>=2),a=ne(e);var u=bi(e,a);u<o&&(d=0,i=ra(a),o=u)}Qe(e,i)}function Ze(e,n,r){return E(n,function(t){return gi(e,t,r)})}function Ci(e,n){var r=new N;l(e,function(t){var a=t.graph().root,o=Fn(t,a,r,n);l(o.vs,function(i,s){t.node(i).order=s}),pi(t,r,o.vs)})}function Qe(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function Ii(e){var n=ki(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,o=Ri(e,n,a.v,a.w),i=o.path,s=o.lca,d=0,u=i[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=i[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<i.length-1&&e.node(u=i[d+1]).minRank<=t.rank;)d++;u=i[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Ri(e,n,r,t){var a=[],o=[],i=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>i||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)o.push(d);return{path:a.concat(o.reverse()),lca:u}}function ki(e){var n={},r=0;function t(a){var o=r;l(e.children(a),t),n[a]={low:o,lim:r++}}return l(e.children(),t),n}function Mi(e,n){var r={};function t(a,o){var i=0,s=0,d=a.length,u=W(o);return l(o,function(f,c){var h=Ai(e,f),v=h?e.node(h).order:d;(h||f===u)&&(l(o.slice(s,c+1),function(p){l(e.predecessors(p),function(g){var b=e.node(g),w=b.order;(w<i||v<w)&&!(b.dummy&&e.node(p).dummy)&&Xn(r,g,p)})}),s=c+1,i=v)}),o}return J(n,t),r}function _i(e,n){var r={};function t(o,i,s,d,u){var f;l(k(i,s),function(c){f=o[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var v=e.node(h);v.dummy&&(v.order<d||v.order>u)&&Xn(r,h,f)})})}function a(o,i){var s=-1,d,u=0;return l(i,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(i,u,c,s,d),u=c,s=d)}t(i,u,i.length,d,o.length)}),i}return J(n,a),r}function Ai(e,n){if(e.node(n).dummy)return we(e.predecessors(n),function(r){return e.node(r).dummy})}function Xn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function ji(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Di(e,n,r,t){var a={},o={},i={};return l(n,function(s){l(s,function(d,u){a[d]=d,o[d]=d,i[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=F(f,function(g){return i[g]});for(var c=(f.length-1)/2,h=Math.floor(c),v=Math.ceil(c);h<=v;++h){var p=f[h];o[u]===u&&d<i[p]&&!ji(r,u,p)&&(o[p]=u,o[u]=a[u]=a[p],d=i[p])}}})}),{root:a,align:o}}function Bi(e,n,r,t,a){var o={},i=$i(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var v=i.nodes(),p=v.pop(),g={};p;)g[p]?c(p):(g[p]=!0,v.push(p),v=v.concat(h(p))),p=v.pop()}function u(c){o[c]=i.inEdges(c).reduce(function(h,v){return Math.max(h,o[v.v]+i.edge(v))},0)}function f(c){var h=i.outEdges(c).reduce(function(p,g){return Math.min(p,o[g.w]-i.edge(g))},Number.POSITIVE_INFINITY),v=e.node(c);h!==Number.POSITIVE_INFINITY&&v.borderType!==s&&(o[c]=Math.max(o[c],h))}return d(u,i.predecessors.bind(i)),d(f,i.successors.bind(i)),l(t,function(c){o[c]=o[r[c]]}),o}function $i(e,n,r,t){var a=new N,o=e.graph(),i=Ui(o.nodesep,o.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(i(e,u,d),h||0))}d=u})}),a}function Fi(e,n){return ye(R(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return fa(r,function(o,i){var s=Vi(e,i)/2;t=Math.max(o+s,t),a=Math.min(o-s,a)}),t-a})}function Xi(e,n){var r=R(n),t=D(r),a=S(r);l(["u","d"],function(o){l(["l","r"],function(i){var s=o+i,d=e[s],u;if(d!==n){var f=R(d);u=i==="l"?t-D(f):a-S(f),u&&(e[s]=ee(d,function(c){return c+u}))}})})}function Gi(e,n){return ee(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=F(E(e,t));return(a[1]+a[2])/2})}function Yi(e){var n=ne(e),r=ue(Mi(e,n),_i(e,n)),t={},a;l(["u","d"],function(i){a=i==="u"?n:R(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=E(a,function(c){return R(c).reverse()}));var d=(i==="u"?e.predecessors:e.successors).bind(e),u=Di(e,a,r,d),f=Bi(e,a,u.root,u.align,s==="r");s==="r"&&(f=ee(f,function(c){return-c})),t[i+s]=f})});var o=Fi(e,t);return Xi(t,o),Gi(t,e.graph().align)}function Ui(e,n,r){return function(t,a,o){var i=t.node(a),s=t.node(o),d=0,u;if(d+=i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":u=-i.width/2;break;case"r":u=i.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(i.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Vi(e,n){return e.node(n).width}function Wi(e){e=Sn(e),qi(e),ca(Yi(e),function(n,r){e.node(r).x=n})}function qi(e){var n=ne(e),r=e.graph().ranksep,t=0;l(n,function(a){var o=S(E(a,function(i){return e.node(i).height}));l(a,function(i){e.node(i).y=t+o/2}),t+=o+r})}function Hi(e,n){var r=Ya;r("layout",()=>{var t=r(" buildLayoutGraph",()=>io(e));r(" runLayout",()=>zi(t,r)),r(" updateInputGraph",()=>Ji(e,t))})}function zi(e,n){n(" makeSpaceForEdgeLabels",()=>oo(e)),n(" removeSelfEdges",()=>vo(e)),n(" acyclic",()=>ja(e)),n(" nestingGraph.run",()=>fi(e)),n(" rank",()=>si(Sn(e))),n(" injectEdgeLabelProxies",()=>so(e)),n(" removeEmptyRanks",()=>Xa(e)),n(" nestingGraph.cleanup",()=>hi(e)),n(" normalizeRanks",()=>Fa(e)),n(" assignRankMinMax",()=>uo(e)),n(" removeEdgeLabelProxies",()=>fo(e)),n(" normalize.run",()=>za(e)),n(" parentDummyChains",()=>Ii(e)),n(" addBorderSegments",()=>Ua(e)),n(" order",()=>Si(e)),n(" insertSelfEdges",()=>bo(e)),n(" adjustCoordinateSystem",()=>Va(e)),n(" position",()=>Wi(e)),n(" positionSelfEdges",()=>wo(e)),n(" removeBorderNodes",()=>go(e)),n(" normalize.undo",()=>Ka(e)),n(" fixupEdgeLabelCoords",()=>ho(e)),n(" undoCoordinateSystem",()=>Wa(e)),n(" translateGraph",()=>co(e)),n(" assignNodeIntersects",()=>lo(e)),n(" reversePoints",()=>po(e)),n(" acyclic.undo",()=>Ba(e))}function Ji(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Ki=["nodesep","edgesep","ranksep","marginx","marginy"],Zi={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Qi=["acyclicer","ranker","rankdir","align"],eo=["width","height"],no={width:0,height:0},ro=["minlen","weight","width","height","labeloffset"],to={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ao=["labelpos"];function io(e){var n=new N({multigraph:!0,compound:!0}),r=oe(e.graph());return n.setGraph(ue({},Zi,ie(r,Ki),q(r,Qi))),l(e.nodes(),function(t){var a=oe(e.node(t));n.setNode(t,aa(ie(a,eo),no)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=oe(e.edge(t));n.setEdge(t,ue({},to,ie(a,ro),q(a,ao)))}),n}function oo(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function so(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),o={rank:(a.rank-t.rank)/2+t.rank,e:n};A(e,"edge-proxy",o,"_ep")}})}function uo(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=S(n,t.maxRank))}),e.graph().maxRank=n}function fo(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function co(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,o=e.graph(),i=o.marginx||0,s=o.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,v=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-v/2),a=Math.max(a,c+v/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=i,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),o.width=r-n+i,o.height=a-t+s}function lo(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),o,i;r.points?(o=r.points[0],i=r.points[r.points.length-1]):(r.points=[],o=a,i=t),r.points.unshift(Ve(t,o)),r.points.push(Ve(a,i))})}function ho(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function po(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function go(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),o=e.node(W(r.borderLeft)),i=e.node(W(r.borderRight));r.width=Math.abs(i.x-o.x),r.height=Math.abs(a.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function vo(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function bo(e){var n=ne(e);l(n,function(r){var t=0;l(r,function(a,o){var i=e.node(a);i.order=o+t,l(i.selfEdges,function(s){A(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++t,e:s.e,label:s.label},"_se")}),delete i.selfEdges})})}function wo(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,o=t.y,i=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*i/3,y:o-s},{x:a+5*i/6,y:o-s},{x:a+i,y:o},{x:a+5*i/6,y:o+s},{x:a+2*i/3,y:o+s}],r.label.x=r.x,r.label.y=r.y}})}function ie(e,n){return ee(q(e,n),Number)}function oe(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var en=x((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),nn=x((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),mo=x(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),yo=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],xo=x((e,n,r,t,a)=>{const o=[],i=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&i.add(f),c!==t&&i.add(c)}),i.forEach(f=>{const c=e.node(f);typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)}),o.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)})}),o.length===0)return nn(a);const s=o.reduce((f,c)=>({x:f.x+c.x/o.length,y:f.y+c.y/o.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":nn(a)},"getSelfLoopSide"),Eo=x((e,n="top",r=0,t=0)=>{const a=e.x,o=e.y-r,i=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=en(Math.max(t,e.width*.35),36,d),f=en(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=o+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+i;return[{x:c,y:o-u/2},{x:c+f,y:o-u/2},{x:c+f,y:o+u/2},{x:c,y:o+u/2}]}case"left":{const c=a-i;return[{x:c,y:o-u/2},{x:c-f,y:o-u/2},{x:c-f,y:o+u/2},{x:c,y:o+u/2}]}default:{const c=o-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),Lo=x((e,n,r="top",t=0,a={})=>{const i=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:i,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};default:return{x:i,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),Gn=x((e,n=0,{mergeSelfLoops:r=!0}={})=>{const t=new Map,a=[],o=e.graph()?.rankdir;return e.edges().forEach(i=>{const s=e.edge(i);if(r&&s.selfLoop){const d=s.selfLoop.id;t.has(d)||t.set(d,[]),t.get(d).push({edge:s,start:i.v,end:i.w})}else a.push({edge:s,start:i.v,end:i.w})}),t.forEach(i=>{if(i.length!==3){i.forEach(w=>a.push(w));return}i.sort((w,P)=>w.edge.selfLoop.order-P.edge.selfLoop.order);const[s,d,u]=i,f=s.edge.originalEdge??d.edge.originalEdge??u.edge.originalEdge??d.edge,c=e.node(f.start);if(!c){i.forEach(w=>a.push(w));return}const h={width:d.edge.width,height:d.edge.height},v=xo(e,c,i,f.start,o),p=Eo(c,v,n,h.width??0),g=Lo(c,p,v,n,h),b={...d.edge,...f,id:f.id,points:p,start:f.start,end:f.end,x:g.x,y:g.y,width:h.width,height:h.height,labelStyle:d.edge.labelStyle,fromCluster:s.edge.fromCluster??d.edge.fromCluster??u.edge.fromCluster,toCluster:s.edge.toCluster??d.edge.toCluster??u.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),Yn=x(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:o})=>{const i=n.graph().rankdir;m.trace("Dir in recursive render - dir:",i);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=Hn(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=mo(r);await Promise.all(n.nodes().map(async function(g){const b=n.node(g);if(a!==void 0){const w=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
|
|
1
|
+
import{s as ce,a as Wn,c as qn,b as Hn,f as Te,e as T,i as zn}from"./chunk-3FUC2YCW-1VltF9kB.js";import{_ as x,c as Jn,l as m,bL as Kn,bM as Zn,aE as Qn,aC as Se,an as Ce,al as er,az as nr,bd as rr}from"./index-BW6XEiuj.js";import{i as U,a as O,d as Ie,e as H,b as z,c as tn,f as le,g as an,h as tr,j as on,s as ar,o as ir,k as or,l as he,m as sr,r as dr,U as Re,S as ke,n as pe,p as ge,q as V,t as sn,u as dn,v as ur,w as I,x as fr,y as cr,z as lr,A as Me,B as hr,C as un,D as M,E as pr,F as gr,H as vr,I as X,J as fn,K as cn,L as br,M as ve,N as ln,O as wr,P as hn,Q as mr,R as yr,G as N,T as l,V as xr,W as L,X as $,Y as R,Z as J}from"./graph-D8UmR1vK.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var Er=/\s/;function Lr(e){for(var n=e.length;n--&&Er.test(e.charAt(n)););return n}var Or=/^\s+/;function Nr(e){return e&&e.slice(0,Lr(e)+1).replace(Or,"")}var _e=NaN,Pr=/^[-+]0x[0-9a-f]+$/i,Tr=/^0b[01]+$/i,Sr=/^0o[0-7]+$/i,Cr=parseInt;function Ir(e){if(typeof e=="number")return e;if(U(e))return _e;if(O(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=O(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Nr(e);var r=Tr.test(e);return r||Sr.test(e)?Cr(e.slice(2),r?2:8):Pr.test(e)?_e:+e}var Ae=1/0,Rr=17976931348623157e292;function G(e){if(!e)return e===0?e:0;if(e=Ir(e),e===Ae||e===-Ae){var n=e<0?-1:1;return n*Rr}return e===e?e:0}function kr(e){var n=G(e),r=n%1;return n===n?r?n-r:n:0}var je=Object.create,Mr=(function(){function e(){}return function(n){if(!O(n))return{};if(je)return je(n);e.prototype=n;var r=new e;return e.prototype=void 0,r}})();function _r(e,n){var r=-1,t=e.length;for(n||(n=Array(t));++r<t;)n[r]=e[r];return n}function K(e,n,r){n=="__proto__"&&Ie?Ie(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}var Ar=Object.prototype,jr=Ar.hasOwnProperty;function Z(e,n,r){var t=e[n];(!(jr.call(e,n)&&H(t,r))||r===void 0&&!(n in e))&&K(e,n,r)}function Dr(e,n,r,t){var a=!r;r||(r={});for(var o=-1,i=n.length;++o<i;){var s=n[o],d=void 0;d===void 0&&(d=e[s]),a?K(r,s,d):Z(r,s,d)}return r}function j(e,n,r){if(!O(r))return!1;var t=typeof n;return(t=="number"?z(r)&&tn(n,r.length):t=="string"&&n in r)?H(r[n],e):!1}function Br(e){return le(function(n,r){var t=-1,a=r.length,o=a>1?r[a-1]:void 0,i=a>2?r[2]:void 0;for(o=e.length>3&&typeof o=="function"?(a--,o):void 0,i&&j(r[0],r[1],i)&&(o=a<3?void 0:o,a=1),n=Object(n);++t<a;){var s=r[t];s&&e(n,s,t,o)}return n})}function $r(e){var n=[];if(e!=null)for(var r in Object(e))n.push(r);return n}var Fr=Object.prototype,Xr=Fr.hasOwnProperty;function Gr(e){if(!O(e))return $r(e);var n=an(e),r=[];for(var t in e)t=="constructor"&&(n||!Xr.call(e,t))||r.push(t);return r}function Q(e){return z(e)?tr(e,!0):Gr(e)}function _(e){var n=e==null?0:e.length;return n?on(e):[]}function Yr(e){return ar(ir(e,void 0,_),e+"")}var pn=or(Object.getPrototypeOf,Object),Ur="[object Object]",Vr=Function.prototype,Wr=Object.prototype,gn=Vr.toString,qr=Wr.hasOwnProperty,Hr=gn.call(Object);function zr(e){if(!he(e)||sr(e)!=Ur)return!1;var n=pn(e);if(n===null)return!0;var r=qr.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&gn.call(r)==Hr}var vn=typeof exports=="object"&&exports&&!exports.nodeType&&exports,De=vn&&typeof module=="object"&&module&&!module.nodeType&&module,Jr=De&&De.exports===vn,Be=Jr?dr.Buffer:void 0,$e=Be?Be.allocUnsafe:void 0;function bn(e,n){if(n)return e.slice();var r=e.length,t=$e?$e(r):new e.constructor(r);return e.copy(t),t}var Kr=Object.prototype,Zr=Kr.hasOwnProperty;function Qr(e){var n=e.length,r=new e.constructor(n);return n&&typeof e[0]=="string"&&Zr.call(e,"index")&&(r.index=e.index,r.input=e.input),r}function be(e){var n=new e.constructor(e.byteLength);return new Re(n).set(new Re(e)),n}function et(e,n){var r=be(e.buffer);return new e.constructor(r,e.byteOffset,e.byteLength)}var nt=/\w*$/;function rt(e){var n=new e.constructor(e.source,nt.exec(e));return n.lastIndex=e.lastIndex,n}var Fe=ke?ke.prototype:void 0,Xe=Fe?Fe.valueOf:void 0;function tt(e){return Xe?Object(Xe.call(e)):{}}function wn(e,n){var r=n?be(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}var at="[object Boolean]",it="[object Date]",ot="[object Map]",st="[object Number]",dt="[object RegExp]",ut="[object Set]",ft="[object String]",ct="[object Symbol]",lt="[object ArrayBuffer]",ht="[object DataView]",pt="[object Float32Array]",gt="[object Float64Array]",vt="[object Int8Array]",bt="[object Int16Array]",wt="[object Int32Array]",mt="[object Uint8Array]",yt="[object Uint8ClampedArray]",xt="[object Uint16Array]",Et="[object Uint32Array]";function Lt(e,n,r){var t=e.constructor;switch(n){case lt:return be(e);case at:case it:return new t(+e);case ht:return et(e);case pt:case gt:case vt:case bt:case wt:case mt:case yt:case xt:case Et:return wn(e,r);case ot:return new t;case st:case ft:return new t(e);case dt:return rt(e);case ut:return new t;case ct:return tt(e)}}function mn(e){return typeof e.constructor=="function"&&!an(e)?Mr(pn(e)):{}}var Ot="[object Map]";function Nt(e){return he(e)&&pe(e)==Ot}var Ge=V&&V.isMap,Pt=Ge?ge(Ge):Nt,Tt="[object Set]";function St(e){return he(e)&&pe(e)==Tt}var Ye=V&&V.isSet,Ct=Ye?ge(Ye):St,It=1,yn="[object Arguments]",Rt="[object Array]",kt="[object Boolean]",Mt="[object Date]",_t="[object Error]",xn="[object Function]",At="[object GeneratorFunction]",jt="[object Map]",Dt="[object Number]",En="[object Object]",Bt="[object RegExp]",$t="[object Set]",Ft="[object String]",Xt="[object Symbol]",Gt="[object WeakMap]",Yt="[object ArrayBuffer]",Ut="[object DataView]",Vt="[object Float32Array]",Wt="[object Float64Array]",qt="[object Int8Array]",Ht="[object Int16Array]",zt="[object Int32Array]",Jt="[object Uint8Array]",Kt="[object Uint8ClampedArray]",Zt="[object Uint16Array]",Qt="[object Uint32Array]",y={};y[yn]=y[Rt]=y[Yt]=y[Ut]=y[kt]=y[Mt]=y[Vt]=y[Wt]=y[qt]=y[Ht]=y[zt]=y[jt]=y[Dt]=y[En]=y[Bt]=y[$t]=y[Ft]=y[Xt]=y[Jt]=y[Kt]=y[Zt]=y[Qt]=!0;y[_t]=y[xn]=y[Gt]=!1;function Y(e,n,r,t,a,o){var i,s=n&It;if(i!==void 0)return i;if(!O(e))return e;var d=I(e);if(d)i=Qr(e);else{var u=pe(e),f=u==xn||u==At;if(sn(e))return bn(e,s);if(u==En||u==yn||f&&!a)i=f?{}:mn(e);else{if(!y[u])return a?e:{};i=Lt(e,u,s)}}o||(o=new dn);var c=o.get(e);if(c)return c;o.set(e,i),Ct(e)?e.forEach(function(p){i.add(Y(p,n,r,p,e,o))}):Pt(e)&&e.forEach(function(p,g){i.set(g,Y(p,n,r,g,e,o))});var h=fr,v=d?void 0:h(e);return ur(v||e,function(p,g){v&&(g=p,p=e[g]),Z(i,g,Y(p,n,r,g,e,o))}),i}var ea=1,na=4;function ra(e){return Y(e,ea|na)}var Ln=Object.prototype,ta=Ln.hasOwnProperty,aa=le(function(e,n){e=Object(e);var r=-1,t=n.length,a=t>2?n[2]:void 0;for(a&&j(n[0],n[1],a)&&(t=1);++r<t;)for(var o=n[r],i=Q(o),s=-1,d=i.length;++s<d;){var u=i[s],f=e[u];(f===void 0||H(f,Ln[u])&&!ta.call(e,u))&&(e[u]=o[u])}return e});function se(e,n,r){(r!==void 0&&!H(e[n],r)||r===void 0&&!(n in e))&&K(e,n,r)}function de(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}function ia(e){return Dr(e,Q(e))}function oa(e,n,r,t,a,o,i){var s=de(e,r),d=de(n,r),u=i.get(d);if(u){se(e,r,u);return}var f=o?o(s,d,r+"",e,n,i):void 0,c=f===void 0;if(c){var h=I(d),v=!h&&sn(d),p=!h&&!v&&cr(d);f=d,h||v||p?I(s)?f=s:lr(s)?f=_r(s):v?(c=!1,f=bn(d,!0)):p?(c=!1,f=wn(d,!0)):f=[]:zr(d)||Me(d)?(f=s,Me(s)?f=ia(s):(!O(s)||hr(s))&&(f=mn(d))):c=!1}c&&(i.set(d,f),a(f,d,t,o,i),i.delete(d)),se(e,r,f)}function On(e,n,r,t,a){e!==n&&un(n,function(o,i){if(a||(a=new dn),O(o))oa(e,n,i,r,On,t,a);else{var s=t?t(de(e,i),o,i+"",e,n,a):void 0;s===void 0&&(s=o),se(e,i,s)}},Q)}function W(e){var n=e==null?0:e.length;return n?e[n-1]:void 0}function sa(e){return function(n,r,t){var a=Object(n);if(!z(n)){var o=M(r);n=pr(n),r=function(s){return o(a[s],s,a)}}var i=e(n,r,t);return i>-1?a[o?n[i]:i]:void 0}}var da=Math.max;function ua(e,n,r){var t=e==null?0:e.length;if(!t)return-1;var a=r==null?0:kr(r);return a<0&&(a=da(t+a,0)),gr(e,M(n),a)}var we=sa(ua);function Nn(e,n){var r=-1,t=z(e)?Array(e.length):[];return vr(e,function(a,o,i){t[++r]=n(a,o,i)}),t}function E(e,n){var r=I(e)?X:Nn;return r(e,M(n))}function fa(e,n){return e==null?e:un(e,fn(n),Q)}function ca(e,n){return e&&cn(e,fn(n))}function la(e,n){return e>n}var ha=Object.prototype,pa=ha.hasOwnProperty;function ga(e,n){return e!=null&&pa.call(e,n)}function Pn(e,n){return e!=null&&br(e,n,ga)}function Tn(e,n){return e<n}function ee(e,n){var r={};return n=M(n),cn(e,function(t,a,o){K(r,a,n(t,a,o))}),r}function me(e,n,r){for(var t=-1,a=e.length;++t<a;){var o=e[t],i=n(o);if(i!=null&&(s===void 0?i===i&&!U(i):r(i,s)))var s=i,d=o}return d}function S(e){return e&&e.length?me(e,ve,la):void 0}var ue=Br(function(e,n,r){On(e,n,r)});function D(e){return e&&e.length?me(e,ve,Tn):void 0}function ye(e,n){return e&&e.length?me(e,M(n),Tn):void 0}function va(e,n,r,t){if(!O(e))return e;n=ln(n,e);for(var a=-1,o=n.length,i=o-1,s=e;s!=null&&++a<o;){var d=wr(n[a]),u=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(a!=i){var f=s[d];u=void 0,u===void 0&&(u=O(f)?f:tn(n[a+1])?[]:{})}Z(s,d,u),s=s[d]}return e}function ba(e,n,r){for(var t=-1,a=n.length,o={};++t<a;){var i=n[t],s=hn(e,i);r(s,i)&&va(o,ln(i,e),s)}return o}function wa(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function ma(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,o=U(e),i=n!==void 0,s=n===null,d=n===n,u=U(n);if(!s&&!u&&!o&&e>n||o&&i&&d&&!s&&!u||t&&i&&d||!r&&d||!a)return 1;if(!t&&!o&&!u&&e<n||u&&r&&a&&!t&&!o||s&&r&&a||!i&&a||!d)return-1}return 0}function ya(e,n,r){for(var t=-1,a=e.criteria,o=n.criteria,i=a.length,s=r.length;++t<i;){var d=ma(a[t],o[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function xa(e,n,r){n.length?n=X(n,function(o){return I(o)?function(i){return hn(i,o.length===1?o[0]:o)}:o}):n=[ve];var t=-1;n=X(n,ge(M));var a=Nn(e,function(o,i,s){var d=X(n,function(u){return u(o)});return{criteria:d,index:++t,value:o}});return wa(a,function(o,i){return ya(o,i,r)})}function Ea(e,n){return ba(e,n,function(r,t){return mr(e,t)})}var q=Yr(function(e,n){return e==null?{}:Ea(e,n)}),La=Math.ceil,Oa=Math.max;function Na(e,n,r,t){for(var a=-1,o=Oa(La((n-e)/(r||1)),0),i=Array(o);o--;)i[++a]=e,e+=r;return i}function Pa(e){return function(n,r,t){return t&&typeof t!="number"&&j(n,r,t)&&(r=t=void 0),n=G(n),r===void 0?(r=n,n=0):r=G(r),t=t===void 0?n<r?1:-1:G(t),Na(n,r,t)}}var k=Pa(),F=le(function(e,n){if(e==null)return[];var r=n.length;return r>1&&j(e,n[0],n[1])?n=[]:r>2&&j(n[0],n[1],n[2])&&(n=[n[0]]),xa(e,on(n),[])}),Ta=0;function xe(e){var n=++Ta;return yr(e)+n}function Sa(e,n,r){for(var t=-1,a=e.length,o=n.length,i={};++t<a;){var s=t<o?n[t]:void 0;r(i,e[t],s)}return i}function Ca(e,n){return Sa(e||[],n||[],Z)}class Ia{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return Ue(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&Ue(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Ra)),t=t._prev;return"["+n.join(", ")+"]"}}function Ue(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ra(e,n){if(e!=="_next"&&e!=="_prev")return n}var ka=xr(1);function Ma(e,n){if(e.nodeCount()<=1)return[];var r=Aa(e,n||ka),t=_a(r.graph,r.buckets,r.zeroIdx);return _(E(t,function(a){return e.outEdges(a.v,a.w)}))}function _a(e,n,r){for(var t=[],a=n[n.length-1],o=n[0],i;e.nodeCount();){for(;i=o.dequeue();)re(e,n,r,i);for(;i=a.dequeue();)re(e,n,r,i);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(i=n[s].dequeue(),i){t=t.concat(re(e,n,r,i,!0));break}}}return t}function re(e,n,r,t,a){var o=a?[]:void 0;return l(e.inEdges(t.v),function(i){var s=e.edge(i),d=e.node(i.v);a&&o.push({v:i.v,w:i.w}),d.out-=s,fe(n,r,d)}),l(e.outEdges(t.v),function(i){var s=e.edge(i),d=i.w,u=e.node(d);u.in-=s,fe(n,r,u)}),e.removeNode(t.v),o}function Aa(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var o=k(a+t+3).map(function(){return new Ia}),i=t+1;return l(r.nodes(),function(s){fe(o,i,r.node(s))}),{graph:r,buckets:o,zeroIdx:i}}function fe(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function ja(e){var n=e.graph().acyclicer==="greedy"?Ma(e,r(e)):Da(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,xe("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Da(e){var n=[],r={},t={};function a(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,l(e.outEdges(o),function(i){Object.prototype.hasOwnProperty.call(r,i.w)?n.push(i):a(i.w)}),delete r[o])}return l(e.nodes(),a),n}function Ba(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function A(e,n,r,t){var a;do a=xe(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function $a(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function Sn(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Ve(e,n){var r=e.x,t=e.y,a=n.x-r,o=n.y-t,i=e.width/2,s=e.height/2;if(!a&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(o)*i>Math.abs(a)*s?(o<0&&(s=-s),d=s*a/o,u=s):(a<0&&(i=-i),d=i,u=i*o/a),{x:r+d,y:t+u}}function ne(e){var n=E(k(Cn(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;L(a)||(n[a][t.order]=r)}),n}function Fa(e){var n=D(E(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);Pn(t,"rank")&&(t.rank-=n)})}function Xa(e){var n=D(E(e.nodes(),function(o){return e.node(o).rank})),r=[];l(e.nodes(),function(o){var i=e.node(o).rank-n;r[i]||(r[i]=[]),r[i].push(o)});var t=0,a=e.graph().nodeRankFactor;l(r,function(o,i){L(o)&&i%a!==0?--t:t&&l(o,function(s){e.node(s).rank+=t})})}function We(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),A(e,"border",a,n)}function Cn(e){return S(E(e.nodes(),function(n){var r=e.node(n).rank;if(!L(r))return r}))}function Ga(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ya(e,n){return n()}function Ua(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,i=a.maxRank+1;o<i;++o)qe(e,"borderLeft","_bl",r,a,o),qe(e,"borderRight","_br",r,a,o)}}l(e.children(),n)}function qe(e,n,r,t,a,o){var i={width:0,height:0,rank:o,borderType:n},s=a[n][o-1],d=A(e,"border",i,r);a[n][o]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Va(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&In(e)}function Wa(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&qa(e),(n==="lr"||n==="rl")&&(Ha(e),In(e))}function In(e){l(e.nodes(),function(n){He(e.node(n))}),l(e.edges(),function(n){He(e.edge(n))})}function He(e){var n=e.width;e.width=e.height,e.height=n}function qa(e){l(e.nodes(),function(n){te(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,te),Object.prototype.hasOwnProperty.call(r,"y")&&te(r)})}function te(e){e.y=-e.y}function Ha(e){l(e.nodes(),function(n){ae(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,ae),Object.prototype.hasOwnProperty.call(r,"x")&&ae(r)})}function ae(e){var n=e.x;e.x=e.y,e.y=n}function za(e){e.graph().dummyChains=[],l(e.edges(),function(n){Ja(e,n)})}function Ja(e,n){var r=n.v,t=e.node(r).rank,a=n.w,o=e.node(a).rank,i=n.name,s=e.edge(n),d=s.labelRank;if(o!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<o;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=A(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},i),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},i)}}function Ka(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function Ee(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var o=D(E(e.outEdges(t),function(i){return r(i.w)-e.edge(i).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),a.rank=o}l(e.sources(),r)}function B(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function Rn(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,o;Za(n,e)<t;)a=Qa(n,e),o=n.hasNode(a.v)?B(e,a):-B(e,a),ei(n,e,o);return n}function Za(e,n){function r(t){l(n.nodeEdges(t),function(a){var o=a.v,i=t===o?a.w:o;!e.hasNode(i)&&!B(n,a)&&(e.setNode(i,{}),e.setEdge(t,i,{}),r(i))})}return l(e.nodes(),r),e.nodeCount()}function Qa(e,n){return ye(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return B(n,r)})}function ei(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function ni(){}ni.prototype=new Error;function kn(e,n,r){I(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],o={};return l(n,function(i){if(!e.hasNode(i))throw new Error("Graph does not have node: "+i);Mn(e,i,r==="post",o,t,a)}),a}function Mn(e,n,r,t,a,o){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||o.push(n),l(a(n),function(i){Mn(e,i,r,t,a,o)}),r&&o.push(n))}function ri(e,n){return kn(e,n,"post")}function ti(e,n){return kn(e,n,"pre")}C.initLowLimValues=Oe;C.initCutValues=Le;C.calcCutValue=_n;C.leaveEdge=jn;C.enterEdge=Dn;C.exchangeEdges=Bn;function C(e){e=$a(e),Ee(e);var n=Rn(e);Oe(n),Le(n,e);for(var r,t;r=jn(n);)t=Dn(n,e,r),Bn(n,e,r,t)}function Le(e,n){var r=ri(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){ai(e,n,t)})}function ai(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=_n(e,n,r)}function _n(e,n,r){var t=e.node(r),a=t.parent,o=!0,i=n.edge(r,a),s=0;return i||(o=!1,i=n.edge(a,r)),s=i.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===o,h=n.edge(d).weight;if(s+=c?h:-h,oi(e,r,f)){var v=e.edge(r,f).cutvalue;s+=c?-v:v}}}),s}function Oe(e,n){arguments.length<2&&(n=e.nodes()[0]),An(e,{},1,n)}function An(e,n,r,t,a){var o=r,i=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=An(e,n,r,s,t))}),i.low=o,i.lim=r++,a?i.parent=a:delete i.parent,r}function jn(e){return we(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Dn(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var o=e.node(t),i=e.node(a),s=o,d=!1;o.lim>i.lim&&(s=i,d=!0);var u=$(n.edges(),function(f){return d===ze(e,e.node(f.v),s)&&d!==ze(e,e.node(f.w),s)});return ye(u,function(f){return B(n,f)})}function Bn(e,n,r,t){var a=r.v,o=r.w;e.removeEdge(a,o),e.setEdge(t.v,t.w,{}),Oe(e),Le(e,n),ii(e,n)}function ii(e,n){var r=we(e.nodes(),function(a){return!n.node(a).parent}),t=ti(e,r);t=t.slice(1),l(t,function(a){var o=e.node(a).parent,i=n.edge(a,o),s=!1;i||(i=n.edge(o,a),s=!0),n.node(a).rank=n.node(o).rank+(s?i.minlen:-i.minlen)})}function oi(e,n,r){return e.hasEdge(n,r)}function ze(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function si(e){switch(e.graph().ranker){case"network-simplex":Je(e);break;case"tight-tree":ui(e);break;case"longest-path":di(e);break;default:Je(e)}}var di=Ee;function ui(e){Ee(e),Rn(e)}function Je(e){C(e)}function fi(e){var n=A(e,"root",{},"_root"),r=ci(e),t=S(R(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(i){e.edge(i).minlen*=a});var o=li(e)+1;l(e.children(),function(i){$n(e,n,a,o,t,r,i)}),e.graph().nodeRankFactor=a}function $n(e,n,r,t,a,o,i){var s=e.children(i);if(!s.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var d=We(e,"_bt"),u=We(e,"_bb"),f=e.node(i);e.setParent(d,i),f.borderTop=d,e.setParent(u,i),f.borderBottom=u,l(s,function(c){$n(e,n,r,t,a,o,c);var h=e.node(c),v=h.borderTop?h.borderTop:c,p=h.borderBottom?h.borderBottom:c,g=h.borderTop?t:2*t,b=v!==p?1:a-o[i]+1;e.setEdge(d,v,{weight:g,minlen:b,nestingEdge:!0}),e.setEdge(p,u,{weight:g,minlen:b,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,d,{weight:0,minlen:a+o[i]})}function ci(e){var n={};function r(t,a){var o=e.children(t);o&&o.length&&l(o,function(i){r(i,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function li(e){return J(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function hi(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function pi(e,n,r){var t={},a;l(r,function(o){for(var i=e.parent(o),s,d;i;){if(s=e.parent(i),s?(d=t[s],t[s]=i):(d=a,a=i),d&&d!==i){n.setEdge(d,i);return}i=s}})}function gi(e,n,r){var t=vi(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return l(e.nodes(),function(o){var i=e.node(o),s=e.parent(o);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(a.setNode(o),a.setParent(o,s||t),l(e[r](o),function(d){var u=d.v===o?d.w:d.v,f=a.edge(u,o),c=L(f)?0:f.weight;a.setEdge(u,o,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&a.setNode(o,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),a}function vi(e){for(var n;e.hasNode(n=xe("_root")););return n}function bi(e,n){for(var r=0,t=1;t<n.length;++t)r+=wi(e,n[t-1],n[t]);return r}function wi(e,n,r){for(var t=Ca(r,E(r,function(u,f){return f})),a=_(E(n,function(u){return F(E(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var i=2*o-1;o-=1;var s=E(new Array(i),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+o;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function mi(e){var n={},r=$(e.nodes(),function(s){return!e.children(s).length}),t=S(E(r,function(s){return e.node(s).rank})),a=E(k(t+1),function(){return[]});function o(s){if(!Pn(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),o)}}var i=F(r,function(s){return e.node(s).rank});return l(i,o),a}function yi(e,n){return E(n,function(r){var t=e.inEdges(r);if(t.length){var a=J(t,function(o,i){var s=e.edge(i),d=e.node(i.v);return{sum:o.sum+s.weight*d.order,weight:o.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function xi(e,n){var r={};l(e,function(a,o){var i=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:o};L(a.barycenter)||(i.barycenter=a.barycenter,i.weight=a.weight)}),l(n.edges(),function(a){var o=r[a.v],i=r[a.w];!L(o)&&!L(i)&&(i.indegree++,o.out.push(r[a.w]))});var t=$(r,function(a){return!a.indegree});return Ei(t)}function Ei(e){var n=[];function r(o){return function(i){i.merged||(L(i.barycenter)||L(o.barycenter)||i.barycenter>=o.barycenter)&&Li(o,i)}}function t(o){return function(i){i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return E($(n,function(o){return!o.merged}),function(o){return q(o,["vs","i","barycenter","weight"])})}function Li(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function Oi(e,n){var r=Ga(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=F(r.rhs,function(f){return-f.i}),o=[],i=0,s=0,d=0;t.sort(Ni(!!n)),d=Ke(o,a,d),l(t,function(f){d+=f.vs.length,o.push(f.vs),i+=f.barycenter*f.weight,s+=f.weight,d=Ke(o,a,d)});var u={vs:_(o)};return s&&(u.barycenter=i/s,u.weight=s),u}function Ke(e,n,r){for(var t;n.length&&(t=W(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function Ni(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function Fn(e,n,r,t){var a=e.children(n),o=e.node(n),i=o?o.borderLeft:void 0,s=o?o.borderRight:void 0,d={};i&&(a=$(a,function(p){return p!==i&&p!==s}));var u=yi(e,a);l(u,function(p){if(e.children(p.v).length){var g=Fn(e,p.v,r,t);d[p.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&Ti(p,g)}});var f=xi(u,r);Pi(f,d);var c=Oi(f,t);if(i&&(c.vs=_([i,c.vs,s]),e.predecessors(i).length)){var h=e.node(e.predecessors(i)[0]),v=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+v.order)/(c.weight+2),c.weight+=2}return c}function Pi(e,n){l(e,function(r){r.vs=_(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function Ti(e,n){L(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function Si(e){var n=Cn(e),r=Ze(e,k(1,n+1),"inEdges"),t=Ze(e,k(n-1,-1,-1),"outEdges"),a=mi(e);Qe(e,a);for(var o=Number.POSITIVE_INFINITY,i,s=0,d=0;d<4;++s,++d){Ci(s%2?r:t,s%4>=2),a=ne(e);var u=bi(e,a);u<o&&(d=0,i=ra(a),o=u)}Qe(e,i)}function Ze(e,n,r){return E(n,function(t){return gi(e,t,r)})}function Ci(e,n){var r=new N;l(e,function(t){var a=t.graph().root,o=Fn(t,a,r,n);l(o.vs,function(i,s){t.node(i).order=s}),pi(t,r,o.vs)})}function Qe(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function Ii(e){var n=ki(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,o=Ri(e,n,a.v,a.w),i=o.path,s=o.lca,d=0,u=i[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=i[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<i.length-1&&e.node(u=i[d+1]).minRank<=t.rank;)d++;u=i[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Ri(e,n,r,t){var a=[],o=[],i=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>i||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)o.push(d);return{path:a.concat(o.reverse()),lca:u}}function ki(e){var n={},r=0;function t(a){var o=r;l(e.children(a),t),n[a]={low:o,lim:r++}}return l(e.children(),t),n}function Mi(e,n){var r={};function t(a,o){var i=0,s=0,d=a.length,u=W(o);return l(o,function(f,c){var h=Ai(e,f),v=h?e.node(h).order:d;(h||f===u)&&(l(o.slice(s,c+1),function(p){l(e.predecessors(p),function(g){var b=e.node(g),w=b.order;(w<i||v<w)&&!(b.dummy&&e.node(p).dummy)&&Xn(r,g,p)})}),s=c+1,i=v)}),o}return J(n,t),r}function _i(e,n){var r={};function t(o,i,s,d,u){var f;l(k(i,s),function(c){f=o[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var v=e.node(h);v.dummy&&(v.order<d||v.order>u)&&Xn(r,h,f)})})}function a(o,i){var s=-1,d,u=0;return l(i,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(i,u,c,s,d),u=c,s=d)}t(i,u,i.length,d,o.length)}),i}return J(n,a),r}function Ai(e,n){if(e.node(n).dummy)return we(e.predecessors(n),function(r){return e.node(r).dummy})}function Xn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function ji(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Di(e,n,r,t){var a={},o={},i={};return l(n,function(s){l(s,function(d,u){a[d]=d,o[d]=d,i[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=F(f,function(g){return i[g]});for(var c=(f.length-1)/2,h=Math.floor(c),v=Math.ceil(c);h<=v;++h){var p=f[h];o[u]===u&&d<i[p]&&!ji(r,u,p)&&(o[p]=u,o[u]=a[u]=a[p],d=i[p])}}})}),{root:a,align:o}}function Bi(e,n,r,t,a){var o={},i=$i(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var v=i.nodes(),p=v.pop(),g={};p;)g[p]?c(p):(g[p]=!0,v.push(p),v=v.concat(h(p))),p=v.pop()}function u(c){o[c]=i.inEdges(c).reduce(function(h,v){return Math.max(h,o[v.v]+i.edge(v))},0)}function f(c){var h=i.outEdges(c).reduce(function(p,g){return Math.min(p,o[g.w]-i.edge(g))},Number.POSITIVE_INFINITY),v=e.node(c);h!==Number.POSITIVE_INFINITY&&v.borderType!==s&&(o[c]=Math.max(o[c],h))}return d(u,i.predecessors.bind(i)),d(f,i.successors.bind(i)),l(t,function(c){o[c]=o[r[c]]}),o}function $i(e,n,r,t){var a=new N,o=e.graph(),i=Ui(o.nodesep,o.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(i(e,u,d),h||0))}d=u})}),a}function Fi(e,n){return ye(R(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return fa(r,function(o,i){var s=Vi(e,i)/2;t=Math.max(o+s,t),a=Math.min(o-s,a)}),t-a})}function Xi(e,n){var r=R(n),t=D(r),a=S(r);l(["u","d"],function(o){l(["l","r"],function(i){var s=o+i,d=e[s],u;if(d!==n){var f=R(d);u=i==="l"?t-D(f):a-S(f),u&&(e[s]=ee(d,function(c){return c+u}))}})})}function Gi(e,n){return ee(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=F(E(e,t));return(a[1]+a[2])/2})}function Yi(e){var n=ne(e),r=ue(Mi(e,n),_i(e,n)),t={},a;l(["u","d"],function(i){a=i==="u"?n:R(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=E(a,function(c){return R(c).reverse()}));var d=(i==="u"?e.predecessors:e.successors).bind(e),u=Di(e,a,r,d),f=Bi(e,a,u.root,u.align,s==="r");s==="r"&&(f=ee(f,function(c){return-c})),t[i+s]=f})});var o=Fi(e,t);return Xi(t,o),Gi(t,e.graph().align)}function Ui(e,n,r){return function(t,a,o){var i=t.node(a),s=t.node(o),d=0,u;if(d+=i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":u=-i.width/2;break;case"r":u=i.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(i.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Vi(e,n){return e.node(n).width}function Wi(e){e=Sn(e),qi(e),ca(Yi(e),function(n,r){e.node(r).x=n})}function qi(e){var n=ne(e),r=e.graph().ranksep,t=0;l(n,function(a){var o=S(E(a,function(i){return e.node(i).height}));l(a,function(i){e.node(i).y=t+o/2}),t+=o+r})}function Hi(e,n){var r=Ya;r("layout",()=>{var t=r(" buildLayoutGraph",()=>io(e));r(" runLayout",()=>zi(t,r)),r(" updateInputGraph",()=>Ji(e,t))})}function zi(e,n){n(" makeSpaceForEdgeLabels",()=>oo(e)),n(" removeSelfEdges",()=>vo(e)),n(" acyclic",()=>ja(e)),n(" nestingGraph.run",()=>fi(e)),n(" rank",()=>si(Sn(e))),n(" injectEdgeLabelProxies",()=>so(e)),n(" removeEmptyRanks",()=>Xa(e)),n(" nestingGraph.cleanup",()=>hi(e)),n(" normalizeRanks",()=>Fa(e)),n(" assignRankMinMax",()=>uo(e)),n(" removeEdgeLabelProxies",()=>fo(e)),n(" normalize.run",()=>za(e)),n(" parentDummyChains",()=>Ii(e)),n(" addBorderSegments",()=>Ua(e)),n(" order",()=>Si(e)),n(" insertSelfEdges",()=>bo(e)),n(" adjustCoordinateSystem",()=>Va(e)),n(" position",()=>Wi(e)),n(" positionSelfEdges",()=>wo(e)),n(" removeBorderNodes",()=>go(e)),n(" normalize.undo",()=>Ka(e)),n(" fixupEdgeLabelCoords",()=>ho(e)),n(" undoCoordinateSystem",()=>Wa(e)),n(" translateGraph",()=>co(e)),n(" assignNodeIntersects",()=>lo(e)),n(" reversePoints",()=>po(e)),n(" acyclic.undo",()=>Ba(e))}function Ji(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Ki=["nodesep","edgesep","ranksep","marginx","marginy"],Zi={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Qi=["acyclicer","ranker","rankdir","align"],eo=["width","height"],no={width:0,height:0},ro=["minlen","weight","width","height","labeloffset"],to={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ao=["labelpos"];function io(e){var n=new N({multigraph:!0,compound:!0}),r=oe(e.graph());return n.setGraph(ue({},Zi,ie(r,Ki),q(r,Qi))),l(e.nodes(),function(t){var a=oe(e.node(t));n.setNode(t,aa(ie(a,eo),no)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=oe(e.edge(t));n.setEdge(t,ue({},to,ie(a,ro),q(a,ao)))}),n}function oo(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function so(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),o={rank:(a.rank-t.rank)/2+t.rank,e:n};A(e,"edge-proxy",o,"_ep")}})}function uo(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=S(n,t.maxRank))}),e.graph().maxRank=n}function fo(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function co(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,o=e.graph(),i=o.marginx||0,s=o.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,v=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-v/2),a=Math.max(a,c+v/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=i,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),o.width=r-n+i,o.height=a-t+s}function lo(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),o,i;r.points?(o=r.points[0],i=r.points[r.points.length-1]):(r.points=[],o=a,i=t),r.points.unshift(Ve(t,o)),r.points.push(Ve(a,i))})}function ho(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function po(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function go(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),o=e.node(W(r.borderLeft)),i=e.node(W(r.borderRight));r.width=Math.abs(i.x-o.x),r.height=Math.abs(a.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function vo(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function bo(e){var n=ne(e);l(n,function(r){var t=0;l(r,function(a,o){var i=e.node(a);i.order=o+t,l(i.selfEdges,function(s){A(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++t,e:s.e,label:s.label},"_se")}),delete i.selfEdges})})}function wo(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,o=t.y,i=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*i/3,y:o-s},{x:a+5*i/6,y:o-s},{x:a+i,y:o},{x:a+5*i/6,y:o+s},{x:a+2*i/3,y:o+s}],r.label.x=r.x,r.label.y=r.y}})}function ie(e,n){return ee(q(e,n),Number)}function oe(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var en=x((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),nn=x((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),mo=x(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),yo=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],xo=x((e,n,r,t,a)=>{const o=[],i=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&i.add(f),c!==t&&i.add(c)}),i.forEach(f=>{const c=e.node(f);typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)}),o.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)})}),o.length===0)return nn(a);const s=o.reduce((f,c)=>({x:f.x+c.x/o.length,y:f.y+c.y/o.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":nn(a)},"getSelfLoopSide"),Eo=x((e,n="top",r=0,t=0)=>{const a=e.x,o=e.y-r,i=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=en(Math.max(t,e.width*.35),36,d),f=en(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=o+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+i;return[{x:c,y:o-u/2},{x:c+f,y:o-u/2},{x:c+f,y:o+u/2},{x:c,y:o+u/2}]}case"left":{const c=a-i;return[{x:c,y:o-u/2},{x:c-f,y:o-u/2},{x:c-f,y:o+u/2},{x:c,y:o+u/2}]}default:{const c=o-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),Lo=x((e,n,r="top",t=0,a={})=>{const i=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:i,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};default:return{x:i,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),Gn=x((e,n=0,{mergeSelfLoops:r=!0}={})=>{const t=new Map,a=[],o=e.graph()?.rankdir;return e.edges().forEach(i=>{const s=e.edge(i);if(r&&s.selfLoop){const d=s.selfLoop.id;t.has(d)||t.set(d,[]),t.get(d).push({edge:s,start:i.v,end:i.w})}else a.push({edge:s,start:i.v,end:i.w})}),t.forEach(i=>{if(i.length!==3){i.forEach(w=>a.push(w));return}i.sort((w,P)=>w.edge.selfLoop.order-P.edge.selfLoop.order);const[s,d,u]=i,f=s.edge.originalEdge??d.edge.originalEdge??u.edge.originalEdge??d.edge,c=e.node(f.start);if(!c){i.forEach(w=>a.push(w));return}const h={width:d.edge.width,height:d.edge.height},v=xo(e,c,i,f.start,o),p=Eo(c,v,n,h.width??0),g=Lo(c,p,v,n,h),b={...d.edge,...f,id:f.id,points:p,start:f.start,end:f.end,x:g.x,y:g.y,width:h.width,height:h.height,labelStyle:d.edge.labelStyle,fromCluster:s.edge.fromCluster??d.edge.fromCluster??u.edge.fromCluster,toCluster:s.edge.toCluster??d.edge.toCluster??u.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),Yn=x(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:o})=>{const i=n.graph().rankdir;m.trace("Dir in recursive render - dir:",i);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=Hn(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=mo(r);await Promise.all(n.nodes().map(async function(g){const b=n.node(g);if(a!==void 0){const w=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
|
|
2
2
|
Node.id = `,g,`
|
|
3
3
|
data=`,w.height,`
|
|
4
4
|
Parent cluster`,a.height),n.setNode(a.id,w),n.parent(g)||(m.trace("Setting parent",g,a.id),n.setParent(g,a.id,w))}if(m.info("(Insert) Node XXX"+g+": "+JSON.stringify(n.node(g))),b?.clusterNode){m.info("Cluster identified XBX",g,b.width,n.node(g));const{ranksep:w,nodesep:P}=n.graph();b.graph.setGraph({...b.graph.graph(),ranksep:w+25,nodesep:P});const Ne=await So({element:f,graph:b.graph,diagramType:r,id:t,parentCluster:n.node(g),siteConfig:o}),Pe=Ne.elem;Kn(b,Pe),b.diff=Ne.diff||0,m.info("New compound node after recursive render XAX",g,"width",b.width,"height",b.height),Zn(Pe,b)}else n.children(g).length>0?(m.trace("Cluster - the non recursive path XBX",g,b.id,b,b.width,"Graph:",n),m.trace(Te(b.id,n)),T.set(b.id,{id:Te(b.id,n),node:b})):(m.trace("Node - the non recursive path XAX",g,f,n.node(g),i),await zn(f,n.node(g),{config:o,dir:i}))})),await x(async()=>{const g=n.edges().map(async function(b){const w=n.edge(b.v,b.w,b.name);if(m.info("Edge "+b.v+" -> "+b.w+": "+JSON.stringify(b)),m.info("Edge "+b.v+" -> "+b.w+": ",b," ",JSON.stringify(n.edge(b))),m.info("Fix",T,"ids:",b.v,b.w,"Translating: ",T.get(b.v),T.get(b.w)),h&&w.selfLoop){if(w.selfLoop.order!==1)return;const P={...w.originalEdge,...w,id:w.selfLoop.id,startLabelLeft:w.originalEdge?.startLabelLeft??w.startLabelLeft,startLabelRight:w.originalEdge?.startLabelRight??w.startLabelRight,endLabelLeft:w.originalEdge?.endLabelLeft??w.endLabelLeft,endLabelRight:w.originalEdge?.endLabelRight??w.endLabelRight};await Se(u,P),w.width=P.width,w.height=P.height,w.labelStyle=P.labelStyle;return}await Se(u,w)});await Promise.all(g)},"processEdges")();const{subGraphTitleTotalMargin:p}=Qn(o);return{elem:c,graph:n,groups:{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c},diagramType:r,id:t,mergeSelfLoops:h,subGraphTitleTotalMargin:p}},"measureDagreGraph"),Un=x(e=>{m.info("############################################# XXX"),m.info("### Layout ### XXX"),m.info("############################################# XXX"),Hi(e)},"runDagreGraphLayout"),Oo=x((e,n,r)=>{const t=e.node(n);if(!t)return;const a={...t};return t?.clusterNode?a.y=(t.y??0)+r:e.children(n).length>0?a.height=(t.height??0)+r:a.y=(t.y??0)+r/2,a},"normalizeDagreNode"),rn=x((e,n)=>{yo.forEach(r=>{n[r]!==void 0&&(e[r]=n[r])})},"applyDagreNodeLayout"),No=x((e,n,r,t)=>({...e,start:e.start??n,end:e.end??r,points:(e.points??[]).map(a=>({...a,y:typeof a.y=="number"?a.y+t:a.y}))}),"normalizeDagreEdge"),Po=x((e,n)=>{const{graph:r,mergeSelfLoops:t,subGraphTitleTotalMargin:a=0}=n,o=new Map(e.nodes.map(s=>[s.id,s]));ce(r).forEach(s=>{const d=Oo(r,s,a);if(!d)return;rn(r.node(s),d);const u=o.get(s);u&&rn(u,d)});const i=a/2;return e.edges=Gn(r,i,{mergeSelfLoops:t}).map(({edge:s,start:d,end:u})=>No(s,d,u,i)),e},"applyDagreLayoutResult"),To=x(async({elem:e,graph:n,groups:{clusters:r,edgePaths:t},diagramType:a,id:o,mergeSelfLoops:i,subGraphTitleTotalMargin:s})=>{let d=0;await Promise.all(ce(n).map(async function(c){const h=n.node(c);if(m.info("Position XBX => "+c+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=s,m.info("A tainted cluster node XBX1",c,h.id,h.width,h.height,h.x,h.y,n.parent(c)),T.get(h.id).node=h,Ce(h);else if(n.children(c).length>0){m.info("A pure cluster node XBX1",c,h.id,h.x,h.y,h.width,h.height,n.parent(c)),h.height+=s,n.node(h.parentId);const v=h?.padding/2||0,p=h?.labelBBox?.height||0,g=p-v||0;m.debug("OffsetY",g,"labelHeight",p,"halfPadding",v),await er(r,h),T.get(h.id).node=h}else{const v=n.node(h.parentId);h.y+=s/2,m.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",v,v?.offsetY,h),Ce(h)}}));const u=s/2;return Gn(n,u,{mergeSelfLoops:i}).forEach(function({edge:c,start:h,end:v}){m.info("Edge "+h+" -> "+v+": "+JSON.stringify(c),c),c.points.forEach(w=>w.y+=u);const p=n.node(h),g=n.node(v),b=nr(t,c,T,a,p,g,o);rr(c,b)}),n.nodes().forEach(function(c){const h=n.node(c);m.info(c,h.type,h.diff),h.isGroup&&(d=h.diff)}),m.warn("Returning from recursive render XAX",e,d),{elem:e,diff:d}},"paintDagreLayoutCore"),So=x(async e=>{const n=await Yn(e);return Un(n.graph),await To(n)},"renderDagreSubgraph"),Vn=x(e=>{const n=new N({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(r=>{n.setNode(r.id,{...r}),r.parentId&&n.setParent(r.id,r.parentId)}),m.debug("Edges:",e.edges),e.edges.forEach(r=>{if(r.start===r.end){const t=r.start,a=t+"---"+t+"---1",o=t+"---"+t+"---2",i=n.node(t);n.setNode(a,{domId:a,id:a,parentId:i.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(a,i.parentId),n.setNode(o,{domId:o,id:o,parentId:i.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(o,i.parentId);const s=structuredClone(r),d=structuredClone(r),u=structuredClone(r),f=structuredClone(r);d.originalEdge=s,d.selfLoop={id:s.id,order:0},u.originalEdge=s,u.selfLoop={id:s.id,order:1},f.originalEdge=s,f.selfLoop={id:s.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=t+"-cyclic-special-1",u.startLabelRight="",u.startLabelLeft="",u.endLabelLeft="",u.endLabelRight="",u.arrowTypeStart="none",u.arrowTypeEnd="none",u.id=t+"-cyclic-special-mid",f.label="",f.startLabelRight="",f.startLabelLeft="",f.arrowTypeStart="none",i.isGroup&&(d.fromCluster=t,f.toCluster=t),f.id=t+"-cyclic-special-2",f.arrowTypeStart="none",n.setEdge(t,a,d,t+"-cyclic-special-0"),n.setEdge(a,o,u,t+"-cyclic-special-1"),n.setEdge(o,t,f,t+"-cyclic-special-2")}else n.setEdge(r.start,r.end,{...r},r.id)}),Wn(n),{graph:n}},"prepareLayoutForDagre"),Co=x(async(e,{element:n,preparedLayout:r})=>{const t=r??Vn(e),a=Jn(),o=await Yn({element:n,graph:t.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return t.measuredLayout=o,o},"measureDagreLayout"),Io=x((e,n)=>{const r=n.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return Un(r.graph),Po(e,r),r},"runDagreLayoutCore"),Ro=x((e,{measure:n})=>ce(n.graph).map(r=>n.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),ko=x((e,n,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),Bo=qn({prepareLayout:Vn,measureLayout:Co,runLayoutCore:Io,paintOptions:{clusterDb:T,getNodes:Ro,getEdgeNode:ko,skipNode:x((e,{measure:n})=>!n.graph.hasNode(e.id),"skipNode"),isCluster:x((e,{measure:n})=>n.graph.hasNode(e.id)&&(n.graph.children(e.id)??[]).length>0,"isCluster")}});export{Po as applyDagreLayoutResult,Gn as getEdgesToRender,Co as measureDagreLayout,Vn as prepareLayoutForDagre,Bo as render,Io as runDagreLayoutCore};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as k1}from"./chunk-5VM5RSS4-
|
|
1
|
+
import{g as k1}from"./chunk-5VM5RSS4-BanBytP-.js";import{g as E1}from"./chunk-XXDRQBXY-Bcwqpw0e.js";import{s as C1}from"./chunk-WEXAMYUT-8OgC9IZ9.js";import{_ as k,o as t1,l as oe,c as Ce,p as S1,r as x1,u as Gt,b as T1,s as D1,q as _1,a as v1,g as F1,t as V1,m as I1,v as s1,J as i1,x as L1,y as Rt,k as Ot,z as B1,A as M1,B as y1,C as w1,D as N1,E as R1,F as O1,G as P1}from"./index-BW6XEiuj.js";import{c as G1}from"./chunk-GWA4HPMP-DWBspe_I.js";import{c as U1}from"./channel-B849ahM4.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var tt={SHAPE_UNSUPPORTED:"SHAPE_UNSUPPORTED",SHAPE_REMOVED:"SHAPE_REMOVED",EDGE_OPERATOR_UNSUPPORTED:"EDGE_OPERATOR_UNSUPPORTED",REFERENCE_EDGE_LABEL_REJECTED:"REFERENCE_EDGE_LABEL_REJECTED",CONNECTOR_REF_UNRESOLVED:"CONNECTOR_REF_UNRESOLVED",CONNECTOR_REF_NOT_A_CONNECTOR:"CONNECTOR_REF_NOT_A_CONNECTOR",METADATA_KEY_MISAPPLIED:"METADATA_KEY_MISAPPLIED",DUPLICATE_ID_NODE:"DUPLICATE_ID_NODE",RESERVED_SYNTHETIC_ID:"RESERVED_SYNTHETIC_ID",CONTAINMENT_VIOLATION:"CONTAINMENT_VIOLATION",EDGE_SEMANTIC_CONTRADICTION:"EDGE_SEMANTIC_CONTRADICTION",FLOW_NO_INPUT:"FLOW_NO_INPUT"},j1=new Set([tt.SHAPE_UNSUPPORTED,tt.SHAPE_REMOVED,tt.CONTAINMENT_VIOLATION]);new Set(Object.values(tt).filter(s=>!j1.has(s)));var z1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),W1=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),K1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),$e="roundedRect";function et(s){return s&&(z1.get(s)??s)}k(et,"resolveShapeAlias");function r1(s,i){for(const n of s)if(!n.isGroup){if((!n.shape||n.shape==="squareRect"||n.shape==="rect")&&(n.shape=$e),W1.has(n.shape)){const r=`shape "${n.shape}" was removed in v0.8.1, using "${$e}"`;i?.emitError?i.emitError("SHAPE_REMOVED",r,{nodeId:n.id}):oe.warn(`agentflow: ${r}`),n.shape=$e;continue}if(!K1.has(n.shape)){const r=`shape "${n.shape}" is not supported, using "${$e}"`;i?.emitWarning?i.emitWarning("SHAPE_UNSUPPORTED",r,{nodeId:n.id}):oe.warn(`agentflow: ${r}`),n.shape=$e}}}k(r1,"normaliseNodeShapes");var Lt=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),a1=Lt.size,o1=k(s=>`af-kind-${s}`,"kindClass"),H1=[...Lt.keys()],u1=k(s=>Math.max(1,s-a1),"containerSlotCount"),l1=k((s,i)=>{const n=a1+s%u1(i);return i>0?n%i:n},"containerSlot");function c1(s,i,n){const r=Ce().themeVariables?.borderColorArray,u=Array.isArray(r)?r.length:0;let l=n.size;for(const c of s??[]){if(c.isGroup||c.shape==="collapsedGroup"){const h=n.get(String(c.id))??l++;c.colorIndex=l1(h,u);continue}const a=i(String(c.id));a&&Lt.has(a)&&(c.cssClasses=`${c.cssClasses??""} ${o1(a)}`.replace(/\s+/g," ").trim())}}k(c1,"assignColorSlots");var n1="agentflow-",Pt=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),Y1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),q1={flow:"flowGroup"};function It(s){if(Array.isArray(s))return s.map(n=>It(n));if(s===null||typeof s!="object")return s;const i={};for(const n of Object.keys(s))n==="__proto__"||n==="constructor"||n==="prototype"||(i[n]=It(s[n]));return i}k(It,"stripPrototypeKeys");function d1(s){let i=!1,n=!1,r=0,u;const l=[];for(const c of s.split(`
|
|
2
2
|
`)){if(u!==void 0){const p=c.length-c.trimStart().length;if(c.trim()===""||p>u){l.push(c);continue}u=void 0}let a=-1;for(let p=0;p<c.length;p++){const A=c[p];if(n)A==="\\"?p++:A==='"'&&(n=!1);else if(i)A==="'"&&(i=!1);else if(A==='"')n=!0;else if(A==="'")i=!0;else if(A==="#"&&(p===0||c[p-1]===" "||c[p-1]===" ")){a=p;break}else A==="["||A==="{"?r++:(A==="]"||A==="}")&&(r=Math.max(0,r-1))}if(i||n||r>0){l.push(c);continue}const h=a>=0?c.slice(0,a):c,g=a>=0?c.slice(a):"";if(/:\s*[>|][\d+-]*\s*$/.test(h)){u=c.length-c.trimStart().length,l.push(c);continue}l.push(h.replace(/,([\t ]*)$/,"$1")+g)}return l.join(`
|
|
3
3
|
`)}k(d1,"stripLineTrailingCommas");var Ze,X1=(Ze=class{constructor(){this.vertexCounter=0,this.config=Ce(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId="",this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=T1,this.setAccDescription=D1,this.setDiagramTitle=_1,this.getAccTitle=v1,this.getAccDescription=F1,this.getDiagramTitle=V1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return I1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const n of this.vertices.values())if(n.id===i)return this.diagramId?`${this.diagramId}-${n.domId}`:n.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,n,r,u,l,c,a={},h,g){if(!i||i.trim().length===0)return;let p;if(h!==void 0){let m;h.includes(`
|
|
4
4
|
`)?m=h+`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as ge}from"./chunk-JWPE2WC7-CVgZV6Wp.js";import{_ as w,R as ye,L as ae,N as ee,Q as Se,d as ve,l as te,bB as B,k as Q,b as xe,a as be,q as we,t as Ce,g as Te,s as Le,O as $e,bC as Ae,A as Fe}from"./index-C-cQEbCY.js";import{s as Ne}from"./chunk-WEXAMYUT-IVsvOCJJ.js";import{p as Me}from"./cynefin-OW5HDTMX-BUpMG_46.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,i,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(i=r.length-1;i>=0;--i)n.push(r[i]);return this}function De(t,a){for(var l=this,n=[l],r=[],i,h,d,g=-1;l=n.pop();)if(r.push(l),i=l.children)for(h=0,d=i.length;h<d;++h)n.push(i[h]);for(;l=r.pop();)t.call(a,l,++g,this);return this}function Pe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function Be(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,r=n&&n.length;--r>=0;)l+=n[r].value;a.value=l})}function Re(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Ee(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function qe(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*Ge(){var t=this,a,l=[t],n,r,i;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,i=n.length;r<i;++r)l.push(n[r]);while(l.length)}function ne(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=je)):a===void 0&&(a=Ye);for(var l=new U(t),n,r=[l],i,h,d,g;n=r.pop();)if((h=a(n.data))&&(g=(h=Array.from(h)).length))for(n.children=h,d=g-1;d>=0;--d)r.push(i=h[d]=new U(h[d])),i.parent=n,i.depth=n.depth+1;return l.eachBefore(Ue)}function Xe(){return ne(this).eachBefore(Qe)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Qe(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ue(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function U(t){this.data=t,this.depth=this.height=0,this.parent=null}U.prototype=ne.prototype={constructor:U,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Re,path:Ee,ancestors:He,descendants:Ie,leaves:Oe,links:qe,copy:Xe,[Symbol.iterator]:Ge};function Ze(t){if(typeof t!="function")throw new Error;return t}function q(){return 0}function G(t){return function(){return t}}function Je(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)}function Ke(t,a,l,n,r){for(var i=t.children,h,d=-1,g=i.length,c=t.value&&(n-a)/t.value;++d<g;)h=i[d],h.y0=l,h.y1=r,h.x0=a,h.x1=a+=h.value*c}function et(t,a,l,n,r){for(var i=t.children,h,d=-1,g=i.length,c=t.value&&(r-l)/t.value;++d<g;)h=i[d],h.x0=a,h.x1=n,h.y0=l,h.y1=l+=h.value*c}var tt=(1+Math.sqrt(5))/2;function at(t,a,l,n,r,i){for(var h=[],d=a.children,g,c,p=0,b=0,s=d.length,x,S,v=a.value,u,y,N,$,V,W,M;p<s;){x=r-l,S=i-n;do u=d[b++].value;while(!u&&b<s);for(y=N=u,W=Math.max(S/x,x/S)/(v*t),M=u*u*W,V=Math.max(N/M,M/y);b<s;++b){if(u+=c=d[b].value,c<y&&(y=c),c>N&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x<S,children:d.slice(p,b)}),g.dice?Ke(g,l,n,r,v?n+=S*u/v:i):et(g,l,n,v?l+=x*u/v:r,i),v-=u,p=b}return h}const nt=(function t(a){function l(n,r,i,h,d){at(a,n,r,i,h,d)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],i=q,h=q,d=q,g=q,c=q;function p(s){return s.x0=s.y0=0,s.x1=l,s.y1=n,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u<S&&(S=u=(S+u)/2),y<v&&(v=y=(v+y)/2),s.x0=S,s.y0=v,s.x1=u,s.y1=y,s.children&&(x=r[s.depth+1]=i(s)/2,S+=c(s)-x,v+=h(s)-x,u-=d(s)-x,y-=g(s)-x,u<S&&(S=u=(S+u)/2),y<v&&(v=y=(v+y)/2),t(s,S,v,u,y))}return p.round=function(s){return arguments.length?(a=!!s,p):a},p.size=function(s){return arguments.length?(l=+s[0],n=+s[1],p):[l,n]},p.tile=function(s){return arguments.length?(t=Ze(s),p):t},p.padding=function(s){return arguments.length?p.paddingInner(s).paddingOuter(s):p.paddingInner()},p.paddingInner=function(s){return arguments.length?(i=typeof s=="function"?s:G(+s),p):i},p.paddingOuter=function(s){return arguments.length?p.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s):p.paddingTop()},p.paddingTop=function(s){return arguments.length?(h=typeof s=="function"?s:G(+s),p):h},p.paddingRight=function(s){return arguments.length?(d=typeof s=="function"?s:G(+s),p):d},p.paddingBottom=function(s){return arguments.length?(g=typeof s=="function"?s:G(+s),p):g},p.paddingLeft=function(s){return arguments.length?(c=typeof s=="function"?s:G(+s),p):c},p}var E,oe=(E=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=xe,this.getAccTitle=be,this.setDiagramTitle=we,this.getDiagramTitle=Ce,this.getAccDescription=Te,this.setAccDescription=Le}getNodes(){return this.nodes}getConfig(){const a=$e,l=ae();return ee({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??=a)}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(i=>{Ae(i)&&(n?.textStyles?n.textStyles.push(i):n.textStyles=[i]),n?.styles?n.styles.push(i):n.styles=[i]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){return this.classes.get(a)?.styles??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(E,"TreeMapDB"),E);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n?.classSelector,n?.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const i=l[l.length-1].node;i.children?i.children.push(r):i.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const i of t.TreemapRows??[])i.$type==="ClassDefStatement"&&a.addClass(i.className??"",i.styleText??"");for(const i of t.TreemapRows??[]){const h=i.item;if(!h)continue;const d=i.indent?parseInt(i.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((i,h)=>{for(const d of i)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{try{const l=await Me("treemap",t);te.debug("Treemap AST:",l);const n=he.parser?.yy;if(!(n instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(l,n)}catch(a){throw te.error("Error parsing treemap:",a),a}},"parse")},it=10,R=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,i=r.getConfig(),h=i.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),s=i.nodeWidth?i.nodeWidth*R:960,x=i.nodeHeight?i.nodeHeight*R:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,i.useMaxWidth);let u;try{const e=i.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([s,x]).paddingTop(e=>e.children&&e.children.length>0?X+R:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?R:0).paddingRight(e=>e.children&&e.children.length>0?R:0).paddingBottom(e=>e.children&&e.children.length>0?R:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=Q(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;i.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),i.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,Z=A?2:4,se=A?8:10,J=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=Q(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*Z,P=C-2*Z;if(T<se||P<se){o.style("display","none");return}let m=parseInt(o.style("font-size"),10);const _=.6;for(;L.getComputedTextLength()>T&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(F<I&&m===D));)o.style("font-size",`${m}px`),k=m+J+F;o.style("font-size",`${m}px`),A?(m<D||P<D)&&o.style("display","none"):(L.getComputedTextLength()>T||m<D||P<m)&&o.style("display","none")}),i.showValues!==!1&&j.append("text").attr("class","treemapValue").attr("x",o=>(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=Q(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=Q(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+J;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*Z;f.node().getComputedTextLength()>me||F+m>ie||m<I?f.style("display","none"):f.style("display",null)});const ue=i.diagramPadding??8;Ne(b,ue,"flowchart",i?.useMaxWidth||!1)},"draw"),ct=w(function(t,a){return a.db.getClasses()},"getClasses"),ht={draw:ot,getClasses:ct},dt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},pt=w(({treemap:t}={})=>{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),i=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return`
|
|
1
|
+
import{p as ge}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{_ as w,R as ye,L as ae,N as ee,Q as Se,d as ve,l as te,bB as B,k as Q,b as xe,a as be,q as we,t as Ce,g as Te,s as Le,O as $e,bC as Ae,A as Fe}from"./index-BW6XEiuj.js";import{s as Ne}from"./chunk-WEXAMYUT-8OgC9IZ9.js";import{p as Me}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import{b as O}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,i,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(i=r.length-1;i>=0;--i)n.push(r[i]);return this}function De(t,a){for(var l=this,n=[l],r=[],i,h,d,g=-1;l=n.pop();)if(r.push(l),i=l.children)for(h=0,d=i.length;h<d;++h)n.push(i[h]);for(;l=r.pop();)t.call(a,l,++g,this);return this}function Pe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function Be(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,r=n&&n.length;--r>=0;)l+=n[r].value;a.value=l})}function Re(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Ee(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function qe(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*Ge(){var t=this,a,l=[t],n,r,i;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,i=n.length;r<i;++r)l.push(n[r]);while(l.length)}function ne(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=je)):a===void 0&&(a=Ye);for(var l=new U(t),n,r=[l],i,h,d,g;n=r.pop();)if((h=a(n.data))&&(g=(h=Array.from(h)).length))for(n.children=h,d=g-1;d>=0;--d)r.push(i=h[d]=new U(h[d])),i.parent=n,i.depth=n.depth+1;return l.eachBefore(Ue)}function Xe(){return ne(this).eachBefore(Qe)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Qe(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ue(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function U(t){this.data=t,this.depth=this.height=0,this.parent=null}U.prototype=ne.prototype={constructor:U,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Re,path:Ee,ancestors:He,descendants:Ie,leaves:Oe,links:qe,copy:Xe,[Symbol.iterator]:Ge};function Ze(t){if(typeof t!="function")throw new Error;return t}function q(){return 0}function G(t){return function(){return t}}function Je(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)}function Ke(t,a,l,n,r){for(var i=t.children,h,d=-1,g=i.length,c=t.value&&(n-a)/t.value;++d<g;)h=i[d],h.y0=l,h.y1=r,h.x0=a,h.x1=a+=h.value*c}function et(t,a,l,n,r){for(var i=t.children,h,d=-1,g=i.length,c=t.value&&(r-l)/t.value;++d<g;)h=i[d],h.x0=a,h.x1=n,h.y0=l,h.y1=l+=h.value*c}var tt=(1+Math.sqrt(5))/2;function at(t,a,l,n,r,i){for(var h=[],d=a.children,g,c,p=0,b=0,s=d.length,x,S,v=a.value,u,y,N,$,V,W,M;p<s;){x=r-l,S=i-n;do u=d[b++].value;while(!u&&b<s);for(y=N=u,W=Math.max(S/x,x/S)/(v*t),M=u*u*W,V=Math.max(N/M,M/y);b<s;++b){if(u+=c=d[b].value,c<y&&(y=c),c>N&&(N=c),M=u*u*W,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x<S,children:d.slice(p,b)}),g.dice?Ke(g,l,n,r,v?n+=S*u/v:i):et(g,l,n,v?l+=x*u/v:r,i),v-=u,p=b}return h}const nt=(function t(a){function l(n,r,i,h,d){at(a,n,r,i,h,d)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l})(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],i=q,h=q,d=q,g=q,c=q;function p(s){return s.x0=s.y0=0,s.x1=l,s.y1=n,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u<S&&(S=u=(S+u)/2),y<v&&(v=y=(v+y)/2),s.x0=S,s.y0=v,s.x1=u,s.y1=y,s.children&&(x=r[s.depth+1]=i(s)/2,S+=c(s)-x,v+=h(s)-x,u-=d(s)-x,y-=g(s)-x,u<S&&(S=u=(S+u)/2),y<v&&(v=y=(v+y)/2),t(s,S,v,u,y))}return p.round=function(s){return arguments.length?(a=!!s,p):a},p.size=function(s){return arguments.length?(l=+s[0],n=+s[1],p):[l,n]},p.tile=function(s){return arguments.length?(t=Ze(s),p):t},p.padding=function(s){return arguments.length?p.paddingInner(s).paddingOuter(s):p.paddingInner()},p.paddingInner=function(s){return arguments.length?(i=typeof s=="function"?s:G(+s),p):i},p.paddingOuter=function(s){return arguments.length?p.paddingTop(s).paddingRight(s).paddingBottom(s).paddingLeft(s):p.paddingTop()},p.paddingTop=function(s){return arguments.length?(h=typeof s=="function"?s:G(+s),p):h},p.paddingRight=function(s){return arguments.length?(d=typeof s=="function"?s:G(+s),p):d},p.paddingBottom=function(s){return arguments.length?(g=typeof s=="function"?s:G(+s),p):g},p.paddingLeft=function(s){return arguments.length?(c=typeof s=="function"?s:G(+s),p):c},p}var E,oe=(E=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=xe,this.getAccTitle=be,this.setDiagramTitle=we,this.getDiagramTitle=Ce,this.getAccDescription=Te,this.setAccDescription=Le}getNodes(){return this.nodes}getConfig(){const a=$e,l=ae();return ee({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??=a)}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(i=>{Ae(i)&&(n?.textStyles?n.textStyles.push(i):n.textStyles=[i]),n?.styles?n.styles.push(i):n.styles=[i]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){return this.classes.get(a)?.styles??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(E,"TreeMapDB"),E);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n?.classSelector,n?.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const i=l[l.length-1].node;i.children?i.children.push(r):i.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const i of t.TreemapRows??[])i.$type==="ClassDefStatement"&&a.addClass(i.className??"",i.styleText??"");for(const i of t.TreemapRows??[]){const h=i.item;if(!h)continue;const d=i.indent?parseInt(i.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};l.push(b)}const n=ce(l),r=w((i,h)=>{for(const d of i)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{try{const l=await Me("treemap",t);te.debug("Treemap AST:",l);const n=he.parser?.yy;if(!(n instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(l,n)}catch(a){throw te.error("Error parsing treemap:",a),a}},"parse")},it=10,R=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,i=r.getConfig(),h=i.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const p=d?30:0,b=Se(a),s=i.nodeWidth?i.nodeWidth*R:960,x=i.nodeHeight?i.nodeHeight*R:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,i.useMaxWidth);let u;try{const e=i.valueFormat||",";if(e==="$0,0")u=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";u=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);u=w(f=>"$"+O(o||"")(f),"valueFormat")}else u=O(e)}catch(e){te.error("Error creating format function:",e),u=O(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([s,x]).paddingTop(e=>e.children&&e.children.length>0?X+R:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?R:0).paddingRight(e=>e.children&&e.children.length>0?R:0).paddingBottom(e=>e.children&&e.children.length>0?R:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>N(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=Q(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;i.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=o.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text("..."),_.getComputedTextLength()>m&&o.text("");break}if(o.text(z+"..."),_.getComputedTextLength()<=m)break}}}),i.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?u(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),A=re.length>20,pe=A?16:38,Y=A?14:28,D=A?4:8,I=A?4:6,Z=A?2:4,se=A?8:10,J=A?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${pe}px;fill:`+$(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=Q(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*Z,P=C-2*Z;if(T<se||P<se){o.style("display","none");return}let m=parseInt(o.style("font-size"),10);const _=.6;for(;L.getComputedTextLength()>T&&m>D;)m--,o.style("font-size",`${m}px`);let F=Math.max(I,Math.min(Y,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(I,Math.min(Y,Math.round(m*_))),!(F<I&&m===D));)o.style("font-size",`${m}px`),k=m+J+F;o.style("font-size",`${m}px`),A?(m<D||P<D)&&o.style("display","none"):(L.getComputedTextLength()>T||m<D||P<m)&&o.style("display","none")}),i.showValues!==!1&&j.append("text").attr("class","treemapValue").attr("x",o=>(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+$(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?u(o.value):"").each(function(o){const f=Q(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=Q(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(o.y1-o.y0)/2+T/2+J;f.attr("y",F);const k=o.x1-o.x0,ie=o.y1-o.y0-4,me=k-2*Z;f.node().getComputedTextLength()>me||F+m>ie||m<I?f.style("display","none"):f.style("display",null)});const ue=i.diagramPadding??8;Ne(b,ue,"flowchart",i?.useMaxWidth||!1)},"draw"),ct=w(function(t,a){return a.db.getClasses()},"getClasses"),ht={draw:ot,getClasses:ct},dt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},pt=w(({treemap:t}={})=>{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),i=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return`
|
|
2
2
|
.treemapNode.section {
|
|
3
3
|
stroke: ${r.sectionStrokeColor};
|
|
4
4
|
stroke-width: ${r.sectionStrokeWidth};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{p as re}from"./chunk-JWPE2WC7-
|
|
1
|
+
import{p as re}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{t as oe,q as se,s as de,g as le,a as ce,b as me,_ as o,l as g,c as N,k as ue,M as xe,A as fe,N as ge,L as F,O as he,j as y,w as P,as as pe}from"./index-BW6XEiuj.js";import{p as be,i as ve}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var T="position frame",$="frame positioned",S="position relation",D="relation positioned",we=o(function(e){g.debug("options str",e)},"setOptions"),ye=o(function(){return{}},"getOptions"),Pe=o(function(){C(),fe()},"clear");function C(){B={}}o(C,"reset");var Se=he.eventmodeling,ke=o(()=>ge({...Se,...F().eventmodeling}),"getConfig"),B={};function O(){let e=Me;const{ast:n}=B,t=E();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=v(e,{$kind:T,index:a,frame:i,textProps:r});let d;K(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=v(e,{$kind:S,index:a,frame:i,sourceFrame:l})})):e=v(e,{$kind:S,index:a,frame:i})}),e={...e,sortedSwimlanesArray:A(e.swimlanes)},e}o(O,"getState");function I(e){B.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function E(){return s}o(E,"getDiagramProps");var Me={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function W(e){const n=e.split(".");if(n.length===2)return n[0]}o(W,"extractNamespace");function H(e){const n=e.split(".");return n.length===2?n[1]:e}o(H,"extractName");function U(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(U,"findSwimlaneByNamespace");function b(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&a<t}).map(i=>Number.parseInt(i)))+1}o(b,"findNextAvailableIndex");function _(e,n){const t=W(e.entityIdentifier),i=U(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:b(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:b(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:b(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=F();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function G(e,n,t){const i=F(),a=y(H(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"};let c=`<b>${P(a,t.textMaxWidth,d)}</b>`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(w=>w.name===e.dataReference?.$refText);p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{
|
|
2
2
|
`)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="<br/>")}const m=r!==void 0;m&&(c+=`<br/><br/><code style="text-align: left; display: block;max-width:${t.textMaxWidth}px">${r}</code>`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(G,"calculateTextProps");function V(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:$,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(V,"decidePositionFrame");function X(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(X,"calculateX");function j(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(j,"calculateMaxRight");function A(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o(A,"sortedSwimlanesArray");function Y(e,n){const t=n,i=_(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=X(a,d,r),m=c+l.width+s.boxPadding,x=j(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=A(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p<f.length;p++){const w=f[p],R=f[p-1];w.y=R.y+R.height+s.swimlaneGap}return h}o(Y,"evolveFramePositioned");function z(e,n){return e===0&&n.sourceFrames.length===0}o(z,"isFirstFrame");function K(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}o(K,"hasSourceFrame");function k(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(k,"findBoxByFrame");function q(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(q,"findBoxByLineIndex");function J(e,n){const t=n;if(ve(t.frame)||z(t.index,t.frame))return[];const i=k(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=k(e.boxes,t.sourceFrame):a=q(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:D,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(J,"decidePositionRelation");function Q(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Q,"evolveRelationPositioned");var Fe={[T]:V,[S]:J},Be={[$]:Y,[D]:Q};function Z(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(Z,"decide");function ee(e,n){const t=n.reduce((i,a)=>{const r=Be[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(ee,"evolve");function v(e,n){const t=Z(e,n);return ee(e,t)}o(v,"dispatch");var M={getConfig:ke,setOptions:we,getOptions:ye,clear:Pe,setAccTitle:me,getAccTitle:ce,getAccDescription:le,setAccDescription:de,setDiagramTitle:se,getDiagramTitle:oe,setAst:I,getDiagramProps:E,getState:O},Ee={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),M.setAst(n),re(n,M)},"parse")},Ae=N(),Re=Ae?.eventmodeling;function te(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(te,"renderD3Box");function ne(e,n){return e>n}o(ne,"dirUpwards");function ie(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ne(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ie,"renderD3Relation");function ae(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(ae,"renderD3Swimlane");var Ne=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+`
|
|
3
3
|
`,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=N(),l=ue(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(ae(l,m.maxR,c,r)),m.boxes.forEach(te(l,c)),m.relations.forEach(ie(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,d?.padding??30,d?.useMaxWidth)},"draw"),Te={draw:Ne},$e=o(e=>"","getStyles"),De=$e,Ue={parser:Ee,db:M,renderer:Te,styles:De};export{Ue as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{I as W}from"./chunk-2Q5K7J3B-
|
|
1
|
+
import{I as W}from"./chunk-2Q5K7J3B-yf0a7mN4.js";import{p as X}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{q as z,b as G,s as Y,t as P,g as q,a as F,_ as g,N as k,l as A,Q as Z,d as j,L as E,A as U,j as Q,aq as J,O as K,ar as ee}from"./index-BW6XEiuj.js";import{p as te}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var L=/[─━│┃└┗├┣]/,D=/[└┗├┣]/,ne=/[─━]/,N=/^[\s│┃]+$/,T=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,V=/^\s*%%/,re=" ";function _(n){return n.some(t=>L.test(t))}g(_,"isBoxDrawingFormat");function M(n){for(const t of n){const e=D.exec(t);if(e?.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function S(n,t){return n.replace(/\bline\s+(\d+)\b/gi,(e,r)=>{const s=parseInt(r,10),i=t.get(s);return i?`line ${i}`:e})}g(S,"remapErrorLines");function R(n){const t=n.split(`
|
|
2
2
|
`),e=new Map;let r=-1;for(const[p,c]of t.entries())if(c.trim()==="treeView-beta"){r=p;break}if(r===-1)return{text:n,lineMap:e};const s=[];for(let p=r+1;p<t.length;p++){const c=t[p];c.trim()===""||V.test(c)||T.test(c)||N.test(c)||s.push(c.replace(/\t/g," "))}if(!_(s))return{text:n,lineMap:e};const i=M(s),o=[];let a=0;for(let p=0;p<=r;p++)o.push(t[p]),a++,e.set(a,p+1);for(let p=r+1;p<t.length;p++){const c=t[p],d=c.trim(),h=p+1;if(d===""){o.push(c),a++,e.set(a,h);continue}if(V.test(c)){o.push(c),a++,e.set(a,h);continue}if(T.test(c)){o.push(c),a++,e.set(a,h);continue}if(N.test(c))continue;const l=c.replace(/\t/g," "),w=D.exec(l);if(w?.index!==void 0){const f=w.index,m=Math.round(f/i)+1;let u=f+1;for(;u<l.length&&ne.test(l[u]);)u++;for(;u<l.length&&l[u]===" ";)u++;const v=l.slice(u).trimEnd();if(!v)throw new Error(`Line ${h}: Empty node — expected a filename or directory name after the box-drawing prefix`);const O=re.repeat(m);o.push(O+v),a++,e.set(a,h)}else{if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;if(L.test(l))o.push(c),a++,e.set(a,h);else{if(/^\s+/.test(l))throw new Error(`Line ${h}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);o.push(c),a++,e.set(a,h)}}}return{text:o.join(`
|
|
3
3
|
`),lineMap:e}}g(R,"preprocessBoxDrawing");var x=new W(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),U()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=K.treeView,ce=g(()=>k(ae,E().treeView),"getConfig"),le=g((n,t,e,r,s,i)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const o={id:x.records.cnt++,level:n,name:t,nodeType:e,icon:s,cssClass:r,description:i,children:[]};x.records.stack[x.records.stack.length-1].children.push(o),x.records.stack.push(o)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:F,getAccDescription:q,getDiagramTitle:P,setAccDescription:Y,setAccTitle:G,setDiagramTitle:z},I=de,he=g(n=>{X(n,I);for(const t of n.nodes){const e=typeof t.indent=="number"?t.indent:0;let r=t.name;const s=r.endsWith("/");s&&(r=r.slice(0,-1));const i=s?"directory":"file",o=t.classAnnotation||void 0,a=t.iconAnnotation,p=a!==void 0?a||"none":void 0,c=t.descAnnotation||void 0,d=c?Q(c,E()):void 0;I.addNode(e,r,i,o,p,d)}},"populate"),pe={parse:g(async n=>{const{text:t,lineMap:e}=R(n);try{const r=await te("treeView",t);A.debug(r),he(r)}catch(r){throw e.size>0&&r instanceof Error&&(r.message=S(r.message,e)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function H(n,t){const e=t?.filenameIcons?.[n];if(e)return e;const r=n.lastIndexOf(".");if(r>0){const s=n.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[s]??i?.[s.slice(1)]}}g(H,"detectIcon");function C(n,t){return n.includes(":")?n:n in b.icons||!t?`${b.prefix}:${n}`:`${t}:${n}`}g(C,"qualifyIcon");function B(n,t){if(n.icon!=="none"){if(n.icon)return C(n.icon,t.defaultIconPack);if(t.showIcons){if(n.nodeType==="file"){const e=H(n.name,t);if(e==="none")return;if(e)return C(e,t.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}g(B,"getNodeIcon");ee([{name:b.prefix,icons:b}]);var y=14,ge=4,fe=16,ue=g(async(n,t)=>{const e=[],r=g(i=>{const o=B(i,t);o&&e.push({icon:o,node:i}),i.children.forEach(r)},"collect");r(n);const s=await Promise.all(e.map(async({icon:i,node:o})=>({id:o.id,svg:await J(i,{height:y,width:y})})));return new Map(s.map(({id:i,svg:o})=>[i,o]))},"resolveNodeIcons"),we=g((n,t,e,r,s,i)=>{const o=r.append("g");let a="treeView-node-label";e.nodeType==="directory"&&(a+=" treeView-node-dir"),e.cssClass&&(a+=` ${e.cssClass}`);const p=y+ge,c=B(e,s),d=c!==void 0;c&&o.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${n+s.paddingX}, ${t+s.paddingY})`).html(i.get(e.id)??"");const h=o.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",a),{height:l,width:w}=h.node().getBBox(),f=l+s.paddingY*2,m=n+s.paddingX+(d?p:0);h.attr("x",m),h.attr("y",t+f/2);const u=m+w,v=w+s.paddingX*2+(d?p:0);return e.BBox={x:n,y:t,width:v,height:f},e.cssClass?.split(/\s+/).includes("highlight")&&o.insert("rect",":first-child").attr("x",n).attr("y",t+1).attr("width",0).attr("height",f-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:o,labelRightEdge:u,centerY:t+f/2}},"positionLabel"),$=g((n,t,e,r,s,i)=>n.append("line").attr("x1",t).attr("y1",e).attr("x2",r).attr("y2",s).attr("stroke-width",i).attr("class","treeView-node-line"),"positionLine"),me=g((n,t,e,r)=>{let s=0,i=0;const o=[],a=g((d,h,l,w)=>{const f=w*(l.rowIndent+l.paddingX),m=we(f,s,h,d,l,r);o.push(m);const{height:u,width:v}=h.BBox;$(d,f-l.rowIndent,s+u/2,f,s+u/2,l.lineThickness),i=Math.max(i,f+v),s+=u},"drawNode"),p=g((d,h=0)=>{a(n,d,e,h),d.children.forEach(m=>{p(m,h+1)});const{x:l,y:w,height:f}=d.BBox;if(d.children.length){const{y:m,height:u}=d.children[d.children.length-1].BBox;$(n,l+e.paddingX,w+f,l+e.paddingX,m+u/2+e.lineThickness/2,e.lineThickness)}},"processNode");p(t);const c=o.filter(d=>d.node.description);if(c.length>0){const h=Math.max(...o.map(l=>l.labelRightEdge))+fe;for(const l of c){const f=l.nodeGroup.append("text").text(l.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",h).attr("y",l.centerY).node().getBBox();i=Math.max(i,h+f.width+e.paddingX)}}for(const d of o)if(d.node.cssClass?.split(/\s+/).includes("highlight")){const h=d.nodeGroup.select(".treeView-highlight-bg");if(!h.empty()){const l=i-d.node.BBox.x+8;h.attr("width",l),i=Math.max(i,d.node.BBox.x+l+2)}}return{totalHeight:s,totalWidth:i}},"drawTree"),xe=g(async(n,t,e,r)=>{A.debug(`Rendering treeView diagram
|
|
4
4
|
`+n);const s=r.db,i=s.getRoot(),o=s.getConfig(),a=Z(t),p=a.append("g");p.attr("class","tree-view");const c=await ue(i,o),{totalHeight:d,totalWidth:h}=me(p,i,o,c);a.attr("viewBox",`-${o.lineThickness/2} 0 ${h} ${d}`),j(a,d,h,o.useMaxWidth)},"draw"),ve={draw:xe},be=ve,Ie={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ce=g(({treeView:n})=>{const{labelFontSize:t,labelColor:e,lineColor:r,iconColor:s,descriptionColor:i,highlightBg:o,highlightStroke:a}=k(Ie,n);return`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as B}from"./chunk-JWPE2WC7-
|
|
1
|
+
import{p as B}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{_ as b,N as m,Q as C,d as S,l as w,b as D,a as T,q as P,t as z,g as A,s as E,L as F,O as W,A as _}from"./index-BW6XEiuj.js";import{p as N}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=P,this.getDiagramTitle=z,this.getAccDescription=A,this.setAccDescription=E}getConfig(){const t=m({...L,...F().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,O=b((e,t)=>{B(e,t);let r=-1,s=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??=r+1,a!==r+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${r+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??=a+(d??1)-1,d??=i-a+1,r=i,w.debug(`Packet block ${a} - ${r} with label ${c}`);s.length<=l+1&&t.getPacket().length<M;){const[p,o]=Y({start:a,end:i,bits:d,label:c},n,l);if(s.push(p),p.end+1===n*l&&(t.pushWord(s),s=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}t.pushWord(s)},"populate"),Y=b((e,t,r)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*r)return[e,void 0];const s=t*r-1,n=t*r;return[{start:e.start,end:s,label:e.label,bits:s-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{const t=await N("packet",e),r=x.parser?.yy;if(!(r instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),O(t,r)},"parse")},I=b((e,t,r,s)=>{const n=s.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())j(f,$,y,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),j=b((e,t,r,{rowHeight:s,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=r*(s+l)+l;for(const o of t){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",s).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+s/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),q={draw:I},G={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},H=b(({packet:e}={})=>{const t=m(G,e);return`
|
|
2
2
|
.packetByte {
|
|
3
3
|
font-size: ${t.byteFontSize};
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as I}from"./chunk-JWPE2WC7-
|
|
1
|
+
import{p as I}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{s as _,g as E,t as F,q as D,a as P,b as z,_ as c,Q as G,A as B,N as w,L as C,O as W,l as b,R as V,d as H}from"./index-BW6XEiuj.js";import{p as j}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),N=W.radar,U=c(()=>w({...N,...C().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),X=c(()=>m.curves,"getCurves"),q=c(()=>m.options,"getOptions"),K=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Q=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Y(t.entries)}))},"setCurves"),Y=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),Z=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});m.options={showLegend:t.showLegend?.value??x.showLegend,ticks:t.ticks?.value??x.ticks,max:t.max?.value??x.max,min:t.min?.value??x.min,graticule:t.graticule?.value??x.graticule},m.options.ticks>y&&(b.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),J=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:X,getOptions:q,setAxes:K,setCurves:Q,setOptions:Z,getConfig:U,clear:J,setAccTitle:z,getAccTitle:P,setDiagramTitle:D,getDiagramTitle:F,getAccDescription:E,setAccDescription:_},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);b.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;st(u,i,v,n.ticks,n.graticule),nt(u,i,v,o),L(u,i,l,h,g,n.graticule,o),k(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return H(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i<r;i++){const l=e*(i+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if(s==="polygon"){const i=t.length;for(let l=0;l<r;l++){const n=e*(l+1)/r,o=t.map((d,p)=>{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let i=0;i<s;i++){const l=t[i].label,n=2*i*Math.PI/s-Math.PI/2,o=Math.cos(n),d=Math.sin(n);a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*o).attr("y2",e*r.axisScaleFactor*d).attr("class","radarAxisLine");const p=o>.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=T(g,r,s,o),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});i==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const i=a[(s-1+e)%e],l=a[s],n=a[(s+1)%e],o=a[(s+2)%e],d={x:l.x+(n.x-i.x)*t,y:l.y+(n.y-i.y)*t},p={x:n.x-(o.x-l.x)*t,y:n.y-(o.y-l.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`}return`${r} Z`}c(S,"closedRoundCurve");function k(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,i=-(r.height/2+r.marginTop)*3/4,l=20;t.forEach((n,o)=>{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
|
|
2
2
|
.radarCurve-${r} {
|
|
3
3
|
color: ${s};
|
|
4
4
|
fill: ${s};
|
package/dist/client/assets/{ebnfDiagram-ZINNZB2B-CRQjE5YW.js → ebnfDiagram-ZINNZB2B-DeWm3AYC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as l,r as m,d as n}from"./chunk-GTNCS2PH-
|
|
1
|
+
import{g as l,r as m,d as n}from"./chunk-GTNCS2PH-DEE2gCa9.js";import{p}from"./chunk-JWPE2WC7-Be3sOMxP.js";import{_ as t,l as o}from"./index-BW6XEiuj.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-BnXIWj_c.js";import"./vendor-editor-core-DbsheCh1.js";import"./vendor-editor-languages-B1l-thbw.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram};
|