@dooc-dev/dooc 0.0.5 → 0.0.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 (174) hide show
  1. package/dist/cli.js +162 -67
  2. package/dist/code-worker.global.js +152 -0
  3. package/dist/code.global.js +101 -101
  4. package/dist/compiler/bundle-urls.js +2 -0
  5. package/dist/compiler/check.js +2 -0
  6. package/dist/compiler/compile.js +13 -3
  7. package/dist/compiler/dxf.d.ts +1 -0
  8. package/dist/compiler/dxf.js +81 -0
  9. package/dist/compiler/export.js +22 -15
  10. package/dist/compiler/figures.js +39 -10
  11. package/dist/compiler/files.js +2 -0
  12. package/dist/compiler/ignored-files.d.ts +2 -0
  13. package/dist/compiler/ignored-files.js +30 -0
  14. package/dist/compiler/ops.js +1 -1
  15. package/dist/compiler/subformat-schema.d.ts +14 -0
  16. package/dist/compiler/subformat-schema.js +92 -0
  17. package/dist/compiler/subformats.d.ts +5 -7
  18. package/dist/compiler/subformats.js +115 -75
  19. package/dist/core/code-file.js +7 -5
  20. package/dist/core/code-grammars.d.ts +5 -0
  21. package/dist/core/code-grammars.js +34 -0
  22. package/dist/core/content-metadata.d.ts +2 -1
  23. package/dist/core/content-metadata.js +7 -2
  24. package/dist/core/content-types.d.ts +1 -1
  25. package/dist/core/escape-html.d.ts +1 -0
  26. package/dist/core/escape-html.js +1 -0
  27. package/dist/core/figure-frame.js +1 -1
  28. package/dist/core/file-embed.js +7 -3
  29. package/dist/core/html.d.ts +4 -1
  30. package/dist/core/html.js +8 -7
  31. package/dist/core/language.js +5 -2
  32. package/dist/core/markdown.js +3 -1
  33. package/dist/core/previewers.d.ts +8 -0
  34. package/dist/core/previewers.js +2 -0
  35. package/dist/core/schema-fields.d.ts +13 -0
  36. package/dist/core/schema-fields.js +175 -0
  37. package/dist/core/schema-graph-mount.js +26 -3
  38. package/dist/core/schema-refs.d.ts +8 -0
  39. package/dist/core/schema-refs.js +82 -0
  40. package/dist/core/toc-ui.js +1 -1
  41. package/dist/edit.global.js +266 -285
  42. package/dist/flow.global.js +1031 -1057
  43. package/dist/graph/abnfDiagram-S7VZAUFO-GAGCW2J5.js +1 -0
  44. package/dist/graph/architecture-WOLXFQ4H-AWAC3VBS.js +1 -0
  45. package/dist/graph/architectureDiagram-YGSQEFNW-WQ7QKSUJ.js +36 -0
  46. package/dist/graph/blockDiagram-APKKGZFW-H7ZNJMOM.js +140 -0
  47. package/dist/graph/bpmnIcons-APHXDYXF-EAVPNTFE.js +1 -0
  48. package/dist/graph/c4Diagram-KJ2TOQU5-3IYS34YL.js +38 -0
  49. package/dist/graph/chunk-3CJU2RDX.js +1 -0
  50. package/dist/graph/chunk-3LU66YMI.js +1 -0
  51. package/dist/graph/chunk-3Y2PDVDE.js +1 -0
  52. package/dist/graph/chunk-4KILFWYV.js +339 -0
  53. package/dist/graph/chunk-4QDE4SUK.js +1 -0
  54. package/dist/graph/chunk-5N2X2DXU.js +1 -0
  55. package/dist/graph/chunk-5OO6DATX.js +1 -0
  56. package/dist/graph/chunk-67BPVAXC.js +1 -0
  57. package/dist/graph/chunk-6CDZONCA.js +1 -0
  58. package/dist/graph/chunk-7ASYMKN2.js +1 -0
  59. package/dist/graph/chunk-7JQUFVT4.js +10 -0
  60. package/dist/graph/chunk-7LSMJ4VU.js +72 -0
  61. package/dist/graph/chunk-7UKJADAE.js +213 -0
  62. package/dist/graph/chunk-AARGNXTW.js +32 -0
  63. package/dist/graph/chunk-ARAJTKOH.js +2 -0
  64. package/dist/graph/chunk-BOXAA5AP.js +62 -0
  65. package/dist/graph/chunk-BTMPKSGF.js +1 -0
  66. package/dist/graph/chunk-BVXT562I.js +1 -0
  67. package/dist/graph/chunk-DIDARDST.js +1 -0
  68. package/dist/graph/chunk-EWYECPNJ.js +1 -0
  69. package/dist/graph/chunk-FD7ZFC7R.js +3 -0
  70. package/dist/graph/chunk-GF4TOPUK.js +1 -0
  71. package/dist/graph/chunk-GWYODWCE.js +1 -0
  72. package/dist/graph/chunk-HKRJKXEE.js +1 -0
  73. package/dist/graph/chunk-I5LEUF24.js +1 -0
  74. package/dist/graph/chunk-ICJPOOXG.js +1 -0
  75. package/dist/graph/chunk-IVZHB6RS.js +135 -0
  76. package/dist/graph/chunk-JSHWCPFJ.js +1 -0
  77. package/dist/graph/chunk-JZGXHT3J.js +1 -0
  78. package/dist/graph/chunk-K4I76XBX.js +14 -0
  79. package/dist/graph/chunk-LSRL537V.js +88 -0
  80. package/dist/graph/chunk-LT6LXKCR.js +136 -0
  81. package/dist/graph/chunk-MPR575IN.js +1 -0
  82. package/dist/graph/chunk-N44XPVUD.js +15 -0
  83. package/dist/graph/chunk-NDAMZVXQ.js +1 -0
  84. package/dist/graph/chunk-O656ZI37.js +1 -0
  85. package/dist/graph/chunk-PDH25ALM.js +2 -0
  86. package/dist/graph/chunk-QLS7NIYR.js +2 -0
  87. package/dist/graph/chunk-QQIGL7OP.js +1 -0
  88. package/dist/graph/chunk-QYAXYFNI.js +1 -0
  89. package/dist/graph/chunk-QYTM6GY3.js +1 -0
  90. package/dist/graph/chunk-RJFVWYCA.js +1 -0
  91. package/dist/graph/chunk-SCEY3ZPT.js +1 -0
  92. package/dist/graph/chunk-SQE76S5B.js +1 -0
  93. package/dist/graph/chunk-WQHTQAFY.js +1 -0
  94. package/dist/graph/chunk-XQS73SBQ.js +1 -0
  95. package/dist/graph/chunk-Z4FIZ7CR.js +1 -0
  96. package/dist/graph/chunk-ZSZXN4BT.js +2 -0
  97. package/dist/graph/classDiagram-v2-L25IHNXF-HNTCDTNK.js +217 -0
  98. package/dist/graph/cose-bilkent-JH36ORCC-2GVA7XKO.js +1 -0
  99. package/dist/graph/cynefin-EF2NZ3EQ-TCI65RAQ.js +1 -0
  100. package/dist/graph/cynefinDiagram-L36ESFBY-OKQ5BLVF.js +62 -0
  101. package/dist/graph/dagre-SPEB5RXH-KZEBD52K.js +4 -0
  102. package/dist/graph/diagram-3B7GL73J-ESCBJM3O.js +200 -0
  103. package/dist/graph/diagram-DNEMPZML-ZIBUSQZI.js +24 -0
  104. package/dist/graph/diagram-L3MUGCDN-IGK62IPN.js +41 -0
  105. package/dist/graph/diagram-LA4NIPWU-2KZCOFJ5.js +24 -0
  106. package/dist/graph/diagram-MHCOC4E2-EYAAB236.js +3 -0
  107. package/dist/graph/diagram-XPFHEONP-OZ5ARGMG.js +30 -0
  108. package/dist/graph/ebnfDiagram-UZSYDL2S-M3XJHARD.js +1 -0
  109. package/dist/graph/erDiagram-EYBAPDEH-Y7KUBH7A.js +99 -0
  110. package/dist/graph/eventmodeling-K75KTNOO-ROLYRDEP.js +1 -0
  111. package/dist/graph/flowDiagram-MALGAFMO-AAUEIPCR.js +1 -0
  112. package/dist/graph/ganttDiagram-23REXITY-JSBTFSSJ.js +292 -0
  113. package/dist/graph/gitGraph-VSP46ZUC-ZCBCDVNF.js +1 -0
  114. package/dist/graph/gitGraphDiagram-STJD7YCW-3ZA5FT3G.js +106 -0
  115. package/dist/graph/info-OHQRW6UA-JKJGOQNY.js +1 -0
  116. package/dist/graph/infoDiagram-KBXO4MBG-6LFMPP2O.js +2 -0
  117. package/dist/graph/ishikawaDiagram-M35NCXHK-YLEU44DY.js +70 -0
  118. package/dist/graph/journeyDiagram-OPLOXDXO-ZHJV66ZT.js +139 -0
  119. package/dist/graph/kanban-definition-BZKZHSQY-SDU25WUM.js +89 -0
  120. package/dist/graph/katex-WSLZOTY7.js +257 -0
  121. package/dist/graph/mindmap-definition-I2QAS2VK-XQNBCYHN.js +98 -0
  122. package/dist/graph/packet-JDAUHWVQ-Y3H77ERD.js +1 -0
  123. package/dist/graph/pegDiagram-FD4XPPHP-YO4VWH6V.js +1 -0
  124. package/dist/graph/pie-XZMESJXO-PRER4XL5.js +1 -0
  125. package/dist/graph/pieDiagram-J4AKIIQI-TJ5WOOSV.js +39 -0
  126. package/dist/graph/quadrantDiagram-XTYBLID2-G6MSSZLW.js +7 -0
  127. package/dist/graph/radar-ABXABTNO-M6MV34GM.js +1 -0
  128. package/dist/graph/railroad-I3PHUGI6-YIWPGN6Q.js +1 -0
  129. package/dist/graph/railroad-abnf-LNEFI6M7-7JHLZ2R7.js +1 -0
  130. package/dist/graph/railroad-ebnf-DWYD2UWJ-V55BXEWY.js +1 -0
  131. package/dist/graph/railroad-peg-JR7BVNR7-XCGKDRMK.js +1 -0
  132. package/dist/graph/railroadDiagram-MRQ6NCDL-RACSFXC4.js +1 -0
  133. package/dist/graph/requirementDiagram-Y7LWUY3S-4LQIQWHQ.js +84 -0
  134. package/dist/graph/sankeyDiagram-WGJFYUXA-K3RXG5FB.js +40 -0
  135. package/dist/graph/schema-graph-global.js +639 -0
  136. package/dist/graph/sequenceDiagram-5NDRBG5M-Y6RBHRS3.js +169 -0
  137. package/dist/graph/sizeCapture-INFHLROL-TJW3VUGH.js +1 -0
  138. package/dist/graph/stateDiagram-v2-FJ4FJNEA-4M5WZORG.js +291 -0
  139. package/dist/graph/swimlanes-UMQ2AFYF-O4W6U4RO.js +1 -0
  140. package/dist/graph/swimlanesDiagram-OMPLPG4O-HZAKM45N.js +8 -0
  141. package/dist/graph/timeline-definition-SEUHKTQE-IHISQ4Q7.js +120 -0
  142. package/dist/graph/treeView-D4JQ5SDB-EVGY4VYS.js +1 -0
  143. package/dist/graph/treemap-SAJKECNS-LN3SMFRX.js +1 -0
  144. package/dist/graph/usecaseDiagram-AFA6YXN4-B645A3J6.js +370 -0
  145. package/dist/graph/vennDiagram-NNMJR3RB-K3HWMON6.js +34 -0
  146. package/dist/graph/wardley-7MLQ67FV-RRWOELC6.js +1 -0
  147. package/dist/graph/wardleyDiagram-S7YFUSEH-DMMWKJEK.js +78 -0
  148. package/dist/graph/xychartDiagram-GGNKY7IX-K6MUQVXR.js +7 -0
  149. package/dist/mcp.js +5 -4
  150. package/dist/plugins.global.js +71 -104
  151. package/dist/subformats.global.js +6 -112
  152. package/dist/ui.global.js +75 -108
  153. package/dist/viewer/build.d.ts +2 -0
  154. package/dist/viewer/build.js +22 -8
  155. package/dist/viewer/code-file.js +7 -2
  156. package/dist/viewer/figure-preview.d.ts +4 -0
  157. package/dist/viewer/figure-preview.js +54 -0
  158. package/dist/viewer/hmr.js +4 -3
  159. package/dist/viewer/lazy-preview.d.ts +2 -0
  160. package/dist/viewer/lazy-preview.js +43 -0
  161. package/dist/viewer/locales/eng.json +26 -3
  162. package/dist/viewer/locales/jpn.json +26 -3
  163. package/dist/viewer/locales/zho.json +26 -3
  164. package/dist/viewer/plugin-blocks.js +1 -1
  165. package/dist/viewer/plugins.js +1 -1
  166. package/dist/viewer/resource-library.d.ts +1 -1
  167. package/dist/viewer/resource-library.js +5 -4
  168. package/dist/viewer/serve.d.ts +2 -1
  169. package/dist/viewer/serve.js +148 -41
  170. package/dist/viewer/textfile.d.ts +2 -0
  171. package/dist/viewer/textfile.js +20 -5
  172. package/package.json +14 -4
  173. package/dist/viewer/lazy-graph.d.ts +0 -2
  174. package/dist/viewer/lazy-graph.js +0 -30
