orbitchat 3.10.6 → 3.10.7

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.
Files changed (97) hide show
  1. package/dist/assets/ChartRenderer-9FnwPEBX.js +105 -0
  2. package/dist/assets/MermaidRenderer-CnzIvTlj.js +317 -0
  3. package/dist/assets/{MusicRenderer-DW6lysGY.js → MusicRenderer-fgx5dq-k.js} +2 -2
  4. package/dist/assets/{SVGRenderer-DAIMVJgr.js → SVGRenderer-CZNFFAA_.js} +1 -1
  5. package/dist/assets/abnfDiagram-VRR7QNED-DChuAW5u.js +1 -0
  6. package/dist/assets/architectureDiagram-ZJ3FMSHR-DHJZWJhu.js +36 -0
  7. package/dist/assets/blockDiagram-677ZJIJ3-H_CNYF5m.js +132 -0
  8. package/dist/assets/{c4Diagram-AAUBKEIU-Cmx-NXVO.js → c4Diagram-LMCZKHZV-BUftbNWY.js} +1 -1
  9. package/dist/assets/channel-Cfw3OpIn.js +1 -0
  10. package/dist/assets/{chunk-QZHKN3VN-CZzLds6P.js → chunk-2Q5K7J3B-CdU2Q6YZ.js} +1 -1
  11. package/dist/assets/{chunk-ND2GUHAM-BodP1saw.js → chunk-32BRIVSS-DnDG740s.js} +1 -1
  12. package/dist/assets/{chunk-FMBD7UC4-MubvFkwu.js → chunk-5VM5RSS4-CQacO1HV.js} +1 -1
  13. package/dist/assets/chunk-EX3LRPZG-Bq0HhB2B.js +231 -0
  14. package/dist/assets/{chunk-4BX2VUAB-CJj_7pn2.js → chunk-JWPE2WC7-BjHi_aEM.js} +1 -1
  15. package/dist/assets/chunk-MOJQB5TN-D2zfH4wm.js +88 -0
  16. package/dist/assets/chunk-RYQCIY6F-DSJh0d2F.js +1 -0
  17. package/dist/assets/{chunk-727SXJPM-CL3otgv0.js → chunk-V7JOEXUC-hSR6fEWT.js} +4 -4
  18. package/dist/assets/{chunk-2J33WTMH-CUt5uiXo.js → chunk-VR4S4FIN-uT68_7rT.js} +1 -1
  19. package/dist/assets/{chunk-55IACEB6-DVyyaDvO.js → chunk-XXDRQBXY-BrvJt-u-.js} +1 -1
  20. package/dist/assets/classDiagram-OUVF2IWQ-BkFPBJiF.js +1 -0
  21. package/dist/assets/classDiagram-v2-EOCWNBFH-BkFPBJiF.js +1 -0
  22. package/dist/assets/{cose-bilkent-S5V4N54A-DEY7stpG.js → cose-bilkent-JH36ORCC-C0vhiJLV.js} +1 -1
  23. package/dist/assets/cynefin-VYW2F7L2-CyM6ijR6.js +178 -0
  24. package/dist/assets/cynefinDiagram-TSTJHNR4-MevACWGH.js +62 -0
  25. package/dist/assets/dagre-VKFMJZFB-BqR7tzk8.js +4 -0
  26. package/dist/assets/{diagram-KO2AKTUF-D05qxtNL.js → diagram-FQU43EPY-IlESJ0wh.js} +3 -3
  27. package/dist/assets/diagram-G47NLZAW-Bqjk3ZYu.js +24 -0
  28. package/dist/assets/{diagram-LMA3HP47-CnQ23_X8.js → diagram-NH7WQ7WH-B63W-pyC.js} +2 -2
  29. package/dist/assets/diagram-OA4YK3LP-B0THRF0G.js +30 -0
  30. package/dist/assets/diagram-WEI45ONY-IZZ69bsz.js +41 -0
  31. package/dist/assets/{docx-preview-C0UevYcE.js → docx-preview-CMb3nQfR.js} +1 -1
  32. package/dist/assets/ebnfDiagram-CCIWWBDH-B_U7c6VT.js +1 -0
  33. package/dist/assets/erDiagram-Q63AITRT-oGWxlmE8.js +85 -0
  34. package/dist/assets/flowDiagram-23GEKE2U-0scCMi71.js +156 -0
  35. package/dist/assets/ganttDiagram-NO4QXBWP-DIS-iO_q.js +292 -0
  36. package/dist/assets/{gitGraphDiagram-PVQCEYII-BmCo7lBu.js → gitGraphDiagram-IHSO6WYX-DsT87XU7.js} +7 -7
  37. package/dist/assets/{graph-CAnANduQ.js → graph-C9eacEi8.js} +1 -1
  38. package/dist/assets/{index--_ARL9JL.js → index-C0slAIYD.js} +1 -1
  39. package/dist/assets/index-DfypiZL2.js +366 -0
  40. package/dist/assets/index-DqIwGcah.css +1 -0
  41. package/dist/assets/{infoDiagram-5YYISTIA-CPT2KkJP.js → infoDiagram-FWYZ7A6U-CkLm2oOh.js} +2 -2
  42. package/dist/assets/{ishikawaDiagram-YF4QCWOH-BKDzsZ93.js → ishikawaDiagram-FXEZZL3T-BEPnPebm.js} +5 -5
  43. package/dist/assets/{journeyDiagram-JHISSGLW-CZBIRXVn.js → journeyDiagram-5HDEW3XC-B3Sx5g-O.js} +1 -1
  44. package/dist/assets/{kanban-definition-UN3LZRKU-Dg7Po601.js → kanban-definition-HUTT4EX6-BZwqoKM8.js} +6 -6
  45. package/dist/assets/layout-DEXfKzaS.js +1 -0
  46. package/dist/assets/map-Czzmt4hB.js +1 -0
  47. package/dist/assets/{mindmap-definition-RKZ34NQL-DDJH6RNg.js → mindmap-definition-LN4V7U3C-CyjRWos4.js} +9 -9
  48. package/dist/assets/{papaparse.min-CdRM_ppG.js → papaparse.min-BWA-Odol.js} +1 -1
  49. package/dist/assets/pegDiagram-2B236MQR-DItVX4G3.js +1 -0
  50. package/dist/assets/pieDiagram-ENE6RG2P-CTRyME0H.js +39 -0
  51. package/dist/assets/{quadrantDiagram-W4KKPZXB-BApnkjpH.js → quadrantDiagram-ABIIQ3AL-DW4gRbec.js} +3 -3
  52. package/dist/assets/railroadDiagram-RFXS5EU6-_rBw9Q9b.js +1 -0
  53. package/dist/assets/{requirementDiagram-4Y6WPE33-B3wRcSqV.js → requirementDiagram-TGXJPOKE-D898qBnU.js} +1 -1
  54. package/dist/assets/sankeyDiagram-HTMAVEWB-doAkRLNI.js +40 -0
  55. package/dist/assets/sequenceDiagram-DBY2YBRQ-D4HUsfB2.js +162 -0
  56. package/dist/assets/sizeCapture-X5ZJPWSS-DJJLR6R7.js +1 -0
  57. package/dist/assets/stateDiagram-2N3HPSRC-0IOXcLaP.js +1 -0
  58. package/dist/assets/stateDiagram-v2-6OUMAXLB-BjcuRalB.js +1 -0
  59. package/dist/assets/swimlanes-5IMT3BWC-HIPL1mdx.js +2 -0
  60. package/dist/assets/swimlanesDiagram-G3AALYLV-usVEFD6y.js +8 -0
  61. package/dist/assets/{timeline-definition-PNZ67QCA-kNKpwGZ_.js → timeline-definition-FHXFAJF6-CgFiawCT.js} +3 -3
  62. package/dist/assets/vendor-auth-CF3lY_Q5.js +5 -0
  63. package/dist/assets/{vendor-markdown-CQ_RitqP.js → vendor-markdown-BRX1CUPf.js} +9 -9
  64. package/dist/assets/{vendor-react-C3O77mRn.js → vendor-react-BAJBiXxk.js} +1 -1
  65. package/dist/assets/{vendor-syntax-Bg-E9hW_.js → vendor-syntax-DG6Vo7Ci.js} +1 -1
  66. package/dist/assets/vennDiagram-L72KCM5P-DiY3ySIT.js +34 -0
  67. package/dist/assets/{wardleyDiagram-YWT4CUSO-CvoUjOCY.js → wardleyDiagram-EHGQE667-CtRzQ3q6.js} +3 -3
  68. package/dist/assets/xychartDiagram-FW5EYKEG-OjszPLMV.js +7 -0
  69. package/dist/index.html +6 -6
  70. package/package.json +6 -2
  71. package/dist/assets/ChartRenderer-DyMx9C0M.js +0 -80
  72. package/dist/assets/MermaidRenderer-DNbuWll0.js +0 -312
  73. package/dist/assets/architectureDiagram-3BPJPVTR-Cow01YMa.js +0 -36
  74. package/dist/assets/blockDiagram-GPEHLZMM-C5XzJyId.js +0 -132
  75. package/dist/assets/channel-BPmzEReZ.js +0 -1
  76. package/dist/assets/chunk-AQP2D5EJ-C45-Gx0g.js +0 -231
  77. package/dist/assets/classDiagram-4FO5ZUOK-DsBJVdDP.js +0 -1
  78. package/dist/assets/classDiagram-v2-Q7XG4LA2-DsBJVdDP.js +0 -1
  79. package/dist/assets/dagre-BM42HDAG-W9SEsE-N.js +0 -4
  80. package/dist/assets/diagram-2AECGRRQ-BlqzAN8a.js +0 -43
  81. package/dist/assets/diagram-5GNKFQAL-BLp8AGzL.js +0 -10
  82. package/dist/assets/diagram-OG6HWLK6-CA92e8BM.js +0 -24
  83. package/dist/assets/erDiagram-TEJ5UH35-DSF2yibf.js +0 -85
  84. package/dist/assets/flowDiagram-I6XJVG4X-DY5MD6ts.js +0 -162
  85. package/dist/assets/ganttDiagram-6RSMTGT7-BgubAiWl.js +0 -292
  86. package/dist/assets/index-BJrmNldF.css +0 -1
  87. package/dist/assets/index-DZzHHAye.js +0 -366
  88. package/dist/assets/layout-DGIYPm2g.js +0 -1
  89. package/dist/assets/pieDiagram-4H26LBE5-VmwJRM5q.js +0 -30
  90. package/dist/assets/sankeyDiagram-5OEKKPKP-CMdvyTCy.js +0 -40
  91. package/dist/assets/sequenceDiagram-3UESZ5HK-Bez2saVY.js +0 -162
  92. package/dist/assets/stateDiagram-AJRCARHV-CnB2Ac4-.js +0 -1
  93. package/dist/assets/stateDiagram-v2-BHNVJYJU-D_TnKrY9.js +0 -1
  94. package/dist/assets/vendor-auth-CrXMNoGZ.js +0 -5
  95. package/dist/assets/vennDiagram-CIIHVFJN-DiFbBKbD.js +0 -34
  96. package/dist/assets/wardley-L42UT6IY-BftqliwA.js +0 -173
  97. package/dist/assets/xychartDiagram-2RQKCTM6-eU0cm1JE.js +0 -7
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-DJJLR6R7.js","assets/MermaidRenderer-CnzIvTlj.js","assets/vendor-markdown-BRX1CUPf.js","assets/vendor-syntax-DG6Vo7Ci.js","assets/purify.es-D6gMnemd.js","assets/isPrototype-DezZrpQP.js"])))=>i.map(i=>d[i]);
2
+ import{_ as Rr}from"./vendor-syntax-DG6Vo7Ci.js";import{c as Nr}from"./chunk-RYQCIY6F-DSJh0d2F.js";import{a5 as Or,a6 as Pr,a7 as Br,a8 as kr,l as Qe,c as _r,$ as Fr,Y as Dr,a0 as Hr,ac as Xr,ae as Yr,y as Gr,ab as $r,af as zr,x as _e,ag as Ve,_ as d,ah as Po}from"./MermaidRenderer-CnzIvTlj.js";import{G as Vr}from"./graph-C9eacEi8.js";import"./vendor-markdown-BRX1CUPf.js";import"./map-Czzmt4hB.js";import"./purify.es-D6gMnemd.js";import"./isPrototype-DezZrpQP.js";async function Xo(t,e){const n=new Vr({multigraph:!0,compound:!0}),o=[...e.edges],s=_r(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),a=r.insert("g").attr("class","edges edgePath"),c=r.insert("g").attr("class","edgeLabels"),f=r.insert("g").attr("class","nodes"),g=new Map,p=t.node()!=null;await Promise.all(e.nodes.map(async M=>{var u;if(M.isGroup)n.setNode(M.id,{...M});else{if(p){const h=await Fr(f,M,{config:s,dir:M.dir}),l=((u=h.node())==null?void 0:u.getBBox())??{width:0,height:0};g.set(M.id,h),M.width=l.width,M.height=l.height}n.setNode(M.id,{...M})}}));for(const M of o)n.setEdge(M.start,M.end,{...M},M.id),e.edges.some(h=>h.id===M.id)||e.edges.push(M);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:M}=await Rr(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-DJJLR6R7.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3,4,5]));M(t,e)}return{graph:n,groups:{clusters:i,edgePaths:a,edgeLabels:c,nodes:f,rootGroups:r},nodeElements:g}}d(Xo,"createGraphWithElements");var Bo=5,je=1e-5,Ue=1e-6;function tn(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}d(tn,"buildSegmentList");function Yo(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=s*a-r*i;if(c===0)return null;const f=n.x-t.x,g=n.y-t.y,p=(f*a-g*i)/c,M=(f*r-g*s)/c;return p<=Ue||p>=1-Ue||M<=Ue||M>=1-Ue?null:{point:{x:t.x+p*s,y:t.y+p*r},tA:p,tB:M}}d(Yo,"segmentIntersection");function wn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(wn,"isHorizontalSeg");function Go(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],s=tn(o.points);for(let r=n+1;r<t.length;r++){const i=t[r],a=tn(i.points);for(const[c,f]of s.entries())for(const[g,p]of a.entries()){const M=Yo(f.a,f.b,p.a,p.b);if(!M)continue;const u=wn(f),h=wn(p);(u!==h?u:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:i.id,segIndex:c,t:M.tA,point:M.point}):e.push({jumpEdgeId:i.id,otherEdgeId:o.id,segIndex:g,t:M.tB,point:M.point})}}}return e}d(Go,"findEdgeIntersections");function le(t){const e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}d(le,"fmt");function Oe(t){return`${le(t.x)},${le(t.y)}`}d(Oe,"pointToString");function $o(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}d($o,"getArcSweepFlag");var jr=.001;function zo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Po[e.arrowTypeStart];if(o){const r=t[0],i=t[1],a=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(a),n[0].y=r.y+o*Math.sin(a)}const s=e.arrowTypeEnd&&Po[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],a=t[r-1],c=Math.atan2(a.y-i.y,a.x-i.x);n[r-1].x=a.x-s*Math.cos(c),n[r-1].y=a.y-s*Math.sin(c)}return n}d(zo,"applyMarkerOffsets");function Vo(t,e,n,o,s){const r=t.point.x,i=t.point.y,a={x:r-e*t.r,y:i-n*t.r},c={x:r+e*t.r,y:i+n*t.r},f=[`L${Oe(a)}`];return s==="arc"?f.push(`A${le(t.r)},${le(t.r)} 0 0 ${o} ${Oe(c)}`):f.push(`M${Oe(c)}`),f}d(Vo,"emitJump");function An(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,a=n.y-e.y,c=Math.hypot(s,r),f=Math.hypot(i,a);if(c<je||f<je)return null;const g=s/c,p=r/c,M=i/f,u=a/f,h=g*M+p*u,l=Math.max(-1,Math.min(1,h)),x=Math.acos(l);if(x<je||Math.abs(Math.PI-x)<je)return null;const C=Math.min(o/Math.sin(x/2),c/2,f/2);return{startX:e.x-g*C,startY:e.y-p*C,endX:e.x+M*C,endY:e.y+u*C,ctrlX:e.x,ctrlY:e.y,cutLen:C}}d(An,"computeRoundedCorner");function jo(t,e,n){const o=t.points;if(o.length<2)return"";const s=zo(o,t),r=t.curve==="rounded",i=tn(s),a=new Map;for(const f of e){const g=i[f.segIndex];if(!g)continue;const p=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),M=a.get(f.segIndex)??[];M.push({t:f.t,point:f.point,d:f.t*p,r:n.jumpRadius}),a.set(f.segIndex,M)}const c=[`M${Oe(s[0])}`];for(let f=0;f<i.length;f++){const g=i[f],p=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),M=p===0?0:(g.b.x-g.a.x)/p,u=p===0?0:(g.b.y-g.a.y)/p,h=$o(g);let l=0;if(r&&f>0){const v=An(s[f-1],s[f],s[f+1]??s[f],Bo);v&&(l=v.cutLen)}let x=p,C=null;r&&f<i.length-1&&(C=An(s[f],s[f+1],s[f+2]??s[f+1],Bo),C&&(x=p-C.cutLen));const b=[...a.get(f)??[]].sort((v,L)=>v.t-L.t);for(const v of b)v.r=Math.min(v.r,v.d-l,x-v.d);for(let v=0;v<b.length-1;v++){const L=b[v+1].d-b[v].d;if(b[v].r+b[v+1].r>L){const y=L/2;b[v].r=Math.min(b[v].r,y),b[v+1].r=Math.min(b[v+1].r,y)}}for(const v of b)v.r<jr||c.push(...Vo(v,M,u,h,n.jumpStyle));r&&C?(c.push(`L${le(C.startX)},${le(C.startY)}`),c.push(`Q${le(C.ctrlX)},${le(C.ctrlY)} ${le(C.endX)},${le(C.endY)}`)):c.push(`L${Oe(g.b)}`)}return c.join(" ")}d(jo,"rewriteEdgePath");function Uo(t){return/^[\d\s+,.LMelm-]*$/.test(t)}d(Uo,"isStraightPath");function Wo(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}d(Wo,"curveSupportsLineHops");function Ko(t){if(!t)return null;try{const e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const s of n)s&&typeof s.x=="number"&&typeof s.y=="number"&&o.push({x:s.x,y:s.y});return o.length>=2?o:null}catch{return null}}d(Ko,"decodeDataPoints");function qo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const f of e)s.set(f.id,f);const r=[],i=new Map;for(const f of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(f.id):f.id,p=o.querySelector(`path[data-id="${g}"]`);if(!p)continue;i.set(f.id,p);const u=Ko(p.getAttribute("data-points"))??f.points;r.push({...f,points:u})}const a=Go(r);if(a.length===0)return;const c=new Map;for(const f of a){const g=c.get(f.jumpEdgeId)??[];g.push(f),c.set(f.jumpEdgeId,g)}for(const f of r){const g=c.get(f.id);if(!g||g.length===0)continue;const p=s.get(f.id),M=p==null?void 0:p.curve;if(M!==void 0&&!Wo(M))continue;const u=i.get(f.id);if(!u)continue;if(M===void 0){const v=u.getAttribute("d")??"";if(!Uo(v))continue}const h=u.getAttribute("style")??"",l=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),x=l?Number.parseFloat(l[1]):null,C=l?Number.parseFloat(l[2]):null,b=jo(f,g,n);if(u.setAttribute("d",b),x!==null&&C!==null&&typeof u.getTotalLength=="function"){const v=u.getTotalLength(),L=Math.max(0,v-x-C),y=`0 ${x} ${L} ${C}`,I=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${y};`).replace(/;\s*;+/g,";");u.setAttribute("style",I)}}}d(qo,"applyLineJumpsToSvg");async function Jo(t,e){var s,r;for(const i of t.nodes)i.isGroup?await Dr(e.clusters,i):Hr(i);const n=new Map;for(const i of t.nodes)i!=null&&i.id&&n.set(i.id,i);for(const i of t.edges){const a=i.start?n.get(i.start)??{}:{},c=i.end?n.get(i.end)??{}:{},f=Xr(e.edgePaths,{...i},{},t.type,a,c,t.diagramId);i.label&&await Yr(e.rootGroups,i),i.label&&Zo(i,f)}const o=(r=(s=t.config)==null?void 0:s.swimlane)==null?void 0:r.lineHops;if(o!==!1){const i=o==="gap"?"gap":"arc",a=t.edges.filter(c=>Array.isArray(c.points)&&c.points.length>=2).map(c=>({id:c.id,points:c.points,curve:c.curve,arrowTypeStart:c.arrowTypeStart,arrowTypeEnd:c.arrowTypeEnd}));qo(e.edgePaths,a,{enabled:!0,jumpRadius:6,jumpStyle:i})}}d(Jo,"adjustLayout");function Zo(t,e){const n=(e==null?void 0:e.updatedPath)??(e==null?void 0:e.originalPath),o=Gr(),{subGraphTitleTotalMargin:s}=$r({flowchart:o.flowchart??{}});if(t.label){const r=zr.get(t.id);let i=t.x,a=t.y;if(n){const c=_e.calcLabelPosition(n);Qe.debug("Moving label "+t.label+" from (",i,",",a,") to (",c.x,",",c.y,") abc88"),e&&(i=c.x,a=c.y)}r.attr("transform",`translate(${i}, ${a+s/2})`)}if(t!=null&&t.startLabelLeft){const r=Ve.get(t.id).startLeft;let i=t==null?void 0:t.x,a=t==null?void 0:t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.startLabelRight){const r=Ve.get(t.id).startRight;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.endLabelLeft){const r=Ve.get(t.id).endLeft;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}if(t.endLabelRight){const r=Ve.get(t.id).endRight;let i=t.x,a=t.y;if(n){const c=_e.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=c.x,a=c.y}r.attr("transform",`translate(${i}, ${a})`)}}d(Zo,"positionEdgeLabel");var vn="__swimlane_default__",Ur=21,ko=20;function Rn(t){return Math.max(t.padding??ko,ko)}d(Rn,"topLaneHorizontalPadding");function Qo(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,a=Math.min(r,n+s/2),c=Math.min(Ur,Math.max(0,a-i)),f=i+c;if(f<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:f}}d(Qo,"assignTopLaneTitleRect");function ts(t){const e=t.direction,n=t.nodes??(t.nodes=[]);for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===vn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:vn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=vn}d(ts,"prepareLayoutForSwimlanes");function es(t){const e=new Map;for(const c of t.nodes??[])e.set(c.id,c);const n=[];for(const c of t.edges??[]){const f=typeof c.start=="string"?c.start:void 0,g=typeof c.end=="string"?c.end:void 0;!f||!g||c.labelNodeId||n.push({id:c.id,src:f,dst:g,ref:c})}const o=t.nodes??[],s=o.filter(c=>c.isGroup),r=o.filter(c=>!c.isGroup);return{nodes:[...[...s].reverse(),...r].map(c=>c.id),edges:n,layout:t,nodeById:e}}d(es,"toGraphView");function ns(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=(o==null?void 0:o.layerGap)??100,a=(o==null?void 0:o.nodeGap)??40;let c=0;for(const M of e.layers){let u=0;for(const h of M){const l=r.get(h);if(!l){u++;continue}l.layer=c,l.order=u;const x=n.x[h]??u*a,C=n.y[h]??c*i;l.x=x,l.y=C,u++}c++}const f=s.nodes??[],g=new Map,p=[];for(const M of f){if(!(M!=null&&M.isGroup))continue;M.parentId||p.push(M);const u=f.filter(b=>b.parentId===M.id);let h=1/0,l=-1/0,x=1/0,C=-1/0;for(const b of u){const v=b.x??n.x[b.id],L=b.y??n.y[b.id],y=b.width??0,I=b.height??0;v!=null&&L!=null&&(h=Math.min(h,v-y/2),l=Math.max(l,v+y/2),x=Math.min(x,L-I/2),C=Math.max(C,L+I/2))}if(h===1/0||x===1/0)M.x=M.x??0,M.y=M.y??0,M.width=M.width??0,M.height=M.height??0;else{const b=M.padding??20,v=M.parentId?b:2*Rn(M),L=b,y=Math.max(0,l-h)+v,I=Math.max(0,C-x)+L,E=(h+l)/2,A=(x+C)/2;M.x=E,M.y=A,M.width=y,M.height=I,g.set(M.id,{minX:h,maxX:l,minY:x,maxY:C})}}if(p.length>0&&g.size>0){let M=1/0,u=-1/0,h=0;for(const l of p){const x=l.padding??20;x>h&&(h=x);const C=g.get(l.id);C&&(M=Math.min(M,C.minY),u=Math.max(u,C.maxY))}if(M!==1/0&&u!==-1/0){const l=Math.max(0,u-M),C=Math.max(h,36),b=l+2*C,v=(M+u)/2;for(const B of p)B.y=v,B.height=b,B.swimlaneContentTop=M;const L=[...p].sort((B,O)=>{const k=B.x??0,H=O.x??0;return k-H}),y=[],I=[],E=[];for(const B of L){const O=g.get(B.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*Rn(B),H=(O.minX+O.maxX)/2;y.push(B.id),I.push(H),E.push(k)}const A=y.length;if(A>0){const B=new Map;if(A===1)B.set(y[0],E[0]);else{const O=[];for(let j=0;j<A-1;j++)O.push(I[j+1]-I[j]);const k=new Array(A);k[0]=0;for(let j=0;j<A-1;j++)k[j+1]=2*O[j]-k[j];let H=0,P=Number.POSITIVE_INFINITY;for(let j=0;j<A;j++){const tt=E[j];j%2===0?H=Math.max(H,tt-k[j]):P=Math.min(P,k[j]-tt)}let G=H;H<=P?G=(H+P)/2:G=H;for(let j=0;j<A;j++){const tt=k[j]+(j%2===0?G:-G),ft=Math.max(E[j],tt);B.set(y[j],ft)}}for(const O of p){const k=B.get(O.id);k!=null&&(O.width=k),Qo(O)}}}}}d(ns,"writeBackToLayoutData");var Wr="[EdgeLabelNodes]";function os(t){const e=[],n=[],o=new Map;for(const i of t.nodes)o.set(i.id,i);for(const i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;const a=i.start?o.get(i.start):void 0,c=i.end?o.get(i.end):void 0;if(!a||!c){Qe.warn(Wr,`Edge ${i.id} has missing source or target node`);continue}const f=`edge-label-${i.start}-${i.end}-${i.id}`,p=a.parentId!==c.parentId?c.parentId:a.parentId,M={id:f,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:p,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...a.dir?{dir:a.dir}:{}};e.push(M),i.labelNodeId=f,i.label=void 0,i.text=void 0;const u={id:`${i.id}-to-label`,start:i.start,end:f,type:"normal",isLayoutOnly:!0},h={id:`${i.id}-from-label`,start:f,end:i.end,type:"normal",isLayoutOnly:!0};n.push(u,h)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}d(os,"createEdgeLabelNodes");var Yt=.001;function co(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:Pe(e,n,o,s)}:void 0}d(co,"measuredNodeRect");function ao(t){if(t.isGroup)return;const e=co(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(ao,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}d(ce,"samePoint");function gt(t,e,n=Yt){return Math.abs(t.x-e.x)<n}d(gt,"sameX");function yt(t,e,n=Yt){return Math.abs(t.y-e.y)<n}d(yt,"sameY");function Nt(t,e,n=Yt){return yt(t,e,n)&&Math.abs(t.x-e.x)>n}d(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}d(Ot,"isVerticalSegment");function Wt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(Wt,"overlapLength");function de(t,e,n=Yt){return t.horizontal&&e.horizontal&&yt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&gt(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(de,"sameAxisSegmentOverlapLength");function Be(t,e=Yt){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],i=Nt(s,r,e),a=Ot(s,r,e);(i||a)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:a})}return n}d(Be,"orthogonalSegmentsForPoints");function oe(t,e=Yt){const n=Be(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}d(oe,"countOrthogonalBends");function xt(t,e=Yt){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(xt,"dedupeConsecutivePoints");function lo(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(lo,"classifyThreeSegmentRoute");function dn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&a>n.top-o&&i<n.bottom+o}d(dn,"segmentBoundsOverlapRect");function fo(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}d(fo,"pointInsideRect");function ss(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ss,"rectContainsRect");function en(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}d(en,"rectsOverlap");function Nn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Nn,"inflateRect");function Pe(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Pe,"rectFromCenterSize");function te(t){var e;return(e=co(t))==null?void 0:e.rect}d(te,"rectOfNodeBounds");function Le(t,e){switch(e){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}}}d(Le,"portForRectSide");function uo(t,e,n,o,s,r=Yt){const i=e==="left"||e==="right",a=o==="left"||o==="right";if(i&&a){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(yt(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(yt(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!i&&!a){if(e===o){if(gt(t,n,r))return;const M=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:M},{x:n.x,y:M},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(gt(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(i&&!a){const g=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,p=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return g&&p?[t,{x:n.x,y:t.y},n]:void 0}const c=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,f=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}d(uo,"buildOrthogonalPortPath");function ho(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ho,"buildSameSideTrackPath");function un(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=ao(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(un,"collectRealNodeBounds");function Me(t){const e=[],n=[];for(const o of t){const s=ao(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(Me,"collectNodeRectEntries");function rs(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,a=o.height??0;n.push({nodeId:o.id,...Pe(s,r,i,a)})}return n}d(rs,"collectLayoutNodeRects");function go(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)<n,collinearY:Math.abs(r.cy-i.cy)<n}}d(go,"getNodePairGeometry");function Pt(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&dn(t,e,r.rect,-s))return!0;return!1}d(Pt,"segmentHitsAnyRect");function mo(t,e,n,o,s=Yt,r=1e-6){const i=yt(t,e,s),a=gt(t,e,s),c=yt(n,o,s),f=gt(n,o,s);if(i&&c||a&&f||!(i||a)||!(c||f))return!1;const g=i?{a:t,b:e}:{a:n,b:o},p=a?{a:t,b:e}:{a:n,b:o},M=g.a.y,u=Math.min(g.a.x,g.b.x),h=Math.max(g.a.x,g.b.x),l=p.a.x,x=Math.min(p.a.y,p.b.y),C=Math.max(p.a.y,p.b.y);if(l<u||l>h||M<x||M>C)return!1;const b=Math.abs(l-g.a.x)<r&&Math.abs(M-g.a.y)<r||Math.abs(l-g.b.x)<r&&Math.abs(M-g.b.y)<r,v=Math.abs(l-p.a.x)<r&&Math.abs(M-p.a.y)<r||Math.abs(l-p.b.x)<r&&Math.abs(M-p.b.y)<r;return!(b&&v)}d(mo,"orthogonalSegmentsCross");function is(t,e,n,o,s=Yt){const r=yt(t,e,s),i=gt(t,e,s),a=yt(n,o,s),c=gt(n,o,s);return i&&c&&gt(t,n,s)?Wt(t.y,e.y,n.y,o.y)>s:r&&a&&yt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}d(is,"sameAxisSegmentsOverlap");function nn(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const a=i.points;if(!(!a||a.length<2))for(let c=0;c<a.length-1;c++){const f=a[c],g=a[c+1];if(!(r&&ce(f,g,s))&&(mo(t,e,f,g,s)||is(t,e,f,g,s)))return!0}}return!1}d(nn,"segmentConflictsWithAnyEdge");function he(t,e,n,o,s=Yt){const r=yt(t,e,s),i=gt(t,e,s),a=yt(n,o,s),c=gt(n,o,s);if(!(r&&c||i&&a))return!1;const f=r?{a:t,b:e}:{a:n,b:o},g=r?{a:n,b:o}:{a:t,b:e},p=f.a.y,M=Math.min(f.a.x,f.b.x),u=Math.max(f.a.x,f.b.x),h=g.a.x,l=Math.min(g.a.y,g.b.y),x=Math.max(g.a.y,g.b.y);return h>M+s&&h<u-s&&p>l+s&&p<x-s}d(he,"orthogonalSegmentsStrictlyCross");function On(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+Yt&&t<s-Yt}d(On,"strictlyBetween");function cs(t,e,n){return gt(t,e)&&gt(e,n)?On(e.y,t.y,n.y):yt(t,e)&&yt(e,n)?On(e.x,t.x,n.x):!1}d(cs,"isCollinearIntermediate");function as(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(ce(s,i)){o++,e=!0;continue}if(cs(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}d(as,"simplifyPolylineOnce");function on(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!gt(s,r)&&!yt(s,r)){const i=e.length>=2?e[e.length-2]:void 0,c=(i?gt(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(c)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}d(on,"orthogonalizePolyline");function ue(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=as(e);if(e=o.points,!o.changed)break}return e}d(ue,"simplifyPolyline");var it=.001,Kr=.5,_o=4;function yo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?te(s):void 0,dstRect:r?te(r):void 0}}d(yo,"endpointContextFor");function ls(t,e,n){if(yt(t,e,it))return{x:t.x<n.left?n.left:n.right,y:t.y};if(gt(t,e,it)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}d(ls,"segmentEnterPoint");function Pn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&fo(t[s],e,Kr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=ls(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(Pn,"clipEndpoint");function fs(t,e){for(const n of t){const o=yo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Pn(s,o.srcRect,!0)),o.dstRect&&(s=Pn(s,o.dstRect,!1)),s=ue(on(s)),s=po(s,o.srcRect,o.dstRect),o.edge.points=ue(on(s))}}d(fs,"clipEdgeEndpointsToNodeBoundaries");function Bn(t,e,n,o=!1){if(yt(t,e,it)){if(e.y<n.top-it||e.y>n.bottom+it)return e;if(o){if(t.x<n.left-it)return{x:n.left,y:t.y};if(t.x>n.right+it)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(gt(t,e,it)){if(e.x<n.left-it||e.x>n.right+it)return e;if(o){if(t.y<n.top-it)return{x:t.x,y:n.top};if(t.y>n.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Bn,"snapEndpointToBoundary");function sn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!ce(r,o,it))return r}return t[e+n]}d(sn,"firstDistinctAdjacent");function rn(t,e){const n=t+_o,o=e-_o;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}d(rn,"cornerClearanceRange");function kn(t,e,n){const{lo:o,hi:s}=rn(e,n);return Math.min(s,Math.max(o,t))}d(kn,"clampToCornerClearance");function ds(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(ds,"intersectRanges");function _n(t,e){return e==="left"||e==="right"?rn(t.top,t.bottom):rn(t.left,t.right)}d(_n,"clearanceRangeForSide");function cn(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(yt(t,e,it)&&o){if(Math.abs(t.x-n.left)<it)return"left";if(Math.abs(t.x-n.right)<it)return"right"}if(gt(t,e,it)&&s){if(Math.abs(t.y-n.top)<it)return"top";if(Math.abs(t.y-n.bottom)<it)return"bottom"}}d(cn,"terminalSideForSegment");function Fe(t){return t==="left"||t==="right"}d(Fe,"isHorizontalSide");function us(t,e,n,o,s){const r=[],i=n?cn(t,e,n):void 0,a=o?cn(e,t,o):void 0;return n&&i&&Fe(i)===s&&r.push(_n(n,i)),o&&a&&Fe(a)===s&&r.push(_n(o,a)),r.length>0?ds(r):void 0}d(us,"straightClearanceRange");function Fn(t,e,n,o,s){const r=us(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,a=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(a-i)<it))return s?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}d(Fn,"clearStraightEndpointCornerAxis");function po(t,e,n){if(t.length!==2)return t;const[o,s]=t;return yt(o,s,it)?Fn(o,s,e,n,!0)??t:gt(o,s,it)?Fn(o,s,e,n,!1)??t:t}d(po,"clearStraightEndpointCornerConnections");function hs(t,e,n){return Fe(n)?{x:t.x,y:kn(t.y,e.top,e.bottom)}:{x:kn(t.x,e.left,e.right),y:t.y}}d(hs,"cornerClearedEndpoint");function gs(t,e,n,o,s,r){const i=t.map(a=>({...a}));for(let a=e;a>=0&&a<t.length;a+=n){const c=t[a];if(r&&!yt(c,o,it)||!r&&!gt(c,o,it))break;r?i[a].y=s.y:i[a].x=s.x}return i}d(gs,"moveCollinearEndpointRun");function Dn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],i=sn(t,o,s);if(!i)return t;const a=cn(r,i,e);if(!a)return t;const c=Fe(a),f=hs(r,e,a);return ce(r,f,it)?t:gs(t,o,s,r,f,c)}d(Dn,"clearEndpointCornerConnection");function Hn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)<it&&Math.abs(e.y-n.top)<it&&o)return"top";if(Math.abs(t.y-n.bottom)<it&&Math.abs(e.y-n.bottom)<it&&o)return"bottom";if(Math.abs(t.x-n.left)<it&&Math.abs(e.x-n.left)<it&&s)return"left";if(Math.abs(t.x-n.right)<it&&Math.abs(e.x-n.right)<it&&s)return"right"}d(Hn,"borderSideForSegment");function Xn(t,e,n,o){switch(t){case"top":return gt(e,n,it)&&n.y<o.top-it;case"bottom":return gt(e,n,it)&&n.y>o.bottom+it;case"left":return yt(e,n,it)&&n.x<o.left-it;case"right":return yt(e,n,it)&&n.x>o.right+it}}d(Xn,"leavesOutward");function Yn(t,e,n){if(t.length<3)return t;if(n){const r=Hn(t[0],t[1],e);return r&&Xn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=Hn(t[o-1],t[o],e);return s&&Xn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Yn,"collapseOwnBorderStub");function ms(t,e,n){let o=t;if(e){const r=sn(o,0,1);if(r){const i=Bn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Yn(o,e,!0)}if(n){const r=o.length-1,i=sn(o,r,-1);if(i){const a=Bn(i,o[r],n,!0);a!==o[r]&&(o=[...o.slice(0,r),a])}o=Yn(o,n,!1)}const s=po(o,e,n);return s!==o||o.length===2?s:(e&&(o=Dn(o,e,!0)),n&&(o=Dn(o,n,!1)),o)}d(ms,"snapAndCollapseEndpoints");function Gn(t,e){for(const n of t){const o=yo(n,e,2);if(!o)continue;const s=xt(o.points,it),r=ms(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Gn,"prepareEdgeEndpointsForRenderer");function xo(t){return new Map(t.map(e=>[e.id,e]))}d(xo,"buildNodeMap");function ys(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}d(ys,"resolveTopLevelGroupId");function $n(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}d($n,"groupDepth");function bo(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,a=r.y;if(typeof i!="number"||typeof a!="number")continue;const c=r.width??0,f=r.height??0;e=Math.min(e,i-c/2),n=Math.max(n,i+c/2),o=Math.min(o,a-f/2),s=Math.max(s,a+f/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(bo,"boundsForChildren");function ps(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(ps,"applyGroupBounds");function xs(t){const e=xo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>$n(s,e)-$n(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=bo(s);r&&ps(o,r)}}d(xs,"recomputeNestedGroupBounds");function an(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);let r=1/0,i=-1/0;for(const c of s){const f=c[e];typeof f=="number"&&(r=Math.min(r,f),i=Math.max(i,f))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const a=d(c=>r+i-c,"mirror");for(const c of n){const f=c[e];typeof f=="number"&&(c[e]=a(f));const g=c.groupTitleRect;g&&(c.groupTitleRect=e==="x"?{...g,left:a(g.right),right:a(g.left)}:{...g,top:a(g.bottom),bottom:a(g.top)})}for(const c of o)for(const f of c.points??[])f[e]=a(f[e]);return!0}d(an,"mirrorAxis");function bs(t){return(t.nodes??[]).some(n=>!n.isGroup)?an(t,"y"):!0}d(bs,"applyBtDirectionTransform");function Ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G<r&&(r=G),j<i&&(i=j)}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const P of s)c+=P.width??0,f+=P.height??0;const g=c/s.length,p=f/s.length,M=p>0?Math.max(1,g/p):1;for(const P of s){const G=P.x??0,tt=((P.y??0)-i)*M+a,ft=G-r;P.x=tt,P.y=ft}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,ft=(G.y-i)*M+a,Mt=j-r;G.x=ft,G.y=Mt}xs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&an(t,"x"),!0;const h=xo(n),l=new Map;for(const P of n){if(P.isGroup)continue;const G=ys(P,h);if(!G)continue;const j=l.get(G)??[];j.push(P),l.set(G,j)}let x=0;for(const P of u){const G=P.padding??0;G>x&&(x=G)}const C=[];let b=1/0,v=-1/0;for(const P of u){const G=l.get(P.id)??[],j=bo(G);j&&(b=Math.min(b,j.minX),v=Math.max(v,j.maxX),C.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||v===-1/0)return!0;const L=Math.max(0,v-b),y=Math.max(x,10),I=L+2*y,E=a+I,O=(b+v)/2-I/2-a,k=O+E/2,H=Math.max(x,a);C.sort((P,G)=>P.centerY-G.centerY);for(let P=0;P<C.length;P++){const G=C[P];let j,tt;if(P===0?j=G.contentTop-H:j=(C[P-1].contentBottom+G.contentTop)/2,P===C.length-1)tt=G.contentBottom+H;else{const Ht=C[P+1];tt=(G.contentBottom+Ht.contentTop)/2}const ft=Math.max(0,tt-j),Mt=(j+tt)/2;G.lane.x=k,G.lane.y=Mt,G.lane.width=E,G.lane.height=ft,G.lane.swimlaneContentTop=G.contentTop,G.lane.groupTitleRect={left:O,right:O+a,top:j,bottom:tt}}return e==="RL"&&an(t,"x"),!0}d(Ms,"applyLrDirectionTransform");var ae=1e-6,qr=8,We=qr,Jr=[0,We,-We,2*We,-2*We];function Is(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const i=lo(xt(r,ae),ae);if(!i)continue;const{p3:a}=i,c=i.kind==="HVH",f=go(s,n,ae);if(!f)continue;const{srcId:g,dstId:p,srcInfo:M,dstInfo:u,collinearX:h,collinearY:l}=f;if(h||l)continue;let x;const C=M.rect;for(const b of Jr){let v,L,y;if(c){const k=u.cy>M.cy?C.bottom:C.top,H=M.cx+b;if(H<=C.left+ae||H>=C.right-ae)continue;v={x:H,y:k},L={x:H,y:a.y},y={x:a.x,y:a.y}}else{const k=u.cx>M.cx?C.right:C.left,H=M.cy+b;if(H<=C.top+ae||H>=C.bottom-ae)continue;v={x:k,y:H},L={x:a.x,y:H},y={x:a.x,y:a.y}}const I=ce(v,L,ae),E=ce(L,y,ae);if(I&&E||!I&&Pt(v,L,o,[g],1)||!E&&Pt(L,y,o,[p],1))continue;const A=!I&&nn(v,L,t,s,{epsilon:ae,skipDegenerateOther:!0}),B=!E&&nn(L,y,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(A||B)){I?x=[L,y]:E?x=[v,L]:x=[v,L,y];break}}x&&(s.points=x)}}d(Is,"portSwapToLShape");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values());for(const a of t){if(a.isLayoutOnly)continue;const c=a.points;if(!c||c.length<4)continue;const f=xt(c,.001);if(f.length<4)continue;const g=f.length-1,p=f[g],M=f[g-1],u=f[g-2],h=p.x-M.x,l=p.y-M.y,x=Math.hypot(h,l);if(x>=10||x<.001)continue;const C=M.x-u.x,b=M.y-u.y;if(Math.hypot(C,b)<.001)continue;const L=Nt(M,p,.001),y=Ot(M,p,.001),I=Nt(u,M,.001),E=Ot(u,M,.001);if(!(L&&E||y&&I))continue;const A=a.end,B=a.start,O=A?e.get(A):void 0;if(!O)continue;const k=O.x??0,H=O.y??0,P=te(O);if(!P)continue;let G,j;if(E){const J=b<0;G={x:k,y:u.y},j={x:k,y:J?P.bottom:P.top}}else{const J=C>0;G={x:u.x,y:H},j={x:J?P.right:P.left,y:H}}if(Pt(G,j,r,A?[A]:[],-2)||Pt(G,j,i,[],-2))continue;if(B){const J=e.get(B),rt=J?te(J):void 0;if(rt&&fo(G,rt,2))continue}const tt=d((J,rt)=>`${J.x.toFixed(3)},${J.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let J=0;J<f.length-1;J++)ft.add(tt(f[J],f[J+1]));const Mt=d((J,rt)=>{for(const ut of t){if(ut===a||ut.isLayoutOnly)continue;const pt=ut.points;if(!(!pt||pt.length<2))for(let St=0;St<pt.length-1;St++){const wt=pt[St],Kt=pt[St+1];if(!ft.has(tt(wt,Kt))&&he(J,rt,wt,Kt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(Mt(G,j))continue;if(g-3>=0){const J=f[g-3],rt=[B,A].filter(ut=>!!ut);if(Pt(J,G,r,rt,-2)||Mt(J,G))continue}const Ft=[...f.slice(0,g-2),G,j];a.points=Ft;const nt=a.labelNodeId;if(nt){const J=e.get(nt);if(J){const rt=J.width??0,ut=J.height??0;if(rt>0&&ut>0){let pt,St,wt=-1;for(let Kt=0;Kt<Ft.length-1;Kt++){const qt=Ft[Kt],Jt=Ft[Kt+1],se=Math.hypot(Jt.x-qt.x,Jt.y-qt.y),Ee=yt(qt,Jt,.001),me=gt(qt,Jt,.001);(Ee&&se>=rt+2||me&&se>=ut+2)&&se>wt&&(wt=se,pt=(qt.x+Jt.x)/2,St=(qt.y+Jt.y)/2)}pt!==void 0&&St!==void 0&&(J.x=pt,J.y=St)}}}}}d(Ss,"collapseShortTerminalStub");var et=.001,Xt=8,at=Be,Ln=d((t,e)=>gt(t,e,et)||yt(t,e,et),"orthogonallyAligned");function Cs(t,e){const s=d((u,h)=>{const l=u.x??0,x=u.y??0,C=h.x-l,b=h.y-x;let v=(u.width??0)/2,L=(u.height??0)/2;return Math.abs(b)*v>Math.abs(C)*L?(b<0&&(L=-L),{x:l+(b===0?0:L*C/b),y:x+L}):(C<0&&(v=-v),{x:l+v,y:x+(C===0?0:v*b/C)})},"rectIntersect"),r=d((u,h)=>{const l=xt(u.points??[]);if(l.length<2)return;const x=h?u.start:u.end,C=x?e.get(x):void 0,b=C?te(C):void 0;if(!C||!x||!b)return;const v=h?l[0]:l[l.length-1],L=h?l[1]:l[l.length-2],y=s(C,v);let I=v;if(Ln(L,y)&&(I=L),gt(y,I,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"V",coord:y.x,min:Math.min(y.y,I.y),max:Math.max(y.y,I.y),boundary:y,railEnd:I,rect:b};if(yt(y,I,et))return{edge:u,edgeId:String(u.id??""),nodeId:x,atStart:h,orientation:"H",coord:y.y,min:Math.min(y.x,I.x),max:Math.max(y.x,I.x),boundary:y,railEnd:I,rect:b}},"terminalLaneFor"),i=d((u,h)=>Math.max(0,Math.min(u.max,h.max)-Math.max(u.min,h.min)),"projectedOverlapLength"),a=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&gt(u.boundary,h.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&yt(u.boundary,h.boundary,1),"sameTerminalFace"),c=d((u,h)=>u.nodeId!==h.nodeId||u.orientation!==h.orientation?!1:i(u,h)>=Xt&&Math.abs(u.coord-h.coord)<.5,"exactTerminalLaneConflict"),f=d((u,h)=>{if(u.nodeId!==h.nodeId||u.orientation!==h.orientation||u.orientation!=="H"||u.atStart===h.atStart)return!1;const l=i(u,h);if(l<Xt)return!1;const x=u.rect.bottom-u.rect.top;return l<x||l>2*x?!1:a(u,h)&&Math.abs(u.coord-h.coord)<16},"nearTerminalLaneConflict"),g=d((u,h)=>{const l=xt(u.edge.points??[]);if(l.length<2)return;const x=u.orientation==="V"?{x:u.boundary.x+h,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+h},C=u.orientation==="V"?{x:u.railEnd.x+h,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+h};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?yt(x,u.boundary,et)&&x.x>=u.rect.left+1&&x.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?gt(x,u.boundary,et)&&x.y>=u.rect.top+1&&x.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const I=l.length>1&&ce(l[1],u.railEnd,et),E=l.slice(I?2:1),A=E[0];return A&&!Ln(A,C)?void 0:[x,C,...E]}const v=l.length>1&&ce(l[l.length-2],u.railEnd,et),L=l.slice(0,v?-2:-1),y=L[L.length-1];if(!(y&&!Ln(y,C)))return[...L,C,x]},"shiftedCandidate"),p=d(u=>{const h=u.edge,l=xt(h.points??[]);if(l.length!==2)return!1;const x=h.start,C=h.end,b=x?e.get(x):void 0,v=C?e.get(C):void 0;if(!b||!v)return!1;const L=b.x??0,y=b.y??0,I=v.x??0,E=v.y??0,[A,B]=l;return yt(A,B,et)&&Math.abs(y-E)<1&&Math.abs(L-I)>1||gt(A,B,et)&&Math.abs(L-I)<1&&Math.abs(y-E)>1},"laneIsStraightCollinearConnector"),M=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const h=t.filter(x=>!x.isLayoutOnly).flatMap(x=>[r(x,!0),r(x,!1)]).filter(x=>!!x);let l=!1;for(let x=0;x<h.length&&!l;x++)for(let C=x+1;C<h.length&&!l;C++){const b=h[x],v=h[C];if(b.edge===v.edge||!(c(b,v)||f(b,v)))continue;const L=!c(b,v),y=[b,v].sort((I,E)=>{const A=p(I),B=p(E);return A!==B?Number(A)-Number(B):+!E.atStart-+!I.atStart});for(const I of y){for(const E of M){const A=g(I,E);if(!A)continue;const B=r({...I.edge,points:A},I.atStart);if(!(!B||h.some(O=>O.edge!==I.edge&&(c(B,O)||L&&f(B,O))))){I.edge.points=A,l=!0;break}}if(l)break}}if(!l)return}}d(Cs,"separateSharedRenderedTerminalLanes");function vs(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=d((a,c)=>{const f=a.start,g=a.end,p=at(c);if(p.length!==c.length-1)return!1;const M=[f,g].filter(u=>!!u);for(const u of p)if(Pt(u.a,u.b,o,M,-2)||Pt(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===a||u.isLayoutOnly)continue;const h=u.points;if(!(!h||h.length<2)){for(const l of p)for(const x of at(xt(h)))if(de(l,x,.5)>=Xt||he(l.a,l.b,x.a,x.b,et))return!1}}return!0},"candidateIsSafe"),i=d((a,c)=>{if(c+4>=a.length)return;const f=a[c],g=a[c+1],p=a[c+2],M=a[c+3],u=a[c+4],h=Nt(f,g)&&Ot(g,p)&&Nt(p,M)&&Ot(M,u)&&gt(f,M,et)&&gt(f,u,et)&&gt(g,p,et)&&(g.x-f.x)*(M.x-p.x)<0,l=Ot(f,g)&&Nt(g,p)&&Ot(p,M)&&Nt(M,u)&&yt(f,M,et)&&yt(f,u,et)&&yt(g,p,et)&&(g.y-f.y)*(M.y-p.y)<0;if(h||l)return xt([...a.slice(0,c+1),u,...a.slice(c+5)]);if(c+5>=a.length)return;const x=a[c+5],C=Ot(f,g)&&Nt(g,p)&&Ot(p,M)&&Nt(M,u)&&Ot(u,x)&&gt(f,u,et)&&gt(f,x,et)&&gt(p,M,et)&&(p.x-g.x)*(u.x-M.x)<0,b=Nt(f,g)&&Ot(g,p)&&Nt(p,M)&&Ot(M,u)&&Nt(u,x)&&yt(f,u,et)&&yt(f,x,et)&&yt(p,M,et)&&(p.y-g.y)*(u.y-M.y)<0;if(!(!C&&!b))return xt([...a.slice(0,c+1),x,...a.slice(c+6)])},"withoutDogleg");for(let a=0;a<8;a++){let c=!1;for(const f of t){if(f.isLayoutOnly)continue;const g=xt(f.points??[]);for(let p=0;p<=g.length-5;p++){const M=i(g,p);if(!(!M||!r(f,M))){f.points=M,c=!0;break}}if(c)break}if(!c)return}}d(vs,"collapseRedundantRectangularDoglegs");function zn(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values()),a=t.filter(h=>!h.isLayoutOnly),c=d((h,l,x)=>xt(h===l?x??[]:h.points??[]),"pointsFor"),f=d((h,l)=>{let x=0;for(let C=0;C<a.length;C++){const b=at(c(a[C],h,l));for(let v=C+1;v<a.length;v++){const L=at(c(a[v],h,l));for(const y of b)for(const I of L)he(y.a,y.b,I.a,I.b,et)&&x++}}return x},"strictCrossingCount"),g=d(h=>{const l=at(h);if(l.length!==3)return;const x=l[1];if(!(l[0].horizontal===x.horizontal||l[2].horizontal===x.horizontal))return{index:x.index,horizontal:x.horizontal,vertical:x.vertical,segment:x}},"middleRail"),p=d((h,l)=>{const x=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(x.includes(C.id))return!1;const b=C.rect;return l.horizontal?Wt(l.a.x,l.b.x,b.left,b.right)>=Xt&&l.a.y>=b.top-2&&l.a.y<=b.bottom+2:Wt(l.a.y,l.b.y,b.top,b.bottom)>=Xt&&l.a.x>=b.left-2&&l.a.x<=b.right+2})},"blockingRectsFor"),M=d((h,l,x)=>{const C=h.map(v=>({...v}));if(l.horizontal)C[l.index].y=x,C[l.index+1].y=x;else if(l.vertical)C[l.index].x=x,C[l.index+1].x=x;else return;const b=ue(xt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),u=d((h,l,x)=>{const C=[h.start,h.end].filter(v=>!!v),b=at(l);if(b.length!==l.length-1)return!1;for(const v of b)if(Pt(v.a,v.b,r,C,-2)||Pt(v.a,v.b,i,[],-2))return!1;for(const v of a)if(v!==h){for(const L of b)for(const y of at(c(v)))if(de(L,y,.5)>=Xt)return!1}return f(h,l)<=x},"candidateIsSafe");for(let h=0;h<8;h++){const l=f();let x=!1;for(const C of a){const b=c(C),v=g(b);if(!v)continue;const L=p(C,v.segment);if(L.length===0)continue;const y=v.horizontal?[Math.min(...L.map(I=>I.rect.top))-20,Math.max(...L.map(I=>I.rect.bottom))+20]:[Math.min(...L.map(I=>I.rect.left))-20,Math.max(...L.map(I=>I.rect.right))+20];for(const I of y){const E=M(b,v.segment,I);if(!(!E||!u(C,E,l))){C.points=E,x=!0;break}}if(x)break}if(!x)return}}d(zn,"liftObstacleHuggingSameSideRails");function Vn(t,e){const o=d(c=>{const f=c.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{left:f.left,right:f.right,top:f.top,bottom:f.bottom}},"validTitleRect"),s=d(c=>{if(!c.isGroup||c.parentId)return;const f=c.direction,g=typeof f=="string"?f.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const p=o(c),M=c.y,u=c.height;if(!p||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,l=p.bottom-p.top;if(!(l<=0||h<l))return{node:c,rect:p}},"topLaneTitleFor"),r=d((c,f)=>{if(!c.horizontal)return!1;const g=c.a.y;return g<=f.top+et||g>=f.bottom-et?!1:Wt(c.a.x,c.b.x,f.left,f.right)>=Xt},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(c=>!!c);if(i.length===0)return;let a=0;for(const c of t){if(c.isLayoutOnly)continue;const f=xt(c.points??[]);for(const g of at(f))for(const p of i)r(g,p.rect)&&(a=Math.max(a,p.rect.bottom-g.a.y+4))}if(!(a<=et))for(const c of i){const f=c.node.y,g=c.node.height;typeof f!="number"||typeof g!="number"||!Number.isFinite(f)||!Number.isFinite(g)||g<=0||(c.node.y=f-a/2,c.node.height=g+a,c.node.groupTitleRect={...c.rect,top:c.rect.top-a,bottom:c.rect.bottom-a})}}d(Vn,"liftTopLaneTitleBandsAboveRails");function jn(t,e){const o=d(f=>{const g=f.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(f=>{if(!f.isGroup||f.parentId||f.direction!=="LR")return;const p=o(f),M=f.x,u=f.width;if(!p||typeof M!="number"||typeof u!="number"||!Number.isFinite(M)||!Number.isFinite(u)||u<=0)return;const h=p.right-p.left,l=p.bottom-p.top;if(!(h<=0||l<h))return{node:f,rect:p}},"leftLaneTitleFor"),r=d((f,g)=>{if(!f.vertical)return!1;const p=f.a.x;return p<=g.left+et||p>=g.right-et?!1:Wt(f.a.y,f.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),i=d((f,g)=>{if(!f.horizontal)return!1;const p=f.a.y;return p<=g.top+et||p>=g.bottom-et?!1:Wt(f.a.x,f.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(f=>!!f);if(a.length===0)return;let c=0;for(const f of t){if(f.isLayoutOnly)continue;const g=xt(f.points??[]);for(const p of at(g))for(const M of a)if(r(p,M.rect))c=Math.max(c,M.rect.right-p.a.x+4);else if(i(p,M.rect)){const u=Math.min(p.a.x,p.b.x);c=Math.max(c,M.rect.right-u+4)}}if(!(c<=et))for(const f of a){const g=f.node.x,p=f.node.width;typeof g!="number"||typeof p!="number"||!Number.isFinite(g)||!Number.isFinite(p)||p<=0||(f.node.x=g-c/2,f.node.width=p+c,f.node.groupTitleRect={...f.rect,left:f.rect.left-c,right:f.rect.right-c})}}d(jn,"shiftLeftLaneTitleBandsLeftOfRails");function Ls(t,e){const{realNodeRects:o}=Me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=d((h,l=new Map)=>xt(l.get(h)??h.points??[]),"replacementPointsFor"),i=d((h=new Map)=>{let l=0;for(let x=0;x<s.length;x++){const C=at(r(s[x],h));for(let b=x+1;b<s.length;b++){const v=at(r(s[b],h));for(const L of C)for(const y of v)he(L.a,L.b,y.a,y.b,et)&&l++}}return l},"crossingCount"),a=d((h=new Map)=>s.reduce((l,x)=>l+oe(r(x,h)),0),"totalBends"),c=d(h=>{const l=r(h);if(l.length<4)return;const x=l[l.length-2],C=l[l.length-1];if(!(!Nt(x,C,et)&&!Ot(x,C,et)))return{tailStart:x,terminal:C}},"terminalTailFor"),f=d((h,l)=>{const x=r(h);if(x.length<3)return;const C=x[0],b=x[1];let v;if(Nt(C,b,et))v={x:b.x,y:l.tailStart.y};else if(Ot(C,b,et))v={x:l.tailStart.x,y:b.y};else return;const L=ue(xt([C,b,v,l.tailStart,l.terminal]));return at(L).length===L.length-1?L:void 0},"candidateWithDestinationTail"),g=d((h,l)=>{const x=[h.start,h.end].filter(C=>!!C);for(const C of at(l))if(Pt(C.a,C.b,o,x,-2))return!0;return!1},"pathHasNodeHit"),p=d((h,l,x)=>{for(const C of s)if(C!==h){for(const b of at(l))for(const v of at(r(C,x)))if(de(b,v,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),M=d((h,l,x)=>!g(h,l)&&!p(h,l,x),"candidateIsSafe"),u=d(()=>{const h=new Map;for(const l of s){const x=l.end;if(!x||!e.has(x)||r(l).length<4)continue;const b=h.get(x)??[];b.push(l),h.set(x,b)}return h},"edgesByDestination");for(let h=0;h<4;h++){const l=i();if(l===0)return;const x=a();let C,b=l,v=x;for(const L of u().values())for(let y=0;y<L.length;y++)for(let I=y+1;I<L.length;I++){const E=L[y],A=L[I],B=c(E),O=c(A);if(!B||!O)continue;const k=f(E,O),H=f(A,B);if(!k||!H)continue;const P=new Map([[E,k],[A,H]]);if(!M(E,k,P)||!M(A,H,P))continue;const G=i(P),j=a(P);G>=l||G>b||G===b&&j>=v||(C=P,b=G,v=j)}if(!C)return;for(const[L,y]of C)L.points=y}}d(Ls,"swapDestinationTerminalTailsToReduceCrossings");function Es(t,e){const{realNodeRects:r,labelNodeRects:i}=Me(e.values()),a=t.filter(L=>!L.isLayoutOnly),c=d((L,y=new Map)=>xt(y.get(L)??L.points??[]),"replacementPointsFor"),f=d((L=new Map)=>{let y=0;for(let I=0;I<a.length;I++){const E=at(c(a[I],L));for(let A=I+1;A<a.length;A++){const B=at(c(a[A],L));for(const O of E)for(const k of B)he(O.a,O.b,k.a,k.b,et)&&y++}}return y},"strictCrossingCount"),g=d((L=new Map)=>a.reduce((y,I)=>y+oe(c(I,L)),0),"totalBends"),p=d(L=>{const y=L.start,I=L.end,E=y?e.get(y):void 0,A=I?e.get(I):void 0,B=E?te(E):void 0,O=A?te(A):void 0;return B&&O?{src:B,dst:O}:void 0},"endpointRectsFor"),M=d((L,y,I)=>{if(I.index<=0||I.index+1>=y.length-1)return;const E=p(L);if(E){if(I.vertical){const A=I.a.x,B=Math.min(E.src.left,E.dst.left),O=Math.max(E.src.right,E.dst.right),k=A<B-et?"left":A>O+et?"right":void 0;return k?{edge:L,points:y,segmentIndex:I.index,axis:"vertical",side:k,coord:A,min:Math.min(I.a.y,I.b.y),max:Math.max(I.a.y,I.b.y)}:void 0}if(I.horizontal){const A=I.a.y,B=Math.min(E.src.top,E.dst.top),O=Math.max(E.src.bottom,E.dst.bottom),k=A<B-et?"top":A>O+et?"bottom":void 0;return k?{edge:L,points:y,segmentIndex:I.index,axis:"horizontal",side:k,coord:A,min:Math.min(I.a.x,I.b.x),max:Math.max(I.a.x,I.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const L=[];for(const y of a){const I=c(y);for(const E of at(I)){const A=M(y,I,E);A&&L.push(A)}}return L},"collectExternalRails"),h=d((L,y)=>L.edge!==y.edge&&L.axis===y.axis&&L.side===y.side&&Wt(L.min,L.max,y.min,y.max)>=Xt,"railsInteract"),l=d(L=>{const y=[],I=new Set;for(const E of L){if(I.has(E))continue;const A=[E],B=[];for(I.add(E);A.length>0;){const O=A.pop();B.push(O);for(const k of L)!I.has(k)&&h(O,k)&&(I.add(k),A.push(k))}B.length>1&&y.push(B)}return y},"connectedComponents"),x=d(L=>{const y=[];for(const I of L)y.some(E=>Math.abs(E-I.coord)<et)||y.push(I.coord);for(;y.length<L.length;){const I=Math.min(...y),E=Math.max(...y),A=L[0].side;y.push(A==="left"||A==="top"?I-12*(L.length-y.length):E+12*(L.length-y.length))}return y},"uniqueCoordsFor"),C=d(L=>{const y=L.map(A=>A.coord),I=x(L),E=[];if(L.length<=6){const A=new Array(I.length).fill(!1),B=[],O=d(()=>{if(B.length===L.length){B.some((k,H)=>Math.abs(k-y[H])>=et)&&E.push([...B]);return}for(const[k,H]of I.entries())A[k]||(A[k]=!0,B.push(H),O(),B.pop(),A[k]=!1)},"visit");return O(),E}for(let A=0;A<y.length;A++)for(let B=A+1;B<y.length;B++){const O=[...y];[O[A],O[B]]=[O[B],O[A]],E.push(O)}return E},"coordinateAssignmentsFor"),b=d((L,y)=>{const I=new Map;for(const[A,B]of L.entries()){const O=y[A],k=I.get(B.edge)??B.points.map(H=>({x:H.x,y:H.y}));B.axis==="vertical"?(k[B.segmentIndex].x=O,k[B.segmentIndex+1].x=O):(k[B.segmentIndex].y=O,k[B.segmentIndex+1].y=O),I.set(B.edge,k)}const E=new Map;for(const[A,B]of I){const O=ue(xt(B));if(at(O).length!==O.length-1)return;E.set(A,O)}return E},"replacementsForAssignment"),v=d(L=>{for(const[y,I]of L){const E=[y.start,y.end].filter(A=>!!A);for(const A of at(I))if(Pt(A.a,A.b,r,E,-2)||Pt(A.a,A.b,i,[],-2))return!1}for(let y=0;y<a.length;y++){const I=a[y],E=L.has(I),A=at(c(I,L));for(let B=y+1;B<a.length;B++){const O=a[B];if(!E&&!L.has(O))continue;const k=at(c(O,L));for(const H of A)for(const P of k)if(de(H,P,.5)>=Xt)return!1}}return!0},"candidateIsSafe");for(let L=0;L<4;L++){const y=f();if(y===0)return;let I,E=y,A=g(),B=Number.POSITIVE_INFINITY;for(const O of l(u()))for(const k of C(O)){const H=b(O,k);if(!H||!v(H))continue;const P=f(H);if(P>=y)continue;const G=g(H),j=O.reduce((tt,ft,Mt)=>tt+Math.abs(k[Mt]-ft.coord),0);P>E||P===E&&(G>A||G===A&&j>=B)||(I=H,E=P,A=G,B=j)}if(!I)return;for(const[O,k]of I)O.points=k}}d(Es,"reassignCrossingExternalRailChannels");function Ts(t,e){const{realNodeRects:o,labelNodeRects:s}=Me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,h,l)=>xt(u===h?l??[]:u.points??[]),"pointsFor"),a=d(u=>at(u).reduce((h,l)=>{const x=l.a.x-l.b.x,C=l.a.y-l.b.y;return h+Math.hypot(x,C)},0),"pathLength"),c=d((u,h)=>{let l=0;for(let x=0;x<r.length;x++){const C=at(i(r[x],u,h));for(let b=x+1;b<r.length;b++){const v=at(i(r[b],u,h));for(const L of C)for(const y of v)he(L.a,L.b,y.a,y.b,et)&&l++}}return l},"strictCrossingCount"),f=d((u,h)=>{if(u.horizontal){const l=u.a.y;return(Math.abs(l-h.top)<1||Math.abs(l-h.bottom)<1)&&Wt(u.a.x,u.b.x,h.left,h.right)>=Xt}if(u.vertical){const l=u.a.x;return(Math.abs(l-h.left)<1||Math.abs(l-h.right)<1)&&Wt(u.a.y,u.b.y,h.top,h.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const h=[u.start,u.end].filter(x=>!!x),l=[];for(const x of h){const C=e.get(x),b=C?te(C):void 0;b&&l.push(b)}return l},"endpointRectsFor"),p=d((u,h)=>{if(h+3>=u.length)return[];const l=u[h],x=u[h+1],C=u[h+2],b=u[h+3],v=Nt(l,x,et)&&Ot(x,C,et)&&Nt(C,b,et),L=Ot(l,x,et)&&Nt(x,C,et)&&Ot(C,b,et);if(!v&&!L)return[];if(!(v?Math.sign(x.x-l.x)!==Math.sign(b.x-C.x):Math.sign(x.y-l.y)!==Math.sign(b.y-C.y)))return[];const I=gt(l,b,et)||yt(l,b,et)?[]:[{x:l.x,y:b.y},{x:b.x,y:l.y}],E=I.length===0?[[...u.slice(0,h+1),...u.slice(h+3)]]:I.map(B=>[...u.slice(0,h+1),B,...u.slice(h+3)]),A=new Set;return E.map(B=>ue(xt(B))).filter(B=>{if(at(B).length!==B.length-1||!B.some(k=>ce(k,b,et)))return!1;const O=B.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return A.has(O)?!1:(A.add(O),!0)})},"shortcutCandidatesAt"),M=d((u,h,l)=>{const x=[u.start,u.end].filter(b=>!!b),C=g(u);for(const b of at(h))if(Pt(b.a,b.b,o,x,-2)||Pt(b.a,b.b,s,[],-2)||C.some(v=>f(b,v)))return!1;for(const b of r)if(b!==u){for(const v of at(h))for(const L of at(i(b)))if(de(v,L,.5)>=Xt)return!1}return c(u,h)<=l},"candidateIsSafe");for(let u=0;u<8;u++){const h=c();let l,x,C=h,b=Number.POSITIVE_INFINITY,v=Number.POSITIVE_INFINITY;for(const L of r){const y=i(L),I=oe(y,et),E=a(y);for(let A=0;A<=y.length-4;A++)for(const B of p(y,A)){const O=oe(B,et),k=a(B);if(!(O<I||O===I&&k<E-et)||!M(L,B,h))continue;const P=c(L,B);P>C||P===C&&(O>b||O===b&&k>=v)||(l=L,x=B,C=P,b=O,v=k)}}if(!l||!x)return;l.points=x}}d(Ts,"shortcutRedundantOrthogonalJogs");function ws(t,e){const i=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const _=R.x??0,F=R.y??0,V=te(R);V&&i.push({id:String(R.id??""),cx:_,cy:F,rect:V})}if(i.length===0)return;const a=new Map(i.map(R=>[R.id,R])),c=i.map(R=>({id:R.id,rect:R.rect})),f=["top","bottom","left","right"],g={top:Math.min(...i.map(R=>R.rect.top))-20,bottom:Math.max(...i.map(R=>R.rect.bottom))+20,left:Math.min(...i.map(R=>R.rect.left))-20,right:Math.max(...i.map(R=>R.rect.right))+20},p=t.filter(R=>!R.isLayoutOnly),M=new Map(p.map((R,_)=>[R,_])),u=d(R=>{const _=R==="left"||R==="top"?-1:1,F=[];for(let V=0;V<=2;V++)F.push(g[R]+_*20*V);return F},"outwardTracksForSide"),h=d((R,_=new Map)=>xt(_.get(R)??R.points??[]),"replacementPointsFor"),l=d((R,_)=>{let F=0;for(const V of R)for(const K of _)he(V.a,V.b,K.a,K.b,et)&&F++;return F},"crossingCountBetweenSegments"),x=d((R,_)=>l(at(R),at(_)),"crossingCountBetweenPaths"),C=d((R=new Map)=>{let _=0;const F=[],V=new Set,K=[],Z=d(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y<p.length;Y++){const q=p[Y],m=h(q,R);for(let S=Y+1;S<p.length;S++){const w=p[S],T=x(m,h(w,R));T>0&&(_+=T,F.push({first:q,second:w,count:T}),Z(q),Z(w))}}return K.sort((Y,q)=>(M.get(Y)??0)-(M.get(q)??0)),{count:_,pairs:F,edgeSet:V,edges:K}},"crossingSnapshot"),b=d((R,_)=>{const F=new Set(_.keys());if(F.size===0)return R.count;let V=0;for(const Z of R.pairs)(F.has(Z.first)||F.has(Z.second))&&(V+=Z.count);let K=0;for(let Z=0;Z<p.length;Z++){const Y=p[Z],q=F.has(Y),m=h(Y,_);for(let S=Z+1;S<p.length;S++){const w=p[S];!q&&!F.has(w)||(K+=x(m,h(w,_)))}}return R.count-V+K},"crossingCountWithReplacements"),v=d(R=>{const _=new Map;for(const K of R.pairs){const Z=_.get(K.first)??new Set;Z.add(K.second),_.set(K.first,Z);const Y=_.get(K.second)??new Set;Y.add(K.first),_.set(K.second,Y)}const F=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const Z=[K],Y=[];for(V.add(K);Z.length>0;){const q=Z.pop();Y.push(q);for(const m of _.get(q)??[])V.has(m)||(V.add(m),Z.push(m))}Y.sort((q,m)=>(M.get(q)??0)-(M.get(m)??0)),Y.length>1&&F.push(Y)}return F},"crossingComponents"),L=d(R=>[R.start,R.end].filter(_=>!!_),"endpointIdsFor"),y=d(R=>{const _=[];for(const F of v(R)){const V=new Set(F),K=new Set(F.flatMap(Y=>L(Y))),Z=[...F];for(const Y of p)V.has(Y)||L(Y).some(q=>K.has(q))&&Z.push(Y);Z.sort((Y,q)=>(M.get(Y)??0)-(M.get(q)??0)),_.push(Z)}return _},"pairSearchGroups"),I=d((R,_,F)=>b(R,new Map([[_,F]])),"crossingCountWithSingleReplacement"),E=d(R=>{const _=new Map;for(const F of R.pairs)_.set(F.first,(_.get(F.first)??0)+F.count),_.set(F.second,(_.get(F.second)??0)+F.count);return _},"currentCrossingsByEdge"),A=d(R=>R.slice(1).reduce((_,F,V)=>{const K=R[V];return _+Math.abs(F.x-K.x)+Math.abs(F.y-K.y)},0),"pathLength"),B=d((R=new Map)=>p.reduce((_,F)=>_+oe(h(F,R)),0),"totalBends"),O=d((R=new Map)=>p.reduce((_,F)=>_+A(h(F,R)),0),"totalLength"),k=d((R,_,F=new Map)=>{const V=at(_);for(const K of p)if(K!==R){for(const Z of V)for(const Y of at(h(K,F)))if(de(Z,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),H=d((R,_)=>{const F=[R.start,R.end].filter(V=>!!V);for(const V of at(_))if(Pt(V.a,V.b,c,F,-2))return!0;return!1},"pathHitsNode"),P=d((R,_)=>{const F=ue(xt(_));at(F).length===F.length-1&&R.push(F)},"pushOrthogonalCandidate"),G=d(R=>R==="left"||R==="right","sideIsHorizontal"),j=d((R,_,F)=>{switch(_){case"left":return Math.min(R.x,F.x)-20;case"right":return Math.max(R.x,F.x)+20;case"top":return Math.min(R.y,F.y)-20;case"bottom":return Math.max(R.y,F.y)+20}},"localTrackForSameSide"),tt=d((R,_,F,V)=>{const K=F==="left"||F==="top"?-1:1,Z=[j(_,F,V),g[F]];for(const Y of Z)for(let q=0;q<=2;q++)P(R,ho(_,F,V,Y+K*20*q))},"addSameSideCandidates"),ft=d((R,_,F,V,K)=>{for(const Z of u(F))for(const Y of u(K))P(R,[_,{x:Z,y:_.y},{x:Z,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),Mt=d((R,_,F,V,K)=>{for(const Z of u(F))for(const Y of u(K))P(R,[_,{x:_.x,y:Z},{x:Y,y:Z},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Ht=d((R,_,F,V,K)=>{const Z=[...u("top"),...u("bottom")];for(const Y of u(F))for(const q of u(K))for(const m of Z)P(R,[_,{x:Y,y:_.y},{x:Y,y:m},{x:q,y:m},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),Ft=d((R,_,F,V,K)=>{const Z=[...u("left"),...u("right")];for(const Y of u(F))for(const q of u(K))for(const m of Z)P(R,[_,{x:_.x,y:Y},{x:m,y:Y},{x:m,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=d(R=>{const _=new Set;return R.map(F=>xt(F)).filter(F=>{const V=F.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return _.has(V)||F.length<2?!1:(_.add(V),!0)})},"dedupeCandidatePaths"),J=d((R,_,F,V)=>{const K=[],Z=uo(R,_,F,V,20,et);Z&&P(K,Z),_===V&&tt(K,R,_,F);const Y=G(_),q=G(V);return Y&&!q?ft(K,R,_,F,V):!Y&&q?Mt(K,R,_,F,V):Y?Ht(K,R,_,F,V):Ft(K,R,_,F,V),nt(K)},"buildCandidatesForSides"),rt=d((R,_,F,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of f){const q=Le(V,Y),m=Y==="top"||Y==="bottom"?u(Y):Z;for(const S of K){P(R,[_,F,{x:S,y:F.y},{x:S,y:q.y},q]);for(const w of m)P(R,[_,F,{x:S,y:F.y},{x:S,y:w},{x:q.x,y:w},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=d((R,_,F,V)=>{const K=[...u("left"),...u("right")],Z=[...u("top"),...u("bottom")];for(const Y of f){const q=Le(V,Y),m=Y==="left"||Y==="right"?u(Y):K;for(const S of Z){P(R,[_,F,{x:F.x,y:S},{x:q.x,y:S},q]);for(const w of m)P(R,[_,F,{x:F.x,y:S},{x:w,y:S},{x:w,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),pt=d(R=>{const _=R.start,F=R.end,V=F?a.get(F):void 0;if(!_||!V)return[];const K=xt(R.points??[]);if(K.length<4)return[];const Z=K[0],Y=K[1],q=[];return Ot(Z,Y,et)?rt(q,Z,Y,V):Nt(Z,Y,et)&&ut(q,Z,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=d(R=>{const _=R.start,F=R.end,V=_?a.get(_):void 0,K=F?a.get(F):void 0;if(!V||!K)return[];const Z=[];for(const Y of f){const q=Le(V,Y);for(const m of f)Z.push(...J(q,Y,Le(K,m),m))}return Z.push(...pt(R)),Z},"candidatePathsFor"),wt=d(()=>new Map(p.map(R=>[R,at(h(R))])),"currentSegmentsByEdge"),Kt=d((R,_,F)=>{const V=new Set;for(const K of p){if(K===R)continue;const Z=F.get(K)??at(h(K));_.some(Y=>Z.some(q=>de(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=d((R,_,F,V)=>{const K=new Set;return St(R).map(Y=>ue(xt(Y))).filter(Y=>{if(H(R,Y))return!1;const q=Y.map(m=>`${m.x.toFixed(3)},${m.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let m=0;for(const S of p)S!==R&&(m+=l(q,F.get(S)??at(h(S))));return{candidate:Y,candidateSegments:q,crossings:_.count-(V.get(R)??0)+m,bends:oe(Y,et),totalBends:oe(Y),length:A(Y)}}).filter(({crossings:Y})=>Y<=_.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,F),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Jt=d((R,_,F,V,K,Z)=>{let Y=0;for(const m of R.pairs)(m.first===_||m.second===_||m.first===V||m.second===V)&&(Y+=m.count);let q=l(F.segments,K.segments);for(const m of p){if(m===_||m===V)continue;const S=Z.get(m)??at(h(m));q+=l(F.segments,S)+l(K.segments,S)}return R.count-Y+q},"pairCrossingCount"),se=d((R,_)=>{for(const F of R.sharedTrackConflicts)if(F!==_)return!1;return!0},"conflictsOnlyWith"),Ee=d((R,_)=>R.segments.some(F=>_.segments.some(V=>de(F,V,.5)>=Xt)),"candidatesShareTrack"),me=d((R,_,F,V)=>se(_,F.edge)&&se(V,R.edge)&&!Ee(_,V),"pairCandidatesAreCompatible"),Te=d((R,_,F,V,K)=>{const Z=Jt(R.current,_.edge,F,V.edge,K,R.baseSegments);if(!(Z>=R.current.count))return{replacements:new Map([[_.edge,F.path],[V.edge,K.path]]),crossings:Z,bends:R.currentBends-(R.baseBendsByEdge.get(_.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+F.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(_.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+F.length+K.length}},"scorePairReplacement"),mn=d((R,_)=>R.crossings<_.crossings||R.crossings===_.crossings&&(R.bends<_.bends||R.bends===_.bends&&R.length<_.length),"pairScoreIsBetter"),yn=d((R,_,F,V)=>{let K=V;for(const Z of _.candidates)for(const Y of F.candidates){if(!me(_,Z,F,Y))continue;const q=Te(R,_,Z,F,Y);q&&mn(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),pn=d(R=>{const _=B(),F=O(),V=wt(),K=E(R),Z=new Map(p.map(T=>[T,oe(h(T))])),Y=new Map(p.map(T=>[T,A(h(T))])),q=new Map,m=y(R);for(const T of m)for(const N of T){if(q.has(N))continue;const D=qt(N,R,V,K);D.length>0&&q.set(N,{edge:N,candidates:D})}let S={replacements:new Map,crossings:R.count,bends:_,length:F};const w={current:R,currentBends:_,currentLength:F,baseBendsByEdge:Z,baseLengthByEdge:Y,baseSegments:V};for(const T of m){const N=new Set(T.filter(W=>R.edgeSet.has(W))),D=T.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W<D.length;W++){const ot=D[W];for(let U=W+1;U<D.length;U++){const z=D[U];!N.has(ot.edge)&&!N.has(z.edge)||(S=yn(w,ot,z,S))}}}return S.replacements.size>0?S.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const _=C(),F=_.count;if(F===0)return;let V,K,Z=F,Y=Number.POSITIVE_INFINITY;for(const m of _.edges){const S=oe(h(m),et);for(const w of St(m)){const T=H(m,w),N=!T&&k(m,w),D=I(_,m,w),W=oe(w,et);T||N||!(D<F||D===F&&W<S)||D>Z||D===Z&&W>=Y||(V=m,K=w,Z=D,Y=W)}}if(V&&K){V.points=K;continue}const q=pn(_);if(!q)return;for(const[m,S]of q)m.points=S}}d(ws,"resolveRenderedOrthogonalCrossings");var be=.001,Zr=8;function As(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(l=>l.rect.top))-r,bottom:Math.max(...o.map(l=>l.rect.bottom))+r,left:Math.min(...o.map(l=>l.rect.left))-r,right:Math.max(...o.map(l=>l.rect.right))+r},a=d((l,x,C,b)=>{const v=[],L=uo(l,x,C,b,r,be);return L&&v.push(L),x===b&&v.push(ho(l,x,C,i[x])),v},"buildOrthogonalPathCandidates"),c=d((l,x)=>{for(let C=0;C<l.length-1;C++){const b=l[C],v=l[C+1];if(Pt(b,v,o,x,1))return!0}return!1},"pathHitsNode"),f=d((l,x,C=!1)=>{let b=0;const v=Be(l,be),L=x.start,y=x.end;for(const I of t){if(I===x||I.isLayoutOnly)continue;const E=I.start,A=I.end;if(!C&&L&&y&&(E===L||E===y||A===L||A===y))continue;const B=I.points;if(!(!B||B.length<2))for(const O of v)for(const k of Be(B,be)){if(mo(O.a,O.b,k.a,k.b,be,be)){b++;continue}de(O,k,be)>=Zr&&b++}}return b},"pathConflictCount"),g=4,p=d((l,x)=>{const C=Math.abs(l.y-x.rect.top),b=Math.abs(l.y-x.rect.bottom),v=Math.abs(l.x-x.rect.left),L=Math.abs(l.x-x.rect.right);let y="top",I=C;return b<I&&(y="bottom",I=b),v<I&&(y="left",I=v),L<I&&(y="right",I=L),y},"nearestSideOfRect"),M=new Map,u=d((l,x,C)=>{const b=M.get(l)??[];b.push({side:x,edgeId:C}),M.set(l,b)},"addFaceClaim");for(const l of t){if(l.isLayoutOnly)continue;const x=l.points??[];if(x.length<1)continue;const C=l.id??"",b=l.start,v=l.end;if(b){const L=n.get(b);L&&u(b,p(x[0],L),C)}if(v){const L=n.get(v);L&&u(v,p(x[x.length-1],L),C)}}const h=d((l,x,C)=>{var b;return((b=M.get(l))==null?void 0:b.some(v=>v.edgeId!==C&&v.side===x))??!1},"faceIsClaimed");for(const l of t){if(l.isLayoutOnly)continue;const x=l.points;if(!x||x.length<2)continue;const C=oe(x,be);if(C<g)continue;const b=l.start,v=l.end;if(!b||!v)continue;const L=n.get(b),y=n.get(v);if(!L||!y)continue;const I=l.id??"",E=f(x,l,!0),A=f(x,l);let B,O=E,k=C;for(const H of s){if(h(b,H,I))continue;const P=Le(L,H);for(const G of s){if(h(v,G,I))continue;const j=Le(y,G);for(const tt of a(P,H,j,G)){if(c(tt,[b,v]))continue;const ft=oe(tt,be);if(E>0){const Mt=f(tt,l,!0);if(Mt>O||Mt===O&&ft>=k)continue;O=Mt,k=ft,B=tt;continue}f(tt,l)>A||ft<k&&(k=ft,B=tt)}}}if(B){l.points=B;const H=M.get(b);H&&M.set(b,H.filter(G=>G.edgeId!==I));const P=M.get(v);P&&M.set(v,P.filter(G=>G.edgeId!==I)),u(b,p(B[0],L),I),u(v,p(B[B.length-1],y),I)}}}d(As,"simplifyDetouredEdges");var Qt=.001,Fo=10,Ke=7;function Un(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,a=r.y-s.y;if(!(Math.abs(i)+Math.abs(a)<Qt)){if(Math.abs(a)<=Qt){const f=s.x+Math.sign(i)*Fo;return{left:Math.min(s.x,f),right:Math.max(s.x,f),top:s.y-Ke,bottom:s.y+Ke}}if(Math.abs(i)<=Qt){const f=s.y+Math.sign(a)*Fo;return{left:s.x-Ke,right:s.x+Ke,top:Math.min(s.y,f),bottom:Math.max(s.y,f)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}d(Un,"markerClearanceRectFor");function Rs(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)}}d(Rs,"normalizeRect");function Wn(t,e){const n=xt(e),o=Un(n,!0),s=Un(n,!1);return[o,s].some(r=>r&&en(t,Rs(r)))}d(Wn,"labelOverlapsOwnMarker");function Je(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const l=h.points;if(!(!l||l.length<2))for(let x=0;x<l.length-1;x++)n.push({edgeId:h.id,p1:l[x],p2:l[x+1]})}const o=[],s=[];for(const h of e.values()){const l=h.isGroup,x=h.parentId;if(l&&!x){const b=te(h);b&&s.push({id:h.id,rect:b});continue}if(l||h.isEdgeLabel)continue;const C=te(h);C&&o.push({nodeId:h.id,rect:C})}const r=3,i=1,a=12,c=d((h,l)=>{const x=Nn(l,r);for(const{nodeId:C,rect:b}of o)if(C!==h&&en(x,b))return!0;return!1},"labelOverlapsForeignNode"),f=d((h,l)=>{const x=Nn(l,r);for(const C of n)if(C.edgeId!==h&&dn(C.p1,C.p2,x))return!0;return!1},"labelOverlapsForeignEdge"),g=d((h,l,x)=>c(h,x)||f(l,x),"labelOverlapsAnything"),p=[],M=d(h=>{for(const{id:l,rect:x}of s)if(ss(x,h))return l},"findContainingLane"),u=d((h,l)=>p.some(x=>x.labelId!==h&&en(l,x.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const l=h.labelNodeId;if(!l)continue;const x=e.get(l);if(!x)continue;const C=h.points;if(!C||C.length<2)continue;const b=x.width??0,v=x.height??0;if(b<=0||v<=0)continue;const L=[];for(let nt=0;nt<C.length-1;nt++){const J=C[nt],rt=C[nt+1],ut=Math.abs(J.x-rt.x),pt=Math.abs(J.y-rt.y);ut<Qt&&pt<Qt||ut>=Qt&&pt>=Qt||L.push({idx:nt,length:ut+pt,orientation:ut>=Qt?"horizontal":"vertical",midX:(J.x+rt.x)/2,midY:(J.y+rt.y)/2})}if(L.length===0)continue;const y=L.length>=3?L.filter(nt=>nt.idx>0&&nt.idx<L.length-1):L,I=y.length>0?y:L,E=b>=v?"horizontal":"vertical",A=d(nt=>[...nt].sort((J,rt)=>{const ut=J.orientation===E,pt=rt.orientation===E;if(ut!==pt)return ut?-1:1;const St=J.length>=(J.orientation==="horizontal"?b:v)+2,wt=rt.length>=(rt.orientation==="horizontal"?b:v)+2;return St!==wt?St?-1:1:rt.length-J.length}),"rankSegments"),B=L[0],O=L[L.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((nt,J)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*J,midY:rt.y+(ut.y-rt.y)*J}},"anchorAtT"),P=d((nt,J,rt)=>Math.min(rt,Math.max(J,nt)),"clamp"),G=d((nt,J)=>nt.midX>=J.left-Qt&&nt.midX<=J.right+Qt&&nt.midY>=J.top-Qt&&nt.midY<=J.bottom+Qt,"pointInsideRectInclusive"),j=d(nt=>{const J=Pe(nt.midX,nt.midY,b,v),rt=M(J);if(rt)return{laneId:rt,anchor:nt,rect:J};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const pt=ut.rect.left+b/2+i,St=ut.rect.right-b/2-i,wt=ut.rect.top+v/2+i,Kt=ut.rect.bottom-v/2-i;if(pt>St||wt>Kt)return;const qt={midX:P(nt.midX,pt,St),midY:P(nt.midY,wt,Kt)},Jt=Pe(qt.midX,qt.midY,b,v);return G(nt,Jt)?{laneId:ut.id,anchor:qt,rect:Jt}:void 0},"placementForAnchor"),tt=d((nt,J,rt)=>nt.orientation==="horizontal"?Math.abs(J.midX-rt.x):Math.abs(J.midY-rt.y),"distanceAlongSegment"),ft=d((nt,J)=>{const ut=(nt.orientation==="horizontal"?b/2:v/2)+a;if(nt===B){const pt=C[nt.idx];if(tt(nt,J,pt)+Qt<ut)return!1}if(nt===O){const pt=C[nt.idx+1];if(tt(nt,J,pt)+Qt<ut)return!1}return!0},"labelClearsTerminalEndpoints"),Mt=d(nt=>{const J=A(nt);for(const rt of J)for(const ut of k){const pt=H(rt,ut);if(!ft(rt,pt))continue;const St=j(pt);if(St&&!Wn(St.rect,C)&&!u(l,St.rect)&&!g(l,h.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Ht=d((nt,J,rt=!1)=>{const ut=A(nt);for(const pt of ut){const St={midX:pt.midX,midY:pt.midY};if(J&&!ft(pt,St))continue;const wt=j(St);if(wt&&!Wn(wt.rect,C)&&!u(l,wt.rect)&&!c(l,wt.rect)&&(rt||!f(h.id,wt.rect)))return{laneId:wt.laneId,anchor:wt.anchor}}},"findLaneContainingFallback"),Ft=Mt(I)??(I.length<L.length?Mt(L):void 0)??Ht(L,!0)??Ht(L,!1)??Ht(L,!1,!0);if(Ft){x.x=Ft.anchor.midX,x.y=Ft.anchor.midY,x.parentId=Ft.laneId;const nt=Pe(Ft.anchor.midX,Ft.anchor.midY,b,v),J=p.findIndex(rt=>rt.labelId===l);J>=0?p[J]={labelId:l,rect:nt}:p.push({labelId:l,rect:nt})}}}d(Je,"anchorLabelsToPolyline");var En=1e-6,Qr=8,Do=Qr/2,ti=3;function Kn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}d(Kn,"pairKey");function Ns(t,e){const{nodeInfoById:n,realNodeRects:o}=un(e),s=new Map;for(const i of e){const a=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(a,{w:i.width??0,h:i.height??0});continue}}const r=d((i,a,c,f)=>{const g=Kn(a,c);let p=0;const M=d(u=>{if(!u)return;const h=s.get(u);if(!h)return;const l=f==="x"?h.w/2:h.h/2;l>p&&(p=l)},"consider");M(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const h=u.start,l=u.end;!h||!l||Kn(h,l)===g&&M(u.labelNodeId)}return p>0?p+ti:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const a=i.points;if(!lo(a,En))continue;const c=go(i,n,En);if(!c)continue;const{srcId:f,dstId:g,srcInfo:p,dstInfo:M,collinearX:u,collinearY:h}=c;if(u===h)continue;let l,x;if(u){const y=M.cy>p.cy;l={x:p.cx,y:y?p.rect.bottom:p.rect.top},x={x:M.cx,y:y?M.rect.top:M.rect.bottom}}else{const y=M.cx>p.cx;l={x:y?p.rect.right:p.rect.left,y:p.cy},x={x:y?M.rect.left:M.rect.right,y:M.cy}}if(Pt(l,x,o,[f,g],1))continue;const b=r(i,f,g,u?"x":"y"),v=b>Do?b:Do,L=[0,v,-v];for(const y of L){const I={...l},E={...x};if(u){if(I.x+=y,E.x+=y,I.x<=p.rect.left||I.x>=p.rect.right||E.x<=M.rect.left||E.x>=M.rect.right)continue}else if(I.y+=y,E.y+=y,I.y<=p.rect.top||I.y>=p.rect.bottom||E.y<=M.rect.top||E.y>=M.rect.bottom)continue;if(!Pt(I,E,o,[f,g],1)&&!nn(I,E,t,i,{epsilon:En})){i.points=[I,E];break}}}}d(Ns,"straightenCollinearSiblingDetours");function qn(t,e){const{realNodeRects:c,labelNodeRects:f}=Me(e.values()),g=d((y,I)=>Be(I,.001).map(E=>({...E,edge:y,interior:E.index>=1&&E.index<=I.length-3})),"segmentsFor"),p=d(()=>{const y=[];for(const I of t){if(I.isLayoutOnly)continue;const E=I.points;!E||E.length<2||y.push(...g(I,xt(E)))}return y},"allSegments"),M=d((y,I)=>y.horizontal&&I.horizontal?Wt(y.a.x,y.b.x,I.a.x,I.b.x)>=8&&Math.abs(y.a.y-I.a.y)<7:y.vertical&&I.vertical?Wt(y.a.y,y.b.y,I.a.y,I.b.y)>=8&&Math.abs(y.a.x-I.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((y,I)=>{const E=y.start,A=y.end,B=g(y,I);if(B.length!==I.length-1)return!1;const O=[E,A].filter(H=>!!H),k=y.labelNodeId?[y.labelNodeId]:[];for(const H of B)if(Pt(H.a,H.b,c,O,-2)||Pt(H.a,H.b,f,k,-2))return!1;for(const H of t){if(H===y||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of B)for(const j of g(H,xt(P)))if(M(G,j)||he(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=d((y,I)=>{const E=xt(y.edge.points??[]);if(E.length<4||y.index>=E.length-1)return;const A=E.map(B=>({...B}));if(y.horizontal)A[y.index].y+=I,A[y.index+1].y+=I;else if(y.vertical)A[y.index].x+=I,A[y.index+1].x+=I;else return;return g(y.edge,A).length===A.length-1?A:void 0},"shiftedCandidate"),l=d((y,I)=>({x:y.x??(I.left+I.right)/2,y:y.y??(I.top+I.bottom)/2}),"nodeCenter"),x=d(y=>{const I=y.edge,E=xt(I.points??[]);if(E.length!==4||y.index!==1)return;const A=I.start?e.get(I.start):void 0,B=I.end?e.get(I.end):void 0,O=A?te(A):void 0,k=B?te(B):void 0,H=E.slice(y.index+2);if(!(!A||!B||!O||!k||H.length===0))return{sourceCenter:l(A,O),targetCenter:l(B,k),sourceRect:O,tail:H}},"sourceDetourContextFor"),C=d((y,I,E,A,B,O)=>{const k=A.y>=E.y,H=k?B.bottom:B.top,P=H+(k?20:-20);if(k&&y.b.y<=P+.001||!k&&y.b.y>=P-.001)return;const G=y.a.x+I;return xt([{x:E.x,y:H},{x:E.x,y:P},{x:G,y:P},{x:G,y:y.b.y},...O],.001)},"verticalSourceDetour"),b=d((y,I,E,A,B,O)=>{const k=A.x>=E.x,H=k?B.right:B.left,P=H+(k?20:-20);if(k&&y.b.x<=P+.001||!k&&y.b.x>=P-.001)return;const G=y.a.y+I;return xt([{x:H,y:E.y},{x:P,y:E.y},{x:P,y:G},{x:y.b.x,y:G},...O],.001)},"horizontalSourceDetour"),v=d((y,I)=>{const E=x(y);if(E){if(y.vertical)return C(y,I,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(y.horizontal)return b(y,I,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),L=[-7,7,-14,14,-21,21];for(let y=0;y<12;y++){const I=p();let E=!1;for(let A=0;A<I.length&&!E;A++)for(let B=A+1;B<I.length&&!E;B++){const O=I[A],k=I[B];if(O.edge===k.edge||!M(O,k))continue;const H=[O,k].filter(P=>P.interior);for(const P of H){for(const G of L){const j=h(P,G);if(j&&u(P.edge,j)){P.edge.points=j,E=!0;break}const tt=v(P,G);if(tt&&u(P.edge,tt)){P.edge.points=tt,E=!0;break}}if(E)break}}if(!E)return}}d(qn,"nudgeSharedInteriorSubpaths");function Os(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=s*a-r*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,g=n.y-t.y,p=(f*a-g*i)/c,M=(f*r-g*s)/c,u=.01;return p>u&&p<1-u&&M>u&&M<1-u}d(Os,"segmentsIntersect");function Ps(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=rs(e),r=[];for(const a of n){if(a.isLayoutOnly)continue;const c=a.points;if(!c||c.length<2)continue;const f=a.start,g=a.end,p=a.labelNodeId,M=a.id??`${f}->${g}`;for(const u of s)if(!(u.nodeId===f||u.nodeId===g)&&!(p&&u.nodeId===p)){for(let h=0;h<c.length-1;h++)if(dn(c[h],c[h+1],u,-1)){o.push({type:"edge-node-overlap",edgeId:M,targetId:u.nodeId,detail:`segment ${h} passes through node "${u.nodeId}"`});break}}for(let u=0;u<c.length-1;u++)r.push({edgeId:M,start:f,end:g,p1:c[u],p2:c[u+1]})}const i=new Set;for(let a=0;a<r.length;a++)for(let c=a+1;c<r.length;c++){const f=r[a],g=r[c];if(f.edgeId!==g.edgeId&&!(f.start===g.start||f.start===g.end||f.end===g.start||f.end===g.end)&&Os(f.p1,f.p2,g.p1,g.p2)){const p=f.edgeId<g.edgeId?`${f.edgeId}|${g.edgeId}`:`${g.edgeId}|${f.edgeId}`;i.has(p)||(i.add(p),o.push({type:"edge-edge-crossing",edgeId:f.edgeId,targetId:g.edgeId,detail:`edges "${f.edgeId}" and "${g.edgeId}" cross`}))}}if(o.length>0){const a=o.filter(f=>f.type==="edge-node-overlap").length,c=o.filter(f=>f.type==="edge-edge-crossing").length;Qe.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${a} edge-node overlap(s), ${c} edge crossing(s)`);for(const f of o)Qe.warn(`[SWIMLANE_VALIDATE] ${f.type}: ${f.detail}`)}return o}d(Ps,"validateSwimlanesLayout");function Bs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!Ms(t,e)||e==="BT"&&s.length>0&&!bs(t))return;for(const a of o){if(a.isLayoutOnly)continue;const c=a.points;!c||c.length<2||(a.points=ue(on(c)))}As(o,n),Ns(o,n),Is(o,n);const r=new Map;for(const a of n)r.set(String(a.id),a);Je(o,r),fs(o,r),Ss(o,r),qn(o,r),Cs(o,r),vs(o,r),zn(o,r),Ls(o,r);const i=d(()=>{ws(o,r),Es(o,r),Ts(o,r),Je(o,r),Gn(o,r),zn(o,r),Je(o,r),Gn(o,r)},"finalizeRenderedEdges");i(),qn(o,r),i(),Vn(o,r),jn(o,r),Vn(o,r),jn(o,r)}d(Bs,"postProcessSwimlaneLayout");function Ie(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(Ie,"normalizeGraph");function Mo(t,e){return t.edges.filter(n=>n.dst===e)}d(Mo,"incoming");function ks(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(ks,"buildSuccessorMap");function Io(t){const e=ks(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(Io,"buildSortedSuccessorMap");function So(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(So,"buildInDegreeMap");function Co(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(Co,"sortedZeroInDegreeNodes");function hn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(hn,"buildPredecessorSuccessorMaps");function vo(t,e,n,o){var i,a;let s=0;for(const c of t.nodes)o!=null&&o.skipGroups&&((i=t.nodeById.get(c))!=null&&i.isGroup)||(s=Math.max(s,n[c]??0));const r=Array.from({length:s+1},()=>[]);for(const c of e)o!=null&&o.skipGroups&&((a=t.nodeById.get(c))!=null&&a.isGroup)||r[Math.max(0,n[c]??0)].push(c);return r}d(vo,"buildLayersFromRanks");function De(t){const e=So(t),n=Co(e),o=[],s=Io(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let a=0;for(;a<n.length&&n[a]<i;)a++;n.splice(a,0,i)}}return o.length===t.nodes.length?o:null}d(De,"topoSortIfAcyclic");function ke(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}d(ke,"buildLayerIndex");function Lo(t){const e=new Array(t.length),n=d((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),a=o,c=r,f=o;for(;a<r||c<s;)c>=s||a<r&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=r-a);for(let g=o;g<s;g++)t[g]=e[g];return i},"count");return n(0,t.length)}d(Lo,"countInversions");function _s(t){const e=Ie(t),n=new Map;for(const g of e.nodes)n.set(g,[]);for(const g of e.edges)n.get(g.src).push(g);for(const g of n.values())g.sort((p,M)=>p.dst===M.dst?p.id.localeCompare(M.id):p.dst.localeCompare(M.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const p of n.get(g)??[]){const M=p.dst;o[M]===0?r(M):o[M]===1&&s.push(p)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,p)=>g.localeCompare(p));for(const g of i)o[g]===0&&r(g);const a=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),c=e.edges.map(g=>a.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(_s,"removeCycles_DFS");function Fs(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const a=n(r)??r;return e.set(o,a),a},"resolve");for(const o of t.nodes)n(o);return e}d(Fs,"buildTopLaneMap");function ge(t){const e=Fs(t);return n=>e.get(n)??null}d(ge,"createTopLaneResolver");function gn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(gn,"buildTopLaneOrder");function Eo(t,e){const n=gn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(Eo,"resolveTopLaneOrder");var ei={EPSILON:1e-6},ln={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Ho={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Ds(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=hn(n);for(const y of r.values())y.sort((I,E)=>I.localeCompare(E));const i=De(n)??[...n.nodes].sort((y,I)=>y.localeCompare(I)),a=new Map;for(const[y,I]of i.entries())a.set(I,y);const c=new Map,f=new Map;for(const y of n.nodes)f.set(y,[]);for(const y of i){const I=(r.get(y)??[]).filter(E=>c.has(E));if(I.length>0){const E=Hs(y,I,{laneOf:o,rankHint:s,topoIndex:a});c.set(y,E),f.get(E).push(y)}else c.has(y)||c.set(y,null)}for(const y of n.nodes)c.has(y)||c.set(y,null);const g=new Set;for(const y of n.nodes)(c.get(y)??null)===null&&g.add(y);const p=[...g].sort((y,I)=>{const E=a.get(y)??0,A=a.get(I)??0;return E===A?y.localeCompare(I):E-A}),M=Xs(n),u=new Map;for(const[y,I]of M.entries())u.set(y,[...I].sort((E,A)=>E.localeCompare(A)));const h=Ys(u),l=Gs(u),x=new Map;for(const y of n.nodes)x.set(y,[]);for(const y of l)for(const I of y.nodes){const E=x.get(I);E?E.push(y.id):x.set(I,[y.id])}const C=[],b=[],v=new Set,L=d(y=>{if(!v.has(y)){v.add(y),C.push(y);for(const I of f.get(y)??[])L(I);b.push(y)}},"walk");for(const y of p)L(y);for(const y of i)L(y);return{parent:c,children:f,roots:p,componentOf:h,blocks:l,nodeBlocks:x,adjacency:u,preorder:C,postorder:b,topologicalOrder:i}}d(Ds,"buildDrivingTree");function Hs(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{var l,x;const a=n.laneOf(r),c=n.laneOf(i),f=a!=null&&a===o,g=c!=null&&c===o;if(f!==g)return f?-1:1;const p=(l=n.rankHint)==null?void 0:l[r],M=(x=n.rankHint)==null?void 0:x[i];if(p!=null&&M!=null&&p!==M)return M-p;const u=n.topoIndex.get(r)??0,h=n.topoIndex.get(i)??0;return u!==h?u-h:r.localeCompare(i)})[0]}d(Hs,"chooseParent");function Xs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Xs,"buildAdjacency");function Ys(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Ys,"assignComponents");function Gs(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((a,c)=>{e.set(a,++r),n.set(a,r);for(const f of t.get(a)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(a)??0)&&(o.push([a,f]),n.set(a,Math.min(n.get(a)??r,e.get(f)??r))):(o.push([a,f]),i(f,a),n.set(a,Math.min(n.get(a)??r,n.get(f)??r)),(n.get(f)??0)>=(e.get(a)??0)&&s.push($s(a,f,o,s.length))))},"visit");for(const a of t.keys())e.has(a)||i(a,null);return s}d(Gs,"computeBlocks");function $s(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d($s,"popBlock");function zs(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,v]of o.entries())s.set(v,b);const r=o.length,i=new Array(r).fill(-1),a=new Array(r).fill(0),c=[],f=new Set;for(const b of o){const v=n.parent.get(b)??null,L=s.get(b);L!=null&&v==null&&(i[L]=-1,a[L]=0,f.has(b)||(f.add(b),c.push(b)))}for(;c.length>0;){const b=c.shift(),v=s.get(b);if(v==null)continue;const L=n.children.get(b)??[];for(const y of L){if(f.has(y))continue;const I=s.get(y);I!=null&&(i[I]=v,a[I]=a[v]+1,f.add(y),c.push(y))}}for(const b of o){if(f.has(b))continue;const v=s.get(b);v!=null&&(i[v]=-1,a[v]=0,f.add(b))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:g},()=>new Array(r).fill(-1));for(let b=0;b<r;b++)p[0][b]=i[b];for(let b=1;b<g;b++)for(let v=0;v<r;v++){const L=p[b-1][v];p[b][v]=L===-1?-1:p[b-1][L]}const M=d((b,v)=>{if(b===-1||v===-1)return-1;a[b]<a[v]&&([b,v]=[v,b]);const L=a[b]-a[v];for(let y=0;y<g;y++)if(L>>y&1&&(b=p[y][b],b===-1))return-1;if(b===v)return b;for(let y=g-1;y>=0;y--){const I=p[y][b],E=p[y][v];I===-1||E===-1||I!==E&&(b=I,v=E)}return p[0][b]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const b of t.edges){let v=b.src,L=b.dst,y=e[v],I=e[L];if(y==null||I==null||(y>I&&([v,L]=[L,v],[y,I]=[I,y]),y==null||I==null||y===I))continue;const E=s.get(v),A=s.get(L);if(E==null||A==null)continue;const B=M(E,A);if(B===-1)continue;const O=u[B];for(let k=y;k<I;k++)O.set(k,(O.get(k)??0)+1)}const h=new Map,l=d((b,v)=>{if(v.size!==0)for(const[L,y]of v)b.set(L,(b.get(L)??0)+y)},"mergeInto"),x=new Set,C=d(b=>{const v=s.get(b);x.add(b);const L=v==null?void 0:u[v],y=L?new Map(L):new Map,I=n.children.get(b)??[];for(const E of I){const A=C(E),B=e[b];if(B!=null){let O=h.get(b);O||(O=new Map,h.set(b,O));let k=A.get(B)??0;const H=e[E];H!=null&&H>B&&(k+=1),O.set(E,k)}l(y,A)}return y},"dfs");for(const b of n.roots)x.has(b)||C(b);for(const b of o)x.has(b)||C(b);return h}d(zs,"computeSubtreeCrossCounts");function Vs(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const a=[...e.get(r)??[]];a.sort(To(n));for(const c of a){s(c);const f=o.get(c);f!=null&&(i=Math.min(i,f))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Vs,"annotateMinimumLayers");function To(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(To,"compareByRankThenId");function js(t,e,n,o){let s=0;for(const c of e){const f=n[c]??0;f>s&&(s=f)}const r=Array.from({length:s+1},()=>[]),i=new Set,a=d(c=>{if(i.has(c))return;i.add(c);const f=n[c]??0;r[f]||(r[f]=[]),r[f].push(c);for(const g of o(c))a(g)},"emit");for(const c of t)a(c);for(const c of e)if(!i.has(c)){const f=n[c]??0;r[f]||(r[f]=[]),r[f].push(c),i.add(c)}return r}d(js,"emitNodesInTreeOrder");function Us(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d(Us,"deduplicateLayers");function Ws(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,a=[],c=[],f=n.get(s);for(const g of r){const p=o.get(g)??i;p>i?a.push({child:g,min:p}):c.push(g)}return a.sort((g,p)=>g.min===p.min?g.child.localeCompare(p.child):g.min-p.min),c.sort((g,p)=>{const M=(f==null?void 0:f.get(g))??0,u=(f==null?void 0:f.get(p))??0;if(M!==u)return M-u;const h=o.get(g)??i,l=o.get(p)??i;return h!==l?h-l:g.localeCompare(p)}),[...a.map(g=>g.child),...c]}}d(Ws,"createChildOrderer");function fn(t,e,n){const o=Ds(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const i=zs(t,e,o),a=[...r].sort(To(e)),c=Vs(a,s,e),f=Ws(s,e,i,c);let g=js(a,t.nodes,e,f);return g=Us(g),g}d(fn,"buildMultitreeLayerOrder");function Ks(t,e,n){const o=new Set(t),s=new Set(e),r=ke(e),i=[];for(const a of n)o.has(a.src)&&s.has(a.dst)&&i.push(r.get(a.dst));return Lo(i)}d(Ks,"countCrossingsBetweenAdjacent");function Jn(t,e,n){const o=[];for(const r of e){const i=n[r.src],a=n[r.dst];if(i==null||a==null||i===a)continue;let c=r.src,f=r.dst,g=i,p=a;i>a&&(c=r.dst,f=r.src,g=a,p=i);for(let M=g;M<p;M++)o.push({id:`${r.id}@${M}`,src:c,dst:f,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Ks(t[r],t[r+1],o);return s}d(Jn,"totalCrossings");function qs(t,e){const n={...e},{preds:o}=hn(t),s=ge(t),r=fn(t,n,s);let i=Jn(r,t.edges,n);const a=ln.MAX_CROSSING_OPTIMIZATION_PASSES;for(let c=0;c<a;c++){let f=!1;const g=[...t.nodes].sort((p,M)=>(n[M]??0)-(n[p]??0));for(const p of g){const M=n[p]??0;if(M===0)continue;let u=0;for(const C of o.get(p)??[])u=Math.max(u,(n[C]??0)+1);if(u>=M)continue;const h=M;n[p]=u;const l=fn(t,n,s),x=Jn(l,t.edges,n);x<i?(i=x,f=!0):n[p]=h}if(!f)break}return n}d(qs,"optimizeRanksByCrossings");function Js(t,e){const n=ge(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(l=>l.src===s);if(i.length===0)continue;let a=!1,c=0;for(const l of i){const x=n(l.dst);x==null||x===r?a=!0:c++}if(c===0||a)continue;let f=0,g=!1;for(const l of t.edges){if(l.dst!==s)continue;const x=n(l.src);x&&(x===r?g=!0:f++)}if(f>0||!g)continue;const p=e[s]??0,M=p+c;let u=0;for(const l of t.edges)l.dst===s&&(u=Math.max(u,(e[l.src]??0)+1));const h=Math.max(p,u,M);h!==p&&(e[s]=h)}}d(Js,"adjustCrossLaneSources");function Zs(t,e){const n=Ie(t),o=De(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=ge(n);let i=Object.create(null);for(const c of o){const f=Mo(n,c),g=e!=null&&e.ignoreCrossLaneEdges?f.filter(p=>{const M=r(p.src),u=r(c);return!M||!u?!0:M===u}):f;if(g.length===0)i[c]=0;else if(s&&g.length===1){const p=g[0].src,M=r(p),u=r(c);M!==u?i[c]=i[p]??0:i[c]=(i[p]??0)+1}else{let p=-1/0;for(const M of g)p=Math.max(p,(i[M.src]??0)+1);i[c]=p===-1/0?0:p}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(i=qs(n,i)),e!=null&&e.ignoreCrossLaneEdges&&Js(n,i),{layers:fn(n,i,r),rankOf:i,dummy:new Set}}d(Zs,"assignLayers_LongestPath");function Qs(t,e){const n=Ie(t),s={...Zs(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=ge(n),{preds:i,succs:a}=hn(n,h=>{if(e!=null&&e.ignoreCrossLaneEdges){const l=r(h.src),x=r(h.dst);if(l&&x&&l!==x)return!1}return!0}),c=De(n)??[...n.nodes],f=[...c].reverse(),g=d((h,l)=>{let x=0;for(const v of i.get(h)??[])x=Math.max(x,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY;const b=a.get(h)??[];return b.length>0&&(C=Math.min(...b.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(x,l)),Math.min(Math.max(l,x),C)},"clampFeasible"),p=ln.GRAVITY_ITERATIONS,M=d(h=>{let l=!1;for(const x of h){const C=i.get(x)??[],b=a.get(x)??[];if(C.length===0&&b.length===0)continue;const v=C.length>0?C.reduce((E,A)=>E+(s[A]??0)+1,0)/C.length:s[x]??0,L=b.length>0?b.reduce((E,A)=>E+(s[A]??0)-1,0)/b.length:s[x]??0,y=Math.round((v+L)/2),I=g(x,y);I!==s[x]&&(s[x]=I,l=!0)}return l},"relaxOrder");for(let h=0;h<p;h++){const l=M(c),x=M(f);if(!l&&!x)break}for(const h of c){let l=0;for(const x of i.get(h)??[])l=Math.max(l,(s[x]??0)+1);(s[h]??0)<l&&(s[h]=l)}for(const h of f){const l=a.get(h)??[];if(l.length>0){const x=Math.min(...l.map(C=>(s[C]??0)-1));(s[h]??0)>x&&(s[h]=x)}}return{layers:vo(n,c,s),rankOf:s,dummy:new Set}}d(Qs,"assignLayers_Gravity");function tr(t){const e=So(t),n=Io(t);let o=Co(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const a of n.get(i)??[])e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0&&r.push(a)}o=r.sort((i,a)=>i.localeCompare(a))}return s.length===t.nodes.length?s:null}d(tr,"topoSortByGenerationIfAcyclic");function er(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?tr(n)??[...n.nodes].sort():De(n)??[...n.nodes].sort(),s=ge(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),a=new Map,c=d((g,p)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(g)===r(p)?1:0:1,"edgeWeight");for(const g of o){const p=n.nodeById.get(g);if(p!=null&&p.isGroup)continue;const M=Mo(n,g);let u=0;if(M.length>0)for(const C of M){const b=C.src,v=i[b]??0;u=Math.max(u,v+c(b,g))}const h=r(g),l=a.get(h)??0,x=Math.max(u,l);i[g]=x,a.set(h,x+1)}return{layers:vo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(er,"assignLayers_LaneAwareCompact");function nr(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const a=new Map(n.nodeById),c=d(u=>{const h=`placeholder-${i++}`,l={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(h,l),r.add(h);s.length<=u;)s.push([]);return s[u].push(h),o[h]=u,h},"addDummyAt"),f=[...n.edges].sort((u,h)=>u.id===h.id?u.src===h.src?u.dst.localeCompare(h.dst):u.src.localeCompare(h.src):u.id.localeCompare(h.id)),g=[];for(const u of f){const h=o[u.src]??0,l=o[u.dst]??0;if(l-h<=1){g.push(u);continue}let x=u.src;for(let b=h+1,v=0;b<l;b++,v++){const L=c(b);g.push({id:`${u.id}#${v}`,src:x,dst:L,weight:u.weight,ref:u.ref}),x=L}const C=l-h-2;g.push({id:`${u.id}#${Math.max(C+1,0)}`,src:x,dst:u.dst,weight:u.weight,ref:u.ref})}const M={nodes:[...n.nodes,...[...r].filter(u=>!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:a};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:M}}d(nr,"makeProperLayering");function Zn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Zn,"median");function Qn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Qn,"barycenter");function or(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(or,"neighborPositionsFor");function sr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(sr,"currentOrderTieBreak");function to(t,e,n){const o=new Set(t),s=new Set(e),r=ke(t),i=ke(e),a=[];for(const f of n)o.has(f.src)&&s.has(f.dst)&&a.push({u:r.get(f.src),v:i.get(f.dst)});a.sort((f,g)=>f.u===g.u?f.v-g.v:f.u-g.u);const c=a.map(f=>f.v);return Lo(c)}d(to,"countCrossingsBetweenAdjacent");function Ze(t,e,n){return[...t].sort((o,s)=>{const r=Zn(e.get(o)??[]),i=Zn(e.get(s)??[]);return r===i?sr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(Ze,"sortByHeuristic");function eo(t,e,n,o,s,r){const i=ke(t),a=ke(e),c=or(e,i,n,o);if(!s||!r||r.length===0)return Ze(e,c,a);const f=new Map;for(const M of e){const u=s(M),h=f.get(u)??[];h.push(M),f.set(u,h)}const g=[];for(const M of r){const u=f.get(M);if(!u||u.length===0)continue;const h=Ze(u,c,a);g.push(...h)}const p=f.get(null);if(p&&p.length>0){const M=Ze(p,c,a);for(const u of M){const h=Qn(c.get(u)??[]);let l=g.length;if(isFinite(h))for(const[x,C]of g.entries()){const b=Qn(c.get(C)??[]);if(h<b){l=x;break}}g.splice(l,0,u)}}return g}d(eo,"reorderLayer");function no(t,e,n,o,s){const r=[...e],i=new Set(t),a=new Set(e),c=o?new Set(o):null,f=n.filter(l=>i.has(l.src)&&a.has(l.dst)),g=c?n.filter(l=>a.has(l.src)&&c.has(l.dst)):void 0,p=d(l=>{let x=to(t,l,f);return g&&o&&(x+=to(l,o,g)),x},"crossingScore"),M=s?new Map:null;if(s&&M)for(const l of e)M.set(l,s(l));let u=!0,h=p(r);for(;u;){u=!1;for(let l=0;l+1<r.length;l++){if(M){const b=M.get(r[l]),v=M.get(r[l+1]);if(b!==v)continue}const x=h;[r[l],r[l+1]]=[r[l+1],r[l]];const C=p(r);C<x?(h=C,u=!0):[r[l],r[l+1]]=[r[l+1],r[l]]}}return r}d(no,"transposeImprove");function rr(t,e,n){const o=t.layers.map(a=>[...a]),s=e.edges,r=ge(e),i=Eo(e,n==null?void 0:n.laneOrder);for(let a=0;a<3;a++){for(let c=1;c<o.length;c++)o[c]=eo(o[c-1],o[c],s,"down",r,i),o[c]=no(o[c-1],o[c],s,o[c+1],r);for(let c=o.length-2;c>=0;c--)o[c]=eo(o[c+1],o[c],s,"up",r,i),o[c]=no(o[c+1],o[c],s,o[c-1],r)}return{layers:o}}d(rr,"orderLayers");function ir(t,e,n){const o=(n==null?void 0:n.layerGap)??Ho.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??Ho.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,i=(n==null?void 0:n.direction)??"TB",a=i==="LR"||i==="RL",c=t.layers,f=Object.create(null),g=Object.create(null),p=d(O=>e.nodeById.get(O),"getNode"),M=d(O=>{var k;return((k=p(O))==null?void 0:k.width)??0},"getWidth"),u=d(O=>{var k;return((k=p(O))==null?void 0:k.height)??0},"getHeight"),h=ge(e),l=Eo(e,n==null?void 0:n.laneOrder),x=c.map(O=>O.reduce((k,H)=>Math.max(k,u(H)),0)),C=[];if(a)for(let O=0;O+1<c.length;O++){const k=c[O].reduce((Mt,Ht)=>Math.max(Mt,M(Ht)),0),H=c[O+1].reduce((Mt,Ht)=>Math.max(Mt,M(Ht)),0),P=x[O],G=x[O+1],j=P/2+G/2,tt=(k+H)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of c)for(const k of O)b.add(h(k));const v=b.has(null),L=l.filter(O=>b.has(O)),y=[...v?[null]:[],...L],I=Object.create(null);for(const O of L)I[O]=0;v&&(I.null=0);for(const O of c){const k=Object.create(null),H=[];for(const P of O){const G=h(P);G===null?H.push(P):(k[G]||(k[G]=[])).push(P)}for(const[P,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+M(ft),0)+s*Math.max(0,G.length-1);I[P]=Math.max(I[P]??0,j)}if(v&&H.length){const P=H.reduce((G,j)=>G+M(j),0)+s*Math.max(0,H.length-1);I.null=Math.max(I.null??0,P)}}const E=new Map;{const O=y.map(P=>(P===null?I.null:I[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,y.length-1))/2;for(let P=0;P<y.length;P++){const G=y[P],j=O[P]??0,tt=H+j/2;E.set(G,tt),H+=j,P<y.length-1&&(H+=r)}}let A=0;for(const[O,k]of c.entries()){const H=x[O]??0,P=new Map;for(const j of k){const tt=h(j),ft=P.get(tt)??[];ft.push(j),P.set(tt,ft)}for(const j of y){const tt=P.get(j)??[];if(tt.length===0)continue;const ft=E.get(j);if(tt.length===1){const Mt=tt[0];f[Mt]=ft,g[Mt]=A+H/2}else{const Mt=tt.map(nt=>M(nt)),Ht=Mt.reduce((nt,J)=>nt+J,0)+s*(tt.length-1);let Ft=ft-Ht/2;for(const[nt,J]of tt.entries()){const rt=Mt[nt];f[J]=Ft+rt/2,g[J]=A+H/2,Ft+=rt+s}}}const G=C[O]??0;A+=H+o+G}const B=new Map;for(const O of e.edges){const k=O.ref.id;B.has(k)||B.set(k,[]),B.get(k).push(O)}for(const[,O]of B){if(O.length===0)continue;const k=O[0].ref,H=k.start,P=k.end;if(H==null||P==null)continue;const G=Math.round(((f[H]??0)+(f[P]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===H||tt===P)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(f[tt]=G)}}return{x:f,y:g}}d(ir,"assignCoordinates");var cr=8;function ar(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}d(ar,"hashString");function lr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(lr,"mulberry32");function fr(t,e){const n=[...t],o=lr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(fr,"deterministicShuffle");function dr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(dr,"sourceDistance");function oo(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const a=n.get(s),c=n.get(r);a==null||c==null||(o+=i*Math.abs(a-c))}return o}d(oo,"laneArrangementCost");function ur(t){const e=gn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=ge(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,a=typeof r.end=="string"?r.end:void 0;if(!i||!a||!t.nodeById.has(i)||!t.nodeById.has(a))continue;const c=o(i),f=o(a);if(!c||!f||c===f)continue;const g=n.get(c),p=n.get(f);if(g==null||p==null)continue;const[M,u]=g<=p?[c,f]:[f,c],h=`${M}\0${u}`,l=s.get(h);l?l.weight++:s.set(h,{a:M,b:u,weight:1})}return[...s.values()]}d(ur,"buildWeightedLaneEdges");function so(t,e,n){const o=[...t];let s=oo(o,e),r=!0,i=0;const a=Math.max(1,o.length);for(;r&&i<a;){r=!1,i++;for(let c=0;c+1<o.length;c++){[o[c],o[c+1]]=[o[c+1],o[c]];const f=oo(o,e);f<s?(s=f,r=!0):[o[c],o[c+1]]=[o[c+1],o[c]]}}return{order:o,cost:s,sourceDistance:dr(o,n)}}d(so,"greedySwitch");function hr(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}d(hr,"isBetterCandidate");function gr(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return ar(`${t.join("|")}#${o}#${n}`)}d(gr,"seedForRestart");function mr(t,e={}){const n=gn(t);if(n.length<2)return n;const o=ur(t);if(o.length===0)return n;const s=new Map(n.map((a,c)=>[a,c]));let r=so(n,o,s);const i=Math.max(0,e.restarts??cr);for(let a=0;a<i;a++){const c=gr(n,o,a),f=fr(n,c),g=so(f,o,s);hr(g,r)&&(r=g)}return r.order}d(mr,"optimizeTopLaneOrder");function yr(t,e){const n=(e==null?void 0:e.ignoreCrossLaneEdges)??!0,o=(e==null?void 0:e.optimizeRanksByCrossings)??!0,s=Ie(t),r=e!=null&&e.automaticLaneOrdering?mr(s,{restarts:cr}):void 0,i=_s(s),a=i.acyclic,c=n?er(a,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??ln.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e==null?void 0:e.direction}):Qs(a,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??ln.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:g}=nr(c,a),p=rr(f,g,{laneOrder:r}),M=ir(p,g,{layerGap:e==null?void 0:e.layerGap,nodeGap:e==null?void 0:e.nodeGap,direction:e==null?void 0:e.direction,laneOrder:r});return{acyclic:a,reversed:i.reversed,layering:f,ordered:p,coordinates:M}}d(yr,"sugiyamaLayout");var lt=ei.EPSILON,ni=8,Ce=15,Ne=15,qe=25,ie=20,Tn=10;function ro(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,a=Math.abs(r),c=Math.abs(i);return a<lt&&c<lt?n:c>lt&&c*3>=a?i>0?"bottom":"top":a>lt?r>0?"right":"left":n}d(ro,"chooseOrthogonalSide");function io(t,e){return Math.abs(t.to-e.from)<lt||Math.abs(t.to-e.to)<lt?t.to:t.from}d(io,"sharedLineEndpointCoord");function ve(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}d(ve,"pointOnLine");function pr(t,e){var K,Z,Y,q;const n=t.nodes??[],o=t.edges??[],s=[];for(const m of o)m.isLayoutOnly||s.push({...m,__originalEdge:m});const r=new Map,i=new Map,a=[],c=e==="LR";for(const m of n)r.set(m.id,m);const f=n.filter(m=>m.isGroup&&!m.parentId);for(const m of f){const S={id:m.id},w=d(T=>{i.set(T.id,S),n.filter(N=>N.parentId===T.id).forEach(w)},"assignLane");w(m)}const g=n.filter(m=>!m.isGroup&&!m.isEdgeLabel).map(m=>{const S=m.width??10,w=m.height??10,T=m.x??0,N=m.y??0,D=ni;return{nodeId:m.id,minX:T-S/2-D,maxX:T+S/2+D,minY:N-w/2-D,maxY:N+w/2+D,visualXHalfExtent:c?w/2+D:S/2+D}}),p=d((m,S,w,T)=>{let N=a.find(D=>D.orientation===m&&Math.abs(D.coord-S)<1);return N||(N={id:`pipe-${m}-${S.toFixed(0)}`,orientation:m,coord:S,spanMin:w,spanMax:T,tracks:[]},a.push(N)),N.spanMin=Math.min(N.spanMin,w),N.spanMax=Math.max(N.spanMax,T),N},"getOrAddPipe"),M=d((m,S)=>{const w=m.width??10,T=m.height??10,N=m.x??0,D=m.y??0;switch(S){case"top":return{x:N,y:D-T/2};case"bottom":return{x:N,y:D+T/2};case"left":return{x:N-w/2,y:D};case"right":return{x:N+w/2,y:D}}},"portForSide"),u=d((m,S,w)=>M(m,ro(m,S,w?"bottom":"top")),"getOrthogonalPort"),h=[],l=[],x=new Set,C=1e3,b=d((m,S,w)=>{if(h.length===0)return 0;const T=Math.abs(S.y-w.y)<lt,N=Math.abs(S.x-w.x)<lt;if(!T&&!N)return 0;let D=0;if(T){const W=S.y,ot=Math.min(S.x,w.x)-lt,U=Math.max(S.x,w.x)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="vertical"||z.pipe.coord<ot||z.pipe.coord>U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}else if(N){const W=S.x,ot=Math.min(S.y,w.y)-lt,U=Math.max(S.y,w.y)+lt;if(U<=ot)return 0;for(const z of h)z.edgeIndex===m||z.orientation!=="horizontal"||z.pipe.coord<ot||z.pipe.coord>U||z.from-lt<=W&&z.to+lt>=W&&(D+=C)}return D},"crossingPenalty"),v=s.map((m,S)=>{if(!m.start||!m.end)return{idx:S,crossLane:0,dx:0,dy:0};const w=r.get(m.start),T=r.get(m.end),N=i.get(m.start),D=i.get(m.end),W=N&&D&&N.id!==D.id?1:0,ot=w&&T?Math.abs((T.x??0)-(w.x??0)):0,U=w&&T?Math.abs((T.y??0)-(w.y??0)):0;return{idx:S,crossLane:W,dx:ot,dy:U}}).sort((m,S)=>{if(m.crossLane!==S.crossLane)return S.crossLane-m.crossLane;const w=m.dx+m.dy,T=S.dx+S.dy;return Math.abs(w-T)>1?w-T:m.idx-S.idx}).map(m=>m.idx),L=d((m,S,w,T)=>{const N=Math.min(m.x,S.x),D=Math.max(m.x,S.x),W=Math.min(m.y,S.y),ot=Math.max(m.y,S.y);return!!g.find(z=>w&&z.nodeId===w||T&&z.nodeId===T?!1:Math.abs(m.x-S.x)>lt?z.minY<m.y&&z.maxY>m.y&&z.maxX>N&&z.minX<D:z.minX<m.x&&z.maxX>m.x&&z.maxY>W&&z.minY<ot)},"isSegmentBlocked"),y=new Map,I=new Map;for(const m of s)!m.start||!m.end||m.start===m.end||(I.set(m.start,(I.get(m.start)??0)+1),I.set(m.end,(I.get(m.end)??0)+1));const E=d((m,S)=>ro(m,S,"bottom"),"determineSide"),A=new Map;for(const[m,S]of s.entries()){if(!S.start||!S.end||S.start===S.end||S.points&&S.points.length>0)continue;const w=r.get(S.start),T=r.get(S.end);if(!w||!T)continue;const N=(T.x??0)-(w.x??0),D=(T.y??0)-(w.y??0);A.set(m,{edgeIdx:m,srcId:S.start,dstId:S.end,srcSide:E(w,{x:T.x??0,y:T.y??0}),dstSide:E(T,{x:w.x??0,y:w.y??0}),absDx:Math.abs(N),absDy:Math.abs(D),dxSign:Math.sign(N),dySign:Math.sign(D)})}const B=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.absDx===0?1/0:m.absDy/m.absDx:m.absDy===0?1/0:m.absDx/m.absDy,"preferenceStrength"),O=d(m=>m.srcSide==="top"||m.srcSide==="bottom"?m.dxSign>=0?"right":"left":m.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const m of A.values()){const S=`${m.srcId}:${m.srcSide}`;k.has(S)||k.set(S,[]),k.get(S).push(m)}const H=new Map,P=d((m,S)=>`${m}:${S}`,"loadKey");for(const m of A.values())H.set(P(m.srcId,m.srcSide),(H.get(P(m.srcId,m.srcSide))??0)+1),H.set(P(m.dstId,m.dstSide),(H.get(P(m.dstId,m.dstSide))??0)+1);for(const m of k.values())if(!(m.length<2)){m.sort((S,w)=>{const T=B(S),N=B(w);return Math.abs(T-N)>1e-9?N-T:S.edgeIdx-w.edgeIdx});for(let S=1;S<m.length;S++){const w=m[S],T=O(w),N=H.get(P(w.srcId,w.srcSide))??0,D=H.get(P(w.srcId,T))??0;D>=N||(H.set(P(w.srcId,w.srcSide),N-1),H.set(P(w.srcId,T),D+1),w.srcSide=T)}}const G=d(m=>{const S=m==null?void 0:m.shape;return S==="question"||S==="diamond"},"isDiamondNode"),j=new Map;for(const m of A.values())j.has(m.dstId)||j.set(m.dstId,new Set),j.get(m.dstId).add(m.dstSide);for(const m of A.values()){if(!G(r.get(m.srcId)))continue;const S=j.get(m.srcId);if(!(S!=null&&S.has(m.srcSide)))continue;const w=O(m);if(S.has(w)||(H.get(P(m.srcId,w))??0)>0)continue;const T=H.get(P(m.srcId,m.srcSide))??0;H.set(P(m.srcId,m.srcSide),Math.max(0,T-1)),H.set(P(m.srcId,w),1),m.srcSide=w}for(const m of A.values()){const{edgeIdx:S,srcId:w,dstId:T,srcSide:N,dstSide:D}=m,W=r.get(w),ot=r.get(T),U=`${w}:${N}:src`,z=N==="top"||N==="bottom"?ot.x??0:ot.y??0;y.has(U)||y.set(U,[]),y.get(U).push({edgeIdx:S,oppositeCoord:z});const bt=`${T}:${D}:dst`,dt=D==="top"||D==="bottom"?W.x??0:W.y??0;y.has(bt)||y.set(bt,[]),y.get(bt).push({edgeIdx:S,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[m,S]of y){if(S.length<2)continue;S.sort((At,Gt)=>At.oppositeCoord-Gt.oppositeCoord);const w=m.split(":"),T=w.slice(0,-2).join(":"),N=w[w.length-2],D=w[w.length-1],W=r.get(T);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,z=W.shape,dt=z==="question"||z==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(S.length+1))),Bt=-(st*(S.length-1))/2;for(const[At,Gt]of S.entries()){const ee=Bt+At*st,xn=`${Gt.edgeIdx}:${D}`;tt.set(xn,ee)}}const Mt=d(m=>{var S;return!!((S=s[m])!=null&&S.labelNodeId)},"edgeHasLabelNode"),Ht=d((m,S)=>m?(y.get(`${m}:${S}:src`)??[]).some(({edgeIdx:w})=>Mt(w))||(y.get(`${m}:${S}:dst`)??[]).some(({edgeIdx:w})=>Mt(w)):!1,"faceHasLabelNode"),Ft=d((m,S,w)=>S==="top"||S==="bottom"?{x:m.x+w,y:m.y}:{x:m.x,y:m.y+w},"applyPortOffset"),nt=d((m,S,w)=>{const T=A.get(m),N={x:w.x??0,y:w.y??0},D={x:S.x??0,y:S.y??0},W=(T==null?void 0:T.srcSide)??E(S,N),ot=(T==null?void 0:T.dstSide)??E(w,D);let U=T?M(S,T.srcSide):u(S,N,!0),z=T?M(w,T.dstSide):u(w,D,!1);const bt=tt.get(`${m}:src`),dt=tt.get(`${m}:dst`);return bt!==void 0&&(U=Ft(U,W,bt)),dt!==void 0&&(z=Ft(z,ot,dt)),{pSrcPort:U,pDstPort:z,srcSide:W,dstSide:ot}},"portsForEdge");for(const m of v){const S=s[m];if(l[m]=[],!S.start||!S.end||S.points&&S.points.length>0||S.start===S.end)continue;const w=r.get(S.start),T=r.get(S.end);if(!w||!T)continue;const{pSrcPort:N,pDstPort:D,srcSide:W,dstSide:ot}=nt(m,w,T),U={...N},z={...D},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(w.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(w.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=D.y>(T.y??0);z.y=X?D.y+ie:D.y-ie}else{const X=D.x>(T.x??0);z.x=X?D.x+ie:D.x-ie}const ct=d((X,$)=>{for(const Q of g)if(!$.includes(Q.nodeId)&&X.x>Q.minX&&X.x<Q.maxX&&X.y>Q.minY&&X.y<Q.maxY)return{inside:!0,obstacle:Q};return{inside:!1}},"isPointInObstacle"),st=d((X,$,Q,ht,Tt)=>{if(Tt){const kt=X.y>($.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Ce:ht.minX-Ce,y:kt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:kt}}const Ct=X.x>($.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Ce:ht.minX-Ce,y:Rt?ht.maxY+Ne:ht.minY-Ne,leavesPositiveSide:Ct}},"obstacleDetour");let It=[];const Bt=[S.start,S.end],At=ct(U,Bt);if(At.inside&&At.obstacle){const X=At.obstacle;if(bt){const $=st(N,w,T,X,!0);U.x=$.x,U.y=$.y;const Q=$.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);It=[{x:N.x,y:Q},{x:$.x,y:Q},{x:$.x,y:$.y}]}else{const $=st(N,w,T,X,!1),Q=$.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=$.x,U.y=$.y,It=[{x:Q,y:N.y},{x:Q,y:$.y},{x:$.x,y:$.y}]}}let Gt=[];const ee=ct(z,Bt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const $=st(D,T,w,X,!0);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:D.x,y:$.y}]}else{const $=st(D,T,w,X,!1);z.x=$.x,z.y=$.y,Gt=[{x:$.x,y:$.y},{x:$.x,y:D.y}]}}if(It.length===0&&Gt.length===0){const X=Ce,$=Math.abs(U.x-z.x)<X,Q=Math.abs(U.y-z.y)<X,ht=tt.get(`${m}:src`)!==void 0||tt.get(`${m}:dst`)!==void 0,Tt=(((K=y.get(`${S.start??""}:${W}:src`))==null?void 0:K.length)??0)+(((Z=y.get(`${S.start??""}:${W}:dst`))==null?void 0:Z.length)??0),Ct=(((Y=y.get(`${S.end??""}:${ot}:src`))==null?void 0:Y.length)??0)+(((q=y.get(`${S.end??""}:${ot}:dst`))==null?void 0:q.length)??0),Rt=Tt>1||Ct>1,kt=I.get(S.start??"")??0,mt=I.get(S.end??"")??0,Vt=Tt>1&&Ht(S.start,W)||Ct>1&&Ht(S.end,ot),re=Tt<=1||kt<=2,Dt=Ct<=1||mt<=2;if(($||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Dt)&&!L(N,D,S.start,S.end)){S.points=[{...N},{...U},{...z},{...D}],x.add(m);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,D.x):Math.min(N.y,D.y),Et=Q?Math.max(N.x,D.x):Math.max(N.y,D.y),Zt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${m}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Et,tracks:[]};h.push({edgeIndex:m,segmentIndex:0,orientation:vt,pipe:Zt,trackIndex:0,from:Lt,to:Et});continue}}const xn=p("vertical",U.x,U.y,U.y);U.x=xn.coord;const Mr=p("vertical",z.x,z.y,z.y);z.x=Mr.coord;let ye=Math.min(U.x,z.x)-50,pe=Math.max(U.x,z.x)+50,we=Math.min(U.y,z.y)-50,Ae=Math.max(U.y,z.y)+50;for(const X of g){const $=Math.min(U.x,z.x),Q=Math.max(U.x,z.x),ht=Math.min(U.y,z.y),Tt=Math.max(U.y,z.y);X.minX<Q&&X.maxX>$&&X.minY<Tt&&X.maxY>ht&&(ye=Math.min(ye,X.minX-qe),pe=Math.max(pe,X.maxX+qe),we=Math.min(we,X.minY-qe),Ae=Math.max(Ae,X.maxY+qe))}for(const X of g){if(X.maxX<ye||X.minX>pe||X.maxY<we||X.minY>Ae)continue;const $=Ce;p("horizontal",X.minY-$,ye,pe),p("horizontal",X.maxY+$,ye,pe);const Q=Ne;p("vertical",X.minX-Q,we,Ae),p("vertical",X.maxX+Q,we,Ae)}p("horizontal",U.y,ye,pe),p("horizontal",z.y,ye,pe);const Ir=a.filter(X=>X.orientation==="horizontal"&&X.coord>=we&&X.coord<=Ae),Sr=a.filter(X=>X.orientation==="vertical"&&X.coord>=ye&&X.coord<=pe),He=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),Xe=He(U.x,U.y),wo=He(z.x,z.y),Ye=new Map,bn=new Map,Mn=new Map,Ge=new Set,Se=[];Ye.set(Xe,0),Mn.set(Xe,"n"),Se.push({key:Xe,f:Math.hypot(z.x-U.x,z.y-U.y),pt:U}),Ge.add(Xe);let $t=[];const xe=d((X,$)=>L(X,$,S.start,S.end),"checkSegmentBlocked"),In={x:z.x,y:U.y},Cr=xe(U,In),vr=xe(In,z),Lr=Cr||vr,Sn={x:U.x,y:z.y},Er=xe(U,Sn),Tr=xe(Sn,z);if(Lr?Er||Tr||(Math.abs(U.x-z.x)<lt?$t=[U,z]:$t=[U,Sn,z]):Math.abs(U.y-z.y)<lt||Math.abs(U.x-z.x)<lt?$t=[U,z]:$t=[U,In,z],$t.length===0)for(;Se.length>0;){Se.sort((mt,Vt)=>mt.f-Vt.f);const X=Se.shift();if(Ge.delete(X.key),X.key===wo){let mt=wo,Vt=z;for($t=[Vt];bn.has(mt);){const re=bn.get(mt);$t.unshift(re),Vt=re,mt=He(re.x,re.y)}break}const $=X.pt.x,Q=X.pt.y,ht=Sr.sort((mt,Vt)=>mt.coord-Vt.coord),Tt=ht.findIndex(mt=>Math.abs(mt.coord-$)<1),Ct=Ir.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];Tt>0&&kt.push({x:ht[Tt-1].coord,y:Q}),Tt>=0&&Tt<ht.length-1&&kt.push({x:ht[Tt+1].coord,y:Q}),Rt>0&&kt.push({x:$,y:Ct[Rt-1].coord}),Rt>=0&&Rt<Ct.length-1&&kt.push({x:$,y:Ct[Rt+1].coord});for(const mt of kt){const Vt=Math.min($,mt.x),re=Math.max($,mt.x),Dt=Math.min(Q,mt.y),jt=Math.max(Q,mt.y);if(g.some(ne=>ne.nodeId===S.start||ne.nodeId===S.end?!1:Vt!==re?ne.minY<Q&&ne.maxY>Q&&ne.maxX>Vt&&ne.minX<re:ne.minX<$&&ne.maxX>$&&ne.maxY>Dt&&ne.minY<jt))continue;const vt=He(mt.x,mt.y),Ut=Math.abs(mt.x-$)+Math.abs(mt.y-Q),Lt=b(m,X.pt,mt);let Et=0;const Zt=z.x-U.x,Re=z.y-U.y,$e=mt.x-$,Cn=mt.y-Q;(Re>10&&Cn<-5||Re<-10&&Cn>5)&&(Et=Math.abs(Cn)*100),(Zt>10&&$e<-5||Zt<-10&&$e>5)&&(Et+=Math.abs($e)*50);let Ao=0;const Ro=Mn.get(X.key)??"n",No=Math.abs($e)>lt?"h":"v";Ro!=="n"&&Ro!==No&&(Ao=50);const wr=Ut+Lt+Et+Ao,ze=(Ye.get(X.key)??1/0)+wr,Oo=Math.abs(z.x-mt.x)+Math.abs(z.y-mt.y);if(ze<(Ye.get(vt)??1/0))if(bn.set(vt,X.pt),Ye.set(vt,ze),Mn.set(vt,No),!Ge.has(vt))Se.push({key:vt,f:ze+Oo,pt:mt}),Ge.add(vt);else{const ne=Se.findIndex(Ar=>Ar.key===vt);ne!==-1&&(Se[ne].f=ze+Oo)}}}if($t.length===0&&($t=[U,{x:U.x,y:z.y},z]),$t.length>4){const X=$t[0],$=$t[$t.length-1];let Q=Math.min(X.x,$.x),ht=Math.max(X.x,$.x),Tt=Math.min(X.y,$.y),Ct=Math.max(X.y,$.y);for(const Dt of $t)Q=Math.min(Q,Dt.x),ht=Math.max(ht,Dt.x),Tt=Math.min(Tt,Dt.y),Ct=Math.max(Ct,Dt.y);const Rt=ht>Math.max(X.x,$.x),kt=Q<Math.min(X.x,$.x);if(c){const Dt=Ne;if(Rt){const jt=Math.max(X.x,$.x),_t=Math.min(X.y,$.y),vt=Math.max(X.y,$.y),Ut=g.filter(Lt=>Lt.minX<jt&&Lt.maxX>jt&&Lt.minY<vt&&Lt.maxY>_t);if(Ut.length>0){let Lt=Math.max(X.x,$.x);for(const Et of Ut){const Zt=(Et.minX+Et.maxX)/2;if(Et.visualXHalfExtent===void 0||isNaN(Et.visualXHalfExtent))continue;const Re=Zt+Et.visualXHalfExtent+Dt;Lt=Math.max(Lt,Re)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=g.filter(_t=>_t.minX<Math.min(X.x,$.x)+Dt&&_t.minY<Math.max(X.y,$.y)&&_t.maxY>Math.min(X.y,$.y));if(jt.length>0){let _t=Math.min(X.x,$.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Dt;_t=Math.min(_t,Lt)}Q=_t}}}const mt=d(Dt=>{const jt=$.y>X.y,_t=g.filter(Lt=>{const Et=Math.min(X.x,$.x)<Lt.maxX&&Math.max(X.x,$.x)>Lt.minX,Zt=Math.min(X.y,$.y)<Lt.maxY&&Math.max(X.y,$.y)>Lt.minY;return Et&&Zt});let vt=_t;if(c&&_t.length>0){const Lt=_t.filter(Et=>Et.minX<Dt&&Et.maxX>Dt);Lt.length>0&&(vt=Lt)}if(vt.length===0)return $.y;const Ut=Ce;if(jt){const Et=Math.max(...vt.map(Zt=>Zt.maxY))+Ut;if(Et<$.y-lt)return Et}else{const Et=Math.min(...vt.map(Zt=>Zt.minY))-Ut;if(Et>$.y+lt)return Et}return $.y},"findBestReturnY"),Vt=d(Dt=>{const jt=mt(Dt),_t={x:Dt,y:X.y},vt={x:Dt,y:jt},Ut={x:$.x,y:jt},Lt=xe(X,_t),Et=xe(_t,vt),Zt=xe(vt,Ut),Re=jt!==$.y?xe(Ut,$):!1;return!Lt&&!Et&&!Zt&&!Re?Math.abs(jt-$.y)<lt?[X,_t,vt,$]:[X,_t,vt,Ut,$]:null},"trySimplifyWithDetourX"),re=Rt&&!kt?Vt(ht):kt&&!Rt?Vt(Q):null;re&&($t=re)}const zt=[N,...It,...$t,...Gt.reverse(),D];if(zt.length>=3){const X=zt[zt.length-1],$=zt[zt.length-2],Q=zt[zt.length-3],ht=Math.abs(Q.y-$.y)<lt&&Math.abs($.y-X.y)<lt,Tt=Math.abs(Q.x-$.x)<lt&&Math.abs($.x-X.x)<lt;if(ht){const Ct=Math.sign($.x-Q.x),Rt=Math.sign(X.x-Q.x);Ct!==0&&Ct===Rt&&Math.abs($.x-Q.x)>Math.abs(X.x-Q.x)&&zt.splice(-2,1)}else if(Tt){const Ct=Math.sign($.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs($.y-Q.y)>Math.abs(X.y-Q.y)&&zt.splice(-2,1)}}const fe=[zt[0]];for(let X=1;X<zt.length-1;X++){if(X===1){fe.push(zt[X]);continue}const $=fe[fe.length-1],Q=zt[X],ht=zt[X+1];if(Math.abs($.y-Q.y)<lt&&Math.abs(Q.y-ht.y)<lt){const Tt=Q.x>$.x,Ct=ht.x>Q.x;if(Tt!==Ct){fe.push(Q);continue}continue}if(Math.abs($.x-Q.x)<lt&&Math.abs(Q.x-ht.x)<lt){const Tt=Q.y>$.y,Ct=ht.y>Q.y;if(Tt!==Ct){fe.push(Q);continue}continue}fe.push(Q)}fe.push(zt[zt.length-1]);for(let X=0;X<fe.length-1;X++){const $=fe[X],Q=fe[X+1],ht=Math.abs($.x-Q.x)<lt?"vertical":"horizontal",Tt=ht==="vertical"?$.x:$.y,Ct=ht==="vertical"?Math.min($.y,Q.y):Math.min($.x,Q.x),Rt=ht==="vertical"?Math.max($.y,Q.y):Math.max($.x,Q.x),kt=p(ht,Tt,Ct,Rt),mt={edgeIndex:m,segmentIndex:X,orientation:ht,pipe:kt,trackIndex:0,from:Ct,to:Rt};h.push(mt),l[m].push(h.length-1),kt.tracks[0]||(kt.tracks[0]={index:0,coord:kt.coord,segments:[]}),kt.tracks[0].segments.push({edgeIndex:m,segmentIndex:X,from:Ct,to:Rt})}}const J=d((m,S)=>m.from<S.to&&S.from<m.to,"segmentsOverlap"),rt=d((m,S,w,T)=>{const N=!T.segments.some(W=>(W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex)&&J(W,m)),D=!w.segments.some(W=>(W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex)&&J(W,S));return N&&D?(m.trackIndex=T.index,S.trackIndex=w.index,w.segments=[...w.segments.filter(W=>W.edgeIndex!==m.edgeIndex||W.segmentIndex!==m.segmentIndex),{edgeIndex:S.edgeIndex,segmentIndex:S.segmentIndex,from:S.from,to:S.to}],T.segments=[...T.segments.filter(W=>W.edgeIndex!==S.edgeIndex||W.segmentIndex!==S.segmentIndex),{edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=d(m=>{const S=m.tracks.length;return m.tracks[S]={index:S,coord:m.coord,segments:[]},S},"createNewTrack"),pt=d((m,S)=>{const w=m.pipe.tracks[m.trackIndex];w.segments=w.segments.filter(N=>N.edgeIndex!==m.edgeIndex||N.segmentIndex!==m.segmentIndex),m.trackIndex=S,m.pipe.tracks[S].segments.push({edgeIndex:m.edgeIndex,segmentIndex:m.segmentIndex,from:m.from,to:m.to})},"moveSegmentToTrack"),St=d((m,S)=>{const w=l[m.edgeIndex];for(const T of w){const N=h[T];N.pipe===m.pipe&&pt(N,S)}},"moveSegmentChainToTrack"),wt=d(m=>{const S=l[m.edgeIndex],w=S.indexOf(h.indexOf(m)),T=[];return w>0&&T.push(h[S[w-1]]),w<S.length-1&&T.push(h[S[w+1]]),T},"getAdjacentSegmentsAlongEdge"),Kt=d((m,S)=>{if(m.orientation===S.orientation)return!1;const w=m.orientation==="horizontal"?m:S,T=m.orientation==="horizontal"?S:m;return T.pipe.coord>w.from&&T.pipe.coord<w.to&&w.pipe.coord>T.from&&w.pipe.coord<T.to},"haveAnyCrossing"),qt=d((m,S)=>{for(const w of m.tracks)if(!w.segments.some(N=>(N.edgeIndex!==S.edgeIndex||N.segmentIndex!==S.segmentIndex)&&J(N,S)))return w.index;return-1},"findAvailableTrack"),Jt=d((m,S)=>{if(m.trackIndex===S.trackIndex)return J(m,S);const w=wt(m),T=wt(S);return w.some(N=>T.some(D=>Kt(N,D)))},"segmentsConflict"),se=d((m,S,w)=>{if(rt(m,S,m.pipe.tracks[m.trackIndex],S.pipe.tracks[S.trackIndex]))return;const T=qt(m.pipe,S);w(S,T!==-1?T:ut(m.pipe))},"resolveTrackConflict"),Ee=d(m=>{let S=0;for(let w=0;w<m.length;w++)for(let T=w+1;T<m.length;T++){const N=m[w],D=m[T];N.pipe===D.pipe&&Jt(N,D)&&(S++,se(N,D,St))}return S},"resolveHandleConflicts"),me=new Map,Te=d(m=>{if(me.has(m))return me.get(m);const S=l[m];if(S.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return me.set(m,ot),ot}const T=h[S[0]].pipe.coord;let N=T;for(let ot=1;ot<S.length;ot++){const U=h[S[ot]];if(U.orientation==="horizontal"){const z=U.from,bt=U.to;N=Math.abs(z-T)>Math.abs(bt-T)?z:bt;break}}const D=Math.abs(N-T),W={dest:N,deviation:D,base:T,delta:N-T};return me.set(m,W),W},"getDestInfo"),mn=d(()=>{let m=0;const S=new Map;for(const[T,N]of s.entries())l[T].length!==0&&N.start&&(S.has(N.start)||S.set(N.start,[]),S.get(N.start).push(T));const w=d(T=>{const N=s[T];if(!N.start||!N.end)return 0;const D=r.get(N.start),W=r.get(N.end);if(!D||!W)return 0;const ot=(W.x??0)-(D.x??0),U=(W.y??0)-(D.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const T of S.values()){T.sort((D,W)=>{const ot=Te(D),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const z=w(D),bt=w(W);if(Math.abs(z-bt)>1)return bt-z;const dt=l[D].length,ct=l[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=l[D][0],It=l[W][0];if(h[st]&&h[It]){const Bt=h[st],At=h[It],Gt=Math.abs(Bt.to-Bt.from),ee=Math.abs(At.to-At.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=T.map(D=>h[l[D][0]]);m+=Ee(N)}return m},"fixSourceHandleCrossings"),yn=d(()=>{let m=0;const S=new Map;for(const[w,T]of s.entries())l[w].length!==0&&T.end&&(S.has(T.end)||S.set(T.end,[]),S.get(T.end).push(w));for(const w of S.values()){w.sort((N,D)=>{const W=d(z=>{const bt=l[z];if(bt.length<2)return 0;const dt=h[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(D);return Math.abs(ot-U)>.1?ot-U:N-D});const T=w.map(N=>h[l[N][l[N].length-1]]);m+=Ee(T)}return m},"fixTargetHandleCrossings"),pn=d(()=>{let m=0;for(const S of a){const w=[];for(const T of S.tracks)for(const N of T.segments){const D=l[N.edgeIndex].find(W=>h[W].segmentIndex===N.segmentIndex);D!==void 0&&w.push(h[D])}w.sort((T,N)=>T.edgeIndex-N.edgeIndex||T.segmentIndex-N.segmentIndex);for(let T=0;T<w.length;T++)for(let N=T+1;N<w.length;N++){const D=w[T],W=w[N];Jt(D,W)&&(m++,se(D,W,pt))}}return m},"fixPipeCrossings");let R=0;const _=10;for(;R<_;){let m=0;if(m+=mn(),m+=yn(),m+=pn(),m===0)break;R++}const F=new Map;for(const m of a){const S=[];m.tracks.forEach(T=>{T.segments.forEach(N=>{S.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:T.index,from:N.from,to:N.to})})}),S.sort((T,N)=>T.from-N.from);const w=[];if(S.length>0){let T=[S[0]],N=S[0].to;for(let D=1;D<S.length;D++){const W=S[D];W.from<N?(T.push(W),N=Math.max(N,W.to)):(w.push(T),T=[W],N=W.to)}w.push(T)}for(const T of w){const N=new Set;T.forEach(st=>N.add(st.trackIndex));const D=new Map;T.forEach(st=>{const It=Te(st.edgeIndex);D.set(st.trackIndex,(D.get(st.trackIndex)??0)+It.delta)});const W=[...N].filter(st=>(D.get(st)??0)<-1),ot=[...N].filter(st=>(D.get(st)??0)>1),U=[...N].filter(st=>Math.abs(D.get(st)??0)<=1);W.sort((st,It)=>(D.get(It)??0)-(D.get(st)??0)),ot.sort((st,It)=>(D.get(st)??0)-(D.get(It)??0));const z=d((st,It)=>{T.filter(Bt=>Bt.trackIndex===st).forEach(Bt=>{const At=x.has(Bt.edgeIndex)?m.coord:It;F.set(`${Bt.edgeIndex}-${Bt.segmentIndex}`,At)})},"assignCoord");let bt=0;for(const st of W)bt++,z(st,m.coord-bt*Tn);if(U.length===0&&N.size>0){const st=[...N].sort((At,Gt)=>Math.abs(D.get(At)??0)-Math.abs(D.get(Gt)??0))[0],It=W.indexOf(st);It!==-1&&W.splice(It,1);const Bt=ot.indexOf(st);Bt!==-1&&ot.splice(Bt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)z(st,m.coord);else{const It=dt%2===1?1:-1,Bt=Math.ceil(dt/2);z(st,m.coord+It*Bt*Tn*.5)}dt++}let ct=0;for(const st of ot)ct++,z(st,m.coord+ct*Tn)}}for(const[m,S]of s.entries()){const w=l[m]??[];if(w.length===0)continue;const T=[],N=r.get(S.start),D=r.get(S.end),{pSrcPort:W,pDstPort:ot}=nt(m,N,D),U=w.map(dt=>{const ct=h[dt],st=F.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});T.push(W);for(let dt=0;dt<U.length;dt++){const ct=U[dt],st=T[T.length-1],It=ct.orient==="vertical"?st.y:st.x,Bt=ct.orient==="vertical"?st.x:st.y,At=U[dt+1],Gt=dt<U.length-1;if(Math.abs(Bt-ct.coord)>lt&&T.push(ve(ct,It)),Gt&&At.orient===ct.orient)if(Math.abs(ct.coord-At.coord)>lt){const ee=ct.orient==="vertical"?(It+At.from)/2:io(ct,At);T.push(ve(ct,ee),ve(At,ee))}else(dt===0||dt===U.length-2)&&T.push(ve(ct,io(ct,At)));else if(Gt)T.push(ve(ct,At.coord));else{const ee=Math.abs(ct.from-It)<Math.abs(ct.to-It)?ct.to:ct.from;T.push(ve(ct,ee))}}const z=T[T.length-1];(Math.abs(z.x-ot.x)>lt||Math.abs(z.y-ot.y)>lt)&&T.push(ot);const bt=[];T.length>0&&bt.push(T[0]);for(let dt=1;dt<T.length;dt++){const ct=T[dt],st=bt[bt.length-1];(Math.abs(ct.x-st.x)>lt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}S.points=bt}for(const m of s){const S=m.__originalEdge;S&&m.points&&(S.points=m.points)}t.edges=(t.edges??[]).filter(m=>!m.isLayoutOnly);const V=d((m,S)=>{const w=S.x??0,T=S.y??0,N=S.width??0,D=S.height??0;if(N<=0||D<=0)return m;const W=w-N/2,ot=w+N/2,U=T-D/2,z=T+D/2;if(m.x<W||m.x>ot||m.y<U||m.y>z)return m;const bt=m.x-W,dt=ot-m.x,ct=m.y-U,st=z-m.y,It=Math.min(bt,dt,ct,st);return It===bt?{x:W,y:m.y}:It===dt?{x:ot,y:m.y}:It===ct?{x:m.x,y:U}:{x:m.x,y:z}},"nodeBoundaryClamp");for(const m of t.edges){const S=m.points;if(!S||S.length<2)continue;const w=m.start,T=m.end,N=w?r.get(w):void 0,D=T?r.get(T):void 0;N&&(S[0]=V(S[0],N)),D&&(S[S.length-1]=V(S[S.length-1],D))}return t}d(pr,"routeEdgesOrthogonal");function xr(t){return t.direction??"TB"}d(xr,"getSwimlaneDirection");function br(t){var g,p,M,u,h;const e=es(t),n=((g=t.config.flowchart)==null?void 0:g.nodeSpacing)??40,o=((p=t.config.flowchart)==null?void 0:p.rankSpacing)??100,s=((M=t.config.swimlane)==null?void 0:M.ignoreCrossLaneEdges)??!0,r=((u=t.config.swimlane)==null?void 0:u.optimizeRanksByCrossings)??!0,i=((h=t.config.swimlane)==null?void 0:h.automaticLaneOrdering)??!1,a=xr(t),{ordered:c,coordinates:f}=yr(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:a});ns(e,c,f,{nodeGap:n,layerGap:o});for(const l of t.edges??[])delete l.points;pr(t,a);for(const l of t.edges??[])(!l.curve||l.curve==="basis")&&(l.curve="rounded");return Bs(t,a),Ps(t),a}d(br,"runSwimlaneLayoutCore");async function oi(t,e){const n=e.select("g");Or(n,t.markers,t.type,t.diagramId),Pr(),Br(),kr(),Nr(),ts(t);const o=os(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await Xo(n,t);br(t),await Jo(t,s)}d(oi,"render");export{oi as render};
@@ -0,0 +1,8 @@
1
+ import{c as r,s as e}from"./flowDiagram-23GEKE2U-0scCMi71.js";import{_ as a}from"./MermaidRenderer-CnzIvTlj.js";import"./chunk-5VM5RSS4-CQacO1HV.js";import"./chunk-XXDRQBXY-BrvJt-u-.js";import"./chunk-VR4S4FIN-uT68_7rT.js";import"./chunk-32BRIVSS-DnDG740s.js";import"./purify.es-D6gMnemd.js";import"./channel-Cfw3OpIn.js";import"./vendor-markdown-BRX1CUPf.js";import"./vendor-syntax-DG6Vo7Ci.js";import"./isPrototype-DezZrpQP.js";var o=a(t=>`${e(t)}
2
+ .swimlane.cluster rect {
3
+ stroke: ${t.clusterBorder} !important;
4
+ }
5
+ [data-look="neo"].cluster rect {
6
+ filter: none;
7
+ }
8
+ `,"getStyles"),m=o,g=r({defaultLayout:"swimlane",styles:m});export{g as diagram};
@@ -1,9 +1,9 @@
1
- import{_ as l,C as pt,T as Wt,U as Pt,V as Bt,c as gt,l as S,H as Vt,N as Ft,W as ft,d as J,B as zt,X as Gt,y as Ot}from"./MermaidRenderer-DNbuWll0.js";import{d as ot}from"./arc-1qRI0DXn.js";import"./vendor-markdown-CQ_RitqP.js";import"./vendor-syntax-Bg-E9hW_.js";import"./purify.es-D6gMnemd.js";import"./isPrototype-DezZrpQP.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(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:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,R=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);_.setInput(s,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var X="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?X="Parse error on line "+(M+1)+`:
1
+ import{_ as l,y as pt,R as Wt,S as Pt,T as Bt,c as gt,l as S,D as Vt,L as Ft,U as ft,d as J,t as zt,V as Gt,p as Ot}from"./MermaidRenderer-CnzIvTlj.js";import{d as ot}from"./arc-1qRI0DXn.js";import"./vendor-markdown-BRX1CUPf.js";import"./vendor-syntax-DG6Vo7Ci.js";import"./purify.es-D6gMnemd.js";import"./isPrototype-DezZrpQP.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(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:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(U,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var K="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?K="Parse error on line "+(M+1)+`:
2
2
  `+_.showPosition()+`
3
- Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":X="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,R=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,R,M,C.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,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]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(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).
3
+ Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":K="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(K,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,C=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,C,M,R.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,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]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(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
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
5
5
  `+d+"^"},"showPosition"),test_match:l(function(s,d){var h,g,m;if(this.options.backtrack_lexer&&(m={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&&(m.yylloc.range=this.yylloc.range.slice(0))),g=s[0].match(/(?:\r\n?|\n).*/g),g&&(this.yylineno+=g.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:g?g[g.length-1].length-g[g.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+s[0].length},this.yytext+=s[0],this.match+=s[0],this.matches=s,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(s[0].length),this.matched+=s[0],h=this.performAction.call(this,this.yy,this,d,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),h)return h;if(this._backtrack){for(var u in m)this[u]=m[u];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var s,d,h,g;this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),u=0;u<m.length;u++)if(h=this._input.match(this.rules[m[u]]),h&&(!d||h[0].length>d[0].length)){if(d=h,g=u,this.options.backtrack_lexer){if(s=this.test_match(h,m[u]),s!==!1)return s;if(this._backtrack){d=!1;continue}else return!1}else if(!this.options.flex)break}return d?(s=this.test_match(d,m[g]),s!==!1?s:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var d=this.next();return d||this.lex()},"lex"),begin:l(function(d){this.conditionStack.push(d)},"begin"),popState:l(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:l(function(d){this.begin(d)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(d,h,g,m){switch(g){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;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";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 k})();y.lexer=x;function f(){this.yy={}}return l(f,"Parser"),f.prototype=y,y.Parser=f,new f})();tt.parser=tt;var Dt=tt,yt={};zt(yt,{addEvent:()=>Tt,addSection:()=>_t,addTask:()=>Et,addTaskOrg:()=>$t,clear:()=>kt,default:()=>Ut,getCommonDb:()=>xt,getDirection:()=>bt,getSections:()=>wt,getTasks:()=>St,setDirection:()=>vt});var K="",mt=0,nt="LR",rt=[],Q=[],Z=[],xt=l(()=>Gt,"getCommonDb"),kt=l(function(){rt.length=0,Q.length=0,K="",Z.length=0,nt="LR",Ot()},"clear"),vt=l(function(e){nt=e},"setDirection"),bt=l(function(){return nt},"getDirection"),_t=l(function(e){K=e,rt.push(e)},"addSection"),wt=l(function(){return rt},"getSections"),St=l(function(){let e=ct();const t=100;let n=0;for(;!e&&n<t;)e=ct(),n++;return Q.push(...Z),Q},"getTasks"),Et=l(function(e,t,n){const i={id:mt++,section:K,type:K,task:e,score:t||0,events:n?[n]:[]};Z.push(i)},"addTask"),Tt=l(function(e){Z.find(n=>n.id===mt-1).events.push(e)},"addEvent"),$t=l(function(e){const t={section:K,type:K,description:e,task:e,classes:[]};Q.push(t)},"addTaskOrg"),ct=l(function(){const e=l(function(n){return Z[n].processed},"compileTask");let t=!0;for(const[n,i]of Z.entries())e(n),t=t&&i.processed;return t},"compileTasks"),Ut={clear:kt,getCommonDb:xt,getDirection:bt,setDirection:vt,addSection:_t,getSections:wt,getTasks:St,addTask:Et,addTaskOrg:$t,addEvent:Tt},Nt=0,j=l(function(e,t){const n=e.append("rect");return n.attr("x",t.x),n.attr("y",t.y),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("width",t.width),n.attr("height",t.height),n.attr("rx",t.rx),n.attr("ry",t.ry),t.class!==void 0&&n.attr("class",t.class),n},"drawRect"),Xt=l(function(e,t){const i=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=e.append("g");r.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function o(p){const y=ot().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}l(o,"smile");function c(p){const y=ot().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}l(c,"sad");function a(p){p.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")}return l(a,"ambivalent"),t.score>3?o(r):t.score<3?c(r):a(r),i},"drawFace"),Kt=l(function(e,t){const n=e.append("circle");return n.attr("cx",t.cx),n.attr("cy",t.cy),n.attr("class","actor-"+t.pos),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("r",t.r),n.class!==void 0&&n.attr("class",n.class),t.title!==void 0&&n.append("title").text(t.title),n},"drawCircle"),It=l(function(e,t){const n=t.text.replace(/<br\s*\/?>/gi," "),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.attr("class","legend"),i.style("text-anchor",t.anchor),t.class!==void 0&&i.attr("class",t.class);const r=i.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(n),i},"drawText"),Zt=l(function(e,t){function n(r,o,c,a,p){return r+","+o+" "+(r+c)+","+o+" "+(r+c)+","+(o+a-p)+" "+(r+c-p*1.2)+","+(o+a)+" "+r+","+(o+a)}l(n,"genPoints");const i=e.append("polygon");i.attr("points",n(t.x,t.y,50,20,7)),i.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,It(e,t)},"drawLabel"),qt=l(function(e,t,n){const i=e.append("g"),r=st();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=n.width,r.height=n.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,j(i,r),Ht(n)(t.text,i,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},n,t.colour)},"drawSection"),et=-1,Jt=l(function(e,t,n,i){const r=t.x+n.width/2,o=e.append("g");et++,o.append("line").attr("id",i+"-task"+et).attr("x1",r).attr("y1",t.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Xt(o,{cx:r,cy:300+(5-t.score)*30,score:t.score});const a=st();a.x=t.x,a.y=t.y,a.fill=t.fill,a.width=n.width,a.height=n.height,a.class="task task-type-"+t.num,a.rx=3,a.ry=3,j(o,a),Ht(n)(t.task,o,a.x,a.y,a.width,a.height,{class:"task"},n,t.colour)},"drawTask"),Qt=l(function(e,t){j(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),jt=l(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),st=l(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Ht=(function(){function e(r,o,c,a,p,y,x,f){const k=o.append("text").attr("x",c+p/2).attr("y",a+y/2+5).style("font-color",f).style("text-anchor","middle").text(r);i(k,x)}l(e,"byText");function t(r,o,c,a,p,y,x,f,k){const{taskFontSize:s,taskFontFamily:d}=f,h=r.split(/<br\s*\/?>/gi);for(let g=0;g<h.length;g++){const m=g*s-s*(h.length-1)/2,u=o.append("text").attr("x",c+p/2).attr("y",a).attr("fill",k).style("text-anchor","middle").style("font-size",s).style("font-family",d);u.append("tspan").attr("x",c+p/2).attr("dy",m).text(h[g]),u.attr("y",a+y/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(u,x)}}l(t,"byTspan");function n(r,o,c,a,p,y,x,f){const k=o.append("switch"),d=k.append("foreignObject").attr("x",c).attr("y",a).attr("width",p).attr("height",y).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,k,c,a,p,y,x,f),i(d,x)}l(n,"byFo");function i(r,o){for(const c in o)c in o&&r.attr(c,o[c])}return l(i,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?n:r.textPlacement==="old"?e:t}})(),Yt=l(function(e,t){Nt=0,et=-1,e.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 it(e,t){e.each(function(){var n=J(this),i=n.text().split(/(\s+|<br>)/).reverse(),r,o=[],c=1.1,a=n.attr("y"),p=parseFloat(n.attr("dy")),y=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",p+"em");for(let x=0;x<i.length;x++)r=i[i.length-1-x],o.push(r),y.text(o.join(" ").trim()),(y.node().getComputedTextLength()>t||r==="<br>")&&(o.pop(),y.text(o.join(" ").trim()),r==="<br>"?o=[""]:o=[r],y=n.append("tspan").attr("x",0).attr("y",a).attr("dy",c+"em").text(r))})}l(it,"wrap");var te=l(function(e,t,n,i,r,o=!1){var m,u,w;const{theme:c,look:a}=i,p=c==null?void 0:c.includes("redux"),y=((m=i==null?void 0:i.themeVariables)==null?void 0:m.THEME_COLOR_LIMIT)??12,x=n%y-1,f=e.append("g");t.section=x,f.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+x));const k=f.append("g"),s=f.append("g"),h=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),g=(u=i.fontSize)!=null&&u.replace?i.fontSize.replace("px",""):i.fontSize;if(t.height=h.height+g*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,s.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),p&&s.attr("transform",`translate(${t.width/2}, ${o?t.padding/2+3:t.padding})`),ne(k,t,x,r,i),a==="neo"&&(f.attr("data-look","neo"),p)){const v=c.includes("dark"),M=((w=e.node())==null?void 0:w.ownerSVGElement)??e.node(),R=J(M),P=R.attr("id")??"",V=P?`${P}-drop-shadow`:"drop-shadow";if(R.select(`#${V}`).empty()){const L=R.select("defs");(L.empty()?R.append("defs"):L).append("filter").attr("id",V).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",v?"0.2":"0.06").attr("flood-color",v?"#FFFFFF":"#000000")}}return t},"drawNode"),ee=l(function(e,t,n){var a;const i=e.append("g"),o=i.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),c=(a=n.fontSize)!=null&&a.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),o.height+c*1.1*.5+t.padding},"getVirtualNodeHeight"),ne=l(function(e,t,n,i,r){const{theme:o}=r,c=o!=null&&o.includes("redux")?0:5,a=5,p=c>0?`M0 ${t.height-a} v${-t.height+2*a} q0,-${c},${c},-${c} h${t.width-2*a} q${c},0,${c},${c} v${t.height-a} H0 Z`:`M0 ${t.height-a} v${-(t.height-a)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",i+"-node-"+Nt++).attr("class","node-bkg node-"+t.type).attr("d",p),o!=null&&o.includes("redux")||e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),W={drawRect:j,drawCircle:Kt,drawSection:qt,drawText:It,drawLabel:Zt,drawTask:Jt,drawBackgroundRect:Qt,getTextObj:jt,getNoteRect:st,initGraphics:Yt,drawNode:te,getVirtualNodeHeight:ee},re=l(function(e,t,n,i){var U,O,$;const r=gt(),{look:o,theme:c,themeVariables:a}=r,{useGradient:p,gradientStart:y,gradientStop:x}=a,f=((U=r.timeline)==null?void 0:U.leftMargin)??50;S.debug("timeline",i.db);const k=r.securityLevel;let s;k==="sandbox"&&(s=J("#i"+t));const h=(k==="sandbox"?J(s.nodes()[0].contentDocument.body):J("body")).select("#"+t);h.append("g");const g=i.db.getTasks(),m=i.db.getCommonDb().getDiagramTitle();S.debug("task",g),W.initGraphics(h,t);const u=i.db.getSections();S.debug("sections",u);let w=0,v=0,M=0,R=0,P=50+f,V=50;R=50;let L=0,_=!0;u.forEach(function(N){const b={number:L,descr:N,section:L,width:150,padding:20,maxHeight:w},T=W.getVirtualNodeHeight(h,b,r);S.debug("sectionHeight before draw",T),w=Math.max(w,T+20)});let C=0,F=0;S.debug("tasks.length",g.length);for(const[N,b]of g.entries()){const T={number:N,descr:b,section:b.section,width:150,padding:20,maxHeight:v},E=W.getVirtualNodeHeight(h,T,r);S.debug("taskHeight before draw",E),v=Math.max(v,E+20),C=Math.max(C,b.events.length);let H=0;for(const I of b.events){const B={descr:I,section:b.section,number:b.section,width:150,padding:20,maxHeight:50};H+=W.getVirtualNodeHeight(h,B,r)}b.events.length>0&&(H+=(b.events.length-1)*10),F=Math.max(F,H)}S.debug("maxSectionHeight before draw",w),S.debug("maxTaskHeight before draw",v),u&&u.length>0?u.forEach(N=>{const b=g.filter(I=>I.section===N),T={number:L,descr:N,section:L,width:200*Math.max(b.length,1)-50,padding:20,maxHeight:w};S.debug("sectionNode",T);const E=h.append("g"),H=W.drawNode(E,T,L,r,t);S.debug("sectionNode output",H),E.attr("transform",`translate(${P}, ${R})`),V+=w+50,b.length>0&&lt(h,b,L,P,V,v,r,C,F,w,!1,t),P+=200*Math.max(b.length,1),V=R,L++}):(_=!1,lt(h,g,L,P,V,v,r,C,F,w,!0,t));const z=h.node().getBBox();if(S.debug("bounds",z),m&&h.append("text").text(m).attr("x",o==="neo"?z.x*2+f:z.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),M=_?w+v+150:v+100,h.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",M).attr("x2",z.width+3*f).attr("y2",M).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),o==="neo"&&p&&c!=="neutral"){const N=h.select("defs"),T=(N.empty()?h.append("defs"):N).append("linearGradient").attr("id",h.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");T.append("stop").attr("offset","0%").attr("stop-color",y).attr("stop-opacity",1),T.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}ft(void 0,h,((O=r.timeline)==null?void 0:O.padding)??50,(($=r.timeline)==null?void 0:$.useMaxWidth)??!1)},"draw"),lt=l(function(e,t,n,i,r,o,c,a,p,y,x,f){var k;for(const s of t){const d={descr:s.task,section:n,number:n,width:150,padding:20,maxHeight:o};S.debug("taskNode",d);const h=e.append("g").attr("class","taskWrapper"),m=W.drawNode(h,d,n,c,f).height;if(S.debug("taskHeight after draw",m),h.attr("transform",`translate(${i}, ${r})`),o=Math.max(o,m),s.events){const u=e.append("g").attr("class","lineWrapper");let w=o;r+=100,w=w+se(e,s.events,n,i,r,c,f),r-=100,u.append("line").attr("x1",i+190/2).attr("y1",r+o).attr("x2",i+190/2).attr("y2",r+o+100+p+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}i=i+200,x&&!((k=c.timeline)!=null&&k.disableMulticolor)&&n++}r=r-10},"drawTasks"),se=l(function(e,t,n,i,r,o,c){let a=0;const p=r;r=r+100;for(const y of t){const x={descr:y,section:n,number:n,width:150,padding:20,maxHeight:50};S.debug("eventNode",x);const f=e.append("g").attr("class","eventWrapper"),s=W.drawNode(f,x,n,o,c,!0).height;a=a+s,f.attr("transform",`translate(${i}, ${r})`),r=r+10+s}return r=p,a},"drawEvents"),ie={setConf:l(()=>{},"setConf"),draw:re},Y=200,G=5,ae=Y+G*2,at=Y+100,oe=at+G*2,Lt=10,ce=0,ht=20,Mt=20,dt=30,At=50,le=l(function(e,t,n,i){var U,O,$,N,b;const r=gt(),o=((U=r.timeline)==null?void 0:U.leftMargin)??50;S.debug("timeline",i.db);const c=Vt(t);c.append("g");const a=i.db.getTasks(),p=i.db.getCommonDb().getDiagramTitle();S.debug("task",a),W.initGraphics(c);const y=i.db.getSections();S.debug("sections",y);let x=0,f=0;const k=50+o;let s=50;const d=s,h=k,g=ae+Mt,m=oe+At,u=h+g;let w=0;const v=y&&y.length>0,M=v?u:k+g,R=Math.max(50,g+m-G*2);y.forEach(function(T){const E={number:w,descr:T,section:w,width:R,padding:G,maxHeight:x},H=W.getVirtualNodeHeight(c,E,r);S.debug("sectionHeight before draw",H),x=Math.max(x,H)});let P=0;S.debug("tasks.length",a.length);for(const[T,E]of a.entries()){const H={number:T,descr:E,section:E.section,width:Y,padding:G,maxHeight:f},I=W.getVirtualNodeHeight(c,H,r);S.debug("taskHeight before draw",I),f=Math.max(f,I);let B=0;for(const D of E.events){const X={descr:D,section:E.section,number:E.section,width:at,padding:G,maxHeight:50};B+=W.getVirtualNodeHeight(c,X,r)}E.events.length>0&&(B+=(E.events.length-1)*Lt),P=Math.max(P,B)+ce}S.debug("maxSectionHeight before draw",x),S.debug("maxTaskHeight before draw",f);const L=Math.max(f,P)+dt;v?y.forEach(T=>{const E=a.filter(Rt=>Rt.section===T),H={number:w,descr:T,section:w,width:R,padding:G,maxHeight:x};S.debug("sectionNode",H);const I=c.append("g"),B=W.drawNode(I,H,w,r);S.debug("sectionNode output",B);const D=M-g;I.attr("transform",`translate(${D}, ${s})`);const X=s+B.height+ht;E.length>0&&ut(c,E,w,M,X,f,r,L,!1);const A=E.length,Ct=B.height+ht+L*Math.max(A,1)-(A>0?dt*2:0);s+=Ct,w++}):ut(c,a,w,M,s,f,r,L,!0);let _=(O=c.node())==null?void 0:O.getBBox();if(!_)throw new Error("bbox not found");if(S.debug("bounds",_),p){if(c.append("text").text(p).attr("x",_.width/2-o).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),_=($=c.node())==null?void 0:$.getBBox(),!_)throw new Error("bbox not found");S.debug("bounds after title",_)}const[C]=Ft(r.fontSize),F=(C??16)*2,z=(C??16)*.5+20,q=c.append("g").attr("class","lineWrapper");q.append("line").attr("x1",M).attr("y1",d-F).attr("x2",M).attr("y2",_.y+_.height+z).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),q.lower(),ft(void 0,c,((N=r.timeline)==null?void 0:N.padding)??50,((b=r.timeline)==null?void 0:b.useMaxWidth)??!1)},"draw"),ut=l(function(e,t,n,i,r,o,c,a,p){var y;for(const x of t){const f={descr:x.task,section:n,number:n,width:Y,padding:G,maxHeight:o};S.debug("taskNode",f);const k=e.append("g").attr("class","taskWrapper"),s=W.drawNode(k,f,n,c),d=s.height;S.debug("taskHeight after draw",d);const h=i-Mt-s.width;if(k.attr("transform",`translate(${h}, ${r})`),o=Math.max(o,d),x.events&&x.events.length>0){const g=r,m=i+At;he(e,x.events,n,i,m,g,c)}r=r+a,p&&!((y=c.timeline)!=null&&y.disableMulticolor)&&n++}},"drawTasks"),he=l(function(e,t,n,i,r,o,c){let a=o;for(const p of t){const y={descr:p,section:n,number:n,width:at,padding:G,maxHeight:0};S.debug("eventNode",y);const x=e.append("g").attr("class","eventWrapper"),k=W.drawNode(x,y,n,c).height;x.attr("transform",`translate(${r}, ${a})`);const s=e.append("g").attr("class","lineWrapper"),d=a+k/2;s.append("line").attr("x1",i).attr("y1",d).attr("x2",r).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),a=a+k+Lt}return a-o},"drawEvents"),de={setConf:l(()=>{},"setConf"),draw:le},ue=l(e=>{var a;const{theme:t}=pt(),n=t==null?void 0:t.includes("dark"),i=t==null?void 0:t.includes("color"),r=((a=e.svgId)==null?void 0:a.replace(/^#/,""))??"",o=r?`url(#${r}-drop-shadow)`:e.dropShadow??"none";let c="";for(let p=0;p<e.THEME_COLOR_LIMIT;p++){const y=`${17-3*p}`,x=i?e.borderColorArray[p]:e.mainBkg,f=i?e.borderColorArray[p]:e.nodeBorder;c+=`
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var d=this.next();return d||this.lex()},"lex"),begin:l(function(d){this.conditionStack.push(d)},"begin"),popState:l(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:l(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:l(function(d){this.begin(d)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(d,h,g,m){switch(g){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;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";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 k})();y.lexer=x;function f(){this.yy={}}return l(f,"Parser"),f.prototype=y,y.Parser=f,new f})();tt.parser=tt;var Dt=tt,yt={};zt(yt,{addEvent:()=>Tt,addSection:()=>_t,addTask:()=>Et,addTaskOrg:()=>$t,clear:()=>kt,default:()=>Ut,getCommonDb:()=>xt,getDirection:()=>bt,getSections:()=>wt,getTasks:()=>St,setDirection:()=>vt});var X="",mt=0,nt="LR",rt=[],Q=[],Z=[],xt=l(()=>Gt,"getCommonDb"),kt=l(function(){rt.length=0,Q.length=0,X="",Z.length=0,nt="LR",Ot()},"clear"),vt=l(function(e){nt=e},"setDirection"),bt=l(function(){return nt},"getDirection"),_t=l(function(e){X=e,rt.push(e)},"addSection"),wt=l(function(){return rt},"getSections"),St=l(function(){let e=ct();const t=100;let n=0;for(;!e&&n<t;)e=ct(),n++;return Q.push(...Z),Q},"getTasks"),Et=l(function(e,t,n){const i={id:mt++,section:X,type:X,task:e,score:t||0,events:n?[n]:[]};Z.push(i)},"addTask"),Tt=l(function(e){Z.find(n=>n.id===mt-1).events.push(e)},"addEvent"),$t=l(function(e){const t={section:X,type:X,description:e,task:e,classes:[]};Q.push(t)},"addTaskOrg"),ct=l(function(){const e=l(function(n){return Z[n].processed},"compileTask");let t=!0;for(const[n,i]of Z.entries())e(n),t=t&&i.processed;return t},"compileTasks"),Ut={clear:kt,getCommonDb:xt,getDirection:bt,setDirection:vt,addSection:_t,getSections:wt,getTasks:St,addTask:Et,addTaskOrg:$t,addEvent:Tt},Nt=0,j=l(function(e,t){const n=e.append("rect");return n.attr("x",t.x),n.attr("y",t.y),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("width",t.width),n.attr("height",t.height),n.attr("rx",t.rx),n.attr("ry",t.ry),t.class!==void 0&&n.attr("class",t.class),n},"drawRect"),Kt=l(function(e,t){const i=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=e.append("g");r.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function o(p){const y=ot().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}l(o,"smile");function c(p){const y=ot().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);p.append("path").attr("class","mouth").attr("d",y).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}l(c,"sad");function a(p){p.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")}return l(a,"ambivalent"),t.score>3?o(r):t.score<3?c(r):a(r),i},"drawFace"),Xt=l(function(e,t){const n=e.append("circle");return n.attr("cx",t.cx),n.attr("cy",t.cy),n.attr("class","actor-"+t.pos),n.attr("fill",t.fill),n.attr("stroke",t.stroke),n.attr("r",t.r),n.class!==void 0&&n.attr("class",n.class),t.title!==void 0&&n.append("title").text(t.title),n},"drawCircle"),It=l(function(e,t){const n=t.text.replace(/<br\s*\/?>/gi," "),i=e.append("text");i.attr("x",t.x),i.attr("y",t.y),i.attr("class","legend"),i.style("text-anchor",t.anchor),t.class!==void 0&&i.attr("class",t.class);const r=i.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(n),i},"drawText"),Zt=l(function(e,t){function n(r,o,c,a,p){return r+","+o+" "+(r+c)+","+o+" "+(r+c)+","+(o+a-p)+" "+(r+c-p*1.2)+","+(o+a)+" "+r+","+(o+a)}l(n,"genPoints");const i=e.append("polygon");i.attr("points",n(t.x,t.y,50,20,7)),i.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,It(e,t)},"drawLabel"),qt=l(function(e,t,n){const i=e.append("g"),r=st();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=n.width,r.height=n.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,j(i,r),Ht(n)(t.text,i,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},n,t.colour)},"drawSection"),et=-1,Jt=l(function(e,t,n,i){const r=t.x+n.width/2,o=e.append("g");et++,o.append("line").attr("id",i+"-task"+et).attr("x1",r).attr("y1",t.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Kt(o,{cx:r,cy:300+(5-t.score)*30,score:t.score});const a=st();a.x=t.x,a.y=t.y,a.fill=t.fill,a.width=n.width,a.height=n.height,a.class="task task-type-"+t.num,a.rx=3,a.ry=3,j(o,a),Ht(n)(t.task,o,a.x,a.y,a.width,a.height,{class:"task"},n,t.colour)},"drawTask"),Qt=l(function(e,t){j(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),jt=l(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),st=l(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Ht=(function(){function e(r,o,c,a,p,y,x,f){const k=o.append("text").attr("x",c+p/2).attr("y",a+y/2+5).style("font-color",f).style("text-anchor","middle").text(r);i(k,x)}l(e,"byText");function t(r,o,c,a,p,y,x,f,k){const{taskFontSize:s,taskFontFamily:d}=f,h=r.split(/<br\s*\/?>/gi);for(let g=0;g<h.length;g++){const m=g*s-s*(h.length-1)/2,u=o.append("text").attr("x",c+p/2).attr("y",a).attr("fill",k).style("text-anchor","middle").style("font-size",s).style("font-family",d);u.append("tspan").attr("x",c+p/2).attr("dy",m).text(h[g]),u.attr("y",a+y/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(u,x)}}l(t,"byTspan");function n(r,o,c,a,p,y,x,f){const k=o.append("switch"),d=k.append("foreignObject").attr("x",c).attr("y",a).attr("width",p).attr("height",y).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(r),t(r,k,c,a,p,y,x,f),i(d,x)}l(n,"byFo");function i(r,o){for(const c in o)c in o&&r.attr(c,o[c])}return l(i,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?n:r.textPlacement==="old"?e:t}})(),Yt=l(function(e,t){Nt=0,et=-1,e.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 it(e,t){e.each(function(){var n=J(this),i=n.text().split(/(\s+|<br>)/).reverse(),r,o=[],c=1.1,a=n.attr("y"),p=parseFloat(n.attr("dy")),y=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",p+"em");for(let x=0;x<i.length;x++)r=i[i.length-1-x],o.push(r),y.text(o.join(" ").trim()),(y.node().getComputedTextLength()>t||r==="<br>")&&(o.pop(),y.text(o.join(" ").trim()),r==="<br>"?o=[""]:o=[r],y=n.append("tspan").attr("x",0).attr("y",a).attr("dy",c+"em").text(r))})}l(it,"wrap");var te=l(function(e,t,n,i,r,o=!1){var m,u,w;const{theme:c,look:a}=i,p=c==null?void 0:c.includes("redux"),y=((m=i==null?void 0:i.themeVariables)==null?void 0:m.THEME_COLOR_LIMIT)??12,x=n%y-1,f=e.append("g");t.section=x,f.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+x));const k=f.append("g"),s=f.append("g"),h=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),g=(u=i.fontSize)!=null&&u.replace?i.fontSize.replace("px",""):i.fontSize;if(t.height=h.height+g*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,s.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),p&&s.attr("transform",`translate(${t.width/2}, ${o?t.padding/2+3:t.padding})`),ne(k,t,x,r,i),a==="neo"&&(f.attr("data-look","neo"),p)){const v=c.includes("dark"),M=((w=e.node())==null?void 0:w.ownerSVGElement)??e.node(),C=J(M),P=C.attr("id")??"",V=P?`${P}-drop-shadow`:"drop-shadow";if(C.select(`#${V}`).empty()){const L=C.select("defs");(L.empty()?C.append("defs"):L).append("filter").attr("id",V).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",v?"0.2":"0.06").attr("flood-color",v?"#FFFFFF":"#000000")}}return t},"drawNode"),ee=l(function(e,t,n){var a;const i=e.append("g"),o=i.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(it,t.width).node().getBBox(),c=(a=n.fontSize)!=null&&a.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),o.height+c*1.1*.5+t.padding},"getVirtualNodeHeight"),ne=l(function(e,t,n,i,r){const{theme:o}=r,c=o!=null&&o.includes("redux")?0:5,a=5,p=c>0?`M0 ${t.height-a} v${-t.height+2*a} q0,-${c},${c},-${c} h${t.width-2*a} q${c},0,${c},${c} v${t.height-a} H0 Z`:`M0 ${t.height-a} v${-(t.height-a)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",i+"-node-"+Nt++).attr("class","node-bkg node-"+t.type).attr("d",p),o!=null&&o.includes("redux")||e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),W={drawRect:j,drawCircle:Xt,drawSection:qt,drawText:It,drawLabel:Zt,drawTask:Jt,drawBackgroundRect:Qt,getTextObj:jt,getNoteRect:st,initGraphics:Yt,drawNode:te,getVirtualNodeHeight:ee},re=l(function(e,t,n,i){var U,O,$;const r=gt(),{look:o,theme:c,themeVariables:a}=r,{useGradient:p,gradientStart:y,gradientStop:x}=a,f=((U=r.timeline)==null?void 0:U.leftMargin)??50;S.debug("timeline",i.db);const k=r.securityLevel;let s;k==="sandbox"&&(s=J("#i"+t));const h=(k==="sandbox"?J(s.nodes()[0].contentDocument.body):J("body")).select("#"+t);h.append("g");const g=i.db.getTasks(),m=i.db.getCommonDb().getDiagramTitle();S.debug("task",g),W.initGraphics(h,t);const u=i.db.getSections();S.debug("sections",u);let w=0,v=0,M=0,C=0,P=50+f,V=50;C=50;let L=0,_=!0;u.forEach(function(N){const b={number:L,descr:N,section:L,width:150,padding:20,maxHeight:w},T=W.getVirtualNodeHeight(h,b,r);S.debug("sectionHeight before draw",T),w=Math.max(w,T+20)});let R=0,F=0;S.debug("tasks.length",g.length);for(const[N,b]of g.entries()){const T={number:N,descr:b,section:b.section,width:150,padding:20,maxHeight:v},E=W.getVirtualNodeHeight(h,T,r);S.debug("taskHeight before draw",E),v=Math.max(v,E+20),R=Math.max(R,b.events.length);let H=0;for(const I of b.events){const B={descr:I,section:b.section,number:b.section,width:150,padding:20,maxHeight:50};H+=W.getVirtualNodeHeight(h,B,r)}b.events.length>0&&(H+=(b.events.length-1)*10),F=Math.max(F,H)}S.debug("maxSectionHeight before draw",w),S.debug("maxTaskHeight before draw",v),u&&u.length>0?u.forEach(N=>{const b=g.filter(I=>I.section===N),T={number:L,descr:N,section:L,width:200*Math.max(b.length,1)-50,padding:20,maxHeight:w};S.debug("sectionNode",T);const E=h.append("g"),H=W.drawNode(E,T,L,r,t);S.debug("sectionNode output",H),E.attr("transform",`translate(${P}, ${C})`),V+=w+50,b.length>0&&lt(h,b,L,P,V,v,r,R,F,w,!1,t),P+=200*Math.max(b.length,1),V=C,L++}):(_=!1,lt(h,g,L,P,V,v,r,R,F,w,!0,t));const z=h.node().getBBox();if(S.debug("bounds",z),m&&h.append("text").text(m).attr("x",o==="neo"?z.x*2+f:z.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),M=_?w+v+150:v+100,h.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",M).attr("x2",z.width+3*f).attr("y2",M).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),o==="neo"&&p&&c!=="neutral"){const N=h.select("defs"),T=(N.empty()?h.append("defs"):N).append("linearGradient").attr("id",h.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");T.append("stop").attr("offset","0%").attr("stop-color",y).attr("stop-opacity",1),T.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}ft(void 0,h,((O=r.timeline)==null?void 0:O.padding)??50,(($=r.timeline)==null?void 0:$.useMaxWidth)??!1)},"draw"),lt=l(function(e,t,n,i,r,o,c,a,p,y,x,f){var k;for(const s of t){const d={descr:s.task,section:n,number:n,width:150,padding:20,maxHeight:o};S.debug("taskNode",d);const h=e.append("g").attr("class","taskWrapper"),m=W.drawNode(h,d,n,c,f).height;if(S.debug("taskHeight after draw",m),h.attr("transform",`translate(${i}, ${r})`),o=Math.max(o,m),s.events){const u=e.append("g").attr("class","lineWrapper");let w=o;r+=100,w=w+se(e,s.events,n,i,r,c,f),r-=100,u.append("line").attr("x1",i+190/2).attr("y1",r+o).attr("x2",i+190/2).attr("y2",r+o+100+p+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}i=i+200,x&&!((k=c.timeline)!=null&&k.disableMulticolor)&&n++}r=r-10},"drawTasks"),se=l(function(e,t,n,i,r,o,c){let a=0;const p=r;r=r+100;for(const y of t){const x={descr:y,section:n,number:n,width:150,padding:20,maxHeight:50};S.debug("eventNode",x);const f=e.append("g").attr("class","eventWrapper"),s=W.drawNode(f,x,n,o,c,!0).height;a=a+s,f.attr("transform",`translate(${i}, ${r})`),r=r+10+s}return r=p,a},"drawEvents"),ie={setConf:l(()=>{},"setConf"),draw:re},Y=200,G=5,ae=Y+G*2,at=Y+100,oe=at+G*2,Lt=10,ce=0,ht=20,Mt=20,dt=30,At=50,le=l(function(e,t,n,i){var U,O,$,N,b;const r=gt(),o=((U=r.timeline)==null?void 0:U.leftMargin)??50;S.debug("timeline",i.db);const c=Vt(t);c.append("g");const a=i.db.getTasks(),p=i.db.getCommonDb().getDiagramTitle();S.debug("task",a),W.initGraphics(c);const y=i.db.getSections();S.debug("sections",y);let x=0,f=0;const k=50+o;let s=50;const d=s,h=k,g=ae+Mt,m=oe+At,u=h+g;let w=0;const v=y&&y.length>0,M=v?u:k+g,C=Math.max(50,g+m-G*2);y.forEach(function(T){const E={number:w,descr:T,section:w,width:C,padding:G,maxHeight:x},H=W.getVirtualNodeHeight(c,E,r);S.debug("sectionHeight before draw",H),x=Math.max(x,H)});let P=0;S.debug("tasks.length",a.length);for(const[T,E]of a.entries()){const H={number:T,descr:E,section:E.section,width:Y,padding:G,maxHeight:f},I=W.getVirtualNodeHeight(c,H,r);S.debug("taskHeight before draw",I),f=Math.max(f,I);let B=0;for(const D of E.events){const K={descr:D,section:E.section,number:E.section,width:at,padding:G,maxHeight:50};B+=W.getVirtualNodeHeight(c,K,r)}E.events.length>0&&(B+=(E.events.length-1)*Lt),P=Math.max(P,B)+ce}S.debug("maxSectionHeight before draw",x),S.debug("maxTaskHeight before draw",f);const L=Math.max(f,P)+dt;v?y.forEach(T=>{const E=a.filter(Ct=>Ct.section===T),H={number:w,descr:T,section:w,width:C,padding:G,maxHeight:x};S.debug("sectionNode",H);const I=c.append("g"),B=W.drawNode(I,H,w,r);S.debug("sectionNode output",B);const D=M-g;I.attr("transform",`translate(${D}, ${s})`);const K=s+B.height+ht;E.length>0&&ut(c,E,w,M,K,f,r,L,!1);const A=E.length,Rt=B.height+ht+L*Math.max(A,1)-(A>0?dt*2:0);s+=Rt,w++}):ut(c,a,w,M,s,f,r,L,!0);let _=(O=c.node())==null?void 0:O.getBBox();if(!_)throw new Error("bbox not found");if(S.debug("bounds",_),p){if(c.append("text").text(p).attr("x",_.width/2-o).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),_=($=c.node())==null?void 0:$.getBBox(),!_)throw new Error("bbox not found");S.debug("bounds after title",_)}const[R]=Ft(r.fontSize),F=(R??16)*2,z=(R??16)*.5+20,q=c.append("g").attr("class","lineWrapper");q.append("line").attr("x1",M).attr("y1",d-F).attr("x2",M).attr("y2",_.y+_.height+z).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),q.lower(),ft(void 0,c,((N=r.timeline)==null?void 0:N.padding)??50,((b=r.timeline)==null?void 0:b.useMaxWidth)??!1)},"draw"),ut=l(function(e,t,n,i,r,o,c,a,p){var y;for(const x of t){const f={descr:x.task,section:n,number:n,width:Y,padding:G,maxHeight:o};S.debug("taskNode",f);const k=e.append("g").attr("class","taskWrapper"),s=W.drawNode(k,f,n,c),d=s.height;S.debug("taskHeight after draw",d);const h=i-Mt-s.width;if(k.attr("transform",`translate(${h}, ${r})`),o=Math.max(o,d),x.events&&x.events.length>0){const g=r,m=i+At;he(e,x.events,n,i,m,g,c)}r=r+a,p&&!((y=c.timeline)!=null&&y.disableMulticolor)&&n++}},"drawTasks"),he=l(function(e,t,n,i,r,o,c){let a=o;for(const p of t){const y={descr:p,section:n,number:n,width:at,padding:G,maxHeight:0};S.debug("eventNode",y);const x=e.append("g").attr("class","eventWrapper"),k=W.drawNode(x,y,n,c).height;x.attr("transform",`translate(${r}, ${a})`);const s=e.append("g").attr("class","lineWrapper"),d=a+k/2;s.append("line").attr("x1",i).attr("y1",d).attr("x2",r).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),a=a+k+Lt}return a-o},"drawEvents"),de={setConf:l(()=>{},"setConf"),draw:le},ue=l(e=>{var a;const{theme:t}=pt(),n=t==null?void 0:t.includes("dark"),i=t==null?void 0:t.includes("color"),r=((a=e.svgId)==null?void 0:a.replace(/^#/,""))??"",o=r?`url(#${r}-drop-shadow)`:e.dropShadow??"none";let c="";for(let p=0;p<e.THEME_COLOR_LIMIT;p++){const y=`${17-3*p}`,x=i?e.borderColorArray[p]:e.mainBkg,f=i?e.borderColorArray[p]:e.nodeBorder;c+=`
7
7
  .section-${p-1} rect,
8
8
  .section-${p-1} path,
9
9
  .section-${p-1} circle {