@softistx/pulsarix-widget 0.7.3 → 0.8.1
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/README.md +14 -7
- package/dist/chunks/abnfDiagram-XWFEHMT6.jcqkp43e.js +1 -0
- package/dist/chunks/architecture-WOLXFQ4H.6qa86taq.js +1 -0
- package/dist/chunks/architectureDiagram-CSQXQB3N.pk9dxdfb.js +36 -0
- package/dist/chunks/blockDiagram-BEDRHYPZ.ehefn7dt.js +140 -0
- package/dist/chunks/bpmnIcons-APHXDYXF.whh96nc8.js +1 -0
- package/dist/chunks/c4Diagram-M2UUVUY5.knj3as6x.js +38 -0
- package/dist/chunks/chat-markdown-DLDNLXM9.tvekh9sm.js +301 -0
- package/dist/chunks/classDiagram-v2-KXABOMEV.vtb7vjzn.js +217 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.gb18dr42.js +1 -0
- package/dist/chunks/cynefin-EF2NZ3EQ.e86yfa9w.js +1 -0
- package/dist/chunks/cynefinDiagram-NJNITYFG.akmr90zk.js +62 -0
- package/dist/chunks/dagre-KIHZ2IZ3.7n7s7vq2.js +4 -0
- package/dist/chunks/diagram-7YQZDPLS.d3sdv0py.js +41 -0
- package/dist/chunks/diagram-QBROCOUO.2v08zs42.js +200 -0
- package/dist/chunks/diagram-RJJCUUZO.tpnwa621.js +30 -0
- package/dist/chunks/diagram-WERXNKYE.hz7tgbtr.js +24 -0
- package/dist/chunks/diagram-YHHI257C.9gge9ecb.js +3 -0
- package/dist/chunks/diagram-YR4HJLHV.bajpx75b.js +24 -0
- package/dist/chunks/ebnfDiagram-N527522P.hxbbq671.js +1 -0
- package/dist/chunks/editor-shortcuts-dialog-I77EAez1.0s00eh53.js +1 -0
- package/dist/chunks/editor.h5bxwyxn.js +4 -0
- package/dist/chunks/elk-O5DQBFGD.vy7cdqps.js +27 -0
- package/dist/chunks/emoji-picker-BofyuTmK.qf287fk6.js +4 -0
- package/dist/chunks/erDiagram-K3K3BIDK.kzs3v0ts.js +99 -0
- package/dist/chunks/eventmodeling-K75KTNOO.9yb5zf47.js +1 -0
- package/dist/chunks/flow-diagram-OPO1ep57.5006stqg.js +7 -0
- package/dist/chunks/flowDiagram-Z6JWZHQI.zf0kndsp.js +1 -0
- package/dist/chunks/ganttDiagram-3PRQTZWP.qkcp8pvg.js +292 -0
- package/dist/chunks/gitGraph-VSP46ZUC.txpj8e6d.js +1 -0
- package/dist/chunks/gitGraphDiagram-VXDFKS5L.ry9dejxm.js +106 -0
- package/dist/chunks/grid-E2QIVN74.q51enfx7.js +1 -0
- package/dist/chunks/illustration-BoOzuxNg.h0gnxa4s.js +1 -0
- package/dist/chunks/index.0hrfbrja.js +44 -0
- package/dist/chunks/index.153rcscj.js +2 -0
- package/dist/chunks/index.20dvswea.js +2 -0
- package/dist/chunks/index.23p1k2rx.js +2 -0
- package/dist/chunks/index.3k4gyba0.js +2 -0
- package/dist/chunks/index.51yk4ene.js +2 -0
- package/dist/chunks/index.9zhger75.js +142 -0
- package/dist/chunks/index.bfeafb22.js +1 -0
- package/dist/chunks/index.cf9nd6xy.js +2 -0
- package/dist/chunks/index.eec12m3n.js +16 -0
- package/dist/chunks/index.fab58nn0.js +2 -0
- package/dist/chunks/index.fgsp5qqn.js +303 -0
- package/dist/chunks/index.fv9af3wd.js +333 -0
- package/dist/chunks/index.fvh2m60c.js +2 -0
- package/dist/chunks/index.gqa9s37g.js +2 -0
- package/dist/chunks/index.h6120080.js +2 -0
- package/dist/chunks/index.q9dsw4bt.js +2 -0
- package/dist/chunks/index.vnhefjwh.js +2 -0
- package/dist/chunks/index.x163xe9c.js +89 -0
- package/dist/chunks/index.x1xqs5m5.js +214 -0
- package/dist/chunks/index.yf0h5qnv.js +2 -0
- package/dist/chunks/info-OHQRW6UA.xea9bh7d.js +1 -0
- package/dist/chunks/infoDiagram-EZ3ZOAHP.r2yygqw8.js +2 -0
- package/dist/chunks/ishikawaDiagram-S3EKX5GW.gwqtdvb2.js +70 -0
- package/dist/chunks/journeyDiagram-POQNLL5X.rp31qkq5.js +139 -0
- package/dist/chunks/kanban-definition-BH5XI6FM.ymsqx6en.js +89 -0
- package/dist/chunks/katex.n08hp8fc.js +257 -0
- package/dist/chunks/markup-color-chrome-ykGNUl8y.06cy435c.js +1 -0
- package/dist/chunks/markup-custom-color-C8Xc6JxB.an2wngns.js +1 -0
- package/dist/chunks/mention-list-Dhq70jL5.1k61f24q.js +1 -0
- package/dist/chunks/mermaid.core.x45crg0h.js +12 -0
- package/dist/chunks/mindmap-definition-WVAN44T4.5cbd4rg2.js +98 -0
- package/dist/chunks/packet-JDAUHWVQ.c7dmae11.js +1 -0
- package/dist/chunks/panel.nm4pj2wm.js +7 -0
- package/dist/chunks/pegDiagram-D4NLKWP3.fsryts4r.js +1 -0
- package/dist/chunks/pie-XZMESJXO.6rv4kzjx.js +1 -0
- package/dist/chunks/pieDiagram-36ENHN4W.k4k2gvg0.js +39 -0
- package/dist/chunks/plated-illustration-BzxADkoZ.wtc9psry.js +1 -0
- package/dist/chunks/quadrantDiagram-ZQUDMS73.j7nj12w0.js +7 -0
- package/dist/chunks/radar-ABXABTNO.58dfc8ba.js +1 -0
- package/dist/chunks/railroad-I3PHUGI6.00fqbahv.js +1 -0
- package/dist/chunks/railroad-abnf-LNEFI6M7.gt1x50q5.js +1 -0
- package/dist/chunks/railroad-ebnf-DWYD2UWJ.qr5qfkga.js +1 -0
- package/dist/chunks/railroad-peg-JR7BVNR7.m61rq7hj.js +1 -0
- package/dist/chunks/railroadDiagram-JIZHGYPL.a681wt3b.js +1 -0
- package/dist/chunks/render-VIF2ZAQL.rn9hpsbx.js +1 -0
- package/dist/chunks/requirementDiagram-AXW2TVFA.shapgy39.js +84 -0
- package/dist/chunks/sankeyDiagram-FBCJTAIF.2syz1e2b.js +40 -0
- package/dist/chunks/sequenceDiagram-3LA2ROMG.jq1w12a6.js +169 -0
- package/dist/chunks/sizeCapture-2Q2CQKSF.jtv53a6j.js +1 -0
- package/dist/chunks/stateDiagram-v2-ATKHQDJO.x0g2rngz.js +291 -0
- package/dist/chunks/swimlanes-YQL5WMAO.j7j7c6ex.js +1 -0
- package/dist/chunks/swimlanesDiagram-UCCPES4V.tzqcsrmd.js +8 -0
- package/dist/chunks/timeline-definition-7Z437IG3.s5bvn8dr.js +120 -0
- package/dist/chunks/treeView-D4JQ5SDB.0x1grm2t.js +1 -0
- package/dist/chunks/treemap-SAJKECNS.1te19jsm.js +1 -0
- package/dist/chunks/usecaseDiagram-RDK6N6HP.9k4r423e.js +370 -0
- package/dist/chunks/vennDiagram-SHRQU5PJ.82q5dzm6.js +34 -0
- package/dist/chunks/wardley-7MLQ67FV.zp6gykk3.js +1 -0
- package/dist/chunks/wardleyDiagram-F3OXNVQS.fm4tw2nc.js +78 -0
- package/dist/chunks/xychartDiagram-GDYJKCDI.57vqn2zd.js +7 -0
- package/dist/index.js +24 -4690
- package/docs/integration.md +146 -33
- package/package.json +7 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e,n}from"./index.fgsp5qqn.js";import{Mt,Nt}from"./index.51yk4ene.js";import"./index.20dvswea.js";import{ot}from"./index.fvh2m60c.js";function cs(t,{measure:o}){let s=Mt(t.config?.swimlane?.lineHops);if(s===!1)return;let r=t.edges.filter((i)=>Array.isArray(i.points)&&i.points.length>=2).map((i)=>({id:i.id,points:i.points,curve:i.curve,cornerRadius:i.cornerRadius,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));Nt(o.groups.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}e(cs,"applySwimlaneLineJumps");function as(t){let o=t?.metadata?.laneRole;return o==="pool"||o==="lane"?o:void 0}e(as,"readLaneRole");function ln(t){let o=t?.metadata?.laneIndex;return typeof o==="number"&&Number.isFinite(o)?o:void 0}e(ln,"readLaneIndex");function Ie(t){let o=new Map,s=new Map;for(let h of t)if(o.set(h.id,h),h.isGroup&&h.parentId)s.set(h.parentId,(s.get(h.parentId)??0)+1);let r=new Set;for(let h of t)if(h.isGroup&&as(h)==="pool"&&(s.get(h.id)??0)>0)r.add(h.id);let i=new Set,c=new Map;for(let h of t){if(!h.isGroup||r.has(h.id))continue;if(h.parentId&&r.has(h.parentId)){i.add(h.id);let y=c.get(h.parentId)??[];y.push(h.id),c.set(h.parentId,y)}else if(!h.parentId)i.add(h.id)}let a=e((h,y)=>{let f=new Set([h]),b=o.get(h)?.parentId;while(b&&!f.has(b)){if(y.has(b))return b;f.add(b),b=o.get(b)?.parentId}return null},"walk"),l=new Map;return{isPool:e((h)=>r.has(h),"isPool"),isLane:e((h)=>i.has(h),"isLane"),laneIdOf:e((h)=>{let y=l.get(h);if(y!==void 0)return y;let f=a(h,i);return l.set(h,f),f},"laneIdOf"),poolIdOf:e((h)=>r.has(h)?h:a(h,r),"poolIdOf"),lanesByPool:c,hasPools:r.size>0}}e(Ie,"buildLaneModel");var vi=new Set(["top","right","bottom","left"]),Yn=8,Ci=1e4;function We(t){let o=t?.metadata?.anchorTo;if(!o||typeof o!=="object")return;let{hostId:s,side:r,slot:i,gap:c}=o;if(typeof s!=="string"||s.length===0||s===t?.id)return;return{hostId:s,...typeof r==="string"&&vi.has(r)?{side:r}:{},...typeof i==="number"&&Number.isFinite(i)?{slot:i}:{},...typeof c==="number"&&Number.isFinite(c)&&c>0?{gap:Math.min(c,Ci)}:{}}}e(We,"readAnchor");function Cn(t,o){let s=new Set([t]),r=We(o.get(t))?.hostId;while(r&&!s.has(r)){let i=o.get(r);if(!i)return;let c=We(i)?.hostId;if(!c)return r;s.add(r),r=c}return}e(Cn,"resolveAnchorHostId");function Ve(t){let o=new Map(t.map((r)=>[r.id,r])),s=new Set;for(let r of t)if(We(r)&&Cn(r.id,o))s.add(r.id);return s}e(Ve,"collectAnchoredIds");function ls(t,o){if(t==="canonical")return"right";return o==="LR"||o==="RL"?"bottom":"right"}e(ls,"defaultAnchorSide");function fs(t,o){let s=t.anchor.slot,r=o.anchor.slot;if(s!==void 0&&r!==void 0&&s!==r)return s-r;if(s!==void 0&&r===void 0)return-1;if(s===void 0&&r!==void 0)return 1;return t.index-o.index}e(fs,"compareBucketEntries");function ds(t){let o=t.reduce((i,c)=>i+c,0)+Yn*Math.max(0,t.length-1),s=[],r=-o/2;for(let i of t)s.push(r+i/2),r+=i+Yn;return{offsets:s,total:o}}e(ds,"packAlongBorder");var Li=e((t)=>[t.width,t.height].every((o)=>o===void 0||Number.isFinite(o)),"hasUsableSize");function us(t,o){let s=new Map(t.map((i)=>[i.id,i])),r=new Map;t.forEach((i,c)=>{let a=We(i);if(!a||!Li(i))return;let l=Cn(i.id,s);if(!l)return;let d=o(a),h=`${d}:${l}`,y=r.get(h)??[];y.push({node:i,anchor:a,index:c,side:d,hostId:l}),r.set(h,y)});for(let i of r.values())i.sort(fs);return r}e(us,"bucketByHostAndSide");function hs(t,o,s,r){let i=!o&&s>0?-(r+Yn):0;return t+i}e(hs,"centreAlongBorder");function gs(t,o){let s=o==="top"||o==="bottom",r=e((h)=>s?h.width??0:h.height??0,"alongBorder"),i=e((h)=>s?h.height??0:h.width??0,"reach"),{offsets:c}=ds(t.map((h)=>r(h.node))),a=0,l=0,d=0;return t.forEach((h,y)=>{let f=h.anchor.gap??0,b=r(h.node)/2,v=hs(c[y],s,f,b);a=Math.max(a,b-v),l=Math.max(l,v+b),d=Math.max(d,f>0?f+i(h.node):0)}),{before:a,after:l,beyond:d}}e(gs,"footprintOf");function ps(t,o){let s=ls("final",o??"TB"),r=new Map;for(let i of us(t,(c)=>c.side??s).values()){if(!i.some((l)=>l.anchor.gap))continue;let{hostId:c,side:a}=i[0];r.set(c,{...r.get(c),[a]:gs(i,a)})}return r}e(ps,"anchorFootprints");var _n="__swimlane_default__",wi=21,Qo=20;function zn(t){return Math.max(t.padding??Qo,Qo)}e(zn,"topLaneHorizontalPadding");function ms(t){let{x:o,y:s,width:r,height:i}=t,c=t.swimlaneContentTop;if(typeof o!=="number"||typeof s!=="number"||typeof r!=="number"||typeof i!=="number"||typeof c!=="number"||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(c)||r<=0||i<=0){delete t.groupTitleRect;return}let a=s-i/2,l=Math.min(c,s+i/2),d=Math.min(wi,Math.max(0,l-a)),h=a+d;if(h<=a){delete t.groupTitleRect;return}t.groupTitleRect={left:o-r/2,right:o+r/2,top:a,bottom:h}}e(ms,"assignTopLaneTitleRect");function ys(t){let o=t.other?.droppedSubGraphMembers;return Array.isArray(o)?o:[]}e(ys,"sharedMembers");var Ei=e((t,o,s)=>!o.some((r)=>r.parentId===s)&&!(t.edges??[]).some((r)=>r.start===s||r.end===s),"isEmptyLane");function xs(t,o){return t.isLane(o)?o:t.laneIdOf(o)??void 0}e(xs,"laneIdOrSelf");function bs(t,o,s){for(let r of s){let i=o.findIndex((c)=>c.id===r);if(i>=0&&Ei(t,o,r))o.splice(i,1)}}e(bs,"removeEmptyLanes");function Is(t,o){let s=Ie(o),r=new Set(o.filter((c)=>s.isLane(c.id)).map((c)=>c.id)),i=new Set;for(let{node:c,keptBy:a,droppedFrom:l}of ys(t)){let d=xs(s,a);if(d&&d!==l&&r.has(l))n.warn(`Swimlane node "${c}" is listed in lanes "${d}" and "${l}"; it is drawn in "${d}" only.`),i.add(l)}bs(t,o,i)}e(Is,"dropLanesEmptiedBySharedNodes");function Ms(t,o){for(let s of t)if(s.isGroup&&!o.isLane(s.id)&&!o.isPool(s.id))n.warn(`Swimlane subgraph "${s.id}" is nested in "${s.parentId}"; only top-level subgraphs are lanes, so it is drawn as a plain box.`)}e(Ms,"warnAboutNestedGroups");function Ss(t){let o=t.direction,s=t.nodes??=[];Is(t,s);let r=Ie(s);Ms(s,r);for(let a of s){let l=r.isLane(a.id);if(!l&&!r.isPool(a.id))continue;if(a.shape=l?"swimlane":"pool",o)a.direction=o}let i=s.filter((a)=>!a.isGroup&&!a.parentId);if(i.length===0)return;let c=s.find((a)=>a.id===_n);if(!c)c={id:_n,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:s.reduce((a,l)=>Math.max(a,l.colorIndex??-1),-1)+1,...o?{direction:o}:{}},s.push(c);else if(c.isGroup){if(c.shape="swimlane",o)c.direction=o}for(let a of i)a.parentId=_n}e(Ss,"prepareLayoutForSwimlanes");function vs(t){let o=(t.nodes??[]).filter((f)=>!f.isEdgeLabel),s=new Map(o.map((f)=>[f.id,f])),r=Ve(o),i=e((f)=>r.has(f)?Cn(f,s)??f:f,"hostOf"),c=new Map;for(let f of o)if(!r.has(f.id))c.set(f.id,f);let a=[];for(let f of t.edges??[]){let b=typeof f.start==="string"?f.start:void 0,v=typeof f.end==="string"?f.end:void 0;if(!b||!v||f.isLayoutOnly)continue;let x=i(b),p=i(v);if(x===p)continue;a.push({id:f.id,src:x,dst:p,ref:f})}let l=o.filter((f)=>f.isGroup&&!r.has(f.id)),d=o.filter((f)=>!f.isGroup&&!r.has(f.id));return{nodes:[...[...l].reverse(),...d].map((f)=>f.id),edges:a,layout:t,nodeById:c}}e(vs,"toGraphView");function Cs(t){let o=new Map(t.map((r)=>[r.id,r])),s=e((r)=>{let i=0,c=r.parentId,a=new Set([r.id]);while(c!=null&&!a.has(c))a.add(c),i++,c=o.get(c)?.parentId;return i},"depthOf");return t.filter((r)=>r?.isGroup).map((r)=>({node:r,depth:s(r)})).sort((r,i)=>i.depth-r.depth).map((r)=>r.node)}e(Cs,"groupsDeepestFirst");function Ls(t,o,s,r){let{layout:i}=t,c=t.nodeById,a=r?.layerGap??100,l=r?.nodeGap??40,d=0;for(let x of o.layers){let p=0;for(let m of x){let L=c.get(m);if(!L){p++;continue}L.layer=d,L.order=p;let g=s.x[m]??p*l,S=s.y[m]??d*a;L.x=g,L.y=S,p++}d++}let h=i.nodes??[],y=Ve(h);for(let x of h)if(x.isEdgeLabel&&s.x[x.id]!=null&&s.y[x.id]!=null)x.x=s.x[x.id],x.y=s.y[x.id];let f=new Map,b=Ie(h),v=[];for(let x of Cs(h)){if(b.isLane(x.id))v.push(x);let p=h.filter((E)=>E.parentId===x.id&&!y.has(E.id)),m=1/0,L=-1/0,g=1/0,S=-1/0;for(let E of p){let M=E.x??s.x[E.id],I=E.y??s.y[E.id],w=E.width??0,A=E.height??0;if(M!=null&&I!=null){if(!E.isEdgeLabel)m=Math.min(m,M-w/2),L=Math.max(L,M+w/2);g=Math.min(g,I-A/2),S=Math.max(S,I+A/2)}}if(m===1/0||g===1/0)x.x=x.x??0,x.y=x.y??0,x.width=x.width??0,x.height=x.height??0;else{let E=x.padding??20,M=x.parentId?E:2*zn(x),I=E,w=Math.max(0,L-m)+M,A=Math.max(0,S-g)+I,B=(m+L)/2,k=(g+S)/2;x.x=B,x.y=k,x.width=w,x.height=A,f.set(x.id,{minX:m,maxX:L,minY:g,maxY:S})}}if(v.length>0&&f.size>0){let x=1/0,p=-1/0,m=0;for(let L of v){let g=L.padding??20;if(g>m)m=g;let S=f.get(L.id);if(!S)continue;x=Math.min(x,S.minY),p=Math.max(p,S.maxY)}if(x!==1/0&&p!==-1/0){let L=Math.max(0,p-x),g=36,S=Math.max(m,36),E=L+2*S,M=(x+p)/2;for(let R of v)R.y=M,R.height=E,R.swimlaneContentTop=x;let I=[...v].sort((R,P)=>{let V=R.x??0,z=P.x??0;return V-z}),w=[],A=[],B=[];for(let R of I){let P=f.get(R.id);if(!P)continue;let V=Math.max(0,P.maxX-P.minX)+2*zn(R),z=(P.minX+P.maxX)/2;w.push(R.id),A.push(z),B.push(V)}let k=w.length;if(k>0){let R=new Map;if(k===1)R.set(w[0],B[0]);else{let P=[];for(let ft=0;ft<k-1;ft++)P.push(A[ft+1]-A[ft]);let V=Array(k);V[0]=0;for(let ft=0;ft<k-1;ft++)V[ft+1]=2*P[ft]-V[ft];let z=0,Y=Number.POSITIVE_INFINITY;for(let ft=0;ft<k;ft++){let St=B[ft];if(ft%2===0)z=Math.max(z,St-V[ft]);else Y=Math.min(Y,V[ft]-St)}let et=z;if(z<=Y)et=(z+Y)/2;else et=z;for(let ft=0;ft<k;ft++){let St=V[ft]+(ft%2===0?et:-et),Zt=Math.max(B[ft],St);R.set(w[ft],Zt)}}for(let P of v){let V=R.get(P.id);if(V!=null)P.width=V;ms(P)}}}}}e(Ls,"writeBackToLayoutData");var Ai="[EdgeLabelNodes]";function ws(t){let o=[],s=[],r=new Map;for(let a of t.nodes)r.set(a.id,a);for(let a of t.edges){if(!a.label||a.label.length===0)continue;if(a.isLayoutOnly)continue;if(a.labelNodeId)continue;let l=a.start?r.get(a.start):void 0,d=a.end?r.get(a.end):void 0;if(!l||!d){n.warn(Ai,`Edge ${a.id} has missing source or target node`);continue}let h=`edge-label-${a.start}-${a.end}-${a.id}`,f=l.parentId!==d.parentId?d.parentId:l.parentId,b={id:h,label:a.label,edgeStart:a.start??"",edgeEnd:a.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:f,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??"",...l.dir?{dir:l.dir}:{}};o.push(b),a.labelNodeId=h,a.label=void 0,a.text=void 0;let v={id:`${a.id}-to-label`,start:a.start,end:h,type:"normal",isLayoutOnly:!0},x={id:`${a.id}-from-label`,start:h,end:a.end,type:"normal",isLayoutOnly:!0};s.push(v,x)}let i=[...t.nodes,...o],c=[...t.edges,...s];return{...t,nodes:i,edges:c}}e(ws,"createEdgeLabelNodes");var te=0.001;function Lo(t){let o=t.x??0,s=t.y??0,r=t.width??0,i=t.height??0;return r>0&&i>0?{cx:o,cy:s,rect:$e(o,s,r,i)}:void 0}e(Lo,"measuredNodeRect");function wo(t){if(t.isGroup)return;let o=Lo(t);if(!o)return;return{id:String(t.id??""),cx:o.cx,cy:o.cy,rect:o.rect}}e(wo,"nodeBoundsInfoFor");function ye(t,o,s=te){return Math.abs(t.x-o.x)<s&&Math.abs(t.y-o.y)<s}e(ye,"samePoint");function wt(t,o,s=te){return Math.abs(t.x-o.x)<s}e(wt,"sameX");function At(t,o,s=te){return Math.abs(t.y-o.y)<s}e(At,"sameY");function $t(t,o,s=te){return At(t,o,s)&&Math.abs(t.x-o.x)>s}e($t,"isHorizontalSegment");function Ut(t,o,s=te){return wt(t,o,s)&&Math.abs(t.y-o.y)>s}e(Ut,"isVerticalSegment");function ce(t,o,s,r){return Math.max(0,Math.min(Math.max(t,o),Math.max(s,r))-Math.max(Math.min(t,o),Math.min(s,r)))}e(ce,"overlapLength");function Se(t,o,s=te){if(t.horizontal&&o.horizontal&&At(t.a,o.a,s))return ce(t.a.x,t.b.x,o.a.x,o.b.x);if(t.vertical&&o.vertical&&wt(t.a,o.a,s))return ce(t.a.y,t.b.y,o.a.y,o.b.y);return 0}e(Se,"sameAxisSegmentOverlapLength");function ge(t,o=te){let s=[];for(let r=0;r<t.length-1;r++){let i=t[r],c=t[r+1],a=$t(i,c,o),l=Ut(i,c,o);if(a||l)s.push({index:r,a:i,b:c,horizontal:a,vertical:l})}return s}e(ge,"orthogonalSegmentsForPoints");function he(t,o=te){let s=ge(t,o),r=0;for(let i=1;i<s.length;i++)if(s[i-1].horizontal!==s[i].horizontal)r++;return r}e(he,"countOrthogonalBends");function Es(t){let o=ge(Ct(t));return o.slice(1).flatMap((s,r)=>o[r].horizontal===s.horizontal?[]:[s.a])}e(Es,"bendPoints");function As(t,o){let s=Math.max(Math.min(o.a.x,o.b.x)-t.x,0,t.x-Math.max(o.a.x,o.b.x)),r=Math.max(Math.min(o.a.y,o.b.y)-t.y,0,t.y-Math.max(o.a.y,o.b.y));return Math.hypot(s,r)}e(As,"distanceToSegment");function un(t,o,s){let r=e((i,c)=>{let a=ge(Ct(c));return Es(i).some((l)=>a.some((d)=>As(l,d)<s))},"touches");return r(t,o)||r(o,t)}e(un,"routesTouchAtBend");function Ct(t,o=te){let s=[];for(let r of t){let i=s.length>0?s[s.length-1]:void 0;if(!i||!ye(i,r,o))s.push({x:r.x,y:r.y})}return s}e(Ct,"dedupeConsecutivePoints");function Eo(t,o=te){if(!t||t.length!==4)return;let[s,r,i,c]=t;if($t(s,r,o)&&Ut(r,i,o)&&$t(i,c,o))return{kind:"HVH",p0:s,p1:r,p2:i,p3:c};return Ut(s,r,o)&&$t(r,i,o)&&Ut(i,c,o)?{kind:"VHV",p0:s,p1:r,p2:i,p3:c}:void 0}e(Eo,"classifyThreeSegmentRoute");function Ln(t,o,s,r=0){let i=Math.min(t.x,o.x),c=Math.max(t.x,o.x),a=Math.min(t.y,o.y),l=Math.max(t.y,o.y);return c>s.left-r&&i<s.right+r&&l>s.top-r&&a<s.bottom+r}e(Ln,"segmentBoundsOverlapRect");function Ao(t,o,s=0){return t.x>o.left+s&&t.x<o.right-s&&t.y>o.top+s&&t.y<o.bottom-s}e(Ao,"pointInsideRect");function Rs(t,o){return t.left<=o.left&&t.right>=o.right&&t.top<=o.top&&t.bottom>=o.bottom}e(Rs,"rectContainsRect");function hn(t,o){return t.left<o.right&&t.right>o.left&&t.top<o.bottom&&t.bottom>o.top}e(hn,"rectsOverlap");function $n(t,o){return{left:t.left-o,right:t.right+o,top:t.top-o,bottom:t.bottom+o}}e($n,"inflateRect");function $e(t,o,s,r){return{left:t-s/2,right:t+s/2,top:o-r/2,bottom:o+r/2}}e($e,"rectFromCenterSize");function se(t){return Lo(t)?.rect}e(se,"rectOfNodeBounds");function De(t,o){switch(o){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}e(De,"portForRectSide");function Ro(t,o,s,r,i,c=te){let a=o==="left"||o==="right",l=r==="left"||r==="right";if(a&&l){if(o==="right"&&r==="left"&&t.x<s.x||o==="left"&&r==="right"&&t.x>s.x){if(At(t,s,c))return[t,s];let f=(t.x+s.x)/2;return[t,{x:f,y:t.y},{x:f,y:s.y},s]}if(o===r){if(At(t,s,c))return;let f=o==="left"?Math.min(t.x,s.x)-i:Math.max(t.x,s.x)+i;return[t,{x:f,y:t.y},{x:f,y:s.y},s]}return}if(!a&&!l){if(o===r){if(wt(t,s,c))return;let b=o==="top"?Math.min(t.y,s.y)-i:Math.max(t.y,s.y)+i;return[t,{x:t.x,y:b},{x:s.x,y:b},s]}if(!(o==="bottom"&&r==="top"&&t.y<s.y||o==="top"&&r==="bottom"&&t.y>s.y))return;if(wt(t,s,c))return[t,s];let f=(t.y+s.y)/2;return[t,{x:t.x,y:f},{x:s.x,y:f},s]}if(a&&!l){let y=o==="right"&&s.x>t.x||o==="left"&&s.x<t.x,f=r==="top"&&t.y<s.y||r==="bottom"&&t.y>s.y;return y&&f?[t,{x:s.x,y:t.y},s]:void 0}let d=o==="bottom"&&s.y>t.y||o==="top"&&s.y<t.y,h=r==="left"&&t.x<s.x||r==="right"&&t.x>s.x;return d&&h?[t,{x:t.x,y:s.y},s]:void 0}e(Ro,"buildOrthogonalPortPath");function To(t,o,s,r){return o==="left"||o==="right"?[t,{x:r,y:t.y},{x:r,y:s.y},s]:[t,{x:t.x,y:r},{x:s.x,y:r},s]}e(To,"buildSameSideTrackPath");function wn(t){let o=new Map,s=[];for(let r of t){if(r.isEdgeLabel)continue;let i=wo(r);if(!i)continue;o.set(i.id,i),s.push({id:i.id,rect:i.rect})}return{nodeInfoById:o,realNodeRects:s}}e(wn,"collectRealNodeBounds");function ve(t){let o=[],s=[];for(let r of t){let i=wo(r);if(!i)continue;let c={id:i.id,rect:i.rect};if(r.isEdgeLabel)s.push(c);else o.push(c)}return{realNodeRects:o,labelNodeRects:s}}e(ve,"collectNodeRectEntries");function Ts(t,{includeEdgeLabels:o=!0}={}){let s=[];for(let r of t){if(r.isGroup||!o&&r.isEdgeLabel)continue;let i=r.x??0,c=r.y??0,a=r.width??0,l=r.height??0;s.push({nodeId:r.id,...$e(i,c,a,l)})}return s}e(Ts,"collectLayoutNodeRects");function Oo(t,o,s=te){let{start:r,end:i}=t;if(!r||!i)return;let c=o.get(r),a=o.get(i);if(!c||!a)return;return{srcId:r,dstId:i,srcInfo:c,dstInfo:a,collinearX:Math.abs(c.cx-a.cx)<s,collinearY:Math.abs(c.cy-a.cy)<s}}e(Oo,"getNodePairGeometry");function Xt(t,o,s,r=[],i=0){for(let c of s){if(r.includes(c.id))continue;if(Ln(t,o,c.rect,-i))return!0}return!1}e(Xt,"segmentHitsAnyRect");function No(t,o,s,r,i=te,c=0.000001){let a=At(t,o,i),l=wt(t,o,i),d=At(s,r,i),h=wt(s,r,i);if(a&&d||l&&h)return!1;if(!(a||l)||!(d||h))return!1;let y=a?{a:t,b:o}:{a:s,b:r},f=l?{a:t,b:o}:{a:s,b:r},b=y.a.y,v=Math.min(y.a.x,y.b.x),x=Math.max(y.a.x,y.b.x),p=f.a.x,m=Math.min(f.a.y,f.b.y),L=Math.max(f.a.y,f.b.y);if(p<v||p>x||b<m||b>L)return!1;let g=Math.abs(p-y.a.x)<c&&Math.abs(b-y.a.y)<c||Math.abs(p-y.b.x)<c&&Math.abs(b-y.b.y)<c,S=Math.abs(p-f.a.x)<c&&Math.abs(b-f.a.y)<c||Math.abs(p-f.b.x)<c&&Math.abs(b-f.b.y)<c;return!(g&&S)}e(No,"orthogonalSegmentsCross");function Fo(t,o,s,r,i=te){let c=At(t,o,i),a=wt(t,o,i),l=At(s,r,i),d=wt(s,r,i);if(a&&d&&wt(t,s,i))return ce(t.y,o.y,s.y,r.y)>i;if(c&&l&&At(t,s,i))return ce(t.x,o.x,s.x,r.x)>i;return!1}e(Fo,"sameAxisSegmentsOverlap");function gn(t,o,s,r,{epsilon:i=te,skipDegenerateOther:c=!1}={}){for(let a of s){if(a===r||a.isLayoutOnly)continue;let l=a.points;if(!l||l.length<2)continue;for(let d=0;d<l.length-1;d++){let h=l[d],y=l[d+1];if(c&&ye(h,y,i))continue;if(No(t,o,h,y,i)||Fo(t,o,h,y,i))return!0}}return!1}e(gn,"segmentConflictsWithAnyEdge");function Ce(t,o,s,r,i=te){let c=At(t,o,i),a=wt(t,o,i),l=At(s,r,i),d=wt(s,r,i);if(!(c&&d||a&&l))return!1;let h=c?{a:t,b:o}:{a:s,b:r},y=c?{a:s,b:r}:{a:t,b:o},f=h.a.y,b=Math.min(h.a.x,h.b.x),v=Math.max(h.a.x,h.b.x),x=y.a.x,p=Math.min(y.a.y,y.b.y),m=Math.max(y.a.y,y.b.y);return x>b+i&&x<v-i&&f>p+i&&f<m-i}e(Ce,"orthogonalSegmentsStrictlyCross");function Un(t,o,s){let r=Math.min(o,s),i=Math.max(o,s);return t>r+te&&t<i-te}e(Un,"strictlyBetween");function Os(t,o,s){if(wt(t,o)&&wt(o,s))return Un(o.y,t.y,s.y);if(At(t,o)&&At(o,s))return Un(o.x,t.x,s.x);return!1}e(Os,"isCollinearIntermediate");function Ns(t){let o=!1,s=[];for(let r=0;r<t.length;r++){let i=s[s.length-1],c=t[r],a=r+1<t.length?t[r+1]:void 0;if(i&&a){if(ye(i,a)){r++,o=!0;continue}if(Os(i,c,a)){o=!0;continue}}s.push(c)}return{points:s,changed:o}}e(Ns,"simplifyPolylineOnce");function pn(t){let o=[t[0]];for(let r=1;r<t.length;r++){let i=o[o.length-1],c=t[r];if(!wt(i,c)&&!At(i,c)){let a=o.length>=2?o[o.length-2]:void 0,d=(a?wt(a,i):!1)?{x:i.x,y:c.y}:{x:c.x,y:i.y};o.push(d)}o.push(c)}let s=[];for(let r of o){let i=s[s.length-1];if(!i||!ye(i,r))s.push(r)}return s}e(pn,"orthogonalizePolyline");function be(t){if(t.length<3)return t;let o=[...t];for(let s=0;s<32;s++){let r=Ns(o);if(o=r.points,!r.changed)break}return o}e(be,"simplifyPolyline");var mt=0.001,Ri=0.5,Vn=4;function Bo(t,o,s){let r=t;if(r.isLayoutOnly||!r.points||r.points.length<s)return;let i=r.start?o.get(r.start):void 0,c=r.end?o.get(r.end):void 0;return{edge:r,points:r.points,srcRect:i?se(i):void 0,dstRect:c?se(c):void 0}}e(Bo,"endpointContextFor");function Fs(t,o,s){if(At(t,o,mt))return{x:t.x<s.left?s.left:s.right,y:t.y};if(wt(t,o,mt)){let r=t.y<s.top?s.top:s.bottom;return{x:t.x,y:r}}return{x:Math.min(s.right,Math.max(s.left,t.x)),y:Math.min(s.bottom,Math.max(s.top,t.y))}}e(Fs,"segmentEnterPoint");function jn(t,o,s){let r=s?1:-1,i=s?0:t.length-1;while(i>=0&&i<t.length&&Ao(t[i],o,Ri))i+=r;if(i<0||i>=t.length)return t;let c=i-r;if(c<0||c>=t.length)return t;let a=Fs(t[i],t[c],o);return s?[a,...t.slice(i)]:[...t.slice(0,i+1),a]}e(jn,"clipEndpoint");function Bs(t,o){for(let s of t){let r=Bo(s,o,2);if(!r)continue;let i=[...r.points];if(r.srcRect)i=jn(i,r.srcRect,!0);if(r.dstRect)i=jn(i,r.dstRect,!1);i=be(pn(i)),i=Po(i,r.srcRect,r.dstRect),r.edge.points=be(pn(i))}}e(Bs,"clipEdgeEndpointsToNodeBoundaries");function Wn(t,o,s,r=!1){if(At(t,o,mt)){if(o.y<s.top-mt||o.y>s.bottom+mt)return o;if(r){if(t.x<s.left-mt)return{x:s.left,y:t.y};if(t.x>s.right+mt)return{x:s.right,y:t.y}}return{x:Math.abs(o.x-s.left)<=Math.abs(o.x-s.right)?s.left:s.right,y:t.y}}if(wt(t,o,mt)){if(o.x<s.left-mt||o.x>s.right+mt)return o;if(r){if(t.y<s.top-mt)return{x:t.x,y:s.top};if(t.y>s.bottom+mt)return{x:t.x,y:s.bottom}}let i=Math.abs(o.y-s.top)<=Math.abs(o.y-s.bottom);return{x:t.x,y:i?s.top:s.bottom}}return o}e(Wn,"snapEndpointToBoundary");function mn(t,o,s){let r=t[o];for(let i=o+s;i>=0&&i<t.length;i+=s){let c=t[i];if(!ye(c,r,mt))return c}return t[o+s]}e(mn,"firstDistinctAdjacent");function yn(t,o){let s=t+Vn,r=o-Vn;return s<=r?{lo:s,hi:r}:{lo:(t+o)/2,hi:(t+o)/2}}e(yn,"cornerClearanceRange");function Kn(t,o,s){let{lo:r,hi:i}=yn(o,s);return Math.min(i,Math.max(r,t))}e(Kn,"clampToCornerClearance");function Ps(t){let o=Math.max(...t.map((r)=>r.lo)),s=Math.min(...t.map((r)=>r.hi));if(o>s)return;return{lo:o,hi:s}}e(Ps,"intersectRanges");function qn(t,o){return o==="left"||o==="right"?yn(t.top,t.bottom):yn(t.left,t.right)}e(qn,"clearanceRangeForSide");function xn(t,o,s){let r=t.y>=s.top-mt&&t.y<=s.bottom+mt,i=t.x>=s.left-mt&&t.x<=s.right+mt;if(At(t,o,mt)&&r){if(Math.abs(t.x-s.left)<mt)return"left";if(Math.abs(t.x-s.right)<mt)return"right"}if(wt(t,o,mt)&&i){if(Math.abs(t.y-s.top)<mt)return"top";if(Math.abs(t.y-s.bottom)<mt)return"bottom"}return}e(xn,"terminalSideForSegment");function Ke(t){return t==="left"||t==="right"}e(Ke,"isHorizontalSide");function ks(t,o,s,r,i){let c=[],a=s?xn(t,o,s):void 0,l=r?xn(o,t,r):void 0;if(s&&a&&Ke(a)===i)c.push(qn(s,a));if(r&&l&&Ke(l)===i)c.push(qn(r,l));return c.length>0?Ps(c):void 0}e(ks,"straightClearanceRange");function Zn(t,o,s,r,i){let c=ks(t,o,s,r,i);if(!c)return;let a=i?t.y:t.x,l=Math.min(c.hi,Math.max(c.lo,a));if(Math.abs(l-a)<mt)return;return i?[{x:t.x,y:l},{x:o.x,y:l}]:[{x:l,y:t.y},{x:l,y:o.y}]}e(Zn,"clearStraightEndpointCornerAxis");function Po(t,o,s){if(t.length!==2)return t;let[r,i]=t;if(At(r,i,mt))return Zn(r,i,o,s,!0)??t;if(wt(r,i,mt))return Zn(r,i,o,s,!1)??t;return t}e(Po,"clearStraightEndpointCornerConnections");function _s(t,o,s){return Ke(s)?{x:t.x,y:Kn(t.y,o.top,o.bottom)}:{x:Kn(t.x,o.left,o.right),y:t.y}}e(_s,"cornerClearedEndpoint");function Hs(t,o,s,r,i,c){let a=t.map((l)=>({...l}));for(let l=o;l>=0&&l<t.length;l+=s){let d=t[l];if(c&&!At(d,r,mt))break;if(!c&&!wt(d,r,mt))break;if(c)a[l].y=i.y;else a[l].x=i.x}return a}e(Hs,"moveCollinearEndpointRun");function Jn(t,o,s){if(t.length<2)return t;let r=s?0:t.length-1,i=s?1:-1,c=t[r],a=mn(t,r,i);if(!a)return t;let l=xn(c,a,o);if(!l)return t;let d=Ke(l),h=_s(c,o,l);if(ye(c,h,mt))return t;return Hs(t,r,i,c,h,d)}e(Jn,"clearEndpointCornerConnection");function Qn(t,o,s){let r=Math.min(t.x,o.x)>=s.left-mt&&Math.max(t.x,o.x)<=s.right+mt,i=Math.min(t.y,o.y)>=s.top-mt&&Math.max(t.y,o.y)<=s.bottom+mt;if(Math.abs(t.y-s.top)<mt&&Math.abs(o.y-s.top)<mt&&r)return"top";if(Math.abs(t.y-s.bottom)<mt&&Math.abs(o.y-s.bottom)<mt&&r)return"bottom";if(Math.abs(t.x-s.left)<mt&&Math.abs(o.x-s.left)<mt&&i)return"left";if(Math.abs(t.x-s.right)<mt&&Math.abs(o.x-s.right)<mt&&i)return"right";return}e(Qn,"borderSideForSegment");function to(t,o,s,r){switch(t){case"top":return wt(o,s,mt)&&s.y<r.top-mt;case"bottom":return wt(o,s,mt)&&s.y>r.bottom+mt;case"left":return At(o,s,mt)&&s.x<r.left-mt;case"right":return At(o,s,mt)&&s.x>r.right+mt}}e(to,"leavesOutward");function eo(t,o,s){if(t.length<3)return t;if(s){let c=Qn(t[0],t[1],o);if(c&&to(c,t[1],t[2],o))return t.slice(1);return t}let r=t.length-1,i=Qn(t[r-1],t[r],o);if(i&&to(i,t[r-1],t[r-2],o))return t.slice(0,r);return t}e(eo,"collapseOwnBorderStub");function Ds(t,o,s){let r=t;if(o){let c=mn(r,0,1);if(c){let a=Wn(c,r[0],o);if(a!==r[0])r=[a,...r.slice(1)]}r=eo(r,o,!0)}if(s){let c=r.length-1,a=mn(r,c,-1);if(a){let l=Wn(a,r[c],s,!0);if(l!==r[c])r=[...r.slice(0,c),l]}r=eo(r,s,!1)}let i=Po(r,o,s);if(i!==r||r.length===2)return i;if(o)r=Jn(r,o,!0);if(s)r=Jn(r,s,!1);return r}e(Ds,"snapAndCollapseEndpoints");function bn(t,o){for(let s of t){let r=Bo(s,o,2);if(!r)continue;let i=Ct(r.points,mt),c=Ds(i,r.srcRect,r.dstRect);if(c.length<3){r.edge.points=c;continue}let a=[c[0],{...c[0]},...c.slice(1,-1),c[c.length-1],{...c[c.length-1]}];r.edge.points=a}}e(bn,"prepareEdgeEndpointsForRenderer");function Xs(t){return new Map(t.map((o)=>[o.id,o]))}e(Xs,"buildNodeMap");function no(t,o){let s=new Set([t.id]),r=0,i=t.parentId;while(i&&!s.has(i)){let c=o.get(i);if(!c?.isGroup)break;s.add(i),r++,i=c.parentId}return r}e(no,"groupDepth");function ko(t){let o=1/0,s=-1/0,r=1/0,i=-1/0;for(let c of t){let{x:a,y:l}=c;if(typeof a!=="number"||typeof l!=="number")continue;let d=c.width??0,h=c.height??0;o=Math.min(o,a-d/2),s=Math.max(s,a+d/2),r=Math.min(r,l-h/2),i=Math.max(i,l+h/2)}if(o===1/0||r===1/0)return null;return{minX:o,maxX:s,minY:r,maxY:i}}e(ko,"boundsForChildren");function Gs(t,o){let s=t.padding??20;t.x=(o.minX+o.maxX)/2,t.y=(o.minY+o.maxY)/2,t.width=Math.max(0,o.maxX-o.minX)+s,t.height=Math.max(0,o.maxY-o.minY)+s}e(Gs,"applyGroupBounds");function Ys(t){let o=Xs(t),s=t.filter((r)=>r.isGroup&&r.parentId).sort((r,i)=>no(i,o)-no(r,o));for(let r of s){let i=t.filter((a)=>a.parentId===r.id),c=ko(i);if(c)Gs(r,c)}}e(Ys,"recomputeNestedGroupBounds");function In(t,o){let s=t.nodes??[],r=t.edges??[],i=s.filter((d)=>!d.isGroup),c=1/0,a=-1/0;for(let d of i){let h=d[o];if(typeof h!=="number")continue;c=Math.min(c,h),a=Math.max(a,h)}if(!Number.isFinite(c)||!Number.isFinite(a))return!1;let l=e((d)=>c+a-d,"mirror");for(let d of s){let h=d[o];if(typeof h==="number")d[o]=l(h);let y=d.groupTitleRect;if(y)d.groupTitleRect=o==="x"?{...y,left:l(y.right),right:l(y.left)}:{...y,top:l(y.bottom),bottom:l(y.top)}}for(let d of r)for(let h of d.points??[])h[o]=l(h[o]);return!0}e(In,"mirrorAxis");function zs(t){if(!(t.nodes??[]).some((s)=>!s.isGroup))return!0;return In(t,"y")}e(zs,"applyBtDirectionTransform");function _o(t){let o=Ve(t),s=t.filter((l)=>!l.isGroup&&!l.isEdgeLabel&&!o.has(l.id));if(s.length===0)return 1;let r=0,i=0;for(let l of s)r+=l.width??0,i+=l.height??0;let c=r/s.length,a=i/s.length;return a>0?Math.max(1,c/a):1}e(_o,"flowAxisStretch");var Ti=36,Oi=["top","right","bottom","left"];function $s(t){if(t==="left")return"right";return t==="right"?"left":t}e($s,"mirroredSide");function Us(t,o,s,r,i){if(s==="top"||s==="bottom"){let a=(o.left+o.right)/2,[l,d]=i?[r.after,r.before]:[r.before,r.after];t.left=Math.min(t.left,a-l),t.right=Math.max(t.right,a+d);return}let c=(o.top+o.bottom)/2;t.top=Math.min(t.top,c-r.before),t.bottom=Math.max(t.bottom,c+r.after)}e(Us,"growAlongBorder");var Ni={top:e((t,o,s)=>{t.top=Math.min(t.top,o.top-s)},"top"),bottom:e((t,o,s)=>{t.bottom=Math.max(t.bottom,o.bottom+s)},"bottom"),left:e((t,o,s)=>{t.left=Math.min(t.left,o.left-s)},"left"),right:e((t,o,s)=>{t.right=Math.max(t.right,o.right+s)},"right")};function Vs(t,o,s,r,i){Us(t,o,s,r,i),Ni[s](t,o,r.beyond)}e(Vs,"reserveOnSide");function js(t,o,s){let r=t.x??0,i=t.y??0,c=(t.width??0)/2,a=(t.height??0)/2,l={left:r-c,right:r+c,top:i-a,bottom:i+a},d={...l},h=s==="RL";for(let y of Oi){let f=o[y];if(f)Vs(d,l,h?$s(y):y,f,h)}return{...t,x:(d.left+d.right)/2,y:(d.top+d.bottom)/2,width:d.right-d.left,height:d.bottom-d.top}}e(js,"withAnchorFootprints");function Ws(t,o="LR"){let s=t.nodes??[],r=t.edges??[],i=Ve(s),c=s.filter((R)=>!R.isGroup&&!i.has(R.id)),a=1/0,l=1/0;for(let R of c){let P=R.x??0,V=R.y??0;if(P<a)a=P;if(V<l)l=V}if(!Number.isFinite(a)||!Number.isFinite(l))return!1;let d=Ti,h=_o(s);for(let R of c){let P=R.x??0,z=((R.y??0)-l)*h+d,Y=P-a;R.x=z,R.y=Y}for(let R of r){if(!R.points)continue;for(let P of R.points){let V=P.x,Y=(P.y-l)*h+d,et=V-a;P.x=Y,P.y=et}}Ys(s);let y=Ie(s),f=s.filter((R)=>y.isLane(R.id));if(f.length===0){if(o==="RL")In(t,"x");return!0}let b=new Map,v=ps(s,o);for(let R of s){if(y.isLane(R.id)||y.isPool(R.id)||i.has(R.id))continue;let P=y.laneIdOf(R.id);if(!P)continue;let V=b.get(P)??[],z=v.get(R.id);V.push(z?js(R,z,o):R),b.set(P,V)}let x=0;for(let R of f){let P=R.padding??0;if(P>x)x=P}let p=[],m=1/0,L=-1/0;for(let R of f){let P=b.get(R.id)??[],V=ko(P);if(!V)continue;m=Math.min(m,V.minX),L=Math.max(L,V.maxX),p.push({lane:R,contentTop:V.minY,contentBottom:V.maxY,centerY:(V.minY+V.maxY)/2})}if(m===1/0||L===-1/0)return!0;let g=Math.max(0,L-m),S=Math.max(x,10),E=g+2*S,M=d+E,A=(m+L)/2-E/2-d,B=A+M/2,k=Math.max(x,d);p.sort((R,P)=>R.centerY-P.centerY);for(let R=0;R<p.length;R++){let P=p[R],V,z;if(R===0)V=P.contentTop-k;else V=(p[R-1].contentBottom+P.contentTop)/2;if(R===p.length-1)z=P.contentBottom+k;else{let ft=p[R+1];z=(P.contentBottom+ft.contentTop)/2}let Y=Math.max(0,z-V),et=(V+z)/2;P.lane.x=B,P.lane.y=et,P.lane.width=M,P.lane.height=Y,P.lane.swimlaneContentTop=P.contentTop,P.lane.groupTitleRect={left:A,right:A+d,top:V,bottom:z}}if(o==="RL")In(t,"x");return!0}e(Ws,"applyLrDirectionTransform");var xe=0.000001,Fi=8,rn=Fi,Bi=[0,rn,-rn,2*rn,-2*rn];function Ks(t,o){let{nodeInfoById:s,realNodeRects:r}=wn(o);for(let i of t){if(i.isLayoutOnly)continue;let c=i.points;if(!c||c.length<4)continue;let a=Eo(Ct(c,xe),xe);if(!a)continue;let{p3:l}=a,d=a.kind==="HVH",h=Oo(i,s,xe);if(!h)continue;let{srcId:y,dstId:f,srcInfo:b,dstInfo:v,collinearX:x,collinearY:p}=h;if(x||p)continue;let m,L=b.rect;for(let g of Bi){let S,E,M;if(d){let R=v.cy>b.cy?L.bottom:L.top,P=b.cx+g;if(P<=L.left+xe||P>=L.right-xe)continue;S={x:P,y:R},E={x:P,y:l.y},M={x:l.x,y:l.y}}else{let R=v.cx>b.cx?L.right:L.left,P=b.cy+g;if(P<=L.top+xe||P>=L.bottom-xe)continue;S={x:R,y:P},E={x:l.x,y:P},M={x:l.x,y:l.y}}let I=ye(S,E,xe),w=ye(E,M,xe);if(I&&w)continue;if(!I&&Xt(S,E,r,[y],1))continue;if(!w&&Xt(E,M,r,[f],1))continue;let A=!I&&gn(S,E,t,i,{epsilon:xe,skipDegenerateOther:!0}),B=!w&&gn(E,M,t,i,{epsilon:xe,skipDegenerateOther:!0});if(A||B)continue;if(I)m=[E,M];else if(w)m=[S,E];else m=[S,E,M];break}if(m)i.points=m}}e(Ks,"portSwapToLShape");function qs(t,o){let{realNodeRects:c,labelNodeRects:a}=ve(o.values());for(let l of t){if(l.isLayoutOnly)continue;let d=l.points;if(!d||d.length<4)continue;let h=Ct(d,0.001);if(h.length<4)continue;let y=h.length-1,f=h[y],b=h[y-1],v=h[y-2],x=f.x-b.x,p=f.y-b.y,m=Math.hypot(x,p);if(m>=10||m<0.001)continue;let L=b.x-v.x,g=b.y-v.y;if(Math.hypot(L,g)<0.001)continue;let E=$t(b,f,0.001),M=Ut(b,f,0.001),I=$t(v,b,0.001),w=Ut(v,b,0.001);if(!(E&&w||M&&I))continue;let{end:A,start:B}=l,k=A?o.get(A):void 0;if(!k)continue;let R=k.x??0,P=k.y??0,V=se(k);if(!V)continue;let z,Y;if(w){let nt=g<0;z={x:R,y:v.y},Y={x:R,y:nt?V.bottom:V.top}}else{let nt=L>0;z={x:v.x,y:P},Y={x:nt?V.right:V.left,y:P}}if(Xt(z,Y,c,A?[A]:[],-2))continue;if(Xt(z,Y,a,[],-2))continue;if(B){let nt=o.get(B),ht=nt?se(nt):void 0;if(ht&&Ao(z,ht,2))continue}let et=e((nt,ht)=>`${nt.x.toFixed(3)},${nt.y.toFixed(3)}|${ht.x.toFixed(3)},${ht.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let nt=0;nt<h.length-1;nt++)ft.add(et(h[nt],h[nt+1]));let St=e((nt,ht)=>{for(let H of t){if(H===l)continue;if(H.isLayoutOnly)continue;let j=H.points;if(!j||j.length<2)continue;for(let st=0;st<j.length-1;st++){let Q=j[st],at=j[st+1];if(ft.has(et(Q,at)))continue;if(Ce(nt,ht,Q,at,0.001))return!0}}return!1},"segmentCrossesOtherEdge");if(St(z,Y))continue;if(y-3>=0){let nt=h[y-3],ht=[B,A].filter((H)=>Boolean(H));if(Xt(nt,z,c,ht,-2))continue;if(St(nt,z))continue}let Jt=[...h.slice(0,y-2),z,Y];l.points=Jt;let Qt=l.labelNodeId;if(Qt){let nt=o.get(Qt);if(nt){let ht=nt.width??0,H=nt.height??0;if(ht>0&&H>0){let j,st,Q=-1;for(let at=0;at<Jt.length-1;at++){let pt=Jt[at],yt=Jt[at+1],xt=Math.hypot(yt.x-pt.x,yt.y-pt.y),vt=At(pt,yt,0.001),Dt=wt(pt,yt,0.001);if(!(vt&&xt>=ht+2||Dt&&xt>=H+2))continue;if(xt>Q)Q=xt,j=(pt.x+yt.x)/2,st=(pt.y+yt.y)/2}if(j!==void 0&&st!==void 0)nt.x=j,nt.y=st}}}}}e(qs,"collapseShortTerminalStub");var ts=4,es=2,Ho={EDGE_GAP:12,LANE_MARGIN:20,ARROWHEAD_SIZE:8,ARROWHEAD_GAP:ts,MIN_ARROWHEAD_SPACING:12,EDGE_STROKE_WIDTH:es,ROUTE_TOUCH_TOLERANCE:ts+es},Pi={EPSILON:0.000001},Mn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Hn={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40,EDGE_LABEL_CLEARANCE:16},dt=0.001,qt=8,Zs=e((t)=>typeof t==="string"?t.toUpperCase():"","upperCaseDirection"),It=ge,Dn=e((t,o)=>wt(t,o,dt)||At(t,o,dt),"orthogonallyAligned");function oo(t,o){let c=e((g,S)=>{let E=Math.min(8,(S-g)/4);return{low:g+E,high:S-E}},"usableFace"),a=e((g,S)=>{let E=g.x??0,M=g.y??0,I=S.x-E,w=S.y-M,A=(g.width??0)/2,B=(g.height??0)/2;if(Math.abs(w)*A>Math.abs(I)*B){if(w<0)B=-B;return{x:E+(w===0?0:B*I/w),y:M+B}}if(I<0)A=-A;return{x:E+A,y:M+(I===0?0:A*w/I)}},"rectIntersect"),l=e((g,S)=>{let E=Ct(g.points??[]);if(E.length<2)return;let M=S?g.start:g.end,I=M?o.get(M):void 0,w=I?se(I):void 0;if(!I||!M||!w)return;let A=S?E[0]:E[E.length-1],B=S?E[1]:E[E.length-2],k=a(I,A),R=A;if(Dn(B,k))R=B;if(wt(k,R,dt))return{edge:g,edgeId:String(g.id??""),nodeId:M,atStart:S,orientation:"V",coord:k.x,min:Math.min(k.y,R.y),max:Math.max(k.y,R.y),boundary:k,railEnd:R,rect:w};if(At(k,R,dt))return{edge:g,edgeId:String(g.id??""),nodeId:M,atStart:S,orientation:"H",coord:k.y,min:Math.min(k.x,R.x),max:Math.max(k.x,R.x),boundary:k,railEnd:R,rect:w};return},"terminalLaneFor"),d=e((g,S)=>Math.max(0,Math.min(g.max,S.max)-Math.max(g.min,S.min)),"projectedOverlapLength"),h=e((g,S)=>{if(g.nodeId!==S.nodeId||g.orientation!==S.orientation)return!1;if(g.orientation==="H")return(Math.abs(g.boundary.x-g.rect.left)<1||Math.abs(g.boundary.x-g.rect.right)<1)&&wt(g.boundary,S.boundary,1);return(Math.abs(g.boundary.y-g.rect.top)<1||Math.abs(g.boundary.y-g.rect.bottom)<1)&&At(g.boundary,S.boundary,1)},"sameTerminalFace"),y=e((g,S)=>{if(g.nodeId!==S.nodeId||g.orientation!==S.orientation)return!1;return d(g,S)>=qt&&Math.abs(g.coord-S.coord)<0.5},"exactTerminalLaneConflict"),f=e((g,S)=>{if(g.nodeId!==S.nodeId||g.orientation!==S.orientation||g.orientation!=="H"||g.atStart===S.atStart)return!1;let E=d(g,S);if(E<qt)return!1;let M=g.rect.bottom-g.rect.top;if(E<M||E>2*M)return!1;return h(g,S)&&Math.abs(g.coord-S.coord)<16},"nearTerminalLaneConflict"),b=e((g,S)=>{let E=Ct(g.edge.points??[]);if(E.length<2)return;let M=g.orientation==="V"?{x:g.boundary.x+S,y:g.boundary.y}:{x:g.boundary.x,y:g.boundary.y+S},I=g.orientation==="V"?{x:g.railEnd.x+S,y:g.railEnd.y}:{x:g.railEnd.x,y:g.railEnd.y+S};if(!e(()=>{if(Math.abs(g.boundary.y-g.rect.top)<1||Math.abs(g.boundary.y-g.rect.bottom)<1){let R=c(g.rect.left,g.rect.right);return At(M,g.boundary,dt)&&M.x>=R.low&&M.x<=R.high}if(Math.abs(g.boundary.x-g.rect.left)<1||Math.abs(g.boundary.x-g.rect.right)<1){let R=c(g.rect.top,g.rect.bottom);return wt(M,g.boundary,dt)&&M.y>=R.low&&M.y<=R.high}return!1},"boundaryStaysOnSameFace")())return;if(g.atStart){let R=E.length>1&&ye(E[1],g.railEnd,dt),P=E.slice(R?2:1),V=P[0];if(V&&!Dn(V,I))return;return[M,I,...P]}let A=E.length>1&&ye(E[E.length-2],g.railEnd,dt),B=E.slice(0,A?-2:-1),k=B[B.length-1];if(k&&!Dn(k,I))return;return[...B,I,M]},"shiftedCandidate"),v=e((g)=>{let S=g.edge,E=Ct(S.points??[]);if(E.length!==2)return!1;let{start:M,end:I}=S,w=M?o.get(M):void 0,A=I?o.get(I):void 0;if(!w||!A)return!1;let B=w.x??0,k=w.y??0,R=A.x??0,P=A.y??0,[V,z]=E;return At(V,z,dt)&&Math.abs(k-P)<1&&Math.abs(B-R)>1||wt(V,z,dt)&&Math.abs(B-R)<1&&Math.abs(k-P)>1},"laneIsStraightCollinearConnector"),x=e((g)=>g.orientation==="H"?c(g.rect.top,g.rect.bottom):c(g.rect.left,g.rect.right),"usableSpanOf"),p=e((g,S)=>{let E=x(g),M=g.coord<S.coord?E.low-g.coord:E.high-g.coord;return Math.sign(M)===Math.sign(g.coord-S.coord)?M:0},"shiftToFaceLimit"),m=e((g)=>{let S=x(g);return[S.low-g.coord,S.high-g.coord]},"shiftsToFaceEnds"),L=[-7,7,-14,14,-21,21];for(let g=0;g<8;g++){let S=t.filter((M)=>!M.isLayoutOnly).flatMap((M)=>[l(M,!0),l(M,!1)]).filter((M)=>Boolean(M)),E=!1;for(let M=0;M<S.length&&!E;M++)for(let I=M+1;I<S.length&&!E;I++){let w=S[M],A=S[I];if(w.edge===A.edge||!(y(w,A)||f(w,A)))continue;let B=!y(w,A),k=[w,A].sort((Y,et)=>{let ft=v(Y),St=v(et);if(ft!==St)return Number(ft)-Number(St);return Number(!et.atStart)-Number(!Y.atStart)}),R=e((Y,et,ft)=>S.some((St)=>St.edge!==Y.edge&&(y(et,St)||ft&&f(et,St))),"conflictsWith"),P=e((Y,et)=>Math.min(...S.filter((ft)=>ft.edge!==Y.edge&&ft.nodeId===et.nodeId&&ft.orientation===et.orientation&&d(et,ft)>=qt).map((ft)=>Math.abs(et.coord-ft.coord))),"closestTrackGap"),V=e((Y,et,ft,St=!1)=>{let Zt=et?l({...Y.edge,points:et},Y.atStart):void 0;if(!et||!Zt||R(Y,Zt,ft)||St&&P(Y,Zt)<P(Y,Y))return!1;return Y.edge.points=et,!0},"accept"),z=B?k.filter((Y)=>!v(Y)):k;for(let Y of z)if(E=L.some((et)=>V(Y,b(Y,et),B)),E)break;if(!E){for(let Y of z)if(E=(B?[p(Y,Y===w?A:w)]:m(Y)).some((St)=>Math.abs(St)>dt&&V(Y,b(Y,St),!1,!0)),E)break}}if(!E)return}}e(oo,"separateSharedRenderedTerminalLanes");function Js(t,o){let{realNodeRects:i,labelNodeRects:c}=ve(o.values()),a=e((d,h)=>{let{start:y,end:f}=d,b=It(h);if(b.length!==h.length-1)return!1;let v=[y,f].filter((x)=>Boolean(x));for(let x of b){if(Xt(x.a,x.b,i,v,-2))return!1;if(Xt(x.a,x.b,c,[],-2))return!1}for(let x of t){if(x===d||x.isLayoutOnly)continue;let p=x.points;if(!p||p.length<2)continue;for(let m of b)for(let L of It(Ct(p))){if(Se(m,L,0.5)>=qt)return!1;if(Ce(m.a,m.b,L.a,L.b,dt))return!1}}return!0},"candidateIsSafe"),l=e((d,h)=>{if(h+4>=d.length)return;let y=d[h],f=d[h+1],b=d[h+2],v=d[h+3],x=d[h+4],p=$t(y,f)&&Ut(f,b)&&$t(b,v)&&Ut(v,x)&&wt(y,v,dt)&&wt(y,x,dt)&&wt(f,b,dt)&&(f.x-y.x)*(v.x-b.x)<0,m=Ut(y,f)&&$t(f,b)&&Ut(b,v)&&$t(v,x)&&At(y,v,dt)&&At(y,x,dt)&&At(f,b,dt)&&(f.y-y.y)*(v.y-b.y)<0;if(p||m)return Ct([...d.slice(0,h+1),x,...d.slice(h+5)]);if(h+5>=d.length)return;let L=d[h+5],g=Ut(y,f)&&$t(f,b)&&Ut(b,v)&&$t(v,x)&&Ut(x,L)&&wt(y,x,dt)&&wt(y,L,dt)&&wt(b,v,dt)&&(b.x-f.x)*(x.x-v.x)<0,S=$t(y,f)&&Ut(f,b)&&$t(b,v)&&Ut(v,x)&&$t(x,L)&&At(y,x,dt)&&At(y,L,dt)&&At(b,v,dt)&&(b.y-f.y)*(x.y-v.y)<0;if(!g&&!S)return;return Ct([...d.slice(0,h+1),L,...d.slice(h+6)])},"withoutDogleg");for(let d=0;d<8;d++){let h=!1;for(let y of t){if(y.isLayoutOnly)continue;let f=Ct(y.points??[]);for(let b=0;b<=f.length-5;b++){let v=l(f,b);if(!v||!a(y,v))continue;y.points=v,h=!0;break}if(h)break}if(!h)return}}e(Js,"collapseRedundantRectangularDoglegs");function so(t,o){let{realNodeRects:c,labelNodeRects:a}=ve(o.values()),l=t.filter((x)=>!x.isLayoutOnly),d=e((x,p,m)=>Ct(x===p?m??[]:x.points??[]),"pointsFor"),h=e((x,p)=>{let m=0;for(let L=0;L<l.length;L++){let g=It(d(l[L],x,p));for(let S=L+1;S<l.length;S++){let E=It(d(l[S],x,p));for(let M of g)for(let I of E)if(Ce(M.a,M.b,I.a,I.b,dt))m++}}return m},"strictCrossingCount"),y=e((x)=>{let p=It(x);if(p.length!==3)return;let m=p[1];if(p[0].horizontal===m.horizontal||p[2].horizontal===m.horizontal)return;return{index:m.index,horizontal:m.horizontal,vertical:m.vertical,segment:m}},"middleRail"),f=e((x,p)=>{let m=[x.start,x.end].filter((L)=>Boolean(L));return c.filter((L)=>{if(m.includes(L.id))return!1;let g=L.rect;if(p.horizontal)return ce(p.a.x,p.b.x,g.left,g.right)>=qt&&p.a.y>=g.top-2&&p.a.y<=g.bottom+2;return ce(p.a.y,p.b.y,g.top,g.bottom)>=qt&&p.a.x>=g.left-2&&p.a.x<=g.right+2})},"blockingRectsFor"),b=e((x,p,m)=>{let L=x.map((S)=>({...S}));if(p.horizontal)L[p.index].y=m,L[p.index+1].y=m;else if(p.vertical)L[p.index].x=m,L[p.index+1].x=m;else return;let g=be(Ct(L));return It(g).length===g.length-1?g:void 0},"candidateByMovingRail"),v=e((x,p,m)=>{let L=[x.start,x.end].filter((S)=>Boolean(S)),g=It(p);if(g.length!==p.length-1)return!1;for(let S of g){if(Xt(S.a,S.b,c,L,-2))return!1;if(Xt(S.a,S.b,a,[],-2))return!1}for(let S of l){if(S===x)continue;for(let E of g)for(let M of It(d(S)))if(Se(E,M,0.5)>=qt)return!1}return h(x,p)<=m},"candidateIsSafe");for(let x=0;x<8;x++){let p=h(),m=!1;for(let L of l){let g=d(L),S=y(g);if(!S)continue;let E=f(L,S.segment);if(E.length===0)continue;let M=S.horizontal?[Math.min(...E.map((I)=>I.rect.top))-20,Math.max(...E.map((I)=>I.rect.bottom))+20]:[Math.min(...E.map((I)=>I.rect.left))-20,Math.max(...E.map((I)=>I.rect.right))+20];for(let I of M){let w=b(g,S.segment,I);if(!w||!v(L,w,p))continue;L.points=w,m=!0;break}if(m)break}if(!m)return}}e(so,"liftObstacleHuggingSameSideRails");function ro(t,o,s){let i=e((y)=>{let f=y.groupTitleRect;if(!f||typeof f.left!=="number"||typeof f.right!=="number"||typeof f.top!=="number"||typeof f.bottom!=="number"||!Number.isFinite(f.left)||!Number.isFinite(f.right)||!Number.isFinite(f.top)||!Number.isFinite(f.bottom)||f.right<=f.left||f.bottom<=f.top)return;return{left:f.left,right:f.right,top:f.top,bottom:f.bottom}},"validTitleRect"),c=Ie([...o.values()]),a=e((y)=>{if(!c.isLane(y.id))return;let f=Zs(y.direction??s);if(f==="LR"||f==="RL"||f==="BT")return;let b=i(y),{y:v,height:x}=y;if(!b||typeof v!=="number"||typeof x!=="number"||!Number.isFinite(v)||!Number.isFinite(x)||x<=0)return;let p=b.right-b.left,m=b.bottom-b.top;if(m<=0||p<m)return;return{node:y,rect:b}},"topLaneTitleFor"),l=e((y,f)=>{if(!y.horizontal)return!1;let b=y.a.y;if(b<f.top-dt||b>f.bottom+dt)return!1;return ce(y.a.x,y.b.x,f.left,f.right)>=qt},"horizontalSegmentIntersectsTitle"),d=[...o.values()].map(a).filter((y)=>Boolean(y));if(d.length===0)return;let h=0;for(let y of t){if(y.isLayoutOnly)continue;let f=Ct(y.points??[]);for(let b of It(f))for(let v of d){if(!l(b,v.rect))continue;h=Math.max(h,v.rect.bottom-b.a.y+4)}}if(h<=dt)return;for(let y of d){let f=y.node.y,b=y.node.height;if(typeof f!=="number"||typeof b!=="number"||!Number.isFinite(f)||!Number.isFinite(b)||b<=0)continue;y.node.y=f-h/2,y.node.height=b+h,y.node.groupTitleRect={...y.rect,top:y.rect.top-h,bottom:y.rect.bottom-h}}}e(ro,"liftTopLaneTitleBandsAboveRails");function io(t,o,s){let i=e((f)=>{let b=f.groupTitleRect;if(!b||typeof b.left!=="number"||typeof b.right!=="number"||typeof b.top!=="number"||typeof b.bottom!=="number"||!Number.isFinite(b.left)||!Number.isFinite(b.right)||!Number.isFinite(b.top)||!Number.isFinite(b.bottom)||b.right<=b.left||b.bottom<=b.top)return;return{left:b.left,right:b.right,top:b.top,bottom:b.bottom}},"validTitleRect"),c=Ie([...o.values()]),a=e((f)=>{if(!c.isLane(f.id))return;if(Zs(f.direction??s)!=="LR")return;let v=i(f),{x,width:p}=f;if(!v||typeof x!=="number"||typeof p!=="number"||!Number.isFinite(x)||!Number.isFinite(p)||p<=0)return;let m=v.right-v.left,L=v.bottom-v.top;if(m<=0||L<m)return;return{node:f,rect:v}},"leftLaneTitleFor"),l=e((f,b)=>{if(!f.vertical)return!1;let v=f.a.x;if(v<b.left-dt||v>b.right+dt)return!1;return ce(f.a.y,f.b.y,b.top,b.bottom)>=qt},"verticalSegmentIntersectsTitle"),d=e((f,b)=>{if(!f.horizontal)return!1;let v=f.a.y;if(v<b.top-dt||v>b.bottom+dt)return!1;return ce(f.a.x,f.b.x,b.left,b.right)>=qt},"horizontalSegmentIntersectsTitle"),h=[...o.values()].map(a).filter((f)=>Boolean(f));if(h.length===0)return;let y=0;for(let f of t){if(f.isLayoutOnly)continue;let b=Ct(f.points??[]);for(let v of It(b))for(let x of h)if(l(v,x.rect))y=Math.max(y,x.rect.right-v.a.x+4);else if(d(v,x.rect)){let p=Math.min(v.a.x,v.b.x);y=Math.max(y,x.rect.right-p+4)}}if(y<=dt)return;for(let f of h){let b=f.node.x,v=f.node.width;if(typeof b!=="number"||typeof v!=="number"||!Number.isFinite(b)||!Number.isFinite(v)||v<=0)continue;f.node.x=b-y/2,f.node.width=v+y,f.node.groupTitleRect={...f.rect,left:f.rect.left-y,right:f.rect.right-y}}}e(io,"shiftLeftLaneTitleBandsLeftOfRails");function Qs(t,o){let{realNodeRects:i}=ve(o.values()),c=t.filter((p)=>!p.isLayoutOnly),a=e((p,m=new Map)=>Ct(m.get(p)??p.points??[]),"replacementPointsFor"),l=e((p=new Map)=>{let m=0;for(let L=0;L<c.length;L++){let g=It(a(c[L],p));for(let S=L+1;S<c.length;S++){let E=It(a(c[S],p));for(let M of g)for(let I of E)if(Ce(M.a,M.b,I.a,I.b,dt))m++}}return m},"crossingCount"),d=e((p=new Map)=>c.reduce((m,L)=>m+he(a(L,p)),0),"totalBends"),h=e((p)=>{let m=a(p);if(m.length<4)return;let L=m[m.length-2],g=m[m.length-1];if(!$t(L,g,dt)&&!Ut(L,g,dt))return;return{tailStart:L,terminal:g}},"terminalTailFor"),y=e((p,m)=>{let L=a(p);if(L.length<3)return;let g=L[0],S=L[1],E;if($t(g,S,dt))E={x:S.x,y:m.tailStart.y};else if(Ut(g,S,dt))E={x:m.tailStart.x,y:S.y};else return;let M=be(Ct([g,S,E,m.tailStart,m.terminal]));return It(M).length===M.length-1?M:void 0},"candidateWithDestinationTail"),f=e((p,m)=>{let L=[p.start,p.end].filter((g)=>Boolean(g));for(let g of It(m))if(Xt(g.a,g.b,i,L,-2))return!0;return!1},"pathHasNodeHit"),b=e((p,m,L)=>{for(let g of c){if(g===p)continue;for(let S of It(m))for(let E of It(a(g,L)))if(Se(S,E,0.5)>=qt)return!0}return!1},"pathHasSharedTrack"),v=e((p,m,L)=>!f(p,m)&&!b(p,m,L),"candidateIsSafe"),x=e(()=>{let p=new Map;for(let m of c){let L=m.end;if(!L||!o.has(L))continue;if(a(m).length<4)continue;let S=p.get(L)??[];S.push(m),p.set(L,S)}return p},"edgesByDestination");for(let p=0;p<4;p++){let m=l();if(m===0)return;let L=d(),g,S=m,E=L;for(let M of x().values())for(let I=0;I<M.length;I++)for(let w=I+1;w<M.length;w++){let A=M[I],B=M[w],k=h(A),R=h(B);if(!k||!R)continue;let P=y(A,R),V=y(B,k);if(!P||!V)continue;let z=new Map([[A,P],[B,V]]);if(!v(A,P,z)||!v(B,V,z))continue;let Y=l(z),et=d(z);if(Y>=m)continue;if(Y>S||Y===S&&et>=E)continue;g=z,S=Y,E=et}if(!g)return;for(let[M,I]of g)M.points=I}}e(Qs,"swapDestinationTerminalTailsToReduceCrossings");function tr(t,o){let{realNodeRects:a,labelNodeRects:l}=ve(o.values()),d=t.filter((M)=>!M.isLayoutOnly),h=e((M,I=new Map)=>Ct(I.get(M)??M.points??[]),"replacementPointsFor"),y=e((M=new Map)=>{let I=0;for(let w=0;w<d.length;w++){let A=It(h(d[w],M));for(let B=w+1;B<d.length;B++){let k=It(h(d[B],M));for(let R of A)for(let P of k)if(Ce(R.a,R.b,P.a,P.b,dt))I++}}return I},"strictCrossingCount"),f=e((M=new Map)=>d.reduce((I,w)=>I+he(h(w,M)),0),"totalBends"),b=e((M)=>{let{start:I,end:w}=M,A=I?o.get(I):void 0,B=w?o.get(w):void 0,k=A?se(A):void 0,R=B?se(B):void 0;return k&&R?{src:k,dst:R}:void 0},"endpointRectsFor"),v=e((M,I,w)=>{if(w.index<=0||w.index+1>=I.length-1)return;let A=b(M);if(!A)return;if(w.vertical){let B=w.a.x,k=Math.min(A.src.left,A.dst.left),R=Math.max(A.src.right,A.dst.right),P=B<k-dt?"left":B>R+dt?"right":void 0;if(!P)return;return{edge:M,points:I,segmentIndex:w.index,axis:"vertical",side:P,coord:B,min:Math.min(w.a.y,w.b.y),max:Math.max(w.a.y,w.b.y)}}if(w.horizontal){let B=w.a.y,k=Math.min(A.src.top,A.dst.top),R=Math.max(A.src.bottom,A.dst.bottom),P=B<k-dt?"top":B>R+dt?"bottom":void 0;if(!P)return;return{edge:M,points:I,segmentIndex:w.index,axis:"horizontal",side:P,coord:B,min:Math.min(w.a.x,w.b.x),max:Math.max(w.a.x,w.b.x)}}return},"externalRailForSegment"),x=e(()=>{let M=[];for(let I of d){let w=h(I);for(let A of It(w)){let B=v(I,w,A);if(B)M.push(B)}}return M},"collectExternalRails"),p=e((M,I)=>M.edge!==I.edge&&M.axis===I.axis&&M.side===I.side&&ce(M.min,M.max,I.min,I.max)>=qt,"railsInteract"),m=e((M)=>{let I=[],w=new Set;for(let A of M){if(w.has(A))continue;let B=[A],k=[];w.add(A);while(B.length>0){let R=B.pop();k.push(R);for(let P of M)if(!w.has(P)&&p(R,P))w.add(P),B.push(P)}if(k.length>1)I.push(k)}return I},"connectedComponents"),L=e((M)=>{let I=[];for(let w of M)if(!I.some((A)=>Math.abs(A-w.coord)<dt))I.push(w.coord);while(I.length<M.length){let w=Math.min(...I),A=Math.max(...I),B=M[0].side;I.push(B==="left"||B==="top"?w-12*(M.length-I.length):A+12*(M.length-I.length))}return I},"uniqueCoordsFor"),g=e((M)=>{let I=M.map((B)=>B.coord),w=L(M),A=[];if(M.length<=6){let B=Array(w.length).fill(!1),k=[],R=e(()=>{if(k.length===M.length){if(k.some((P,V)=>Math.abs(P-I[V])>=dt))A.push([...k]);return}for(let[P,V]of w.entries()){if(B[P])continue;B[P]=!0,k.push(V),R(),k.pop(),B[P]=!1}},"visit");return R(),A}for(let B=0;B<I.length;B++)for(let k=B+1;k<I.length;k++){let R=[...I];[R[B],R[k]]=[R[k],R[B]],A.push(R)}return A},"coordinateAssignmentsFor"),S=e((M,I)=>{let w=new Map;for(let[B,k]of M.entries()){let R=I[B],P=w.get(k.edge)??k.points.map((V)=>({x:V.x,y:V.y}));if(k.axis==="vertical")P[k.segmentIndex].x=R,P[k.segmentIndex+1].x=R;else P[k.segmentIndex].y=R,P[k.segmentIndex+1].y=R;w.set(k.edge,P)}let A=new Map;for(let[B,k]of w){let R=be(Ct(k));if(It(R).length!==R.length-1)return;A.set(B,R)}return A},"replacementsForAssignment"),E=e((M)=>{for(let[I,w]of M){let A=[I.start,I.end].filter((B)=>Boolean(B));for(let B of It(w)){if(Xt(B.a,B.b,a,A,-2))return!1;if(Xt(B.a,B.b,l,[],-2))return!1}}for(let I=0;I<d.length;I++){let w=d[I],A=M.has(w),B=It(h(w,M));for(let k=I+1;k<d.length;k++){let R=d[k];if(!A&&!M.has(R))continue;let P=It(h(R,M));for(let V of B)for(let z of P)if(Se(V,z,0.5)>=qt)return!1}}return!0},"candidateIsSafe");for(let M=0;M<4;M++){let I=y();if(I===0)return;let w,A=I,B=f(),k=Number.POSITIVE_INFINITY;for(let R of m(x()))for(let P of g(R)){let V=S(R,P);if(!V||!E(V))continue;let z=y(V);if(z>=I)continue;let Y=f(V),et=R.reduce((ft,St,Zt)=>ft+Math.abs(P[Zt]-St.coord),0);if(z>A||z===A&&(Y>B||Y===B&&et>=k))continue;w=V,A=z,B=Y,k=et}if(!w)return;for(let[R,P]of w)R.points=P}}e(tr,"reassignCrossingExternalRailChannels");function er(t,o){let{realNodeRects:i,labelNodeRects:c}=ve(o.values()),a=t.filter((x)=>!x.isLayoutOnly),l=e((x,p,m)=>Ct(x===p?m??[]:x.points??[]),"pointsFor"),d=e((x)=>It(x).reduce((p,m)=>{let L=m.a.x-m.b.x,g=m.a.y-m.b.y;return p+Math.hypot(L,g)},0),"pathLength"),h=e((x,p)=>{let m=0;for(let L=0;L<a.length;L++){let g=It(l(a[L],x,p));for(let S=L+1;S<a.length;S++){let E=It(l(a[S],x,p));for(let M of g)for(let I of E)if(Ce(M.a,M.b,I.a,I.b,dt))m++}}return m},"strictCrossingCount"),y=e((x,p)=>{if(x.horizontal){let m=x.a.y;return(Math.abs(m-p.top)<1||Math.abs(m-p.bottom)<1)&&ce(x.a.x,x.b.x,p.left,p.right)>=qt}if(x.vertical){let m=x.a.x;return(Math.abs(m-p.left)<1||Math.abs(m-p.right)<1)&&ce(x.a.y,x.b.y,p.top,p.bottom)>=qt}return!1},"segmentRunsAlongRectBorder"),f=e((x)=>{let p=[x.start,x.end].filter((L)=>Boolean(L)),m=[];for(let L of p){let g=o.get(L),S=g?se(g):void 0;if(S)m.push(S)}return m},"endpointRectsFor"),b=e((x,p)=>{if(p+3>=x.length)return[];let m=x[p],L=x[p+1],g=x[p+2],S=x[p+3],E=$t(m,L,dt)&&Ut(L,g,dt)&&$t(g,S,dt),M=Ut(m,L,dt)&&$t(L,g,dt)&&Ut(g,S,dt);if(!E&&!M)return[];if(!(E?Math.sign(L.x-m.x)!==Math.sign(S.x-g.x):Math.sign(L.y-m.y)!==Math.sign(S.y-g.y)))return[];let w=wt(m,S,dt)||At(m,S,dt)?[]:[{x:m.x,y:S.y},{x:S.x,y:m.y}],A=w.length===0?[[...x.slice(0,p+1),...x.slice(p+3)]]:w.map((k)=>[...x.slice(0,p+1),k,...x.slice(p+3)]),B=new Set;return A.map((k)=>be(Ct(k))).filter((k)=>{if(It(k).length!==k.length-1)return!1;if(!k.some((P)=>ye(P,S,dt)))return!1;let R=k.map((P)=>`${P.x.toFixed(3)},${P.y.toFixed(3)}`).join("|");if(B.has(R))return!1;return B.add(R),!0})},"shortcutCandidatesAt"),v=e((x,p,m)=>{let L=[x.start,x.end].filter((S)=>Boolean(S)),g=f(x);for(let S of It(p)){if(Xt(S.a,S.b,i,L,-2))return!1;if(Xt(S.a,S.b,c,[],-2))return!1;if(g.some((E)=>y(S,E)))return!1}for(let S of a){if(S===x)continue;for(let E of It(p))for(let M of It(l(S)))if(Se(E,M,0.5)>=qt)return!1}return h(x,p)<=m},"candidateIsSafe");for(let x=0;x<8;x++){let p=h(),m,L,g=p,{POSITIVE_INFINITY:S,POSITIVE_INFINITY:E}=Number;for(let M of a){let I=l(M),w=he(I,dt),A=d(I);for(let B=0;B<=I.length-4;B++)for(let k of b(I,B)){let R=he(k,dt),P=d(k);if(!(R<w||R===w&&P<A-dt)||!v(M,k,p))continue;let z=h(M,k);if(z>g||z===g&&(R>S||R===S&&P>=E))continue;m=M,L=k,g=z,S=R,E=P}}if(!m||!L)return;m.points=L}}e(er,"shortcutRedundantOrthogonalJogs");function nr(t,o){let a=[];for(let F of o.values()){if(F.isGroup||F.isEdgeLabel)continue;let _=F.x??0,X=F.y??0,q=se(F);if(!q)continue;a.push({id:String(F.id??""),cx:_,cy:X,rect:q})}if(a.length===0)return;let l=new Map(a.map((F)=>[F.id,F])),d=a.map((F)=>({id:F.id,rect:F.rect})),h=["top","bottom","left","right"],y={top:Math.min(...a.map((F)=>F.rect.top))-20,bottom:Math.max(...a.map((F)=>F.rect.bottom))+20,left:Math.min(...a.map((F)=>F.rect.left))-20,right:Math.max(...a.map((F)=>F.rect.right))+20},f=t.filter((F)=>!F.isLayoutOnly),b=new Map(f.map((F,_)=>[F,_])),v=e((F)=>{let _=F==="left"||F==="top"?-1:1,X=[];for(let q=0;q<=2;q++)X.push(y[F]+_*20*q);return X},"outwardTracksForSide"),x=e((F,_=new Map)=>Ct(_.get(F)??F.points??[]),"replacementPointsFor"),p=e((F,_)=>{let X=0;for(let q of F)for(let J of _)if(Ce(q.a,q.b,J.a,J.b,dt))X++;return X},"crossingCountBetweenSegments"),m=e((F,_)=>p(It(F),It(_)),"crossingCountBetweenPaths"),L=e((F=new Map)=>{let _=0,X=[],q=new Set,J=[],rt=e((U)=>{if(!q.has(U))q.add(U),J.push(U)},"addEdge");for(let U=0;U<f.length;U++){let it=f[U],gt=x(it,F);for(let u=U+1;u<f.length;u++){let C=f[u],T=m(gt,x(C,F));if(T>0)_+=T,X.push({first:it,second:C,count:T}),rt(it),rt(C)}}return J.sort((U,it)=>(b.get(U)??0)-(b.get(it)??0)),{count:_,pairs:X,edgeSet:q,edges:J}},"crossingSnapshot"),g=e((F,_)=>{let X=new Set(_.keys());if(X.size===0)return F.count;let q=0;for(let rt of F.pairs)if(X.has(rt.first)||X.has(rt.second))q+=rt.count;let J=0;for(let rt=0;rt<f.length;rt++){let U=f[rt],it=X.has(U),gt=x(U,_);for(let u=rt+1;u<f.length;u++){let C=f[u];if(!it&&!X.has(C))continue;J+=m(gt,x(C,_))}}return F.count-q+J},"crossingCountWithReplacements"),S=e((F)=>{let _=new Map;for(let J of F.pairs){let rt=_.get(J.first)??new Set;rt.add(J.second),_.set(J.first,rt);let U=_.get(J.second)??new Set;U.add(J.first),_.set(J.second,U)}let X=[],q=new Set;for(let J of F.edges){if(q.has(J))continue;let rt=[J],U=[];q.add(J);while(rt.length>0){let it=rt.pop();U.push(it);for(let gt of _.get(it)??[])if(!q.has(gt))q.add(gt),rt.push(gt)}if(U.sort((it,gt)=>(b.get(it)??0)-(b.get(gt)??0)),U.length>1)X.push(U)}return X},"crossingComponents"),E=e((F)=>[F.start,F.end].filter((_)=>Boolean(_)),"endpointIdsFor"),M=e((F)=>{let _=[];for(let X of S(F)){let q=new Set(X),J=new Set(X.flatMap((U)=>E(U))),rt=[...X];for(let U of f){if(q.has(U))continue;if(E(U).some((it)=>J.has(it)))rt.push(U)}rt.sort((U,it)=>(b.get(U)??0)-(b.get(it)??0)),_.push(rt)}return _},"pairSearchGroups"),I=e((F,_,X)=>g(F,new Map([[_,X]])),"crossingCountWithSingleReplacement"),w=e((F)=>{let _=new Map;for(let X of F.pairs)_.set(X.first,(_.get(X.first)??0)+X.count),_.set(X.second,(_.get(X.second)??0)+X.count);return _},"currentCrossingsByEdge"),A=e((F)=>F.slice(1).reduce((_,X,q)=>{let J=F[q];return _+Math.abs(X.x-J.x)+Math.abs(X.y-J.y)},0),"pathLength"),B=e((F=new Map)=>f.reduce((_,X)=>_+he(x(X,F)),0),"totalBends"),k=e((F=new Map)=>f.reduce((_,X)=>_+A(x(X,F)),0),"totalLength"),R=e((F,_)=>un(F,_,Ho.ROUTE_TOUCH_TOLERANCE),"touchesAtBend"),P=e((F,_,X=new Map)=>{let q=It(_);for(let J of f){if(J===F)continue;for(let rt of q)for(let U of It(x(J,X)))if(Se(rt,U,0.5)>=qt)return!0;if(R(_,x(J,X)))return!0}return!1},"pathHasSegmentConflict"),V=e((F,_)=>{let X=[F.start,F.end].filter((q)=>Boolean(q));for(let q of It(_))if(Xt(q.a,q.b,d,X,-2))return!0;return!1},"pathHitsNode"),z=e((F,_)=>{let X=be(Ct(_));if(It(X).length===X.length-1)F.push(X)},"pushOrthogonalCandidate"),Y=e((F)=>F==="left"||F==="right","sideIsHorizontal"),et=e((F,_,X)=>{switch(_){case"left":return Math.min(F.x,X.x)-20;case"right":return Math.max(F.x,X.x)+20;case"top":return Math.min(F.y,X.y)-20;case"bottom":return Math.max(F.y,X.y)+20}},"localTrackForSameSide"),ft=e((F,_,X,q)=>{let J=X==="left"||X==="top"?-1:1,rt=[et(_,X,q),y[X]];for(let U of rt)for(let it=0;it<=2;it++)z(F,To(_,X,q,U+J*20*it))},"addSameSideCandidates"),St=e((F,_,X,q,J)=>{for(let rt of v(X))for(let U of v(J))z(F,[_,{x:rt,y:_.y},{x:rt,y:U},{x:q.x,y:U},q])},"addHorizontalToVerticalCandidates"),Zt=e((F,_,X,q,J)=>{for(let rt of v(X))for(let U of v(J))z(F,[_,{x:_.x,y:rt},{x:U,y:rt},{x:U,y:q.y},q])},"addVerticalToHorizontalCandidates"),Jt=e((F,_,X,q,J)=>{let rt=[...v("top"),...v("bottom")];for(let U of v(X))for(let it of v(J))for(let gt of rt)z(F,[_,{x:U,y:_.y},{x:U,y:gt},{x:it,y:gt},{x:it,y:q.y},q])},"addHorizontalPairCandidates"),Qt=e((F,_,X,q,J)=>{let rt=[...v("left"),...v("right")];for(let U of v(X))for(let it of v(J))for(let gt of rt)z(F,[_,{x:_.x,y:U},{x:gt,y:U},{x:gt,y:it},{x:q.x,y:it},q])},"addVerticalPairCandidates"),nt=e((F)=>{let _=new Set;return F.map((X)=>Ct(X)).filter((X)=>{let q=X.map((J)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}`).join("|");if(_.has(q)||X.length<2)return!1;return _.add(q),!0})},"dedupeCandidatePaths"),ht=e((F,_,X,q)=>{let J=[],rt=Ro(F,_,X,q,20,dt);if(rt)z(J,rt);if(_===q)ft(J,F,_,X);let U=Y(_),it=Y(q);if(U&&!it)St(J,F,_,X,q);else if(!U&&it)Zt(J,F,_,X,q);else if(U)Jt(J,F,_,X,q);else Qt(J,F,_,X,q);return nt(J)},"buildCandidatesForSides"),H=e((F,_,X,q)=>{let J=[...v("left"),...v("right")],rt=[...v("top"),...v("bottom")];for(let U of h){let it=De(q,U),gt=U==="top"||U==="bottom"?v(U):rt;for(let u of J){if(Y(U))z(F,[_,X,{x:u,y:X.y},{x:u,y:it.y},it]);for(let C of gt)z(F,[_,X,{x:u,y:X.y},{x:u,y:C},{x:it.x,y:C},it])}}},"addVerticalDepartureOuterTrackCandidates"),j=e((F,_,X,q)=>{let J=[...v("left"),...v("right")],rt=[...v("top"),...v("bottom")];for(let U of h){let it=De(q,U),gt=U==="left"||U==="right"?v(U):J;for(let u of rt){if(!Y(U))z(F,[_,X,{x:X.x,y:u},{x:it.x,y:u},it]);for(let C of gt)z(F,[_,X,{x:X.x,y:u},{x:C,y:u},{x:C,y:it.y},it])}}},"addHorizontalDepartureOuterTrackCandidates"),st=e((F)=>{let{start:_,end:X}=F,q=X?l.get(X):void 0;if(!_||!q)return[];let J=Ct(F.points??[]);if(J.length<4)return[];let rt=J[0],U=J[1],it=[];if(Ut(rt,U,dt))H(it,rt,U,q);else if($t(rt,U,dt))j(it,rt,U,q);return it},"terminalPreservingOuterTrackCandidates"),Q=e((F)=>{let{start:_,end:X}=F,q=_?l.get(_):void 0,J=X?l.get(X):void 0;if(!q||!J)return[];let rt=[];for(let U of h){let it=De(q,U);for(let gt of h)rt.push(...ht(it,U,De(J,gt),gt))}return rt.push(...st(F)),rt},"candidatePathsFor"),at=e(()=>new Map(f.map((F)=>[F,It(x(F))])),"currentSegmentsByEdge"),pt=e((F,_,X,q)=>{let J=new Set;for(let rt of f){if(rt===F)continue;let U=q.get(rt)??It(x(rt));if(X.some((it)=>U.some((gt)=>Se(it,gt,0.5)>=qt))||R(_,x(rt)))J.add(rt)}return J},"sharedTrackConflictsFor"),yt=e((F,_,X,q)=>{let J=new Set;return Q(F).map((U)=>be(Ct(U))).filter((U)=>{if(V(F,U))return!1;let it=U.map((gt)=>`${gt.x.toFixed(3)},${gt.y.toFixed(3)}`).join("|");if(J.has(it)||U.length<2)return!1;return J.add(it),!0}).map((U)=>{let it=It(U),gt=0;for(let u of f){if(u===F)continue;gt+=p(it,X.get(u)??It(x(u)))}return{candidate:U,candidateSegments:it,crossings:_.count-(q.get(F)??0)+gt,bends:he(U,dt),totalBends:he(U),length:A(U)}}).filter(({crossings:U})=>U<=_.count).sort((U,it)=>U.crossings-it.crossings||U.bends-it.bends||U.length-it.length).slice(0,48).map((U)=>({path:U.candidate,segments:U.candidateSegments,sharedTrackConflicts:pt(F,U.candidate,U.candidateSegments,X),totalBends:U.totalBends,length:U.length}))},"pairCandidatesFor"),xt=e((F,_,X,q,J,rt)=>{let U=0;for(let gt of F.pairs)if(gt.first===_||gt.second===_||gt.first===q||gt.second===q)U+=gt.count;let it=p(X.segments,J.segments);for(let gt of f){if(gt===_||gt===q)continue;let u=rt.get(gt)??It(x(gt));it+=p(X.segments,u)+p(J.segments,u)}return F.count-U+it},"pairCrossingCount"),vt=e((F,_)=>{for(let X of F.sharedTrackConflicts)if(X!==_)return!1;return!0},"conflictsOnlyWith"),Dt=e((F,_)=>F.segments.some((X)=>_.segments.some((q)=>Se(X,q,0.5)>=qt))||R(F.path,_.path),"candidatesShareTrack"),Be=e((F,_,X,q)=>vt(_,X.edge)&&vt(q,F.edge)&&!Dt(_,q),"pairCandidatesAreCompatible"),Le=e((F,_,X,q,J)=>{let rt=xt(F.current,_.edge,X,q.edge,J,F.baseSegments);if(rt>=F.current.count)return;return{replacements:new Map([[_.edge,X.path],[q.edge,J.path]]),crossings:rt,bends:F.currentBends-(F.baseBendsByEdge.get(_.edge)??0)-(F.baseBendsByEdge.get(q.edge)??0)+X.totalBends+J.totalBends,length:F.currentLength-(F.baseLengthByEdge.get(_.edge)??0)-(F.baseLengthByEdge.get(q.edge)??0)+X.length+J.length}},"scorePairReplacement"),we=e((F,_)=>F.crossings<_.crossings||F.crossings===_.crossings&&(F.bends<_.bends||F.bends===_.bends&&F.length<_.length),"pairScoreIsBetter"),Pe=e((F,_,X,q)=>{let J=q;for(let rt of _.candidates)for(let U of X.candidates){if(!Be(_,rt,X,U))continue;let it=Le(F,_,rt,X,U);if(it&&we(it,J))J=it}return J},"bestScoreForOptionPair"),Je=e((F)=>{let _=B(),X=k(),q=at(),J=w(F),rt=new Map(f.map((T)=>[T,he(x(T))])),U=new Map(f.map((T)=>[T,A(x(T))])),it=new Map,gt=M(F);for(let T of gt)for(let O of T){if(it.has(O))continue;let N=yt(O,F,q,J);if(N.length>0)it.set(O,{edge:O,candidates:N})}let u={replacements:new Map,crossings:F.count,bends:_,length:X},C={current:F,currentBends:_,currentLength:X,baseBendsByEdge:rt,baseLengthByEdge:U,baseSegments:q};for(let T of gt){let O=new Set(T.filter((D)=>F.edgeSet.has(D))),N=T.map((D)=>it.get(D)).filter((D)=>Boolean(D));for(let D=0;D<N.length;D++){let tt=N[D];for(let ut=D+1;ut<N.length;ut++){let Z=N[ut];if(!O.has(tt.edge)&&!O.has(Z.edge))continue;u=Pe(C,tt,Z,u)}}}return u.replacements.size>0?u.replacements:void 0},"bestPairedReplacement");for(let F=0;F<4;F++){let _=L(),X=_.count;if(X===0)return;let q,J,rt=X,U=Number.POSITIVE_INFINITY;for(let gt of _.edges){let u=he(x(gt),dt);for(let C of Q(gt)){let T=V(gt,C),O=!T&&P(gt,C),N=I(_,gt,C),D=he(C,dt);if(T||O)continue;if(!(N<X||N===X&&D<u))continue;if(N>rt||N===rt&&D>=U)continue;q=gt,J=C,rt=N,U=D}}if(q&&J){q.points=J;continue}let it=Je(_);if(!it)return;for(let[gt,u]of it)gt.points=u}}e(nr,"resolveRenderedOrthogonalCrossings");var Ne=0.001,ki=8;function or(t,o){let{nodeInfoById:s,realNodeRects:r}=wn(o),i=["top","bottom","left","right"],c=20,a={top:Math.min(...r.map((p)=>p.rect.top))-20,bottom:Math.max(...r.map((p)=>p.rect.bottom))+20,left:Math.min(...r.map((p)=>p.rect.left))-20,right:Math.max(...r.map((p)=>p.rect.right))+20},l=e((p,m,L,g)=>{let S=[],E=Ro(p,m,L,g,20,Ne);if(E)S.push(E);if(m===g)S.push(To(p,m,L,a[m]));return S},"buildOrthogonalPathCandidates"),d=e((p,m)=>{for(let L=0;L<p.length-1;L++){let g=p[L],S=p[L+1];if(Xt(g,S,r,m,1))return!0}return!1},"pathHitsNode"),h=e((p,m,L=!1)=>{let g=0,S=ge(p,Ne),{start:E,end:M}=m;for(let I of t){if(I===m||I.isLayoutOnly)continue;let{start:w,end:A}=I;if(!L&&E&&M&&(w===E||w===M||A===E||A===M))continue;let B=I.points;if(!B||B.length<2)continue;for(let k of S)for(let R of ge(B,Ne)){if(No(k.a,k.b,R.a,R.b,Ne,Ne)){g++;continue}if(Se(k,R,Ne)>=ki)g++}}return g},"pathConflictCount"),y=4,f=e((p,m)=>{let L=Math.abs(p.y-m.rect.top),g=Math.abs(p.y-m.rect.bottom),S=Math.abs(p.x-m.rect.left),E=Math.abs(p.x-m.rect.right),M="top",I=L;if(g<I)M="bottom",I=g;if(S<I)M="left",I=S;if(E<I)M="right",I=E;return M},"nearestSideOfRect"),b=new Map,v=e((p,m,L)=>{let g=b.get(p)??[];g.push({side:m,edgeId:L}),b.set(p,g)},"addFaceClaim");for(let p of t){if(p.isLayoutOnly)continue;let m=p.points??[];if(m.length<1)continue;let L=p.id??"",{start:g,end:S}=p;if(g){let E=s.get(g);if(E)v(g,f(m[0],E),L)}if(S){let E=s.get(S);if(E)v(S,f(m[m.length-1],E),L)}}let x=e((p,m,L)=>b.get(p)?.some((g)=>g.edgeId!==L&&g.side===m)??!1,"faceIsClaimed");for(let p of t){if(p.isLayoutOnly)continue;let m=p.points;if(!m||m.length<2)continue;let L=he(m,Ne);if(L<4)continue;let{start:g,end:S}=p;if(!g||!S)continue;let E=s.get(g),M=s.get(S);if(!E||!M)continue;let I=p.id??"",w=h(m,p,!0),A=h(m,p),B,k=w,R=L;for(let P of i){if(x(g,P,I))continue;let V=De(E,P);for(let z of i){if(x(S,z,I))continue;let Y=De(M,z);for(let et of l(V,P,Y,z)){if(d(et,[g,S]))continue;let ft=he(et,Ne);if(w>0){let St=h(et,p,!0);if(St>k||St===k&&ft>=R)continue;k=St,R=ft,B=et;continue}if(h(et,p)>A)continue;if(ft<R)R=ft,B=et}}}if(B){p.points=B;let P=b.get(g);if(P)b.set(g,P.filter((z)=>z.edgeId!==I));let V=b.get(S);if(V)b.set(S,V.filter((z)=>z.edgeId!==I));v(g,f(B[0],E),I),v(S,f(B[B.length-1],M),I)}}}e(or,"simplifyDetouredEdges");var fe=0.001,ns=10,cn=7;function co(t,o){let s=o?0:t.length-1,r=o?1:-1,i=t[s],c=t[s+r];if(!i||!c)return;let a=c.x-i.x,l=c.y-i.y;if(Math.abs(a)+Math.abs(l)<fe)return;if(Math.abs(l)<=fe){let h=i.x+Math.sign(a)*ns;return{left:Math.min(i.x,h),right:Math.max(i.x,h),top:i.y-cn,bottom:i.y+cn}}if(Math.abs(a)<=fe){let h=i.y+Math.sign(l)*ns;return{left:i.x-cn,right:i.x+cn,top:Math.min(i.y,h),bottom:Math.max(i.y,h)}}return{left:Math.min(i.x,c.x),right:Math.max(i.x,c.x),top:Math.min(i.y,c.y),bottom:Math.max(i.y,c.y)}}e(co,"markerClearanceRectFor");function sr(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}e(sr,"normalizeRect");function ao(t,o){let s=Ct(o),r=co(s,!0),i=co(s,!1);return[r,i].some((c)=>c&&hn(t,sr(c)))}e(ao,"labelOverlapsOwnMarker");function je(t,o){let s=[];for(let p of t){if(p.isLayoutOnly)continue;let m=p.points;if(!m||m.length<2)continue;for(let L=0;L<m.length-1;L++)s.push({edgeId:p.id,p1:m[L],p2:m[L+1]})}let r=[],i=[],c=Ie([...o.values()]);for(let p of o.values()){let m=p.isGroup;if(c.isLane(p.id)){let g=se(p);if(g)i.push({id:p.id,rect:g});continue}if(m)continue;if(p.isEdgeLabel)continue;let L=se(p);if(!L)continue;r.push({nodeId:p.id,rect:L})}let a=3,l=1,d=12,h=e((p,m)=>{let L=$n(m,a);for(let{nodeId:g,rect:S}of r){if(g===p)continue;if(hn(L,S))return!0}return!1},"labelOverlapsForeignNode"),y=e((p,m)=>{let L=$n(m,a);for(let g of s){if(g.edgeId===p)continue;if(Ln(g.p1,g.p2,L))return!0}return!1},"labelOverlapsForeignEdge"),f=e((p,m,L)=>h(p,L)||y(m,L),"labelOverlapsAnything"),b=[],v=e((p)=>{for(let{id:m,rect:L}of i)if(Rs(L,p))return m;return},"findContainingLane"),x=e((p,m)=>b.some((L)=>L.labelId!==p&&hn(m,L.rect)),"overlapsPlacedLabel");for(let p of t){if(p.isLayoutOnly)continue;let m=p.labelNodeId;if(!m)continue;let L=o.get(m);if(!L)continue;let g=p.points;if(!g||g.length<2)continue;let S=L.width??0,E=L.height??0;if(S<=0||E<=0)continue;let M=[];for(let nt=0;nt<g.length-1;nt++){let ht=g[nt],H=g[nt+1],j=Math.abs(ht.x-H.x),st=Math.abs(ht.y-H.y);if(j<fe&&st<fe)continue;if(j>=fe&&st>=fe)continue;M.push({idx:nt,length:j+st,orientation:j>=fe?"horizontal":"vertical",midX:(ht.x+H.x)/2,midY:(ht.y+H.y)/2})}if(M.length===0)continue;let I=M.length>=3?M.filter((nt)=>nt.idx>0&&nt.idx<M.length-1):M,w=I.length>0?I:M,A=S>=E?"horizontal":"vertical",B=e((nt)=>[...nt].sort((ht,H)=>{let j=ht.orientation===A,st=H.orientation===A;if(j!==st)return j?-1:1;let Q=ht.length>=(ht.orientation==="horizontal"?S:E)+2,at=H.length>=(H.orientation==="horizontal"?S:E)+2;if(Q!==at)return Q?-1:1;return H.length-ht.length}),"rankSegments"),k=M[0],R=M[M.length-1],P=[0.5,0.25,0.75,0.05,0.95,0.15,0.85,0.1,0.9],V=e((nt,ht)=>{let H=g[nt.idx],j=g[nt.idx+1];return{midX:H.x+(j.x-H.x)*ht,midY:H.y+(j.y-H.y)*ht}},"anchorAtT"),z=e((nt,ht,H)=>Math.min(H,Math.max(ht,nt)),"clamp"),Y=e((nt,ht)=>nt.midX>=ht.left-fe&&nt.midX<=ht.right+fe&&nt.midY>=ht.top-fe&&nt.midY<=ht.bottom+fe,"pointInsideRectInclusive"),et=e((nt)=>{let ht=$e(nt.midX,nt.midY,S,E),H=v(ht);if(H)return{laneId:H,anchor:nt,rect:ht};let j=i.find(({rect:vt})=>Y(nt,vt));if(!j)return;let st=j.rect.left+S/2+l,Q=j.rect.right-S/2-l,at=j.rect.top+E/2+l,pt=j.rect.bottom-E/2-l;if(st>Q||at>pt)return;let yt={midX:z(nt.midX,st,Q),midY:z(nt.midY,at,pt)},xt=$e(yt.midX,yt.midY,S,E);return Y(nt,xt)?{laneId:j.id,anchor:yt,rect:xt}:void 0},"placementForAnchor"),ft=e((nt,ht,H)=>nt.orientation==="horizontal"?Math.abs(ht.midX-H.x):Math.abs(ht.midY-H.y),"distanceAlongSegment"),St=e((nt,ht)=>{let j=(nt.orientation==="horizontal"?S/2:E/2)+d;if(nt===k){let st=g[nt.idx];if(ft(nt,ht,st)+fe<j)return!1}if(nt===R){let st=g[nt.idx+1];if(ft(nt,ht,st)+fe<j)return!1}return!0},"labelClearsTerminalEndpoints"),Zt=e((nt)=>{let ht=B(nt);for(let H of ht)for(let j of P){let st=V(H,j);if(!St(H,st))continue;let Q=et(st);if(!Q)continue;if(ao(Q.rect,g))continue;if(x(m,Q.rect))continue;if(!f(m,p.id,Q.rect))return{laneId:Q.laneId,anchor:Q.anchor}}return},"tryPool"),Jt=e((nt,ht,H=!1)=>{let j=B(nt);for(let st of j){let Q={midX:st.midX,midY:st.midY};if(ht&&!St(st,Q))continue;let at=et(Q);if(at&&!ao(at.rect,g)&&!x(m,at.rect)&&!h(m,at.rect)&&(H||!y(p.id,at.rect)))return{laneId:at.laneId,anchor:at.anchor}}return},"findLaneContainingFallback"),Qt=Zt(w)??(w.length<M.length?Zt(M):void 0)??Jt(M,!0)??Jt(M,!1)??Jt(M,!1,!0);if(Qt){L.x=Qt.anchor.midX,L.y=Qt.anchor.midY,L.parentId=Qt.laneId;let nt=$e(Qt.anchor.midX,Qt.anchor.midY,S,E),ht=b.findIndex((H)=>H.labelId===m);if(ht>=0)b[ht]={labelId:m,rect:nt};else b.push({labelId:m,rect:nt})}}}e(je,"anchorLabelsToPolyline");var Xn=0.000001,_i=8,os=_i/2,Hi=3;function lo(t,o,s,{cx:r,cy:i},c,a){let l={x:r,y:i},d=a==="x"?"y":"x",h=Math.sign(c[d]-l[d]);for(let y of t){if(y===o||y.isLayoutOnly||!y.points?.length)continue;if([...y.end===s?[y.points.at(-1)]:[],...y.start===s?[y.points[0]]:[]].some((b)=>Math.sign(b[d]-l[d])===h&&Math.abs(b[a]-c[a])<Ho.MIN_ARROWHEAD_SPACING))return!0}return!1}e(lo,"crowdsFaceNeighbour");function fo(t,o){return t<o?`${t}::${o}`:`${o}::${t}`}e(fo,"pairKey");function rr(t,o){let{nodeInfoById:s,realNodeRects:r}=wn(o),i=new Map;for(let a of o){let l=a.id;if(a.isGroup)continue;if(a.isEdgeLabel){i.set(l,{w:a.width??0,h:a.height??0});continue}}let c=e((a,l,d,h)=>{let y=fo(l,d),f=0,b=e((v)=>{if(!v)return;let x=i.get(v);if(!x)return;let p=h==="x"?x.w/2:x.h/2;if(p>f)f=p},"consider");b(a.labelNodeId);for(let v of t){if(v===a)continue;if(v.isLayoutOnly)continue;let{start:x,end:p}=v;if(!x||!p)continue;if(fo(x,p)!==y)continue;b(v.labelNodeId)}return f>0?f+Hi:0},"labelClearanceFor");for(let a of t){if(a.isLayoutOnly)continue;let l=a.points;if(!Eo(l,Xn))continue;let d=Oo(a,s,Xn);if(!d)continue;let{srcId:h,dstId:y,srcInfo:f,dstInfo:b,collinearX:v,collinearY:x}=d;if(v===x)continue;let p,m;if(v){let I=b.cy>f.cy;p={x:f.cx,y:I?f.rect.bottom:f.rect.top},m={x:b.cx,y:I?b.rect.top:b.rect.bottom}}else{let I=b.cx>f.cx;p={x:I?f.rect.right:f.rect.left,y:f.cy},m={x:I?b.rect.left:b.rect.right,y:b.cy}}if(Xt(p,m,r,[h,y],1))continue;let L=v?"x":"y",g=c(a,h,y,L),S=g>os?g:os,E=[0,S,-S],M;for(let I of E){let w={...p},A={...m};if(v){if(w.x+=I,A.x+=I,w.x<=f.rect.left||w.x>=f.rect.right)continue;if(A.x<=b.rect.left||A.x>=b.rect.right)continue}else{if(w.y+=I,A.y+=I,w.y<=f.rect.top||w.y>=f.rect.bottom)continue;if(A.y<=b.rect.top||A.y>=b.rect.bottom)continue}if(Xt(w,A,r,[h,y],1))continue;if(gn(w,A,t,a,{epsilon:Xn}))continue;let B=[w,A];if(lo(t,a,h,f,w,L)||lo(t,a,y,b,A,L)){M??=B;continue}a.points=B,M=void 0;break}if(M)a.points=M}}e(rr,"straightenCollinearSiblingDetours");function uo(t,o){let{realNodeRects:h,labelNodeRects:y}=ve(o.values()),f=e((I,w)=>ge(w,0.001).map((A)=>({...A,edge:I,interior:A.index>=1&&A.index<=w.length-3})),"segmentsFor"),b=e(()=>{let I=[];for(let w of t){if(w.isLayoutOnly)continue;let A=w.points;if(!A||A.length<2)continue;I.push(...f(w,Ct(A)))}return I},"allSegments"),v=e((I,w)=>{if(I.horizontal&&w.horizontal)return ce(I.a.x,I.b.x,w.a.x,w.b.x)>=8&&Math.abs(I.a.y-w.a.y)<7;if(I.vertical&&w.vertical)return ce(I.a.y,I.b.y,w.a.y,w.b.y)>=8&&Math.abs(I.a.x-w.a.x)<7;return!1},"hasCrowdedParallelTrack"),x=e((I,w)=>{let{start:A,end:B}=I,k=f(I,w);if(k.length!==w.length-1)return!1;let R=[A,B].filter((V)=>Boolean(V)),P=I.labelNodeId?[I.labelNodeId]:[];for(let V of k){if(Xt(V.a,V.b,h,R,-2))return!1;if(Xt(V.a,V.b,y,P,-2))return!1}for(let V of t){if(V===I||V.isLayoutOnly)continue;let z=V.points;if(!z||z.length<2)continue;for(let Y of k)for(let et of f(V,Ct(z))){if(v(Y,et))return!1;if(Ce(Y.a,Y.b,et.a,et.b,0.001))return!1}}return!0},"candidateIsSafe"),p=e((I,w)=>{let A=Ct(I.edge.points??[]);if(A.length<4||I.index>=A.length-1)return;let B=A.map((k)=>({...k}));if(I.horizontal)B[I.index].y+=w,B[I.index+1].y+=w;else if(I.vertical)B[I.index].x+=w,B[I.index+1].x+=w;else return;return f(I.edge,B).length===B.length-1?B:void 0},"shiftedCandidate"),m=e((I,w)=>({x:I.x??(w.left+w.right)/2,y:I.y??(w.top+w.bottom)/2}),"nodeCenter"),L=e((I)=>{let w=I.edge,A=Ct(w.points??[]);if(A.length!==4||I.index!==1)return;let B=w.start?o.get(w.start):void 0,k=w.end?o.get(w.end):void 0,R=B?se(B):void 0,P=k?se(k):void 0,V=A.slice(I.index+2);if(!B||!k||!R||!P||V.length===0)return;return{sourceCenter:m(B,R),targetCenter:m(k,P),sourceRect:R,tail:V}},"sourceDetourContextFor"),g=e((I,w,A,B,k,R)=>{let P=B.y>=A.y,V=P?k.bottom:k.top,z=V+(P?20:-20);if(P&&I.b.y<=z+0.001||!P&&I.b.y>=z-0.001)return;let Y=I.a.x+w;return Ct([{x:A.x,y:V},{x:A.x,y:z},{x:Y,y:z},{x:Y,y:I.b.y},...R],0.001)},"verticalSourceDetour"),S=e((I,w,A,B,k,R)=>{let P=B.x>=A.x,V=P?k.right:k.left,z=V+(P?20:-20);if(P&&I.b.x<=z+0.001||!P&&I.b.x>=z-0.001)return;let Y=I.a.y+w;return Ct([{x:V,y:A.y},{x:z,y:A.y},{x:z,y:Y},{x:I.b.x,y:Y},...R],0.001)},"horizontalSourceDetour"),E=e((I,w)=>{let A=L(I);if(!A)return;if(I.vertical)return g(I,w,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(I.horizontal)return S(I,w,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);return},"sourceDetourCandidate"),M=[-7,7,-14,14,-21,21];for(let I=0;I<12;I++){let w=b(),A=!1;for(let B=0;B<w.length&&!A;B++)for(let k=B+1;k<w.length&&!A;k++){let R=w[B],P=w[k];if(R.edge===P.edge||!v(R,P))continue;let V=[R,P].filter((z)=>z.interior);for(let z of V){for(let Y of M){let et=p(z,Y);if(et&&x(z.edge,et)){z.edge.points=et,A=!0;break}let ft=E(z,Y);if(ft&&x(z.edge,ft)){z.edge.points=ft,A=!0;break}}if(A)break}}if(!A)return}}e(uo,"nudgeSharedInteriorSubpaths");var Gt=0.001,ss=2,En=e((t)=>t==="top"||t==="bottom"?"x":"y","runsAlongFace");function ir(t,o,s){let r=En(s),[i,c]=r==="x"?[o.left,o.right]:[o.top,o.bottom];return{top:o.top-t.y,bottom:t.y-o.bottom,left:o.left-t.x,right:t.x-o.right}[s]>-Gt&&t[r]>=i-Gt&&t[r]<=c+Gt}e(ir,"endpointThroughFace");function Sn(t,o,s){let r=t.node.id;return s.every((i)=>{if(i===o||i.isLayoutOnly)return!0;let c=i.points??[];return[[i.start,c.at(0)],[i.end,c.at(-1)]].every(([l,d])=>l!==r||!d||!ir(d,t.rect,t.side))})}e(Sn,"faceIsOwn");function ho(t,o){let s=ge(o,Gt);return ge(t,Gt).reduce((r,i)=>r+s.filter((c)=>Ce(i.a,i.b,c.a,c.b,Gt)).length,0)}e(ho,"strictCrossings");function cr(t,o){let s=ge(o,Gt);return ge(t,Gt).some((r)=>s.some((i)=>Fo(r.a,r.b,i.a,i.b,Gt)))}e(cr,"overlapsAny");function Do(t,o,s,r){let i=Ho.ROUTE_TOUCH_TOLERANCE;return r.every((c)=>{let a=Ct(c.points??[],Gt);if(c===t||c.isLayoutOnly||a.length<2)return!0;return!cr(s,a)&&ho(s,a)<=ho(o,a)&&(!un(s,a,i)||un(o,a,i))})}e(Do,"clearOfOtherEdges");function Xo(t,o,s){let r=t.labelNodeId,i=[t.start,t.end].filter((a)=>Boolean(a)),c=ge(o,Gt);return c.every((a)=>{let d=a.index===0||a.index===c.length-1?i:[];return!Xt(a.a,a.b,s.realNodeRects,d,ss)&&!Xt(a.a,a.b,s.labelNodeRects,r?[r]:[],ss)})}e(Xo,"clearOfNodes");var rs=1;function go(t){let o=t&&!t.isGroup?se(t):void 0;return t&&o?{node:t,rect:o,cx:t.x??0,cy:t.y??0}:void 0}e(go,"placed");function ar(t,o){let s=o.rect.top>t.rect.bottom;if(!s&&o.rect.bottom>=t.rect.top)return;let[r,i]=s?["bottom","top"]:["top","bottom"];return{from:{node:t.node,rect:t.rect,side:r},to:{node:o.node,rect:o.rect,side:i},points:[{x:t.cx,y:s?t.rect.bottom:t.rect.top},{x:t.cx,y:s?o.rect.top:o.rect.bottom}]}}e(ar,"verticalLine");function lr(t,o){let s=o.rect.left>t.rect.right;if(!s&&o.rect.right>=t.rect.left)return;let[r,i]=s?["right","left"]:["left","right"];return{from:{node:t.node,rect:t.rect,side:r},to:{node:o.node,rect:o.rect,side:i},points:[{x:s?t.rect.right:t.rect.left,y:t.cy},{x:s?o.rect.left:o.rect.right,y:t.cy}]}}e(lr,"horizontalLine");function fr(t,o){let s=go(o.get(t.start??"")),r=go(o.get(t.end??""));if(!s||!r||s.node===r.node)return;return s.node.parentId===r.node.parentId?void 0:[s,r]}e(fr,"crossGroupPair");function dr(t,o){let s=fr(t,o);if(!s)return;let[r,i]=s;if(Math.abs(r.cx-i.cx)<=rs)return ar(r,i);return Math.abs(r.cy-i.cy)<=rs?lr(r,i):void 0}e(dr,"straightLineFor");var Di=e((t,o)=>t.length===o.length&&t.every((s,r)=>Math.abs(s.x-o[r].x)<Gt&&Math.abs(s.y-o[r].y)<Gt),"isAlready");function ur(t,o,s,r,i){return Sn(o.from,t,r)&&Sn(o.to,t,r)&&Xo(t,o.points,i)&&Do(t,s,o.points,r)}e(ur,"lineIsClear");function hr(t,o,s,r){let i=dr(t,s),c=Ct(t.points??[],Gt);if(!i||c.length<2||Di(c,i.points))return!1;if(!ur(t,i,c,o,r))return!1;return t.points=i.points,!0}e(hr,"straighten");function gr(t,o){let s=ve(o.values()),r=!1;for(let i of t)if(!i.isLayoutOnly&&hr(i,t,o,s))r=!0;return r}e(gr,"straightenAlignedCrossLaneEdges");var Xi=new Set(["question","diamond","diam","decision"]),Gi=e((t)=>Xi.has(t.shape??""),"isDiamond"),qe=e((t,o)=>Math.abs(t-o)<Gt,"near"),pr=e((t,o,s)=>t>=o-Gt&&t<=s+Gt,"within");function mr(t,o,s){if(!wt(t,o,Gt)||!pr(t.x,s.left,s.right))return;if(qe(t.y,s.bottom)&&o.y>t.y)return"bottom";return qe(t.y,s.top)&&o.y<t.y?"top":void 0}e(mr,"verticalLegFace");function yr(t,o,s){if(!At(t,o,Gt)||!pr(t.y,s.top,s.bottom))return;if(qe(t.x,s.right)&&o.x>t.x)return"right";return qe(t.x,s.left)&&o.x<t.x?"left":void 0}e(yr,"horizontalLegFace");var Yi=e((t,o,s)=>mr(t,o,s)??yr(t,o,s),"faceOfLeg");function xr(t,o,s,r){let i=Yi(r[0],r[1],s);if(!i)return;let c=En(i);return qe(r[1][c],r[2][c])?void 0:{edge:t,node:o,rect:s,side:i,route:r}}e(xr,"terminalFrom");var zi=e((t,o)=>(o?t.start:t.end)??"","endpointId");function br(t,o,s){let r=Ct(t.points??[],Gt),i=s.get(zi(t,o)),c=i?se(i):void 0;if(!i||!c||r.length<3)return;return xr(t,i,c,o?r:r.reverse())}e(br,"terminalAt");function Ir({node:t,rect:o,side:s,route:r}){let i=En(s),c=(i==="x"?t.x:t.y)??0,a=r[0][i];if(Math.abs(a-c)<Gt)return;if(Gi(t))return c;let[l,d]=i==="x"?[o.left,o.right]:[o.top,o.bottom];return Math.min(a-l,d-a)<=Vn+Gt?c:void 0}e(Ir,"alignedCoord");function Mr(t,o,s,r){let i=Ir(t);if(i===void 0||!Sn(t,t.edge,o))return!1;let c=En(t.side),[a,l,...d]=t.route,h=be(Ct([{...a,[c]:i},{...l,[c]:i},...d],Gt)),y=r?t.route:[...t.route].reverse(),f=r?h:[...h].reverse();if(!Xo(t.edge,f,s)||!Do(t.edge,y,f,o))return!1;return t.edge.points=f,!0}e(Mr,"alignTerminal");function Sr(t,o){let s=ve(o.values()),r=!1;for(let i of t){if(i.isLayoutOnly)continue;for(let c of[!0,!1]){let a=br(i,c,o);if(a&&Mr(a,t,s,c))r=!0}}return r}e(Sr,"alignTerminalLegsToPorts");function vr(t,o,s,r){let i=o.x-t.x,c=o.y-t.y,a=r.x-s.x,l=r.y-s.y,d=i*l-c*a;if(Math.abs(d)<0.0000000001)return!1;let h=s.x-t.x,y=s.y-t.y,f=(h*l-y*a)/d,b=(h*c-y*i)/d,v=0.01;return f>v&&f<1-v&&b>v&&b<1-v}e(vr,"segmentsIntersect");function Cr(t){let o=t.nodes??[],s=t.edges??[],r=[];if(!s.length||!o.length)return r;let i=Ts(o),c=1,a=[];for(let d of s){if(d.isLayoutOnly)continue;let h=d.points;if(!h||h.length<2)continue;let{start:y,end:f,labelNodeId:b}=d,v=d.id??`${y}->${f}`;for(let x of i){if(x.nodeId===y||x.nodeId===f)continue;if(b&&x.nodeId===b)continue;for(let p=0;p<h.length-1;p++)if(Ln(h[p],h[p+1],x,-c)){r.push({type:"edge-node-overlap",edgeId:v,targetId:x.nodeId,detail:`segment ${p} passes through node "${x.nodeId}"`});break}}for(let x=0;x<h.length-1;x++)a.push({edgeId:v,start:y,end:f,p1:h[x],p2:h[x+1]})}let l=new Set;for(let d=0;d<a.length;d++)for(let h=d+1;h<a.length;h++){let y=a[d],f=a[h];if(y.edgeId===f.edgeId)continue;if(y.start===f.start||y.start===f.end||y.end===f.start||y.end===f.end)continue;if(vr(y.p1,y.p2,f.p1,f.p2)){let b=y.edgeId<f.edgeId?`${y.edgeId}|${f.edgeId}`:`${f.edgeId}|${y.edgeId}`;if(!l.has(b))l.add(b),r.push({type:"edge-edge-crossing",edgeId:y.edgeId,targetId:f.edgeId,detail:`edges "${y.edgeId}" and "${f.edgeId}" cross`})}}if(r.length>0){let d=r.filter((y)=>y.type==="edge-node-overlap").length,h=r.filter((y)=>y.type==="edge-edge-crossing").length;n.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${d} edge-node overlap(s), ${h} edge crossing(s)`);for(let y of r)n.warn(`[SWIMLANE_VALIDATE] ${y.type}: ${y.detail}`)}return r}e(Cr,"validateSwimlanesLayout");function Lr(t,o){let s=gr(t,o);if(Sr(t,o)||s)je(t,o),bn(t,o)}e(Lr,"alignTerminalLegsAndRefresh");function wr(t,o){let s=t.nodes??[],r=t.edges??[],i=s.filter((l)=>!l.isGroup);if((o==="LR"||o==="RL")&&i.length>0&&!Ws(t,o))return;if(o==="BT"&&i.length>0&&!zs(t))return;for(let l of r){if(l.isLayoutOnly)continue;let d=l.points;if(!d||d.length<2)continue;l.points=be(pn(d))}or(r,s),rr(r,s),Ks(r,s);let c=new Map;for(let l of s)c.set(String(l.id),l);je(r,c),Bs(r,c),qs(r,c),uo(r,c),oo(r,c),Js(r,c),so(r,c),Qs(r,c);let a=e(()=>{nr(r,c),oo(r,c),tr(r,c),er(r,c),je(r,c),bn(r,c),so(r,c),je(r,c),bn(r,c)},"finalizeRenderedEdges");a(),uo(r,c),a(),Lr(r,c),ro(r,c,o),io(r,c,o),ro(r,c,o),io(r,c,o)}e(wr,"postProcessSwimlaneLayout");function Fe(t){let o=new Map(t.nodeById),s=new Set,r=[];for(let c of t.edges){if(!o.has(c.src)||!o.has(c.dst))continue;let a=`${c.id}:${c.src}->${c.dst}`;if(s.has(a))continue;s.add(a),r.push(c)}return{nodes:[...o.keys()],edges:r,layout:t.layout,nodeById:o}}e(Fe,"normalizeGraph");function Go(t,o){return t.edges.filter((s)=>s.dst===o)}e(Go,"incoming");function Er(t){let o=new Map;for(let s of t.nodes)o.set(s,[]);for(let s of t.edges)o.get(s.src).push(s.dst);return o}e(Er,"buildSuccessorMap");function Yo(t){let o=Er(t);for(let s of o.values())s.sort((r,i)=>r.localeCompare(i));return o}e(Yo,"buildSortedSuccessorMap");function An(t){let o=new Map;for(let s of t.nodes)o.set(s,0);for(let s of t.edges)o.set(s.dst,(o.get(s.dst)??0)+1);return o}e(An,"buildInDegreeMap");function zo(t,o){let s=[...o.entries()].filter(([,l])=>l===0).map(([l])=>l).sort((l,d)=>l.localeCompare(d)),r=new Set(t.edges.flatMap((l)=>[l.src,l.dst])),i=e((l)=>!r.has(l)&&!t.nodeById.get(l)?.isGroup,"isUnconnected"),c=[...o.keys()].filter((l)=>o.get(l)===0&&i(l)),a=0;return s.map((l)=>i(l)?c[a++]:l)}e(zo,"sortedZeroInDegreeNodes");function Rn(t,o=()=>!0){let s=new Map,r=new Map;for(let i of t.nodes)s.set(i,[]),r.set(i,[]);for(let i of t.edges){if(!o(i))continue;r.get(i.src).push(i.dst),s.get(i.dst).push(i.src)}return{preds:s,succs:r}}e(Rn,"buildPredecessorSuccessorMaps");function $o(t,o,s,r){let i=0;for(let a of t.nodes){if(r?.skipGroups&&t.nodeById.get(a)?.isGroup)continue;i=Math.max(i,s[a]??0)}let c=Array.from({length:i+1},()=>[]);for(let a of o){if(r?.skipGroups&&t.nodeById.get(a)?.isGroup)continue;c[Math.max(0,s[a]??0)].push(a)}return c}e($o,"buildLayersFromRanks");function Ze(t){let o=An(t),s=zo(t,o),r=[],i=Yo(t);while(s.length){let c=s.shift();r.push(c);for(let a of i.get(c)??[])if(o.set(a,(o.get(a)??0)-1),(o.get(a)??0)===0){let l=0;while(l<s.length&&s[l]<a)l++;s.splice(l,0,a)}}return r.length===t.nodes.length?r:null}e(Ze,"topoSortIfAcyclic");function Ue(t){let o=new Map,s=0;for(let r of t)o.set(r,s),s++;return o}e(Ue,"buildLayerIndex");function Uo(t){let o=Array(t.length),s=e((r,i)=>{if(i-r<=1)return 0;let c=r+i>>1,a=s(r,c)+s(c,i),l=r,d=c,h=r;while(l<c||d<i)if(d>=i||l<c&&t[l]<=t[d])o[h++]=t[l++];else o[h++]=t[d++],a+=c-l;for(let y=r;y<i;y++)t[y]=o[y];return a},"count");return s(0,t.length)}e(Uo,"countInversions");function Ar(t){let o=Fe(t),s=new Map;for(let f of o.nodes)s.set(f,[]);for(let f of o.edges)s.get(f.src).push(f);for(let f of s.values())f.sort((b,v)=>b.dst===v.dst?b.id.localeCompare(v.id):b.dst.localeCompare(v.dst));let r=Object.create(null);for(let f of o.nodes)r[f]=0;let i=[],c=e((f)=>{r[f]=1;for(let b of s.get(f)??[]){let v=b.dst;if(r[v]===0)c(v);else if(r[v]===1)i.push(b)}r[f]=2},"dfs"),a=An(o),l=[...o.nodes.filter((f)=>(a.get(f)??0)===0),...o.nodes.filter((f)=>(a.get(f)??0)!==0)];for(let f of l)if(r[f]===0)c(f);let d=new Set(i.map((f)=>`${f.id}:${f.src}->${f.dst}`)),h=o.edges.map((f)=>d.has(`${f.id}:${f.src}->${f.dst}`)?{id:f.id,src:f.dst,dst:f.src,weight:f.weight,ref:f.ref}:f);return{acyclic:{nodes:[...o.nodes],edges:h,layout:o.layout,nodeById:new Map(o.nodeById)},reversed:i}}e(Ar,"removeCycles_DFS");function Rr(t){let o=Ie(t.layout.nodes??[]),s=new Map;for(let r of t.nodes)s.set(r,o.laneIdOf(r));return s}e(Rr,"buildTopLaneMap");function Ee(t){let o=Rr(t);return(s)=>o.get(s)??null}e(Ee,"createTopLaneResolver");function Tn(t){let o=t.layout.nodes??[],s=Ie(o),r=o.filter((a)=>s.isLane(a.id)),i=r.filter((a)=>ln(a)!==void 0);if(i.length>0&&i.length===r.length)return[...i].sort((a,l)=>(ln(a)??0)-(ln(l)??0)).map((a)=>a.id);if(!s.hasPools)return[...new Set(r.map((a)=>a.id))].reverse();let c=[];for(let a of o){if(a.parentId)continue;if(s.isPool(a.id))c.push(...s.lanesByPool.get(a.id)??[]);else if(s.isLane(a.id))c.push(a.id)}return[...new Set(c)].reverse()}e(Tn,"buildTopLaneOrder");function Vo(t,o){let s=Tn(t);if(!o||o.length===0)return s;let r=new Set(s),i=new Set,c=[];for(let a of o){if(!r.has(a)||i.has(a))continue;i.add(a),c.push(a)}for(let a of s){if(i.has(a))continue;c.push(a)}return c}e(Vo,"resolveTopLaneOrder");function Tr(t,o){let s=Fe(t),r=o?.laneOf??(()=>null),i=o?.rankHint,{preds:c}=Rn(s);for(let M of c.values())M.sort((I,w)=>I.localeCompare(w));let a=Ze(s)??[...s.nodes].sort((M,I)=>M.localeCompare(I)),l=new Map;for(let[M,I]of a.entries())l.set(I,M);let d=new Map,h=new Map;for(let M of s.nodes)h.set(M,[]);for(let M of a){let I=(c.get(M)??[]).filter((w)=>d.has(w));if(I.length>0){let w=Or(M,I,{laneOf:r,rankHint:i,topoIndex:l});d.set(M,w),h.get(w).push(M)}else if(!d.has(M))d.set(M,null)}for(let M of s.nodes)if(!d.has(M))d.set(M,null);let y=new Set;for(let M of s.nodes)if((d.get(M)??null)===null)y.add(M);let f=[...y].sort((M,I)=>{let w=l.get(M)??0,A=l.get(I)??0;if(w===A)return M.localeCompare(I);return w-A}),b=Nr(s),v=new Map;for(let[M,I]of b.entries())v.set(M,[...I].sort((w,A)=>w.localeCompare(A)));let x=Fr(v),p=Br(v),m=new Map;for(let M of s.nodes)m.set(M,[]);for(let M of p)for(let I of M.nodes){let w=m.get(I);if(w)w.push(M.id);else m.set(I,[M.id])}let L=[],g=[],S=new Set,E=e((M)=>{if(S.has(M))return;S.add(M),L.push(M);for(let I of h.get(M)??[])E(I);g.push(M)},"walk");for(let M of f)E(M);for(let M of a)E(M);return{parent:d,children:h,roots:f,componentOf:x,blocks:p,nodeBlocks:m,adjacency:v,preorder:L,postorder:g,topologicalOrder:a}}e(Tr,"buildDrivingTree");function Or(t,o,s){let r=s.laneOf(t);return[...o].sort((c,a)=>{let l=s.laneOf(c),d=s.laneOf(a),h=l!=null&&l===r,y=d!=null&&d===r;if(h!==y)return h?-1:1;let f=s.rankHint?.[c],b=s.rankHint?.[a];if(f!=null&&b!=null&&f!==b)return b-f;let v=s.topoIndex.get(c)??0,x=s.topoIndex.get(a)??0;if(v!==x)return v-x;return c.localeCompare(a)})[0]}e(Or,"chooseParent");function Nr(t){let o=new Map;for(let s of t.nodes)o.set(s,new Set);for(let s of t.edges)o.get(s.src).add(s.dst),o.get(s.dst).add(s.src);return o}e(Nr,"buildAdjacency");function Fr(t){let o=new Map,s=0;for(let r of t.keys()){if(o.has(r))continue;let i=[r];while(i.length>0){let c=i.pop();if(o.has(c))continue;o.set(c,s);for(let a of t.get(c)??[])if(!o.has(a))i.push(a)}s++}return o}e(Fr,"assignComponents");function Br(t){let o=new Map,s=new Map,r=[],i=[],c=0,a=e((l,d)=>{o.set(l,++c),s.set(l,c);for(let h of t.get(l)??[]){if(h===d)continue;if(!o.has(h)){if(r.push([l,h]),a(h,l),s.set(l,Math.min(s.get(l)??c,s.get(h)??c)),(s.get(h)??0)>=(o.get(l)??0))i.push(Pr(l,h,r,i.length))}else if((o.get(h)??0)<(o.get(l)??0))r.push([l,h]),s.set(l,Math.min(s.get(l)??c,o.get(h)??c))}},"visit");for(let l of t.keys())if(!o.has(l))a(l,null);return i}e(Br,"computeBlocks");function Pr(t,o,s,r){let i=[],c=new Set;while(s.length>0){let a=s.pop();if(i.push(a),c.add(a[0]),c.add(a[1]),a[0]===t&&a[1]===o||a[0]===o&&a[1]===t)break}return{id:r,edges:i,nodes:[...c]}}e(Pr,"popBlock");function kr(t,o,s){let r=[...t.nodes],i=new Map;for(let[g,S]of r.entries())i.set(S,g);let c=r.length,a=Array(c).fill(-1),l=Array(c).fill(0),d=[],h=new Set;for(let g of r){let S=s.parent.get(g)??null,E=i.get(g);if(E==null)continue;if(S==null){if(a[E]=-1,l[E]=0,!h.has(g))h.add(g),d.push(g)}}while(d.length>0){let g=d.shift(),S=i.get(g);if(S==null)continue;let E=s.children.get(g)??[];for(let M of E){if(h.has(M))continue;let I=i.get(M);if(I==null)continue;a[I]=S,l[I]=l[S]+1,h.add(M),d.push(M)}}for(let g of r){if(h.has(g))continue;let S=i.get(g);if(S==null)continue;a[S]=-1,l[S]=0,h.add(g)}let y=Math.max(1,Math.ceil(Math.log2(Math.max(1,c)))+1),f=Array.from({length:y},()=>Array(c).fill(-1));for(let g=0;g<c;g++)f[0][g]=a[g];for(let g=1;g<y;g++)for(let S=0;S<c;S++){let E=f[g-1][S];f[g][S]=E===-1?-1:f[g-1][E]}let b=e((g,S)=>{if(g===-1||S===-1)return-1;if(l[g]<l[S])[g,S]=[S,g];let E=l[g]-l[S];for(let M=0;M<y;M++)if(E>>M&1){if(g=f[M][g],g===-1)return-1}if(g===S)return g;for(let M=y-1;M>=0;M--){let I=f[M][g],w=f[M][S];if(I===-1||w===-1)continue;if(I!==w)g=I,S=w}return f[0][g]},"lcaIndex"),v=Array.from({length:c},()=>new Map);for(let g of t.edges){let{src:S,dst:E}=g,M=o[S],I=o[E];if(M==null||I==null)continue;if(M>I)[S,E]=[E,S],[M,I]=[I,M];if(M==null||I==null||M===I)continue;let w=i.get(S),A=i.get(E);if(w==null||A==null)continue;let B=b(w,A);if(B===-1)continue;let k=v[B];for(let R=M;R<I;R++)k.set(R,(k.get(R)??0)+1)}let x=new Map,p=e((g,S)=>{if(S.size===0)return;for(let[E,M]of S)g.set(E,(g.get(E)??0)+M)},"mergeInto"),m=new Set,L=e((g)=>{let S=i.get(g);m.add(g);let E=S==null?void 0:v[S],M=E?new Map(E):new Map,I=s.children.get(g)??[];for(let w of I){let A=L(w),B=o[g];if(B!=null){let k=x.get(g);if(!k)k=new Map,x.set(g,k);let R=A.get(B)??0,P=o[w];if(P!=null&&P>B)R+=1;k.set(w,R)}p(M,A)}return M},"dfs");for(let g of s.roots)if(!m.has(g))L(g);for(let g of r)if(!m.has(g))L(g);return x}e(kr,"computeSubtreeCrossCounts");function _r(t,o,s){let r=new Map,i=e((c)=>{let a=s[c]??0,l=[...o.get(c)??[]];l.sort(jo(s));for(let d of l){i(d);let h=r.get(d);if(h!=null)a=Math.min(a,h)}r.set(c,a)},"annotate");for(let c of t)i(c);return r}e(_r,"annotateMinimumLayers");function jo(t){return(o,s)=>{let r=t[o]??0,i=t[s]??0;return r===i?o.localeCompare(s):r-i}}e(jo,"compareByRankThenId");function Hr(t,o,s,r){let i=0;for(let d of o){let h=s[d]??0;if(h>i)i=h}let c=Array.from({length:i+1},()=>[]),a=new Set,l=e((d)=>{if(a.has(d))return;a.add(d);let h=s[d]??0;if(!c[h])c[h]=[];c[h].push(d);for(let y of r(d))l(y)},"emit");for(let d of t)l(d);for(let d of o)if(!a.has(d)){let h=s[d]??0;if(!c[h])c[h]=[];c[h].push(d),a.add(d)}return c}e(Hr,"emitNodesInTreeOrder");function Dr(t){let o=[];for(let s of t){let r=new Set,i=[];for(let c of s){if(r.has(c))continue;r.add(c),i.push(c)}o.push(i)}return o}e(Dr,"deduplicateLayers");function Xr(t,o,s,r){return(i)=>{let c=t.get(i)??[];if(c.length===0)return[];let a=o[i]??0,l=[],d=[],h=s.get(i);for(let y of c){let f=r.get(y)??a;if(f>a)l.push({child:y,min:f});else d.push(y)}return l.sort((y,f)=>{if(y.min===f.min)return y.child.localeCompare(f.child);return y.min-f.min}),d.sort((y,f)=>{let b=h?.get(y)??0,v=h?.get(f)??0;if(b!==v)return b-v;let x=r.get(y)??a,p=r.get(f)??a;if(x!==p)return x-p;return y.localeCompare(f)}),[...l.map((y)=>y.child),...d]}}e(Xr,"createChildOrderer");function vn(t,o,s){let r=Tr(t,{rankHint:o,laneOf:s}),{children:i,roots:c}=r;for(let f of t.nodes)if(!i.has(f))i.set(f,[]);let a=kr(t,o,r),l=[...c].sort(jo(o)),d=_r(l,i,o),h=Xr(i,o,a,d),y=Hr(l,t.nodes,o,h);return y=Dr(y),y}e(vn,"buildMultitreeLayerOrder");function Gr(t,o,s){let r=new Set(t),i=new Set(o),c=Ue(o),a=[];for(let l of s)if(r.has(l.src)&&i.has(l.dst))a.push(c.get(l.dst));return Uo(a)}e(Gr,"countCrossingsBetweenAdjacent");function po(t,o,s){let r=[];for(let c of o){let a=s[c.src],l=s[c.dst];if(a==null||l==null||a===l)continue;let{src:d,dst:h}=c,y=a,f=l;if(a>l)d=c.dst,h=c.src,y=l,f=a;for(let b=y;b<f;b++)r.push({id:`${c.id}@${b}`,src:d,dst:h,ref:c.ref})}let i=0;for(let c=0;c+1<t.length;c++)i+=Gr(t[c],t[c+1],r);return i}e(po,"totalCrossings");function Yr(t,o){let s={...o},{preds:r}=Rn(t),i=Ee(t),c=vn(t,s,i),a=po(c,t.edges,s),l=Mn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let d=0;d<l;d++){let h=!1,y=[...t.nodes].sort((f,b)=>(s[b]??0)-(s[f]??0));for(let f of y){let b=s[f]??0;if(b===0)continue;let v=0;for(let L of r.get(f)??[])v=Math.max(v,(s[L]??0)+1);if(v>=b)continue;let x=b;s[f]=v;let p=vn(t,s,i),m=po(p,t.edges,s);if(m<a)a=m,h=!0;else s[f]=x}if(!h)break}return s}e(Yr,"optimizeRanksByCrossings");function zr(t,o){let s=Ee(t),r=[...t.nodes].sort((i,c)=>(o[i]??0)-(o[c]??0)||i.localeCompare(c));for(let i of r){let c=s(i);if(!c)continue;let a=t.edges.filter((p)=>p.src===i);if(a.length===0)continue;let l=!1,d=0;for(let p of a){let m=s(p.dst);if(m==null||m===c)l=!0;else d++}if(d===0||l)continue;let h=0,y=!1;for(let p of t.edges){if(p.dst!==i)continue;let m=s(p.src);if(!m)continue;if(m===c)y=!0;else h++}if(h>0||!y)continue;let f=o[i]??0,b=f+d,v=0;for(let p of t.edges)if(p.dst===i)v=Math.max(v,(o[p.src]??0)+1);let x=Math.max(f,v,b);if(x!==f)o[i]=x}}e(zr,"adjustCrossLaneSources");function $r(t,o){let s=Fe(t),r=Ze(s)??[...s.nodes].sort(),i=o?.compactSingleInput??!1,c=Ee(s),a=Object.create(null);for(let d of r){let h=Go(s,d),y=o?.ignoreCrossLaneEdges?h.filter((f)=>{let b=c(f.src),v=c(d);if(!b||!v)return!0;return b===v}):h;if(y.length===0)a[d]=0;else if(i&&y.length===1){let f=y[0].src,b=c(f),v=c(d);if(b!==v)a[d]=a[f]??0;else a[d]=(a[f]??0)+1}else{let f=-1/0;for(let b of y)f=Math.max(f,(a[b.src]??0)+1);a[d]=f===-1/0?0:f}}if(o?.optimizeRanksByCrossings??!1)a=Yr(s,a);if(o?.ignoreCrossLaneEdges)zr(s,a);return{layers:vn(s,a,c),rankOf:a,dummy:new Set}}e($r,"assignLayers_LongestPath");function Ur(t,o){let s=Fe(t),i={...$r(s,{compactSingleInput:o?.compactSingleInput,ignoreCrossLaneEdges:o?.ignoreCrossLaneEdges,optimizeRanksByCrossings:o?.optimizeRanksByCrossings}).rankOf},c=Ee(s),{preds:a,succs:l}=Rn(s,(x)=>{if(o?.ignoreCrossLaneEdges){let p=c(x.src),m=c(x.dst);if(p&&m&&p!==m)return!1}return!0}),d=Ze(s)??[...s.nodes],h=[...d].reverse(),y=e((x,p)=>{let m=0;for(let S of a.get(x)??[])m=Math.max(m,(i[S]??0)+1);let L=Number.POSITIVE_INFINITY,g=l.get(x)??[];if(g.length>0)L=Math.min(...g.map((S)=>(i[S]??0)-1));if(!Number.isFinite(L))L=Math.max(m,p);return Math.min(Math.max(p,m),L)},"clampFeasible"),f=Mn.GRAVITY_ITERATIONS,b=e((x)=>{let p=!1;for(let m of x){let L=a.get(m)??[],g=l.get(m)??[];if(L.length===0&&g.length===0)continue;let S=L.length>0?L.reduce((w,A)=>w+(i[A]??0)+1,0)/L.length:i[m]??0,E=g.length>0?g.reduce((w,A)=>w+(i[A]??0)-1,0)/g.length:i[m]??0,M=Math.round((S+E)/2),I=y(m,M);if(I!==i[m])i[m]=I,p=!0}return p},"relaxOrder");for(let x=0;x<f;x++){let p=b(d),m=b(h);if(!p&&!m)break}for(let x of d){let p=0;for(let m of a.get(x)??[])p=Math.max(p,(i[m]??0)+1);if((i[x]??0)<p)i[x]=p}for(let x of h){let p=l.get(x)??[];if(p.length>0){let m=Math.min(...p.map((L)=>(i[L]??0)-1));if((i[x]??0)>m)i[x]=m}}return{layers:$o(s,d,i),rankOf:i,dummy:new Set}}e(Ur,"assignLayers_Gravity");function Vr(t){let o=An(t),s=Yo(t),r=zo(t,o),i=[];while(r.length>0){let c=[];for(let a of r){i.push(a);for(let l of s.get(a)??[])if(o.set(l,(o.get(l)??0)-1),(o.get(l)??0)===0)c.push(l)}r=c.sort((a,l)=>a.localeCompare(l))}return i.length===t.nodes.length?i:null}e(Vr,"topoSortByGenerationIfAcyclic");function jr(t,o){let s=Fe(t),r=o?.direction==="LR"?Vr(s)??[...s.nodes].sort():Ze(s)??[...s.nodes].sort(),i=Ee(s),c=e((y)=>i(y)??y,"laneOf"),a=Object.create(null),l=new Map,d=e((y,f)=>{if(o?.ignoreCrossLaneEdges??!0)return c(y)===c(f)?1:0;return 1},"edgeWeight");for(let y of r){if(s.nodeById.get(y)?.isGroup)continue;let b=Go(s,y),v=0;if(b.length>0)for(let L of b){let g=L.src,S=a[g]??0;v=Math.max(v,S+d(g,y))}let x=c(y),p=l.get(x)??0,m=Math.max(v,p);a[y]=m,l.set(x,m+1)}return{layers:$o(s,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}e(jr,"assignLayers_LaneAwareCompact");function Wr(t,o){let s=Fe(o),{rankOf:r}=t,i=t.layers.map((v)=>[...v]),c=new Set(t.dummy?[...t.dummy]:[]),a=0,l=new Map(s.nodeById),d=e((v)=>{let x=`placeholder-${a++}`,p={id:x,isGroup:!1,isDummy:!0,width:0,height:0};l.set(x,p),c.add(x);while(i.length<=v)i.push([]);return i[v].push(x),r[x]=v,x},"addDummyAt"),h=[...s.edges].sort((v,x)=>v.id===x.id?v.src===x.src?v.dst.localeCompare(x.dst):v.src.localeCompare(x.src):v.id.localeCompare(x.id)),y=[];for(let v of h){let x=r[v.src]??0,p=r[v.dst]??0;if(p-x<=1){y.push(v);continue}let m=v.src;for(let g=x+1,S=0;g<p;g++,S++){let E=d(g);y.push({id:`${v.id}#${S}`,src:m,dst:E,weight:v.weight,ref:v.ref}),m=E}let L=p-x-2;y.push({id:`${v.id}#${Math.max(L+1,0)}`,src:m,dst:v.dst,weight:v.weight,ref:v.ref})}let b={nodes:[...s.nodes,...[...c].filter((v)=>!s.nodes.includes(v))],edges:y,layout:s.layout,nodeById:l};return{layering:{layers:i,rankOf:r,dummy:c},graphWithDummies:b}}e(Wr,"makeProperLayering");function mo(t){let o=t.length;if(o===0)return Number.POSITIVE_INFINITY;let s=[...t].sort((r,i)=>r-i);if(o%2===1)return s[(o-1)/2];return 0.5*(s[o/2-1]+s[o/2])}e(mo,"median");function yo(t){if(t.length===0)return Number.POSITIVE_INFINITY;return t.reduce((s,r)=>s+r,0)/t.length}e(yo,"barycenter");function Kr(t,o,s,r){let i=new Map;for(let c of t)i.set(c,[]);for(let c of s)if(r==="down"){if(o.has(c.src)&&i.has(c.dst))i.get(c.dst).push(o.get(c.src))}else if(o.has(c.dst)&&i.has(c.src))i.get(c.src).push(o.get(c.dst));return i}e(Kr,"neighborPositionsFor");function qr(t,o,s){let r=s.get(t)??0,i=s.get(o)??0;return r!==i?r-i:t.localeCompare(o)}e(qr,"currentOrderTieBreak");function xo(t,o,s){let r=new Set(t),i=new Set(o),c=Ue(t),a=Ue(o),l=[];for(let h of s)if(r.has(h.src)&&i.has(h.dst))l.push({u:c.get(h.src),v:a.get(h.dst)});l.sort((h,y)=>h.u===y.u?h.v-y.v:h.u-y.u);let d=l.map((h)=>h.v);return Uo(d)}e(xo,"countCrossingsBetweenAdjacent");function fn(t,o,s){return[...t].sort((r,i)=>{let c=mo(o.get(r)??[]),a=mo(o.get(i)??[]);if(c===a)return qr(r,i,s);if(!isFinite(c))return 1;if(!isFinite(a))return-1;return c-a})}e(fn,"sortByHeuristic");function bo(t,o,s,r,i,c){let a=Ue(t),l=Ue(o),d=Kr(o,a,s,r);if(!i||!c||c.length===0)return fn(o,d,l);let h=new Map;for(let b of o){let v=i(b),x=h.get(v)??[];x.push(b),h.set(v,x)}let y=[];for(let b of c){let v=h.get(b);if(!v||v.length===0)continue;let x=fn(v,d,l);y.push(...x)}let f=h.get(null);if(f&&f.length>0){let b=fn(f,d,l);for(let v of b){let x=yo(d.get(v)??[]),p=y.length;if(isFinite(x))for(let[m,L]of y.entries()){let g=yo(d.get(L)??[]);if(x<g){p=m;break}}y.splice(p,0,v)}}return y}e(bo,"reorderLayer");function Io(t,o,s,r,i){let c=[...o],a=new Set(t),l=new Set(o),d=r?new Set(r):null,h=s.filter((p)=>a.has(p.src)&&l.has(p.dst)),y=d?s.filter((p)=>l.has(p.src)&&d.has(p.dst)):void 0,f=e((p)=>{let m=xo(t,p,h);if(y&&r)m+=xo(p,r,y);return m},"crossingScore"),b=i?new Map:null;if(i&&b)for(let p of o)b.set(p,i(p));let v=!0,x=f(c);while(v){v=!1;for(let p=0;p+1<c.length;p++){if(b){let g=b.get(c[p]),S=b.get(c[p+1]);if(g!==S)continue}let m=x;[c[p],c[p+1]]=[c[p+1],c[p]];let L=f(c);if(L<m)x=L,v=!0;else[c[p],c[p+1]]=[c[p+1],c[p]]}}return c}e(Io,"transposeImprove");function Zr(t,o,s){let r=t.layers.map((l)=>[...l]),i=o.edges,c=Ee(o),a=Vo(o,s?.laneOrder);for(let l=0;l<3;l++){for(let d=1;d<r.length;d++)r[d]=bo(r[d-1],r[d],i,"down",c,a),r[d]=Io(r[d-1],r[d],i,r[d+1],c);for(let d=r.length-2;d>=0;d--)r[d]=bo(r[d+1],r[d],i,"up",c,a),r[d]=Io(r[d+1],r[d],i,r[d-1],c)}return{layers:r}}e(Zr,"orderLayers");function Jr(t,o,s){let r=s?.layerGap??Hn.DEFAULT_LAYER_GAP,i=s?.nodeGap??Hn.DEFAULT_NODE_GAP,c=s?.laneGap??i*2,a=s?.direction??"TB",l=a==="LR"||a==="RL",d=Object.create(null),h=Object.create(null),y=new Map((o.layout?.nodes??[]).filter((H)=>H.isEdgeLabel).map((H)=>[H.id,H])),f=e((H)=>y.get(H)??o.nodeById.get(H),"getNode"),b=e((H)=>f(H)?.width??0,"getWidth"),v=e((H)=>f(H)?.height??0,"getHeight"),x=Ee(o),p=new Map,m=e((H)=>p.has(H)?p.get(H)??null:x(H),"topLaneOf"),L=Vo(o,s?.laneOrder),g=new Set;for(let H of t.layers)for(let j of H)g.add(x(j));let S=g.has(null),E=L.filter((H)=>g.has(H)),M=[...S?[null]:[],...E],I=t.layers,w=new Map;for(let[H,j]of I.entries())for(let st of j)w.set(st,H);let A=[],B=[],k=[];for(let H of o.layout?.edges??[]){let{labelNodeId:j,start:st,end:Q}=H;if(!j||!y.has(j)||st==null||Q==null)continue;let at=w.get(st),pt=w.get(Q);if(at==null||pt==null){k.push({labelId:j,near:at==null?Q:st});continue}if(p.set(j,x(Q)),at===pt){let vt=e((Dt)=>M.indexOf(x(Dt)),"column");A.push({labelId:j,rank:pt,lane:x(Q),side:st!==Q&&vt(st)<vt(Q)?"before":"after"});continue}let yt=Math.min(at,pt),xt=Math.max(at,pt);B.push({labelId:j,start:st,end:Q,gap:yt+Math.floor((xt-yt-1)/2),crossesLanes:x(st)!==x(Q)})}let R=I.map((H)=>H.reduce((j,st)=>Math.max(j,v(st)),0));for(let{labelId:H,rank:j}of A)R[j]=Math.max(R[j],v(H));let P=I.map(()=>0);if(l)for(let H=0;H+1<I.length;H++){let j=I[H].reduce((xt,vt)=>Math.max(xt,b(vt)),0),st=I[H+1].reduce((xt,vt)=>Math.max(xt,b(vt)),0),Q=R[H],at=R[H+1],pt=Q/2+at/2,yt=(j+st)/2;P[H]=Math.max(0,yt-pt-r)}let V=l?_o(o.layout?.nodes??[]):1,z=I.map(()=>0);for(let{labelId:H,gap:j}of B){let Q=((l?b(H):v(H))+2*Hn.EDGE_LABEL_CLEARANCE)/V;z[j]=Math.max(z[j],Q)}for(let[H,j]of z.entries())P[H]+=j;let Y=Object.create(null);for(let H of E)Y[H]=0;if(S)Y.null=0;for(let H of I){let j=Object.create(null),st=[];for(let Q of H){let at=m(Q);if(at===null)st.push(Q);else(j[at]||=[]).push(Q)}for(let[Q,at]of Object.entries(j)){let pt=at.reduce((yt,xt)=>yt+b(xt),0)+i*Math.max(0,at.length-1);Y[Q]=Math.max(Y[Q]??0,pt)}if(S&&st.length){let Q=st.reduce((at,pt)=>at+b(pt),0)+i*Math.max(0,st.length-1);Y.null=Math.max(Y.null??0,Q)}}let et=new Map;for(let H of B){let j=`${H.gap}:${m(H.labelId)}`,st=et.get(j);if(st)st.push(H);else et.set(j,[H])}for(let H of et.values()){let j=m(H[0].labelId);if(j!==null){let st=H.reduce((Q,at,pt)=>Q+b(at.labelId)+(pt>0?i:0),0);Y[j]=Math.max(Y[j]??0,st)}}let ft=new Map;for(let{labelId:H,rank:j,lane:st,side:Q}of A){let at=`${j}:${st}:${Q}`;ft.set(at,(ft.get(at)??0)+i+b(H))}let St=e((H,j,st)=>ft.get(`${H}:${j}:${st}`)??0,"rowLabelSpan");for(let{rank:H,lane:j}of A){let st=I[H].filter((pt)=>m(pt)===j).reduce((pt,yt,xt)=>pt+b(yt)+(xt>0?i:0),0),Q=Math.max(St(H,j,"before"),St(H,j,"after")),at=j??"null";Y[at]=Math.max(Y[at]??0,st+2*Q)}let Zt=new Map;{let H=M.map((Q)=>(Q===null?Y.null:Y[Q])??0),st=-(H.reduce((Q,at)=>Q+at,0)+c*Math.max(0,M.length-1))/2;for(let Q=0;Q<M.length;Q++){let at=M[Q],pt=H[Q]??0,yt=st+pt/2;if(Zt.set(at,yt),st+=pt,Q<M.length-1)st+=c}}let Jt=[],Qt=0;for(let[H,j]of I.entries()){let st=R[H]??0,Q=new Map;for(let pt of j){let yt=m(pt),xt=Q.get(yt)??[];xt.push(pt),Q.set(yt,xt)}for(let pt of M){let yt=Q.get(pt)??[];if(yt.length===0)continue;let xt=Zt.get(pt);if(yt.length===1){let vt=yt[0];d[vt]=xt,h[vt]=Qt+st/2}else{let vt=yt.map((Le)=>b(Le)),Dt=vt.reduce((Le,we)=>Le+we,0)+i*(yt.length-1),Be=xt-Dt/2;for(let[Le,we]of yt.entries()){let Pe=vt[Le];d[we]=Be+Pe/2,h[we]=Qt+st/2,Be+=Pe+i}}}let at=r+(P[H]??0);Jt[H]=Qt+st+at/2,Qt+=st+at}let nt=new Map;for(let{labelId:H,rank:j,lane:st,side:Q}of A){let at=`${j}:${st}:${Q}`;if(!nt.has(at)){let vt=I[j].filter((Dt)=>m(Dt)===st).map((Dt)=>Q==="before"?d[Dt]-b(Dt)/2:d[Dt]+b(Dt)/2);nt.set(at,Q==="before"?Math.min(...vt):Math.max(...vt))}let pt=b(H),yt=nt.get(at)+(Q==="before"?-1:1)*(i+pt/2);d[H]=yt,h[H]=h[I[j].find((xt)=>m(xt)===st)],nt.set(at,yt+(Q==="before"?-1:1)*(pt/2))}for(let H of et.values()){let j=H.map(({start:xt,end:vt,crossesLanes:Dt})=>Dt?d[vt]:((d[xt]??0)+(d[vt]??0))/2),st=H.map((xt,vt)=>vt).sort((xt,vt)=>j[xt]-j[vt]||xt-vt),Q=[],at=-1/0;for(let xt of st){let vt=b(H[xt].labelId);Q[xt]=Math.max(j[xt],at+i+vt/2),at=Q[xt]+vt/2}let pt=e((xt)=>xt.reduce((vt,Dt)=>vt+Dt,0)/xt.length,"mean"),yt=pt(j)-pt(Q);for(let[xt,{labelId:vt,gap:Dt}]of H.entries())d[vt]=Q[xt]+yt,h[vt]=Jt[Dt]}for(let{labelId:H,near:j}of k)d[H]=d[j]??0,h[H]=h[j]??0;let ht=new Map;for(let H of o.edges){let j=H.ref.id;if(!ht.has(j))ht.set(j,[]);ht.get(j).push(H)}for(let[,H]of ht){if(H.length===0)continue;let j=H[0].ref,{start:st,end:Q}=j;if(st==null||Q==null)continue;let at=Math.round(((d[st]??0)+(d[Q]??0))/2),pt=new Set;for(let yt of H)pt.add(yt.src),pt.add(yt.dst);for(let yt of pt){if(yt===st||yt===Q)continue;if(o.nodeById.get(yt)?.isDummy)d[yt]=at}}return{x:d,y:h}}e(Jr,"assignCoordinates");var Qr=8;function ti(t){let o=2166136261;for(let s=0;s<t.length;s++)o^=t.charCodeAt(s),o=Math.imul(o,16777619);return o>>>0}e(ti,"hashString");function ei(t){let o=t>>>0;return()=>{o+=1831565813;let s=o;return s=Math.imul(s^s>>>15,s|1),s^=s+Math.imul(s^s>>>7,s|61),((s^s>>>14)>>>0)/4294967296}}e(ei,"mulberry32");function ni(t,o){let s=[...t],r=ei(o);for(let i=s.length-1;i>0;i--){let c=Math.floor(r()*(i+1));[s[i],s[c]]=[s[c],s[i]]}return s}e(ni,"deterministicShuffle");function oi(t,o){let s=0;for(let[r,i]of t.entries())s+=Math.abs(r-(o.get(i)??r));return s}e(oi,"sourceDistance");function Mo(t,o){let s=new Map;for(let[i,c]of t.entries())s.set(c,i);let r=0;for(let{a:i,b:c,weight:a}of o){let l=s.get(i),d=s.get(c);if(l==null||d==null)continue;r+=a*Math.abs(l-d)}return r}e(Mo,"laneArrangementCost");function si(t){let o=Tn(t);if(o.length<2)return[];let s=new Map(o.map((c,a)=>[c,a])),r=Ee(t),i=new Map;for(let c of t.layout.edges??[]){if(c.isLayoutOnly)continue;let a=typeof c.start==="string"?c.start:void 0,l=typeof c.end==="string"?c.end:void 0;if(!a||!l||!t.nodeById.has(a)||!t.nodeById.has(l))continue;let d=r(a),h=r(l);if(!d||!h||d===h)continue;let y=s.get(d),f=s.get(h);if(y==null||f==null)continue;let[b,v]=y<=f?[d,h]:[h,d],x=`${b}\x00${v}`,p=i.get(x);if(p)p.weight++;else i.set(x,{a:b,b:v,weight:1})}return[...i.values()]}e(si,"buildWeightedLaneEdges");function So(t,o,s){let r=[...t],i=Mo(r,o),c=!0,a=0,l=Math.max(1,r.length);while(c&&a<l){c=!1,a++;for(let d=0;d+1<r.length;d++){[r[d],r[d+1]]=[r[d+1],r[d]];let h=Mo(r,o);if(h<i)i=h,c=!0;else[r[d],r[d+1]]=[r[d+1],r[d]]}}return{order:r,cost:i,sourceDistance:oi(r,s)}}e(So,"greedySwitch");function ri(t,o){if(t.cost!==o.cost)return t.cost<o.cost;return t.sourceDistance<o.sourceDistance}e(ri,"isBetterCandidate");function ii(t,o,s){let r=[...o].sort((i,c)=>i.a===c.a?i.b.localeCompare(c.b):i.a.localeCompare(c.a)).map(({a:i,b:c,weight:a})=>`${i}:${c}:${a}`).join("|");return ti(`${t.join("|")}#${r}#${s}`)}e(ii,"seedForRestart");function ci(t,o={}){let s=Tn(t);if(s.length<2)return s;let r=si(t);if(r.length===0)return s;let i=new Map(s.map((l,d)=>[l,d])),c=So(s,r,i),a=Math.max(0,o.restarts??Qr);for(let l=0;l<a;l++){let d=ii(s,r,l),h=ni(s,d),y=So(h,r,i);if(ri(y,c))c=y}return c.order}e(ci,"optimizeTopLaneOrder");function ai(t,o){let s=o?.ignoreCrossLaneEdges??!0,r=o?.optimizeRanksByCrossings??!0,i=Fe(t),c=o?.automaticLaneOrdering?ci(i,{restarts:Qr}):void 0,a=Ar(i),l=a.acyclic,d=s?jr(l,{compactSingleInput:o?.compactSingleInput??Mn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:o?.direction}):Ur(l,{compactSingleInput:o?.compactSingleInput??Mn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),{layering:h,graphWithDummies:y}=Wr(d,l),f=Zr(h,y,{laneOrder:c}),b=Jr(f,y,{layerGap:o?.layerGap,nodeGap:o?.nodeGap,direction:o?.direction,laneOrder:c});return{acyclic:l,reversed:a.reversed,layering:h,ordered:f,coordinates:b}}e(ai,"sugiyamaLayout");var bt=Pi.EPSILON,$i=8,_e=15,ze=15,an=25,me=20,Gn=10;function vo(t,o,s){let r=t.x??0,i=t.y??0,c=o.x-r,a=o.y-i,l=Math.abs(c),d=Math.abs(a);if(l<bt&&d<bt)return s;let h=3;if(d>bt&&d*h>=l)return a>0?"bottom":"top";if(l>bt)return c>0?"right":"left";return s}e(vo,"chooseOrthogonalSide");var is=e((t)=>typeof t==="number"&&Number.isFinite(t)&&t>0,"isDrawableSize");function dn(t,o){let s=t.metadata?.drawnExtent;return{w:is(s?.width)?s.width:t.width??o,h:is(s?.height)?s.height:t.height??o}}e(dn,"drawnSize");function Co(t,o){return Math.abs(t.to-o.from)<bt||Math.abs(t.to-o.to)<bt?t.to:t.from}e(Co,"sharedLineEndpointCoord");function He(t,o){return t.orient==="vertical"?{x:t.coord,y:o}:{x:o,y:t.coord}}e(He,"pointOnLine");function li(t,o){let s=t.nodes??[],r=t.edges??[],i=[];for(let u of r){if(u.isLayoutOnly)continue;i.push({...u,__originalEdge:u})}let c=new Map,a=new Map,l=[],d=o==="LR";for(let u of s)c.set(u.id,u);let h=Ie(s),y=s.filter((u)=>h.isLane(u.id));for(let u of y){let C={id:u.id},T=e((O)=>{a.set(O.id,C),s.filter((N)=>N.parentId===O.id).forEach(T)},"assignLane");T(u)}let f=Ve(s),b=s.filter((u)=>!u.isGroup&&!u.isEdgeLabel&&!f.has(u.id)).map((u)=>{let C=u.width??10,T=u.height??10,O=u.x??0,N=u.y??0,D=$i;return{nodeId:u.id,minX:O-C/2-D,maxX:O+C/2+D,minY:N-T/2-D,maxY:N+T/2+D,visualXHalfExtent:d?T/2+D:C/2+D}}),v=e((u,C,T,O)=>{let N=l.find((D)=>D.orientation===u&&Math.abs(D.coord-C)<1);if(!N)N={id:`pipe-${u}-${C.toFixed(0)}`,orientation:u,coord:C,spanMin:T,spanMax:O,tracks:[]},l.push(N);return N.spanMin=Math.min(N.spanMin,T),N.spanMax=Math.max(N.spanMax,O),N},"getOrAddPipe"),x=e((u,C)=>{let{w:T,h:O}=dn(u,10),N=u.x??0,D=u.y??0;switch(C){case"top":return{x:N,y:D-O/2};case"bottom":return{x:N,y:D+O/2};case"left":return{x:N-T/2,y:D};case"right":return{x:N+T/2,y:D}}},"portForSide"),p=e((u,C,T)=>x(u,vo(u,C,T?"bottom":"top")),"getOrthogonalPort"),m=[],L=[],g=new Set,S=1000,E=e((u,C,T)=>{if(m.length===0)return 0;let O=Math.abs(C.y-T.y)<bt,N=Math.abs(C.x-T.x)<bt;if(!O&&!N)return 0;let D=0;if(O){let tt=C.y,ut=Math.min(C.x,T.x)-bt,Z=Math.max(C.x,T.x)+bt;if(Z<=ut)return 0;for(let K of m){if(K.edgeIndex===u||K.orientation!=="vertical")continue;if(K.pipe.coord<ut||K.pipe.coord>Z)continue;if(K.from-bt<=tt&&K.to+bt>=tt)D+=S}}else if(N){let tt=C.x,ut=Math.min(C.y,T.y)-bt,Z=Math.max(C.y,T.y)+bt;if(Z<=ut)return 0;for(let K of m){if(K.edgeIndex===u||K.orientation!=="horizontal")continue;if(K.pipe.coord<ut||K.pipe.coord>Z)continue;if(K.from-bt<=tt&&K.to+bt>=tt)D+=S}}return D},"crossingPenalty"),M=i.map((u,C)=>{if(!u.start||!u.end)return{idx:C,crossLane:0,dx:0,dy:0};let T=c.get(u.start),O=c.get(u.end),N=a.get(u.start),D=a.get(u.end),tt=N&&D&&N.id!==D.id?1:0,ut=T&&O?Math.abs((O.x??0)-(T.x??0)):0,Z=T&&O?Math.abs((O.y??0)-(T.y??0)):0;return{idx:C,crossLane:tt,dx:ut,dy:Z}}).sort((u,C)=>{if(u.crossLane!==C.crossLane)return C.crossLane-u.crossLane;let T=u.dx+u.dy,O=C.dx+C.dy;if(Math.abs(T-O)>1)return T-O;return u.idx-C.idx}).map((u)=>u.idx),I=e((u,C,T,O)=>{let N=Math.min(u.x,C.x),D=Math.max(u.x,C.x),tt=Math.min(u.y,C.y),ut=Math.max(u.y,C.y);return!!b.find((K)=>{if(T&&K.nodeId===T)return!1;if(O&&K.nodeId===O)return!1;if(Math.abs(u.x-C.x)>bt)return K.minY<u.y&&K.maxY>u.y&&K.maxX>N&&K.minX<D;else return K.minX<u.x&&K.maxX>u.x&&K.maxY>tt&&K.minY<ut})},"isSegmentBlocked"),w=new Map,A=new Map;for(let u of i){if(!u.start||!u.end||u.start===u.end)continue;A.set(u.start,(A.get(u.start)??0)+1),A.set(u.end,(A.get(u.end)??0)+1)}let B=e((u,C)=>vo(u,C,"bottom"),"determineSide"),k=new Map;for(let[u,C]of i.entries()){if(!C.start||!C.end||C.start===C.end)continue;if(C.points&&C.points.length>0)continue;let T=c.get(C.start),O=c.get(C.end);if(!T||!O)continue;let N=(O.x??0)-(T.x??0),D=(O.y??0)-(T.y??0);k.set(u,{edgeIdx:u,srcId:C.start,dstId:C.end,srcSide:B(T,{x:O.x??0,y:O.y??0}),dstSide:B(O,{x:T.x??0,y:T.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}let R=e((u)=>{if(u.srcSide==="top"||u.srcSide==="bottom")return u.absDx===0?1/0:u.absDy/u.absDx;return u.absDy===0?1/0:u.absDx/u.absDy},"preferenceStrength"),P=e((u)=>{if(u.srcSide==="top"||u.srcSide==="bottom"){if(u.dxSign===0)return["right","left"];return[u.dxSign>0?"right":"left"]}if(u.dySign===0)return["bottom","top"];return[u.dySign>0?"bottom":"top"]},"secondarySides"),V=e((u)=>P(u)[0],"secondarySide"),z=new Map;for(let u of k.values()){let C=`${u.srcId}:${u.srcSide}`;if(!z.has(C))z.set(C,[]);z.get(C).push(u)}let Y=new Map,et=e((u,C)=>`${u}:${C}`,"loadKey");for(let u of k.values())Y.set(et(u.srcId,u.srcSide),(Y.get(et(u.srcId,u.srcSide))??0)+1),Y.set(et(u.dstId,u.dstSide),(Y.get(et(u.dstId,u.dstSide))??0)+1);for(let u of z.values()){if(u.length<2)continue;u.sort((C,T)=>{let O=R(C),N=R(T);if(Math.abs(O-N)>0.000000001)return N-O;return C.edgeIdx-T.edgeIdx});for(let C=1;C<u.length;C++){let T=u[C],O=Y.get(et(T.srcId,T.srcSide))??0,N=P(T).reduce((tt,ut)=>(Y.get(et(T.srcId,ut))??0)<(Y.get(et(T.srcId,tt))??0)?ut:tt),D=Y.get(et(T.srcId,N))??0;if(D>=O)continue;Y.set(et(T.srcId,T.srcSide),O-1),Y.set(et(T.srcId,N),D+1),T.srcSide=N}}let ft=e((u)=>{let C=u?.shape;return C==="question"||C==="diamond"},"isDiamondNode"),St=new Map;for(let u of k.values()){if(!St.has(u.dstId))St.set(u.dstId,new Set);St.get(u.dstId).add(u.dstSide)}for(let u of k.values()){if(!ft(c.get(u.srcId)))continue;let C=St.get(u.srcId);if(!C?.has(u.srcSide))continue;let T=V(u);if(C.has(T)||(Y.get(et(u.srcId,T))??0)>0)continue;let O=Y.get(et(u.srcId,u.srcSide))??0;Y.set(et(u.srcId,u.srcSide),Math.max(0,O-1)),Y.set(et(u.srcId,T),1),u.srcSide=T}let Zt=e((u)=>{let C=u?.shape;return C==="hexagon"||C==="notch-pent"},"hasVertexFaces"),Jt=new Map;for(let u of k.values()){if(!Jt.has(u.srcId))Jt.set(u.srcId,new Set);Jt.get(u.srcId).add(u.srcSide)}let Qt=e((u)=>{if(u.dstSide==="top"||u.dstSide==="bottom")return u.dxSign>=0?"left":"right";return u.dySign>=0?"top":"bottom"},"secondaryDstSide");for(let u of k.values()){if(!Zt(c.get(u.dstId)))continue;let C=Jt.get(u.dstId);if(!C?.has(u.dstSide))continue;let T=Qt(u);if(C.has(T)||(Y.get(et(u.dstId,T))??0)>0)continue;let O=Y.get(et(u.dstId,u.dstSide))??0;Y.set(et(u.dstId,u.dstSide),Math.max(0,O-1)),Y.set(et(u.dstId,T),1),u.dstSide=T;let N=u.dySign>=0?"bottom":"top";if((T==="top"||T==="bottom")&&St.get(u.srcId)?.has(u.srcSide)&&!St.get(u.srcId)?.has(N)&&(Y.get(et(u.srcId,N))??0)===0){let D=Y.get(et(u.srcId,u.srcSide))??0;Y.set(et(u.srcId,u.srcSide),Math.max(0,D-1)),Y.set(et(u.srcId,N),1),u.srcSide=N}}for(let u of k.values()){let{edgeIdx:C,srcId:T,dstId:O,srcSide:N,dstSide:D}=u,tt=c.get(T),ut=c.get(O),Z=`${T}:${N}:src`,K=N==="top"||N==="bottom"?ut.x??0:ut.y??0;if(!w.has(Z))w.set(Z,[]);w.get(Z).push({edgeIdx:C,oppositeCoord:K});let Tt=`${O}:${D}:dst`,Ot=D==="top"||D==="bottom"?tt.x??0:tt.y??0;if(!w.has(Tt))w.set(Tt,[]);w.get(Tt).push({edgeIdx:C,oppositeCoord:Ot})}let nt=new Map,ht=8;for(let[u,C]of w){if(C.length<2)continue;C.sort((Vt,de)=>Vt.oppositeCoord-de.oppositeCoord);let T=u.split(":"),O=T.slice(0,-2).join(":"),N=T[T.length-2],D=T[T.length-1],tt=c.get(O);if(!tt)continue;let ut=N==="left"||N==="right",Z=dn(tt,10),K=ut?Z.h:Z.w,Tt=tt.shape,Bt=Tt==="question"||Tt==="diamond"?K*0.3:K,Lt=Math.min(20,Bt/(C.length-1),Math.max(ht,Bt/(C.length+1))),ae=-(Lt*(C.length-1))/2;for(let[Vt,de]of C.entries()){let Ae=ae+Vt*Lt,On=`${de.edgeIdx}:${D}`;nt.set(On,Ae)}}let H=e((u)=>Boolean(i[u]?.labelNodeId),"edgeHasLabelNode"),j=e((u,C)=>{if(!u)return!1;return(w.get(`${u}:${C}:src`)??[]).some(({edgeIdx:T})=>H(T))||(w.get(`${u}:${C}:dst`)??[]).some(({edgeIdx:T})=>H(T))},"faceHasLabelNode"),st=e((u,C,T)=>{if(C==="top"||C==="bottom")return{x:u.x+T,y:u.y};else return{x:u.x,y:u.y+T}},"applyPortOffset"),Q=e((u,C,T)=>{let O=k.get(u),N={x:T.x??0,y:T.y??0},D={x:C.x??0,y:C.y??0},tt=O?.srcSide??B(C,N),ut=O?.dstSide??B(T,D),Z=O?x(C,O.srcSide):p(C,N,!0),K=O?x(T,O.dstSide):p(T,D,!1),Tt=nt.get(`${u}:src`),Ot=nt.get(`${u}:dst`);if(Tt!==void 0)Z=st(Z,tt,Tt);if(Ot!==void 0)K=st(K,ut,Ot);return{pSrcPort:Z,pDstPort:K,srcSide:tt,dstSide:ut}},"portsForEdge");for(let u of M){let C=i[u];if(L[u]=[],!C.start||!C.end)continue;if(C.points&&C.points.length>0)continue;if(C.start===C.end)continue;let T=c.get(C.start),O=c.get(C.end);if(!T||!O)continue;let{pSrcPort:N,pDstPort:D,srcSide:tt,dstSide:ut}=Q(u,T,O),Z={...N},K={...D},Tt=tt==="top"||tt==="bottom",Ot=ut==="top"||ut==="bottom";if(Tt){let G=N.y>(T.y??0);Z.y=G?N.y+me:N.y-me}else{let G=N.x>(T.x??0);Z.x=G?N.x+me:N.x-me}if(Ot){let G=D.y>(O.y??0);K.y=G?D.y+me:D.y-me}else{let G=D.x>(O.x??0);K.x=G?D.x+me:D.x-me}let Bt=e((G,W)=>{for(let ct of b){if(W.includes(ct.nodeId))continue;if(G.x>ct.minX&&G.x<ct.maxX&&G.y>ct.minY&&G.y<ct.maxY)return{inside:!0,obstacle:ct}}return{inside:!1}},"isPointInObstacle"),lt=e((G,W,ct,Et,Ht)=>{if(Ht){let jt=G.y>(W.y??0);return{x:(ct.x??0)>=G.x?Et.maxX+_e:Et.minX-_e,y:jt?Et.maxY+ze:Et.minY-ze,leavesPositiveSide:jt}}let Ft=G.x>(W.x??0),zt=(ct.y??0)>=G.y;return{x:Ft?Et.maxX+_e:Et.minX-_e,y:zt?Et.maxY+ze:Et.minY-ze,leavesPositiveSide:Ft}},"obstacleDetour"),Lt=[],Yt=[C.start,C.end],ae=Bt(Z,Yt);if(ae.inside&&ae.obstacle){let G=ae.obstacle;if(Tt){let W=lt(N,T,O,G,!0);Z.x=W.x,Z.y=W.y;let ct=W.leavesPositiveSide?Math.min(G.minY-2,N.y+me):Math.max(G.maxY+2,N.y-me);Lt=[{x:N.x,y:ct},{x:W.x,y:ct},{x:W.x,y:W.y}]}else{let W=lt(N,T,O,G,!1),ct=W.leavesPositiveSide?Math.min(G.minX-2,N.x+me):Math.max(G.maxX+2,N.x-me);Z.x=W.x,Z.y=W.y,Lt=[{x:ct,y:N.y},{x:ct,y:W.y},{x:W.x,y:W.y}]}}let Vt=[],de=Bt(K,Yt);if(de.inside&&de.obstacle){let G=de.obstacle;if(Ot){let W=lt(D,O,T,G,!0);K.x=W.x,K.y=W.y,Vt=[{x:W.x,y:W.y},{x:D.x,y:W.y}]}else{let W=lt(D,O,T,G,!1);K.x=W.x,K.y=W.y,Vt=[{x:W.x,y:W.y},{x:W.x,y:D.y}]}}if(Lt.length===0&&Vt.length===0){let G=_e,W=Math.abs(Z.x-K.x)<G,ct=Math.abs(Z.y-K.y)<G,Et=nt.get(`${u}:src`)!==void 0||nt.get(`${u}:dst`)!==void 0,Ht=(w.get(`${C.start??""}:${tt}:src`)?.length??0)+(w.get(`${C.start??""}:${tt}:dst`)?.length??0),Ft=(w.get(`${C.end??""}:${ut}:src`)?.length??0)+(w.get(`${C.end??""}:${ut}:dst`)?.length??0),zt=Ht>1||Ft>1,jt=A.get(C.start??"")??0,Rt=A.get(C.end??"")??0,oe=Ht>1&&j(C.start,tt)||Ft>1&&j(C.end,ut),pe=Ht<=1||jt<=2,Kt=Ft<=1||Rt<=2;if((W||ct)&&!Et&&(!zt||zt&&!oe&&pe&&Kt)){if(!I(N,D,C.start,C.end)){C.points=[{...N},{...Z},{...K},{...D}],g.add(u);let Pt=ct?"horizontal":"vertical",ie=ct?N.y:N.x,kt=ct?Math.min(N.x,D.x):Math.min(N.y,D.y),_t=ct?Math.max(N.x,D.x):Math.max(N.y,D.y),le={id:`fast-path-${Pt}-${ie.toFixed(0)}-${u}`,orientation:Pt,coord:ie,spanMin:kt,spanMax:_t,tracks:[]};m.push({edgeIndex:u,segmentIndex:0,orientation:Pt,pipe:le,trackIndex:0,from:kt,to:_t});continue}}}let Ae=v("vertical",Z.x,Z.y,Z.y);Z.x=Ae.coord;let On=v("vertical",K.x,K.y,K.y);K.x=On.coord;let Re=Math.min(Z.x,K.x)-50,Te=Math.max(Z.x,K.x)+50,Xe=Math.min(Z.y,K.y)-50,Ge=Math.max(Z.y,K.y)+50;for(let G of b){let W=Math.min(Z.x,K.x),ct=Math.max(Z.x,K.x),Et=Math.min(Z.y,K.y),Ht=Math.max(Z.y,K.y);if(G.minX<ct&&G.maxX>W&&G.minY<Ht&&G.maxY>Et)Re=Math.min(Re,G.minX-an),Te=Math.max(Te,G.maxX+an),Xe=Math.min(Xe,G.minY-an),Ge=Math.max(Ge,G.maxY+an)}for(let G of b){if(G.maxX<Re||G.minX>Te||G.maxY<Xe||G.minY>Ge)continue;let W=_e;v("horizontal",G.minY-W,Re,Te),v("horizontal",G.maxY+W,Re,Te);let ct=ze;v("vertical",G.minX-ct,Xe,Ge),v("vertical",G.maxX+ct,Xe,Ge)}v("horizontal",Z.y,Re,Te),v("horizontal",K.y,Re,Te);let hi=l.filter((G)=>G.orientation==="horizontal"&&G.coord>=Xe&&G.coord<=Ge),gi=l.filter((G)=>G.orientation==="vertical"&&G.coord>=Re&&G.coord<=Te),Qe=e((G,W)=>`${G.toFixed(1)},${W.toFixed(1)}`,"getKey"),tn=Qe(Z.x,Z.y),Wo=Qe(K.x,K.y),en=new Map,Nn=new Map,Fn=new Map,nn=new Set,ke=[];en.set(tn,0),Fn.set(tn,"n"),ke.push({key:tn,f:Math.hypot(K.x-Z.x,K.y-Z.y),pt:Z}),nn.add(tn);let ee=[],Oe=e((G,W)=>I(G,W,C.start,C.end),"checkSegmentBlocked"),Bn={x:K.x,y:Z.y},pi=Oe(Z,Bn),mi=Oe(Bn,K),yi=pi||mi,Pn={x:Z.x,y:K.y},xi=Oe(Z,Pn),bi=Oe(Pn,K),Ii=xi||bi;if(!yi)if(Math.abs(Z.y-K.y)<bt||Math.abs(Z.x-K.x)<bt)ee=[Z,K];else ee=[Z,Bn,K];else if(!Ii)if(Math.abs(Z.x-K.x)<bt)ee=[Z,K];else ee=[Z,Pn,K];if(ee.length===0)while(ke.length>0){ke.sort((Rt,oe)=>Rt.f-oe.f);let G=ke.shift();if(nn.delete(G.key),G.key===Wo){let Rt=Wo,oe=K;ee=[oe];while(Nn.has(Rt)){let pe=Nn.get(Rt);ee.unshift(pe),oe=pe,Rt=Qe(pe.x,pe.y)}break}let W=G.pt.x,ct=G.pt.y,Et=gi.sort((Rt,oe)=>Rt.coord-oe.coord),Ht=Et.findIndex((Rt)=>Math.abs(Rt.coord-W)<1),Ft=hi.sort((Rt,oe)=>Rt.coord-oe.coord),zt=Ft.findIndex((Rt)=>Math.abs(Rt.coord-ct)<1),jt=[];if(Ht>0)jt.push({x:Et[Ht-1].coord,y:ct});if(Ht>=0&&Ht<Et.length-1)jt.push({x:Et[Ht+1].coord,y:ct});if(zt>0)jt.push({x:W,y:Ft[zt-1].coord});if(zt>=0&&zt<Ft.length-1)jt.push({x:W,y:Ft[zt+1].coord});for(let Rt of jt){let oe=Math.min(W,Rt.x),pe=Math.max(W,Rt.x),Kt=Math.min(ct,Rt.y),re=Math.max(ct,Rt.y);if(b.some((ue)=>{if(ue.nodeId===C.start||ue.nodeId===C.end)return!1;if(oe!==pe)return ue.minY<ct&&ue.maxY>ct&&ue.maxX>oe&&ue.minX<pe;else return ue.minX<W&&ue.maxX>W&&ue.maxY>Kt&&ue.minY<re}))continue;let Pt=Qe(Rt.x,Rt.y),ie=Math.abs(Rt.x-W)+Math.abs(Rt.y-ct),kt=E(u,G.pt,Rt),_t=0,le=K.x-Z.x,Ye=K.y-Z.y,on=Rt.x-W,kn=Rt.y-ct;if(Ye>10&&kn<-5||Ye<-10&&kn>5)_t=Math.abs(kn)*100;if(le>10&&on<-5||le<-10&&on>5)_t+=Math.abs(on)*50;let Ko=0,qo=Fn.get(G.key)??"n",Zo=Math.abs(on)>bt?"h":"v";if(qo!=="n"&&qo!==Zo)Ko=50;let Mi=ie+kt+_t+Ko,sn=(en.get(G.key)??1/0)+Mi,Jo=Math.abs(K.x-Rt.x)+Math.abs(K.y-Rt.y);if(sn<(en.get(Pt)??1/0))if(Nn.set(Pt,G.pt),en.set(Pt,sn),Fn.set(Pt,Zo),!nn.has(Pt))ke.push({key:Pt,f:sn+Jo,pt:Rt}),nn.add(Pt);else{let ue=ke.findIndex((Si)=>Si.key===Pt);if(ue!==-1)ke[ue].f=sn+Jo}}}if(ee.length===0)ee=[Z,{x:Z.x,y:K.y},K];if(ee.length>4){let G=ee[0],W=ee[ee.length-1],ct=Math.min(G.x,W.x),Et=Math.max(G.x,W.x),Ht=Math.min(G.y,W.y),Ft=Math.max(G.y,W.y);for(let Kt of ee)ct=Math.min(ct,Kt.x),Et=Math.max(Et,Kt.x),Ht=Math.min(Ht,Kt.y),Ft=Math.max(Ft,Kt.y);let zt=Et>Math.max(G.x,W.x),jt=ct<Math.min(G.x,W.x);if(d){let Kt=ze;if(zt){let re=Math.max(G.x,W.x),Wt=Math.min(G.y,W.y),Pt=Math.max(G.y,W.y),ie=b.filter((kt)=>kt.minX<re&&kt.maxX>re&&kt.minY<Pt&&kt.maxY>Wt);if(ie.length>0){let kt=Math.max(G.x,W.x);for(let _t of ie){let le=(_t.minX+_t.maxX)/2;if(_t.visualXHalfExtent===void 0||isNaN(_t.visualXHalfExtent))continue;let Ye=le+_t.visualXHalfExtent+Kt;kt=Math.max(kt,Ye)}if(!isNaN(kt))Et=kt}}if(jt){let re=b.filter((Wt)=>Wt.minX<Math.min(G.x,W.x)+Kt&&Wt.minY<Math.max(G.y,W.y)&&Wt.maxY>Math.min(G.y,W.y));if(re.length>0){let Wt=Math.min(G.x,W.x);for(let Pt of re){let kt=(Pt.minX+Pt.maxX)/2-Pt.visualXHalfExtent-Kt;Wt=Math.min(Wt,kt)}ct=Wt}}}let Rt=e((Kt)=>{let re=W.y>G.y,Wt=b.filter((kt)=>{let _t=Math.min(G.x,W.x)<kt.maxX&&Math.max(G.x,W.x)>kt.minX,le=Math.min(G.y,W.y)<kt.maxY&&Math.max(G.y,W.y)>kt.minY;return _t&&le}),Pt=Wt;if(d&&Wt.length>0){let kt=Wt.filter((_t)=>_t.minX<Kt&&_t.maxX>Kt);if(kt.length>0)Pt=kt}if(Pt.length===0)return W.y;let ie=_e;if(re){let _t=Math.max(...Pt.map((le)=>le.maxY))+ie;if(_t<W.y-bt)return _t}else{let _t=Math.min(...Pt.map((le)=>le.minY))-ie;if(_t>W.y+bt)return _t}return W.y},"findBestReturnY"),oe=e((Kt)=>{let re=Rt(Kt),Wt={x:Kt,y:G.y},Pt={x:Kt,y:re},ie={x:W.x,y:re},kt=Oe(G,Wt),_t=Oe(Wt,Pt),le=Oe(Pt,ie),Ye=re!==W.y?Oe(ie,W):!1;if(!kt&&!_t&&!le&&!Ye){if(Math.abs(re-W.y)<bt)return[G,Wt,Pt,W];return[G,Wt,Pt,ie,W]}return null},"trySimplifyWithDetourX"),pe=zt&&!jt?oe(Et):jt&&!zt?oe(ct):null;if(pe)ee=pe}let ne=[N,...Lt,...ee,...Vt.reverse(),D];if(ne.length>=3){let G=ne[ne.length-1],W=ne[ne.length-2],ct=ne[ne.length-3],Et=Math.abs(ct.y-W.y)<bt&&Math.abs(W.y-G.y)<bt,Ht=Math.abs(ct.x-W.x)<bt&&Math.abs(W.x-G.x)<bt;if(Et){let Ft=Math.sign(W.x-ct.x),zt=Math.sign(G.x-ct.x);if(Ft!==0&&Ft===zt&&Math.abs(W.x-ct.x)>Math.abs(G.x-ct.x))ne.splice(-2,1)}else if(Ht){let Ft=Math.sign(W.y-ct.y),zt=Math.sign(G.y-ct.y);if(Ft!==0&&Ft===zt&&Math.abs(W.y-ct.y)>Math.abs(G.y-ct.y))ne.splice(-2,1)}}let Me=[ne[0]];for(let G=1;G<ne.length-1;G++){if(G===1){Me.push(ne[G]);continue}let W=Me[Me.length-1],ct=ne[G],Et=ne[G+1];if(Math.abs(W.y-ct.y)<bt&&Math.abs(ct.y-Et.y)<bt){let Ht=ct.x>W.x,Ft=Et.x>ct.x;if(Ht!==Ft){Me.push(ct);continue}continue}if(Math.abs(W.x-ct.x)<bt&&Math.abs(ct.x-Et.x)<bt){let Ht=ct.y>W.y,Ft=Et.y>ct.y;if(Ht!==Ft){Me.push(ct);continue}continue}Me.push(ct)}Me.push(ne[ne.length-1]);for(let G=0;G<Me.length-1;G++){let W=Me[G],ct=Me[G+1],Et=Math.abs(W.x-ct.x)<bt?"vertical":"horizontal",Ht=Et==="vertical"?W.x:W.y,Ft=Et==="vertical"?Math.min(W.y,ct.y):Math.min(W.x,ct.x),zt=Et==="vertical"?Math.max(W.y,ct.y):Math.max(W.x,ct.x),jt=v(Et,Ht,Ft,zt),Rt={edgeIndex:u,segmentIndex:G,orientation:Et,pipe:jt,trackIndex:0,from:Ft,to:zt};if(m.push(Rt),L[u].push(m.length-1),!jt.tracks[0])jt.tracks[0]={index:0,coord:jt.coord,segments:[]};jt.tracks[0].segments.push({edgeIndex:u,segmentIndex:G,from:Ft,to:zt})}}let at=e((u,C)=>u.from<C.to&&C.from<u.to,"segmentsOverlap"),pt=e((u,C,T,O)=>{let N=!O.segments.some((tt)=>(tt.edgeIndex!==C.edgeIndex||tt.segmentIndex!==C.segmentIndex)&&at(tt,u)),D=!T.segments.some((tt)=>(tt.edgeIndex!==u.edgeIndex||tt.segmentIndex!==u.segmentIndex)&&at(tt,C));if(N&&D)return u.trackIndex=O.index,C.trackIndex=T.index,T.segments=[...T.segments.filter((tt)=>tt.edgeIndex!==u.edgeIndex||tt.segmentIndex!==u.segmentIndex),{edgeIndex:C.edgeIndex,segmentIndex:C.segmentIndex,from:C.from,to:C.to}],O.segments=[...O.segments.filter((tt)=>tt.edgeIndex!==C.edgeIndex||tt.segmentIndex!==C.segmentIndex),{edgeIndex:u.edgeIndex,segmentIndex:u.segmentIndex,from:u.from,to:u.to}],!0;return!1},"trySwapSegmentsAcrossTracks"),yt=e((u)=>{let C=u.tracks.length;return u.tracks[C]={index:C,coord:u.coord,segments:[]},C},"createNewTrack"),xt=e((u,C)=>{let T=u.pipe.tracks[u.trackIndex];T.segments=T.segments.filter((N)=>N.edgeIndex!==u.edgeIndex||N.segmentIndex!==u.segmentIndex),u.trackIndex=C,u.pipe.tracks[C].segments.push({edgeIndex:u.edgeIndex,segmentIndex:u.segmentIndex,from:u.from,to:u.to})},"moveSegmentToTrack"),vt=e((u,C)=>{let T=L[u.edgeIndex];for(let O of T){let N=m[O];if(N.pipe===u.pipe)xt(N,C)}},"moveSegmentChainToTrack"),Dt=e((u)=>{let C=L[u.edgeIndex],T=C.indexOf(m.indexOf(u)),O=[];if(T>0)O.push(m[C[T-1]]);if(T<C.length-1)O.push(m[C[T+1]]);return O},"getAdjacentSegmentsAlongEdge"),Be=e((u,C)=>{if(u.orientation===C.orientation)return!1;let T=u.orientation==="horizontal"?u:C,O=u.orientation==="horizontal"?C:u;return O.pipe.coord>T.from&&O.pipe.coord<T.to&&T.pipe.coord>O.from&&T.pipe.coord<O.to},"haveAnyCrossing"),Le=e((u,C)=>{for(let T of u.tracks)if(!T.segments.some((N)=>(N.edgeIndex!==C.edgeIndex||N.segmentIndex!==C.segmentIndex)&&at(N,C)))return T.index;return-1},"findAvailableTrack"),we=e((u,C)=>{if(u.trackIndex===C.trackIndex)return at(u,C);let T=Dt(u),O=Dt(C);return T.some((N)=>O.some((D)=>Be(N,D)))},"segmentsConflict"),Pe=e((u,C,T)=>{if(pt(u,C,u.pipe.tracks[u.trackIndex],C.pipe.tracks[C.trackIndex]))return;let O=Le(u.pipe,C);T(C,O!==-1?O:yt(u.pipe))},"resolveTrackConflict"),Je=e((u)=>{let C=0;for(let T=0;T<u.length;T++)for(let O=T+1;O<u.length;O++){let N=u[T],D=u[O];if(N.pipe!==D.pipe)continue;if(we(N,D))C++,Pe(N,D,vt)}return C},"resolveHandleConflicts"),F=new Map,_=e((u)=>{if(F.has(u))return F.get(u);let C=L[u];if(C.length===0){let ut={dest:0,deviation:0,base:0,delta:0};return F.set(u,ut),ut}let O=m[C[0]].pipe.coord,N=O;for(let ut=1;ut<C.length;ut++){let Z=m[C[ut]];if(Z.orientation==="horizontal"){let{from:K,to:Tt}=Z;N=Math.abs(K-O)>Math.abs(Tt-O)?K:Tt;break}}let D=Math.abs(N-O),tt={dest:N,deviation:D,base:O,delta:N-O};return F.set(u,tt),tt},"getDestInfo"),X=e(()=>{let u=0,C=new Map;for(let[O,N]of i.entries()){if(L[O].length===0)continue;if(!N.start)continue;if(!C.has(N.start))C.set(N.start,[]);C.get(N.start).push(O)}let T=e((O)=>{let N=i[O];if(!N.start||!N.end)return 0;let D=c.get(N.start),tt=c.get(N.end);if(!D||!tt)return 0;let ut=(tt.x??0)-(D.x??0),Z=(tt.y??0)-(D.y??0);return Math.abs(ut)+Math.abs(Z)},"getEdgeDistance");for(let O of C.values()){O.sort((D,tt)=>{let ut=_(D),Z=_(tt);if(Math.abs(ut.deviation-Z.deviation)>1)return ut.deviation-Z.deviation;if(Math.abs(ut.dest-Z.dest)>1)return ut.dest-Z.dest;let K=T(D),Tt=T(tt);if(Math.abs(K-Tt)>1)return Tt-K;let Ot=L[D].length,Bt=L[tt].length;if(Ot!==Bt)return Ot-Bt;if(Ot===1){let lt=L[D][0],Lt=L[tt][0];if(m[lt]&&m[Lt]){let Yt=m[lt],ae=m[Lt],Vt=Math.abs(Yt.to-Yt.from),de=Math.abs(ae.to-ae.from);if(Math.abs(Vt-de)>1)return Vt-de}}return 0});let N=O.map((D)=>m[L[D][0]]);u+=Je(N)}return u},"fixSourceHandleCrossings"),q=e(()=>{let u=0,C=new Map;for(let[T,O]of i.entries()){if(L[T].length===0)continue;if(!O.end)continue;if(!C.has(O.end))C.set(O.end,[]);C.get(O.end).push(T)}for(let T of C.values()){T.sort((N,D)=>{let tt=e((K)=>{let Tt=L[K];if(Tt.length<2)return 0;let Ot=m[Tt[Tt.length-2]];return Math.abs(Ot.to-Ot.from)},"getDist"),ut=tt(N),Z=tt(D);if(Math.abs(ut-Z)>0.1)return ut-Z;return N-D});let O=T.map((N)=>m[L[N][L[N].length-1]]);u+=Je(O)}return u},"fixTargetHandleCrossings"),J=e(()=>{let u=0;for(let C of l){let T=[];for(let O of C.tracks)for(let N of O.segments){let D=L[N.edgeIndex].find((tt)=>m[tt].segmentIndex===N.segmentIndex);if(D!==void 0)T.push(m[D])}T.sort((O,N)=>O.edgeIndex-N.edgeIndex||O.segmentIndex-N.segmentIndex);for(let O=0;O<T.length;O++)for(let N=O+1;N<T.length;N++){let D=T[O],tt=T[N];if(we(D,tt))u++,Pe(D,tt,xt)}}return u},"fixPipeCrossings"),rt=0,U=10;while(rt<U){let u=0;if(u+=X(),u+=q(),u+=J(),u===0)break;rt++}let it=new Map;for(let u of l){let C=[];u.tracks.forEach((O)=>{O.segments.forEach((N)=>{C.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:O.index,from:N.from,to:N.to})})}),C.sort((O,N)=>O.from-N.from);let T=[];if(C.length>0){let O=[C[0]],N=C[0].to;for(let D=1;D<C.length;D++){let tt=C[D];if(tt.from<N)O.push(tt),N=Math.max(N,tt.to);else T.push(O),O=[tt],N=tt.to}T.push(O)}for(let O of T){let N=new Set;O.forEach((lt)=>N.add(lt.trackIndex));let D=new Map;O.forEach((lt)=>{let Lt=_(lt.edgeIndex);D.set(lt.trackIndex,(D.get(lt.trackIndex)??0)+Lt.delta)});let tt=[...N].filter((lt)=>(D.get(lt)??0)<-1),ut=[...N].filter((lt)=>(D.get(lt)??0)>1),Z=[...N].filter((lt)=>Math.abs(D.get(lt)??0)<=1);tt.sort((lt,Lt)=>(D.get(Lt)??0)-(D.get(lt)??0)),ut.sort((lt,Lt)=>(D.get(lt)??0)-(D.get(Lt)??0));let K=e((lt,Lt)=>{O.filter((Yt)=>Yt.trackIndex===lt).forEach((Yt)=>{let ae=g.has(Yt.edgeIndex)?u.coord:Lt;it.set(`${Yt.edgeIndex}-${Yt.segmentIndex}`,ae)})},"assignCoord"),Tt=0;for(let lt of tt)Tt++,K(lt,u.coord-Tt*Gn);if(Z.length===0&&N.size>0){let lt=[...N].sort((ae,Vt)=>Math.abs(D.get(ae)??0)-Math.abs(D.get(Vt)??0))[0],Lt=tt.indexOf(lt);if(Lt!==-1)tt.splice(Lt,1);let Yt=ut.indexOf(lt);if(Yt!==-1)ut.splice(Yt,1);Z.push(lt)}let Ot=0;for(let lt of Z){if(Ot===0)K(lt,u.coord);else{let Lt=Ot%2===1?1:-1,Yt=Math.ceil(Ot/2);K(lt,u.coord+Lt*Yt*Gn*0.5)}Ot++}let Bt=0;for(let lt of ut)Bt++,K(lt,u.coord+Bt*Gn)}}for(let[u,C]of i.entries()){let T=L[u]??[];if(T.length===0)continue;let O=[],N=c.get(C.start),D=c.get(C.end),{pSrcPort:tt,pDstPort:ut}=Q(u,N,D),Z=T.map((Bt)=>{let lt=m[Bt],Lt=it.get(`${lt.edgeIndex}-${lt.segmentIndex}`)??lt.pipe.coord;return{orient:lt.orientation,coord:Lt,from:lt.from,to:lt.to}});O.push(tt);for(let Bt=0;Bt<Z.length;Bt++){let lt=Z[Bt],Lt=O[O.length-1],Yt=lt.orient==="vertical"?Lt.y:Lt.x,ae=lt.orient==="vertical"?Lt.x:Lt.y,Vt=Z[Bt+1],de=Bt<Z.length-1;if(Math.abs(ae-lt.coord)>bt)O.push(He(lt,Yt));if(de&&Vt.orient===lt.orient){if(Math.abs(lt.coord-Vt.coord)>bt){let Ae=lt.orient==="vertical"?(Yt+Vt.from)/2:Co(lt,Vt);O.push(He(lt,Ae),He(Vt,Ae))}else if(Bt===0||Bt===Z.length-2)O.push(He(lt,Co(lt,Vt)))}else if(de)O.push(He(lt,Vt.coord));else{let Ae=Math.abs(lt.from-Yt)<Math.abs(lt.to-Yt)?lt.to:lt.from;O.push(He(lt,Ae))}}let K=O[O.length-1];if(Math.abs(K.x-ut.x)>bt||Math.abs(K.y-ut.y)>bt)O.push(ut);let Tt=O[0];if(Tt&&(Math.abs(Tt.x-tt.x)>bt||Math.abs(Tt.y-tt.y)>bt))O.unshift(tt);let Ot=[];if(O.length>0)Ot.push(O[0]);for(let Bt=1;Bt<O.length;Bt++){let lt=O[Bt],Lt=Ot[Ot.length-1];if(Math.abs(lt.x-Lt.x)>bt||Math.abs(lt.y-Lt.y)>bt)Ot.push(lt)}C.points=Ot}for(let u of i){let C=u.__originalEdge;if(C&&u.points)C.points=u.points}t.edges=(t.edges??[]).filter((u)=>!u.isLayoutOnly);let gt=e((u,C)=>{let T=C.x??0,O=C.y??0,{w:N,h:D}=dn(C,0);if(N<=0||D<=0)return u;let tt=T-N/2,ut=T+N/2,Z=O-D/2,K=O+D/2;if(u.x<tt||u.x>ut||u.y<Z||u.y>K)return u;let Tt=u.x-tt,Ot=ut-u.x,Bt=u.y-Z,lt=K-u.y,Lt=Math.min(Tt,Ot,Bt,lt);if(Lt===Tt)return{x:tt,y:u.y};if(Lt===Ot)return{x:ut,y:u.y};if(Lt===Bt)return{x:u.x,y:Z};return{x:u.x,y:K}},"nodeBoundaryClamp");for(let u of t.edges){let C=u.points;if(!C||C.length<2)continue;let{start:T,end:O}=u,N=T?c.get(T):void 0,D=O?c.get(O):void 0;if(N)C[0]=gt(C[0],N);if(D)C[C.length-1]=gt(C[C.length-1],D)}return t}e(li,"routeEdgesOrthogonal");function fi(t){return t.direction??"TB"}e(fi,"getSwimlaneDirection");function di(t){let o=vs(t),s=t.config.flowchart?.nodeSpacing??40,r=t.config.flowchart?.rankSpacing??100,i=t.config.swimlane?.ignoreCrossLaneEdges??!0,c=t.config.swimlane?.optimizeRanksByCrossings??!0,a=t.config.swimlane?.automaticLaneOrdering??!1,l=fi(t),{ordered:d,coordinates:h}=ai(o,{nodeGap:s,layerGap:r,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:c,automaticLaneOrdering:a,direction:l});Ls(o,d,h,{nodeGap:s,layerGap:r});for(let y of t.edges??[])delete y.points;li(t,l);for(let y of t.edges??[])if(!y.curve||y.curve==="basis")y.curve="rounded";return wr(t,l),Cr(t),l}e(di,"runSwimlaneLayoutCore");function ui(t){Ss(t);let o=ws(t);t.nodes=o.nodes,t.edges=o.edges}e(ui,"prepareSwimlaneLayout");var rc=ot({prepareLayout:ui,runLayoutCore:di,afterPaint:cs});export{rc as render};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import"./index.153rcscj.js";import{e}from"./index.fgsp5qqn.js";import"./index.23p1k2rx.js";import{cs,us}from"./index.x1xqs5m5.js";import"./index.eec12m3n.js";import"./index.gqa9s37g.js";import"./index.h6120080.js";var r=e((t)=>`${cs(t)}
|
|
2
|
+
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
+
stroke: ${t.clusterBorder} !important;
|
|
4
|
+
}
|
|
5
|
+
[data-look="neo"].cluster rect {
|
|
6
|
+
filter: none;
|
|
7
|
+
}
|
|
8
|
+
`,"getStyles"),o=r,F=us({styles:o});export{F as diagram};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import{e,dr,n,ae,h,p,k,Tt,to,A,u,m,Qt,Y,he,tt,Qe}from"./index.fgsp5qqn.js";var ht=function(){var r=e(function(E,o,f,d){for(f=f||{},d=E.length;d--;f[E[d]]=o);return f},"o"),t=[6,11,13,14,15,17,19,20,23,24],a=[1,12],s=[1,13],i=[1,14],g=[1,15],c=[1,16],l=[1,19],_=[1,20],b={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:e(function(o,f,d,x,w,y,I){var T=y.length-1;switch(w){case 1:return y[T-1];case 3:x.setDirection("LR");break;case 4:x.setDirection("TD");break;case 5:this.$=[];break;case 6:y[T-1].push(y[T]),this.$=y[T-1];break;case 7:case 8:this.$=y[T];break;case 9:case 10:this.$=[];break;case 11:x.getCommonDb().setDiagramTitle(y[T].substr(6)),this.$=y[T].substr(6);break;case 12:this.$=y[T].trim(),x.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=y[T].trim(),x.getCommonDb().setAccDescription(this.$);break;case 15:x.addSection(y[T].substr(8)),this.$=y[T].substr(8);break;case 18:x.addTask(y[T],0,""),this.$=y[T];break;case 19:x.addEvent(y[T].substr(2)),this.$=y[T];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},r(t,[2,5],{5:6}),r(t,[2,2]),r(t,[2,3]),r(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:a,15:s,17:i,19:g,20:c,21:17,22:18,23:l,24:_},r(t,[2,10],{1:[2,1]}),r(t,[2,6]),{12:21,14:a,15:s,17:i,19:g,20:c,21:17,22:18,23:l,24:_},r(t,[2,8]),r(t,[2,9]),r(t,[2,11]),{16:[1,22]},{18:[1,23]},r(t,[2,14]),r(t,[2,15]),r(t,[2,16]),r(t,[2,17]),r(t,[2,18]),r(t,[2,19]),r(t,[2,7]),r(t,[2,12]),r(t,[2,13])],defaultActions:{},parseError:e(function(o,f){if(f.recoverable)this.trace(o);else{var d=Error(o);throw d.hash=f,d}},"parseError"),parse:e(function(o){var f=this,d=[0],x=[],w=[null],y=[],I=this.table,T="",W=0,G=0,D=0,q=2,B=1,O=y.slice.call(arguments,1),L=Object.create(this.lexer),F={yy:{}};for(var U in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,U))F.yy[U]=this.yy[U];if(L.setInput(o,F.yy),F.yy.lexer=L,F.yy.parser=this,typeof L.yylloc>"u")L.yylloc={};var J=L.yylloc;y.push(J);var C=L.options&&L.options.ranges;if(typeof F.yy.parseError==="function")this.parseError=F.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function N(K){d.length=d.length-2*K,w.length=w.length-K,y.length=y.length-K}e(N,"popStack");function M(){var K=x.pop()||L.lex()||B;if(typeof K!=="number"){if(K instanceof Array)x=K,K=x.pop();K=f.symbols_[K]||K}return K}e(M,"lex");var H,P,V,R,lt,rt,j={},nt,X,mt,it;while(!0){if(V=d[d.length-1],this.defaultActions[V])R=this.defaultActions[V];else{if(H===null||typeof H>"u")H=M();R=I[V]&&I[V][H]}if(typeof R>"u"||!R.length||!R[0]){var ct="";it=[];for(nt in I[V])if(this.terminals_[nt]&&nt>q)it.push("'"+this.terminals_[nt]+"'");if(L.showPosition)ct="Parse error on line "+(W+1)+`:
|
|
2
|
+
`+L.showPosition()+`
|
|
3
|
+
Expecting `+it.join(", ")+", got '"+(this.terminals_[H]||H)+"'";else ct="Parse error on line "+(W+1)+": Unexpected "+(H==B?"end of input":"'"+(this.terminals_[H]||H)+"'");this.parseError(ct,{text:L.match,token:this.terminals_[H]||H,line:L.yylineno,loc:J,expected:it})}if(R[0]instanceof Array&&R.length>1)throw Error("Parse Error: multiple actions possible at state: "+V+", token: "+H);switch(R[0]){case 1:if(d.push(H),w.push(L.yytext),y.push(L.yylloc),d.push(R[1]),H=null,!P){if(G=L.yyleng,T=L.yytext,W=L.yylineno,J=L.yylloc,D>0)D--}else H=P,P=null;break;case 2:if(X=this.productions_[R[1]][1],j.$=w[w.length-X],j._$={first_line:y[y.length-(X||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(X||1)].first_column,last_column:y[y.length-1].last_column},C)j._$.range=[y[y.length-(X||1)].range[0],y[y.length-1].range[1]];if(rt=this.performAction.apply(j,[T,G,W,F.yy,R[1],w,y].concat(O)),typeof rt<"u")return rt;if(X)d=d.slice(0,-1*X*2),w=w.slice(0,-1*X),y=y.slice(0,-1*X);d.push(this.productions_[R[1]][0]),w.push(j.$),y.push(j._$),mt=I[d[d.length-2]][d[d.length-1]],d.push(mt);break;case 3:return!0}}return!0},"parse")},S=function(){var E={EOF:1,parseError:e(function(f,d){if(this.yy.parser)this.yy.parser.parseError(f,d);else throw Error(f)},"parseError"),setInput:e(function(o,f){if(this.yy=f||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:e(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var f=o.match(/(?:\r\n?|\n).*/g);if(f)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),o},"input"),unput:e(function(o){var f=o.length,d=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-f),this.offset-=f;var x=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),d.length-1)this.yylineno-=d.length-1;var w=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:d?(d.length===x.length?this.yylloc.first_column:0)+x[x.length-d.length].length-d[0].length:this.yylloc.first_column-f},this.options.ranges)this.yylloc.range=[w[0],w[0]+this.yyleng-f];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(o){this.unput(this.match.slice(o))},"less"),pastInput:e(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var o=this.match;if(o.length<20)o+=this._input.substr(0,20-o.length);return(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var o=this.pastInput(),f=Array(o.length+1).join("-");return o+this.upcomingInput()+`
|
|
5
|
+
`+f+"^"},"showPosition"),test_match:e(function(o,f){var d,x,w;if(this.options.backtrack_lexer){if(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)w.yylloc.range=this.yylloc.range.slice(0)}if(x=o[0].match(/(?:\r\n?|\n).*/g),x)this.yylineno+=x.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+o[0].length},this.yytext+=o[0],this.match+=o[0],this.matches=o,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(o[0].length),this.matched+=o[0],d=this.performAction.call(this,this.yy,this,f,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(d)return d;else if(this._backtrack){for(var y in w)this[y]=w[y];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var o,f,d,x;if(!this._more)this.yytext="",this.match="";var w=this._currentRules();for(var y=0;y<w.length;y++)if(d=this._input.match(this.rules[w[y]]),d&&(!f||d[0].length>f[0].length)){if(f=d,x=y,this.options.backtrack_lexer)if(o=this.test_match(d,w[y]),o!==!1)return o;else if(this._backtrack){f=!1;continue}else return!1;else if(!this.options.flex)break}if(f){if(o=this.test_match(f,w[x]),o!==!1)return o;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var f=this.next();if(f)return f;else return this.lex()},"lex"),begin:e(function(f){this.conditionStack.push(f)},"begin"),popState:e(function(){var f=this.conditionStack.length-1;if(f>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(f){if(f=this.conditionStack.length-1-Math.abs(f||0),f>=0)return this.conditionStack[f];else return"INITIAL"},"topState"),pushState:e(function(f){this.begin(f)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(f,d,x,w){var y=w;switch(x){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return E}();b.lexer=S;function v(){this.yy={}}return e(v,"Parser"),v.prototype=b,b.Parser=v,new v}();ht.parser=ht;var Ot=ht,wt={};dr(wt,{addEvent:()=>Ct,addSection:()=>Ht,addTask:()=>At,addTaskOrg:()=>Rt,clear:()=>$t,default:()=>Gt,getCommonDb:()=>Et,getDirection:()=>It,getSections:()=>Lt,getTasks:()=>Mt,setDirection:()=>Nt});var Q="",St=0,ut="LR",pt=[],st=[],et=[],Et=e(()=>to,"getCommonDb"),$t=e(function(){pt.length=0,st.length=0,Q="",et.length=0,ut="LR",A()},"clear"),Nt=e(function(r){ut=r},"setDirection"),It=e(function(){return ut},"getDirection"),Ht=e(function(r){Q=r,pt.push(r)},"addSection"),Lt=e(function(){return pt},"getSections"),Mt=e(function(){let r=kt(),t=100,a=0;while(!r&&a<t)r=kt(),a++;return st.push(...et),st},"getTasks"),At=e(function(r,t,a){let s={id:St++,section:Q,type:Q,task:r,score:t?t:0,events:a?[a]:[]};et.push(s)},"addTask"),Ct=e(function(r){et.find((a)=>a.id===St-1).events.push(r)},"addEvent"),Rt=e(function(r){let t={section:Q,type:Q,description:r,task:r,classes:[]};st.push(t)},"addTaskOrg"),kt=e(function(){let r=e(function(a){return et[a].processed},"compileTask"),t=!0;for(let[a,s]of et.entries())r(a),t=t&&s.processed;return t},"compileTasks"),Gt={clear:$t,getCommonDb:Et,getDirection:It,setDirection:Nt,addSection:Ht,getSections:Lt,getTasks:Mt,addTask:At,addTaskOrg:Rt,addEvent:Ct},Wt=0,at=e(function(r,t){let a=r.append("rect");if(a.attr("x",t.x),a.attr("y",t.y),a.attr("fill",t.fill),a.attr("stroke",t.stroke),a.attr("width",t.width),a.attr("height",t.height),a.attr("rx",t.rx),a.attr("ry",t.ry),t.class!==void 0)a.attr("class",t.class);return a},"drawRect"),Dt=e(function(r,t){let s=r.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),i=r.append("g");i.append("circle").attr("cx",t.cx-5).attr("cy",t.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),i.append("circle").attr("cx",t.cx+5).attr("cy",t.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function g(_){let b=Qt().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);_.append("path").attr("class","mouth").attr("d",b).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}e(g,"smile");function c(_){let b=Qt().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);_.append("path").attr("class","mouth").attr("d",b).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}e(c,"sad");function l(_){_.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}if(e(l,"ambivalent"),t.score>3)g(i);else if(t.score<3)c(i);else l(i);return s},"drawFace"),Kt=e(function(r,t){let a=r.append("circle");if(a.attr("cx",t.cx),a.attr("cy",t.cy),a.attr("class","actor-"+t.pos),a.attr("fill",t.fill),a.attr("stroke",t.stroke),a.attr("r",t.r),a.class!==void 0)a.attr("class",a.class);if(t.title!==void 0)a.append("title").text(t.title);return a},"drawCircle"),Pt=e(function(r,t){let a=t.text.replace(/<br\s*\/?>/gi," "),s=r.append("text");if(s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class!==void 0)s.attr("class",t.class);let i=s.append("tspan");return i.attr("x",t.x+t.textMargin*2),i.text(a),s},"drawText"),Ut=e(function(r,t){function a(i,g,c,l,_){return i+","+g+" "+(i+c)+","+g+" "+(i+c)+","+(g+l-_)+" "+(i+c-_*1.2)+","+(g+l)+" "+i+","+(g+l)}e(a,"genPoints");let s=r.append("polygon");s.attr("points",a(t.x,t.y,50,20,7)),s.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+0.5*t.labelMargin,Pt(r,t)},"drawLabel"),Xt=e(function(r,t,a){let s=r.append("g"),i=gt();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=a.width,i.height=a.height,i.class="journey-section section-type-"+t.num,i.rx=3,i.ry=3,at(s,i),Bt(a)(t.text,s,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+t.num},a,t.colour)},"drawSection"),dt=-1,Zt=e(function(r,t,a,s){let i=t.x+a.width/2,g=r.append("g");dt++;let c=450;g.append("line").attr("id",s+"-task"+dt).attr("x1",i).attr("y1",t.y).attr("x2",i).attr("y2",c).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Dt(g,{cx:i,cy:300+(5-t.score)*30,score:t.score});let l=gt();l.x=t.x,l.y=t.y,l.fill=t.fill,l.width=a.width,l.height=a.height,l.class="task task-type-"+t.num,l.rx=3,l.ry=3,at(g,l),Bt(a)(t.task,g,l.x,l.y,l.width,l.height,{class:"task"},a,t.colour)},"drawTask"),jt=e(function(r,t){at(r,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),qt=e(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),gt=e(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Bt=function(){function r(i,g,c,l,_,b,S,v){let E=g.append("text").attr("x",c+_/2).attr("y",l+b/2+5).style("font-color",v).style("text-anchor","middle").text(i);s(E,S)}e(r,"byText");function t(i,g,c,l,_,b,S,v,E){let{taskFontSize:o,taskFontFamily:f}=v,d=i.split(/<br\s*\/?>/gi);for(let x=0;x<d.length;x++){let w=x*o-o*(d.length-1)/2,y=g.append("text").attr("x",c+_/2).attr("y",l).attr("fill",E).style("text-anchor","middle").style("font-size",o).style("font-family",f);y.append("tspan").attr("x",c+_/2).attr("dy",w).text(d[x]),y.attr("y",l+b/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),s(y,S)}}e(t,"byTspan");function a(i,g,c,l,_,b,S,v){let E=g.append("switch"),f=E.append("foreignObject").attr("x",c).attr("y",l).attr("width",_).attr("height",b).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");f.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(i),t(i,E,c,l,_,b,S,v),s(f,S)}e(a,"byFo");function s(i,g){for(let c in g)if(c in g)i.attr(c,g[c])}return e(s,"_setTextAttrs"),function(i){return i.textPlacement==="fo"?a:i.textPlacement==="old"?r:t}}(),Jt=e(function(r,t){Wt=0,dt=-1,r.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function ft(r,t){r.each(function(){var a=m(this),s=a.text().split(/(\s+|<br>)/).reverse(),i,g=[],c=1.1,l=a.attr("y"),_=parseFloat(a.attr("dy")),b=a.text(null).append("tspan").attr("x",0).attr("y",l).attr("dy",_+"em");for(let S=0;S<s.length;S++)if(i=s[s.length-1-S],g.push(i),b.text(g.join(" ").trim()),b.node().getComputedTextLength()>t||i==="<br>"){if(g.pop(),b.text(g.join(" ").trim()),i==="<br>")g=[""];else g=[i];b=a.append("tspan").attr("x",0).attr("y",l).attr("dy",c+"em").text(i)}})}e(ft,"wrap");var Yt=e(function(r,t,a,s,i,g=!1){let{theme:c,look:l}=s,_=c?.includes("redux"),b=s?.themeVariables?.THEME_COLOR_LIMIT??12,S=a%b-1,v=r.append("g");t.section=S,v.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+S));let E=v.append("g"),o=v.append("g"),d=o.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ft,t.width).node().getBBox(),x=s.fontSize?.replace?s.fontSize.replace("px",""):s.fontSize;if(t.height=d.height+x*1.1*0.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,o.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),_)o.attr("transform",`translate(${t.width/2}, ${g?t.padding/2+3:t.padding})`);if(ee(E,t,S,i,s),l==="neo"){if(v.attr("data-look","neo"),_){let w=c.includes("dark"),y=r.node()?.ownerSVGElement??r.node(),I=m(y),T=I.attr("id")??"",W=T?`${T}-drop-shadow`:"drop-shadow";if(I.select(`#${W}`).empty()){let G=I.select("defs");(G.empty()?I.append("defs"):G).append("filter").attr("id",W).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",w?"0.2":"0.06").attr("flood-color",w?"#FFFFFF":"#000000")}}}return t},"drawNode"),te=e(function(r,t,a){let s=r.append("g"),g=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ft,t.width).node().getBBox(),c=a.fontSize?.replace?a.fontSize.replace("px",""):a.fontSize;return s.remove(),g.height+c*1.1*0.5+t.padding},"getVirtualNodeHeight"),ee=e(function(r,t,a,s,i){let{theme:g}=i,c=g?.includes("redux")?0:5,l=5,_=c>0?`M0 ${t.height-5} v${-t.height+10} q0,-${c},${c},-${c} h${t.width-10} q${c},0,${c},${c} v${t.height-5} H0 Z`:`M0 ${t.height-5} v${-(t.height-5)} h${t.width} v${t.height} H0 Z`;if(r.append("path").attr("id",s+"-node-"+Wt++).attr("class","node-bkg node-"+t.type).attr("d",_),!g?.includes("redux"))r.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),z={drawRect:at,drawCircle:Kt,drawSection:Xt,drawText:Pt,drawLabel:Ut,drawTask:Zt,drawBackgroundRect:jt,getTextObj:qt,getNoteRect:gt,initGraphics:Jt,drawNode:Yt,getVirtualNodeHeight:te},re=e(function(r,t,a,s){let i=u(),{look:g,theme:c,themeVariables:l}=i,{useGradient:_,gradientStart:b,gradientStop:S}=l,v=i.timeline?.leftMargin??50;n.debug("timeline",s.db);let E=i.securityLevel,o;if(E==="sandbox")o=m("#i"+t);let d=(E==="sandbox"?m(o.nodes()[0].contentDocument.body):m("body")).select("#"+t);d.append("g");let x=s.db.getTasks(),w=s.db.getCommonDb().getDiagramTitle();n.debug("task",x),z.initGraphics(d,t);let y=s.db.getSections();n.debug("sections",y);let I=0,T=0,W=0,G=0,D=50+v,q=50;G=50;let B=0,O=!0;y.forEach(function(C){let N={number:B,descr:C,section:B,width:150,padding:20,maxHeight:I},M=z.getVirtualNodeHeight(d,N,i);n.debug("sectionHeight before draw",M),I=Math.max(I,M+20)});let L=0,F=0;n.debug("tasks.length",x.length);for(let[C,N]of x.entries()){let M={number:C,descr:N,section:N.section,width:150,padding:20,maxHeight:T},H=z.getVirtualNodeHeight(d,M,i);n.debug("taskHeight before draw",H),T=Math.max(T,H+20),L=Math.max(L,N.events.length);let P=0;for(let V of N.events){let R={descr:V,section:N.section,number:N.section,width:150,padding:20,maxHeight:50};P+=z.getVirtualNodeHeight(d,R,i)}if(N.events.length>0)P+=(N.events.length-1)*10;F=Math.max(F,P)}if(n.debug("maxSectionHeight before draw",I),n.debug("maxTaskHeight before draw",T),y&&y.length>0)y.forEach((C)=>{let N=x.filter((V)=>V.section===C),M={number:B,descr:C,section:B,width:200*Math.max(N.length,1)-50,padding:20,maxHeight:I};n.debug("sectionNode",M);let H=d.append("g"),P=z.drawNode(H,M,B,i,t);if(n.debug("sectionNode output",P),H.attr("transform",`translate(${D}, ${G})`),q+=I+50,N.length>0)xt(d,N,B,D,q,T,i,L,F,I,!1,t);D+=200*Math.max(N.length,1),q=G,B++});else O=!1,xt(d,x,B,D,q,T,i,L,F,I,!0,t);let U=d.node().getBBox();if(n.debug("bounds",U),w)d.append("text").text(w).attr("x",g==="neo"?U.x*2+v:U.width/2-v).attr("font-size","4ex").attr("font-weight","bold").attr("y",20);if(W=O?I+T+150:T+100,d.append("g").attr("class","lineWrapper").append("line").attr("x1",v).attr("y1",W).attr("x2",U.width+3*v).attr("y2",W).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),g==="neo"&&_&&c!=="neutral"){let C=d.select("defs"),M=(C.empty()?d.append("defs"):C).append("linearGradient").attr("id",d.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");M.append("stop").attr("offset","0%").attr("stop-color",b).attr("stop-opacity",1),M.append("stop").attr("offset","100%").attr("stop-color",S).attr("stop-opacity",1)}Tt(void 0,d,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),xt=e(function(r,t,a,s,i,g,c,l,_,b,S,v){for(let E of t){let o={descr:E.task,section:a,number:a,width:150,padding:20,maxHeight:g};n.debug("taskNode",o);let f=r.append("g").attr("class","taskWrapper"),x=z.drawNode(f,o,a,c,v).height;if(n.debug("taskHeight after draw",x),f.attr("transform",`translate(${s}, ${i})`),g=Math.max(g,x),E.events){let w=r.append("g").attr("class","lineWrapper"),y=g;i+=100,y=y+ne(r,E.events,a,s,i,c,v),i-=100,w.append("line").attr("x1",s+95).attr("y1",i+g).attr("x2",s+95).attr("y2",i+g+100+_+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${v}-arrowhead)`).attr("stroke-dasharray","5,5")}if(s=s+200,S&&!c.timeline?.disableMulticolor)a++}i=i-10},"drawTasks"),ne=e(function(r,t,a,s,i,g,c){let l=0,_=i;i=i+100;for(let b of t){let S={descr:b,section:a,number:a,width:150,padding:20,maxHeight:50};n.debug("eventNode",S);let v=r.append("g").attr("class","eventWrapper"),o=z.drawNode(v,S,a,g,c,!0).height;l=l+o,v.attr("transform",`translate(${s}, ${i})`),i=i+10+o}return i=_,l},"drawEvents"),ie={setConf:e(()=>{},"setConf"),draw:re},ot=200,Z=5,se=ot+Z*2,yt=ot+100,oe=yt+Z*2,Vt=10,le=0,bt=20,Ft=20,vt=30,zt=50,ce=e(function(r,t,a,s){let i=u(),g=i.timeline?.leftMargin??50;n.debug("timeline",s.db);let c=Y(t);c.append("g");let l=s.db.getTasks(),_=s.db.getCommonDb().getDiagramTitle();n.debug("task",l),z.initGraphics(c);let b=s.db.getSections();n.debug("sections",b);let S=0,v=0,E=50+g,o=50,f=o,d=E,x=se+Ft,w=oe+zt,y=d+x,I=0,T=b&&b.length>0,W=T?y:E+x,G=Math.max(50,x+w-Z*2);b.forEach(function(C){let N={number:I,descr:C,section:I,width:G,padding:Z,maxHeight:S},M=z.getVirtualNodeHeight(c,N,i);n.debug("sectionHeight before draw",M),S=Math.max(S,M)});let D=0;n.debug("tasks.length",l.length);for(let[C,N]of l.entries()){let M={number:C,descr:N,section:N.section,width:ot,padding:Z,maxHeight:v},H=z.getVirtualNodeHeight(c,M,i);n.debug("taskHeight before draw",H),v=Math.max(v,H);let P=0;for(let V of N.events){let R={descr:V,section:N.section,number:N.section,width:yt,padding:Z,maxHeight:50};P+=z.getVirtualNodeHeight(c,R,i)}if(N.events.length>0)P+=(N.events.length-1)*Vt;D=Math.max(D,P)+le}n.debug("maxSectionHeight before draw",S),n.debug("maxTaskHeight before draw",v);let B=Math.max(v,D)+vt;if(T)b.forEach((C)=>{let N=l.filter((j)=>j.section===C),M={number:I,descr:C,section:I,width:G,padding:Z,maxHeight:S};n.debug("sectionNode",M);let H=c.append("g"),P=z.drawNode(H,M,I,i);n.debug("sectionNode output",P);let V=W-x;H.attr("transform",`translate(${V}, ${o})`);let R=o+P.height+bt;if(N.length>0)_t(c,N,I,W,R,v,i,B,!1);let lt=N.length,rt=P.height+bt+B*Math.max(lt,1)-(lt>0?vt*2:0);o+=rt,I++});else _t(c,l,I,W,o,v,i,B,!0);let O=c.node()?.getBBox();if(!O)throw Error("bbox not found");if(n.debug("bounds",O),_){if(c.append("text").text(_).attr("x",O.width/2-g).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),O=c.node()?.getBBox(),!O)throw Error("bbox not found");n.debug("bounds after title",O)}let[L]=Qe(i.fontSize),F=(L??16)*2,U=(L??16)*0.5+20,J=c.append("g").attr("class","lineWrapper");J.append("line").attr("x1",W).attr("y1",f-F).attr("x2",W).attr("y2",O.y+O.height+U).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),J.lower(),Tt(void 0,c,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),_t=e(function(r,t,a,s,i,g,c,l,_){for(let b of t){let S={descr:b.task,section:a,number:a,width:ot,padding:Z,maxHeight:g};n.debug("taskNode",S);let v=r.append("g").attr("class","taskWrapper"),E=z.drawNode(v,S,a,c),o=E.height;n.debug("taskHeight after draw",o);let f=s-Ft-E.width;if(v.attr("transform",`translate(${f}, ${i})`),g=Math.max(g,o),b.events&&b.events.length>0){let d=i,x=s+zt;de(r,b.events,a,s,x,d,c)}if(i=i+l,_&&!c.timeline?.disableMulticolor)a++}},"drawTasks"),de=e(function(r,t,a,s,i,g,c){let l=g;for(let _ of t){let b={descr:_,section:a,number:a,width:yt,padding:Z,maxHeight:0};n.debug("eventNode",b);let S=r.append("g").attr("class","eventWrapper"),E=z.drawNode(S,b,a,c).height;S.attr("transform",`translate(${i}, ${l})`);let o=r.append("g").attr("class","lineWrapper"),f=l+E/2;o.append("line").attr("x1",s).attr("y1",f).attr("x2",i).attr("y2",f).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),l=l+E+Vt}return l-g},"drawEvents"),ue={setConf:e(()=>{},"setConf"),draw:ce},pe=e((r)=>{let{theme:t}=k(),a=t?.includes("dark"),s=he(t,r.borderColorArray),i=r.svgId?.replace(/^#/,"")??"",g=i?`url(#${i}-drop-shadow)`:r.dropShadow??"none",c="";for(let l=0;l<tt(r.THEME_COLOR_LIMIT);l++){let _=`${17-3*l}`,b=s?r.borderColorArray[l%r.borderColorArray.length]:void 0,S=b??r.mainBkg,v=b??r.nodeBorder;c+=`
|
|
7
|
+
.section-${l-1} rect,
|
|
8
|
+
.section-${l-1} path,
|
|
9
|
+
.section-${l-1} circle {
|
|
10
|
+
fill: ${a&&s?r.mainBkg:S};
|
|
11
|
+
stroke: ${v};
|
|
12
|
+
stroke-width: ${r.strokeWidth};
|
|
13
|
+
filter: ${g};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.section-${l-1} text {
|
|
17
|
+
fill: ${r.nodeBorder};
|
|
18
|
+
font-weight: ${r.fontWeight}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.node-icon-${l-1} {
|
|
22
|
+
font-size: 40px;
|
|
23
|
+
color: ${r["cScaleLabel"+l]};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.section-edge-${l-1} {
|
|
27
|
+
stroke: ${r["cScale"+l]};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.edge-depth-${l-1} {
|
|
31
|
+
stroke-width: ${_};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.section-${l-1} line {
|
|
35
|
+
stroke: ${r["cScaleInv"+l]};
|
|
36
|
+
stroke-width: 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.lineWrapper line {
|
|
40
|
+
stroke: ${r.nodeBorder};
|
|
41
|
+
stroke-width:${r.strokeWidth}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.disabled,
|
|
45
|
+
.disabled circle,
|
|
46
|
+
.disabled text {
|
|
47
|
+
fill: ${r.tertiaryColor??"lightgray"};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.disabled text {
|
|
51
|
+
fill: ${r.clusterBorder??"#efefef"};
|
|
52
|
+
}
|
|
53
|
+
`}return c},"genReduxSections"),ge=e((r)=>{let t="",a=tt(r.THEME_COLOR_LIMIT);for(let s=0;s<a;s++)if(r["lineColor"+s]=r["lineColor"+s]??r["cScaleInv"+s],ae(r["lineColor"+s]))r["lineColor"+s]=h(r["lineColor"+s],20);else r["lineColor"+s]=p(r["lineColor"+s],20);for(let s=0;s<a;s++){let i=""+(17-3*s);t+=`
|
|
54
|
+
.section-${s-1} rect, .section-${s-1} path, .section-${s-1} circle, .section-${s-1} path {
|
|
55
|
+
fill: ${r["cScale"+s]};
|
|
56
|
+
}
|
|
57
|
+
.section-${s-1} text {
|
|
58
|
+
fill: ${r["cScaleLabel"+s]};
|
|
59
|
+
}
|
|
60
|
+
.node-icon-${s-1} {
|
|
61
|
+
font-size: 40px;
|
|
62
|
+
color: ${r["cScaleLabel"+s]};
|
|
63
|
+
}
|
|
64
|
+
.section-edge-${s-1}{
|
|
65
|
+
stroke: ${r["cScale"+s]};
|
|
66
|
+
}
|
|
67
|
+
.edge-depth-${s-1}{
|
|
68
|
+
stroke-width: ${i};
|
|
69
|
+
}
|
|
70
|
+
.section-${s-1} line {
|
|
71
|
+
stroke: ${r["cScaleInv"+s]} ;
|
|
72
|
+
stroke-width: 3;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.lineWrapper line{
|
|
76
|
+
stroke: ${r["cScaleLabel"+s]} ;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.disabled, .disabled circle, .disabled text {
|
|
80
|
+
fill: ${r.tertiaryColor??"lightgray"};
|
|
81
|
+
}
|
|
82
|
+
.disabled text {
|
|
83
|
+
fill: ${r.clusterBorder??"#efefef"};
|
|
84
|
+
}
|
|
85
|
+
`}return t},"genSections"),fe=e((r)=>{let{theme:t}=k(),a=t?.includes("redux"),s=t==="neutral",i=r.svgId?.replace(/^#/,"")??"",g="";if(r.useGradient&&i&&r.THEME_COLOR_LIMIT&&!s){let c=tt(r.THEME_COLOR_LIMIT);for(let l=0;l<c;l++)g+=`
|
|
86
|
+
.section-${l-1}[data-look="neo"] rect,
|
|
87
|
+
.section-${l-1}[data-look="neo"] path,
|
|
88
|
+
.section-${l-1}[data-look="neo"] circle {
|
|
89
|
+
fill: ${r.mainBkg};
|
|
90
|
+
stroke: url(#${i}-gradient);
|
|
91
|
+
stroke-width: 2;
|
|
92
|
+
}
|
|
93
|
+
.section-${l-1}[data-look="neo"] line {
|
|
94
|
+
stroke: url(#${i}-gradient);
|
|
95
|
+
stroke-width: 2;
|
|
96
|
+
}`}return`
|
|
97
|
+
.edge {
|
|
98
|
+
stroke-width: 3;
|
|
99
|
+
}
|
|
100
|
+
${a?pe(r):ge(r)}
|
|
101
|
+
${g}
|
|
102
|
+
.section-root rect, .section-root path, .section-root circle {
|
|
103
|
+
fill: ${r.git0};
|
|
104
|
+
}
|
|
105
|
+
.section-root text {
|
|
106
|
+
fill: ${r.gitBranchLabel0};
|
|
107
|
+
}
|
|
108
|
+
.icon-container {
|
|
109
|
+
height:100%;
|
|
110
|
+
display: flex;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
.edge {
|
|
115
|
+
fill: none;
|
|
116
|
+
}
|
|
117
|
+
.eventWrapper {
|
|
118
|
+
filter: brightness(120%);
|
|
119
|
+
}
|
|
120
|
+
`},"getStyles"),ye=fe,me={setConf:e(()=>{},"setConf"),draw:e((r,t,a,s)=>{if((s?.db?.getDirection?.()??"LR")==="TD")return ue.draw(r,t,a,s);return ie.draw(r,t,a,s)},"draw")},$e={db:wt,renderer:me,parser:Ot,styles:ye};export{$e as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rs}from"./index.9zhger75.js";export{rs as createTreeViewServices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Yo}from"./index.9zhger75.js";export{Yo as createTreemapServices};
|