@@ -0,0 +1 @@
1
+ import{g as Wo}from"./chunk-I5LEUF24.js";import"./chunk-K4I76XBX.js";import"./chunk-EWYECPNJ.js";import{a as Fn}from"./chunk-7JQUFVT4.js";import"./chunk-NDAMZVXQ.js";import"./chunk-BOXAA5AP.js";import"./chunk-4QDE4SUK.js";import"./chunk-DIDARDST.js";import"./chunk-7LSMJ4VU.js";import"./chunk-5N2X2DXU.js";import"./chunk-3CJU2RDX.js";import"./chunk-QLS7NIYR.js";import"./chunk-ICJPOOXG.js";import"./chunk-IVZHB6RS.js";import{b as De}from"./chunk-QQIGL7OP.js";import{a as c}from"./chunk-RJFVWYCA.js";import"./chunk-SQE76S5B.js";var on=5,en=1e-5,fi=2,ui=.6,nn=1e-6;function sn(t){let e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}c(sn,"buildSegmentList");function Ko(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,d=o.y-n.y,u=s*d-r*i;if(u===0)return null;let a=n.x-t.x,y=n.y-t.y,l=(a*d-y*i)/u,x=(a*r-y*s)/u;return l<=nn||l>=1-nn||x<=nn||x>=1-nn?null:{point:{x:t.x+l*s,y:t.y+l*r},tA:l,tB:x}}c(Ko,"segmentIntersection");function Pn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}c(Pn,"isHorizontalSeg");function kn(t,e,n){if(t.curve!=="rounded")return!1;let o=t.points,s=o[e],r=o[e+1];if(!s||!r)return!1;let i=Math.hypot(r.x-s.x,r.y-s.y),d=n*i,u=e>0?$e(o[e-1],s,r,on):null;if(u&&d<u.cutLen)return!0;let a=e+2<o.length?$e(s,r,o[e+2],on):null;return a!==null&&i-d<a.cutLen}c(kn,"crossingSitsInRoundedCorner");function qo(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],s=sn(o.points);for(let r=n+1;r<t.length;r++){let i=t[r],d=sn(i.points);for(let[u,a]of s.entries())for(let[y,l]of d.entries()){let x=Ko(a.a,a.b,l.a,l.b);if(!x||kn(o,u,x.tA)||kn(i,y,x.tB))continue;let m=Pn(a),p=Pn(l);(m!==p?m:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:i.id,segIndex:u,t:x.tA,point:x.point}):e.push({jumpEdgeId:i.id,otherEdgeId:o.id,segIndex:y,t:x.tB,point:x.point})}}}return e}c(qo,"findEdgeIntersections");function fe(t){let e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}c(fe,"fmt");function He(t){return`${fe(t.x)},${fe(t.y)}`}c(He,"pointToString");function Jo(t){let 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}c(Jo,"getArcSweepFlag");function Zo(t,e){if(t.length<2)return t.map(r=>({...r}));let n=t.map(r=>({...r})),o=e.arrowTypeStart&&Fn[e.arrowTypeStart];if(o){let r=t[0],i=t[1],d=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(d),n[0].y=r.y+o*Math.sin(d)}let s=e.arrowTypeEnd&&Fn[e.arrowTypeEnd];if(s){let r=t.length,i=t[r-2],d=t[r-1],u=Math.atan2(d.y-i.y,d.x-i.x);n[r-1].x=d.x-s*Math.cos(u),n[r-1].y=d.y-s*Math.sin(u)}return n}c(Zo,"applyMarkerOffsets");function Qo(t,e,n,o,s){let r=t.point.x,i=t.point.y,d={x:r-e*t.r,y:i-n*t.r},u={x:r+e*t.r,y:i+n*t.r},a=[`L${He(d)}`];return s==="arc"?a.push(`A${fe(t.r)},${fe(t.r)} 0 0 ${o} ${He(u)}`):a.push(`M${He(u)}`),a}c(Qo,"emitJump");function $e(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,d=n.y-e.y,u=Math.hypot(s,r),a=Math.hypot(i,d);if(u<en||a<en)return null;let y=s/u,l=r/u,x=i/a,m=d/a,p=y*x+l*m,f=Math.max(-1,Math.min(1,p)),h=Math.acos(f);if(h<en||Math.abs(Math.PI-h)<en)return null;let M=Math.min(o/Math.sin(h/2),u/2,a/2);return{startX:e.x-y*M,startY:e.y-l*M,endX:e.x+x*M,endY:e.y+m*M,ctrlX:e.x,ctrlY:e.y,cutLen:M}}c($e,"computeRoundedCorner");function ts(t,e,n){let o=t.points;if(o.length<2)return"";let s=Zo(o,t),r=t.curve==="rounded",i=sn(s),d=new Map;for(let a of e){let y=i[a.segIndex];if(!y)continue;let l=Math.hypot(y.b.x-y.a.x,y.b.y-y.a.y),x=d.get(a.segIndex)??[];x.push({t:a.t,point:a.point,d:a.t*l,r:n.jumpRadius}),d.set(a.segIndex,x)}let u=[`M${He(s[0])}`];for(let a=0;a<i.length;a++){let y=i[a],l=Math.hypot(y.b.x-y.a.x,y.b.y-y.a.y),x=l===0?0:(y.b.x-y.a.x)/l,m=l===0?0:(y.b.y-y.a.y)/l,p=Jo(y),f=0;if(r&&a>0){let w=$e(s[a-1],s[a],s[a+1]??s[a],on);w&&(f=w.cutLen)}let h=l,M=null;r&&a<i.length-1&&(M=$e(s[a],s[a+1],s[a+2]??s[a+1],on),M&&(h=l-M.cutLen));let I=n.jumpRadius*ui,C=[...d.get(a)??[]].sort((w,S)=>w.t-S.t).filter(w=>{let S=Math.min(w.d-f,h-w.d)-fi;return w.r=Math.min(w.r,S),w.r>=I});for(let w=0;w<C.length-1;w++){let S=C[w+1].d-C[w].d;if(C[w].r+C[w+1].r>S){let b=S/2;C[w].r=Math.min(C[w].r,b),C[w+1].r=Math.min(C[w+1].r,b)}}for(let w of C)w.r<I||u.push(...Qo(w,x,m,p,n.jumpStyle));r&&M?(u.push(`L${fe(M.startX)},${fe(M.startY)}`),u.push(`Q${fe(M.ctrlX)},${fe(M.ctrlY)} ${fe(M.endX)},${fe(M.endY)}`)):u.push(`L${He(y.b)}`)}return u.join(" ")}c(ts,"rewriteEdgePath");function es(t){return/^[\d\s+,.LMelm-]*$/.test(t)}c(es,"isStraightPath");function ns(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}c(ns,"curveSupportsLineHops");function os(t){if(!t)return null;try{let e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;let o=[];for(let 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}}c(os,"decodeDataPoints");function _n(t,e,n){if(!n.enabled)return;let o=t.node();if(!o)return;let s=new Map;for(let a of e)s.set(a.id,a);let r=new Map;for(let a of o.querySelectorAll("path[data-id]")){let y=a.getAttribute("data-id");y!==null&&!r.has(y)&&r.set(y,a)}let i=[];for(let a of e){let y=r.get(a.id);if(!y)continue;let x=os(y.getAttribute("data-points"))??a.points;i.push({...a,points:x})}let d=qo(i);if(d.length===0)return;let u=new Map;for(let a of d){let y=u.get(a.jumpEdgeId)??[];y.push(a),u.set(a.jumpEdgeId,y)}for(let a of i){let y=u.get(a.id);if(!y||y.length===0)continue;let x=s.get(a.id)?.curve;if(x!==void 0&&!ns(x))continue;let m=r.get(a.id);if(!m)continue;if(x===void 0){let C=m.getAttribute("d")??"";if(!es(C))continue}let p=m.getAttribute("style")??"",f=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),h=f?Number.parseFloat(f[1]):null,M=f?Number.parseFloat(f[2]):null,I=ts(a,y,n);if(m.setAttribute("d",I),h!==null&&M!==null&&typeof m.getTotalLength=="function"){let C=m.getTotalLength(),w=Math.max(0,C-h-M),S=`0 ${h} ${w} ${M}`,b=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${S};`).replace(/;\s*;+/g,";");m.setAttribute("style",b)}}}c(_n,"applyLineJumpsToSvg");function fs(t,{measure:e}){let n=t.config?.swimlane?.lineHops;if(n===!1)return;let o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));_n(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}c(fs,"applySwimlaneLineJumps");function us(t){let e=t?.metadata?.laneRole;return e==="pool"||e==="lane"?e:void 0}c(us,"readLaneRole");function ln(t){let e=t?.metadata?.laneIndex;return typeof e=="number"&&Number.isFinite(e)?e:void 0}c(ln,"readLaneIndex");function he(t){let e=new Map,n=new Map;for(let a of t)e.set(a.id,a),a.isGroup&&a.parentId&&n.set(a.parentId,(n.get(a.parentId)??0)+1);let o=new Set;for(let a of t)a.isGroup&&us(a)==="pool"&&(n.get(a.id)??0)>0&&o.add(a.id);let s=new Set,r=new Map;for(let a of t)if(!(!a.isGroup||o.has(a.id)))if(a.parentId&&o.has(a.parentId)){s.add(a.id);let y=r.get(a.parentId)??[];y.push(a.id),r.set(a.parentId,y)}else a.parentId||s.add(a.id);let i=c((a,y)=>{let l=new Set([a]),x=e.get(a)?.parentId;for(;x&&!l.has(x);){if(y.has(x))return x;l.add(x),x=e.get(x)?.parentId}return null},"walk"),d=new Map;return{isPool:c(a=>o.has(a),"isPool"),isLane:c(a=>s.has(a),"isLane"),laneIdOf:c(a=>{let y=d.get(a);if(y!==void 0)return y;let l=i(a,s);return d.set(a,l),l},"laneIdOf"),poolIdOf:c(a=>o.has(a)?a:i(a,o),"poolIdOf"),lanesByPool:r,hasPools:o.size>0}}c(he,"buildLaneModel");var hi=new Set(["top","right","bottom","left"]),$n=8,gi=1e4;function ze(t){let e=t?.metadata?.anchorTo;if(!e||typeof e!="object")return;let{hostId:n,side:o,slot:s,gap:r}=e;if(!(typeof n!="string"||n.length===0||n===t?.id))return{hostId:n,...typeof o=="string"&&hi.has(o)?{side:o}:{},...typeof s=="number"&&Number.isFinite(s)?{slot:s}:{},...typeof r=="number"&&Number.isFinite(r)&&r>0?{gap:Math.min(r,gi)}:{}}}c(ze,"readAnchor");function Sn(t,e){let n=new Set([t]),o=ze(e.get(t))?.hostId;for(;o&&!n.has(o);){let s=e.get(o);if(!s)return;let r=ze(s)?.hostId;if(!r)return o;n.add(o),o=r}}c(Sn,"resolveAnchorHostId");function Ve(t){let e=new Map(t.map(o=>[o.id,o])),n=new Set;for(let o of t)ze(o)&&Sn(o.id,e)&&n.add(o.id);return n}c(Ve,"collectAnchoredIds");function hs(t,e){return t==="canonical"?"right":e==="LR"||e==="RL"?"bottom":"right"}c(hs,"defaultAnchorSide");function gs(t,e){let n=t.anchor.slot,o=e.anchor.slot;return n!==void 0&&o!==void 0&&n!==o?n-o:n!==void 0&&o===void 0?-1:n===void 0&&o!==void 0?1:t.index-e.index}c(gs,"compareBucketEntries");function ps(t){let e=t.reduce((s,r)=>s+r,0)+$n*Math.max(0,t.length-1),n=[],o=-e/2;for(let s of t)n.push(o+s/2),o+=s+$n;return{offsets:n,total:e}}c(ps,"packAlongBorder");var pi=c(t=>[t.width,t.height].every(e=>e===void 0||Number.isFinite(e)),"hasUsableSize");function ms(t,e){let n=new Map(t.map(s=>[s.id,s])),o=new Map;t.forEach((s,r)=>{let i=ze(s);if(!i||!pi(s))return;let d=Sn(s.id,n);if(!d)return;let u=e(i),a=`${u}:${d}`,y=o.get(a)??[];y.push({node:s,anchor:i,index:r,side:u,hostId:d}),o.set(a,y)});for(let s of o.values())s.sort(gs);return o}c(ms,"bucketByHostAndSide");function ys(t,e,n,o){let s=!e&&n>0?-(o+$n):0;return t+s}c(ys,"centreAlongBorder");function xs(t,e){let n=e==="top"||e==="bottom",o=c(a=>n?a.width??0:a.height??0,"alongBorder"),s=c(a=>n?a.height??0:a.width??0,"reach"),{offsets:r}=ps(t.map(a=>o(a.node))),i=0,d=0,u=0;return t.forEach((a,y)=>{let l=a.anchor.gap??0,x=o(a.node)/2,m=ys(r[y],n,l,x);i=Math.max(i,x-m),d=Math.max(d,m+x),u=Math.max(u,l>0?l+s(a.node):0)}),{before:i,after:d,beyond:u}}c(xs,"footprintOf");function bs(t,e){let n=hs("final",e??"TB"),o=new Map;for(let s of ms(t,r=>r.side??n).values()){if(!s.some(d=>d.anchor.gap))continue;let{hostId:r,side:i}=s[0];o.set(r,{...o.get(r),[i]:xs(s,i)})}return o}c(bs,"anchorFootprints");var Dn="__swimlane_default__",mi=21,ss=20;function zn(t){return Math.max(t.padding??ss,ss)}c(zn,"topLaneHorizontalPadding");function Ms(t){let{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}let i=n-s/2,d=Math.min(r,n+s/2),u=Math.min(mi,Math.max(0,d-i)),a=i+u;if(a<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:a}}c(Ms,"assignTopLaneTitleRect");function Is(t){let e=t.other?.droppedSubGraphMembers;return Array.isArray(e)?e:[]}c(Is,"sharedMembers");var yi=c((t,e,n)=>!e.some(o=>o.parentId===n)&&!(t.edges??[]).some(o=>o.start===n||o.end===n),"isEmptyLane");function Ss(t,e){return t.isLane(e)?e:t.laneIdOf(e)??void 0}c(Ss,"laneIdOrSelf");function Cs(t,e,n){for(let o of n){let s=e.findIndex(r=>r.id===o);s>=0&&yi(t,e,o)&&e.splice(s,1)}}c(Cs,"removeEmptyLanes");function vs(t,e){let n=he(e),o=new Set(e.filter(r=>n.isLane(r.id)).map(r=>r.id)),s=new Set;for(let{node:r,keptBy:i,droppedFrom:d}of Is(t)){let u=Ss(n,i);u&&u!==d&&o.has(d)&&(De.warn(`Swimlane node "${r}" is listed in lanes "${u}" and "${d}"; it is drawn in "${u}" only.`),s.add(d))}Cs(t,e,s)}c(vs,"dropLanesEmptiedBySharedNodes");function Ls(t,e){for(let n of t)n.isGroup&&!e.isLane(n.id)&&!e.isPool(n.id)&&De.warn(`Swimlane subgraph "${n.id}" is nested in "${n.parentId}"; only top-level subgraphs are lanes, so it is drawn as a plain box.`)}c(Ls,"warnAboutNestedGroups");function ws(t){let e=t.direction,n=t.nodes??=[];vs(t,n);let o=he(n);Ls(n,o);for(let i of n){let d=o.isLane(i.id);!d&&!o.isPool(i.id)||(i.shape=d?"swimlane":"pool",e&&(i.direction=e))}let s=n.filter(i=>!i.isGroup&&!i.parentId);if(s.length===0)return;let r=n.find(i=>i.id===Dn);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:Dn,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((i,d)=>Math.max(i,d.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(r));for(let i of s)i.parentId=Dn}c(ws,"prepareLayoutForSwimlanes");function Es(t){let e=(t.nodes??[]).filter(l=>!l.isEdgeLabel),n=new Map(e.map(l=>[l.id,l])),o=Ve(e),s=c(l=>o.has(l)?Sn(l,n)??l:l,"hostOf"),r=new Map;for(let l of e)o.has(l.id)||r.set(l.id,l);let i=[];for(let l of t.edges??[]){let x=typeof l.start=="string"?l.start:void 0,m=typeof l.end=="string"?l.end:void 0;if(!x||!m||l.isLayoutOnly)continue;let p=s(x),f=s(m);p!==f&&i.push({id:l.id,src:p,dst:f,ref:l})}let d=e.filter(l=>l.isGroup&&!o.has(l.id)),u=e.filter(l=>!l.isGroup&&!o.has(l.id));return{nodes:[...[...d].reverse(),...u].map(l=>l.id),edges:i,layout:t,nodeById:r}}c(Es,"toGraphView");function As(t){let e=new Map(t.map(o=>[o.id,o])),n=c(o=>{let s=0,r=o.parentId,i=new Set([o.id]);for(;r!=null&&!i.has(r);)i.add(r),s++,r=e.get(r)?.parentId;return s},"depthOf");return t.filter(o=>o?.isGroup).map(o=>({node:o,depth:n(o)})).sort((o,s)=>s.depth-o.depth).map(o=>o.node)}c(As,"groupsDeepestFirst");function Rs(t,e,n,o){let{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,d=o?.nodeGap??40,u=0;for(let p of e.layers){let f=0;for(let h of p){let M=r.get(h);if(!M){f++;continue}M.layer=u,M.order=f;let I=n.x[h]??f*d,C=n.y[h]??u*i;M.x=I,M.y=C,f++}u++}let a=s.nodes??[],y=Ve(a);for(let p of a)p.isEdgeLabel&&n.x[p.id]!=null&&n.y[p.id]!=null&&(p.x=n.x[p.id],p.y=n.y[p.id]);let l=new Map,x=he(a),m=[];for(let p of As(a)){x.isLane(p.id)&&m.push(p);let f=a.filter(w=>w.parentId===p.id&&!y.has(w.id)),h=1/0,M=-1/0,I=1/0,C=-1/0;for(let w of f){let S=w.x??n.x[w.id],b=w.y??n.y[w.id],L=w.width??0,E=w.height??0;S!=null&&b!=null&&(w.isEdgeLabel||(h=Math.min(h,S-L/2),M=Math.max(M,S+L/2)),I=Math.min(I,b-E/2),C=Math.max(C,b+E/2))}if(h===1/0||I===1/0)p.x=p.x??0,p.y=p.y??0,p.width=p.width??0,p.height=p.height??0;else{let w=p.padding??20,S=p.parentId?w:2*zn(p),b=w,L=Math.max(0,M-h)+S,E=Math.max(0,C-I)+b,B=(h+M)/2,P=(I+C)/2;p.x=B,p.y=P,p.width=L,p.height=E,l.set(p.id,{minX:h,maxX:M,minY:I,maxY:C})}}if(m.length>0&&l.size>0){let p=1/0,f=-1/0,h=0;for(let M of m){let I=M.padding??20;I>h&&(h=I);let C=l.get(M.id);C&&(p=Math.min(p,C.minY),f=Math.max(f,C.maxY))}if(p!==1/0&&f!==-1/0){let M=Math.max(0,f-p),C=Math.max(h,36),w=M+2*C,S=(p+f)/2;for(let N of m)N.y=S,N.height=w,N.swimlaneContentTop=p;let b=[...m].sort((N,F)=>{let U=N.x??0,G=F.x??0;return U-G}),L=[],E=[],B=[];for(let N of b){let F=l.get(N.id);if(!F)continue;let U=Math.max(0,F.maxX-F.minX)+2*zn(N),G=(F.minX+F.maxX)/2;L.push(N.id),E.push(G),B.push(U)}let P=L.length;if(P>0){let N=new Map;if(P===1)N.set(L[0],B[0]);else{let F=[];for(let ft=0;ft<P-1;ft++)F.push(E[ft+1]-E[ft]);let U=new Array(P);U[0]=0;for(let ft=0;ft<P-1;ft++)U[ft+1]=2*F[ft]-U[ft];let G=0,Z=Number.POSITIVE_INFINITY;for(let ft=0;ft<P;ft++){let At=B[ft];ft%2===0?G=Math.max(G,At-U[ft]):Z=Math.min(Z,U[ft]-At)}let it=G;G<=Z?it=(G+Z)/2:it=G;for(let ft=0;ft<P;ft++){let At=U[ft]+(ft%2===0?it:-it),te=Math.max(B[ft],At);N.set(L[ft],te)}}for(let F of m){let U=N.get(F.id);U!=null&&(F.width=U),Ms(F)}}}}}c(Rs,"writeBackToLayoutData");var xi="[EdgeLabelNodes]";function Ts(t){let e=[],n=[],o=new Map;for(let i of t.nodes)o.set(i.id,i);for(let i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;let d=i.start?o.get(i.start):void 0,u=i.end?o.get(i.end):void 0;if(!d||!u){De.warn(xi,`Edge ${i.id} has missing source or target node`);continue}let a=`edge-label-${i.start}-${i.end}-${i.id}`,l=d.parentId!==u.parentId?u.parentId:d.parentId,x={id:a,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:l,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...d.dir?{dir:d.dir}:{}};e.push(x),i.labelNodeId=a,i.label=void 0,i.text=void 0;let m={id:`${i.id}-to-label`,start:i.start,end:a,type:"normal",isLayoutOnly:!0},p={id:`${i.id}-from-label`,start:a,end:i.end,type:"normal",isLayoutOnly:!0};n.push(m,p)}let s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}c(Ts,"createEdgeLabelNodes");var jt=.001;function vo(t){let 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:Ye(e,n,o,s)}:void 0}c(vo,"measuredNodeRect");function Lo(t){if(t.isGroup)return;let e=vo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}c(Lo,"nodeBoundsInfoFor");function de(t,e,n=jt){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}c(de,"samePoint");function It(t,e,n=jt){return Math.abs(t.x-e.x)<n}c(It,"sameX");function Ct(t,e,n=jt){return Math.abs(t.y-e.y)<n}c(Ct,"sameY");function _t(t,e,n=jt){return Ct(t,e,n)&&Math.abs(t.x-e.x)>n}c(_t,"isHorizontalSegment");function Dt(t,e,n=jt){return It(t,e,n)&&Math.abs(t.y-e.y)>n}c(Dt,"isVerticalSegment");function Qt(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)))}c(Qt,"overlapLength");function pe(t,e,n=jt){return t.horizontal&&e.horizontal&&Ct(t.a,e.a,n)?Qt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&It(t.a,e.a,n)?Qt(t.a.y,t.b.y,e.a.y,e.b.y):0}c(pe,"sameAxisSegmentOverlapLength");function we(t,e=jt){let n=[];for(let o=0;o<t.length-1;o++){let s=t[o],r=t[o+1],i=_t(s,r,e),d=Dt(s,r,e);(i||d)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:d})}return n}c(we,"orthogonalSegmentsForPoints");function ce(t,e=jt){let n=we(t,e),o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}c(ce,"countOrthogonalBends");function Os(t){let e=we(vt(t));return e.slice(1).flatMap((n,o)=>e[o].horizontal===n.horizontal?[]:[n.a])}c(Os,"bendPoints");function Ns(t,e){let n=Math.max(Math.min(e.a.x,e.b.x)-t.x,0,t.x-Math.max(e.a.x,e.b.x)),o=Math.max(Math.min(e.a.y,e.b.y)-t.y,0,t.y-Math.max(e.a.y,e.b.y));return Math.hypot(n,o)}c(Ns,"distanceToSegment");function Bs(t,e,n){let o=c((s,r)=>{let i=we(vt(r));return Os(s).some(d=>i.some(u=>Ns(d,u)<n))},"touches");return o(t,e)||o(e,t)}c(Bs,"routesTouchAtBend");function vt(t,e=jt){let n=[];for(let o of t){let s=n.length>0?n[n.length-1]:void 0;(!s||!de(s,o,e))&&n.push({x:o.x,y:o.y})}return n}c(vt,"dedupeConsecutivePoints");function wo(t,e=jt){if(!t||t.length!==4)return;let[n,o,s,r]=t;return _t(n,o,e)&&Dt(o,s,e)&&_t(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Dt(n,o,e)&&_t(o,s,e)&&Dt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}c(wo,"classifyThreeSegmentRoute");function Cn(t,e,n,o=0){let s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),d=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&d>n.top-o&&i<n.bottom+o}c(Cn,"segmentBoundsOverlapRect");function Eo(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}c(Eo,"pointInsideRect");function Fs(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}c(Fs,"rectContainsRect");function hn(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}c(hn,"rectsOverlap");function Un(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}c(Un,"inflateRect");function Ye(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}c(Ye,"rectFromCenterSize");function se(t){return vo(t)?.rect}c(se,"rectOfNodeBounds");function Fe(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}}}c(Fe,"portForRectSide");function Ao(t,e,n,o,s,r=jt){let i=e==="left"||e==="right",d=o==="left"||o==="right";if(i&&d){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(Ct(t,n,r))return[t,n];let l=(t.x+n.x)/2;return[t,{x:l,y:t.y},{x:l,y:n.y},n]}if(e===o){if(Ct(t,n,r))return;let l=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:l,y:t.y},{x:l,y:n.y},n]}return}if(!i&&!d){if(e===o){if(It(t,n,r))return;let x=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(It(t,n,r))return[t,n];let l=(t.y+n.y)/2;return[t,{x:t.x,y:l},{x:n.x,y:l},n]}if(i&&!d){let y=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,l=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return y&&l?[t,{x:n.x,y:t.y},n]:void 0}let u=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,a=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return u&&a?[t,{x:t.x,y:n.y},n]:void 0}c(Ao,"buildOrthogonalPortPath");function Ro(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]}c(Ro,"buildSameSideTrackPath");function vn(t){let e=new Map,n=[];for(let o of t){if(o.isEdgeLabel)continue;let s=Lo(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}c(vn,"collectRealNodeBounds");function Ee(t){let e=[],n=[];for(let o of t){let s=Lo(o);if(!s)continue;let r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}c(Ee,"collectNodeRectEntries");function Ps(t,{includeEdgeLabels:e=!0}={}){let n=[];for(let o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;let s=o.x??0,r=o.y??0,i=o.width??0,d=o.height??0;n.push({nodeId:o.id,...Ye(s,r,i,d)})}return n}c(Ps,"collectLayoutNodeRects");function To(t,e,n=jt){let o=t.start,s=t.end;if(!o||!s)return;let 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}}c(To,"getNodePairGeometry");function Xt(t,e,n,o=[],s=0){for(let r of n)if(!o.includes(r.id)&&Cn(t,e,r.rect,-s))return!0;return!1}c(Xt,"segmentHitsAnyRect");function Oo(t,e,n,o,s=jt,r=1e-6){let i=Ct(t,e,s),d=It(t,e,s),u=Ct(n,o,s),a=It(n,o,s);if(i&&u||d&&a||!(i||d)||!(u||a))return!1;let y=i?{a:t,b:e}:{a:n,b:o},l=d?{a:t,b:e}:{a:n,b:o},x=y.a.y,m=Math.min(y.a.x,y.b.x),p=Math.max(y.a.x,y.b.x),f=l.a.x,h=Math.min(l.a.y,l.b.y),M=Math.max(l.a.y,l.b.y);if(f<m||f>p||x<h||x>M)return!1;let I=Math.abs(f-y.a.x)<r&&Math.abs(x-y.a.y)<r||Math.abs(f-y.b.x)<r&&Math.abs(x-y.b.y)<r,C=Math.abs(f-l.a.x)<r&&Math.abs(x-l.a.y)<r||Math.abs(f-l.b.x)<r&&Math.abs(x-l.b.y)<r;return!(I&&C)}c(Oo,"orthogonalSegmentsCross");function ks(t,e,n,o,s=jt){let r=Ct(t,e,s),i=It(t,e,s),d=Ct(n,o,s),u=It(n,o,s);return i&&u&&It(t,n,s)?Qt(t.y,e.y,n.y,o.y)>s:r&&d&&Ct(t,n,s)?Qt(t.x,e.x,n.x,o.x)>s:!1}c(ks,"sameAxisSegmentsOverlap");function gn(t,e,n,o,{epsilon:s=jt,skipDegenerateOther:r=!1}={}){for(let i of n){if(i===o||i.isLayoutOnly)continue;let d=i.points;if(!(!d||d.length<2))for(let u=0;u<d.length-1;u++){let a=d[u],y=d[u+1];if(!(r&&de(a,y,s))&&(Oo(t,e,a,y,s)||ks(t,e,a,y,s)))return!0}}return!1}c(gn,"segmentConflictsWithAnyEdge");function be(t,e,n,o,s=jt){let r=Ct(t,e,s),i=It(t,e,s),d=Ct(n,o,s),u=It(n,o,s);if(!(r&&u||i&&d))return!1;let a=r?{a:t,b:e}:{a:n,b:o},y=r?{a:n,b:o}:{a:t,b:e},l=a.a.y,x=Math.min(a.a.x,a.b.x),m=Math.max(a.a.x,a.b.x),p=y.a.x,f=Math.min(y.a.y,y.b.y),h=Math.max(y.a.y,y.b.y);return p>x+s&&p<m-s&&l>f+s&&l<h-s}c(be,"orthogonalSegmentsStrictlyCross");function Vn(t,e,n){let o=Math.min(e,n),s=Math.max(e,n);return t>o+jt&&t<s-jt}c(Vn,"strictlyBetween");function _s(t,e,n){return It(t,e)&&It(e,n)?Vn(e.y,t.y,n.y):Ct(t,e)&&Ct(e,n)?Vn(e.x,t.x,n.x):!1}c(_s,"isCollinearIntermediate");function Ds(t){let e=!1,n=[];for(let o=0;o<t.length;o++){let s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(de(s,i)){o++,e=!0;continue}if(_s(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}c(Ds,"simplifyPolylineOnce");function pn(t){let e=[t[0]];for(let o=1;o<t.length;o++){let s=e[e.length-1],r=t[o];if(!It(s,r)&&!Ct(s,r)){let i=e.length>=2?e[e.length-2]:void 0,u=(i?It(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(u)}e.push(r)}let n=[];for(let o of e){let s=n[n.length-1];(!s||!de(s,o))&&n.push(o)}return n}c(pn,"orthogonalizePolyline");function me(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){let o=Ds(e);if(e=o.points,!o.changed)break}return e}c(me,"simplifyPolyline");var ht=.001,bi=.5,rs=4;function No(t,e,n){let o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;let 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?se(s):void 0,dstRect:r?se(r):void 0}}c(No,"endpointContextFor");function Hs(t,e,n){if(Ct(t,e,ht))return{x:t.x<n.left?n.left:n.right,y:t.y};if(It(t,e,ht)){let 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))}}c(Hs,"segmentEnterPoint");function jn(t,e,n){let o=n?1:-1,s=n?0:t.length-1;for(;s>=0&&s<t.length&&Eo(t[s],e,bi);)s+=o;if(s<0||s>=t.length)return t;let r=s-o;if(r<0||r>=t.length)return t;let i=Hs(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}c(jn,"clipEndpoint");function Xs(t,e){for(let n of t){let o=No(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=jn(s,o.srcRect,!0)),o.dstRect&&(s=jn(s,o.dstRect,!1)),s=me(pn(s)),s=Bo(s,o.srcRect,o.dstRect),o.edge.points=me(pn(s))}}c(Xs,"clipEdgeEndpointsToNodeBoundaries");function Wn(t,e,n,o=!1){if(Ct(t,e,ht)){if(e.y<n.top-ht||e.y>n.bottom+ht)return e;if(o){if(t.x<n.left-ht)return{x:n.left,y:t.y};if(t.x>n.right+ht)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(It(t,e,ht)){if(e.x<n.left-ht||e.x>n.right+ht)return e;if(o){if(t.y<n.top-ht)return{x:t.x,y:n.top};if(t.y>n.bottom+ht)return{x:t.x,y:n.bottom}}let 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}c(Wn,"snapEndpointToBoundary");function mn(t,e,n){let o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){let r=t[s];if(!de(r,o,ht))return r}return t[e+n]}c(mn,"firstDistinctAdjacent");function yn(t,e){let n=t+rs,o=e-rs;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}c(yn,"cornerClearanceRange");function Kn(t,e,n){let{lo:o,hi:s}=yn(e,n);return Math.min(s,Math.max(o,t))}c(Kn,"clampToCornerClearance");function Ys(t){let e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}c(Ys,"intersectRanges");function qn(t,e){return e==="left"||e==="right"?yn(t.top,t.bottom):yn(t.left,t.right)}c(qn,"clearanceRangeForSide");function xn(t,e,n){let o=t.y>=n.top-ht&&t.y<=n.bottom+ht,s=t.x>=n.left-ht&&t.x<=n.right+ht;if(Ct(t,e,ht)&&o){if(Math.abs(t.x-n.left)<ht)return"left";if(Math.abs(t.x-n.right)<ht)return"right"}if(It(t,e,ht)&&s){if(Math.abs(t.y-n.top)<ht)return"top";if(Math.abs(t.y-n.bottom)<ht)return"bottom"}}c(xn,"terminalSideForSegment");function Ue(t){return t==="left"||t==="right"}c(Ue,"isHorizontalSide");function Gs(t,e,n,o,s){let r=[],i=n?xn(t,e,n):void 0,d=o?xn(e,t,o):void 0;return n&&i&&Ue(i)===s&&r.push(qn(n,i)),o&&d&&Ue(d)===s&&r.push(qn(o,d)),r.length>0?Ys(r):void 0}c(Gs,"straightClearanceRange");function Jn(t,e,n,o,s){let r=Gs(t,e,n,o,s);if(!r)return;let i=s?t.y:t.x,d=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(d-i)<ht))return s?[{x:t.x,y:d},{x:e.x,y:d}]:[{x:d,y:t.y},{x:d,y:e.y}]}c(Jn,"clearStraightEndpointCornerAxis");function Bo(t,e,n){if(t.length!==2)return t;let[o,s]=t;return Ct(o,s,ht)?Jn(o,s,e,n,!0)??t:It(o,s,ht)?Jn(o,s,e,n,!1)??t:t}c(Bo,"clearStraightEndpointCornerConnections");function $s(t,e,n){return Ue(n)?{x:t.x,y:Kn(t.y,e.top,e.bottom)}:{x:Kn(t.x,e.left,e.right),y:t.y}}c($s,"cornerClearedEndpoint");function zs(t,e,n,o,s,r){let i=t.map(d=>({...d}));for(let d=e;d>=0&&d<t.length;d+=n){let u=t[d];if(r&&!Ct(u,o,ht)||!r&&!It(u,o,ht))break;r?i[d].y=s.y:i[d].x=s.x}return i}c(zs,"moveCollinearEndpointRun");function Zn(t,e,n){if(t.length<2)return t;let o=n?0:t.length-1,s=n?1:-1,r=t[o],i=mn(t,o,s);if(!i)return t;let d=xn(r,i,e);if(!d)return t;let u=Ue(d),a=$s(r,e,d);return de(r,a,ht)?t:zs(t,o,s,r,a,u)}c(Zn,"clearEndpointCornerConnection");function Qn(t,e,n){let o=Math.min(t.x,e.x)>=n.left-ht&&Math.max(t.x,e.x)<=n.right+ht,s=Math.min(t.y,e.y)>=n.top-ht&&Math.max(t.y,e.y)<=n.bottom+ht;if(Math.abs(t.y-n.top)<ht&&Math.abs(e.y-n.top)<ht&&o)return"top";if(Math.abs(t.y-n.bottom)<ht&&Math.abs(e.y-n.bottom)<ht&&o)return"bottom";if(Math.abs(t.x-n.left)<ht&&Math.abs(e.x-n.left)<ht&&s)return"left";if(Math.abs(t.x-n.right)<ht&&Math.abs(e.x-n.right)<ht&&s)return"right"}c(Qn,"borderSideForSegment");function to(t,e,n,o){switch(t){case"top":return It(e,n,ht)&&n.y<o.top-ht;case"bottom":return It(e,n,ht)&&n.y>o.bottom+ht;case"left":return Ct(e,n,ht)&&n.x<o.left-ht;case"right":return Ct(e,n,ht)&&n.x>o.right+ht}}c(to,"leavesOutward");function eo(t,e,n){if(t.length<3)return t;if(n){let r=Qn(t[0],t[1],e);return r&&to(r,t[1],t[2],e)?t.slice(1):t}let o=t.length-1,s=Qn(t[o-1],t[o],e);return s&&to(s,t[o-1],t[o-2],e)?t.slice(0,o):t}c(eo,"collapseOwnBorderStub");function Us(t,e,n){let o=t;if(e){let r=mn(o,0,1);if(r){let i=Wn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=eo(o,e,!0)}if(n){let r=o.length-1,i=mn(o,r,-1);if(i){let d=Wn(i,o[r],n,!0);d!==o[r]&&(o=[...o.slice(0,r),d])}o=eo(o,n,!1)}let s=Bo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Zn(o,e,!0)),n&&(o=Zn(o,n,!1)),o)}c(Us,"snapAndCollapseEndpoints");function no(t,e){for(let n of t){let o=No(n,e,2);if(!o)continue;let s=vt(o.points,ht),r=Us(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}c(no,"prepareEdgeEndpointsForRenderer");function Vs(t){return new Map(t.map(e=>[e.id,e]))}c(Vs,"buildNodeMap");function oo(t,e){let n=new Set([t.id]),o=0,s=t.parentId;for(;s&&!n.has(s);){let r=e.get(s);if(!r?.isGroup)break;n.add(s),o++,s=r.parentId}return o}c(oo,"groupDepth");function Fo(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(let r of t){let i=r.x,d=r.y;if(typeof i!="number"||typeof d!="number")continue;let u=r.width??0,a=r.height??0;e=Math.min(e,i-u/2),n=Math.max(n,i+u/2),o=Math.min(o,d-a/2),s=Math.max(s,d+a/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}c(Fo,"boundsForChildren");function js(t,e){let 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}c(js,"applyGroupBounds");function Ws(t){let e=Vs(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>oo(s,e)-oo(o,e));for(let o of n){let s=t.filter(i=>i.parentId===o.id),r=Fo(s);r&&js(o,r)}}c(Ws,"recomputeNestedGroupBounds");function bn(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(u=>!u.isGroup),r=1/0,i=-1/0;for(let u of s){let a=u[e];typeof a=="number"&&(r=Math.min(r,a),i=Math.max(i,a))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;let d=c(u=>r+i-u,"mirror");for(let u of n){let a=u[e];typeof a=="number"&&(u[e]=d(a));let y=u.groupTitleRect;y&&(u.groupTitleRect=e==="x"?{...y,left:d(y.right),right:d(y.left)}:{...y,top:d(y.bottom),bottom:d(y.top)})}for(let u of o)for(let a of u.points??[])a[e]=d(a[e]);return!0}c(bn,"mirrorAxis");function Ks(t){return(t.nodes??[]).some(n=>!n.isGroup)?bn(t,"y"):!0}c(Ks,"applyBtDirectionTransform");function Po(t){let e=t.filter(i=>!i.isGroup&&!i.isEdgeLabel);if(e.length===0)return 1;let n=0,o=0;for(let i of e)n+=i.width??0,o+=i.height??0;let s=n/e.length,r=o/e.length;return r>0?Math.max(1,s/r):1}c(Po,"flowAxisStretch");var Mi=36,Ii=["top","right","bottom","left"];function qs(t){return t==="left"?"right":t==="right"?"left":t}c(qs,"mirroredSide");function Js(t,e,n,o,s){if(n==="top"||n==="bottom"){let i=(e.left+e.right)/2,[d,u]=s?[o.after,o.before]:[o.before,o.after];t.left=Math.min(t.left,i-d),t.right=Math.max(t.right,i+u);return}let r=(e.top+e.bottom)/2;t.top=Math.min(t.top,r-o.before),t.bottom=Math.max(t.bottom,r+o.after)}c(Js,"growAlongBorder");var Si={top:c((t,e,n)=>{t.top=Math.min(t.top,e.top-n)},"top"),bottom:c((t,e,n)=>{t.bottom=Math.max(t.bottom,e.bottom+n)},"bottom"),left:c((t,e,n)=>{t.left=Math.min(t.left,e.left-n)},"left"),right:c((t,e,n)=>{t.right=Math.max(t.right,e.right+n)},"right")};function Zs(t,e,n,o,s){Js(t,e,n,o,s),Si[n](t,e,o.beyond)}c(Zs,"reserveOnSide");function Qs(t,e,n){let o=t.x??0,s=t.y??0,r=(t.width??0)/2,i=(t.height??0)/2,d={left:o-r,right:o+r,top:s-i,bottom:s+i},u={...d},a=n==="RL";for(let y of Ii){let l=e[y];l&&Zs(u,d,a?qs(y):y,l,a)}return{...t,x:(u.left+u.right)/2,y:(u.top+u.bottom)/2,width:u.right-u.left,height:u.bottom-u.top}}c(Qs,"withAnchorFootprints");function tr(t,e="LR"){let n=t.nodes??[],o=t.edges??[],s=Ve(n),r=n.filter(N=>!N.isGroup&&!s.has(N.id)),i=1/0,d=1/0;for(let N of r){let F=N.x??0,U=N.y??0;F<i&&(i=F),U<d&&(d=U)}if(!Number.isFinite(i)||!Number.isFinite(d))return!1;let u=Mi,a=Po(r);for(let N of r){let F=N.x??0,G=((N.y??0)-d)*a+u,Z=F-i;N.x=G,N.y=Z}for(let N of o)if(N.points)for(let F of N.points){let U=F.x,Z=(F.y-d)*a+u,it=U-i;F.x=Z,F.y=it}Ws(n);let y=he(n),l=n.filter(N=>y.isLane(N.id));if(l.length===0)return e==="RL"&&bn(t,"x"),!0;let x=new Map,m=bs(n,e);for(let N of n){if(y.isLane(N.id)||y.isPool(N.id)||s.has(N.id))continue;let F=y.laneIdOf(N.id);if(!F)continue;let U=x.get(F)??[],G=m.get(N.id);U.push(G?Qs(N,G,e):N),x.set(F,U)}let p=0;for(let N of l){let F=N.padding??0;F>p&&(p=F)}let f=[],h=1/0,M=-1/0;for(let N of l){let F=x.get(N.id)??[],U=Fo(F);U&&(h=Math.min(h,U.minX),M=Math.max(M,U.maxX),f.push({lane:N,contentTop:U.minY,contentBottom:U.maxY,centerY:(U.minY+U.maxY)/2}))}if(h===1/0||M===-1/0)return!0;let I=Math.max(0,M-h),C=Math.max(p,10),w=I+2*C,S=u+w,E=(h+M)/2-w/2-u,B=E+S/2,P=Math.max(p,u);f.sort((N,F)=>N.centerY-F.centerY);for(let N=0;N<f.length;N++){let F=f[N],U,G;if(N===0?U=F.contentTop-P:U=(f[N-1].contentBottom+F.contentTop)/2,N===f.length-1)G=F.contentBottom+P;else{let ft=f[N+1];G=(F.contentBottom+ft.contentTop)/2}let Z=Math.max(0,G-U),it=(U+G)/2;F.lane.x=B,F.lane.y=it,F.lane.width=S,F.lane.height=Z,F.lane.swimlaneContentTop=F.contentTop,F.lane.groupTitleRect={left:E,right:E+u,top:U,bottom:G}}return e==="RL"&&bn(t,"x"),!0}c(tr,"applyLrDirectionTransform");var ue=1e-6,Ci=8,rn=Ci,vi=[0,rn,-rn,2*rn,-2*rn];function er(t,e){let{nodeInfoById:n,realNodeRects:o}=vn(e);for(let s of t){if(s.isLayoutOnly)continue;let r=s.points;if(!r||r.length<4)continue;let i=wo(vt(r,ue),ue);if(!i)continue;let{p3:d}=i,u=i.kind==="HVH",a=To(s,n,ue);if(!a)continue;let{srcId:y,dstId:l,srcInfo:x,dstInfo:m,collinearX:p,collinearY:f}=a;if(p||f)continue;let h,M=x.rect;for(let I of vi){let C,w,S;if(u){let N=m.cy>x.cy?M.bottom:M.top,F=x.cx+I;if(F<=M.left+ue||F>=M.right-ue)continue;C={x:F,y:N},w={x:F,y:d.y},S={x:d.x,y:d.y}}else{let N=m.cx>x.cx?M.right:M.left,F=x.cy+I;if(F<=M.top+ue||F>=M.bottom-ue)continue;C={x:N,y:F},w={x:d.x,y:F},S={x:d.x,y:d.y}}let b=de(C,w,ue),L=de(w,S,ue);if(b&&L||!b&&Xt(C,w,o,[y],1)||!L&&Xt(w,S,o,[l],1))continue;let E=!b&&gn(C,w,t,s,{epsilon:ue,skipDegenerateOther:!0}),B=!L&&gn(w,S,t,s,{epsilon:ue,skipDegenerateOther:!0});if(!(E||B)){b?h=[w,S]:L?h=[C,w]:h=[C,w,S];break}}h&&(s.points=h)}}c(er,"portSwapToLShape");function nr(t,e){let{realNodeRects:r,labelNodeRects:i}=Ee(e.values());for(let d of t){if(d.isLayoutOnly)continue;let u=d.points;if(!u||u.length<4)continue;let a=vt(u,.001);if(a.length<4)continue;let y=a.length-1,l=a[y],x=a[y-1],m=a[y-2],p=l.x-x.x,f=l.y-x.y,h=Math.hypot(p,f);if(h>=10||h<.001)continue;let M=x.x-m.x,I=x.y-m.y;if(Math.hypot(M,I)<.001)continue;let w=_t(x,l,.001),S=Dt(x,l,.001),b=_t(m,x,.001),L=Dt(m,x,.001);if(!(w&&L||S&&b))continue;let E=d.end,B=d.start,P=E?e.get(E):void 0;if(!P)continue;let N=P.x??0,F=P.y??0,U=se(P);if(!U)continue;let G,Z;if(L){let Q=I<0;G={x:N,y:m.y},Z={x:N,y:Q?U.bottom:U.top}}else{let Q=M>0;G={x:m.x,y:F},Z={x:Q?U.right:U.left,y:F}}if(Xt(G,Z,r,E?[E]:[],-2)||Xt(G,Z,i,[],-2))continue;if(B){let Q=e.get(B),lt=Q?se(Q):void 0;if(lt&&Eo(G,lt,2))continue}let it=c((Q,lt)=>`${Q.x.toFixed(3)},${Q.y.toFixed(3)}|${lt.x.toFixed(3)},${lt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let Q=0;Q<a.length-1;Q++)ft.add(it(a[Q],a[Q+1]));let At=c((Q,lt)=>{for(let _ of t){if(_===d||_.isLayoutOnly)continue;let $=_.points;if(!(!$||$.length<2))for(let tt=0;tt<$.length-1;tt++){let q=$[tt],st=$[tt+1];if(!ft.has(it(q,st))&&be(Q,lt,q,st,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(At(G,Z))continue;if(y-3>=0){let Q=a[y-3],lt=[B,E].filter(_=>!!_);if(Xt(Q,G,r,lt,-2)||At(Q,G))continue}let zt=[...a.slice(0,y-2),G,Z];d.points=zt;let Ut=d.labelNodeId;if(Ut){let Q=e.get(Ut);if(Q){let lt=Q.width??0,_=Q.height??0;if(lt>0&&_>0){let $,tt,q=-1;for(let st=0;st<zt.length-1;st++){let ut=zt[st],gt=zt[st+1],pt=Math.hypot(gt.x-ut.x,gt.y-ut.y),xt=Ct(ut,gt,.001),Ft=It(ut,gt,.001);(xt&&pt>=lt+2||Ft&&pt>=_+2)&&pt>q&&(q=pt,$=(ut.x+gt.x)/2,tt=(ut.y+gt.y)/2)}$!==void 0&&tt!==void 0&&(Q.x=$,Q.y=tt)}}}}}c(nr,"collapseShortTerminalStub");var is=4,cs=2,or={EDGE_GAP:12,LANE_MARGIN:20,ARROWHEAD_SIZE:8,ARROWHEAD_GAP:is,MIN_ARROWHEAD_SPACING:12,EDGE_STROKE_WIDTH:cs,ROUTE_TOUCH_TOLERANCE:is+cs},Li={EPSILON:1e-6},Mn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Hn={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40,EDGE_LABEL_CLEARANCE:16},ct=.001,Vt=8,sr=c(t=>typeof t=="string"?t.toUpperCase():"","upperCaseDirection"),yt=we,Xn=c((t,e)=>It(t,e,ct)||Ct(t,e,ct),"orthogonallyAligned");function so(t,e){let s=c((m,p)=>{let f=m.x??0,h=m.y??0,M=p.x-f,I=p.y-h,C=(m.width??0)/2,w=(m.height??0)/2;return Math.abs(I)*C>Math.abs(M)*w?(I<0&&(w=-w),{x:f+(I===0?0:w*M/I),y:h+w}):(M<0&&(C=-C),{x:f+C,y:h+(M===0?0:C*I/M)})},"rectIntersect"),r=c((m,p)=>{let f=vt(m.points??[]);if(f.length<2)return;let h=p?m.start:m.end,M=h?e.get(h):void 0,I=M?se(M):void 0;if(!M||!h||!I)return;let C=p?f[0]:f[f.length-1],w=p?f[1]:f[f.length-2],S=s(M,C),b=C;if(Xn(w,S)&&(b=w),It(S,b,ct))return{edge:m,edgeId:String(m.id??""),nodeId:h,atStart:p,orientation:"V",coord:S.x,min:Math.min(S.y,b.y),max:Math.max(S.y,b.y),boundary:S,railEnd:b,rect:I};if(Ct(S,b,ct))return{edge:m,edgeId:String(m.id??""),nodeId:h,atStart:p,orientation:"H",coord:S.y,min:Math.min(S.x,b.x),max:Math.max(S.x,b.x),boundary:S,railEnd:b,rect:I}},"terminalLaneFor"),i=c((m,p)=>Math.max(0,Math.min(m.max,p.max)-Math.max(m.min,p.min)),"projectedOverlapLength"),d=c((m,p)=>m.nodeId!==p.nodeId||m.orientation!==p.orientation?!1:m.orientation==="H"?(Math.abs(m.boundary.x-m.rect.left)<1||Math.abs(m.boundary.x-m.rect.right)<1)&&It(m.boundary,p.boundary,1):(Math.abs(m.boundary.y-m.rect.top)<1||Math.abs(m.boundary.y-m.rect.bottom)<1)&&Ct(m.boundary,p.boundary,1),"sameTerminalFace"),u=c((m,p)=>m.nodeId!==p.nodeId||m.orientation!==p.orientation?!1:i(m,p)>=Vt&&Math.abs(m.coord-p.coord)<.5,"exactTerminalLaneConflict"),a=c((m,p)=>{if(m.nodeId!==p.nodeId||m.orientation!==p.orientation||m.orientation!=="H"||m.atStart===p.atStart)return!1;let f=i(m,p);if(f<Vt)return!1;let h=m.rect.bottom-m.rect.top;return f<h||f>2*h?!1:d(m,p)&&Math.abs(m.coord-p.coord)<16},"nearTerminalLaneConflict"),y=c((m,p)=>{let f=vt(m.edge.points??[]);if(f.length<2)return;let h=m.orientation==="V"?{x:m.boundary.x+p,y:m.boundary.y}:{x:m.boundary.x,y:m.boundary.y+p},M=m.orientation==="V"?{x:m.railEnd.x+p,y:m.railEnd.y}:{x:m.railEnd.x,y:m.railEnd.y+p};if(!c(()=>Math.abs(m.boundary.y-m.rect.top)<1||Math.abs(m.boundary.y-m.rect.bottom)<1?Ct(h,m.boundary,ct)&&h.x>=m.rect.left+1&&h.x<=m.rect.right-1:Math.abs(m.boundary.x-m.rect.left)<1||Math.abs(m.boundary.x-m.rect.right)<1?It(h,m.boundary,ct)&&h.y>=m.rect.top+1&&h.y<=m.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(m.atStart){let b=f.length>1&&de(f[1],m.railEnd,ct),L=f.slice(b?2:1),E=L[0];return E&&!Xn(E,M)?void 0:[h,M,...L]}let C=f.length>1&&de(f[f.length-2],m.railEnd,ct),w=f.slice(0,C?-2:-1),S=w[w.length-1];if(!(S&&!Xn(S,M)))return[...w,M,h]},"shiftedCandidate"),l=c(m=>{let p=m.edge,f=vt(p.points??[]);if(f.length!==2)return!1;let h=p.start,M=p.end,I=h?e.get(h):void 0,C=M?e.get(M):void 0;if(!I||!C)return!1;let w=I.x??0,S=I.y??0,b=C.x??0,L=C.y??0,[E,B]=f;return Ct(E,B,ct)&&Math.abs(S-L)<1&&Math.abs(w-b)>1||It(E,B,ct)&&Math.abs(w-b)<1&&Math.abs(S-L)>1},"laneIsStraightCollinearConnector"),x=[-7,7,-14,14,-21,21];for(let m=0;m<8;m++){let p=t.filter(h=>!h.isLayoutOnly).flatMap(h=>[r(h,!0),r(h,!1)]).filter(h=>!!h),f=!1;for(let h=0;h<p.length&&!f;h++)for(let M=h+1;M<p.length&&!f;M++){let I=p[h],C=p[M];if(I.edge===C.edge||!(u(I,C)||a(I,C)))continue;let w=!u(I,C),S=[I,C].sort((b,L)=>{let E=l(b),B=l(L);return E!==B?Number(E)-Number(B):+!L.atStart-+!b.atStart});for(let b of S){for(let L of x){let E=y(b,L);if(!E)continue;let B=r({...b.edge,points:E},b.atStart);if(!(!B||p.some(P=>P.edge!==b.edge&&(u(B,P)||w&&a(B,P))))){b.edge.points=E,f=!0;break}}if(f)break}}if(!f)return}}c(so,"separateSharedRenderedTerminalLanes");function rr(t,e){let{realNodeRects:s,labelNodeRects:r}=Ee(e.values()),i=c((u,a)=>{let y=u.start,l=u.end,x=yt(a);if(x.length!==a.length-1)return!1;let m=[y,l].filter(p=>!!p);for(let p of x)if(Xt(p.a,p.b,s,m,-2)||Xt(p.a,p.b,r,[],-2))return!1;for(let p of t){if(p===u||p.isLayoutOnly)continue;let f=p.points;if(!(!f||f.length<2)){for(let h of x)for(let M of yt(vt(f)))if(pe(h,M,.5)>=Vt||be(h.a,h.b,M.a,M.b,ct))return!1}}return!0},"candidateIsSafe"),d=c((u,a)=>{if(a+4>=u.length)return;let y=u[a],l=u[a+1],x=u[a+2],m=u[a+3],p=u[a+4],f=_t(y,l)&&Dt(l,x)&&_t(x,m)&&Dt(m,p)&&It(y,m,ct)&&It(y,p,ct)&&It(l,x,ct)&&(l.x-y.x)*(m.x-x.x)<0,h=Dt(y,l)&&_t(l,x)&&Dt(x,m)&&_t(m,p)&&Ct(y,m,ct)&&Ct(y,p,ct)&&Ct(l,x,ct)&&(l.y-y.y)*(m.y-x.y)<0;if(f||h)return vt([...u.slice(0,a+1),p,...u.slice(a+5)]);if(a+5>=u.length)return;let M=u[a+5],I=Dt(y,l)&&_t(l,x)&&Dt(x,m)&&_t(m,p)&&Dt(p,M)&&It(y,p,ct)&&It(y,M,ct)&&It(x,m,ct)&&(x.x-l.x)*(p.x-m.x)<0,C=_t(y,l)&&Dt(l,x)&&_t(x,m)&&Dt(m,p)&&_t(p,M)&&Ct(y,p,ct)&&Ct(y,M,ct)&&Ct(x,m,ct)&&(x.y-l.y)*(p.y-m.y)<0;if(!(!I&&!C))return vt([...u.slice(0,a+1),M,...u.slice(a+6)])},"withoutDogleg");for(let u=0;u<8;u++){let a=!1;for(let y of t){if(y.isLayoutOnly)continue;let l=vt(y.points??[]);for(let x=0;x<=l.length-5;x++){let m=d(l,x);if(!(!m||!i(y,m))){y.points=m,a=!0;break}}if(a)break}if(!a)return}}c(rr,"collapseRedundantRectangularDoglegs");function ro(t,e){let{realNodeRects:r,labelNodeRects:i}=Ee(e.values()),d=t.filter(p=>!p.isLayoutOnly),u=c((p,f,h)=>vt(p===f?h??[]:p.points??[]),"pointsFor"),a=c((p,f)=>{let h=0;for(let M=0;M<d.length;M++){let I=yt(u(d[M],p,f));for(let C=M+1;C<d.length;C++){let w=yt(u(d[C],p,f));for(let S of I)for(let b of w)be(S.a,S.b,b.a,b.b,ct)&&h++}}return h},"strictCrossingCount"),y=c(p=>{let f=yt(p);if(f.length!==3)return;let h=f[1];if(!(f[0].horizontal===h.horizontal||f[2].horizontal===h.horizontal))return{index:h.index,horizontal:h.horizontal,vertical:h.vertical,segment:h}},"middleRail"),l=c((p,f)=>{let h=[p.start,p.end].filter(M=>!!M);return r.filter(M=>{if(h.includes(M.id))return!1;let I=M.rect;return f.horizontal?Qt(f.a.x,f.b.x,I.left,I.right)>=Vt&&f.a.y>=I.top-2&&f.a.y<=I.bottom+2:Qt(f.a.y,f.b.y,I.top,I.bottom)>=Vt&&f.a.x>=I.left-2&&f.a.x<=I.right+2})},"blockingRectsFor"),x=c((p,f,h)=>{let M=p.map(C=>({...C}));if(f.horizontal)M[f.index].y=h,M[f.index+1].y=h;else if(f.vertical)M[f.index].x=h,M[f.index+1].x=h;else return;let I=me(vt(M));return yt(I).length===I.length-1?I:void 0},"candidateByMovingRail"),m=c((p,f,h)=>{let M=[p.start,p.end].filter(C=>!!C),I=yt(f);if(I.length!==f.length-1)return!1;for(let C of I)if(Xt(C.a,C.b,r,M,-2)||Xt(C.a,C.b,i,[],-2))return!1;for(let C of d)if(C!==p){for(let w of I)for(let S of yt(u(C)))if(pe(w,S,.5)>=Vt)return!1}return a(p,f)<=h},"candidateIsSafe");for(let p=0;p<8;p++){let f=a(),h=!1;for(let M of d){let I=u(M),C=y(I);if(!C)continue;let w=l(M,C.segment);if(w.length===0)continue;let S=C.horizontal?[Math.min(...w.map(b=>b.rect.top))-20,Math.max(...w.map(b=>b.rect.bottom))+20]:[Math.min(...w.map(b=>b.rect.left))-20,Math.max(...w.map(b=>b.rect.right))+20];for(let b of S){let L=x(I,C.segment,b);if(!(!L||!m(M,L,f))){M.points=L,h=!0;break}}if(h)break}if(!h)return}}c(ro,"liftObstacleHuggingSameSideRails");function io(t,e,n){let s=c(y=>{let l=y.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),r=he([...e.values()]),i=c(y=>{if(!r.isLane(y.id))return;let l=sr(y.direction??n);if(l==="LR"||l==="RL"||l==="BT")return;let x=s(y),m=y.y,p=y.height;if(!x||typeof m!="number"||typeof p!="number"||!Number.isFinite(m)||!Number.isFinite(p)||p<=0)return;let f=x.right-x.left,h=x.bottom-x.top;if(!(h<=0||f<h))return{node:y,rect:x}},"topLaneTitleFor"),d=c((y,l)=>{if(!y.horizontal)return!1;let x=y.a.y;return x<l.top-ct||x>l.bottom+ct?!1:Qt(y.a.x,y.b.x,l.left,l.right)>=Vt},"horizontalSegmentIntersectsTitle"),u=[...e.values()].map(i).filter(y=>!!y);if(u.length===0)return;let a=0;for(let y of t){if(y.isLayoutOnly)continue;let l=vt(y.points??[]);for(let x of yt(l))for(let m of u)d(x,m.rect)&&(a=Math.max(a,m.rect.bottom-x.a.y+4))}if(!(a<=ct))for(let y of u){let l=y.node.y,x=y.node.height;typeof l!="number"||typeof x!="number"||!Number.isFinite(l)||!Number.isFinite(x)||x<=0||(y.node.y=l-a/2,y.node.height=x+a,y.node.groupTitleRect={...y.rect,top:y.rect.top-a,bottom:y.rect.bottom-a})}}c(io,"liftTopLaneTitleBandsAboveRails");function co(t,e,n){let s=c(l=>{let x=l.groupTitleRect;if(!(!x||typeof x.left!="number"||typeof x.right!="number"||typeof x.top!="number"||typeof x.bottom!="number"||!Number.isFinite(x.left)||!Number.isFinite(x.right)||!Number.isFinite(x.top)||!Number.isFinite(x.bottom)||x.right<=x.left||x.bottom<=x.top))return{left:x.left,right:x.right,top:x.top,bottom:x.bottom}},"validTitleRect"),r=he([...e.values()]),i=c(l=>{if(!r.isLane(l.id)||sr(l.direction??n)!=="LR")return;let m=s(l),p=l.x,f=l.width;if(!m||typeof p!="number"||typeof f!="number"||!Number.isFinite(p)||!Number.isFinite(f)||f<=0)return;let h=m.right-m.left,M=m.bottom-m.top;if(!(h<=0||M<h))return{node:l,rect:m}},"leftLaneTitleFor"),d=c((l,x)=>{if(!l.vertical)return!1;let m=l.a.x;return m<x.left-ct||m>x.right+ct?!1:Qt(l.a.y,l.b.y,x.top,x.bottom)>=Vt},"verticalSegmentIntersectsTitle"),u=c((l,x)=>{if(!l.horizontal)return!1;let m=l.a.y;return m<x.top-ct||m>x.bottom+ct?!1:Qt(l.a.x,l.b.x,x.left,x.right)>=Vt},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(i).filter(l=>!!l);if(a.length===0)return;let y=0;for(let l of t){if(l.isLayoutOnly)continue;let x=vt(l.points??[]);for(let m of yt(x))for(let p of a)if(d(m,p.rect))y=Math.max(y,p.rect.right-m.a.x+4);else if(u(m,p.rect)){let f=Math.min(m.a.x,m.b.x);y=Math.max(y,p.rect.right-f+4)}}if(!(y<=ct))for(let l of a){let x=l.node.x,m=l.node.width;typeof x!="number"||typeof m!="number"||!Number.isFinite(x)||!Number.isFinite(m)||m<=0||(l.node.x=x-y/2,l.node.width=m+y,l.node.groupTitleRect={...l.rect,left:l.rect.left-y,right:l.rect.right-y})}}c(co,"shiftLeftLaneTitleBandsLeftOfRails");function ir(t,e){let{realNodeRects:s}=Ee(e.values()),r=t.filter(f=>!f.isLayoutOnly),i=c((f,h=new Map)=>vt(h.get(f)??f.points??[]),"replacementPointsFor"),d=c((f=new Map)=>{let h=0;for(let M=0;M<r.length;M++){let I=yt(i(r[M],f));for(let C=M+1;C<r.length;C++){let w=yt(i(r[C],f));for(let S of I)for(let b of w)be(S.a,S.b,b.a,b.b,ct)&&h++}}return h},"crossingCount"),u=c((f=new Map)=>r.reduce((h,M)=>h+ce(i(M,f)),0),"totalBends"),a=c(f=>{let h=i(f);if(h.length<4)return;let M=h[h.length-2],I=h[h.length-1];if(!(!_t(M,I,ct)&&!Dt(M,I,ct)))return{tailStart:M,terminal:I}},"terminalTailFor"),y=c((f,h)=>{let M=i(f);if(M.length<3)return;let I=M[0],C=M[1],w;if(_t(I,C,ct))w={x:C.x,y:h.tailStart.y};else if(Dt(I,C,ct))w={x:h.tailStart.x,y:C.y};else return;let S=me(vt([I,C,w,h.tailStart,h.terminal]));return yt(S).length===S.length-1?S:void 0},"candidateWithDestinationTail"),l=c((f,h)=>{let M=[f.start,f.end].filter(I=>!!I);for(let I of yt(h))if(Xt(I.a,I.b,s,M,-2))return!0;return!1},"pathHasNodeHit"),x=c((f,h,M)=>{for(let I of r)if(I!==f){for(let C of yt(h))for(let w of yt(i(I,M)))if(pe(C,w,.5)>=Vt)return!0}return!1},"pathHasSharedTrack"),m=c((f,h,M)=>!l(f,h)&&!x(f,h,M),"candidateIsSafe"),p=c(()=>{let f=new Map;for(let h of r){let M=h.end;if(!M||!e.has(M)||i(h).length<4)continue;let C=f.get(M)??[];C.push(h),f.set(M,C)}return f},"edgesByDestination");for(let f=0;f<4;f++){let h=d();if(h===0)return;let M=u(),I,C=h,w=M;for(let S of p().values())for(let b=0;b<S.length;b++)for(let L=b+1;L<S.length;L++){let E=S[b],B=S[L],P=a(E),N=a(B);if(!P||!N)continue;let F=y(E,N),U=y(B,P);if(!F||!U)continue;let G=new Map([[E,F],[B,U]]);if(!m(E,F,G)||!m(B,U,G))continue;let Z=d(G),it=u(G);Z>=h||Z>C||Z===C&&it>=w||(I=G,C=Z,w=it)}if(!I)return;for(let[S,b]of I)S.points=b}}c(ir,"swapDestinationTerminalTailsToReduceCrossings");function cr(t,e){let{realNodeRects:i,labelNodeRects:d}=Ee(e.values()),u=t.filter(S=>!S.isLayoutOnly),a=c((S,b=new Map)=>vt(b.get(S)??S.points??[]),"replacementPointsFor"),y=c((S=new Map)=>{let b=0;for(let L=0;L<u.length;L++){let E=yt(a(u[L],S));for(let B=L+1;B<u.length;B++){let P=yt(a(u[B],S));for(let N of E)for(let F of P)be(N.a,N.b,F.a,F.b,ct)&&b++}}return b},"strictCrossingCount"),l=c((S=new Map)=>u.reduce((b,L)=>b+ce(a(L,S)),0),"totalBends"),x=c(S=>{let b=S.start,L=S.end,E=b?e.get(b):void 0,B=L?e.get(L):void 0,P=E?se(E):void 0,N=B?se(B):void 0;return P&&N?{src:P,dst:N}:void 0},"endpointRectsFor"),m=c((S,b,L)=>{if(L.index<=0||L.index+1>=b.length-1)return;let E=x(S);if(E){if(L.vertical){let B=L.a.x,P=Math.min(E.src.left,E.dst.left),N=Math.max(E.src.right,E.dst.right),F=B<P-ct?"left":B>N+ct?"right":void 0;return F?{edge:S,points:b,segmentIndex:L.index,axis:"vertical",side:F,coord:B,min:Math.min(L.a.y,L.b.y),max:Math.max(L.a.y,L.b.y)}:void 0}if(L.horizontal){let B=L.a.y,P=Math.min(E.src.top,E.dst.top),N=Math.max(E.src.bottom,E.dst.bottom),F=B<P-ct?"top":B>N+ct?"bottom":void 0;return F?{edge:S,points:b,segmentIndex:L.index,axis:"horizontal",side:F,coord:B,min:Math.min(L.a.x,L.b.x),max:Math.max(L.a.x,L.b.x)}:void 0}}},"externalRailForSegment"),p=c(()=>{let S=[];for(let b of u){let L=a(b);for(let E of yt(L)){let B=m(b,L,E);B&&S.push(B)}}return S},"collectExternalRails"),f=c((S,b)=>S.edge!==b.edge&&S.axis===b.axis&&S.side===b.side&&Qt(S.min,S.max,b.min,b.max)>=Vt,"railsInteract"),h=c(S=>{let b=[],L=new Set;for(let E of S){if(L.has(E))continue;let B=[E],P=[];for(L.add(E);B.length>0;){let N=B.pop();P.push(N);for(let F of S)!L.has(F)&&f(N,F)&&(L.add(F),B.push(F))}P.length>1&&b.push(P)}return b},"connectedComponents"),M=c(S=>{let b=[];for(let L of S)b.some(E=>Math.abs(E-L.coord)<ct)||b.push(L.coord);for(;b.length<S.length;){let L=Math.min(...b),E=Math.max(...b),B=S[0].side;b.push(B==="left"||B==="top"?L-12*(S.length-b.length):E+12*(S.length-b.length))}return b},"uniqueCoordsFor"),I=c(S=>{let b=S.map(B=>B.coord),L=M(S),E=[];if(S.length<=6){let B=new Array(L.length).fill(!1),P=[],N=c(()=>{if(P.length===S.length){P.some((F,U)=>Math.abs(F-b[U])>=ct)&&E.push([...P]);return}for(let[F,U]of L.entries())B[F]||(B[F]=!0,P.push(U),N(),P.pop(),B[F]=!1)},"visit");return N(),E}for(let B=0;B<b.length;B++)for(let P=B+1;P<b.length;P++){let N=[...b];[N[B],N[P]]=[N[P],N[B]],E.push(N)}return E},"coordinateAssignmentsFor"),C=c((S,b)=>{let L=new Map;for(let[B,P]of S.entries()){let N=b[B],F=L.get(P.edge)??P.points.map(U=>({x:U.x,y:U.y}));P.axis==="vertical"?(F[P.segmentIndex].x=N,F[P.segmentIndex+1].x=N):(F[P.segmentIndex].y=N,F[P.segmentIndex+1].y=N),L.set(P.edge,F)}let E=new Map;for(let[B,P]of L){let N=me(vt(P));if(yt(N).length!==N.length-1)return;E.set(B,N)}return E},"replacementsForAssignment"),w=c(S=>{for(let[b,L]of S){let E=[b.start,b.end].filter(B=>!!B);for(let B of yt(L))if(Xt(B.a,B.b,i,E,-2)||Xt(B.a,B.b,d,[],-2))return!1}for(let b=0;b<u.length;b++){let L=u[b],E=S.has(L),B=yt(a(L,S));for(let P=b+1;P<u.length;P++){let N=u[P];if(!E&&!S.has(N))continue;let F=yt(a(N,S));for(let U of B)for(let G of F)if(pe(U,G,.5)>=Vt)return!1}}return!0},"candidateIsSafe");for(let S=0;S<4;S++){let b=y();if(b===0)return;let L,E=b,B=l(),P=Number.POSITIVE_INFINITY;for(let N of h(p()))for(let F of I(N)){let U=C(N,F);if(!U||!w(U))continue;let G=y(U);if(G>=b)continue;let Z=l(U),it=N.reduce((ft,At,te)=>ft+Math.abs(F[te]-At.coord),0);G>E||G===E&&(Z>B||Z===B&&it>=P)||(L=U,E=G,B=Z,P=it)}if(!L)return;for(let[N,F]of L)N.points=F}}c(cr,"reassignCrossingExternalRailChannels");function ar(t,e){let{realNodeRects:s,labelNodeRects:r}=Ee(e.values()),i=t.filter(p=>!p.isLayoutOnly),d=c((p,f,h)=>vt(p===f?h??[]:p.points??[]),"pointsFor"),u=c(p=>yt(p).reduce((f,h)=>{let M=h.a.x-h.b.x,I=h.a.y-h.b.y;return f+Math.hypot(M,I)},0),"pathLength"),a=c((p,f)=>{let h=0;for(let M=0;M<i.length;M++){let I=yt(d(i[M],p,f));for(let C=M+1;C<i.length;C++){let w=yt(d(i[C],p,f));for(let S of I)for(let b of w)be(S.a,S.b,b.a,b.b,ct)&&h++}}return h},"strictCrossingCount"),y=c((p,f)=>{if(p.horizontal){let h=p.a.y;return(Math.abs(h-f.top)<1||Math.abs(h-f.bottom)<1)&&Qt(p.a.x,p.b.x,f.left,f.right)>=Vt}if(p.vertical){let h=p.a.x;return(Math.abs(h-f.left)<1||Math.abs(h-f.right)<1)&&Qt(p.a.y,p.b.y,f.top,f.bottom)>=Vt}return!1},"segmentRunsAlongRectBorder"),l=c(p=>{let f=[p.start,p.end].filter(M=>!!M),h=[];for(let M of f){let I=e.get(M),C=I?se(I):void 0;C&&h.push(C)}return h},"endpointRectsFor"),x=c((p,f)=>{if(f+3>=p.length)return[];let h=p[f],M=p[f+1],I=p[f+2],C=p[f+3],w=_t(h,M,ct)&&Dt(M,I,ct)&&_t(I,C,ct),S=Dt(h,M,ct)&&_t(M,I,ct)&&Dt(I,C,ct);if(!w&&!S)return[];if(!(w?Math.sign(M.x-h.x)!==Math.sign(C.x-I.x):Math.sign(M.y-h.y)!==Math.sign(C.y-I.y)))return[];let L=It(h,C,ct)||Ct(h,C,ct)?[]:[{x:h.x,y:C.y},{x:C.x,y:h.y}],E=L.length===0?[[...p.slice(0,f+1),...p.slice(f+3)]]:L.map(P=>[...p.slice(0,f+1),P,...p.slice(f+3)]),B=new Set;return E.map(P=>me(vt(P))).filter(P=>{if(yt(P).length!==P.length-1||!P.some(F=>de(F,C,ct)))return!1;let N=P.map(F=>`${F.x.toFixed(3)},${F.y.toFixed(3)}`).join("|");return B.has(N)?!1:(B.add(N),!0)})},"shortcutCandidatesAt"),m=c((p,f,h)=>{let M=[p.start,p.end].filter(C=>!!C),I=l(p);for(let C of yt(f))if(Xt(C.a,C.b,s,M,-2)||Xt(C.a,C.b,r,[],-2)||I.some(w=>y(C,w)))return!1;for(let C of i)if(C!==p){for(let w of yt(f))for(let S of yt(d(C)))if(pe(w,S,.5)>=Vt)return!1}return a(p,f)<=h},"candidateIsSafe");for(let p=0;p<8;p++){let f=a(),h,M,I=f,C=Number.POSITIVE_INFINITY,w=Number.POSITIVE_INFINITY;for(let S of i){let b=d(S),L=ce(b,ct),E=u(b);for(let B=0;B<=b.length-4;B++)for(let P of x(b,B)){let N=ce(P,ct),F=u(P);if(!(N<L||N===L&&F<E-ct)||!m(S,P,f))continue;let G=a(S,P);G>I||G===I&&(N>C||N===C&&F>=w)||(h=S,M=P,I=G,C=N,w=F)}}if(!h||!M)return;h.points=M}}c(ar,"shortcutRedundantOrthogonalJogs");function lr(t,e){let i=[];for(let O of e.values()){if(O.isGroup||O.isEdgeLabel)continue;let k=O.x??0,H=O.y??0,j=se(O);j&&i.push({id:String(O.id??""),cx:k,cy:H,rect:j})}if(i.length===0)return;let d=new Map(i.map(O=>[O.id,O])),u=i.map(O=>({id:O.id,rect:O.rect})),a=["top","bottom","left","right"],y={top:Math.min(...i.map(O=>O.rect.top))-20,bottom:Math.max(...i.map(O=>O.rect.bottom))+20,left:Math.min(...i.map(O=>O.rect.left))-20,right:Math.max(...i.map(O=>O.rect.right))+20},l=t.filter(O=>!O.isLayoutOnly),x=new Map(l.map((O,k)=>[O,k])),m=c(O=>{let k=O==="left"||O==="top"?-1:1,H=[];for(let j=0;j<=2;j++)H.push(y[O]+k*20*j);return H},"outwardTracksForSide"),p=c((O,k=new Map)=>vt(k.get(O)??O.points??[]),"replacementPointsFor"),f=c((O,k)=>{let H=0;for(let j of O)for(let K of k)be(j.a,j.b,K.a,K.b,ct)&&H++;return H},"crossingCountBetweenSegments"),h=c((O,k)=>f(yt(O),yt(k)),"crossingCountBetweenPaths"),M=c((O=new Map)=>{let k=0,H=[],j=new Set,K=[],et=c(Y=>{j.has(Y)||(j.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y<l.length;Y++){let nt=l[Y],dt=p(nt,O);for(let g=Y+1;g<l.length;g++){let v=l[g],A=h(dt,p(v,O));A>0&&(k+=A,H.push({first:nt,second:v,count:A}),et(nt),et(v))}}return K.sort((Y,nt)=>(x.get(Y)??0)-(x.get(nt)??0)),{count:k,pairs:H,edgeSet:j,edges:K}},"crossingSnapshot"),I=c((O,k)=>{let H=new Set(k.keys());if(H.size===0)return O.count;let j=0;for(let et of O.pairs)(H.has(et.first)||H.has(et.second))&&(j+=et.count);let K=0;for(let et=0;et<l.length;et++){let Y=l[et],nt=H.has(Y),dt=p(Y,k);for(let g=et+1;g<l.length;g++){let v=l[g];!nt&&!H.has(v)||(K+=h(dt,p(v,k)))}}return O.count-j+K},"crossingCountWithReplacements"),C=c(O=>{let k=new Map;for(let K of O.pairs){let et=k.get(K.first)??new Set;et.add(K.second),k.set(K.first,et);let Y=k.get(K.second)??new Set;Y.add(K.first),k.set(K.second,Y)}let H=[],j=new Set;for(let K of O.edges){if(j.has(K))continue;let et=[K],Y=[];for(j.add(K);et.length>0;){let nt=et.pop();Y.push(nt);for(let dt of k.get(nt)??[])j.has(dt)||(j.add(dt),et.push(dt))}Y.sort((nt,dt)=>(x.get(nt)??0)-(x.get(dt)??0)),Y.length>1&&H.push(Y)}return H},"crossingComponents"),w=c(O=>[O.start,O.end].filter(k=>!!k),"endpointIdsFor"),S=c(O=>{let k=[];for(let H of C(O)){let j=new Set(H),K=new Set(H.flatMap(Y=>w(Y))),et=[...H];for(let Y of l)j.has(Y)||w(Y).some(nt=>K.has(nt))&&et.push(Y);et.sort((Y,nt)=>(x.get(Y)??0)-(x.get(nt)??0)),k.push(et)}return k},"pairSearchGroups"),b=c((O,k,H)=>I(O,new Map([[k,H]])),"crossingCountWithSingleReplacement"),L=c(O=>{let k=new Map;for(let H of O.pairs)k.set(H.first,(k.get(H.first)??0)+H.count),k.set(H.second,(k.get(H.second)??0)+H.count);return k},"currentCrossingsByEdge"),E=c(O=>O.slice(1).reduce((k,H,j)=>{let K=O[j];return k+Math.abs(H.x-K.x)+Math.abs(H.y-K.y)},0),"pathLength"),B=c((O=new Map)=>l.reduce((k,H)=>k+ce(p(H,O)),0),"totalBends"),P=c((O=new Map)=>l.reduce((k,H)=>k+E(p(H,O)),0),"totalLength"),N=c((O,k)=>Bs(O,k,or.ROUTE_TOUCH_TOLERANCE),"touchesAtBend"),F=c((O,k,H=new Map)=>{let j=yt(k);for(let K of l)if(K!==O){for(let et of j)for(let Y of yt(p(K,H)))if(pe(et,Y,.5)>=Vt)return!0;if(N(k,p(K,H)))return!0}return!1},"pathHasSegmentConflict"),U=c((O,k)=>{let H=[O.start,O.end].filter(j=>!!j);for(let j of yt(k))if(Xt(j.a,j.b,u,H,-2))return!0;return!1},"pathHitsNode"),G=c((O,k)=>{let H=me(vt(k));yt(H).length===H.length-1&&O.push(H)},"pushOrthogonalCandidate"),Z=c(O=>O==="left"||O==="right","sideIsHorizontal"),it=c((O,k,H)=>{switch(k){case"left":return Math.min(O.x,H.x)-20;case"right":return Math.max(O.x,H.x)+20;case"top":return Math.min(O.y,H.y)-20;case"bottom":return Math.max(O.y,H.y)+20}},"localTrackForSameSide"),ft=c((O,k,H,j)=>{let K=H==="left"||H==="top"?-1:1,et=[it(k,H,j),y[H]];for(let Y of et)for(let nt=0;nt<=2;nt++)G(O,Ro(k,H,j,Y+K*20*nt))},"addSameSideCandidates"),At=c((O,k,H,j,K)=>{for(let et of m(H))for(let Y of m(K))G(O,[k,{x:et,y:k.y},{x:et,y:Y},{x:j.x,y:Y},j])},"addHorizontalToVerticalCandidates"),te=c((O,k,H,j,K)=>{for(let et of m(H))for(let Y of m(K))G(O,[k,{x:k.x,y:et},{x:Y,y:et},{x:Y,y:j.y},j])},"addVerticalToHorizontalCandidates"),zt=c((O,k,H,j,K)=>{let et=[...m("top"),...m("bottom")];for(let Y of m(H))for(let nt of m(K))for(let dt of et)G(O,[k,{x:Y,y:k.y},{x:Y,y:dt},{x:nt,y:dt},{x:nt,y:j.y},j])},"addHorizontalPairCandidates"),Ut=c((O,k,H,j,K)=>{let et=[...m("left"),...m("right")];for(let Y of m(H))for(let nt of m(K))for(let dt of et)G(O,[k,{x:k.x,y:Y},{x:dt,y:Y},{x:dt,y:nt},{x:j.x,y:nt},j])},"addVerticalPairCandidates"),Q=c(O=>{let k=new Set;return O.map(H=>vt(H)).filter(H=>{let j=H.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return k.has(j)||H.length<2?!1:(k.add(j),!0)})},"dedupeCandidatePaths"),lt=c((O,k,H,j)=>{let K=[],et=Ao(O,k,H,j,20,ct);et&&G(K,et),k===j&&ft(K,O,k,H);let Y=Z(k),nt=Z(j);return Y&&!nt?At(K,O,k,H,j):!Y&&nt?te(K,O,k,H,j):Y?zt(K,O,k,H,j):Ut(K,O,k,H,j),Q(K)},"buildCandidatesForSides"),_=c((O,k,H,j)=>{let K=[...m("left"),...m("right")],et=[...m("top"),...m("bottom")];for(let Y of a){let nt=Fe(j,Y),dt=Y==="top"||Y==="bottom"?m(Y):et;for(let g of K){Z(Y)&&G(O,[k,H,{x:g,y:H.y},{x:g,y:nt.y},nt]);for(let v of dt)G(O,[k,H,{x:g,y:H.y},{x:g,y:v},{x:nt.x,y:v},nt])}}},"addVerticalDepartureOuterTrackCandidates"),$=c((O,k,H,j)=>{let K=[...m("left"),...m("right")],et=[...m("top"),...m("bottom")];for(let Y of a){let nt=Fe(j,Y),dt=Y==="left"||Y==="right"?m(Y):K;for(let g of et){Z(Y)||G(O,[k,H,{x:H.x,y:g},{x:nt.x,y:g},nt]);for(let v of dt)G(O,[k,H,{x:H.x,y:g},{x:v,y:g},{x:v,y:nt.y},nt])}}},"addHorizontalDepartureOuterTrackCandidates"),tt=c(O=>{let k=O.start,H=O.end,j=H?d.get(H):void 0;if(!k||!j)return[];let K=vt(O.points??[]);if(K.length<4)return[];let et=K[0],Y=K[1],nt=[];return Dt(et,Y,ct)?_(nt,et,Y,j):_t(et,Y,ct)&&$(nt,et,Y,j),nt},"terminalPreservingOuterTrackCandidates"),q=c(O=>{let k=O.start,H=O.end,j=k?d.get(k):void 0,K=H?d.get(H):void 0;if(!j||!K)return[];let et=[];for(let Y of a){let nt=Fe(j,Y);for(let dt of a)et.push(...lt(nt,Y,Fe(K,dt),dt))}return et.push(...tt(O)),et},"candidatePathsFor"),st=c(()=>new Map(l.map(O=>[O,yt(p(O))])),"currentSegmentsByEdge"),ut=c((O,k,H,j)=>{let K=new Set;for(let et of l){if(et===O)continue;let Y=j.get(et)??yt(p(et));(H.some(nt=>Y.some(dt=>pe(nt,dt,.5)>=Vt))||N(k,p(et)))&&K.add(et)}return K},"sharedTrackConflictsFor"),gt=c((O,k,H,j)=>{let K=new Set;return q(O).map(Y=>me(vt(Y))).filter(Y=>{if(U(O,Y))return!1;let nt=Y.map(dt=>`${dt.x.toFixed(3)},${dt.y.toFixed(3)}`).join("|");return K.has(nt)||Y.length<2?!1:(K.add(nt),!0)}).map(Y=>{let nt=yt(Y),dt=0;for(let g of l)g!==O&&(dt+=f(nt,H.get(g)??yt(p(g))));return{candidate:Y,candidateSegments:nt,crossings:k.count-(j.get(O)??0)+dt,bends:ce(Y,ct),totalBends:ce(Y),length:E(Y)}}).filter(({crossings:Y})=>Y<=k.count).sort((Y,nt)=>Y.crossings-nt.crossings||Y.bends-nt.bends||Y.length-nt.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:ut(O,Y.candidate,Y.candidateSegments,H),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),pt=c((O,k,H,j,K,et)=>{let Y=0;for(let dt of O.pairs)(dt.first===k||dt.second===k||dt.first===j||dt.second===j)&&(Y+=dt.count);let nt=f(H.segments,K.segments);for(let dt of l){if(dt===k||dt===j)continue;let g=et.get(dt)??yt(p(dt));nt+=f(H.segments,g)+f(K.segments,g)}return O.count-Y+nt},"pairCrossingCount"),xt=c((O,k)=>{for(let H of O.sharedTrackConflicts)if(H!==k)return!1;return!0},"conflictsOnlyWith"),Ft=c((O,k)=>O.segments.some(H=>k.segments.some(j=>pe(H,j,.5)>=Vt))||N(O.path,k.path),"candidatesShareTrack"),Re=c((O,k,H,j)=>xt(k,H.edge)&&xt(j,O.edge)&&!Ft(k,j),"pairCandidatesAreCompatible"),ye=c((O,k,H,j,K)=>{let et=pt(O.current,k.edge,H,j.edge,K,O.baseSegments);if(!(et>=O.current.count))return{replacements:new Map([[k.edge,H.path],[j.edge,K.path]]),crossings:et,bends:O.currentBends-(O.baseBendsByEdge.get(k.edge)??0)-(O.baseBendsByEdge.get(j.edge)??0)+H.totalBends+K.totalBends,length:O.currentLength-(O.baseLengthByEdge.get(k.edge)??0)-(O.baseLengthByEdge.get(j.edge)??0)+H.length+K.length}},"scorePairReplacement"),xe=c((O,k)=>O.crossings<k.crossings||O.crossings===k.crossings&&(O.bends<k.bends||O.bends===k.bends&&O.length<k.length),"pairScoreIsBetter"),Te=c((O,k,H,j)=>{let K=j;for(let et of k.candidates)for(let Y of H.candidates){if(!Re(k,et,H,Y))continue;let nt=ye(O,k,et,H,Y);nt&&xe(nt,K)&&(K=nt)}return K},"bestScoreForOptionPair"),We=c(O=>{let k=B(),H=P(),j=st(),K=L(O),et=new Map(l.map(A=>[A,ce(p(A))])),Y=new Map(l.map(A=>[A,E(p(A))])),nt=new Map,dt=S(O);for(let A of dt)for(let R of A){if(nt.has(R))continue;let T=gt(R,O,j,K);T.length>0&&nt.set(R,{edge:R,candidates:T})}let g={replacements:new Map,crossings:O.count,bends:k,length:H},v={current:O,currentBends:k,currentLength:H,baseBendsByEdge:et,baseLengthByEdge:Y,baseSegments:j};for(let A of dt){let R=new Set(A.filter(D=>O.edgeSet.has(D))),T=A.map(D=>nt.get(D)).filter(D=>!!D);for(let D=0;D<T.length;D++){let J=T[D];for(let at=D+1;at<T.length;at++){let W=T[at];!R.has(J.edge)&&!R.has(W.edge)||(g=Te(v,J,W,g))}}}return g.replacements.size>0?g.replacements:void 0},"bestPairedReplacement");for(let O=0;O<4;O++){let k=M(),H=k.count;if(H===0)return;let j,K,et=H,Y=Number.POSITIVE_INFINITY;for(let dt of k.edges){let g=ce(p(dt),ct);for(let v of q(dt)){let A=U(dt,v),R=!A&&F(dt,v),T=b(k,dt,v),D=ce(v,ct);A||R||!(T<H||T===H&&D<g)||T>et||T===et&&D>=Y||(j=dt,K=v,et=T,Y=D)}}if(j&&K){j.points=K;continue}let nt=We(k);if(!nt)return;for(let[dt,g]of nt)dt.points=g}}c(lr,"resolveRenderedOrthogonalCrossings");var Le=.001,wi=8;function dr(t,e){let{nodeInfoById:n,realNodeRects:o}=vn(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(f=>f.rect.top))-r,bottom:Math.max(...o.map(f=>f.rect.bottom))+r,left:Math.min(...o.map(f=>f.rect.left))-r,right:Math.max(...o.map(f=>f.rect.right))+r},d=c((f,h,M,I)=>{let C=[],w=Ao(f,h,M,I,r,Le);return w&&C.push(w),h===I&&C.push(Ro(f,h,M,i[h])),C},"buildOrthogonalPathCandidates"),u=c((f,h)=>{for(let M=0;M<f.length-1;M++){let I=f[M],C=f[M+1];if(Xt(I,C,o,h,1))return!0}return!1},"pathHitsNode"),a=c((f,h,M=!1)=>{let I=0,C=we(f,Le),w=h.start,S=h.end;for(let b of t){if(b===h||b.isLayoutOnly)continue;let L=b.start,E=b.end;if(!M&&w&&S&&(L===w||L===S||E===w||E===S))continue;let B=b.points;if(!(!B||B.length<2))for(let P of C)for(let N of we(B,Le)){if(Oo(P.a,P.b,N.a,N.b,Le,Le)){I++;continue}pe(P,N,Le)>=wi&&I++}}return I},"pathConflictCount"),y=4,l=c((f,h)=>{let M=Math.abs(f.y-h.rect.top),I=Math.abs(f.y-h.rect.bottom),C=Math.abs(f.x-h.rect.left),w=Math.abs(f.x-h.rect.right),S="top",b=M;return I<b&&(S="bottom",b=I),C<b&&(S="left",b=C),w<b&&(S="right",b=w),S},"nearestSideOfRect"),x=new Map,m=c((f,h,M)=>{let I=x.get(f)??[];I.push({side:h,edgeId:M}),x.set(f,I)},"addFaceClaim");for(let f of t){if(f.isLayoutOnly)continue;let h=f.points??[];if(h.length<1)continue;let M=f.id??"",I=f.start,C=f.end;if(I){let w=n.get(I);w&&m(I,l(h[0],w),M)}if(C){let w=n.get(C);w&&m(C,l(h[h.length-1],w),M)}}let p=c((f,h,M)=>x.get(f)?.some(I=>I.edgeId!==M&&I.side===h)??!1,"faceIsClaimed");for(let f of t){if(f.isLayoutOnly)continue;let h=f.points;if(!h||h.length<2)continue;let M=ce(h,Le);if(M<y)continue;let I=f.start,C=f.end;if(!I||!C)continue;let w=n.get(I),S=n.get(C);if(!w||!S)continue;let b=f.id??"",L=a(h,f,!0),E=a(h,f),B,P=L,N=M;for(let F of s){if(p(I,F,b))continue;let U=Fe(w,F);for(let G of s){if(p(C,G,b))continue;let Z=Fe(S,G);for(let it of d(U,F,Z,G)){if(u(it,[I,C]))continue;let ft=ce(it,Le);if(L>0){let At=a(it,f,!0);if(At>P||At===P&&ft>=N)continue;P=At,N=ft,B=it;continue}a(it,f)>E||ft<N&&(N=ft,B=it)}}}if(B){f.points=B;let F=x.get(I);F&&x.set(I,F.filter(G=>G.edgeId!==b));let U=x.get(C);U&&x.set(C,U.filter(G=>G.edgeId!==b)),m(I,l(B[0],w),b),m(C,l(B[B.length-1],S),b)}}}c(dr,"simplifyDetouredEdges");var oe=.001,as=10,cn=7;function ao(t,e){let n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;let i=r.x-s.x,d=r.y-s.y;if(!(Math.abs(i)+Math.abs(d)<oe)){if(Math.abs(d)<=oe){let a=s.x+Math.sign(i)*as;return{left:Math.min(s.x,a),right:Math.max(s.x,a),top:s.y-cn,bottom:s.y+cn}}if(Math.abs(i)<=oe){let a=s.y+Math.sign(d)*as;return{left:s.x-cn,right:s.x+cn,top:Math.min(s.y,a),bottom:Math.max(s.y,a)}}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)}}}c(ao,"markerClearanceRectFor");function fr(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)}}c(fr,"normalizeRect");function lo(t,e){let n=vt(e),o=ao(n,!0),s=ao(n,!1);return[o,s].some(r=>r&&hn(t,fr(r)))}c(lo,"labelOverlapsOwnMarker");function dn(t,e){let n=[];for(let f of t){if(f.isLayoutOnly)continue;let h=f.points;if(!(!h||h.length<2))for(let M=0;M<h.length-1;M++)n.push({edgeId:f.id,p1:h[M],p2:h[M+1]})}let o=[],s=[],r=he([...e.values()]);for(let f of e.values()){let h=f.isGroup;if(r.isLane(f.id)){let I=se(f);I&&s.push({id:f.id,rect:I});continue}if(h||f.isEdgeLabel)continue;let M=se(f);M&&o.push({nodeId:f.id,rect:M})}let i=3,d=1,u=12,a=c((f,h)=>{let M=Un(h,i);for(let{nodeId:I,rect:C}of o)if(I!==f&&hn(M,C))return!0;return!1},"labelOverlapsForeignNode"),y=c((f,h)=>{let M=Un(h,i);for(let I of n)if(I.edgeId!==f&&Cn(I.p1,I.p2,M))return!0;return!1},"labelOverlapsForeignEdge"),l=c((f,h,M)=>a(f,M)||y(h,M),"labelOverlapsAnything"),x=[],m=c(f=>{for(let{id:h,rect:M}of s)if(Fs(M,f))return h},"findContainingLane"),p=c((f,h)=>x.some(M=>M.labelId!==f&&hn(h,M.rect)),"overlapsPlacedLabel");for(let f of t){if(f.isLayoutOnly)continue;let h=f.labelNodeId;if(!h)continue;let M=e.get(h);if(!M)continue;let I=f.points;if(!I||I.length<2)continue;let C=M.width??0,w=M.height??0;if(C<=0||w<=0)continue;let S=[];for(let Q=0;Q<I.length-1;Q++){let lt=I[Q],_=I[Q+1],$=Math.abs(lt.x-_.x),tt=Math.abs(lt.y-_.y);$<oe&&tt<oe||$>=oe&&tt>=oe||S.push({idx:Q,length:$+tt,orientation:$>=oe?"horizontal":"vertical",midX:(lt.x+_.x)/2,midY:(lt.y+_.y)/2})}if(S.length===0)continue;let b=S.length>=3?S.filter(Q=>Q.idx>0&&Q.idx<S.length-1):S,L=b.length>0?b:S,E=C>=w?"horizontal":"vertical",B=c(Q=>[...Q].sort((lt,_)=>{let $=lt.orientation===E,tt=_.orientation===E;if($!==tt)return $?-1:1;let q=lt.length>=(lt.orientation==="horizontal"?C:w)+2,st=_.length>=(_.orientation==="horizontal"?C:w)+2;return q!==st?q?-1:1:_.length-lt.length}),"rankSegments"),P=S[0],N=S[S.length-1],F=[.5,.25,.75,.05,.95,.15,.85,.1,.9],U=c((Q,lt)=>{let _=I[Q.idx],$=I[Q.idx+1];return{midX:_.x+($.x-_.x)*lt,midY:_.y+($.y-_.y)*lt}},"anchorAtT"),G=c((Q,lt,_)=>Math.min(_,Math.max(lt,Q)),"clamp"),Z=c((Q,lt)=>Q.midX>=lt.left-oe&&Q.midX<=lt.right+oe&&Q.midY>=lt.top-oe&&Q.midY<=lt.bottom+oe,"pointInsideRectInclusive"),it=c(Q=>{let lt=Ye(Q.midX,Q.midY,C,w),_=m(lt);if(_)return{laneId:_,anchor:Q,rect:lt};let $=s.find(({rect:xt})=>Z(Q,xt));if(!$)return;let tt=$.rect.left+C/2+d,q=$.rect.right-C/2-d,st=$.rect.top+w/2+d,ut=$.rect.bottom-w/2-d;if(tt>q||st>ut)return;let gt={midX:G(Q.midX,tt,q),midY:G(Q.midY,st,ut)},pt=Ye(gt.midX,gt.midY,C,w);return Z(Q,pt)?{laneId:$.id,anchor:gt,rect:pt}:void 0},"placementForAnchor"),ft=c((Q,lt,_)=>Q.orientation==="horizontal"?Math.abs(lt.midX-_.x):Math.abs(lt.midY-_.y),"distanceAlongSegment"),At=c((Q,lt)=>{let $=(Q.orientation==="horizontal"?C/2:w/2)+u;if(Q===P){let tt=I[Q.idx];if(ft(Q,lt,tt)+oe<$)return!1}if(Q===N){let tt=I[Q.idx+1];if(ft(Q,lt,tt)+oe<$)return!1}return!0},"labelClearsTerminalEndpoints"),te=c(Q=>{let lt=B(Q);for(let _ of lt)for(let $ of F){let tt=U(_,$);if(!At(_,tt))continue;let q=it(tt);if(q&&!lo(q.rect,I)&&!p(h,q.rect)&&!l(h,f.id,q.rect))return{laneId:q.laneId,anchor:q.anchor}}},"tryPool"),zt=c((Q,lt,_=!1)=>{let $=B(Q);for(let tt of $){let q={midX:tt.midX,midY:tt.midY};if(lt&&!At(tt,q))continue;let st=it(q);if(st&&!lo(st.rect,I)&&!p(h,st.rect)&&!a(h,st.rect)&&(_||!y(f.id,st.rect)))return{laneId:st.laneId,anchor:st.anchor}}},"findLaneContainingFallback"),Ut=te(L)??(L.length<S.length?te(S):void 0)??zt(S,!0)??zt(S,!1)??zt(S,!1,!0);if(Ut){M.x=Ut.anchor.midX,M.y=Ut.anchor.midY,M.parentId=Ut.laneId;let Q=Ye(Ut.anchor.midX,Ut.anchor.midY,C,w),lt=x.findIndex(_=>_.labelId===h);lt>=0?x[lt]={labelId:h,rect:Q}:x.push({labelId:h,rect:Q})}}}c(dn,"anchorLabelsToPolyline");var Yn=1e-6,Ei=8,ls=Ei/2,Ai=3;function fo(t,e,n,{cx:o,cy:s},r,i){let d={x:o,y:s},u=i==="x"?"y":"x",a=Math.sign(r[u]-d[u]);for(let y of t){if(y===e||y.isLayoutOnly||!y.points?.length)continue;if([...y.end===n?[y.points.at(-1)]:[],...y.start===n?[y.points[0]]:[]].some(x=>Math.sign(x[u]-d[u])===a&&Math.abs(x[i]-r[i])<or.MIN_ARROWHEAD_SPACING))return!0}return!1}c(fo,"crowdsFaceNeighbour");function uo(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}c(uo,"pairKey");function ur(t,e){let{nodeInfoById:n,realNodeRects:o}=vn(e),s=new Map;for(let i of e){let d=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(d,{w:i.width??0,h:i.height??0});continue}}let r=c((i,d,u,a)=>{let y=uo(d,u),l=0,x=c(m=>{if(!m)return;let p=s.get(m);if(!p)return;let f=a==="x"?p.w/2:p.h/2;f>l&&(l=f)},"consider");x(i.labelNodeId);for(let m of t){if(m===i||m.isLayoutOnly)continue;let p=m.start,f=m.end;!p||!f||uo(p,f)===y&&x(m.labelNodeId)}return l>0?l+Ai:0},"labelClearanceFor");for(let i of t){if(i.isLayoutOnly)continue;let d=i.points;if(!wo(d,Yn))continue;let u=To(i,n,Yn);if(!u)continue;let{srcId:a,dstId:y,srcInfo:l,dstInfo:x,collinearX:m,collinearY:p}=u;if(m===p)continue;let f,h;if(m){let b=x.cy>l.cy;f={x:l.cx,y:b?l.rect.bottom:l.rect.top},h={x:x.cx,y:b?x.rect.top:x.rect.bottom}}else{let b=x.cx>l.cx;f={x:b?l.rect.right:l.rect.left,y:l.cy},h={x:b?x.rect.left:x.rect.right,y:x.cy}}if(Xt(f,h,o,[a,y],1))continue;let M=m?"x":"y",I=r(i,a,y,M),C=I>ls?I:ls,w=[0,C,-C],S;for(let b of w){let L={...f},E={...h};if(m){if(L.x+=b,E.x+=b,L.x<=l.rect.left||L.x>=l.rect.right||E.x<=x.rect.left||E.x>=x.rect.right)continue}else if(L.y+=b,E.y+=b,L.y<=l.rect.top||L.y>=l.rect.bottom||E.y<=x.rect.top||E.y>=x.rect.bottom)continue;if(Xt(L,E,o,[a,y],1)||gn(L,E,t,i,{epsilon:Yn}))continue;let B=[L,E];if(fo(t,i,a,l,L,M)||fo(t,i,y,x,E,M)){S??=B;continue}i.points=B,S=void 0;break}S&&(i.points=S)}}c(ur,"straightenCollinearSiblingDetours");function ho(t,e){let{realNodeRects:a,labelNodeRects:y}=Ee(e.values()),l=c((b,L)=>we(L,.001).map(E=>({...E,edge:b,interior:E.index>=1&&E.index<=L.length-3})),"segmentsFor"),x=c(()=>{let b=[];for(let L of t){if(L.isLayoutOnly)continue;let E=L.points;!E||E.length<2||b.push(...l(L,vt(E)))}return b},"allSegments"),m=c((b,L)=>b.horizontal&&L.horizontal?Qt(b.a.x,b.b.x,L.a.x,L.b.x)>=8&&Math.abs(b.a.y-L.a.y)<7:b.vertical&&L.vertical?Qt(b.a.y,b.b.y,L.a.y,L.b.y)>=8&&Math.abs(b.a.x-L.a.x)<7:!1,"hasCrowdedParallelTrack"),p=c((b,L)=>{let E=b.start,B=b.end,P=l(b,L);if(P.length!==L.length-1)return!1;let N=[E,B].filter(U=>!!U),F=b.labelNodeId?[b.labelNodeId]:[];for(let U of P)if(Xt(U.a,U.b,a,N,-2)||Xt(U.a,U.b,y,F,-2))return!1;for(let U of t){if(U===b||U.isLayoutOnly)continue;let G=U.points;if(!(!G||G.length<2)){for(let Z of P)for(let it of l(U,vt(G)))if(m(Z,it)||be(Z.a,Z.b,it.a,it.b,.001))return!1}}return!0},"candidateIsSafe"),f=c((b,L)=>{let E=vt(b.edge.points??[]);if(E.length<4||b.index>=E.length-1)return;let B=E.map(P=>({...P}));if(b.horizontal)B[b.index].y+=L,B[b.index+1].y+=L;else if(b.vertical)B[b.index].x+=L,B[b.index+1].x+=L;else return;return l(b.edge,B).length===B.length-1?B:void 0},"shiftedCandidate"),h=c((b,L)=>({x:b.x??(L.left+L.right)/2,y:b.y??(L.top+L.bottom)/2}),"nodeCenter"),M=c(b=>{let L=b.edge,E=vt(L.points??[]);if(E.length!==4||b.index!==1)return;let B=L.start?e.get(L.start):void 0,P=L.end?e.get(L.end):void 0,N=B?se(B):void 0,F=P?se(P):void 0,U=E.slice(b.index+2);if(!(!B||!P||!N||!F||U.length===0))return{sourceCenter:h(B,N),targetCenter:h(P,F),sourceRect:N,tail:U}},"sourceDetourContextFor"),I=c((b,L,E,B,P,N)=>{let F=B.y>=E.y,U=F?P.bottom:P.top,G=U+(F?20:-20);if(F&&b.b.y<=G+.001||!F&&b.b.y>=G-.001)return;let Z=b.a.x+L;return vt([{x:E.x,y:U},{x:E.x,y:G},{x:Z,y:G},{x:Z,y:b.b.y},...N],.001)},"verticalSourceDetour"),C=c((b,L,E,B,P,N)=>{let F=B.x>=E.x,U=F?P.right:P.left,G=U+(F?20:-20);if(F&&b.b.x<=G+.001||!F&&b.b.x>=G-.001)return;let Z=b.a.y+L;return vt([{x:U,y:E.y},{x:G,y:E.y},{x:G,y:Z},{x:b.b.x,y:Z},...N],.001)},"horizontalSourceDetour"),w=c((b,L)=>{let E=M(b);if(E){if(b.vertical)return I(b,L,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail);if(b.horizontal)return C(b,L,E.sourceCenter,E.targetCenter,E.sourceRect,E.tail)}},"sourceDetourCandidate"),S=[-7,7,-14,14,-21,21];for(let b=0;b<12;b++){let L=x(),E=!1;for(let B=0;B<L.length&&!E;B++)for(let P=B+1;P<L.length&&!E;P++){let N=L[B],F=L[P];if(N.edge===F.edge||!m(N,F))continue;let U=[N,F].filter(G=>G.interior);for(let G of U){for(let Z of S){let it=f(G,Z);if(it&&p(G.edge,it)){G.edge.points=it,E=!0;break}let ft=w(G,Z);if(ft&&p(G.edge,ft)){G.edge.points=ft,E=!0;break}}if(E)break}}if(!E)return}}c(ho,"nudgeSharedInteriorSubpaths");function hr(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,d=o.y-n.y,u=s*d-r*i;if(Math.abs(u)<1e-10)return!1;let a=n.x-t.x,y=n.y-t.y,l=(a*d-y*i)/u,x=(a*r-y*s)/u,m=.01;return l>m&&l<1-m&&x>m&&x<1-m}c(hr,"segmentsIntersect");function gr(t){let e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;let s=Ps(e),r=1,i=[];for(let u of n){if(u.isLayoutOnly)continue;let a=u.points;if(!a||a.length<2)continue;let y=u.start,l=u.end,x=u.labelNodeId,m=u.id??`${y}->${l}`;for(let p of s)if(!(p.nodeId===y||p.nodeId===l)&&!(x&&p.nodeId===x)){for(let f=0;f<a.length-1;f++)if(Cn(a[f],a[f+1],p,-r)){o.push({type:"edge-node-overlap",edgeId:m,targetId:p.nodeId,detail:`segment ${f} passes through node "${p.nodeId}"`});break}}for(let p=0;p<a.length-1;p++)i.push({edgeId:m,start:y,end:l,p1:a[p],p2:a[p+1]})}let d=new Set;for(let u=0;u<i.length;u++)for(let a=u+1;a<i.length;a++){let y=i[u],l=i[a];if(y.edgeId!==l.edgeId&&!(y.start===l.start||y.start===l.end||y.end===l.start||y.end===l.end)&&hr(y.p1,y.p2,l.p1,l.p2)){let x=y.edgeId<l.edgeId?`${y.edgeId}|${l.edgeId}`:`${l.edgeId}|${y.edgeId}`;d.has(x)||(d.add(x),o.push({type:"edge-edge-crossing",edgeId:y.edgeId,targetId:l.edgeId,detail:`edges "${y.edgeId}" and "${l.edgeId}" cross`}))}}if(o.length>0){let u=o.filter(y=>y.type==="edge-node-overlap").length,a=o.filter(y=>y.type==="edge-edge-crossing").length;De.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${u} edge-node overlap(s), ${a} edge crossing(s)`);for(let y of o)De.warn(`[SWIMLANE_VALIDATE] ${y.type}: ${y.detail}`)}return o}c(gr,"validateSwimlanesLayout");function pr(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(d=>!d.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!tr(t,e)||e==="BT"&&s.length>0&&!Ks(t))return;for(let d of o){if(d.isLayoutOnly)continue;let u=d.points;!u||u.length<2||(d.points=me(pn(u)))}dr(o,n),ur(o,n),er(o,n);let r=new Map;for(let d of n)r.set(String(d.id),d);dn(o,r),Xs(o,r),nr(o,r),ho(o,r),so(o,r),rr(o,r),ro(o,r),ir(o,r);let i=c(()=>{lr(o,r),so(o,r),cr(o,r),ar(o,r),dn(o,r),no(o,r),ro(o,r),dn(o,r),no(o,r)},"finalizeRenderedEdges");i(),ho(o,r),i(),io(o,r,e),co(o,r,e),io(o,r,e),co(o,r,e)}c(pr,"postProcessSwimlaneLayout");function Ae(t){let e=new Map(t.nodeById),n=new Set,o=[];for(let r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;let 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}}c(Ae,"normalizeGraph");function ko(t,e){return t.edges.filter(n=>n.dst===e)}c(ko,"incoming");function mr(t){let e=new Map;for(let n of t.nodes)e.set(n,[]);for(let n of t.edges)e.get(n.src).push(n.dst);return e}c(mr,"buildSuccessorMap");function _o(t){let e=mr(t);for(let n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}c(_o,"buildSortedSuccessorMap");function Ln(t){let e=new Map;for(let n of t.nodes)e.set(n,0);for(let n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}c(Ln,"buildInDegreeMap");function Do(t,e){let n=[...e.entries()].filter(([,d])=>d===0).map(([d])=>d).sort((d,u)=>d.localeCompare(u)),o=new Set(t.edges.flatMap(d=>[d.src,d.dst])),s=c(d=>!o.has(d)&&!t.nodeById.get(d)?.isGroup,"isUnconnected"),r=[...e.keys()].filter(d=>e.get(d)===0&&s(d)),i=0;return n.map(d=>s(d)?r[i++]:d)}c(Do,"sortedZeroInDegreeNodes");function wn(t,e=()=>!0){let n=new Map,o=new Map;for(let s of t.nodes)n.set(s,[]),o.set(s,[]);for(let 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}}c(wn,"buildPredecessorSuccessorMaps");function Ho(t,e,n,o){let s=0;for(let i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));let r=Array.from({length:s+1},()=>[]);for(let i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}c(Ho,"buildLayersFromRanks");function je(t){let e=Ln(t),n=Do(t,e),o=[],s=_o(t);for(;n.length;){let r=n.shift();o.push(r);for(let i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let d=0;for(;d<n.length&&n[d]<i;)d++;n.splice(d,0,i)}}return o.length===t.nodes.length?o:null}c(je,"topoSortIfAcyclic");function Ge(t){let e=new Map,n=0;for(let o of t)e.set(o,n),n++;return e}c(Ge,"buildLayerIndex");function Xo(t){let e=new Array(t.length),n=c((o,s)=>{if(s-o<=1)return 0;let r=o+s>>1,i=n(o,r)+n(r,s),d=o,u=r,a=o;for(;d<r||u<s;)u>=s||d<r&&t[d]<=t[u]?e[a++]=t[d++]:(e[a++]=t[u++],i+=r-d);for(let y=o;y<s;y++)t[y]=e[y];return i},"count");return n(0,t.length)}c(Xo,"countInversions");function yr(t){let e=Ae(t),n=new Map;for(let l of e.nodes)n.set(l,[]);for(let l of e.edges)n.get(l.src).push(l);for(let l of n.values())l.sort((x,m)=>x.dst===m.dst?x.id.localeCompare(m.id):x.dst.localeCompare(m.dst));let o=Object.create(null);for(let l of e.nodes)o[l]=0;let s=[],r=c(l=>{o[l]=1;for(let x of n.get(l)??[]){let m=x.dst;o[m]===0?r(m):o[m]===1&&s.push(x)}o[l]=2},"dfs"),i=Ln(e),d=[...e.nodes.filter(l=>(i.get(l)??0)===0),...e.nodes.filter(l=>(i.get(l)??0)!==0)];for(let l of d)o[l]===0&&r(l);let u=new Set(s.map(l=>`${l.id}:${l.src}->${l.dst}`)),a=e.edges.map(l=>u.has(`${l.id}:${l.src}->${l.dst}`)?{id:l.id,src:l.dst,dst:l.src,weight:l.weight,ref:l.ref}:l);return{acyclic:{nodes:[...e.nodes],edges:a,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}c(yr,"removeCycles_DFS");function xr(t){let e=he(t.layout.nodes??[]),n=new Map;for(let o of t.nodes)n.set(o,e.laneIdOf(o));return n}c(xr,"buildTopLaneMap");function Me(t){let e=xr(t);return n=>e.get(n)??null}c(Me,"createTopLaneResolver");function En(t){let e=t.layout.nodes??[],n=he(e),o=e.filter(i=>n.isLane(i.id)),s=o.filter(i=>ln(i)!==void 0);if(s.length>0&&s.length===o.length)return[...s].sort((i,d)=>(ln(i)??0)-(ln(d)??0)).map(i=>i.id);if(!n.hasPools)return[...new Set(o.map(i=>i.id))].reverse();let r=[];for(let i of e)i.parentId||(n.isPool(i.id)?r.push(...n.lanesByPool.get(i.id)??[]):n.isLane(i.id)&&r.push(i.id));return[...new Set(r)].reverse()}c(En,"buildTopLaneOrder");function Yo(t,e){let n=En(t);if(!e||e.length===0)return n;let o=new Set(n),s=new Set,r=[];for(let i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(let i of n)s.has(i)||r.push(i);return r}c(Yo,"resolveTopLaneOrder");function br(t,e){let n=Ae(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=wn(n);for(let S of r.values())S.sort((b,L)=>b.localeCompare(L));let i=je(n)??[...n.nodes].sort((S,b)=>S.localeCompare(b)),d=new Map;for(let[S,b]of i.entries())d.set(b,S);let u=new Map,a=new Map;for(let S of n.nodes)a.set(S,[]);for(let S of i){let b=(r.get(S)??[]).filter(L=>u.has(L));if(b.length>0){let L=Mr(S,b,{laneOf:o,rankHint:s,topoIndex:d});u.set(S,L),a.get(L).push(S)}else u.has(S)||u.set(S,null)}for(let S of n.nodes)u.has(S)||u.set(S,null);let y=new Set;for(let S of n.nodes)(u.get(S)??null)===null&&y.add(S);let l=[...y].sort((S,b)=>{let L=d.get(S)??0,E=d.get(b)??0;return L===E?S.localeCompare(b):L-E}),x=Ir(n),m=new Map;for(let[S,b]of x.entries())m.set(S,[...b].sort((L,E)=>L.localeCompare(E)));let p=Sr(m),f=Cr(m),h=new Map;for(let S of n.nodes)h.set(S,[]);for(let S of f)for(let b of S.nodes){let L=h.get(b);L?L.push(S.id):h.set(b,[S.id])}let M=[],I=[],C=new Set,w=c(S=>{if(!C.has(S)){C.add(S),M.push(S);for(let b of a.get(S)??[])w(b);I.push(S)}},"walk");for(let S of l)w(S);for(let S of i)w(S);return{parent:u,children:a,roots:l,componentOf:p,blocks:f,nodeBlocks:h,adjacency:m,preorder:M,postorder:I,topologicalOrder:i}}c(br,"buildDrivingTree");function Mr(t,e,n){let o=n.laneOf(t);return[...e].sort((r,i)=>{let d=n.laneOf(r),u=n.laneOf(i),a=d!=null&&d===o,y=u!=null&&u===o;if(a!==y)return a?-1:1;let l=n.rankHint?.[r],x=n.rankHint?.[i];if(l!=null&&x!=null&&l!==x)return x-l;let m=n.topoIndex.get(r)??0,p=n.topoIndex.get(i)??0;return m!==p?m-p:r.localeCompare(i)})[0]}c(Mr,"chooseParent");function Ir(t){let e=new Map;for(let n of t.nodes)e.set(n,new Set);for(let n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}c(Ir,"buildAdjacency");function Sr(t){let e=new Map,n=0;for(let o of t.keys()){if(e.has(o))continue;let s=[o];for(;s.length>0;){let r=s.pop();if(!e.has(r)){e.set(r,n);for(let i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}c(Sr,"assignComponents");function Cr(t){let e=new Map,n=new Map,o=[],s=[],r=0,i=c((d,u)=>{e.set(d,++r),n.set(d,r);for(let a of t.get(d)??[])a!==u&&(e.has(a)?(e.get(a)??0)<(e.get(d)??0)&&(o.push([d,a]),n.set(d,Math.min(n.get(d)??r,e.get(a)??r))):(o.push([d,a]),i(a,d),n.set(d,Math.min(n.get(d)??r,n.get(a)??r)),(n.get(a)??0)>=(e.get(d)??0)&&s.push(vr(d,a,o,s.length))))},"visit");for(let d of t.keys())e.has(d)||i(d,null);return s}c(Cr,"computeBlocks");function vr(t,e,n,o){let s=[],r=new Set;for(;n.length>0;){let 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]}}c(vr,"popBlock");function Lr(t,e,n){let o=[...t.nodes],s=new Map;for(let[I,C]of o.entries())s.set(C,I);let r=o.length,i=new Array(r).fill(-1),d=new Array(r).fill(0),u=[],a=new Set;for(let I of o){let C=n.parent.get(I)??null,w=s.get(I);w!=null&&C==null&&(i[w]=-1,d[w]=0,a.has(I)||(a.add(I),u.push(I)))}for(;u.length>0;){let I=u.shift(),C=s.get(I);if(C==null)continue;let w=n.children.get(I)??[];for(let S of w){if(a.has(S))continue;let b=s.get(S);b!=null&&(i[b]=C,d[b]=d[C]+1,a.add(S),u.push(S))}}for(let I of o){if(a.has(I))continue;let C=s.get(I);C!=null&&(i[C]=-1,d[C]=0,a.add(I))}let y=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),l=Array.from({length:y},()=>new Array(r).fill(-1));for(let I=0;I<r;I++)l[0][I]=i[I];for(let I=1;I<y;I++)for(let C=0;C<r;C++){let w=l[I-1][C];l[I][C]=w===-1?-1:l[I-1][w]}let x=c((I,C)=>{if(I===-1||C===-1)return-1;d[I]<d[C]&&([I,C]=[C,I]);let w=d[I]-d[C];for(let S=0;S<y;S++)if(w>>S&1&&(I=l[S][I],I===-1))return-1;if(I===C)return I;for(let S=y-1;S>=0;S--){let b=l[S][I],L=l[S][C];b===-1||L===-1||b!==L&&(I=b,C=L)}return l[0][I]},"lcaIndex"),m=Array.from({length:r},()=>new Map);for(let I of t.edges){let C=I.src,w=I.dst,S=e[C],b=e[w];if(S==null||b==null||(S>b&&([C,w]=[w,C],[S,b]=[b,S]),S==null||b==null||S===b))continue;let L=s.get(C),E=s.get(w);if(L==null||E==null)continue;let B=x(L,E);if(B===-1)continue;let P=m[B];for(let N=S;N<b;N++)P.set(N,(P.get(N)??0)+1)}let p=new Map,f=c((I,C)=>{if(C.size!==0)for(let[w,S]of C)I.set(w,(I.get(w)??0)+S)},"mergeInto"),h=new Set,M=c(I=>{let C=s.get(I);h.add(I);let w=C==null?void 0:m[C],S=w?new Map(w):new Map,b=n.children.get(I)??[];for(let L of b){let E=M(L),B=e[I];if(B!=null){let P=p.get(I);P||(P=new Map,p.set(I,P));let N=E.get(B)??0,F=e[L];F!=null&&F>B&&(N+=1),P.set(L,N)}f(S,E)}return S},"dfs");for(let I of n.roots)h.has(I)||M(I);for(let I of o)h.has(I)||M(I);return p}c(Lr,"computeSubtreeCrossCounts");function wr(t,e,n){let o=new Map,s=c(r=>{let i=n[r]??0,d=[...e.get(r)??[]];d.sort(Go(n));for(let u of d){s(u);let a=o.get(u);a!=null&&(i=Math.min(i,a))}o.set(r,i)},"annotate");for(let r of t)s(r);return o}c(wr,"annotateMinimumLayers");function Go(t){return(e,n)=>{let o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}c(Go,"compareByRankThenId");function Er(t,e,n,o){let s=0;for(let u of e){let a=n[u]??0;a>s&&(s=a)}let r=Array.from({length:s+1},()=>[]),i=new Set,d=c(u=>{if(i.has(u))return;i.add(u);let a=n[u]??0;r[a]||(r[a]=[]),r[a].push(u);for(let y of o(u))d(y)},"emit");for(let u of t)d(u);for(let u of e)if(!i.has(u)){let a=n[u]??0;r[a]||(r[a]=[]),r[a].push(u),i.add(u)}return r}c(Er,"emitNodesInTreeOrder");function Ar(t){let e=[];for(let n of t){let o=new Set,s=[];for(let r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}c(Ar,"deduplicateLayers");function Rr(t,e,n,o){return s=>{let r=t.get(s)??[];if(r.length===0)return[];let i=e[s]??0,d=[],u=[],a=n.get(s);for(let y of r){let l=o.get(y)??i;l>i?d.push({child:y,min:l}):u.push(y)}return d.sort((y,l)=>y.min===l.min?y.child.localeCompare(l.child):y.min-l.min),u.sort((y,l)=>{let x=a?.get(y)??0,m=a?.get(l)??0;if(x!==m)return x-m;let p=o.get(y)??i,f=o.get(l)??i;return p!==f?p-f:y.localeCompare(l)}),[...d.map(y=>y.child),...u]}}c(Rr,"createChildOrderer");function In(t,e,n){let o=br(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(let l of t.nodes)s.has(l)||s.set(l,[]);let i=Lr(t,e,o),d=[...r].sort(Go(e)),u=wr(d,s,e),a=Rr(s,e,i,u),y=Er(d,t.nodes,e,a);return y=Ar(y),y}c(In,"buildMultitreeLayerOrder");function Tr(t,e,n){let o=new Set(t),s=new Set(e),r=Ge(e),i=[];for(let d of n)o.has(d.src)&&s.has(d.dst)&&i.push(r.get(d.dst));return Xo(i)}c(Tr,"countCrossingsBetweenAdjacent");function go(t,e,n){let o=[];for(let r of e){let i=n[r.src],d=n[r.dst];if(i==null||d==null||i===d)continue;let u=r.src,a=r.dst,y=i,l=d;i>d&&(u=r.dst,a=r.src,y=d,l=i);for(let x=y;x<l;x++)o.push({id:`${r.id}@${x}`,src:u,dst:a,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Tr(t[r],t[r+1],o);return s}c(go,"totalCrossings");function Or(t,e){let n={...e},{preds:o}=wn(t),s=Me(t),r=In(t,n,s),i=go(r,t.edges,n),d=Mn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let u=0;u<d;u++){let a=!1,y=[...t.nodes].sort((l,x)=>(n[x]??0)-(n[l]??0));for(let l of y){let x=n[l]??0;if(x===0)continue;let m=0;for(let M of o.get(l)??[])m=Math.max(m,(n[M]??0)+1);if(m>=x)continue;let p=x;n[l]=m;let f=In(t,n,s),h=go(f,t.edges,n);h<i?(i=h,a=!0):n[l]=p}if(!a)break}return n}c(Or,"optimizeRanksByCrossings");function Nr(t,e){let n=Me(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(let s of o){let r=n(s);if(!r)continue;let i=t.edges.filter(f=>f.src===s);if(i.length===0)continue;let d=!1,u=0;for(let f of i){let h=n(f.dst);h==null||h===r?d=!0:u++}if(u===0||d)continue;let a=0,y=!1;for(let f of t.edges){if(f.dst!==s)continue;let h=n(f.src);h&&(h===r?y=!0:a++)}if(a>0||!y)continue;let l=e[s]??0,x=l+u,m=0;for(let f of t.edges)f.dst===s&&(m=Math.max(m,(e[f.src]??0)+1));let p=Math.max(l,m,x);p!==l&&(e[s]=p)}}c(Nr,"adjustCrossLaneSources");function Br(t,e){let n=Ae(t),o=je(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=Me(n),i=Object.create(null);for(let u of o){let a=ko(n,u),y=e?.ignoreCrossLaneEdges?a.filter(l=>{let x=r(l.src),m=r(u);return!x||!m?!0:x===m}):a;if(y.length===0)i[u]=0;else if(s&&y.length===1){let l=y[0].src,x=r(l),m=r(u);x!==m?i[u]=i[l]??0:i[u]=(i[l]??0)+1}else{let l=-1/0;for(let x of y)l=Math.max(l,(i[x.src]??0)+1);i[u]=l===-1/0?0:l}}return(e?.optimizeRanksByCrossings??!1)&&(i=Or(n,i)),e?.ignoreCrossLaneEdges&&Nr(n,i),{layers:In(n,i,r),rankOf:i,dummy:new Set}}c(Br,"assignLayers_LongestPath");function Fr(t,e){let n=Ae(t),s={...Br(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=Me(n),{preds:i,succs:d}=wn(n,p=>{if(e?.ignoreCrossLaneEdges){let f=r(p.src),h=r(p.dst);if(f&&h&&f!==h)return!1}return!0}),u=je(n)??[...n.nodes],a=[...u].reverse(),y=c((p,f)=>{let h=0;for(let C of i.get(p)??[])h=Math.max(h,(s[C]??0)+1);let M=Number.POSITIVE_INFINITY,I=d.get(p)??[];return I.length>0&&(M=Math.min(...I.map(C=>(s[C]??0)-1))),Number.isFinite(M)||(M=Math.max(h,f)),Math.min(Math.max(f,h),M)},"clampFeasible"),l=Mn.GRAVITY_ITERATIONS,x=c(p=>{let f=!1;for(let h of p){let M=i.get(h)??[],I=d.get(h)??[];if(M.length===0&&I.length===0)continue;let C=M.length>0?M.reduce((L,E)=>L+(s[E]??0)+1,0)/M.length:s[h]??0,w=I.length>0?I.reduce((L,E)=>L+(s[E]??0)-1,0)/I.length:s[h]??0,S=Math.round((C+w)/2),b=y(h,S);b!==s[h]&&(s[h]=b,f=!0)}return f},"relaxOrder");for(let p=0;p<l;p++){let f=x(u),h=x(a);if(!f&&!h)break}for(let p of u){let f=0;for(let h of i.get(p)??[])f=Math.max(f,(s[h]??0)+1);(s[p]??0)<f&&(s[p]=f)}for(let p of a){let f=d.get(p)??[];if(f.length>0){let h=Math.min(...f.map(M=>(s[M]??0)-1));(s[p]??0)>h&&(s[p]=h)}}return{layers:Ho(n,u,s),rankOf:s,dummy:new Set}}c(Fr,"assignLayers_Gravity");function Pr(t){let e=Ln(t),n=_o(t),o=Do(t,e),s=[];for(;o.length>0;){let r=[];for(let i of o){s.push(i);for(let d of n.get(i)??[])e.set(d,(e.get(d)??0)-1),(e.get(d)??0)===0&&r.push(d)}o=r.sort((i,d)=>i.localeCompare(d))}return s.length===t.nodes.length?s:null}c(Pr,"topoSortByGenerationIfAcyclic");function kr(t,e){let n=Ae(t),o=e?.direction==="LR"?Pr(n)??[...n.nodes].sort():je(n)??[...n.nodes].sort(),s=Me(n),r=c(y=>s(y)??y,"laneOf"),i=Object.create(null),d=new Map,u=c((y,l)=>e?.ignoreCrossLaneEdges??!0?r(y)===r(l)?1:0:1,"edgeWeight");for(let y of o){if(n.nodeById.get(y)?.isGroup)continue;let x=ko(n,y),m=0;if(x.length>0)for(let M of x){let I=M.src,C=i[I]??0;m=Math.max(m,C+u(I,y))}let p=r(y),f=d.get(p)??0,h=Math.max(m,f);i[y]=h,d.set(p,h+1)}return{layers:Ho(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}c(kr,"assignLayers_LaneAwareCompact");function _r(t,e){let n=Ae(e),{rankOf:o}=t,s=t.layers.map(m=>[...m]),r=new Set(t.dummy?[...t.dummy]:[]),i=0,d=new Map(n.nodeById),u=c(m=>{let p=`placeholder-${i++}`,f={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(d.set(p,f),r.add(p);s.length<=m;)s.push([]);return s[m].push(p),o[p]=m,p},"addDummyAt"),a=[...n.edges].sort((m,p)=>m.id===p.id?m.src===p.src?m.dst.localeCompare(p.dst):m.src.localeCompare(p.src):m.id.localeCompare(p.id)),y=[];for(let m of a){let p=o[m.src]??0,f=o[m.dst]??0;if(f-p<=1){y.push(m);continue}let h=m.src;for(let I=p+1,C=0;I<f;I++,C++){let w=u(I);y.push({id:`${m.id}#${C}`,src:h,dst:w,weight:m.weight,ref:m.ref}),h=w}let M=f-p-2;y.push({id:`${m.id}#${Math.max(M+1,0)}`,src:h,dst:m.dst,weight:m.weight,ref:m.ref})}let x={nodes:[...n.nodes,...[...r].filter(m=>!n.nodes.includes(m))],edges:y,layout:n.layout,nodeById:d};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:x}}c(_r,"makeProperLayering");function po(t){let e=t.length;if(e===0)return Number.POSITIVE_INFINITY;let n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}c(po,"median");function mo(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}c(mo,"barycenter");function Dr(t,e,n,o){let s=new Map;for(let r of t)s.set(r,[]);for(let 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}c(Dr,"neighborPositionsFor");function Hr(t,e,n){let o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}c(Hr,"currentOrderTieBreak");function yo(t,e,n){let o=new Set(t),s=new Set(e),r=Ge(t),i=Ge(e),d=[];for(let a of n)o.has(a.src)&&s.has(a.dst)&&d.push({u:r.get(a.src),v:i.get(a.dst)});d.sort((a,y)=>a.u===y.u?a.v-y.v:a.u-y.u);let u=d.map(a=>a.v);return Xo(u)}c(yo,"countCrossingsBetweenAdjacent");function fn(t,e,n){return[...t].sort((o,s)=>{let r=po(e.get(o)??[]),i=po(e.get(s)??[]);return r===i?Hr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}c(fn,"sortByHeuristic");function xo(t,e,n,o,s,r){let i=Ge(t),d=Ge(e),u=Dr(e,i,n,o);if(!s||!r||r.length===0)return fn(e,u,d);let a=new Map;for(let x of e){let m=s(x),p=a.get(m)??[];p.push(x),a.set(m,p)}let y=[];for(let x of r){let m=a.get(x);if(!m||m.length===0)continue;let p=fn(m,u,d);y.push(...p)}let l=a.get(null);if(l&&l.length>0){let x=fn(l,u,d);for(let m of x){let p=mo(u.get(m)??[]),f=y.length;if(isFinite(p))for(let[h,M]of y.entries()){let I=mo(u.get(M)??[]);if(p<I){f=h;break}}y.splice(f,0,m)}}return y}c(xo,"reorderLayer");function bo(t,e,n,o,s){let r=[...e],i=new Set(t),d=new Set(e),u=o?new Set(o):null,a=n.filter(f=>i.has(f.src)&&d.has(f.dst)),y=u?n.filter(f=>d.has(f.src)&&u.has(f.dst)):void 0,l=c(f=>{let h=yo(t,f,a);return y&&o&&(h+=yo(f,o,y)),h},"crossingScore"),x=s?new Map:null;if(s&&x)for(let f of e)x.set(f,s(f));let m=!0,p=l(r);for(;m;){m=!1;for(let f=0;f+1<r.length;f++){if(x){let I=x.get(r[f]),C=x.get(r[f+1]);if(I!==C)continue}let h=p;[r[f],r[f+1]]=[r[f+1],r[f]];let M=l(r);M<h?(p=M,m=!0):[r[f],r[f+1]]=[r[f+1],r[f]]}}return r}c(bo,"transposeImprove");function Xr(t,e,n){let o=t.layers.map(d=>[...d]),s=e.edges,r=Me(e),i=Yo(e,n?.laneOrder);for(let d=0;d<3;d++){for(let u=1;u<o.length;u++)o[u]=xo(o[u-1],o[u],s,"down",r,i),o[u]=bo(o[u-1],o[u],s,o[u+1],r);for(let u=o.length-2;u>=0;u--)o[u]=xo(o[u+1],o[u],s,"up",r,i),o[u]=bo(o[u+1],o[u],s,o[u-1],r)}return{layers:o}}c(Xr,"orderLayers");function Yr(t,e,n){let o=n?.layerGap??Hn.DEFAULT_LAYER_GAP,s=n?.nodeGap??Hn.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",d=i==="LR"||i==="RL",u=Object.create(null),a=Object.create(null),y=new Map((e.layout?.nodes??[]).filter(_=>_.isEdgeLabel).map(_=>[_.id,_])),l=c(_=>y.get(_)??e.nodeById.get(_),"getNode"),x=c(_=>l(_)?.width??0,"getWidth"),m=c(_=>l(_)?.height??0,"getHeight"),p=Me(e),f=new Map,h=c(_=>f.has(_)?f.get(_)??null:p(_),"topLaneOf"),M=Yo(e,n?.laneOrder),I=new Set;for(let _ of t.layers)for(let $ of _)I.add(p($));let C=I.has(null),w=M.filter(_=>I.has(_)),S=[...C?[null]:[],...w],b=t.layers,L=new Map;for(let[_,$]of b.entries())for(let tt of $)L.set(tt,_);let E=[],B=[],P=[];for(let _ of e.layout?.edges??[]){let $=_.labelNodeId,tt=_.start,q=_.end;if(!$||!y.has($)||tt==null||q==null)continue;let st=L.get(tt),ut=L.get(q);if(st==null||ut==null){P.push({labelId:$,near:st==null?q:tt});continue}if(f.set($,p(q)),st===ut){let xt=c(Ft=>S.indexOf(p(Ft)),"column");E.push({labelId:$,rank:ut,lane:p(q),side:tt!==q&&xt(tt)<xt(q)?"before":"after"});continue}let gt=Math.min(st,ut),pt=Math.max(st,ut);B.push({labelId:$,start:tt,end:q,gap:gt+Math.floor((pt-gt-1)/2),crossesLanes:p(tt)!==p(q)})}let N=b.map(_=>_.reduce(($,tt)=>Math.max($,m(tt)),0));for(let{labelId:_,rank:$}of E)N[$]=Math.max(N[$],m(_));let F=b.map(()=>0);if(d)for(let _=0;_+1<b.length;_++){let $=b[_].reduce((pt,xt)=>Math.max(pt,x(xt)),0),tt=b[_+1].reduce((pt,xt)=>Math.max(pt,x(xt)),0),q=N[_],st=N[_+1],ut=q/2+st/2,gt=($+tt)/2;F[_]=Math.max(0,gt-ut-o)}let U=d?Po(e.layout?.nodes??[]):1,G=b.map(()=>0);for(let{labelId:_,gap:$}of B){let q=((d?x(_):m(_))+2*Hn.EDGE_LABEL_CLEARANCE)/U;G[$]=Math.max(G[$],q)}for(let[_,$]of G.entries())F[_]+=$;let Z=Object.create(null);for(let _ of w)Z[_]=0;C&&(Z.null=0);for(let _ of b){let $=Object.create(null),tt=[];for(let q of _){let st=h(q);st===null?tt.push(q):($[st]||=[]).push(q)}for(let[q,st]of Object.entries($)){let ut=st.reduce((gt,pt)=>gt+x(pt),0)+s*Math.max(0,st.length-1);Z[q]=Math.max(Z[q]??0,ut)}if(C&&tt.length){let q=tt.reduce((st,ut)=>st+x(ut),0)+s*Math.max(0,tt.length-1);Z.null=Math.max(Z.null??0,q)}}let it=new Map;for(let _ of B){let $=`${_.gap}:${h(_.labelId)}`,tt=it.get($);tt?tt.push(_):it.set($,[_])}for(let _ of it.values()){let $=h(_[0].labelId);if($!==null){let tt=_.reduce((q,st,ut)=>q+x(st.labelId)+(ut>0?s:0),0);Z[$]=Math.max(Z[$]??0,tt)}}let ft=new Map;for(let{labelId:_,rank:$,lane:tt,side:q}of E){let st=`${$}:${tt}:${q}`;ft.set(st,(ft.get(st)??0)+s+x(_))}let At=c((_,$,tt)=>ft.get(`${_}:${$}:${tt}`)??0,"rowLabelSpan");for(let{rank:_,lane:$}of E){let tt=b[_].filter(ut=>h(ut)===$).reduce((ut,gt,pt)=>ut+x(gt)+(pt>0?s:0),0),q=Math.max(At(_,$,"before"),At(_,$,"after")),st=$??"null";Z[st]=Math.max(Z[st]??0,tt+2*q)}let te=new Map;{let _=S.map(q=>(q===null?Z.null:Z[q])??0),tt=-(_.reduce((q,st)=>q+st,0)+r*Math.max(0,S.length-1))/2;for(let q=0;q<S.length;q++){let st=S[q],ut=_[q]??0,gt=tt+ut/2;te.set(st,gt),tt+=ut,q<S.length-1&&(tt+=r)}}let zt=[],Ut=0;for(let[_,$]of b.entries()){let tt=N[_]??0,q=new Map;for(let ut of $){let gt=h(ut),pt=q.get(gt)??[];pt.push(ut),q.set(gt,pt)}for(let ut of S){let gt=q.get(ut)??[];if(gt.length===0)continue;let pt=te.get(ut);if(gt.length===1){let xt=gt[0];u[xt]=pt,a[xt]=Ut+tt/2}else{let xt=gt.map(ye=>x(ye)),Ft=xt.reduce((ye,xe)=>ye+xe,0)+s*(gt.length-1),Re=pt-Ft/2;for(let[ye,xe]of gt.entries()){let Te=xt[ye];u[xe]=Re+Te/2,a[xe]=Ut+tt/2,Re+=Te+s}}}let st=o+(F[_]??0);zt[_]=Ut+tt+st/2,Ut+=tt+st}let Q=new Map;for(let{labelId:_,rank:$,lane:tt,side:q}of E){let st=`${$}:${tt}:${q}`;if(!Q.has(st)){let xt=b[$].filter(Ft=>h(Ft)===tt).map(Ft=>q==="before"?u[Ft]-x(Ft)/2:u[Ft]+x(Ft)/2);Q.set(st,q==="before"?Math.min(...xt):Math.max(...xt))}let ut=x(_),gt=Q.get(st)+(q==="before"?-1:1)*(s+ut/2);u[_]=gt,a[_]=a[b[$].find(pt=>h(pt)===tt)],Q.set(st,gt+(q==="before"?-1:1)*(ut/2))}for(let _ of it.values()){let $=_.map(({start:pt,end:xt,crossesLanes:Ft})=>Ft?u[xt]:((u[pt]??0)+(u[xt]??0))/2),tt=_.map((pt,xt)=>xt).sort((pt,xt)=>$[pt]-$[xt]||pt-xt),q=[],st=-1/0;for(let pt of tt){let xt=x(_[pt].labelId);q[pt]=Math.max($[pt],st+s+xt/2),st=q[pt]+xt/2}let ut=c(pt=>pt.reduce((xt,Ft)=>xt+Ft,0)/pt.length,"mean"),gt=ut($)-ut(q);for(let[pt,{labelId:xt,gap:Ft}]of _.entries())u[xt]=q[pt]+gt,a[xt]=zt[Ft]}for(let{labelId:_,near:$}of P)u[_]=u[$]??0,a[_]=a[$]??0;let lt=new Map;for(let _ of e.edges){let $=_.ref.id;lt.has($)||lt.set($,[]),lt.get($).push(_)}for(let[,_]of lt){if(_.length===0)continue;let $=_[0].ref,tt=$.start,q=$.end;if(tt==null||q==null)continue;let st=Math.round(((u[tt]??0)+(u[q]??0))/2),ut=new Set;for(let gt of _)ut.add(gt.src),ut.add(gt.dst);for(let gt of ut){if(gt===tt||gt===q)continue;e.nodeById.get(gt)?.isDummy&&(u[gt]=st)}}return{x:u,y:a}}c(Yr,"assignCoordinates");var Gr=8;function $r(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}c($r,"hashString");function zr(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}}c(zr,"mulberry32");function Ur(t,e){let n=[...t],o=zr(e);for(let s=n.length-1;s>0;s--){let r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}c(Ur,"deterministicShuffle");function Vr(t,e){let n=0;for(let[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}c(Vr,"sourceDistance");function Mo(t,e){let n=new Map;for(let[s,r]of t.entries())n.set(r,s);let o=0;for(let{a:s,b:r,weight:i}of e){let d=n.get(s),u=n.get(r);d==null||u==null||(o+=i*Math.abs(d-u))}return o}c(Mo,"laneArrangementCost");function jr(t){let e=En(t);if(e.length<2)return[];let n=new Map(e.map((r,i)=>[r,i])),o=Me(t),s=new Map;for(let r of t.layout.edges??[]){if(r.isLayoutOnly)continue;let i=typeof r.start=="string"?r.start:void 0,d=typeof r.end=="string"?r.end:void 0;if(!i||!d||!t.nodeById.has(i)||!t.nodeById.has(d))continue;let u=o(i),a=o(d);if(!u||!a||u===a)continue;let y=n.get(u),l=n.get(a);if(y==null||l==null)continue;let[x,m]=y<=l?[u,a]:[a,u],p=`${x}\0${m}`,f=s.get(p);f?f.weight++:s.set(p,{a:x,b:m,weight:1})}return[...s.values()]}c(jr,"buildWeightedLaneEdges");function Io(t,e,n){let o=[...t],s=Mo(o,e),r=!0,i=0,d=Math.max(1,o.length);for(;r&&i<d;){r=!1,i++;for(let u=0;u+1<o.length;u++){[o[u],o[u+1]]=[o[u+1],o[u]];let a=Mo(o,e);a<s?(s=a,r=!0):[o[u],o[u+1]]=[o[u+1],o[u]]}}return{order:o,cost:s,sourceDistance:Vr(o,n)}}c(Io,"greedySwitch");function Wr(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}c(Wr,"isBetterCandidate");function Kr(t,e,n){let 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 $r(`${t.join("|")}#${o}#${n}`)}c(Kr,"seedForRestart");function qr(t,e={}){let n=En(t);if(n.length<2)return n;let o=jr(t);if(o.length===0)return n;let s=new Map(n.map((d,u)=>[d,u])),r=Io(n,o,s),i=Math.max(0,e.restarts??Gr);for(let d=0;d<i;d++){let u=Kr(n,o,d),a=Ur(n,u),y=Io(a,o,s);Wr(y,r)&&(r=y)}return r.order}c(qr,"optimizeTopLaneOrder");function Jr(t,e){let n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=Ae(t),r=e?.automaticLaneOrdering?qr(s,{restarts:Gr}):void 0,i=yr(s),d=i.acyclic,u=n?kr(d,{compactSingleInput:e?.compactSingleInput??Mn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Fr(d,{compactSingleInput:e?.compactSingleInput??Mn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:a,graphWithDummies:y}=_r(u,d),l=Xr(a,y,{laneOrder:r}),x=Yr(l,y,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:d,reversed:i.reversed,layering:a,ordered:l,coordinates:x}}c(Jr,"sugiyamaLayout");var mt=Li.EPSILON,Ri=8,Ne=15,Xe=15,an=25,le=20,Gn=10;function So(t,e,n){let o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,d=Math.abs(r),u=Math.abs(i);return d<mt&&u<mt?n:u>mt&&u*3>=d?i>0?"bottom":"top":d>mt?r>0?"right":"left":n}c(So,"chooseOrthogonalSide");var ds=c(t=>typeof t=="number"&&Number.isFinite(t)&&t>0,"isDrawableSize");function un(t,e){let n=t.metadata?.drawnExtent;return{w:ds(n?.width)?n.width:t.width??e,h:ds(n?.height)?n.height:t.height??e}}c(un,"drawnSize");function Co(t,e){return Math.abs(t.to-e.from)<mt||Math.abs(t.to-e.to)<mt?t.to:t.from}c(Co,"sharedLineEndpointCoord");function Be(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}c(Be,"pointOnLine");function Zr(t,e){let n=t.nodes??[],o=t.edges??[],s=[];for(let g of o)g.isLayoutOnly||s.push({...g,__originalEdge:g});let r=new Map,i=new Map,d=[],u=e==="LR";for(let g of n)r.set(g.id,g);let a=he(n),y=n.filter(g=>a.isLane(g.id));for(let g of y){let v={id:g.id},A=c(R=>{i.set(R.id,v),n.filter(T=>T.parentId===R.id).forEach(A)},"assignLane");A(g)}let l=Ve(n),x=n.filter(g=>!g.isGroup&&!g.isEdgeLabel&&!l.has(g.id)).map(g=>{let v=g.width??10,A=g.height??10,R=g.x??0,T=g.y??0,D=Ri;return{nodeId:g.id,minX:R-v/2-D,maxX:R+v/2+D,minY:T-A/2-D,maxY:T+A/2+D,visualXHalfExtent:u?A/2+D:v/2+D}}),m=c((g,v,A,R)=>{let T=d.find(D=>D.orientation===g&&Math.abs(D.coord-v)<1);return T||(T={id:`pipe-${g}-${v.toFixed(0)}`,orientation:g,coord:v,spanMin:A,spanMax:R,tracks:[]},d.push(T)),T.spanMin=Math.min(T.spanMin,A),T.spanMax=Math.max(T.spanMax,R),T},"getOrAddPipe"),p=c((g,v)=>{let{w:A,h:R}=un(g,10),T=g.x??0,D=g.y??0;switch(v){case"top":return{x:T,y:D-R/2};case"bottom":return{x:T,y:D+R/2};case"left":return{x:T-A/2,y:D};case"right":return{x:T+A/2,y:D}}},"portForSide"),f=c((g,v,A)=>p(g,So(g,v,A?"bottom":"top")),"getOrthogonalPort"),h=[],M=[],I=new Set,C=1e3,w=c((g,v,A)=>{if(h.length===0)return 0;let R=Math.abs(v.y-A.y)<mt,T=Math.abs(v.x-A.x)<mt;if(!R&&!T)return 0;let D=0;if(R){let J=v.y,at=Math.min(v.x,A.x)-mt,W=Math.max(v.x,A.x)+mt;if(W<=at)return 0;for(let V of h)V.edgeIndex===g||V.orientation!=="vertical"||V.pipe.coord<at||V.pipe.coord>W||V.from-mt<=J&&V.to+mt>=J&&(D+=C)}else if(T){let J=v.x,at=Math.min(v.y,A.y)-mt,W=Math.max(v.y,A.y)+mt;if(W<=at)return 0;for(let V of h)V.edgeIndex===g||V.orientation!=="horizontal"||V.pipe.coord<at||V.pipe.coord>W||V.from-mt<=J&&V.to+mt>=J&&(D+=C)}return D},"crossingPenalty"),S=s.map((g,v)=>{if(!g.start||!g.end)return{idx:v,crossLane:0,dx:0,dy:0};let A=r.get(g.start),R=r.get(g.end),T=i.get(g.start),D=i.get(g.end),J=T&&D&&T.id!==D.id?1:0,at=A&&R?Math.abs((R.x??0)-(A.x??0)):0,W=A&&R?Math.abs((R.y??0)-(A.y??0)):0;return{idx:v,crossLane:J,dx:at,dy:W}}).sort((g,v)=>{if(g.crossLane!==v.crossLane)return v.crossLane-g.crossLane;let A=g.dx+g.dy,R=v.dx+v.dy;return Math.abs(A-R)>1?A-R:g.idx-v.idx}).map(g=>g.idx),b=c((g,v,A,R)=>{let T=Math.min(g.x,v.x),D=Math.max(g.x,v.x),J=Math.min(g.y,v.y),at=Math.max(g.y,v.y);return!!x.find(V=>A&&V.nodeId===A||R&&V.nodeId===R?!1:Math.abs(g.x-v.x)>mt?V.minY<g.y&&V.maxY>g.y&&V.maxX>T&&V.minX<D:V.minX<g.x&&V.maxX>g.x&&V.maxY>J&&V.minY<at)},"isSegmentBlocked"),L=new Map,E=new Map;for(let g of s)!g.start||!g.end||g.start===g.end||(E.set(g.start,(E.get(g.start)??0)+1),E.set(g.end,(E.get(g.end)??0)+1));let B=c((g,v)=>So(g,v,"bottom"),"determineSide"),P=new Map;for(let[g,v]of s.entries()){if(!v.start||!v.end||v.start===v.end||v.points&&v.points.length>0)continue;let A=r.get(v.start),R=r.get(v.end);if(!A||!R)continue;let T=(R.x??0)-(A.x??0),D=(R.y??0)-(A.y??0);P.set(g,{edgeIdx:g,srcId:v.start,dstId:v.end,srcSide:B(A,{x:R.x??0,y:R.y??0}),dstSide:B(R,{x:A.x??0,y:A.y??0}),absDx:Math.abs(T),absDy:Math.abs(D),dxSign:Math.sign(T),dySign:Math.sign(D)})}let N=c(g=>g.srcSide==="top"||g.srcSide==="bottom"?g.absDx===0?1/0:g.absDy/g.absDx:g.absDy===0?1/0:g.absDx/g.absDy,"preferenceStrength"),F=c(g=>g.srcSide==="top"||g.srcSide==="bottom"?g.dxSign===0?["right","left"]:[g.dxSign>0?"right":"left"]:g.dySign===0?["bottom","top"]:[g.dySign>0?"bottom":"top"],"secondarySides"),U=c(g=>F(g)[0],"secondarySide"),G=new Map;for(let g of P.values()){let v=`${g.srcId}:${g.srcSide}`;G.has(v)||G.set(v,[]),G.get(v).push(g)}let Z=new Map,it=c((g,v)=>`${g}:${v}`,"loadKey");for(let g of P.values())Z.set(it(g.srcId,g.srcSide),(Z.get(it(g.srcId,g.srcSide))??0)+1),Z.set(it(g.dstId,g.dstSide),(Z.get(it(g.dstId,g.dstSide))??0)+1);for(let g of G.values())if(!(g.length<2)){g.sort((v,A)=>{let R=N(v),T=N(A);return Math.abs(R-T)>1e-9?T-R:v.edgeIdx-A.edgeIdx});for(let v=1;v<g.length;v++){let A=g[v],R=Z.get(it(A.srcId,A.srcSide))??0,T=F(A).reduce((J,at)=>(Z.get(it(A.srcId,at))??0)<(Z.get(it(A.srcId,J))??0)?at:J),D=Z.get(it(A.srcId,T))??0;D>=R||(Z.set(it(A.srcId,A.srcSide),R-1),Z.set(it(A.srcId,T),D+1),A.srcSide=T)}}let ft=c(g=>{let v=g?.shape;return v==="question"||v==="diamond"},"isDiamondNode"),At=new Map;for(let g of P.values())At.has(g.dstId)||At.set(g.dstId,new Set),At.get(g.dstId).add(g.dstSide);for(let g of P.values()){if(!ft(r.get(g.srcId)))continue;let v=At.get(g.srcId);if(!v?.has(g.srcSide))continue;let A=U(g);if(v.has(A)||(Z.get(it(g.srcId,A))??0)>0)continue;let R=Z.get(it(g.srcId,g.srcSide))??0;Z.set(it(g.srcId,g.srcSide),Math.max(0,R-1)),Z.set(it(g.srcId,A),1),g.srcSide=A}let te=c(g=>{let v=g?.shape;return v==="hexagon"||v==="notch-pent"},"hasVertexFaces"),zt=new Map;for(let g of P.values())zt.has(g.srcId)||zt.set(g.srcId,new Set),zt.get(g.srcId).add(g.srcSide);let Ut=c(g=>g.dstSide==="top"||g.dstSide==="bottom"?g.dxSign>=0?"left":"right":g.dySign>=0?"top":"bottom","secondaryDstSide");for(let g of P.values()){if(!te(r.get(g.dstId)))continue;let v=zt.get(g.dstId);if(!v?.has(g.dstSide))continue;let A=Ut(g);if(v.has(A)||(Z.get(it(g.dstId,A))??0)>0)continue;let R=Z.get(it(g.dstId,g.dstSide))??0;Z.set(it(g.dstId,g.dstSide),Math.max(0,R-1)),Z.set(it(g.dstId,A),1),g.dstSide=A;let T=g.dySign>=0?"bottom":"top";if((A==="top"||A==="bottom")&&At.get(g.srcId)?.has(g.srcSide)&&!At.get(g.srcId)?.has(T)&&(Z.get(it(g.srcId,T))??0)===0){let D=Z.get(it(g.srcId,g.srcSide))??0;Z.set(it(g.srcId,g.srcSide),Math.max(0,D-1)),Z.set(it(g.srcId,T),1),g.srcSide=T}}for(let g of P.values()){let{edgeIdx:v,srcId:A,dstId:R,srcSide:T,dstSide:D}=g,J=r.get(A),at=r.get(R),W=`${A}:${T}:src`,V=T==="top"||T==="bottom"?at.x??0:at.y??0;L.has(W)||L.set(W,[]),L.get(W).push({edgeIdx:v,oppositeCoord:V});let Lt=`${R}:${D}:dst`,wt=D==="top"||D==="bottom"?J.x??0:J.y??0;L.has(Lt)||L.set(Lt,[]),L.get(Lt).push({edgeIdx:v,oppositeCoord:wt})}let Q=new Map,lt=8;for(let[g,v]of L){if(v.length<2)continue;v.sort((Ht,re)=>Ht.oppositeCoord-re.oppositeCoord);let A=g.split(":"),R=A.slice(0,-2).join(":"),T=A[A.length-2],D=A[A.length-1],J=r.get(R);if(!J)continue;let at=T==="left"||T==="right",W=un(J,10),V=at?W.h:W.w,Lt=J.shape,Rt=Lt==="question"||Lt==="diamond"?V*.3:V,bt=Math.min(20,Rt/(v.length-1),Math.max(lt,Rt/(v.length+1))),ee=-(bt*(v.length-1))/2;for(let[Ht,re]of v.entries()){let Ie=ee+Ht*bt,An=`${re.edgeIdx}:${D}`;Q.set(An,Ie)}}let _=c(g=>!!s[g]?.labelNodeId,"edgeHasLabelNode"),$=c((g,v)=>g?(L.get(`${g}:${v}:src`)??[]).some(({edgeIdx:A})=>_(A))||(L.get(`${g}:${v}:dst`)??[]).some(({edgeIdx:A})=>_(A)):!1,"faceHasLabelNode"),tt=c((g,v,A)=>v==="top"||v==="bottom"?{x:g.x+A,y:g.y}:{x:g.x,y:g.y+A},"applyPortOffset"),q=c((g,v,A)=>{let R=P.get(g),T={x:A.x??0,y:A.y??0},D={x:v.x??0,y:v.y??0},J=R?.srcSide??B(v,T),at=R?.dstSide??B(A,D),W=R?p(v,R.srcSide):f(v,T,!0),V=R?p(A,R.dstSide):f(A,D,!1),Lt=Q.get(`${g}:src`),wt=Q.get(`${g}:dst`);return Lt!==void 0&&(W=tt(W,J,Lt)),wt!==void 0&&(V=tt(V,at,wt)),{pSrcPort:W,pDstPort:V,srcSide:J,dstSide:at}},"portsForEdge");for(let g of S){let v=s[g];if(M[g]=[],!v.start||!v.end||v.points&&v.points.length>0||v.start===v.end)continue;let A=r.get(v.start),R=r.get(v.end);if(!A||!R)continue;let{pSrcPort:T,pDstPort:D,srcSide:J,dstSide:at}=q(g,A,R),W={...T},V={...D},Lt=J==="top"||J==="bottom",wt=at==="top"||at==="bottom";if(Lt){let X=T.y>(A.y??0);W.y=X?T.y+le:T.y-le}else{let X=T.x>(A.x??0);W.x=X?T.x+le:T.x-le}if(wt){let X=D.y>(R.y??0);V.y=X?D.y+le:D.y-le}else{let X=D.x>(R.x??0);V.x=X?D.x+le:D.x-le}let Rt=c((X,z)=>{for(let ot of x)if(!z.includes(ot.nodeId)&&X.x>ot.minX&&X.x<ot.maxX&&X.y>ot.minY&&X.y<ot.maxY)return{inside:!0,obstacle:ot};return{inside:!1}},"isPointInObstacle"),rt=c((X,z,ot,Mt,Bt)=>{if(Bt){let Yt=X.y>(z.y??0);return{x:(ot.x??0)>=X.x?Mt.maxX+Ne:Mt.minX-Ne,y:Yt?Mt.maxY+Xe:Mt.minY-Xe,leavesPositiveSide:Yt}}let Et=X.x>(z.x??0),kt=(ot.y??0)>=X.y;return{x:Et?Mt.maxX+Ne:Mt.minX-Ne,y:kt?Mt.maxY+Xe:Mt.minY-Xe,leavesPositiveSide:Et}},"obstacleDetour"),bt=[],Pt=[v.start,v.end],ee=Rt(W,Pt);if(ee.inside&&ee.obstacle){let X=ee.obstacle;if(Lt){let z=rt(T,A,R,X,!0);W.x=z.x,W.y=z.y;let ot=z.leavesPositiveSide?Math.min(X.minY-2,T.y+le):Math.max(X.maxY+2,T.y-le);bt=[{x:T.x,y:ot},{x:z.x,y:ot},{x:z.x,y:z.y}]}else{let z=rt(T,A,R,X,!1),ot=z.leavesPositiveSide?Math.min(X.minX-2,T.x+le):Math.max(X.maxX+2,T.x-le);W.x=z.x,W.y=z.y,bt=[{x:ot,y:T.y},{x:ot,y:z.y},{x:z.x,y:z.y}]}}let Ht=[],re=Rt(V,Pt);if(re.inside&&re.obstacle){let X=re.obstacle;if(wt){let z=rt(D,R,A,X,!0);V.x=z.x,V.y=z.y,Ht=[{x:z.x,y:z.y},{x:D.x,y:z.y}]}else{let z=rt(D,R,A,X,!1);V.x=z.x,V.y=z.y,Ht=[{x:z.x,y:z.y},{x:z.x,y:D.y}]}}if(bt.length===0&&Ht.length===0){let X=Ne,z=Math.abs(W.x-V.x)<X,ot=Math.abs(W.y-V.y)<X,Mt=Q.get(`${g}:src`)!==void 0||Q.get(`${g}:dst`)!==void 0,Bt=(L.get(`${v.start??""}:${J}:src`)?.length??0)+(L.get(`${v.start??""}:${J}:dst`)?.length??0),Et=(L.get(`${v.end??""}:${at}:src`)?.length??0)+(L.get(`${v.end??""}:${at}:dst`)?.length??0),kt=Bt>1||Et>1,Yt=E.get(v.start??"")??0,St=E.get(v.end??"")??0,qt=Bt>1&&$(v.start,J)||Et>1&&$(v.end,at),ae=Bt<=1||Yt<=2,$t=Et<=1||St<=2;if((z||ot)&&!Mt&&(!kt||kt&&!qt&&ae&&$t)&&!b(T,D,v.start,v.end)){v.points=[{...T},{...W},{...V},{...D}],I.add(g);let Tt=ot?"horizontal":"vertical",Zt=ot?T.y:T.x,Ot=ot?Math.min(T.x,D.x):Math.min(T.y,D.y),Nt=ot?Math.max(T.x,D.x):Math.max(T.y,D.y),ne={id:`fast-path-${Tt}-${Zt.toFixed(0)}-${g}`,orientation:Tt,coord:Zt,spanMin:Ot,spanMax:Nt,tracks:[]};h.push({edgeIndex:g,segmentIndex:0,orientation:Tt,pipe:ne,trackIndex:0,from:Ot,to:Nt});continue}}let Ie=m("vertical",W.x,W.y,W.y);W.x=Ie.coord;let An=m("vertical",V.x,V.y,V.y);V.x=An.coord;let Se=Math.min(W.x,V.x)-50,Ce=Math.max(W.x,V.x)+50,Pe=Math.min(W.y,V.y)-50,ke=Math.max(W.y,V.y)+50;for(let X of x){let z=Math.min(W.x,V.x),ot=Math.max(W.x,V.x),Mt=Math.min(W.y,V.y),Bt=Math.max(W.y,V.y);X.minX<ot&&X.maxX>z&&X.minY<Bt&&X.maxY>Mt&&(Se=Math.min(Se,X.minX-an),Ce=Math.max(Ce,X.maxX+an),Pe=Math.min(Pe,X.minY-an),ke=Math.max(ke,X.maxY+an))}for(let X of x){if(X.maxX<Se||X.minX>Ce||X.maxY<Pe||X.minY>ke)continue;let z=Ne;m("horizontal",X.minY-z,Se,Ce),m("horizontal",X.maxY+z,Se,Ce);let ot=Xe;m("vertical",X.minX-ot,Pe,ke),m("vertical",X.maxX+ot,Pe,ke)}m("horizontal",W.y,Se,Ce),m("horizontal",V.y,Se,Ce);let ni=d.filter(X=>X.orientation==="horizontal"&&X.coord>=Pe&&X.coord<=ke),oi=d.filter(X=>X.orientation==="vertical"&&X.coord>=Se&&X.coord<=Ce),Ke=c((X,z)=>`${X.toFixed(1)},${z.toFixed(1)}`,"getKey"),qe=Ke(W.x,W.y),$o=Ke(V.x,V.y),Je=new Map,Rn=new Map,Tn=new Map,Ze=new Set,Oe=[];Je.set(qe,0),Tn.set(qe,"n"),Oe.push({key:qe,f:Math.hypot(V.x-W.x,V.y-W.y),pt:W}),Ze.add(qe);let Wt=[],ve=c((X,z)=>b(X,z,v.start,v.end),"checkSegmentBlocked"),On={x:V.x,y:W.y},si=ve(W,On),ri=ve(On,V),ii=si||ri,Nn={x:W.x,y:V.y},ci=ve(W,Nn),ai=ve(Nn,V);if(ii?ci||ai||(Math.abs(W.x-V.x)<mt?Wt=[W,V]:Wt=[W,Nn,V]):Math.abs(W.y-V.y)<mt||Math.abs(W.x-V.x)<mt?Wt=[W,V]:Wt=[W,On,V],Wt.length===0)for(;Oe.length>0;){Oe.sort((St,qt)=>St.f-qt.f);let X=Oe.shift();if(Ze.delete(X.key),X.key===$o){let St=$o,qt=V;for(Wt=[qt];Rn.has(St);){let ae=Rn.get(St);Wt.unshift(ae),qt=ae,St=Ke(ae.x,ae.y)}break}let z=X.pt.x,ot=X.pt.y,Mt=oi.sort((St,qt)=>St.coord-qt.coord),Bt=Mt.findIndex(St=>Math.abs(St.coord-z)<1),Et=ni.sort((St,qt)=>St.coord-qt.coord),kt=Et.findIndex(St=>Math.abs(St.coord-ot)<1),Yt=[];Bt>0&&Yt.push({x:Mt[Bt-1].coord,y:ot}),Bt>=0&&Bt<Mt.length-1&&Yt.push({x:Mt[Bt+1].coord,y:ot}),kt>0&&Yt.push({x:z,y:Et[kt-1].coord}),kt>=0&&kt<Et.length-1&&Yt.push({x:z,y:Et[kt+1].coord});for(let St of Yt){let qt=Math.min(z,St.x),ae=Math.max(z,St.x),$t=Math.min(ot,St.y),Jt=Math.max(ot,St.y);if(x.some(ie=>ie.nodeId===v.start||ie.nodeId===v.end?!1:qt!==ae?ie.minY<ot&&ie.maxY>ot&&ie.maxX>qt&&ie.minX<ae:ie.minX<z&&ie.maxX>z&&ie.maxY>$t&&ie.minY<Jt))continue;let Tt=Ke(St.x,St.y),Zt=Math.abs(St.x-z)+Math.abs(St.y-ot),Ot=w(g,X.pt,St),Nt=0,ne=V.x-W.x,_e=V.y-W.y,Qe=St.x-z,Bn=St.y-ot;(_e>10&&Bn<-5||_e<-10&&Bn>5)&&(Nt=Math.abs(Bn)*100),(ne>10&&Qe<-5||ne<-10&&Qe>5)&&(Nt+=Math.abs(Qe)*50);let zo=0,Uo=Tn.get(X.key)??"n",Vo=Math.abs(Qe)>mt?"h":"v";Uo!=="n"&&Uo!==Vo&&(zo=50);let li=Zt+Ot+Nt+zo,tn=(Je.get(X.key)??1/0)+li,jo=Math.abs(V.x-St.x)+Math.abs(V.y-St.y);if(tn<(Je.get(Tt)??1/0))if(Rn.set(Tt,X.pt),Je.set(Tt,tn),Tn.set(Tt,Vo),!Ze.has(Tt))Oe.push({key:Tt,f:tn+jo,pt:St}),Ze.add(Tt);else{let ie=Oe.findIndex(di=>di.key===Tt);ie!==-1&&(Oe[ie].f=tn+jo)}}}if(Wt.length===0&&(Wt=[W,{x:W.x,y:V.y},V]),Wt.length>4){let X=Wt[0],z=Wt[Wt.length-1],ot=Math.min(X.x,z.x),Mt=Math.max(X.x,z.x),Bt=Math.min(X.y,z.y),Et=Math.max(X.y,z.y);for(let $t of Wt)ot=Math.min(ot,$t.x),Mt=Math.max(Mt,$t.x),Bt=Math.min(Bt,$t.y),Et=Math.max(Et,$t.y);let kt=Mt>Math.max(X.x,z.x),Yt=ot<Math.min(X.x,z.x);if(u){let $t=Xe;if(kt){let Jt=Math.max(X.x,z.x),Gt=Math.min(X.y,z.y),Tt=Math.max(X.y,z.y),Zt=x.filter(Ot=>Ot.minX<Jt&&Ot.maxX>Jt&&Ot.minY<Tt&&Ot.maxY>Gt);if(Zt.length>0){let Ot=Math.max(X.x,z.x);for(let Nt of Zt){let ne=(Nt.minX+Nt.maxX)/2;if(Nt.visualXHalfExtent===void 0||isNaN(Nt.visualXHalfExtent))continue;let _e=ne+Nt.visualXHalfExtent+$t;Ot=Math.max(Ot,_e)}isNaN(Ot)||(Mt=Ot)}}if(Yt){let Jt=x.filter(Gt=>Gt.minX<Math.min(X.x,z.x)+$t&&Gt.minY<Math.max(X.y,z.y)&&Gt.maxY>Math.min(X.y,z.y));if(Jt.length>0){let Gt=Math.min(X.x,z.x);for(let Tt of Jt){let Ot=(Tt.minX+Tt.maxX)/2-Tt.visualXHalfExtent-$t;Gt=Math.min(Gt,Ot)}ot=Gt}}}let St=c($t=>{let Jt=z.y>X.y,Gt=x.filter(Ot=>{let Nt=Math.min(X.x,z.x)<Ot.maxX&&Math.max(X.x,z.x)>Ot.minX,ne=Math.min(X.y,z.y)<Ot.maxY&&Math.max(X.y,z.y)>Ot.minY;return Nt&&ne}),Tt=Gt;if(u&&Gt.length>0){let Ot=Gt.filter(Nt=>Nt.minX<$t&&Nt.maxX>$t);Ot.length>0&&(Tt=Ot)}if(Tt.length===0)return z.y;let Zt=Ne;if(Jt){let Nt=Math.max(...Tt.map(ne=>ne.maxY))+Zt;if(Nt<z.y-mt)return Nt}else{let Nt=Math.min(...Tt.map(ne=>ne.minY))-Zt;if(Nt>z.y+mt)return Nt}return z.y},"findBestReturnY"),qt=c($t=>{let Jt=St($t),Gt={x:$t,y:X.y},Tt={x:$t,y:Jt},Zt={x:z.x,y:Jt},Ot=ve(X,Gt),Nt=ve(Gt,Tt),ne=ve(Tt,Zt),_e=Jt!==z.y?ve(Zt,z):!1;return!Ot&&!Nt&&!ne&&!_e?Math.abs(Jt-z.y)<mt?[X,Gt,Tt,z]:[X,Gt,Tt,Zt,z]:null},"trySimplifyWithDetourX"),ae=kt&&!Yt?qt(Mt):Yt&&!kt?qt(ot):null;ae&&(Wt=ae)}let Kt=[T,...bt,...Wt,...Ht.reverse(),D];if(Kt.length>=3){let X=Kt[Kt.length-1],z=Kt[Kt.length-2],ot=Kt[Kt.length-3],Mt=Math.abs(ot.y-z.y)<mt&&Math.abs(z.y-X.y)<mt,Bt=Math.abs(ot.x-z.x)<mt&&Math.abs(z.x-X.x)<mt;if(Mt){let Et=Math.sign(z.x-ot.x),kt=Math.sign(X.x-ot.x);Et!==0&&Et===kt&&Math.abs(z.x-ot.x)>Math.abs(X.x-ot.x)&&Kt.splice(-2,1)}else if(Bt){let Et=Math.sign(z.y-ot.y),kt=Math.sign(X.y-ot.y);Et!==0&&Et===kt&&Math.abs(z.y-ot.y)>Math.abs(X.y-ot.y)&&Kt.splice(-2,1)}}let ge=[Kt[0]];for(let X=1;X<Kt.length-1;X++){if(X===1){ge.push(Kt[X]);continue}let z=ge[ge.length-1],ot=Kt[X],Mt=Kt[X+1];if(Math.abs(z.y-ot.y)<mt&&Math.abs(ot.y-Mt.y)<mt){let Bt=ot.x>z.x,Et=Mt.x>ot.x;if(Bt!==Et){ge.push(ot);continue}continue}if(Math.abs(z.x-ot.x)<mt&&Math.abs(ot.x-Mt.x)<mt){let Bt=ot.y>z.y,Et=Mt.y>ot.y;if(Bt!==Et){ge.push(ot);continue}continue}ge.push(ot)}ge.push(Kt[Kt.length-1]);for(let X=0;X<ge.length-1;X++){let z=ge[X],ot=ge[X+1],Mt=Math.abs(z.x-ot.x)<mt?"vertical":"horizontal",Bt=Mt==="vertical"?z.x:z.y,Et=Mt==="vertical"?Math.min(z.y,ot.y):Math.min(z.x,ot.x),kt=Mt==="vertical"?Math.max(z.y,ot.y):Math.max(z.x,ot.x),Yt=m(Mt,Bt,Et,kt),St={edgeIndex:g,segmentIndex:X,orientation:Mt,pipe:Yt,trackIndex:0,from:Et,to:kt};h.push(St),M[g].push(h.length-1),Yt.tracks[0]||(Yt.tracks[0]={index:0,coord:Yt.coord,segments:[]}),Yt.tracks[0].segments.push({edgeIndex:g,segmentIndex:X,from:Et,to:kt})}}let st=c((g,v)=>g.from<v.to&&v.from<g.to,"segmentsOverlap"),ut=c((g,v,A,R)=>{let T=!R.segments.some(J=>(J.edgeIndex!==v.edgeIndex||J.segmentIndex!==v.segmentIndex)&&st(J,g)),D=!A.segments.some(J=>(J.edgeIndex!==g.edgeIndex||J.segmentIndex!==g.segmentIndex)&&st(J,v));return T&&D?(g.trackIndex=R.index,v.trackIndex=A.index,A.segments=[...A.segments.filter(J=>J.edgeIndex!==g.edgeIndex||J.segmentIndex!==g.segmentIndex),{edgeIndex:v.edgeIndex,segmentIndex:v.segmentIndex,from:v.from,to:v.to}],R.segments=[...R.segments.filter(J=>J.edgeIndex!==v.edgeIndex||J.segmentIndex!==v.segmentIndex),{edgeIndex:g.edgeIndex,segmentIndex:g.segmentIndex,from:g.from,to:g.to}],!0):!1},"trySwapSegmentsAcrossTracks"),gt=c(g=>{let v=g.tracks.length;return g.tracks[v]={index:v,coord:g.coord,segments:[]},v},"createNewTrack"),pt=c((g,v)=>{let A=g.pipe.tracks[g.trackIndex];A.segments=A.segments.filter(T=>T.edgeIndex!==g.edgeIndex||T.segmentIndex!==g.segmentIndex),g.trackIndex=v,g.pipe.tracks[v].segments.push({edgeIndex:g.edgeIndex,segmentIndex:g.segmentIndex,from:g.from,to:g.to})},"moveSegmentToTrack"),xt=c((g,v)=>{let A=M[g.edgeIndex];for(let R of A){let T=h[R];T.pipe===g.pipe&&pt(T,v)}},"moveSegmentChainToTrack"),Ft=c(g=>{let v=M[g.edgeIndex],A=v.indexOf(h.indexOf(g)),R=[];return A>0&&R.push(h[v[A-1]]),A<v.length-1&&R.push(h[v[A+1]]),R},"getAdjacentSegmentsAlongEdge"),Re=c((g,v)=>{if(g.orientation===v.orientation)return!1;let A=g.orientation==="horizontal"?g:v,R=g.orientation==="horizontal"?v:g;return R.pipe.coord>A.from&&R.pipe.coord<A.to&&A.pipe.coord>R.from&&A.pipe.coord<R.to},"haveAnyCrossing"),ye=c((g,v)=>{for(let A of g.tracks)if(!A.segments.some(T=>(T.edgeIndex!==v.edgeIndex||T.segmentIndex!==v.segmentIndex)&&st(T,v)))return A.index;return-1},"findAvailableTrack"),xe=c((g,v)=>{if(g.trackIndex===v.trackIndex)return st(g,v);let A=Ft(g),R=Ft(v);return A.some(T=>R.some(D=>Re(T,D)))},"segmentsConflict"),Te=c((g,v,A)=>{if(ut(g,v,g.pipe.tracks[g.trackIndex],v.pipe.tracks[v.trackIndex]))return;let R=ye(g.pipe,v);A(v,R!==-1?R:gt(g.pipe))},"resolveTrackConflict"),We=c(g=>{let v=0;for(let A=0;A<g.length;A++)for(let R=A+1;R<g.length;R++){let T=g[A],D=g[R];T.pipe===D.pipe&&xe(T,D)&&(v++,Te(T,D,xt))}return v},"resolveHandleConflicts"),O=new Map,k=c(g=>{if(O.has(g))return O.get(g);let v=M[g];if(v.length===0){let at={dest:0,deviation:0,base:0,delta:0};return O.set(g,at),at}let R=h[v[0]].pipe.coord,T=R;for(let at=1;at<v.length;at++){let W=h[v[at]];if(W.orientation==="horizontal"){let V=W.from,Lt=W.to;T=Math.abs(V-R)>Math.abs(Lt-R)?V:Lt;break}}let D=Math.abs(T-R),J={dest:T,deviation:D,base:R,delta:T-R};return O.set(g,J),J},"getDestInfo"),H=c(()=>{let g=0,v=new Map;for(let[R,T]of s.entries())M[R].length!==0&&T.start&&(v.has(T.start)||v.set(T.start,[]),v.get(T.start).push(R));let A=c(R=>{let T=s[R];if(!T.start||!T.end)return 0;let D=r.get(T.start),J=r.get(T.end);if(!D||!J)return 0;let at=(J.x??0)-(D.x??0),W=(J.y??0)-(D.y??0);return Math.abs(at)+Math.abs(W)},"getEdgeDistance");for(let R of v.values()){R.sort((D,J)=>{let at=k(D),W=k(J);if(Math.abs(at.deviation-W.deviation)>1)return at.deviation-W.deviation;if(Math.abs(at.dest-W.dest)>1)return at.dest-W.dest;let V=A(D),Lt=A(J);if(Math.abs(V-Lt)>1)return Lt-V;let wt=M[D].length,Rt=M[J].length;if(wt!==Rt)return wt-Rt;if(wt===1){let rt=M[D][0],bt=M[J][0];if(h[rt]&&h[bt]){let Pt=h[rt],ee=h[bt],Ht=Math.abs(Pt.to-Pt.from),re=Math.abs(ee.to-ee.from);if(Math.abs(Ht-re)>1)return Ht-re}}return 0});let T=R.map(D=>h[M[D][0]]);g+=We(T)}return g},"fixSourceHandleCrossings"),j=c(()=>{let g=0,v=new Map;for(let[A,R]of s.entries())M[A].length!==0&&R.end&&(v.has(R.end)||v.set(R.end,[]),v.get(R.end).push(A));for(let A of v.values()){A.sort((T,D)=>{let J=c(V=>{let Lt=M[V];if(Lt.length<2)return 0;let wt=h[Lt[Lt.length-2]];return Math.abs(wt.to-wt.from)},"getDist"),at=J(T),W=J(D);return Math.abs(at-W)>.1?at-W:T-D});let R=A.map(T=>h[M[T][M[T].length-1]]);g+=We(R)}return g},"fixTargetHandleCrossings"),K=c(()=>{let g=0;for(let v of d){let A=[];for(let R of v.tracks)for(let T of R.segments){let D=M[T.edgeIndex].find(J=>h[J].segmentIndex===T.segmentIndex);D!==void 0&&A.push(h[D])}A.sort((R,T)=>R.edgeIndex-T.edgeIndex||R.segmentIndex-T.segmentIndex);for(let R=0;R<A.length;R++)for(let T=R+1;T<A.length;T++){let D=A[R],J=A[T];xe(D,J)&&(g++,Te(D,J,pt))}}return g},"fixPipeCrossings"),et=0,Y=10;for(;et<Y;){let g=0;if(g+=H(),g+=j(),g+=K(),g===0)break;et++}let nt=new Map;for(let g of d){let v=[];g.tracks.forEach(R=>{R.segments.forEach(T=>{v.push({edgeIndex:T.edgeIndex,segmentIndex:T.segmentIndex,trackIndex:R.index,from:T.from,to:T.to})})}),v.sort((R,T)=>R.from-T.from);let A=[];if(v.length>0){let R=[v[0]],T=v[0].to;for(let D=1;D<v.length;D++){let J=v[D];J.from<T?(R.push(J),T=Math.max(T,J.to)):(A.push(R),R=[J],T=J.to)}A.push(R)}for(let R of A){let T=new Set;R.forEach(rt=>T.add(rt.trackIndex));let D=new Map;R.forEach(rt=>{let bt=k(rt.edgeIndex);D.set(rt.trackIndex,(D.get(rt.trackIndex)??0)+bt.delta)});let J=[...T].filter(rt=>(D.get(rt)??0)<-1),at=[...T].filter(rt=>(D.get(rt)??0)>1),W=[...T].filter(rt=>Math.abs(D.get(rt)??0)<=1);J.sort((rt,bt)=>(D.get(bt)??0)-(D.get(rt)??0)),at.sort((rt,bt)=>(D.get(rt)??0)-(D.get(bt)??0));let V=c((rt,bt)=>{R.filter(Pt=>Pt.trackIndex===rt).forEach(Pt=>{let ee=I.has(Pt.edgeIndex)?g.coord:bt;nt.set(`${Pt.edgeIndex}-${Pt.segmentIndex}`,ee)})},"assignCoord"),Lt=0;for(let rt of J)Lt++,V(rt,g.coord-Lt*Gn);if(W.length===0&&T.size>0){let rt=[...T].sort((ee,Ht)=>Math.abs(D.get(ee)??0)-Math.abs(D.get(Ht)??0))[0],bt=J.indexOf(rt);bt!==-1&&J.splice(bt,1);let Pt=at.indexOf(rt);Pt!==-1&&at.splice(Pt,1),W.push(rt)}let wt=0;for(let rt of W){if(wt===0)V(rt,g.coord);else{let bt=wt%2===1?1:-1,Pt=Math.ceil(wt/2);V(rt,g.coord+bt*Pt*Gn*.5)}wt++}let Rt=0;for(let rt of at)Rt++,V(rt,g.coord+Rt*Gn)}}for(let[g,v]of s.entries()){let A=M[g]??[];if(A.length===0)continue;let R=[],T=r.get(v.start),D=r.get(v.end),{pSrcPort:J,pDstPort:at}=q(g,T,D),W=A.map(Rt=>{let rt=h[Rt],bt=nt.get(`${rt.edgeIndex}-${rt.segmentIndex}`)??rt.pipe.coord;return{orient:rt.orientation,coord:bt,from:rt.from,to:rt.to}});R.push(J);for(let Rt=0;Rt<W.length;Rt++){let rt=W[Rt],bt=R[R.length-1],Pt=rt.orient==="vertical"?bt.y:bt.x,ee=rt.orient==="vertical"?bt.x:bt.y,Ht=W[Rt+1],re=Rt<W.length-1;if(Math.abs(ee-rt.coord)>mt&&R.push(Be(rt,Pt)),re&&Ht.orient===rt.orient)if(Math.abs(rt.coord-Ht.coord)>mt){let Ie=rt.orient==="vertical"?(Pt+Ht.from)/2:Co(rt,Ht);R.push(Be(rt,Ie),Be(Ht,Ie))}else(Rt===0||Rt===W.length-2)&&R.push(Be(rt,Co(rt,Ht)));else if(re)R.push(Be(rt,Ht.coord));else{let Ie=Math.abs(rt.from-Pt)<Math.abs(rt.to-Pt)?rt.to:rt.from;R.push(Be(rt,Ie))}}let V=R[R.length-1];(Math.abs(V.x-at.x)>mt||Math.abs(V.y-at.y)>mt)&&R.push(at);let Lt=R[0];Lt&&(Math.abs(Lt.x-J.x)>mt||Math.abs(Lt.y-J.y)>mt)&&R.unshift(J);let wt=[];R.length>0&&wt.push(R[0]);for(let Rt=1;Rt<R.length;Rt++){let rt=R[Rt],bt=wt[wt.length-1];(Math.abs(rt.x-bt.x)>mt||Math.abs(rt.y-bt.y)>mt)&&wt.push(rt)}v.points=wt}for(let g of s){let v=g.__originalEdge;v&&g.points&&(v.points=g.points)}t.edges=(t.edges??[]).filter(g=>!g.isLayoutOnly);let dt=c((g,v)=>{let A=v.x??0,R=v.y??0,{w:T,h:D}=un(v,0);if(T<=0||D<=0)return g;let J=A-T/2,at=A+T/2,W=R-D/2,V=R+D/2;if(g.x<J||g.x>at||g.y<W||g.y>V)return g;let Lt=g.x-J,wt=at-g.x,Rt=g.y-W,rt=V-g.y,bt=Math.min(Lt,wt,Rt,rt);return bt===Lt?{x:J,y:g.y}:bt===wt?{x:at,y:g.y}:bt===Rt?{x:g.x,y:W}:{x:g.x,y:V}},"nodeBoundaryClamp");for(let g of t.edges){let v=g.points;if(!v||v.length<2)continue;let A=g.start,R=g.end,T=A?r.get(A):void 0,D=R?r.get(R):void 0;T&&(v[0]=dt(v[0],T)),D&&(v[v.length-1]=dt(v[v.length-1],D))}return t}c(Zr,"routeEdgesOrthogonal");function Qr(t){return t.direction??"TB"}c(Qr,"getSwimlaneDirection");function ti(t){let e=Es(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,d=Qr(t),{ordered:u,coordinates:a}=Jr(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:d});Rs(e,u,a,{nodeGap:n,layerGap:o});for(let y of t.edges??[])delete y.points;Zr(t,d);for(let y of t.edges??[])(!y.curve||y.curve==="basis")&&(y.curve="rounded");return pr(t,d),gr(t),d}c(ti,"runSwimlaneLayoutCore");function ei(t){ws(t);let e=Ts(t);t.nodes=e.nodes,t.edges=e.edges}c(ei,"prepareSwimlaneLayout");var Wi=Wo({prepareLayout:ei,runLayoutCore:ti,afterPaint:fs});export{Wi as render};
@@ -0,0 +1,8 @@
1
+ import{a as o,b as m}from"./chunk-7UKJADAE.js";import"./chunk-N44XPVUD.js";import"./chunk-JZGXHT3J.js";import"./chunk-6CDZONCA.js";import"./chunk-AARGNXTW.js";import"./chunk-GWYODWCE.js";import"./chunk-WQHTQAFY.js";import"./chunk-EWYECPNJ.js";import"./chunk-7JQUFVT4.js";import"./chunk-NDAMZVXQ.js";import"./chunk-7ASYMKN2.js";import"./chunk-BOXAA5AP.js";import"./chunk-4QDE4SUK.js";import"./chunk-DIDARDST.js";import"./chunk-7LSMJ4VU.js";import"./chunk-5N2X2DXU.js";import"./chunk-3CJU2RDX.js";import"./chunk-QLS7NIYR.js";import"./chunk-ICJPOOXG.js";import"./chunk-IVZHB6RS.js";import"./chunk-QQIGL7OP.js";import{a as r}from"./chunk-RJFVWYCA.js";import"./chunk-SQE76S5B.js";var i=r(t=>`${o(t)}
2
+ .swimlane.cluster:not([data-color-id]) rect {
3
+ stroke: ${t.clusterBorder} !important;
4
+ }
5
+ [data-look="neo"].cluster rect {
6
+ filter: none;
7
+ }
8
+ `,"getStyles"),e=i,F=m({styles:e});export{F as diagram};
@@ -0,0 +1,120 @@
1
+ import{a as wt}from"./chunk-67BPVAXC.js";import{c as _t,f as J}from"./chunk-3CJU2RDX.js";import{o as vt}from"./chunk-QLS7NIYR.js";import{b as at}from"./chunk-ICJPOOXG.js";import{$ as st,C as nt,Q as it,T as kt,U as bt,c as yt,d as mt,e as xt}from"./chunk-IVZHB6RS.js";import{b as _,d as K}from"./chunk-QQIGL7OP.js";import{a as o,b as ft}from"./chunk-RJFVWYCA.js";import"./chunk-SQE76S5B.js";var ot=(function(){var e=o(function(k,a,d,c){for(d=d||{},c=k.length;c--;d[k[c]]=a);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],i=[1,12],n=[1,13],r=[1,14],h=[1,15],l=[1,16],s=[1,19],y=[1,20],g={trace:o(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:o(function(a,d,c,p,m,u,w){var b=u.length-1;switch(m){case 1:return u[b-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[b-1].push(u[b]),this.$=u[b-1];break;case 7:case 8:this.$=u[b];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[b].substr(6)),this.$=u[b].substr(6);break;case 12:this.$=u[b].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[b].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[b].substr(8)),this.$=u[b].substr(8);break;case 18:p.addTask(u[b],0,""),this.$=u[b];break;case 19:p.addEvent(u[b].substr(2)),this.$=u[b];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:i,15:n,17:r,19:h,20:l,21:17,22:18,23:s,24:y},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:i,15:n,17:r,19:h,20:l,21:17,22:18,23:s,24:y},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:o(function(a,d){if(d.recoverable)this.trace(a);else{var c=new Error(a);throw c.hash=d,c}},"parseError"),parse:o(function(a){var d=this,c=[0],p=[],m=[null],u=[],w=this.table,b="",I=0,P=0,B=0,G=2,L=1,R=u.slice.call(arguments,1),E=Object.create(this.lexer),A={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(A.yy[V]=this.yy[V]);E.setInput(a,A.yy),A.yy.lexer=E,A.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var D=E.yylloc;u.push(D);var $=E.options&&E.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function v(W){c.length=c.length-2*W,m.length=m.length-W,u.length=u.length-W}o(v,"popStack");function T(){var W;return W=p.pop()||E.lex()||L,typeof W!="number"&&(W instanceof Array&&(p=W,W=p.pop()),W=d.symbols_[W]||W),W}o(T,"lex");for(var S,H,M,N,et,Z,O={},j,F,gt,q;;){if(M=c[c.length-1],this.defaultActions[M]?N=this.defaultActions[M]:((S===null||typeof S>"u")&&(S=T()),N=w[M]&&w[M][S]),typeof N>"u"||!N.length||!N[0]){var rt="";q=[];for(j in w[M])this.terminals_[j]&&j>G&&q.push("'"+this.terminals_[j]+"'");E.showPosition?rt="Parse error on line "+(I+1)+`:
2
+ `+E.showPosition()+`
3
+ Expecting `+q.join(", ")+", got '"+(this.terminals_[S]||S)+"'":rt="Parse error on line "+(I+1)+": Unexpected "+(S==L?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(rt,{text:E.match,token:this.terminals_[S]||S,line:E.yylineno,loc:D,expected:q})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+S);switch(N[0]){case 1:c.push(S),m.push(E.yytext),u.push(E.yylloc),c.push(N[1]),S=null,H?(S=H,H=null):(P=E.yyleng,b=E.yytext,I=E.yylineno,D=E.yylloc,B>0&&B--);break;case 2:if(F=this.productions_[N[1]][1],O.$=m[m.length-F],O._$={first_line:u[u.length-(F||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(F||1)].first_column,last_column:u[u.length-1].last_column},$&&(O._$.range=[u[u.length-(F||1)].range[0],u[u.length-1].range[1]]),Z=this.performAction.apply(O,[b,P,I,A.yy,N[1],m,u].concat(R)),typeof Z<"u")return Z;F&&(c=c.slice(0,-1*F*2),m=m.slice(0,-1*F),u=u.slice(0,-1*F)),c.push(this.productions_[N[1]][0]),m.push(O.$),u.push(O._$),gt=w[c[c.length-2]][c[c.length-1]],c.push(gt);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:o(function(d,c){if(this.yy.parser)this.yy.parser.parseError(d,c);else throw new Error(d)},"parseError"),setInput:o(function(a,d){return this.yy=d||this.yy||{},this._input=a,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:o(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.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),a},"input"),unput:o(function(a){var d=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var p=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),c.length-1&&(this.yylineno-=c.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:c?(c.length===p.length?this.yylloc.first_column:0)+p[p.length-c.length].length-c[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:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(a){this.unput(this.match.slice(a))},"less"),pastInput:o(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+`
5
+ `+d+"^"},"showPosition"),test_match:o(function(a,d){var c,p,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))),p=a[0].match(/(?:\r\n?|\n).*/g),p&&(this.yylineno+=p.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,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(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,d,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var u in m)this[u]=m[u];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,d,c,p;this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),u=0;u<m.length;u++)if(c=this._input.match(this.rules[m[u]]),c&&(!d||c[0].length>d[0].length)){if(d=c,p=u,this.options.backtrack_lexer){if(a=this.test_match(c,m[u]),a!==!1)return a;if(this._backtrack){d=!1;continue}else return!1}else if(!this.options.flex)break}return d?(a=this.test_match(d,m[p]),a!==!1?a:!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:o(function(){var d=this.next();return d||this.lex()},"lex"),begin:o(function(d){this.conditionStack.push(d)},"begin"),popState:o(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(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:o(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:o(function(d){this.begin(d)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(d,c,p,m){var u=m;switch(p){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return k})();g.lexer=x;function f(){this.yy={}}return o(f,"Parser"),f.prototype=g,g.Parser=f,new f})();ot.parser=ot;var Xt=ot,It={};ft(It,{addEvent:()=>Vt,addSection:()=>Rt,addTask:()=>Bt,addTaskOrg:()=>Ft,clear:()=>Mt,default:()=>Zt,getCommonDb:()=>Lt,getDirection:()=>Ct,getSections:()=>Wt,getTasks:()=>Pt,setDirection:()=>At});var U="",Ht=0,ct="LR",ht=[],Q=[],X=[],Lt=o(()=>kt,"getCommonDb"),Mt=o(function(){ht.length=0,Q.length=0,U="",X.length=0,ct="LR",bt()},"clear"),At=o(function(e){ct=e},"setDirection"),Ct=o(function(){return ct},"getDirection"),Rt=o(function(e){U=e,ht.push(e)},"addSection"),Wt=o(function(){return ht},"getSections"),Pt=o(function(){let e=St(),t=100,i=0;for(;!e&&i<t;)e=St(),i++;return Q.push(...X),Q},"getTasks"),Bt=o(function(e,t,i){let n={id:Ht++,section:U,type:U,task:e,score:t||0,events:i?[i]:[]};X.push(n)},"addTask"),Vt=o(function(e){X.find(i=>i.id===Ht-1).events.push(e)},"addEvent"),Ft=o(function(e){let t={section:U,type:U,description:e,task:e,classes:[]};Q.push(t)},"addTaskOrg"),St=o(function(){let e=o(function(i){return X[i].processed},"compileTask"),t=!0;for(let[i,n]of X.entries())e(i),t=t&&n.processed;return t},"compileTasks"),Zt={clear:Mt,getCommonDb:Lt,getDirection:Ct,setDirection:At,addSection:Rt,getSections:Wt,getTasks:Pt,addTask:Bt,addTaskOrg:Ft,addEvent:Vt},zt=0,Y=o(function(e,t){let i=e.append("rect");return i.attr("x",t.x),i.attr("y",t.y),i.attr("fill",t.fill),i.attr("stroke",t.stroke),i.attr("width",t.width),i.attr("height",t.height),i.attr("rx",t.rx),i.attr("ry",t.ry),t.class!==void 0&&i.attr("class",t.class),i},"drawRect"),jt=o(function(e,t){let n=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 h(y){let g=at().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(h,"smile");function l(y){let g=at().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);y.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(l,"sad");function s(y){y.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 o(s,"ambivalent"),t.score>3?h(r):t.score<3?l(r):s(r),n},"drawFace"),qt=o(function(e,t){let i=e.append("circle");return i.attr("cx",t.cx),i.attr("cy",t.cy),i.attr("class","actor-"+t.pos),i.attr("fill",t.fill),i.attr("stroke",t.stroke),i.attr("r",t.r),i.class!==void 0&&i.attr("class",i.class),t.title!==void 0&&i.append("title").text(t.title),i},"drawCircle"),Ot=o(function(e,t){let i=t.text.replace(/<br\s*\/?>/gi," "),n=e.append("text");n.attr("x",t.x),n.attr("y",t.y),n.attr("class","legend"),n.style("text-anchor",t.anchor),t.class!==void 0&&n.attr("class",t.class);let r=n.append("tspan");return r.attr("x",t.x+t.textMargin*2),r.text(i),n},"drawText"),Jt=o(function(e,t){function i(r,h,l,s,y){return r+","+h+" "+(r+l)+","+h+" "+(r+l)+","+(h+s-y)+" "+(r+l-y*1.2)+","+(h+s)+" "+r+","+(h+s)}o(i,"genPoints");let n=e.append("polygon");n.attr("points",i(t.x,t.y,50,20,7)),n.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,Ot(e,t)},"drawLabel"),Qt=o(function(e,t,i){let n=e.append("g"),r=dt();r.x=t.x,r.y=t.y,r.fill=t.fill,r.width=i.width,r.height=i.height,r.class="journey-section section-type-"+t.num,r.rx=3,r.ry=3,Y(n,r),Gt(i)(t.text,n,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+t.num},i,t.colour)},"drawSection"),lt=-1,Yt=o(function(e,t,i,n){let r=t.x+i.width/2,h=e.append("g");lt++,h.append("line").attr("id",n+"-task"+lt).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"),jt(h,{cx:r,cy:300+(5-t.score)*30,score:t.score});let s=dt();s.x=t.x,s.y=t.y,s.fill=t.fill,s.width=i.width,s.height=i.height,s.class="task task-type-"+t.num,s.rx=3,s.ry=3,Y(h,s),Gt(i)(t.task,h,s.x,s.y,s.width,s.height,{class:"task"},i,t.colour)},"drawTask"),te=o(function(e,t){Y(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),ee=o(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),dt=o(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Gt=(function(){function e(r,h,l,s,y,g,x,f){let k=h.append("text").attr("x",l+y/2).attr("y",s+g/2+5).style("font-color",f).style("text-anchor","middle").text(r);n(k,x)}o(e,"byText");function t(r,h,l,s,y,g,x,f,k){let{taskFontSize:a,taskFontFamily:d}=f,c=r.split(/<br\s*\/?>/gi);for(let p=0;p<c.length;p++){let m=p*a-a*(c.length-1)/2,u=h.append("text").attr("x",l+y/2).attr("y",s).attr("fill",k).style("text-anchor","middle").style("font-size",a).style("font-family",d);u.append("tspan").attr("x",l+y/2).attr("dy",m).text(c[p]),u.attr("y",s+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),n(u,x)}}o(t,"byTspan");function i(r,h,l,s,y,g,x,f){let k=h.append("switch"),d=k.append("foreignObject").attr("x",l).attr("y",s).attr("width",y).attr("height",g).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,l,s,y,g,x,f),n(d,x)}o(i,"byFo");function n(r,h){for(let l in h)l in h&&r.attr(l,h[l])}return o(n,"_setTextAttrs"),function(r){return r.textPlacement==="fo"?i:r.textPlacement==="old"?e:t}})(),re=o(function(e,t){zt=0,lt=-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 ut(e,t){e.each(function(){var i=K(this),n=i.text().split(/(\s+|<br>)/).reverse(),r,h=[],l=1.1,s=i.attr("y"),y=parseFloat(i.attr("dy")),g=i.text(null).append("tspan").attr("x",0).attr("y",s).attr("dy",y+"em");for(let x=0;x<n.length;x++)r=n[n.length-1-x],h.push(r),g.text(h.join(" ").trim()),(g.node().getComputedTextLength()>t||r==="<br>")&&(h.pop(),g.text(h.join(" ").trim()),r==="<br>"?h=[""]:h=[r],g=i.append("tspan").attr("x",0).attr("y",s).attr("dy",l+"em").text(r))})}o(ut,"wrap");var ne=o(function(e,t,i,n,r,h=!1){let{theme:l,look:s}=n,y=l?.includes("redux"),g=n?.themeVariables?.THEME_COLOR_LIMIT??12,x=i%g-1,f=e.append("g");t.section=x,f.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+x));let k=f.append("g"),a=f.append("g"),c=a.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ut,t.width).node().getBBox(),p=n.fontSize?.replace?n.fontSize.replace("px",""):n.fontSize;if(t.height=c.height+p*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,a.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),y&&a.attr("transform",`translate(${t.width/2}, ${h?t.padding/2+3:t.padding})`),se(k,t,x,r,n),s==="neo"&&(f.attr("data-look","neo"),y)){let m=l.includes("dark"),u=e.node()?.ownerSVGElement??e.node(),w=K(u),b=w.attr("id")??"",I=b?`${b}-drop-shadow`:"drop-shadow";if(w.select(`#${I}`).empty()){let P=w.select("defs");(P.empty()?w.append("defs"):P).append("filter").attr("id",I).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",m?"0.2":"0.06").attr("flood-color",m?"#FFFFFF":"#000000")}}return t},"drawNode"),ie=o(function(e,t,i){let n=e.append("g"),h=n.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(ut,t.width).node().getBBox(),l=i.fontSize?.replace?i.fontSize.replace("px",""):i.fontSize;return n.remove(),h.height+l*1.1*.5+t.padding},"getVirtualNodeHeight"),se=o(function(e,t,i,n,r){let{theme:h}=r,l=h?.includes("redux")?0:5,s=5,y=l>0?`M0 ${t.height-s} v${-t.height+2*s} q0,-${l},${l},-${l} h${t.width-2*s} q${l},0,${l},${l} v${t.height-s} H0 Z`:`M0 ${t.height-s} v${-(t.height-s)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",n+"-node-"+zt++).attr("class","node-bkg node-"+t.type).attr("d",y),h?.includes("redux")||e.append("line").attr("class","node-line-"+i).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),C={drawRect:Y,drawCircle:qt,drawSection:Qt,drawText:Ot,drawLabel:Jt,drawTask:Yt,drawBackgroundRect:te,getTextObj:ee,getNoteRect:dt,initGraphics:re,drawNode:ne,getVirtualNodeHeight:ie},ae=o(function(e,t,i,n){let r=st(),{look:h,theme:l,themeVariables:s}=r,{useGradient:y,gradientStart:g,gradientStop:x}=s,f=r.timeline?.leftMargin??50;_.debug("timeline",n.db);let k=r.securityLevel,a;k==="sandbox"&&(a=K("#i"+t));let c=(k==="sandbox"?K(a.nodes()[0].contentDocument.body):K("body")).select("#"+t);c.append("g");let p=n.db.getTasks(),m=n.db.getCommonDb().getDiagramTitle();_.debug("task",p),C.initGraphics(c,t);let u=n.db.getSections();_.debug("sections",u);let w=0,b=0,I=0,P=0,B=50+f,G=50;P=50;let L=0,R=!0;u.forEach(function($){let v={number:L,descr:$,section:L,width:150,padding:20,maxHeight:w},T=C.getVirtualNodeHeight(c,v,r);_.debug("sectionHeight before draw",T),w=Math.max(w,T+20)});let E=0,A=0;_.debug("tasks.length",p.length);for(let[$,v]of p.entries()){let T={number:$,descr:v,section:v.section,width:150,padding:20,maxHeight:b},S=C.getVirtualNodeHeight(c,T,r);_.debug("taskHeight before draw",S),b=Math.max(b,S+20),E=Math.max(E,v.events.length);let H=0;for(let M of v.events){let N={descr:M,section:v.section,number:v.section,width:150,padding:20,maxHeight:50};H+=C.getVirtualNodeHeight(c,N,r)}v.events.length>0&&(H+=(v.events.length-1)*10),A=Math.max(A,H)}_.debug("maxSectionHeight before draw",w),_.debug("maxTaskHeight before draw",b),u&&u.length>0?u.forEach($=>{let v=p.filter(M=>M.section===$),T={number:L,descr:$,section:L,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:w};_.debug("sectionNode",T);let S=c.append("g"),H=C.drawNode(S,T,L,r,t);_.debug("sectionNode output",H),S.attr("transform",`translate(${B}, ${P})`),G+=w+50,v.length>0&&Et(c,v,L,B,G,b,r,E,A,w,!1,t),B+=200*Math.max(v.length,1),G=P,L++}):(R=!1,Et(c,p,L,B,G,b,r,E,A,w,!0,t));let V=c.node().getBBox();if(_.debug("bounds",V),m&&c.append("text").text(m).attr("x",h==="neo"?V.x*2+f:V.width/2-f).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),I=R?w+b+150:b+100,c.append("g").attr("class","lineWrapper").append("line").attr("x1",f).attr("y1",I).attr("x2",V.width+3*f).attr("y2",I).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),h==="neo"&&y&&l!=="neutral"){let $=c.select("defs"),T=($.empty()?c.append("defs"):$).append("linearGradient").attr("id",c.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",g).attr("stop-opacity",1),T.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}it(void 0,c,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),Et=o(function(e,t,i,n,r,h,l,s,y,g,x,f){for(let k of t){let a={descr:k.task,section:i,number:i,width:150,padding:20,maxHeight:h};_.debug("taskNode",a);let d=e.append("g").attr("class","taskWrapper"),p=C.drawNode(d,a,i,l,f).height;if(_.debug("taskHeight after draw",p),d.attr("transform",`translate(${n}, ${r})`),h=Math.max(h,p),k.events){let m=e.append("g").attr("class","lineWrapper"),u=h;r+=100,u=u+oe(e,k.events,i,n,r,l,f),r-=100,m.append("line").attr("x1",n+190/2).attr("y1",r+h).attr("x2",n+190/2).attr("y2",r+h+100+y+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${f}-arrowhead)`).attr("stroke-dasharray","5,5")}n=n+200,x&&!l.timeline?.disableMulticolor&&i++}r=r-10},"drawTasks"),oe=o(function(e,t,i,n,r,h,l){let s=0,y=r;r=r+100;for(let g of t){let x={descr:g,section:i,number:i,width:150,padding:20,maxHeight:50};_.debug("eventNode",x);let f=e.append("g").attr("class","eventWrapper"),a=C.drawNode(f,x,i,h,l,!0).height;s=s+a,f.attr("transform",`translate(${n}, ${r})`),r=r+10+a}return r=y,s},"drawEvents"),le={setConf:o(()=>{},"setConf"),draw:ae},tt=200,z=5,ce=tt+z*2,pt=tt+100,he=pt+z*2,Dt=10,de=0,Tt=20,Kt=20,$t=30,Ut=50,ue=o(function(e,t,i,n){let r=st(),h=r.timeline?.leftMargin??50;_.debug("timeline",n.db);let l=wt(t);l.append("g");let s=n.db.getTasks(),y=n.db.getCommonDb().getDiagramTitle();_.debug("task",s),C.initGraphics(l);let g=n.db.getSections();_.debug("sections",g);let x=0,f=0,k=50+h,a=50,d=a,c=k,p=ce+Kt,m=he+Ut,u=c+p,w=0,b=g&&g.length>0,I=b?u:k+p,P=Math.max(50,p+m-z*2);g.forEach(function($){let v={number:w,descr:$,section:w,width:P,padding:z,maxHeight:x},T=C.getVirtualNodeHeight(l,v,r);_.debug("sectionHeight before draw",T),x=Math.max(x,T)});let B=0;_.debug("tasks.length",s.length);for(let[$,v]of s.entries()){let T={number:$,descr:v,section:v.section,width:tt,padding:z,maxHeight:f},S=C.getVirtualNodeHeight(l,T,r);_.debug("taskHeight before draw",S),f=Math.max(f,S);let H=0;for(let M of v.events){let N={descr:M,section:v.section,number:v.section,width:pt,padding:z,maxHeight:50};H+=C.getVirtualNodeHeight(l,N,r)}v.events.length>0&&(H+=(v.events.length-1)*Dt),B=Math.max(B,H)+de}_.debug("maxSectionHeight before draw",x),_.debug("maxTaskHeight before draw",f);let L=Math.max(f,B)+$t;b?g.forEach($=>{let v=s.filter(O=>O.section===$),T={number:w,descr:$,section:w,width:P,padding:z,maxHeight:x};_.debug("sectionNode",T);let S=l.append("g"),H=C.drawNode(S,T,w,r);_.debug("sectionNode output",H);let M=I-p;S.attr("transform",`translate(${M}, ${a})`);let N=a+H.height+Tt;v.length>0&&Nt(l,v,w,I,N,f,r,L,!1);let et=v.length,Z=H.height+Tt+L*Math.max(et,1)-(et>0?$t*2:0);a+=Z,w++}):Nt(l,s,w,I,a,f,r,L,!0);let R=l.node()?.getBBox();if(!R)throw new Error("bbox not found");if(_.debug("bounds",R),y){if(l.append("text").text(y).attr("x",R.width/2-h).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),R=l.node()?.getBBox(),!R)throw new Error("bbox not found");_.debug("bounds after title",R)}let[E]=vt(r.fontSize),A=(E??16)*2,V=(E??16)*.5+20,D=l.append("g").attr("class","lineWrapper");D.append("line").attr("x1",I).attr("y1",d-A).attr("x2",I).attr("y2",R.y+R.height+V).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),D.lower(),it(void 0,l,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),Nt=o(function(e,t,i,n,r,h,l,s,y){for(let g of t){let x={descr:g.task,section:i,number:i,width:tt,padding:z,maxHeight:h};_.debug("taskNode",x);let f=e.append("g").attr("class","taskWrapper"),k=C.drawNode(f,x,i,l),a=k.height;_.debug("taskHeight after draw",a);let d=n-Kt-k.width;if(f.attr("transform",`translate(${d}, ${r})`),h=Math.max(h,a),g.events&&g.events.length>0){let c=r,p=n+Ut;pe(e,g.events,i,n,p,c,l)}r=r+s,y&&!l.timeline?.disableMulticolor&&i++}},"drawTasks"),pe=o(function(e,t,i,n,r,h,l){let s=h;for(let y of t){let g={descr:y,section:i,number:i,width:pt,padding:z,maxHeight:0};_.debug("eventNode",g);let x=e.append("g").attr("class","eventWrapper"),k=C.drawNode(x,g,i,l).height;x.attr("transform",`translate(${r}, ${s})`);let a=e.append("g").attr("class","lineWrapper"),d=s+k/2;a.append("line").attr("x1",n).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"),s=s+k+Dt}return s-h},"drawEvents"),ge={setConf:o(()=>{},"setConf"),draw:ue},fe=o(e=>{let{theme:t}=nt(),i=t?.includes("dark"),n=_t(t,e.borderColorArray),r=e.svgId?.replace(/^#/,"")??"",h=r?`url(#${r}-drop-shadow)`:e.dropShadow??"none",l="";for(let s=0;s<J(e.THEME_COLOR_LIMIT);s++){let y=`${17-3*s}`,g=n?e.borderColorArray[s%e.borderColorArray.length]:void 0,x=g??e.mainBkg,f=g??e.nodeBorder;l+=`
7
+ .section-${s-1} rect,
8
+ .section-${s-1} path,
9
+ .section-${s-1} circle {
10
+ fill: ${i&&n?e.mainBkg:x};
11
+ stroke: ${f};
12
+ stroke-width: ${e.strokeWidth};
13
+ filter: ${h};
14
+ }
15
+
16
+ .section-${s-1} text {
17
+ fill: ${e.nodeBorder};
18
+ font-weight: ${e.fontWeight}
19
+ }
20
+
21
+ .node-icon-${s-1} {
22
+ font-size: 40px;
23
+ color: ${e["cScaleLabel"+s]};
24
+ }
25
+
26
+ .section-edge-${s-1} {
27
+ stroke: ${e["cScale"+s]};
28
+ }
29
+
30
+ .edge-depth-${s-1} {
31
+ stroke-width: ${y};
32
+ }
33
+
34
+ .section-${s-1} line {
35
+ stroke: ${e["cScaleInv"+s]};
36
+ stroke-width: 3;
37
+ }
38
+
39
+ .lineWrapper line {
40
+ stroke: ${e.nodeBorder};
41
+ stroke-width:${e.strokeWidth}
42
+ }
43
+
44
+ .disabled,
45
+ .disabled circle,
46
+ .disabled text {
47
+ fill: ${e.tertiaryColor??"lightgray"};
48
+ }
49
+
50
+ .disabled text {
51
+ fill: ${e.clusterBorder??"#efefef"};
52
+ }
53
+ `}return l},"genReduxSections"),ye=o(e=>{let t="",i=J(e.THEME_COLOR_LIMIT);for(let n=0;n<i;n++)e["lineColor"+n]=e["lineColor"+n]??e["cScaleInv"+n],yt(e["lineColor"+n])?e["lineColor"+n]=mt(e["lineColor"+n],20):e["lineColor"+n]=xt(e["lineColor"+n],20);for(let n=0;n<i;n++){let r=""+(17-3*n);t+=`
54
+ .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path {
55
+ fill: ${e["cScale"+n]};
56
+ }
57
+ .section-${n-1} text {
58
+ fill: ${e["cScaleLabel"+n]};
59
+ }
60
+ .node-icon-${n-1} {
61
+ font-size: 40px;
62
+ color: ${e["cScaleLabel"+n]};
63
+ }
64
+ .section-edge-${n-1}{
65
+ stroke: ${e["cScale"+n]};
66
+ }
67
+ .edge-depth-${n-1}{
68
+ stroke-width: ${r};
69
+ }
70
+ .section-${n-1} line {
71
+ stroke: ${e["cScaleInv"+n]} ;
72
+ stroke-width: 3;
73
+ }
74
+
75
+ .lineWrapper line{
76
+ stroke: ${e["cScaleLabel"+n]} ;
77
+ }
78
+
79
+ .disabled, .disabled circle, .disabled text {
80
+ fill: ${e.tertiaryColor??"lightgray"};
81
+ }
82
+ .disabled text {
83
+ fill: ${e.clusterBorder??"#efefef"};
84
+ }
85
+ `}return t},"genSections"),me=o(e=>{let{theme:t}=nt(),i=t?.includes("redux"),n=t==="neutral",r=e.svgId?.replace(/^#/,"")??"",h="";if(e.useGradient&&r&&e.THEME_COLOR_LIMIT&&!n){let l=J(e.THEME_COLOR_LIMIT);for(let s=0;s<l;s++)h+=`
86
+ .section-${s-1}[data-look="neo"] rect,
87
+ .section-${s-1}[data-look="neo"] path,
88
+ .section-${s-1}[data-look="neo"] circle {
89
+ fill: ${e.mainBkg};
90
+ stroke: url(#${r}-gradient);
91
+ stroke-width: 2;
92
+ }
93
+ .section-${s-1}[data-look="neo"] line {
94
+ stroke: url(#${r}-gradient);
95
+ stroke-width: 2;
96
+ }`}return`
97
+ .edge {
98
+ stroke-width: 3;
99
+ }
100
+ ${i?fe(e):ye(e)}
101
+ ${h}
102
+ .section-root rect, .section-root path, .section-root circle {
103
+ fill: ${e.git0};
104
+ }
105
+ .section-root text {
106
+ fill: ${e.gitBranchLabel0};
107
+ }
108
+ .icon-container {
109
+ height:100%;
110
+ display: flex;
111
+ justify-content: center;
112
+ align-items: center;
113
+ }
114
+ .edge {
115
+ fill: none;
116
+ }
117
+ .eventWrapper {
118
+ filter: brightness(120%);
119
+ }
120
+ `},"getStyles"),xe=me,ke={setConf:o(()=>{},"setConf"),draw:o((e,t,i,n)=>(n?.db?.getDirection?.()??"LR")==="TD"?ge.draw(e,t,i,n):le.draw(e,t,i,n),"draw")},Ie={db:It,renderer:ke,parser:Xt,styles:xe};export{Ie as diagram};
@@ -0,0 +1 @@
1
+ import{a as e,b as r}from"./chunk-QYAXYFNI.js";import"./chunk-LT6LXKCR.js";import"./chunk-SQE76S5B.js";export{e as TreeViewModule,r as createTreeViewServices};
@@ -0,0 +1 @@
1
+ import{a as e,b as r}from"./chunk-QYTM6GY3.js";import"./chunk-LT6LXKCR.js";import"./chunk-SQE76S5B.js";export{e as TreemapModule,r as createTreemapServices};