@staticbolt/docs 0.0.1-beta.4 → 0.0.1-beta.5

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 (116) hide show
  1. package/README.md +2 -7
  2. package/lib/index.d.mts +35 -3
  3. package/lib/mermaid/abnfDiagram-PAR5IXJI-Ibbj5eGO.js +1 -0
  4. package/lib/mermaid/architecture-7GRP2DOG-M7G3SWCO-BJAoKIRD.js +1 -0
  5. package/lib/mermaid/architectureDiagram-2PNWDENW-CI3fLWIN.js +36 -0
  6. package/lib/mermaid/blockDiagram-PUWGUBOA-DAfWpjz7.js +129 -0
  7. package/lib/mermaid/c4Diagram-3NLNHZP5-at-f4FDi.js +38 -0
  8. package/lib/mermaid/chunk-2NMSUPJH-DuxvnX1p.js +1 -0
  9. package/lib/mermaid/chunk-32MCUW2P-D8U-Oy6M.js +206 -0
  10. package/lib/mermaid/chunk-3NPNU5GP-8WYybYAh.js +1 -0
  11. package/lib/mermaid/chunk-3SMGFRGC-C0WC5bhP.js +1 -0
  12. package/lib/mermaid/chunk-4CAJECRU-C_QnaDal.js +15 -0
  13. package/lib/mermaid/chunk-4OADUZ5Q-DHE3k_pb.js +10 -0
  14. package/lib/mermaid/chunk-5IMINLNL-Cl3N81sR.js +1 -0
  15. package/lib/mermaid/chunk-5IQCK5RY-Df5Ppxew.js +3 -0
  16. package/lib/mermaid/chunk-5MVFYWFU-DgXg5u6h.js +1 -0
  17. package/lib/mermaid/chunk-AQ6EADP3-CZhslHi-.js +1 -0
  18. package/lib/mermaid/chunk-AZZRMDJM-y-xJBuMz.js +15 -0
  19. package/lib/mermaid/chunk-CLS4B6BI-BRLlisnG.js +168 -0
  20. package/lib/mermaid/chunk-DZP67EKU-9RpG5Rdc.js +70 -0
  21. package/lib/mermaid/chunk-EICP7K5X-8YS1Gtlr.js +1 -0
  22. package/lib/mermaid/chunk-GDY2UAB4-QtXfmDIW.js +1 -0
  23. package/lib/mermaid/chunk-H7VHZCWX-CwFRFlEn.js +1 -0
  24. package/lib/mermaid/chunk-IJBDOHL6-CgcssvZb.js +1 -0
  25. package/lib/mermaid/chunk-JFFVMJIA-Cx1_ZSMR.js +1 -0
  26. package/lib/mermaid/chunk-JQRUD6KW-Dbva2Z17.js +1 -0
  27. package/lib/mermaid/chunk-JZGDI5JK-BspJQ1vQ.js +1 -0
  28. package/lib/mermaid/chunk-KD6SPIPN-4bKl37hM.js +2 -0
  29. package/lib/mermaid/chunk-NF366YI6-D1lnbapv.js +231 -0
  30. package/lib/mermaid/chunk-NUDPKBEF-CL0e9XiQ.js +34 -0
  31. package/lib/mermaid/chunk-OJINMHTS-rKnCIFV0.js +1 -0
  32. package/lib/mermaid/chunk-Q6NGPIAH-CM9NYxWM.js +2 -0
  33. package/lib/mermaid/chunk-QJSWEUOL-kvKBktmc.js +133 -0
  34. package/lib/mermaid/chunk-R7JDMUKV-CSyCOfYj.js +1 -0
  35. package/lib/mermaid/chunk-RCXAM2GK-BeKcutEV.js +1 -0
  36. package/lib/mermaid/chunk-RT4MAWR3-Cv_8LyN5.js +1 -0
  37. package/lib/mermaid/chunk-SFMINX4W-BW2NSwFJ.js +1 -0
  38. package/lib/mermaid/chunk-SLDQ463B-D15xTdNW.js +88 -0
  39. package/lib/mermaid/chunk-STOV2HOB-GnExfzIX.js +1 -0
  40. package/lib/mermaid/chunk-T5OCTHI4-DdZvN-9i.js +1 -0
  41. package/lib/mermaid/chunk-TCEHX7R3-BXjgPiQF.js +1 -0
  42. package/lib/mermaid/chunk-VQC2EELJ-sGo2yn97.js +1 -0
  43. package/lib/mermaid/chunk-VRZKL3EH-BzaZ6KlD.js +1 -0
  44. package/lib/mermaid/chunk-VTHDQ7BV-BqUEu5Ml.js +1 -0
  45. package/lib/mermaid/chunk-VY2OSTJR-BYk2nUI_.js +2 -0
  46. package/lib/mermaid/chunk-WUBWJARI-Z8MI6quX.js +1 -0
  47. package/lib/mermaid/chunk-YBMQ5JGJ-DlZ1nCKo.js +2 -0
  48. package/lib/mermaid/chunk-YDMLL4PJ-BHgx6nXf.js +1 -0
  49. package/lib/mermaid/chunk-Z6V44ARX-CWGOZvke.js +62 -0
  50. package/lib/mermaid/chunk-ZJJ7VQJP-CZ7qJzqZ.js +340 -0
  51. package/lib/mermaid/chunk-ZNLK7HRR-B-wIfXTw.js +1 -0
  52. package/lib/mermaid/chunk-ZQN7UHIL-CNp35E78.js +1 -0
  53. package/lib/mermaid/chunk-ZS6VBONO-D-IFTJgn.js +175 -0
  54. package/lib/mermaid/chunk-ZUNWM646-DRKPDcQl.js +1 -0
  55. package/lib/mermaid/classDiagram-FGAMPOII-D1sf64vv.js +1 -0
  56. package/lib/mermaid/classDiagram-v2-AI5RJEK4-D1sf64vv.js +1 -0
  57. package/lib/mermaid/cose-bilkent-Q72C2OJ3-iX90typn.js +1 -0
  58. package/lib/mermaid/cynefin-OW5HDTMX-6OCTWOGG-6jDAiaRu.js +1 -0
  59. package/lib/mermaid/cynefinDiagram-2OOWUY4M-5ACKe62t.js +62 -0
  60. package/lib/mermaid/dagre-MPVFI544-BUrJjGwd.js +4 -0
  61. package/lib/mermaid/diagram-AE4NWXFW-B3Lkw8MS.js +24 -0
  62. package/lib/mermaid/diagram-BUJID5UG-p2ajLLgr.js +41 -0
  63. package/lib/mermaid/diagram-C44CZ5NI-CO0U1GX-.js +24 -0
  64. package/lib/mermaid/diagram-EYOLEXXS-DDoUndBV.js +30 -0
  65. package/lib/mermaid/diagram-P7B6PWOJ-C_dSNQyG.js +3 -0
  66. package/lib/mermaid/ebnfDiagram-FTPZ3PV6-DIwB5te0.js +1 -0
  67. package/lib/mermaid/erDiagram-H3ERR26V-CN4pCzIq.js +99 -0
  68. package/lib/mermaid/eventmodeling-NTZA5JFV-WKSWQHFS-Ruta89_N.js +1 -0
  69. package/lib/mermaid/flowDiagram-YHGXBVSY-CrSHzFwR.js +1 -0
  70. package/lib/mermaid/ganttDiagram-RWFTB7ED-C-rfEOn5.js +292 -0
  71. package/lib/mermaid/gitGraph-4MIJSDKK-JH2HKYUO-B76vihW5.js +1 -0
  72. package/lib/mermaid/gitGraphDiagram-MAR6GKOP-peAd7EYO.js +106 -0
  73. package/lib/mermaid/index.js +15 -0
  74. package/lib/mermaid/info-A6RAGUB7-3TX3OFWW-DykwOJ0Z.js +1 -0
  75. package/lib/mermaid/infoDiagram-LV547AFH-C46dOKDG.js +2 -0
  76. package/lib/mermaid/ishikawaDiagram-PUJQGNDS-DUmHXvO9.js +70 -0
  77. package/lib/mermaid/journeyDiagram-EW5QJT4W-CNAhUHsQ.js +139 -0
  78. package/lib/mermaid/kanban-definition-JSQERAZB-uOEoksHt.js +89 -0
  79. package/lib/mermaid/katex-CZ4GXH2S-CaEE-8Xf.js +257 -0
  80. package/lib/mermaid/mindmap-definition-VBJCLQLM-DZceCWFq.js +96 -0
  81. package/lib/mermaid/packet-AYTQ26CC-MKII6P3Y-XqJQX7OO.js +1 -0
  82. package/lib/mermaid/pegDiagram-7WILOQTJ-DMKA8PUf.js +1 -0
  83. package/lib/mermaid/pie-WAS4IAKB-6B4OPMJ5-DpoRuAye.js +1 -0
  84. package/lib/mermaid/pieDiagram-EFA7CBSB-BzO4xw8C.js +39 -0
  85. package/lib/mermaid/quadrantDiagram-WARVYA7P-DMQd2xKZ.js +7 -0
  86. package/lib/mermaid/radar-RG4KPBEZ-UPTR3XUL-BcwE6tO1.js +1 -0
  87. package/lib/mermaid/railroad-74A4TZTK-MEFUPFMS-B2Kwx3Uk.js +1 -0
  88. package/lib/mermaid/railroad-abnf-HS5TGJTU-R5YG2S5D-uBY3fYzG.js +1 -0
  89. package/lib/mermaid/railroad-ebnf-LZEXJU2U-G5QEX2L6-AhpzdU_3.js +1 -0
  90. package/lib/mermaid/railroad-peg-WCYAUIDC-H5I2ZRY2-CrsmP7-8.js +1 -0
  91. package/lib/mermaid/railroadDiagram-5NIQVNLQ-BGyZ628g.js +1 -0
  92. package/lib/mermaid/requirementDiagram-SXREGOKZ-CtCO7u9U.js +84 -0
  93. package/lib/mermaid/sankeyDiagram-VV74M2VP-CPXqmSKK.js +40 -0
  94. package/lib/mermaid/sequenceDiagram-52ZFIFDL-B1rSqWZp.js +162 -0
  95. package/lib/mermaid/sizeCapture-FGA5AGYP-BEqQzsxs.js +1 -0
  96. package/lib/mermaid/stateDiagram-3QAKPIVI-3KzWPUq3.js +1 -0
  97. package/lib/mermaid/stateDiagram-v2-HN2P4RDZ-dXASbYMy.js +1 -0
  98. package/lib/mermaid/swimlanes-QLVP42QD-CLpR90IY.js +1 -0
  99. package/lib/mermaid/swimlanesDiagram-JKPDBFCN-C2sgVGQE.js +8 -0
  100. package/lib/mermaid/timeline-definition-GS45XAXW-DLn0_RV5.js +120 -0
  101. package/lib/mermaid/treeView-Q6P3EWNA-ZRJGANNQ-u1bD1sZ1.js +1 -0
  102. package/lib/mermaid/treemap-WGGIJYW6-K64VN5AS-DrIaTBlj.js +1 -0
  103. package/lib/mermaid/vennDiagram-QIQU2ZRJ-FxbUp7-Z.js +34 -0
  104. package/lib/mermaid/wardley-WFR3VGLG-D67OWCCH-Br9hyuFK.js +1 -0
  105. package/lib/mermaid/wardleyDiagram-U6YNM66N-l-Kvr0Az.js +78 -0
  106. package/lib/mermaid/xychartDiagram-XJAZEDNM-O9bztWNh.js +7 -0
  107. package/lib/plugins.mjs +73 -14
  108. package/package.json +4 -17
  109. package/sources/parts/document/document.part.html +5 -7
  110. package/sources/parts/header/header.part.html +2 -2
  111. package/sources/parts/header/header.style.css +4 -2
  112. package/sources/parts/mermaid/mermaid.part.html +1 -1
  113. package/sources/parts/pagefind/pagefind.part.html +5 -3
  114. package/sources/parts/sidebar/sidebar.style.css +10 -0
  115. package/sources/parts/table-of-content/table-of-content-desktop.part.html +2 -2
  116. package/sources/scripts/mermaid.ts +3 -1
@@ -0,0 +1 @@
1
+ import{t as e}from"./chunk-AQ6EADP3-CZhslHi-.js";import{q as t}from"./chunk-H7VHZCWX-CwFRFlEn.js";import"./chunk-QJSWEUOL-kvKBktmc.js";import"./chunk-4CAJECRU-C_QnaDal.js";import"./chunk-5IMINLNL-Cl3N81sR.js";import"./chunk-ZNLK7HRR-B-wIfXTw.js";import"./chunk-2NMSUPJH-DuxvnX1p.js";import"./chunk-STOV2HOB-GnExfzIX.js";import"./chunk-VY2OSTJR-BYk2nUI_.js";import"./chunk-DZP67EKU-9RpG5Rdc.js";import"./chunk-Z6V44ARX-CWGOZvke.js";import"./chunk-VRZKL3EH-BzaZ6KlD.js";import"./chunk-ZQN7UHIL-CNp35E78.js";import{l as n}from"./chunk-4OADUZ5Q-DHE3k_pb.js";import{t as r}from"./chunk-WUBWJARI-Z8MI6quX.js";var i=5,a=1e-5,o=1e-6;function s(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}e(s,`buildSegmentList`);function c(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,s=r.x-n.x,c=r.y-n.y,l=i*c-a*s;if(l===0)return null;let u=n.x-e.x,d=n.y-e.y,f=(u*c-d*s)/l,p=(u*a-d*i)/l;return f<=o||f>=1-o||p<=o||p>=1-o?null:{point:{x:e.x+f*i,y:e.y+f*a},tA:f,tB:p}}e(c,`segmentIntersection`);function l(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}e(l,`isHorizontalSeg`);function u(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=s(r.points);for(let a=n+1;a<e.length;a++){let n=e[a],o=s(n.points);for(let[e,a]of i.entries())for(let[i,s]of o.entries()){let o=c(a.a,a.b,s.a,s.b);if(!o)continue;let u=l(a);u!==l(s)&&u?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:o.tA,point:o.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:i,t:o.tB,point:o.point})}}}return t}e(u,`findEdgeIntersections`);function d(e){return`${Math.round(e*1e3)/1e3}`}e(d,`fmt`);function f(e){return`${d(e.x)},${d(e.y)}`}e(f,`pointToString`);function p(e){let t=e.b.x-e.a.x,n=e.b.y-e.a.y;return Math.abs(t)>=Math.abs(n)?+(t>=0):+(n>=0)}e(p,`getArcSweepFlag`);var m=.001;function h(e,t){if(e.length<2)return e.map(e=>({...e}));let r=e.map(e=>({...e})),i=t.arrowTypeStart&&n[t.arrowTypeStart];if(i){let t=e[0],n=e[1],a=Math.atan2(n.y-t.y,n.x-t.x);r[0].x=t.x+i*Math.cos(a),r[0].y=t.y+i*Math.sin(a)}let a=t.arrowTypeEnd&&n[t.arrowTypeEnd];if(a){let t=e.length,n=e[t-2],i=e[t-1],o=Math.atan2(i.y-n.y,i.x-n.x);r[t-1].x=i.x-a*Math.cos(o),r[t-1].y=i.y-a*Math.sin(o)}return r}e(h,`applyMarkerOffsets`);function g(e,t,n,r,i){let a=e.point.x,o=e.point.y,s={x:a-t*e.r,y:o-n*e.r},c={x:a+t*e.r,y:o+n*e.r},l=[`L${f(s)}`];return i===`arc`?l.push(`A${d(e.r)},${d(e.r)} 0 0 ${r} ${f(c)}`):l.push(`M${f(c)}`),l}e(g,`emitJump`);function _(e,t,n,r){let i=t.x-e.x,o=t.y-e.y,s=n.x-t.x,c=n.y-t.y,l=Math.hypot(i,o),u=Math.hypot(s,c);if(l<a||u<a)return null;let d=i/l,f=o/l,p=s/u,m=c/u,h=d*p+f*m,g=Math.acos(Math.max(-1,Math.min(1,h)));if(g<a||Math.abs(Math.PI-g)<a)return null;let _=Math.min(r/Math.sin(g/2),l/2,u/2);return{startX:t.x-d*_,startY:t.y-f*_,endX:t.x+p*_,endY:t.y+m*_,ctrlX:t.x,ctrlY:t.y,cutLen:_}}e(_,`computeRoundedCorner`);function v(e,t,n){let r=e.points;if(r.length<2)return``;let a=h(r,e),o=e.curve===`rounded`,c=s(a),l=new Map;for(let e of t){let t=c[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),i=l.get(e.segIndex)??[];i.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),l.set(e.segIndex,i)}let u=[`M${f(a[0])}`];for(let e=0;e<c.length;e++){let t=c[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),s=r===0?0:(t.b.x-t.a.x)/r,h=r===0?0:(t.b.y-t.a.y)/r,v=p(t),y=0;if(o&&e>0){let t=_(a[e-1],a[e],a[e+1]??a[e],i);t&&(y=t.cutLen)}let b=r,x=null;o&&e<c.length-1&&(x=_(a[e],a[e+1],a[e+2]??a[e+1],i),x&&(b=r-x.cutLen));let S=[...l.get(e)??[]].sort((e,t)=>e.t-t.t);for(let e of S)e.r=Math.min(e.r,e.d-y,b-e.d);for(let e=0;e<S.length-1;e++){let t=S[e+1].d-S[e].d;if(S[e].r+S[e+1].r>t){let n=t/2;S[e].r=Math.min(S[e].r,n),S[e+1].r=Math.min(S[e+1].r,n)}}for(let e of S)e.r<m||u.push(...g(e,s,h,v,n.jumpStyle));o&&x?(u.push(`L${d(x.startX)},${d(x.startY)}`),u.push(`Q${d(x.ctrlX)},${d(x.ctrlY)} ${d(x.endX)},${d(x.endY)}`)):u.push(`L${f(t.b)}`)}return u.join(` `)}e(v,`rewriteEdgePath`);function y(e){return/^[\d\s+,.LMelm-]*$/.test(e)}e(y,`isStraightPath`);function b(e){return!e||e===`linear`||e===`rounded`||e===`step`||e===`stepBefore`||e===`stepAfter`}e(b,`curveSupportsLineHops`);function x(e){if(!e)return null;try{let t=typeof atob==`function`?atob(e):Buffer.from(e,`base64`).toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&typeof e.x==`number`&&typeof e.y==`number`&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}e(x,`decodeDataPoints`);function S(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let i=new Map;for(let e of t)i.set(e.id,e);let a=[],o=new Map;for(let e of t){let t=typeof CSS<`u`&&CSS.escape?CSS.escape(e.id):e.id,n=r.querySelector(`path[data-id="${t}"]`);if(!n)continue;o.set(e.id,n);let i=x(n.getAttribute(`data-points`))??e.points;a.push({...e,points:i})}let s=u(a);if(s.length===0)return;let c=new Map;for(let e of s){let t=c.get(e.jumpEdgeId)??[];t.push(e),c.set(e.jumpEdgeId,t)}for(let e of a){let t=c.get(e.id);if(!t||t.length===0)continue;let r=i.get(e.id)?.curve;if(r!==void 0&&!b(r))continue;let a=o.get(e.id);if(!a||r===void 0&&!y(a.getAttribute(`d`)??``))continue;let s=a.getAttribute(`style`)??``,l=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(s),u=l?Number.parseFloat(l[1]):null,d=l?Number.parseFloat(l[2]):null,f=v(e,t,n);if(a.setAttribute(`d`,f),u!==null&&d!==null&&typeof a.getTotalLength==`function`){let e=a.getTotalLength(),t=`0 ${u} ${Math.max(0,e-u-d)} ${d}`,n=s.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,`;`);a.setAttribute(`style`,n)}}}e(S,`applyLineJumpsToSvg`);function C(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(n===!1)return;let r=n===`gap`?`gap`:`arc`,i=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));S(t.groups.edgePaths,i,{enabled:!0,jumpRadius:6,jumpStyle:r})}e(C,`applySwimlaneLineJumps`);var w=`__swimlane_default__`;function T(e){return Math.max(e.padding??20,20)}e(T,`topLaneHorizontalPadding`);function E(e){let{x:t,y:n,width:r,height:i}=e,a=e.swimlaneContentTop;if(typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||r<=0||i<=0){delete e.groupTitleRect;return}let o=n-i/2,s=Math.min(a,n+i/2),c=o+Math.min(21,Math.max(0,s-o));if(c<=o){delete e.groupTitleRect;return}e.groupTitleRect={left:t-r/2,right:t+r/2,top:o,bottom:c}}e(E,`assignTopLaneTitleRect`);function D(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape=`swimlane`,t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(r.length===0)return;let i=n.find(e=>e.id===w);i?i.isGroup&&(i.shape=`swimlane`,t&&(i.direction=t)):(i={id:w,label:``,isGroup:!0,shape:`swimlane`,padding:20,...t?{direction:t}:{}},n.push(i));for(let e of r)e.parentId=w}e(D,`prepareLayoutForSwimlanes`);function O(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e=typeof t.start==`string`?t.start:void 0,r=typeof t.end==`string`?t.end:void 0;!e||!r||t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t})}let r=e.nodes??[],i=r.filter(e=>e.isGroup),a=r.filter(e=>!e.isGroup);return{nodes:[...[...i].reverse(),...a].map(e=>e.id),edges:n,layout:e,nodeById:t}}e(O,`toGraphView`);function k(e,t,n,r){let{layout:i}=e,a=e.nodeById,o=r?.layerGap??100,s=r?.nodeGap??40,c=0;for(let e of t.layers){let t=0;for(let r of e){let e=a.get(r);if(!e){t++;continue}e.layer=c,e.order=t;let i=n.x[r]??t*s,l=n.y[r]??c*o;e.x=i,e.y=l,t++}c++}let l=i.nodes??[],u=new Map,d=[];for(let e of l){if(!e?.isGroup)continue;e.parentId||d.push(e);let t=l.filter(t=>t.parentId===e.id),r=1/0,i=-1/0,a=1/0,o=-1/0;for(let e of t){let t=e.x??n.x[e.id],s=e.y??n.y[e.id],c=e.width??0,l=e.height??0;t!=null&&s!=null&&(r=Math.min(r,t-c/2),i=Math.max(i,t+c/2),a=Math.min(a,s-l/2),o=Math.max(o,s+l/2))}if(r===1/0||a===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=e.parentId?t:2*T(e),s=t,c=Math.max(0,i-r)+n,l=Math.max(0,o-a)+s,d=(r+i)/2,f=(a+o)/2;e.x=d,e.y=f,e.width=c,e.height=l,u.set(e.id,{minX:r,maxX:i,minY:a,maxY:o})}}if(d.length>0&&u.size>0){let e=1/0,t=-1/0,n=0;for(let r of d){let i=r.padding??20;i>n&&(n=i);let a=u.get(r.id);a&&(e=Math.min(e,a.minY),t=Math.max(t,a.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),i=(e+t)/2;for(let t of d)t.y=i,t.height=r,t.swimlaneContentTop=e;let a=[...d].sort((e,t)=>(e.x??0)-(t.x??0)),o=[],s=[],c=[];for(let e of a){let t=u.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*T(e),r=(t.minX+t.maxX)/2;o.push(e.id),s.push(r),c.push(n)}let l=o.length;if(l>0){let e=new Map;if(l===1)e.set(o[0],c[0]);else{let t=[];for(let e=0;e<l-1;e++)t.push(s[e+1]-s[e]);let n=Array(l);n[0]=0;for(let e=0;e<l-1;e++)n[e+1]=2*t[e]-n[e];let r=0,i=1/0;for(let e=0;e<l;e++){let t=c[e];e%2==0?r=Math.max(r,t-n[e]):i=Math.min(i,n[e]-t)}let a=r;a=r<=i?(r+i)/2:r;for(let t=0;t<l;t++){let r=n[t]+(t%2==0?a:-a),i=Math.max(c[t],r);e.set(o[t],i)}}for(let t of d){let n=e.get(t.id);n!=null&&(t.width=n),E(t)}}}}}e(k,`writeBackToLayoutData`);var A=`[EdgeLabelNodes]`;function j(e){let n=[],r=[],i=new Map;for(let t of e.nodes)i.set(t.id,t);for(let a of e.edges){if(!a.label||a.label.length===0||a.isLayoutOnly||a.labelNodeId)continue;let e=a.start?i.get(a.start):void 0,o=a.end?i.get(a.end):void 0;if(!e||!o){t.warn(A,`Edge ${a.id} has missing source or target node`);continue}let s=`edge-label-${a.start}-${a.end}-${a.id}`,c=e.parentId===o.parentId?e.parentId:o.parentId,l={id:s,label:a.label,edgeStart:a.start??``,edgeEnd:a.end??``,shape:`labelRect`,width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??``,...e.dir?{dir:e.dir}:{}};n.push(l),a.labelNodeId=s,a.label=void 0,a.text=void 0;let u={id:`${a.id}-to-label`,start:a.start,end:s,type:`normal`,isLayoutOnly:!0},d={id:`${a.id}-from-label`,start:s,end:a.end,type:`normal`,isLayoutOnly:!0};r.push(u,d)}let a=[...e.nodes,...n],o=[...e.edges,...r];return{...e,nodes:a,edges:o}}e(j,`createEdgeLabelNodes`);function M(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0;return r>0&&i>0?{cx:t,cy:n,rect:U(t,n,r,i)}:void 0}e(M,`measuredNodeRect`);function ee(e){if(e.isGroup)return;let t=M(e);return t?{id:String(e.id??``),cx:t.cx,cy:t.cy,rect:t.rect}:void 0}e(ee,`nodeBoundsInfoFor`);function N(e,t,n=.001){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}e(N,`samePoint`);function P(e,t,n=.001){return Math.abs(e.x-t.x)<n}e(P,`sameX`);function F(e,t,n=.001){return Math.abs(e.y-t.y)<n}e(F,`sameY`);function I(e,t,n=.001){return F(e,t,n)&&Math.abs(e.x-t.x)>n}e(I,`isHorizontalSegment`);function L(e,t,n=.001){return P(e,t,n)&&Math.abs(e.y-t.y)>n}e(L,`isVerticalSegment`);function R(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}e(R,`overlapLength`);function z(e,t,n=.001){return e.horizontal&&t.horizontal&&F(e.a,t.a,n)?R(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&P(e.a,t.a,n)?R(e.a.y,e.b.y,t.a.y,t.b.y):0}e(z,`sameAxisSegmentOverlapLength`);function te(e,t=.001){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=I(i,a,t),s=L(i,a,t);(o||s)&&n.push({index:r,a:i,b:a,horizontal:o,vertical:s})}return n}e(te,`orthogonalSegmentsForPoints`);function B(e,t=.001){let n=te(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}e(B,`countOrthogonalBends`);function V(e,t=.001){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;(!e||!N(e,r,t))&&n.push({x:r.x,y:r.y})}return n}e(V,`dedupeConsecutivePoints`);function ne(e,t=.001){if(!e||e.length!==4)return;let[n,r,i,a]=e;return I(n,r,t)&&L(r,i,t)&&I(i,a,t)?{kind:`HVH`,p0:n,p1:r,p2:i,p3:a}:L(n,r,t)&&I(r,i,t)&&L(i,a,t)?{kind:`VHV`,p0:n,p1:r,p2:i,p3:a}:void 0}e(ne,`classifyThreeSegmentRoute`);function re(e,t,n,r=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return a>n.left-r&&i<n.right+r&&s>n.top-r&&o<n.bottom+r}e(re,`segmentBoundsOverlapRect`);function ie(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}e(ie,`pointInsideRect`);function ae(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}e(ae,`rectContainsRect`);function oe(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}e(oe,`rectsOverlap`);function H(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}e(H,`inflateRect`);function U(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}e(U,`rectFromCenterSize`);function W(e){return M(e)?.rect}e(W,`rectOfNodeBounds`);function se(e,t){switch(t){case`top`:return{x:e.cx,y:e.rect.top};case`bottom`:return{x:e.cx,y:e.rect.bottom};case`left`:return{x:e.rect.left,y:e.cy};case`right`:return{x:e.rect.right,y:e.cy}}}e(se,`portForRectSide`);function ce(e,t,n,r,i,a=.001){let o=t===`left`||t===`right`,s=r===`left`||r===`right`;if(o&&s){if(t===`right`&&r===`left`&&e.x<n.x||t===`left`&&r===`right`&&e.x>n.x){if(F(e,n,a))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(F(e,n,a))return;let r=t===`left`?Math.min(e.x,n.x)-i:Math.max(e.x,n.x)+i;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!o&&!s){if(t===r){if(P(e,n,a))return;let r=t===`top`?Math.min(e.y,n.y)-i:Math.max(e.y,n.y)+i;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!(t===`bottom`&&r===`top`&&e.y<n.y||t===`top`&&r===`bottom`&&e.y>n.y))return;if(P(e,n,a))return[e,n];let o=(e.y+n.y)/2;return[e,{x:e.x,y:o},{x:n.x,y:o},n]}if(o&&!s){let i=t===`right`&&n.x>e.x||t===`left`&&n.x<e.x,a=r===`top`&&e.y<n.y||r===`bottom`&&e.y>n.y;return i&&a?[e,{x:n.x,y:e.y},n]:void 0}let c=t===`bottom`&&n.y>e.y||t===`top`&&n.y<e.y,l=r===`left`&&e.x<n.x||r===`right`&&e.x>n.x;return c&&l?[e,{x:e.x,y:n.y},n]:void 0}e(ce,`buildOrthogonalPortPath`);function le(e,t,n,r){return t===`left`||t===`right`?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}e(le,`buildSameSideTrackPath`);function ue(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=ee(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}e(ue,`collectRealNodeBounds`);function G(e){let t=[],n=[];for(let r of e){let e=ee(r);if(!e)continue;let i={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(i):t.push(i)}return{realNodeRects:t,labelNodeRects:n}}e(G,`collectNodeRectEntries`);function de(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,i=r.y??0,a=r.width??0,o=r.height??0;n.push({nodeId:r.id,...U(e,i,a,o)})}return n}e(de,`collectLayoutNodeRects`);function fe(e,t,n=.001){let r=e.start,i=e.end;if(!r||!i)return;let a=t.get(r),o=t.get(i);if(!(!a||!o))return{srcId:r,dstId:i,srcInfo:a,dstInfo:o,collinearX:Math.abs(a.cx-o.cx)<n,collinearY:Math.abs(a.cy-o.cy)<n}}e(fe,`getNodePairGeometry`);function K(e,t,n,r=[],i=0){for(let a of n)if(!r.includes(a.id)&&re(e,t,a.rect,-i))return!0;return!1}e(K,`segmentHitsAnyRect`);function q(e,t,n,r,i=.001,a=1e-6){let o=F(e,t,i),s=P(e,t,i),c=F(n,r,i),l=P(n,r,i);if(o&&c||s&&l||!(o||s)||!(c||l))return!1;let u=o?{a:e,b:t}:{a:n,b:r},d=s?{a:e,b:t}:{a:n,b:r},f=u.a.y,p=Math.min(u.a.x,u.b.x),m=Math.max(u.a.x,u.b.x),h=d.a.x,g=Math.min(d.a.y,d.b.y),_=Math.max(d.a.y,d.b.y);if(h<p||h>m||f<g||f>_)return!1;let v=Math.abs(h-u.a.x)<a&&Math.abs(f-u.a.y)<a||Math.abs(h-u.b.x)<a&&Math.abs(f-u.b.y)<a,y=Math.abs(h-d.a.x)<a&&Math.abs(f-d.a.y)<a||Math.abs(h-d.b.x)<a&&Math.abs(f-d.b.y)<a;return!(v&&y)}e(q,`orthogonalSegmentsCross`);function pe(e,t,n,r,i=.001){let a=F(e,t,i),o=P(e,t,i),s=F(n,r,i),c=P(n,r,i);return o&&c&&P(e,n,i)?R(e.y,t.y,n.y,r.y)>i:a&&s&&F(e,n,i)?R(e.x,t.x,n.x,r.x)>i:!1}e(pe,`sameAxisSegmentsOverlap`);function me(e,t,n,r,{epsilon:i=.001,skipDegenerateOther:a=!1}={}){for(let o of n){if(o===r||o.isLayoutOnly)continue;let n=o.points;if(!(!n||n.length<2))for(let r=0;r<n.length-1;r++){let o=n[r],s=n[r+1];if(!(a&&N(o,s,i))&&(q(e,t,o,s,i)||pe(e,t,o,s,i)))return!0}}return!1}e(me,`segmentConflictsWithAnyEdge`);function he(e,t,n,r,i=.001){let a=F(e,t,i),o=P(e,t,i),s=F(n,r,i),c=P(n,r,i);if(!(a&&c||o&&s))return!1;let l=a?{a:e,b:t}:{a:n,b:r},u=a?{a:n,b:r}:{a:e,b:t},d=l.a.y,f=Math.min(l.a.x,l.b.x),p=Math.max(l.a.x,l.b.x),m=u.a.x,h=Math.min(u.a.y,u.b.y),g=Math.max(u.a.y,u.b.y);return m>f+i&&m<p-i&&d>h+i&&d<g-i}e(he,`orthogonalSegmentsStrictlyCross`);function ge(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return e>r+.001&&e<i-.001}e(ge,`strictlyBetween`);function _e(e,t,n){return P(e,t)&&P(t,n)?ge(t.y,e.y,n.y):F(e,t)&&F(t,n)?ge(t.x,e.x,n.x):!1}e(_e,`isCollinearIntermediate`);function ve(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=n[n.length-1],a=e[r],o=r+1<e.length?e[r+1]:void 0;if(i&&o){if(N(i,o)){r++,t=!0;continue}if(_e(i,a,o)){t=!0;continue}}n.push(a)}return{points:n,changed:t}}e(ve,`simplifyPolylineOnce`);function ye(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];if(!P(r,i)&&!F(r,i)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&P(e,r)?{x:r.x,y:i.y}:{x:i.x,y:r.y};t.push(n)}t.push(i)}let n=[];for(let e of t){let t=n[n.length-1];(!t||!N(t,e))&&n.push(e)}return n}e(ye,`orthogonalizePolyline`);function be(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=ve(t);if(t=e.points,!e.changed)break}return t}e(be,`simplifyPolyline`);var J=.001,xe=.5,Se=4;function Ce(e,t,n){let r=e;if(r.isLayoutOnly||!r.points||r.points.length<n)return;let i=r.start?t.get(r.start):void 0,a=r.end?t.get(r.end):void 0;return{edge:r,points:r.points,srcRect:i?W(i):void 0,dstRect:a?W(a):void 0}}e(Ce,`endpointContextFor`);function we(e,t,n){if(F(e,t,J))return{x:e.x<n.left?n.left:n.right,y:e.y};if(P(e,t,J)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}e(we,`segmentEnterPoint`);function Te(e,t,n){let r=n?1:-1,i=n?0:e.length-1;for(;i>=0&&i<e.length&&ie(e[i],t,xe);)i+=r;if(i<0||i>=e.length)return e;let a=i-r;if(a<0||a>=e.length)return e;let o=we(e[i],e[a],t);return n?[o,...e.slice(i)]:[...e.slice(0,i+1),o]}e(Te,`clipEndpoint`);function Ee(e,t){for(let n of e){let e=Ce(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=Te(r,e.srcRect,!0)),e.dstRect&&(r=Te(r,e.dstRect,!1)),r=be(ye(r)),r=Le(r,e.srcRect,e.dstRect),e.edge.points=be(ye(r))}}e(Ee,`clipEdgeEndpointsToNodeBoundaries`);function De(e,t,n,r=!1){if(F(e,t,J)){if(t.y<n.top-J||t.y>n.bottom+J)return t;if(r){if(e.x<n.left-J)return{x:n.left,y:e.y};if(e.x>n.right+J)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(P(e,t,J)){if(t.x<n.left-J||t.x>n.right+J)return t;if(r){if(e.y<n.top-J)return{x:e.x,y:n.top};if(e.y>n.bottom+J)return{x:e.x,y:n.bottom}}let i=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:i?n.top:n.bottom}}return t}e(De,`snapEndpointToBoundary`);function Oe(e,t,n){let r=e[t];for(let i=t+n;i>=0&&i<e.length;i+=n){let t=e[i];if(!N(t,r,J))return t}return e[t+n]}e(Oe,`firstDistinctAdjacent`);function ke(e,t){let n=e+Se,r=t-Se;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}e(ke,`cornerClearanceRange`);function Ae(e,t,n){let{lo:r,hi:i}=ke(t,n);return Math.min(i,Math.max(r,e))}e(Ae,`clampToCornerClearance`);function je(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}e(je,`intersectRanges`);function Me(e,t){return t===`left`||t===`right`?ke(e.top,e.bottom):ke(e.left,e.right)}e(Me,`clearanceRangeForSide`);function Ne(e,t,n){let r=e.y>=n.top-J&&e.y<=n.bottom+J,i=e.x>=n.left-J&&e.x<=n.right+J;if(F(e,t,J)&&r){if(Math.abs(e.x-n.left)<J)return`left`;if(Math.abs(e.x-n.right)<J)return`right`}if(P(e,t,J)&&i){if(Math.abs(e.y-n.top)<J)return`top`;if(Math.abs(e.y-n.bottom)<J)return`bottom`}}e(Ne,`terminalSideForSegment`);function Pe(e){return e===`left`||e===`right`}e(Pe,`isHorizontalSide`);function Fe(e,t,n,r,i){let a=[],o=n?Ne(e,t,n):void 0,s=r?Ne(t,e,r):void 0;return n&&o&&Pe(o)===i&&a.push(Me(n,o)),r&&s&&Pe(s)===i&&a.push(Me(r,s)),a.length>0?je(a):void 0}e(Fe,`straightClearanceRange`);function Ie(e,t,n,r,i){let a=Fe(e,t,n,r,i);if(!a)return;let o=i?e.y:e.x,s=Math.min(a.hi,Math.max(a.lo,o));if(!(Math.abs(s-o)<J))return i?[{x:e.x,y:s},{x:t.x,y:s}]:[{x:s,y:e.y},{x:s,y:t.y}]}e(Ie,`clearStraightEndpointCornerAxis`);function Le(e,t,n){if(e.length!==2)return e;let[r,i]=e;return F(r,i,J)?Ie(r,i,t,n,!0)??e:P(r,i,J)?Ie(r,i,t,n,!1)??e:e}e(Le,`clearStraightEndpointCornerConnections`);function Re(e,t,n){return Pe(n)?{x:e.x,y:Ae(e.y,t.top,t.bottom)}:{x:Ae(e.x,t.left,t.right),y:e.y}}e(Re,`cornerClearedEndpoint`);function ze(e,t,n,r,i,a){let o=e.map(e=>({...e}));for(let s=t;s>=0&&s<e.length;s+=n){let t=e[s];if(a&&!F(t,r,J)||!a&&!P(t,r,J))break;a?o[s].y=i.y:o[s].x=i.x}return o}e(ze,`moveCollinearEndpointRun`);function Be(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,i=n?1:-1,a=e[r],o=Oe(e,r,i);if(!o)return e;let s=Ne(a,o,t);if(!s)return e;let c=Pe(s),l=Re(a,t,s);return N(a,l,J)?e:ze(e,r,i,a,l,c)}e(Be,`clearEndpointCornerConnection`);function Ve(e,t,n){let r=Math.min(e.x,t.x)>=n.left-J&&Math.max(e.x,t.x)<=n.right+J,i=Math.min(e.y,t.y)>=n.top-J&&Math.max(e.y,t.y)<=n.bottom+J;if(Math.abs(e.y-n.top)<J&&Math.abs(t.y-n.top)<J&&r)return`top`;if(Math.abs(e.y-n.bottom)<J&&Math.abs(t.y-n.bottom)<J&&r)return`bottom`;if(Math.abs(e.x-n.left)<J&&Math.abs(t.x-n.left)<J&&i)return`left`;if(Math.abs(e.x-n.right)<J&&Math.abs(t.x-n.right)<J&&i)return`right`}e(Ve,`borderSideForSegment`);function He(e,t,n,r){switch(e){case`top`:return P(t,n,J)&&n.y<r.top-J;case`bottom`:return P(t,n,J)&&n.y>r.bottom+J;case`left`:return F(t,n,J)&&n.x<r.left-J;case`right`:return F(t,n,J)&&n.x>r.right+J}}e(He,`leavesOutward`);function Ue(e,t,n){if(e.length<3)return e;if(n){let n=Ve(e[0],e[1],t);return n&&He(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,i=Ve(e[r-1],e[r],t);return i&&He(i,e[r-1],e[r-2],t)?e.slice(0,r):e}e(Ue,`collapseOwnBorderStub`);function We(e,t,n){let r=e;if(t){let e=Oe(r,0,1);if(e){let n=De(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=Ue(r,t,!0)}if(n){let e=r.length-1,t=Oe(r,e,-1);if(t){let i=De(t,r[e],n,!0);i!==r[e]&&(r=[...r.slice(0,e),i])}r=Ue(r,n,!1)}let i=Le(r,t,n);return i!==r||r.length===2?i:(t&&(r=Be(r,t,!0)),n&&(r=Be(r,n,!1)),r)}e(We,`snapAndCollapseEndpoints`);function Ge(e,t){for(let n of e){let e=Ce(n,t,2);if(!e)continue;let r=We(V(e.points,J),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=i}}e(Ge,`prepareEdgeEndpointsForRenderer`);function Ke(e){return new Map(e.map(e=>[e.id,e]))}e(Ke,`buildNodeMap`);function qe(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}e(qe,`resolveTopLevelGroupId`);function Je(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}e(Je,`groupDepth`);function Ye(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e){let e=a.x,o=a.y;if(typeof e!=`number`||typeof o!=`number`)continue;let s=a.width??0,c=a.height??0;t=Math.min(t,e-s/2),n=Math.max(n,e+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}return t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:i}}e(Ye,`boundsForChildren`);function Xe(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}e(Xe,`applyGroupBounds`);function Ze(e){let t=Ke(e),n=e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>Je(n,t)-Je(e,t));for(let t of n){let n=Ye(e.filter(e=>e.parentId===t.id));n&&Xe(t,n)}}e(Ze,`recomputeNestedGroupBounds`);function Qe(t,n){let r=t.nodes??[],i=t.edges??[],a=r.filter(e=>!e.isGroup),o=1/0,s=-1/0;for(let e of a){let t=e[n];typeof t==`number`&&(o=Math.min(o,t),s=Math.max(s,t))}if(!Number.isFinite(o)||!Number.isFinite(s))return!1;let c=e(e=>o+s-e,`mirror`);for(let e of r){let t=e[n];typeof t==`number`&&(e[n]=c(t));let r=e.groupTitleRect;r&&(e.groupTitleRect=n===`x`?{...r,left:c(r.right),right:c(r.left)}:{...r,top:c(r.bottom),bottom:c(r.top)})}for(let e of i)for(let t of e.points??[])t[n]=c(t[n]);return!0}e(Qe,`mirrorAxis`);function $e(e){return!(e.nodes??[]).some(e=>!e.isGroup)||Qe(e,`y`)}e($e,`applyBtDirectionTransform`);function et(e,t=`LR`){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup),a=1/0,o=1/0;for(let e of i){let t=e.x??0,n=e.y??0;t<a&&(a=t),n<o&&(o=n)}if(!Number.isFinite(a)||!Number.isFinite(o))return!1;let s=0,c=0;for(let e of i)s+=e.width??0,c+=e.height??0;let l=s/i.length,u=c/i.length,d=u>0?Math.max(1,l/u):1;for(let e of i){let t=e.x??0,n=((e.y??0)-o)*d+36,r=t-a;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-o)*d+36,r=e-a;t.x=n,t.y=r}Ze(n);let f=n.filter(e=>e.isGroup&&!e.parentId);if(f.length===0)return t===`RL`&&Qe(e,`x`),!0;let p=Ke(n),m=new Map;for(let e of n){if(e.isGroup)continue;let t=qe(e,p);if(!t)continue;let n=m.get(t)??[];n.push(e),m.set(t,n)}let h=0;for(let e of f){let t=e.padding??0;t>h&&(h=t)}let g=[],_=1/0,v=-1/0;for(let e of f){let t=Ye(m.get(e.id)??[]);t&&(_=Math.min(_,t.minX),v=Math.max(v,t.maxX),g.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(_===1/0||v===-1/0)return!0;let y=Math.max(0,v-_)+2*Math.max(h,10),b=36+y,x=(_+v)/2-y/2-36,S=x+b/2,C=Math.max(h,36);g.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<g.length;e++){let t=g[e],n,r;if(n=e===0?t.contentTop-C:(g[e-1].contentBottom+t.contentTop)/2,e===g.length-1)r=t.contentBottom+C;else{let n=g[e+1];r=(t.contentBottom+n.contentTop)/2}let i=Math.max(0,r-n),a=(n+r)/2;t.lane.x=S,t.lane.y=a,t.lane.width=b,t.lane.height=i,t.lane.swimlaneContentTop=t.contentTop,t.lane.groupTitleRect={left:x,right:x+36,top:n,bottom:r}}return t===`RL`&&Qe(e,`x`),!0}e(et,`applyLrDirectionTransform`);var tt=1e-6,nt=8,rt=[0,nt,-nt,2*nt,-2*nt];function it(e,t){let{nodeInfoById:n,realNodeRects:r}=ue(t);for(let t of e){if(t.isLayoutOnly)continue;let i=t.points;if(!i||i.length<4)continue;let a=ne(V(i,tt),tt);if(!a)continue;let{p3:o}=a,s=a.kind===`HVH`,c=fe(t,n,tt);if(!c)continue;let{srcId:l,dstId:u,srcInfo:d,dstInfo:f,collinearX:p,collinearY:m}=c;if(p||m)continue;let h,g=d.rect;for(let n of rt){let i,a,c;if(s){let e=f.cy>d.cy?g.bottom:g.top,t=d.cx+n;if(t<=g.left+tt||t>=g.right-tt)continue;i={x:t,y:e},a={x:t,y:o.y},c={x:o.x,y:o.y}}else{let e=f.cx>d.cx?g.right:g.left,t=d.cy+n;if(t<=g.top+tt||t>=g.bottom-tt)continue;i={x:e,y:t},a={x:o.x,y:t},c={x:o.x,y:o.y}}let p=N(i,a,tt),m=N(a,c,tt);if(p&&m||!p&&K(i,a,r,[l],1)||!m&&K(a,c,r,[u],1))continue;let _=!p&&me(i,a,e,t,{epsilon:tt,skipDegenerateOther:!0}),v=!m&&me(a,c,e,t,{epsilon:tt,skipDegenerateOther:!0});if(!(_||v)){h=p?[a,c]:m?[i,a]:[i,a,c];break}}h&&(t.points=h)}}e(it,`portSwapToLShape`);function at(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values());for(let a of t){if(a.isLayoutOnly)continue;let o=a.points;if(!o||o.length<4)continue;let s=V(o,.001);if(s.length<4)continue;let c=s.length-1,l=s[c],u=s[c-1],d=s[c-2],f=l.x-u.x,p=l.y-u.y,m=Math.hypot(f,p);if(m>=10||m<.001)continue;let h=u.x-d.x,g=u.y-d.y;if(Math.hypot(h,g)<.001)continue;let _=I(u,l,.001),v=L(u,l,.001),y=I(d,u,.001),b=L(d,u,.001);if(!(_&&b||v&&y))continue;let x=a.end,S=a.start,C=x?n.get(x):void 0;if(!C)continue;let w=C.x??0,T=C.y??0,E=W(C);if(!E)continue;let D,O;if(b){let e=g<0;D={x:w,y:d.y},O={x:w,y:e?E.bottom:E.top}}else{let e=h>0;D={x:d.x,y:T},O={x:e?E.right:E.left,y:T}}if(K(D,O,r,x?[x]:[],-2)||K(D,O,i,[],-2))continue;if(S){let e=n.get(S),t=e?W(e):void 0;if(t&&ie(D,t,2))continue}let k=e((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,`ownSegmentKey`),A=new Set;for(let e=0;e<s.length-1;e++)A.add(k(s[e],s[e+1]));let j=e((e,n)=>{for(let r of t){if(r===a||r.isLayoutOnly)continue;let t=r.points;if(!(!t||t.length<2))for(let r=0;r<t.length-1;r++){let i=t[r],a=t[r+1];if(!A.has(k(i,a))&&he(e,n,i,a,.001))return!0}}return!1},`segmentCrossesOtherEdge`);if(j(D,O))continue;if(c-3>=0){let e=s[c-3],t=[S,x].filter(e=>!!e);if(K(e,D,r,t,-2)||j(e,D))continue}let M=[...s.slice(0,c-2),D,O];a.points=M;let ee=a.labelNodeId;if(ee){let e=n.get(ee);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let r,i,a=-1;for(let e=0;e<M.length-1;e++){let o=M[e],s=M[e+1],c=Math.hypot(s.x-o.x,s.y-o.y),l=F(o,s,.001),u=P(o,s,.001);(l&&c>=t+2||u&&c>=n+2)&&c>a&&(a=c,r=(o.x+s.x)/2,i=(o.y+s.y)/2)}r!==void 0&&i!==void 0&&(e.x=r,e.y=i)}}}}}e(at,`collapseShortTerminalStub`);var Y=.001,X=8,Z=te,ot=e((e,t)=>P(e,t,Y)||F(e,t,Y),`orthogonallyAligned`);function st(t,n){let r=e((e,t)=>{let n=e.x??0,r=e.y??0,i=t.x-n,a=t.y-r,o=(e.width??0)/2,s=(e.height??0)/2;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),{x:n+(a===0?0:s*i/a),y:r+s}):(i<0&&(o=-o),{x:n+o,y:r+(i===0?0:o*a/i)})},`rectIntersect`),i=e((e,t)=>{let i=V(e.points??[]);if(i.length<2)return;let a=t?e.start:e.end,o=a?n.get(a):void 0,s=o?W(o):void 0;if(!o||!a||!s)return;let c=t?i[0]:i[i.length-1],l=t?i[1]:i[i.length-2],u=r(o,c),d=c;if(ot(l,u)&&(d=l),P(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`V`,coord:u.x,min:Math.min(u.y,d.y),max:Math.max(u.y,d.y),boundary:u,railEnd:d,rect:s};if(F(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`H`,coord:u.y,min:Math.min(u.x,d.x),max:Math.max(u.x,d.x),boundary:u,railEnd:d,rect:s}},`terminalLaneFor`),a=e((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),`projectedOverlapLength`),o=e((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:e.orientation===`H`?(Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1)&&P(e.boundary,t.boundary,1):(Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1)&&F(e.boundary,t.boundary,1),`sameTerminalFace`),s=e((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:a(e,t)>=X&&Math.abs(e.coord-t.coord)<.5,`exactTerminalLaneConflict`),c=e((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||e.orientation!==`H`||e.atStart===t.atStart)return!1;let n=a(e,t);if(n<X)return!1;let r=e.rect.bottom-e.rect.top;return n<r||n>2*r?!1:o(e,t)&&Math.abs(e.coord-t.coord)<16},`nearTerminalLaneConflict`),l=e((t,n)=>{let r=V(t.edge.points??[]);if(r.length<2)return;let i=t.orientation===`V`?{x:t.boundary.x+n,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+n},a=t.orientation===`V`?{x:t.railEnd.x+n,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+n};if(!e(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?F(i,t.boundary,Y)&&i.x>=t.rect.left+1&&i.x<=t.rect.right-1:Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1?P(i,t.boundary,Y)&&i.y>=t.rect.top+1&&i.y<=t.rect.bottom-1:!1,`boundaryStaysOnSameFace`)())return;if(t.atStart){let e=r.length>1&&N(r[1],t.railEnd,Y),n=r.slice(e?2:1),o=n[0];return o&&!ot(o,a)?void 0:[i,a,...n]}let o=r.length>1&&N(r[r.length-2],t.railEnd,Y),s=r.slice(0,o?-2:-1),c=s[s.length-1];if(!(c&&!ot(c,a)))return[...s,a,i]},`shiftedCandidate`),u=e(e=>{let t=e.edge,r=V(t.points??[]);if(r.length!==2)return!1;let i=t.start,a=t.end,o=i?n.get(i):void 0,s=a?n.get(a):void 0;if(!o||!s)return!1;let c=o.x??0,l=o.y??0,u=s.x??0,d=s.y??0,[f,p]=r;return F(f,p,Y)&&Math.abs(l-d)<1&&Math.abs(c-u)>1||P(f,p,Y)&&Math.abs(c-u)<1&&Math.abs(l-d)>1},`laneIsStraightCollinearConnector`),d=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){let e=t.filter(e=>!e.isLayoutOnly).flatMap(e=>[i(e,!0),i(e,!1)]).filter(e=>!!e),n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){let a=e[t],o=e[r];if(a.edge===o.edge||!(s(a,o)||c(a,o)))continue;let f=!s(a,o),p=[a,o].sort((e,t)=>{let n=u(e),r=u(t);return n===r?+!t.atStart-!e.atStart:Number(n)-Number(r)});for(let t of p){for(let r of d){let a=l(t,r);if(!a)continue;let o=i({...t.edge,points:a},t.atStart);if(!(!o||e.some(e=>e.edge!==t.edge&&(s(o,e)||f&&c(o,e))))){t.edge.points=a,n=!0;break}}if(n)break}}if(!n)return}}e(st,`separateSharedRenderedTerminalLanes`);function ct(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values()),a=e((e,n)=>{let a=e.start,o=e.end,s=Z(n);if(s.length!==n.length-1)return!1;let c=[a,o].filter(e=>!!e);for(let e of s)if(K(e.a,e.b,r,c,-2)||K(e.a,e.b,i,[],-2))return!1;for(let n of t){if(n===e||n.isLayoutOnly)continue;let t=n.points;if(!(!t||t.length<2)){for(let e of s)for(let n of Z(V(t)))if(z(e,n,.5)>=X||he(e.a,e.b,n.a,n.b,Y))return!1}}return!0},`candidateIsSafe`),o=e((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=e[t+4],s=I(n,r)&&L(r,i)&&I(i,a)&&L(a,o)&&P(n,a,Y)&&P(n,o,Y)&&P(r,i,Y)&&(r.x-n.x)*(a.x-i.x)<0,c=L(n,r)&&I(r,i)&&L(i,a)&&I(a,o)&&F(n,a,Y)&&F(n,o,Y)&&F(r,i,Y)&&(r.y-n.y)*(a.y-i.y)<0;if(s||c)return V([...e.slice(0,t+1),o,...e.slice(t+5)]);if(t+5>=e.length)return;let l=e[t+5],u=L(n,r)&&I(r,i)&&L(i,a)&&I(a,o)&&L(o,l)&&P(n,o,Y)&&P(n,l,Y)&&P(i,a,Y)&&(i.x-r.x)*(o.x-a.x)<0,d=I(n,r)&&L(r,i)&&I(i,a)&&L(a,o)&&I(o,l)&&F(n,o,Y)&&F(n,l,Y)&&F(i,a,Y)&&(i.y-r.y)*(o.y-a.y)<0;if(!(!u&&!d))return V([...e.slice(0,t+1),l,...e.slice(t+6)])},`withoutDogleg`);for(let e=0;e<8;e++){let e=!1;for(let n of t){if(n.isLayoutOnly)continue;let t=V(n.points??[]);for(let r=0;r<=t.length-5;r++){let i=o(t,r);if(!(!i||!a(n,i))){n.points=i,e=!0;break}}if(e)break}if(!e)return}}e(ct,`collapseRedundantRectangularDoglegs`);function lt(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t,n)=>V(e===t?n??[]:e.points??[]),`pointsFor`),s=e((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)he(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),c=e(e=>{let t=Z(e);if(t.length!==3)return;let n=t[1];if(t[0].horizontal!==n.horizontal&&t[2].horizontal!==n.horizontal)return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},`middleRail`),l=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);return r.filter(e=>{if(n.includes(e.id))return!1;let r=e.rect;return t.horizontal?R(t.a.x,t.b.x,r.left,r.right)>=X&&t.a.y>=r.top-2&&t.a.y<=r.bottom+2:R(t.a.y,t.b.y,r.top,r.bottom)>=X&&t.a.x>=r.left-2&&t.a.x<=r.right+2})},`blockingRectsFor`),u=e((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else if(t.vertical)r[t.index].x=n,r[t.index+1].x=n;else return;let i=be(V(r));return Z(i).length===i.length-1?i:void 0},`candidateByMovingRail`),d=e((e,t,n)=>{let c=[e.start,e.end].filter(e=>!!e),l=Z(t);if(l.length!==t.length-1)return!1;for(let e of l)if(K(e.a,e.b,r,c,-2)||K(e.a,e.b,i,[],-2))return!1;for(let t of a)if(t!==e){for(let e of l)for(let n of Z(o(t)))if(z(e,n,.5)>=X)return!1}return s(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=s(),t=!1;for(let n of a){let r=o(n),i=c(r);if(!i)continue;let a=l(n,i.segment);if(a.length===0)continue;let s=i.horizontal?[Math.min(...a.map(e=>e.rect.top))-20,Math.max(...a.map(e=>e.rect.bottom))+20]:[Math.min(...a.map(e=>e.rect.left))-20,Math.max(...a.map(e=>e.rect.right))+20];for(let a of s){let o=u(r,i.segment,a);if(!(!o||!d(n,o,e))){n.points=o,t=!0;break}}if(t)break}if(!t)return}}e(lt,`liftObstacleHuggingSameSideRails`);function ut(t,n){let r=e(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=e(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,n=typeof t==`string`?t.toUpperCase():``;if(n===`LR`||n===`RL`||n===`BT`)return;let i=r(e),a=e.y,o=e.height;if(!i||typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o)||o<=0)return;let s=i.right-i.left,c=i.bottom-i.top;if(!(c<=0||s<c))return{node:e,rect:i}},`topLaneTitleFor`),a=e((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:R(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),o=[...n.values()].map(i).filter(e=>!!e);if(o.length===0)return;let s=0;for(let e of t){if(e.isLayoutOnly)continue;let t=V(e.points??[]);for(let e of Z(t))for(let t of o)a(e,t.rect)&&(s=Math.max(s,t.rect.bottom-e.a.y+4))}if(!(s<=Y))for(let e of o){let t=e.node.y,n=e.node.height;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.y=t-s/2,e.node.height=n+s,e.node.groupTitleRect={...e.rect,top:e.rect.top-s,bottom:e.rect.bottom-s})}}e(ut,`liftTopLaneTitleBandsAboveRails`);function dt(t,n){let r=e(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=e(e=>{if(!e.isGroup||e.parentId||e.direction!==`LR`)return;let t=r(e),n=e.x,i=e.width;if(!t||typeof n!=`number`||typeof i!=`number`||!Number.isFinite(n)||!Number.isFinite(i)||i<=0)return;let a=t.right-t.left,o=t.bottom-t.top;if(!(a<=0||o<a))return{node:e,rect:t}},`leftLaneTitleFor`),a=e((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return n<=t.left+Y||n>=t.right-Y?!1:R(e.a.y,e.b.y,t.top,t.bottom)>=X},`verticalSegmentIntersectsTitle`),o=e((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:R(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),s=[...n.values()].map(i).filter(e=>!!e);if(s.length===0)return;let c=0;for(let e of t){if(e.isLayoutOnly)continue;let t=V(e.points??[]);for(let e of Z(t))for(let t of s)if(a(e,t.rect))c=Math.max(c,t.rect.right-e.a.x+4);else if(o(e,t.rect)){let n=Math.min(e.a.x,e.b.x);c=Math.max(c,t.rect.right-n+4)}}if(!(c<=Y))for(let e of s){let t=e.node.x,n=e.node.width;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.x=t-c/2,e.node.width=n+c,e.node.groupTitleRect={...e.rect,left:e.rect.left-c,right:e.rect.right-c})}}e(dt,`shiftLeftLaneTitleBandsLeftOfRails`);function ft(t,n){let{realNodeRects:r}=G(n.values()),i=t.filter(e=>!e.isLayoutOnly),a=e((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),o=e((e=new Map)=>{let t=0;for(let n=0;n<i.length;n++){let r=Z(a(i[n],e));for(let o=n+1;o<i.length;o++){let n=Z(a(i[o],e));for(let e of r)for(let r of n)he(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`crossingCount`),s=e((e=new Map)=>i.reduce((t,n)=>t+B(a(n,e)),0),`totalBends`),c=e(e=>{let t=a(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(!(!I(n,r,Y)&&!L(n,r,Y)))return{tailStart:n,terminal:r}},`terminalTailFor`),l=e((e,t)=>{let n=a(e);if(n.length<3)return;let r=n[0],i=n[1],o;if(I(r,i,Y))o={x:i.x,y:t.tailStart.y};else if(L(r,i,Y))o={x:t.tailStart.x,y:i.y};else return;let s=be(V([r,i,o,t.tailStart,t.terminal]));return Z(s).length===s.length-1?s:void 0},`candidateWithDestinationTail`),u=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(K(e.a,e.b,r,n,-2))return!0;return!1},`pathHasNodeHit`),d=e((e,t,n)=>{for(let r of i)if(r!==e){for(let e of Z(t))for(let t of Z(a(r,n)))if(z(e,t,.5)>=X)return!0}return!1},`pathHasSharedTrack`),f=e((e,t,n)=>!u(e,t)&&!d(e,t,n),`candidateIsSafe`),p=e(()=>{let e=new Map;for(let t of i){let r=t.end;if(!r||!n.has(r)||a(t).length<4)continue;let i=e.get(r)??[];i.push(t),e.set(r,i)}return e},`edgesByDestination`);for(let e=0;e<4;e++){let e=o();if(e===0)return;let t=s(),n,r=e,i=t;for(let t of p().values())for(let a=0;a<t.length;a++)for(let u=a+1;u<t.length;u++){let d=t[a],p=t[u],m=c(d),h=c(p);if(!m||!h)continue;let g=l(d,h),_=l(p,m);if(!g||!_)continue;let v=new Map([[d,g],[p,_]]);if(!f(d,g,v)||!f(p,_,v))continue;let y=o(v),b=s(v);y>=e||y>r||y===r&&b>=i||(n=v,r=y,i=b)}if(!n)return;for(let[e,t]of n)e.points=t}}e(ft,`swapDestinationTerminalTailsToReduceCrossings`);function pt(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),s=e((e=new Map)=>{let t=0;for(let n=0;n<a.length;n++){let r=Z(o(a[n],e));for(let i=n+1;i<a.length;i++){let n=Z(o(a[i],e));for(let e of r)for(let r of n)he(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`strictCrossingCount`),c=e((e=new Map)=>a.reduce((t,n)=>t+B(o(n,e)),0),`totalBends`),l=e(e=>{let t=e.start,r=e.end,i=t?n.get(t):void 0,a=r?n.get(r):void 0,o=i?W(i):void 0,s=a?W(a):void 0;return o&&s?{src:o,dst:s}:void 0},`endpointRectsFor`),u=e((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=l(e);if(r){if(n.vertical){let i=n.a.x,a=Math.min(r.src.left,r.dst.left),o=Math.max(r.src.right,r.dst.right),s=i<a-Y?`left`:i>o+Y?`right`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`vertical`,side:s,coord:i,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}:void 0}if(n.horizontal){let i=n.a.y,a=Math.min(r.src.top,r.dst.top),o=Math.max(r.src.bottom,r.dst.bottom),s=i<a-Y?`top`:i>o+Y?`bottom`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`horizontal`,side:s,coord:i,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}:void 0}}},`externalRailForSegment`),d=e(()=>{let e=[];for(let t of a){let n=o(t);for(let r of Z(n)){let i=u(t,n,r);i&&e.push(i)}}return e},`collectExternalRails`),f=e((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&R(e.min,e.max,t.min,t.max)>=X,`railsInteract`),p=e(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let i=[r],a=[];for(n.add(r);i.length>0;){let t=i.pop();a.push(t);for(let r of e)!n.has(r)&&f(t,r)&&(n.add(r),i.push(r))}a.length>1&&t.push(a)}return t},`connectedComponents`),m=e(e=>{let t=[];for(let n of e)t.some(e=>Math.abs(e-n.coord)<Y)||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),i=e[0].side;t.push(i===`left`||i===`top`?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},`uniqueCoordsFor`),h=e(t=>{let n=t.map(e=>e.coord),r=m(t),i=[];if(t.length<=6){let a=Array(r.length).fill(!1),o=[],s=e(()=>{if(o.length===t.length){o.some((e,t)=>Math.abs(e-n[t])>=Y)&&i.push([...o]);return}for(let[e,t]of r.entries())a[e]||(a[e]=!0,o.push(t),s(),o.pop(),a[e]=!1)},`visit`);return s(),i}for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let r=[...n];[r[e],r[t]]=[r[t],r[e]],i.push(r)}return i},`coordinateAssignmentsFor`),g=e((e,t)=>{let n=new Map;for(let[r,i]of e.entries()){let e=t[r],a=n.get(i.edge)??i.points.map(e=>({x:e.x,y:e.y}));i.axis===`vertical`?(a[i.segmentIndex].x=e,a[i.segmentIndex+1].x=e):(a[i.segmentIndex].y=e,a[i.segmentIndex+1].y=e),n.set(i.edge,a)}let r=new Map;for(let[e,t]of n){let n=be(V(t));if(Z(n).length!==n.length-1)return;r.set(e,n)}return r},`replacementsForAssignment`),_=e(e=>{for(let[t,n]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of Z(n))if(K(t.a,t.b,r,e,-2)||K(t.a,t.b,i,[],-2))return!1}for(let t=0;t<a.length;t++){let n=a[t],r=e.has(n),i=Z(o(n,e));for(let n=t+1;n<a.length;n++){let t=a[n];if(!r&&!e.has(t))continue;let s=Z(o(t,e));for(let e of i)for(let t of s)if(z(e,t,.5)>=X)return!1}}return!0},`candidateIsSafe`);for(let e=0;e<4;e++){let e=s();if(e===0)return;let t,n=e,r=c(),i=1/0;for(let a of p(d()))for(let o of h(a)){let l=g(a,o);if(!l||!_(l))continue;let u=s(l);if(u>=e)continue;let d=c(l),f=a.reduce((e,t,n)=>e+Math.abs(o[n]-t.coord),0);u>n||u===n&&(d>r||d===r&&f>=i)||(t=l,n=u,r=d,i=f)}if(!t)return;for(let[e,n]of t)e.points=n}}e(pt,`reassignCrossingExternalRailChannels`);function mt(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t,n)=>V(e===t?n??[]:e.points??[]),`pointsFor`),s=e(e=>Z(e).reduce((e,t)=>{let n=t.a.x-t.b.x,r=t.a.y-t.b.y;return e+Math.hypot(n,r)},0),`pathLength`),c=e((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)he(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),l=e((e,t)=>{if(e.horizontal){let n=e.a.y;return(Math.abs(n-t.top)<1||Math.abs(n-t.bottom)<1)&&R(e.a.x,e.b.x,t.left,t.right)>=X}if(e.vertical){let n=e.a.x;return(Math.abs(n-t.left)<1||Math.abs(n-t.right)<1)&&R(e.a.y,e.b.y,t.top,t.bottom)>=X}return!1},`segmentRunsAlongRectBorder`),u=e(e=>{let t=[e.start,e.end].filter(e=>!!e),r=[];for(let e of t){let t=n.get(e),i=t?W(t):void 0;i&&r.push(i)}return r},`endpointRectsFor`),d=e((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=I(n,r,Y)&&L(r,i,Y)&&I(i,a,Y),s=L(n,r,Y)&&I(r,i,Y)&&L(i,a,Y);if(!o&&!s||!(o?Math.sign(r.x-n.x)!==Math.sign(a.x-i.x):Math.sign(r.y-n.y)!==Math.sign(a.y-i.y)))return[];let c=P(n,a,Y)||F(n,a,Y)?[]:[{x:n.x,y:a.y},{x:a.x,y:n.y}],l=c.length===0?[[...e.slice(0,t+1),...e.slice(t+3)]]:c.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),u=new Set;return l.map(e=>be(V(e))).filter(e=>{if(Z(e).length!==e.length-1||!e.some(e=>N(e,a,Y)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return!u.has(t)&&(u.add(t),!0)})},`shortcutCandidatesAt`),f=e((e,t,n)=>{let s=[e.start,e.end].filter(e=>!!e),d=u(e);for(let e of Z(t))if(K(e.a,e.b,r,s,-2)||K(e.a,e.b,i,[],-2)||d.some(t=>l(e,t)))return!1;for(let n of a)if(n!==e){for(let e of Z(t))for(let t of Z(o(n)))if(z(e,t,.5)>=X)return!1}return c(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=c(),t,n,r=e,i=1/0,l=1/0;for(let u of a){let a=o(u),p=B(a,Y),m=s(a);for(let o=0;o<=a.length-4;o++)for(let h of d(a,o)){let a=B(h,Y),o=s(h);if(!(a<p||a===p&&o<m-Y)||!f(u,h,e))continue;let d=c(u,h);d>r||d===r&&(a>i||a===i&&o>=l)||(t=u,n=h,r=d,i=a,l=o)}}if(!t||!n)return;t.points=n}}e(mt,`shortcutRedundantOrthogonalJogs`);function ht(t,n){let r=[];for(let e of n.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,n=e.y??0,i=W(e);i&&r.push({id:String(e.id??``),cx:t,cy:n,rect:i})}if(r.length===0)return;let i=new Map(r.map(e=>[e.id,e])),a=r.map(e=>({id:e.id,rect:e.rect})),o=[`top`,`bottom`,`left`,`right`],s={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},c=t.filter(e=>!e.isLayoutOnly),l=new Map(c.map((e,t)=>[e,t])),u=e(e=>{let t=e===`left`||e===`top`?-1:1,n=[];for(let r=0;r<=2;r++)n.push(s[e]+t*20*r);return n},`outwardTracksForSide`),d=e((e,t=new Map)=>V(t.get(e)??e.points??[]),`replacementPointsFor`),f=e((e,t)=>{let n=0;for(let r of e)for(let e of t)he(r.a,r.b,e.a,e.b,Y)&&n++;return n},`crossingCountBetweenSegments`),p=e((e,t)=>f(Z(e),Z(t)),`crossingCountBetweenPaths`),m=e((t=new Map)=>{let n=0,r=[],i=new Set,a=[],o=e(e=>{i.has(e)||(i.add(e),a.push(e))},`addEdge`);for(let e=0;e<c.length;e++){let i=c[e],a=d(i,t);for(let s=e+1;s<c.length;s++){let e=c[s],l=p(a,d(e,t));l>0&&(n+=l,r.push({first:i,second:e,count:l}),o(i),o(e))}}return a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),{count:n,pairs:r,edgeSet:i,edges:a}},`crossingSnapshot`),h=e((e,t)=>{let n=new Set(t.keys());if(n.size===0)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let i=0;for(let e=0;e<c.length;e++){let r=c[e],a=n.has(r),o=d(r,t);for(let r=e+1;r<c.length;r++){let e=c[r];!a&&!n.has(e)||(i+=p(o,d(e,t)))}}return e.count-r+i},`crossingCountWithReplacements`),g=e(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let i of e.edges){if(r.has(i))continue;let e=[i],a=[];for(r.add(i);e.length>0;){let n=e.pop();a.push(n);for(let i of t.get(n)??[])r.has(i)||(r.add(i),e.push(i))}a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),a.length>1&&n.push(a)}return n},`crossingComponents`),_=e(e=>[e.start,e.end].filter(e=>!!e),`endpointIdsFor`),v=e(e=>{let t=[];for(let n of g(e)){let e=new Set(n),r=new Set(n.flatMap(e=>_(e))),i=[...n];for(let t of c)e.has(t)||_(t).some(e=>r.has(e))&&i.push(t);i.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),t.push(i)}return t},`pairSearchGroups`),y=e((e,t,n)=>h(e,new Map([[t,n]])),`crossingCountWithSingleReplacement`),b=e(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},`currentCrossingsByEdge`),x=e(e=>e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.abs(n.x-i.x)+Math.abs(n.y-i.y)},0),`pathLength`),S=e((e=new Map)=>c.reduce((t,n)=>t+B(d(n,e)),0),`totalBends`),C=e((e=new Map)=>c.reduce((t,n)=>t+x(d(n,e)),0),`totalLength`),w=e((e,t,n=new Map)=>{let r=Z(t);for(let t of c)if(t!==e){for(let e of r)for(let r of Z(d(t,n)))if(z(e,r,.5)>=X)return!0}return!1},`pathHasSegmentConflict`),T=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(K(e.a,e.b,a,n,-2))return!0;return!1},`pathHitsNode`),E=e((e,t)=>{let n=be(V(t));Z(n).length===n.length-1&&e.push(n)},`pushOrthogonalCandidate`),D=e(e=>e===`left`||e===`right`,`sideIsHorizontal`),O=e((e,t,n)=>{switch(t){case`left`:return Math.min(e.x,n.x)-20;case`right`:return Math.max(e.x,n.x)+20;case`top`:return Math.min(e.y,n.y)-20;case`bottom`:return Math.max(e.y,n.y)+20}},`localTrackForSameSide`),k=e((e,t,n,r)=>{let i=n===`left`||n===`top`?-1:1,a=[O(t,n,r),s[n]];for(let o of a)for(let a=0;a<=2;a++)E(e,le(t,n,r,o+i*20*a))},`addSameSideCandidates`),A=e((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))E(e,[t,{x:a,y:t.y},{x:a,y:n},{x:r.x,y:n},r])},`addHorizontalToVerticalCandidates`),j=e((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))E(e,[t,{x:t.x,y:a},{x:n,y:a},{x:n,y:r.y},r])},`addVerticalToHorizontalCandidates`),M=e((e,t,n,r,i)=>{let a=[...u(`top`),...u(`bottom`)];for(let o of u(n))for(let n of u(i))for(let i of a)E(e,[t,{x:o,y:t.y},{x:o,y:i},{x:n,y:i},{x:n,y:r.y},r])},`addHorizontalPairCandidates`),ee=e((e,t,n,r,i)=>{let a=[...u(`left`),...u(`right`)];for(let o of u(n))for(let n of u(i))for(let i of a)E(e,[t,{x:t.x,y:o},{x:i,y:o},{x:i,y:n},{x:r.x,y:n},r])},`addVerticalPairCandidates`),N=e(e=>{let t=new Set;return e.map(e=>V(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return t.has(n)||e.length<2?!1:(t.add(n),!0)})},`dedupeCandidatePaths`),P=e((e,t,n,r)=>{let i=[],a=ce(e,t,n,r,20,Y);a&&E(i,a),t===r&&k(i,e,t,n);let o=D(t),s=D(r);return o&&!s?A(i,e,t,n,r):!o&&s?j(i,e,t,n,r):o?M(i,e,t,n,r):ee(i,e,t,n,r),N(i)},`buildCandidatesForSides`),F=e((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=se(r,s),c=s===`top`||s===`bottom`?u(s):a;for(let r of i){E(e,[t,n,{x:r,y:n.y},{x:r,y:o.y},o]);for(let i of c)E(e,[t,n,{x:r,y:n.y},{x:r,y:i},{x:o.x,y:i},o])}}},`addVerticalDepartureOuterTrackCandidates`),R=e((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=se(r,s),c=s===`left`||s===`right`?u(s):i;for(let r of a){E(e,[t,n,{x:n.x,y:r},{x:o.x,y:r},o]);for(let i of c)E(e,[t,n,{x:n.x,y:r},{x:i,y:r},{x:i,y:o.y},o])}}},`addHorizontalDepartureOuterTrackCandidates`),te=e(e=>{let t=e.start,n=e.end,r=n?i.get(n):void 0;if(!t||!r)return[];let a=V(e.points??[]);if(a.length<4)return[];let o=a[0],s=a[1],c=[];return L(o,s,Y)?F(c,o,s,r):I(o,s,Y)&&R(c,o,s,r),c},`terminalPreservingOuterTrackCandidates`),ne=e(e=>{let t=e.start,n=e.end,r=t?i.get(t):void 0,a=n?i.get(n):void 0;if(!r||!a)return[];let s=[];for(let e of o){let t=se(r,e);for(let n of o)s.push(...P(t,e,se(a,n),n))}return s.push(...te(e)),s},`candidatePathsFor`),re=e(()=>new Map(c.map(e=>[e,Z(d(e))])),`currentSegmentsByEdge`),ie=e((e,t,n)=>{let r=new Set;for(let i of c){if(i===e)continue;let a=n.get(i)??Z(d(i));t.some(e=>a.some(t=>z(e,t,.5)>=X))&&r.add(i)}return r},`sharedTrackConflictsFor`),ae=e((e,t,n,r)=>{let i=new Set;return ne(e).map(e=>be(V(e))).filter(t=>{if(T(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return i.has(n)||t.length<2?!1:(i.add(n),!0)}).map(i=>{let a=Z(i),o=0;for(let t of c)t!==e&&(o+=f(a,n.get(t)??Z(d(t))));return{candidate:i,candidateSegments:a,crossings:t.count-(r.get(e)??0)+o,bends:B(i,Y),totalBends:B(i),length:x(i)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:ie(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},`pairCandidatesFor`),oe=e((e,t,n,r,i,a)=>{let o=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(o+=n.count);let s=f(n.segments,i.segments);for(let e of c){if(e===t||e===r)continue;let o=a.get(e)??Z(d(e));s+=f(n.segments,o)+f(i.segments,o)}return e.count-o+s},`pairCrossingCount`),H=e((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},`conflictsOnlyWith`),U=e((e,t)=>e.segments.some(e=>t.segments.some(t=>z(e,t,.5)>=X)),`candidatesShareTrack`),ue=e((e,t,n,r)=>H(t,n.edge)&&H(r,e.edge)&&!U(t,r),`pairCandidatesAreCompatible`),G=e((e,t,n,r,i)=>{let a=oe(e.current,t.edge,n,r.edge,i,e.baseSegments);if(!(a>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,i.path]]),crossings:a,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+i.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+i.length}},`scorePairReplacement`),de=e((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),`pairScoreIsBetter`),fe=e((e,t,n,r)=>{let i=r;for(let r of t.candidates)for(let a of n.candidates){if(!ue(t,r,n,a))continue;let o=G(e,t,r,n,a);o&&de(o,i)&&(i=o)}return i},`bestScoreForOptionPair`),q=e(e=>{let t=S(),n=C(),r=re(),i=b(e),a=new Map(c.map(e=>[e,B(d(e))])),o=new Map(c.map(e=>[e,x(d(e))])),s=new Map,l=v(e);for(let t of l)for(let n of t){if(s.has(n))continue;let t=ae(n,e,r,i);t.length>0&&s.set(n,{edge:n,candidates:t})}let u={replacements:new Map,crossings:e.count,bends:t,length:n},f={current:e,currentBends:t,currentLength:n,baseBendsByEdge:a,baseLengthByEdge:o,baseSegments:r};for(let t of l){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>s.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let i=e+1;i<r.length;i++){let e=r[i];!n.has(t.edge)&&!n.has(e.edge)||(u=fe(f,t,e,u))}}}return u.replacements.size>0?u.replacements:void 0},`bestPairedReplacement`);for(let e=0;e<4;e++){let e=m(),t=e.count;if(t===0)return;let n,r,i=t,a=1/0;for(let o of e.edges){let s=B(d(o),Y);for(let c of ne(o)){let l=T(o,c),u=!l&&w(o,c),d=y(e,o,c),f=B(c,Y);l||u||!(d<t||d===t&&f<s)||d>i||d===i&&f>=a||(n=o,r=c,i=d,a=f)}}if(n&&r){n.points=r;continue}let o=q(e);if(!o)return;for(let[e,t]of o)e.points=t}}e(ht,`resolveRenderedOrthogonalCrossings`);var gt=.001,_t=8;function vt(t,n){let{nodeInfoById:r,realNodeRects:i}=ue(n),a=[`top`,`bottom`,`left`,`right`],o={top:Math.min(...i.map(e=>e.rect.top))-20,bottom:Math.max(...i.map(e=>e.rect.bottom))+20,left:Math.min(...i.map(e=>e.rect.left))-20,right:Math.max(...i.map(e=>e.rect.right))+20},s=e((e,t,n,r)=>{let i=[],a=ce(e,t,n,r,20,gt);return a&&i.push(a),t===r&&i.push(le(e,t,n,o[t])),i},`buildOrthogonalPathCandidates`),c=e((e,t)=>{for(let n=0;n<e.length-1;n++){let r=e[n],a=e[n+1];if(K(r,a,i,t,1))return!0}return!1},`pathHitsNode`),l=e((e,n,r=!1)=>{let i=0,a=te(e,gt),o=n.start,s=n.end;for(let e of t){if(e===n||e.isLayoutOnly)continue;let t=e.start,c=e.end;if(!r&&o&&s&&(t===o||t===s||c===o||c===s))continue;let l=e.points;if(!(!l||l.length<2))for(let e of a)for(let t of te(l,gt)){if(q(e.a,e.b,t.a,t.b,gt,gt)){i++;continue}z(e,t,gt)>=_t&&i++}}return i},`pathConflictCount`),u=e((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),i=Math.abs(e.x-t.rect.left),a=Math.abs(e.x-t.rect.right),o=`top`,s=n;return r<s&&(o=`bottom`,s=r),i<s&&(o=`left`,s=i),a<s&&(o=`right`,s=a),o},`nearestSideOfRect`),d=new Map,f=e((e,t,n)=>{let r=d.get(e)??[];r.push({side:t,edgeId:n}),d.set(e,r)},`addFaceClaim`);for(let e of t){if(e.isLayoutOnly)continue;let t=e.points??[];if(t.length<1)continue;let n=e.id??``,i=e.start,a=e.end;if(i){let e=r.get(i);e&&f(i,u(t[0],e),n)}if(a){let e=r.get(a);e&&f(a,u(t[t.length-1],e),n)}}let p=e((e,t,n)=>d.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,`faceIsClaimed`);for(let e of t){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=B(t,gt);if(n<4)continue;let i=e.start,o=e.end;if(!i||!o)continue;let m=r.get(i),h=r.get(o);if(!m||!h)continue;let g=e.id??``,_=l(t,e,!0),v=l(t,e),y,b=_,x=n;for(let t of a){if(p(i,t,g))continue;let n=se(m,t);for(let r of a){if(p(o,r,g))continue;let a=se(h,r);for(let u of s(n,t,a,r)){if(c(u,[i,o]))continue;let t=B(u,gt);if(_>0){let n=l(u,e,!0);if(n>b||n===b&&t>=x)continue;b=n,x=t,y=u;continue}l(u,e)>v||t<x&&(x=t,y=u)}}}if(y){e.points=y;let t=d.get(i);t&&d.set(i,t.filter(e=>e.edgeId!==g));let n=d.get(o);n&&d.set(o,n.filter(e=>e.edgeId!==g)),f(i,u(y[0],m),g),f(o,u(y[y.length-1],h),g)}}}e(vt,`simplifyDetouredEdges`);var Q=.001,yt=10,bt=7;function xt(e,t){let n=t?0:e.length-1,r=t?1:-1,i=e[n],a=e[n+r];if(!i||!a)return;let o=a.x-i.x,s=a.y-i.y;if(!(Math.abs(o)+Math.abs(s)<Q)){if(Math.abs(s)<=Q){let e=i.x+Math.sign(o)*yt;return{left:Math.min(i.x,e),right:Math.max(i.x,e),top:i.y-bt,bottom:i.y+bt}}if(Math.abs(o)<=Q){let e=i.y+Math.sign(s)*yt;return{left:i.x-bt,right:i.x+bt,top:Math.min(i.y,e),bottom:Math.max(i.y,e)}}return{left:Math.min(i.x,a.x),right:Math.max(i.x,a.x),top:Math.min(i.y,a.y),bottom:Math.max(i.y,a.y)}}}e(xt,`markerClearanceRectFor`);function St(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}e(St,`normalizeRect`);function Ct(e,t){let n=V(t);return[xt(n,!0),xt(n,!1)].some(t=>t&&oe(e,St(t)))}e(Ct,`labelOverlapsOwnMarker`);function wt(t,n){let r=[];for(let e of t){if(e.isLayoutOnly)continue;let t=e.points;if(!(!t||t.length<2))for(let n=0;n<t.length-1;n++)r.push({edgeId:e.id,p1:t[n],p2:t[n+1]})}let i=[],a=[];for(let e of n.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=W(e);t&&a.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let r=W(e);r&&i.push({nodeId:e.id,rect:r})}let o=e((e,t)=>{let n=H(t,3);for(let{nodeId:t,rect:r}of i)if(t!==e&&oe(n,r))return!0;return!1},`labelOverlapsForeignNode`),s=e((e,t)=>{let n=H(t,3);for(let t of r)if(t.edgeId!==e&&re(t.p1,t.p2,n))return!0;return!1},`labelOverlapsForeignEdge`),c=e((e,t,n)=>o(e,n)||s(t,n),`labelOverlapsAnything`),l=[],u=e(e=>{for(let{id:t,rect:n}of a)if(ae(n,e))return t},`findContainingLane`),d=e((e,t)=>l.some(n=>n.labelId!==e&&oe(t,n.rect)),`overlapsPlacedLabel`);for(let r of t){if(r.isLayoutOnly)continue;let t=r.labelNodeId;if(!t)continue;let i=n.get(t);if(!i)continue;let f=r.points;if(!f||f.length<2)continue;let p=i.width??0,m=i.height??0;if(p<=0||m<=0)continue;let h=[];for(let e=0;e<f.length-1;e++){let t=f[e],n=f[e+1],r=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);r<Q&&i<Q||r>=Q&&i>=Q||h.push({idx:e,length:r+i,orientation:r>=Q?`horizontal`:`vertical`,midX:(t.x+n.x)/2,midY:(t.y+n.y)/2})}if(h.length===0)continue;let g=h.length>=3?h.filter(e=>e.idx>0&&e.idx<h.length-1):h,_=g.length>0?g:h,v=p>=m?`horizontal`:`vertical`,y=e(e=>[...e].sort((e,t)=>{let n=e.orientation===v;if(n!==(t.orientation===v))return n?-1:1;let r=e.length>=(e.orientation===`horizontal`?p:m)+2;return r===t.length>=(t.orientation===`horizontal`?p:m)+2?t.length-e.length:r?-1:1}),`rankSegments`),b=h[0],x=h[h.length-1],S=[.5,.25,.75,.05,.95,.15,.85,.1,.9],C=e((e,t)=>{let n=f[e.idx],r=f[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},`anchorAtT`),w=e((e,t,n)=>Math.min(n,Math.max(t,e)),`clamp`),T=e((e,t)=>e.midX>=t.left-Q&&e.midX<=t.right+Q&&e.midY>=t.top-Q&&e.midY<=t.bottom+Q,`pointInsideRectInclusive`),E=e(e=>{let t=U(e.midX,e.midY,p,m),n=u(t);if(n)return{laneId:n,anchor:e,rect:t};let r=a.find(({rect:t})=>T(e,t));if(!r)return;let i=r.rect.left+p/2+1,o=r.rect.right-p/2-1,s=r.rect.top+m/2+1,c=r.rect.bottom-m/2-1;if(i>o||s>c)return;let l={midX:w(e.midX,i,o),midY:w(e.midY,s,c)},d=U(l.midX,l.midY,p,m);return T(e,d)?{laneId:r.id,anchor:l,rect:d}:void 0},`placementForAnchor`),D=e((e,t,n)=>e.orientation===`horizontal`?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),`distanceAlongSegment`),O=e((e,t)=>{let n=(e.orientation===`horizontal`?p/2:m/2)+12;if(e===b){let r=f[e.idx];if(D(e,t,r)+Q<n)return!1}if(e===x){let r=f[e.idx+1];if(D(e,t,r)+Q<n)return!1}return!0},`labelClearsTerminalEndpoints`),k=e(e=>{let n=y(e);for(let e of n)for(let n of S){let i=C(e,n);if(!O(e,i))continue;let a=E(i);if(a&&!Ct(a.rect,f)&&!d(t,a.rect)&&!c(t,r.id,a.rect))return{laneId:a.laneId,anchor:a.anchor}}},`tryPool`),A=e((e,n,i=!1)=>{let a=y(e);for(let e of a){let a={midX:e.midX,midY:e.midY};if(n&&!O(e,a))continue;let c=E(a);if(c&&!Ct(c.rect,f)&&!d(t,c.rect)&&!o(t,c.rect)&&(i||!s(r.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},`findLaneContainingFallback`),j=k(_)??(_.length<h.length?k(h):void 0)??A(h,!0)??A(h,!1)??A(h,!1,!0);if(j){i.x=j.anchor.midX,i.y=j.anchor.midY,i.parentId=j.laneId;let e=U(j.anchor.midX,j.anchor.midY,p,m),n=l.findIndex(e=>e.labelId===t);n>=0?l[n]={labelId:t,rect:e}:l.push({labelId:t,rect:e})}}}e(wt,`anchorLabelsToPolyline`);var Tt=1e-6,Et=4,Dt=3;function Ot(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}e(Ot,`pairKey`);function kt(t,n){let{nodeInfoById:r,realNodeRects:i}=ue(n),a=new Map;for(let e of n){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){a.set(t,{w:e.width??0,h:e.height??0});continue}}let o=e((n,r,i,o)=>{let s=Ot(r,i),c=0,l=e(e=>{if(!e)return;let t=a.get(e);if(!t)return;let n=o===`x`?t.w/2:t.h/2;n>c&&(c=n)},`consider`);l(n.labelNodeId);for(let e of t){if(e===n||e.isLayoutOnly)continue;let t=e.start,r=e.end;!t||!r||Ot(t,r)===s&&l(e.labelNodeId)}return c>0?c+Dt:0},`labelClearanceFor`);for(let e of t){if(e.isLayoutOnly)continue;let n=e.points;if(!ne(n,Tt))continue;let a=fe(e,r,Tt);if(!a)continue;let{srcId:s,dstId:c,srcInfo:l,dstInfo:u,collinearX:d,collinearY:f}=a;if(d===f)continue;let p,m;if(d){let e=u.cy>l.cy;p={x:l.cx,y:e?l.rect.bottom:l.rect.top},m={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>l.cx;p={x:e?l.rect.right:l.rect.left,y:l.cy},m={x:e?u.rect.left:u.rect.right,y:u.cy}}if(K(p,m,i,[s,c],1))continue;let h=o(e,s,c,d?`x`:`y`),g=h>Et?h:Et,_=[0,g,-g];for(let n of _){let r={...p},a={...m};if(d){if(r.x+=n,a.x+=n,r.x<=l.rect.left||r.x>=l.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(r.y+=n,a.y+=n,r.y<=l.rect.top||r.y>=l.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!K(r,a,i,[s,c],1)&&!me(r,a,t,e,{epsilon:Tt})){e.points=[r,a];break}}}}e(kt,`straightenCollinearSiblingDetours`);function At(t,n){let{realNodeRects:r,labelNodeRects:i}=G(n.values()),a=e((e,t)=>te(t,.001).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),`segmentsFor`),o=e(()=>{let e=[];for(let n of t){if(n.isLayoutOnly)continue;let t=n.points;!t||t.length<2||e.push(...a(n,V(t)))}return e},`allSegments`),s=e((e,t)=>e.horizontal&&t.horizontal?R(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&Math.abs(e.a.y-t.a.y)<7:e.vertical&&t.vertical?R(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&Math.abs(e.a.x-t.a.x)<7:!1,`hasCrowdedParallelTrack`),c=e((e,n)=>{let o=e.start,c=e.end,l=a(e,n);if(l.length!==n.length-1)return!1;let u=[o,c].filter(e=>!!e),d=e.labelNodeId?[e.labelNodeId]:[];for(let e of l)if(K(e.a,e.b,r,u,-2)||K(e.a,e.b,i,d,-2))return!1;for(let n of t){if(n===e||n.isLayoutOnly)continue;let t=n.points;if(!(!t||t.length<2)){for(let e of l)for(let r of a(n,V(t)))if(s(e,r)||he(e.a,e.b,r.a,r.b,.001))return!1}}return!0},`candidateIsSafe`),l=e((e,t)=>{let n=V(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else if(e.vertical)r[e.index].x+=t,r[e.index+1].x+=t;else return;return a(e.edge,r).length===r.length-1?r:void 0},`shiftedCandidate`),u=e((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),`nodeCenter`),d=e(e=>{let t=e.edge,r=V(t.points??[]);if(r.length!==4||e.index!==1)return;let i=t.start?n.get(t.start):void 0,a=t.end?n.get(t.end):void 0,o=i?W(i):void 0,s=a?W(a):void 0,c=r.slice(e.index+2);if(!(!i||!a||!o||!s||c.length===0))return{sourceCenter:u(i,o),targetCenter:u(a,s),sourceRect:o,tail:c}},`sourceDetourContextFor`),f=e((e,t,n,r,i,a)=>{let o=r.y>=n.y,s=o?i.bottom:i.top,c=s+(o?20:-20);if(o&&e.b.y<=c+.001||!o&&e.b.y>=c-.001)return;let l=e.a.x+t;return V([{x:n.x,y:s},{x:n.x,y:c},{x:l,y:c},{x:l,y:e.b.y},...a],.001)},`verticalSourceDetour`),p=e((e,t,n,r,i,a)=>{let o=r.x>=n.x,s=o?i.right:i.left,c=s+(o?20:-20);if(o&&e.b.x<=c+.001||!o&&e.b.x>=c-.001)return;let l=e.a.y+t;return V([{x:s,y:n.y},{x:c,y:n.y},{x:c,y:l},{x:e.b.x,y:l},...a],.001)},`horizontalSourceDetour`),m=e((e,t)=>{let n=d(e);if(n){if(e.vertical)return f(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return p(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},`sourceDetourCandidate`),h=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=o(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let i=e[n],a=e[r];if(i.edge===a.edge||!s(i,a))continue;let o=[i,a].filter(e=>e.interior);for(let e of o){for(let n of h){let r=l(e,n);if(r&&c(e.edge,r)){e.edge.points=r,t=!0;break}let i=m(e,n);if(i&&c(e.edge,i)){e.edge.points=i,t=!0;break}}if(t)break}}if(!t)return}}e(At,`nudgeSharedInteriorSubpaths`);function jt(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*s-a*o;if(Math.abs(c)<1e-10)return!1;let l=n.x-e.x,u=n.y-e.y,d=(l*s-u*o)/c,f=(l*a-u*i)/c,p=.01;return d>p&&d<.99&&f>p&&f<.99}e(jt,`segmentsIntersect`);function Mt(e){let n=e.nodes??[],r=e.edges??[],i=[];if(!r.length||!n.length)return i;let a=de(n),o=[];for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,r=e.end,s=e.labelNodeId,c=e.id??`${n}->${r}`;for(let e of a)if(e.nodeId!==n&&e.nodeId!==r&&!(s&&e.nodeId===s)){for(let n=0;n<t.length-1;n++)if(re(t[n],t[n+1],e,-1)){i.push({type:`edge-node-overlap`,edgeId:c,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)o.push({edgeId:c,start:n,end:r,p1:t[e],p2:t[e+1]})}let s=new Set;for(let e=0;e<o.length;e++)for(let t=e+1;t<o.length;t++){let n=o[e],r=o[t];if(n.edgeId!==r.edgeId&&n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&jt(n.p1,n.p2,r.p1,r.p2)){let e=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;s.has(e)||(s.add(e),i.push({type:`edge-edge-crossing`,edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(i.length>0){let e=i.filter(e=>e.type===`edge-node-overlap`).length,n=i.filter(e=>e.type===`edge-edge-crossing`).length;t.warn(`[SWIMLANE_VALIDATE] ${i.length} issue(s) detected: ${e} edge-node overlap(s), ${n} edge crossing(s)`);for(let e of i)t.warn(`[SWIMLANE_VALIDATE] ${e.type}: ${e.detail}`)}return i}e(Mt,`validateSwimlanesLayout`);function Nt(t,n){let r=t.nodes??[],i=t.edges??[],a=r.filter(e=>!e.isGroup);if((n===`LR`||n===`RL`)&&a.length>0&&!et(t,n)||n===`BT`&&a.length>0&&!$e(t))return;for(let e of i){if(e.isLayoutOnly)continue;let t=e.points;!t||t.length<2||(e.points=be(ye(t)))}vt(i,r),kt(i,r),it(i,r);let o=new Map;for(let e of r)o.set(String(e.id),e);wt(i,o),Ee(i,o),at(i,o),At(i,o),st(i,o),ct(i,o),lt(i,o),ft(i,o);let s=e(()=>{ht(i,o),pt(i,o),mt(i,o),wt(i,o),Ge(i,o),lt(i,o),wt(i,o),Ge(i,o)},`finalizeRenderedEdges`);s(),At(i,o),s(),ut(i,o),dt(i,o),ut(i,o),dt(i,o)}e(Nt,`postProcessSwimlaneLayout`);function Pt(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let i of e.edges){if(!t.has(i.src)||!t.has(i.dst))continue;let e=`${i.id}:${i.src}->${i.dst}`;n.has(e)||(n.add(e),r.push(i))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}e(Pt,`normalizeGraph`);function Ft(e,t){return e.edges.filter(e=>e.dst===t)}e(Ft,`incoming`);function It(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}e(It,`buildSuccessorMap`);function Lt(e){let t=It(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}e(Lt,`buildSortedSuccessorMap`);function Rt(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}e(Rt,`buildInDegreeMap`);function zt(e){return[...e.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}e(zt,`sortedZeroInDegreeNodes`);function Bt(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let i of e.edges)t(i)&&(r.get(i.src).push(i.dst),n.get(i.dst).push(i.src));return{preds:n,succs:r}}e(Bt,`buildPredecessorSuccessorMaps`);function Vt(e,t,n,r){let i=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(i=Math.max(i,n[t]??0));let a=Array.from({length:i+1},()=>[]);for(let i of t)r?.skipGroups&&e.nodeById.get(i)?.isGroup||a[Math.max(0,n[i]??0)].push(i);return a}e(Vt,`buildLayersFromRanks`);function Ht(e){let t=Rt(e),n=zt(t),r=[],i=Lt(e);for(;n.length;){let e=n.shift();r.push(e);for(let r of i.get(e)??[])if(t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0){let e=0;for(;e<n.length&&n[e]<r;)e++;n.splice(e,0,r)}}return r.length===e.nodes.length?r:null}e(Ht,`topoSortIfAcyclic`);function Ut(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}e(Ut,`buildLayerIndex`);function Wt(t){let n=Array(t.length),r=e((e,i)=>{if(i-e<=1)return 0;let a=e+i>>1,o=r(e,a)+r(a,i),s=e,c=a,l=e;for(;s<a||c<i;)c>=i||s<a&&t[s]<=t[c]?n[l++]=t[s++]:(n[l++]=t[c++],o+=a-s);for(let r=e;r<i;r++)t[r]=n[r];return o},`count`);return r(0,t.length)}e(Wt,`countInversions`);function Gt(t){let n=Pt(t),r=new Map;for(let e of n.nodes)r.set(e,[]);for(let e of n.edges)r.get(e.src).push(e);for(let e of r.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let i=Object.create(null);for(let e of n.nodes)i[e]=0;let a=[],o=e(e=>{i[e]=1;for(let t of r.get(e)??[]){let e=t.dst;i[e]===0?o(e):i[e]===1&&a.push(t)}i[e]=2},`dfs`),s=[...n.nodes].sort((e,t)=>e.localeCompare(t));for(let e of s)i[e]===0&&o(e);let c=new Set(a.map(e=>`${e.id}:${e.src}->${e.dst}`)),l=n.edges.map(e=>c.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...n.nodes],edges:l,layout:n.layout,nodeById:new Map(n.nodeById)},reversed:a}}e(Gt,`removeCycles_DFS`);function Kt(t){let n=new Map,r=e(e=>{if(n.has(e))return n.get(e);let i=t.nodeById.get(e);if(!i)return n.set(e,null),null;let a=i.parentId;if(!a)return n.set(e,null),null;let o=r(a)??a;return n.set(e,o),o},`resolve`);for(let e of t.nodes)r(e);return n}e(Kt,`buildTopLaneMap`);function qt(e){let t=Kt(e);return e=>t.get(e)??null}e(qt,`createTopLaneResolver`);function Jt(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}e(Jt,`buildTopLaneOrder`);function Yt(e,t){let n=Jt(e);if(!t||t.length===0)return n;let r=new Set(n),i=new Set,a=[];for(let e of t)!r.has(e)||i.has(e)||(i.add(e),a.push(e));for(let e of n)i.has(e)||a.push(e);return a}e(Yt,`resolveTopLaneOrder`);var Xt={EPSILON:1e-6},Zt={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Qt={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function $t(t,n){let r=Pt(t),i=n?.laneOf??(()=>null),a=n?.rankHint,{preds:o}=Bt(r);for(let e of o.values())e.sort((e,t)=>e.localeCompare(t));let s=Ht(r)??[...r.nodes].sort((e,t)=>e.localeCompare(t)),c=new Map;for(let[e,t]of s.entries())c.set(t,e);let l=new Map,u=new Map;for(let e of r.nodes)u.set(e,[]);for(let e of s){let t=(o.get(e)??[]).filter(e=>l.has(e));if(t.length>0){let n=en(e,t,{laneOf:i,rankHint:a,topoIndex:c});l.set(e,n),u.get(n).push(e)}else l.has(e)||l.set(e,null)}for(let e of r.nodes)l.has(e)||l.set(e,null);let d=new Set;for(let e of r.nodes)(l.get(e)??null)===null&&d.add(e);let f=[...d].sort((e,t)=>{let n=c.get(e)??0,r=c.get(t)??0;return n===r?e.localeCompare(t):n-r}),p=tn(r),m=new Map;for(let[e,t]of p.entries())m.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let h=nn(m),g=rn(m),_=new Map;for(let e of r.nodes)_.set(e,[]);for(let e of g)for(let t of e.nodes){let n=_.get(t);n?n.push(e.id):_.set(t,[e.id])}let v=[],y=[],b=new Set,x=e(e=>{if(!b.has(e)){b.add(e),v.push(e);for(let t of u.get(e)??[])x(t);y.push(e)}},`walk`);for(let e of f)x(e);for(let e of s)x(e);return{parent:l,children:u,roots:f,componentOf:h,blocks:g,nodeBlocks:_,adjacency:m,preorder:v,postorder:y,topologicalOrder:s}}e($t,`buildDrivingTree`);function en(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let i=n.laneOf(e),a=n.laneOf(t),o=i!=null&&i===r;if(o!==(a!=null&&a===r))return o?-1:1;let s=n.rankHint?.[e],c=n.rankHint?.[t];if(s!=null&&c!=null&&s!==c)return c-s;let l=n.topoIndex.get(e)??0,u=n.topoIndex.get(t)??0;return l===u?e.localeCompare(t):l-u})[0]}e(en,`chooseParent`);function tn(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}e(tn,`buildAdjacency`);function nn(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let i=[r];for(;i.length>0;){let r=i.pop();if(!t.has(r)){t.set(r,n);for(let n of e.get(r)??[])t.has(n)||i.push(n)}}n++}return t}e(nn,`assignComponents`);function rn(t){let n=new Map,r=new Map,i=[],a=[],o=0,s=e((e,c)=>{n.set(e,++o),r.set(e,o);for(let l of t.get(e)??[])l!==c&&(n.has(l)?(n.get(l)??0)<(n.get(e)??0)&&(i.push([e,l]),r.set(e,Math.min(r.get(e)??o,n.get(l)??o))):(i.push([e,l]),s(l,e),r.set(e,Math.min(r.get(e)??o,r.get(l)??o)),(r.get(l)??0)>=(n.get(e)??0)&&a.push(an(e,l,i,a.length))))},`visit`);for(let e of t.keys())n.has(e)||s(e,null);return a}e(rn,`computeBlocks`);function an(e,t,n,r){let i=[],a=new Set;for(;n.length>0;){let r=n.pop();if(i.push(r),a.add(r[0]),a.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:i,nodes:[...a]}}e(an,`popBlock`);function on(t,n,r){let i=[...t.nodes],a=new Map;for(let[e,t]of i.entries())a.set(t,e);let o=i.length,s=Array(o).fill(-1),c=Array(o).fill(0),l=[],u=new Set;for(let e of i){let t=r.parent.get(e)??null,n=a.get(e);n!=null&&t==null&&(s[n]=-1,c[n]=0,u.has(e)||(u.add(e),l.push(e)))}for(;l.length>0;){let e=l.shift(),t=a.get(e);if(t==null)continue;let n=r.children.get(e)??[];for(let e of n){if(u.has(e))continue;let n=a.get(e);n!=null&&(s[n]=t,c[n]=c[t]+1,u.add(e),l.push(e))}}for(let e of i){if(u.has(e))continue;let t=a.get(e);t!=null&&(s[t]=-1,c[t]=0,u.add(e))}let d=Math.max(1,Math.ceil(Math.log2(Math.max(1,o)))+1),f=Array.from({length:d},()=>Array(o).fill(-1));for(let e=0;e<o;e++)f[0][e]=s[e];for(let e=1;e<d;e++)for(let t=0;t<o;t++){let n=f[e-1][t];f[e][t]=n===-1?-1:f[e-1][n]}let p=e((e,t)=>{if(e===-1||t===-1)return-1;c[e]<c[t]&&([e,t]=[t,e]);let n=c[e]-c[t];for(let t=0;t<d;t++)if(n>>t&1&&(e=f[t][e],e===-1))return-1;if(e===t)return e;for(let n=d-1;n>=0;n--){let r=f[n][e],i=f[n][t];r===-1||i===-1||r!==i&&(e=r,t=i)}return f[0][e]},`lcaIndex`),m=Array.from({length:o},()=>new Map);for(let e of t.edges){let t=e.src,r=e.dst,i=n[t],o=n[r];if(i==null||o==null||(i>o&&([t,r]=[r,t],[i,o]=[o,i]),i==null||o==null||i===o))continue;let s=a.get(t),c=a.get(r);if(s==null||c==null)continue;let l=p(s,c);if(l===-1)continue;let u=m[l];for(let e=i;e<o;e++)u.set(e,(u.get(e)??0)+1)}let h=new Map,g=e((e,t)=>{if(t.size!==0)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},`mergeInto`),_=new Set,v=e(e=>{let t=a.get(e);_.add(e);let i=t==null?void 0:m[t],o=i?new Map(i):new Map,s=r.children.get(e)??[];for(let t of s){let r=v(t),i=n[e];if(i!=null){let a=h.get(e);a||(a=new Map,h.set(e,a));let o=r.get(i)??0,s=n[t];s!=null&&s>i&&(o+=1),a.set(t,o)}g(o,r)}return o},`dfs`);for(let e of r.roots)_.has(e)||v(e);for(let e of i)_.has(e)||v(e);return h}e(on,`computeSubtreeCrossCounts`);function sn(t,n,r){let i=new Map,a=e(e=>{let t=r[e]??0,o=[...n.get(e)??[]];o.sort(cn(r));for(let e of o){a(e);let n=i.get(e);n!=null&&(t=Math.min(t,n))}i.set(e,t)},`annotate`);for(let e of t)a(e);return i}e(sn,`annotateMinimumLayers`);function cn(e){return(t,n)=>{let r=e[t]??0,i=e[n]??0;return r===i?t.localeCompare(n):r-i}}e(cn,`compareByRankThenId`);function ln(t,n,r,i){let a=0;for(let e of n){let t=r[e]??0;t>a&&(a=t)}let o=Array.from({length:a+1},()=>[]),s=new Set,c=e(e=>{if(s.has(e))return;s.add(e);let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e);for(let t of i(e))c(t)},`emit`);for(let e of t)c(e);for(let e of n)if(!s.has(e)){let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e),s.add(e)}return o}e(ln,`emitNodesInTreeOrder`);function un(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}e(un,`deduplicateLayers`);function dn(e,t,n,r){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let o=t[i]??0,s=[],c=[],l=n.get(i);for(let e of a){let t=r.get(e)??o;t>o?s.push({child:e,min:t}):c.push(e)}return s.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),c.sort((e,t)=>{let n=l?.get(e)??0,i=l?.get(t)??0;if(n!==i)return n-i;let a=r.get(e)??o,s=r.get(t)??o;return a===s?e.localeCompare(t):a-s}),[...s.map(e=>e.child),...c]}}e(dn,`createChildOrderer`);function fn(e,t,n){let r=$t(e,{rankHint:t,laneOf:n}),{children:i,roots:a}=r;for(let t of e.nodes)i.has(t)||i.set(t,[]);let o=on(e,t,r),s=[...a].sort(cn(t)),c=dn(i,t,o,sn(s,i,t)),l=ln(s,e.nodes,t,c);return l=un(l),l}e(fn,`buildMultitreeLayerOrder`);function pn(e,t,n){let r=new Set(e),i=new Set(t),a=Ut(t),o=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&o.push(a.get(e.dst));return Wt(o)}e(pn,`countCrossingsBetweenAdjacent`);function mn(e,t,n){let r=[];for(let e of t){let t=n[e.src],i=n[e.dst];if(t==null||i==null||t===i)continue;let a=e.src,o=e.dst,s=t,c=i;t>i&&(a=e.dst,o=e.src,s=i,c=t);for(let t=s;t<c;t++)r.push({id:`${e.id}@${t}`,src:a,dst:o,ref:e.ref})}let i=0;for(let t=0;t+1<e.length;t++)i+=pn(e[t],e[t+1],r);return i}e(mn,`totalCrossings`);function hn(e,t){let n={...t},{preds:r}=Bt(e),i=qt(e),a=mn(fn(e,n,i),e.edges,n),o=Zt.MAX_CROSSING_OPTIMIZATION_PASSES;for(let t=0;t<o;t++){let t=!1,o=[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0));for(let s of o){let o=n[s]??0;if(o===0)continue;let c=0;for(let e of r.get(s)??[])c=Math.max(c,(n[e]??0)+1);if(c>=o)continue;let l=o;n[s]=c;let u=mn(fn(e,n,i),e.edges,n);u<a?(a=u,t=!0):n[s]=l}if(!t)break}return n}e(hn,`optimizeRanksByCrossings`);function gn(e,t){let n=qt(e),r=[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n));for(let i of r){let r=n(i);if(!r)continue;let a=e.edges.filter(e=>e.src===i);if(a.length===0)continue;let o=!1,s=0;for(let e of a){let t=n(e.dst);t==null||t===r?o=!0:s++}if(s===0||o)continue;let c=0,l=!1;for(let t of e.edges){if(t.dst!==i)continue;let e=n(t.src);e&&(e===r?l=!0:c++)}if(c>0||!l)continue;let u=t[i]??0,d=u+s,f=0;for(let n of e.edges)n.dst===i&&(f=Math.max(f,(t[n.src]??0)+1));let p=Math.max(u,f,d);p!==u&&(t[i]=p)}}e(gn,`adjustCrossLaneSources`);function _n(e,t){let n=Pt(e),r=Ht(n)??[...n.nodes].sort(),i=t?.compactSingleInput??!1,a=qt(n),o=Object.create(null);for(let e of r){let r=Ft(n,e),s=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=a(t.src),r=a(e);return!n||!r||n===r}):r;if(s.length===0)o[e]=0;else if(i&&s.length===1){let t=s[0].src;a(t)===a(e)?o[e]=(o[t]??0)+1:o[e]=o[t]??0}else{let t=-1/0;for(let e of s)t=Math.max(t,(o[e.src]??0)+1);o[e]=t===-1/0?0:t}}return(t?.optimizeRanksByCrossings??!1)&&(o=hn(n,o)),t?.ignoreCrossLaneEdges&&gn(n,o),{layers:fn(n,o,a),rankOf:o,dummy:new Set}}e(_n,`assignLayers_LongestPath`);function vn(t,n){let r=Pt(t),i={..._n(r,{compactSingleInput:n?.compactSingleInput,ignoreCrossLaneEdges:n?.ignoreCrossLaneEdges,optimizeRanksByCrossings:n?.optimizeRanksByCrossings}).rankOf},a=qt(r),{preds:o,succs:s}=Bt(r,e=>{if(n?.ignoreCrossLaneEdges){let t=a(e.src),n=a(e.dst);if(t&&n&&t!==n)return!1}return!0}),c=Ht(r)??[...r.nodes],l=[...c].reverse(),u=e((e,t)=>{let n=0;for(let t of o.get(e)??[])n=Math.max(n,(i[t]??0)+1);let r=1/0,a=s.get(e)??[];return a.length>0&&(r=Math.min(...a.map(e=>(i[e]??0)-1))),Number.isFinite(r)||(r=Math.max(n,t)),Math.min(Math.max(t,n),r)},`clampFeasible`),d=Zt.GRAVITY_ITERATIONS,f=e(e=>{let t=!1;for(let n of e){let e=o.get(n)??[],r=s.get(n)??[];if(e.length===0&&r.length===0)continue;let a=e.length>0?e.reduce((e,t)=>e+(i[t]??0)+1,0)/e.length:i[n]??0,c=r.length>0?r.reduce((e,t)=>e+(i[t]??0)-1,0)/r.length:i[n]??0,l=Math.round((a+c)/2),d=u(n,l);d!==i[n]&&(i[n]=d,t=!0)}return t},`relaxOrder`);for(let e=0;e<d;e++){let e=f(c),t=f(l);if(!e&&!t)break}for(let e of c){let t=0;for(let n of o.get(e)??[])t=Math.max(t,(i[n]??0)+1);(i[e]??0)<t&&(i[e]=t)}for(let e of l){let t=s.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(i[e]??0)-1));(i[e]??0)>n&&(i[e]=n)}}return{layers:Vt(r,c,i),rankOf:i,dummy:new Set}}e(vn,`assignLayers_Gravity`);function yn(e){let t=Rt(e),n=Lt(e),r=zt(t),i=[];for(;r.length>0;){let e=[];for(let a of r){i.push(a);for(let r of n.get(a)??[])t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r)}r=e.sort((e,t)=>e.localeCompare(t))}return i.length===e.nodes.length?i:null}e(yn,`topoSortByGenerationIfAcyclic`);function bn(t,n){let r=Pt(t),i=n?.direction===`LR`?yn(r)??[...r.nodes].sort():Ht(r)??[...r.nodes].sort(),a=qt(r),o=e(e=>a(e)??e,`laneOf`),s=Object.create(null),c=new Map,l=e((e,t)=>n?.ignoreCrossLaneEdges??!0?+(o(e)===o(t)):1,`edgeWeight`);for(let e of i){if(r.nodeById.get(e)?.isGroup)continue;let t=Ft(r,e),n=0;if(t.length>0)for(let r of t){let t=r.src,i=s[t]??0;n=Math.max(n,i+l(t,e))}let i=o(e),a=c.get(i)??0,u=Math.max(n,a);s[e]=u,c.set(i,u+1)}return{layers:Vt(r,i,s,{skipGroups:!0}),rankOf:s,dummy:new Set}}e(bn,`assignLayers_LaneAwareCompact`);function xn(t,n){let r=Pt(n),{rankOf:i}=t,a=t.layers.map(e=>[...e]),o=new Set(t.dummy?[...t.dummy]:[]),s=0,c=new Map(r.nodeById),l=e(e=>{let t=`placeholder-${s++}`,n={id:t,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(t,n),o.add(t);a.length<=e;)a.push([]);return a[e].push(t),i[t]=e,t},`addDummyAt`),u=[...r.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),d=[];for(let e of u){let t=i[e.src]??0,n=i[e.dst]??0;if(n-t<=1){d.push(e);continue}let r=e.src;for(let i=t+1,a=0;i<n;i++,a++){let t=l(i);d.push({id:`${e.id}#${a}`,src:r,dst:t,weight:e.weight,ref:e.ref}),r=t}let a=n-t-2;d.push({id:`${e.id}#${Math.max(a+1,0)}`,src:r,dst:e.dst,weight:e.weight,ref:e.ref})}let f={nodes:[...r.nodes,...[...o].filter(e=>!r.nodes.includes(e))],edges:d,layout:r.layout,nodeById:c};return{layering:{layers:a,rankOf:i,dummy:o},graphWithDummies:f}}e(xn,`makeProperLayering`);function Sn(e){let t=e.length;if(t===0)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}e(Sn,`median`);function Cn(e){return e.length===0?1/0:e.reduce((e,t)=>e+t,0)/e.length}e(Cn,`barycenter`);function wn(e,t,n,r){let i=new Map;for(let t of e)i.set(t,[]);for(let e of n)r===`down`?t.has(e.src)&&i.has(e.dst)&&i.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&i.has(e.src)&&i.get(e.src).push(t.get(e.dst));return i}e(wn,`neighborPositionsFor`);function Tn(e,t,n){let r=n.get(e)??0,i=n.get(t)??0;return r===i?e.localeCompare(t):r-i}e(Tn,`currentOrderTieBreak`);function En(e,t,n){let r=new Set(e),i=new Set(t),a=Ut(e),o=Ut(t),s=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&s.push({u:a.get(e.src),v:o.get(e.dst)});return s.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),Wt(s.map(e=>e.v))}e(En,`countCrossingsBetweenAdjacent`);function Dn(e,t,n){return[...e].sort((e,r)=>{let i=Sn(t.get(e)??[]),a=Sn(t.get(r)??[]);return i===a?Tn(e,r,n):isFinite(i)?isFinite(a)?i-a:-1:1})}e(Dn,`sortByHeuristic`);function On(e,t,n,r,i,a){let o=Ut(e),s=Ut(t),c=wn(t,o,n,r);if(!i||!a||a.length===0)return Dn(t,c,s);let l=new Map;for(let e of t){let t=i(e),n=l.get(t)??[];n.push(e),l.set(t,n)}let u=[];for(let e of a){let t=l.get(e);if(!t||t.length===0)continue;let n=Dn(t,c,s);u.push(...n)}let d=l.get(null);if(d&&d.length>0){let e=Dn(d,c,s);for(let t of e){let e=Cn(c.get(t)??[]),n=u.length;if(isFinite(e)){for(let[t,r]of u.entries())if(e<Cn(c.get(r)??[])){n=t;break}}u.splice(n,0,t)}}return u}e(On,`reorderLayer`);function kn(t,n,r,i,a){let o=[...n],s=new Set(t),c=new Set(n),l=i?new Set(i):null,u=r.filter(e=>s.has(e.src)&&c.has(e.dst)),d=l?r.filter(e=>c.has(e.src)&&l.has(e.dst)):void 0,f=e(e=>{let n=En(t,e,u);return d&&i&&(n+=En(e,i,d)),n},`crossingScore`),p=a?new Map:null;if(a&&p)for(let e of n)p.set(e,a(e));let m=!0,h=f(o);for(;m;){m=!1;for(let e=0;e+1<o.length;e++){if(p&&p.get(o[e])!==p.get(o[e+1]))continue;let t=h;[o[e],o[e+1]]=[o[e+1],o[e]];let n=f(o);n<t?(h=n,m=!0):[o[e],o[e+1]]=[o[e+1],o[e]]}}return o}e(kn,`transposeImprove`);function An(e,t,n){let r=e.layers.map(e=>[...e]),i=t.edges,a=qt(t),o=Yt(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=On(r[e-1],r[e],i,`down`,a,o),r[e]=kn(r[e-1],r[e],i,r[e+1],a);for(let e=r.length-2;e>=0;e--)r[e]=On(r[e+1],r[e],i,`up`,a,o),r[e]=kn(r[e+1],r[e],i,r[e-1],a)}return{layers:r}}e(An,`orderLayers`);function jn(t,n,r){let i=r?.layerGap??Qt.DEFAULT_LAYER_GAP,a=r?.nodeGap??Qt.DEFAULT_NODE_GAP,o=r?.laneGap??a*2,s=r?.direction??`TB`,c=s===`LR`||s===`RL`,l=t.layers,u=Object.create(null),d=Object.create(null),f=e(e=>n.nodeById.get(e),`getNode`),p=e(e=>f(e)?.width??0,`getWidth`),m=e(e=>f(e)?.height??0,`getHeight`),h=qt(n),g=Yt(n,r?.laneOrder),_=l.map(e=>e.reduce((e,t)=>Math.max(e,m(t)),0)),v=[];if(c)for(let e=0;e+1<l.length;e++){let t=l[e].reduce((e,t)=>Math.max(e,p(t)),0),n=l[e+1].reduce((e,t)=>Math.max(e,p(t)),0),r=_[e],a=_[e+1],o=r/2+a/2,s=(t+n)/2,c=Math.max(0,s-o-i);v.push(c)}let y=new Set;for(let e of l)for(let t of e)y.add(h(t));let b=y.has(null),x=g.filter(e=>y.has(e)),S=[...b?[null]:[],...x],C=Object.create(null);for(let e of x)C[e]=0;b&&(C.null=0);for(let e of l){let t=Object.create(null),n=[];for(let r of e){let e=h(r);e===null?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C[e]=Math.max(C[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C.null=Math.max(C.null??0,e)}}let w=new Map;{let e=S.map(e=>(e===null?C.null:C[e])??0),t=-(e.reduce((e,t)=>e+t,0)+o*Math.max(0,S.length-1))/2;for(let n=0;n<S.length;n++){let r=S[n],i=e[n]??0,a=t+i/2;w.set(r,a),t+=i,n<S.length-1&&(t+=o)}}let T=0;for(let[e,t]of l.entries()){let n=_[e]??0,r=new Map;for(let e of t){let t=h(e),n=r.get(t)??[];n.push(e),r.set(t,n)}for(let e of S){let t=r.get(e)??[];if(t.length===0)continue;let i=w.get(e);if(t.length===1){let e=t[0];u[e]=i,d[e]=T+n/2}else{let e=t.map(e=>p(e)),r=i-(e.reduce((e,t)=>e+t,0)+a*(t.length-1))/2;for(let[i,o]of t.entries()){let t=e[i];u[o]=r+t/2,d[o]=T+n/2,r+=t+a}}}let o=v[e]??0;T+=n+i+o}let E=new Map;for(let e of n.edges){let t=e.ref.id;E.has(t)||E.set(t,[]),E.get(t).push(e)}for(let[,e]of E){if(e.length===0)continue;let t=e[0].ref,r=t.start,i=t.end;if(r==null||i==null)continue;let a=Math.round(((u[r]??0)+(u[i]??0))/2),o=new Set;for(let t of e)o.add(t.src),o.add(t.dst);for(let e of o)e!==r&&e!==i&&n.nodeById.get(e)?.isDummy&&(u[e]=a)}return{x:u,y:d}}e(jn,`assignCoordinates`);var Mn=8;function Nn(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}e(Nn,`hashString`);function Pn(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}e(Pn,`mulberry32`);function Fn(e,t){let n=[...e],r=Pn(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}e(Fn,`deterministicShuffle`);function In(e,t){let n=0;for(let[r,i]of e.entries())n+=Math.abs(r-(t.get(i)??r));return n}e(In,`sourceDistance`);function Ln(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:i,weight:a}of t){let t=n.get(e),o=n.get(i);t==null||o==null||(r+=a*Math.abs(t-o))}return r}e(Ln,`laneArrangementCost`);function Rn(e){let t=Jt(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=qt(e),i=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let a=typeof t.start==`string`?t.start:void 0,o=typeof t.end==`string`?t.end:void 0;if(!a||!o||!e.nodeById.has(a)||!e.nodeById.has(o))continue;let s=r(a),c=r(o);if(!s||!c||s===c)continue;let l=n.get(s),u=n.get(c);if(l==null||u==null)continue;let[d,f]=l<=u?[s,c]:[c,s],p=`${d}\0${f}`,m=i.get(p);m?m.weight++:i.set(p,{a:d,b:f,weight:1})}return[...i.values()]}e(Rn,`buildWeightedLaneEdges`);function zn(e,t,n){let r=[...e],i=Ln(r,t),a=!0,o=0,s=Math.max(1,r.length);for(;a&&o<s;){a=!1,o++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=Ln(r,t);n<i?(i=n,a=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:i,sourceDistance:In(r,n)}}e(zn,`greedySwitch`);function Bn(e,t){return e.cost===t.cost?e.sourceDistance<t.sourceDistance:e.cost<t.cost}e(Bn,`isBetterCandidate`);function Vn(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join(`|`);return Nn(`${e.join(`|`)}#${r}#${n}`)}e(Vn,`seedForRestart`);function Hn(e,t={}){let n=Jt(e);if(n.length<2)return n;let r=Rn(e);if(r.length===0)return n;let i=new Map(n.map((e,t)=>[e,t])),a=zn(n,r,i),o=Math.max(0,t.restarts??Mn);for(let e=0;e<o;e++){let t=zn(Fn(n,Vn(n,r,e)),r,i);Bn(t,a)&&(a=t)}return a.order}e(Hn,`optimizeTopLaneOrder`);function Un(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,i=Pt(e),a=t?.automaticLaneOrdering?Hn(i,{restarts:Mn}):void 0,o=Gt(i),s=o.acyclic,{layering:c,graphWithDummies:l}=xn(n?bn(s,{compactSingleInput:t?.compactSingleInput??Zt.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:t?.direction}):vn(s,{compactSingleInput:t?.compactSingleInput??Zt.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),s),u=An(c,l,{laneOrder:a}),d=jn(u,l,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:a});return{acyclic:s,reversed:o.reversed,layering:c,ordered:u,coordinates:d}}e(Un,`sugiyamaLayout`);var $=Xt.EPSILON,Wn=8,Gn=15,Kn=15,qn=25,Jn=20,Yn=10;function Xn(e,t,n){let r=e.x??0,i=e.y??0,a=t.x-r,o=t.y-i,s=Math.abs(a),c=Math.abs(o);return s<$&&c<$?n:c>$&&c*3>=s?o>0?`bottom`:`top`:s>$?a>0?`right`:`left`:n}e(Xn,`chooseOrthogonalSide`);function Zn(e,t){return Math.abs(e.to-t.from)<$||Math.abs(e.to-t.to)<$?e.to:e.from}e(Zn,`sharedLineEndpointCoord`);function Qn(e,t){return e.orient===`vertical`?{x:e.coord,y:t}:{x:t,y:e.coord}}e(Qn,`pointOnLine`);function $n(t,n){let r=t.nodes??[],i=t.edges??[],a=[];for(let e of i)e.isLayoutOnly||a.push({...e,__originalEdge:e});let o=new Map,s=new Map,c=[],l=n===`LR`;for(let e of r)o.set(e.id,e);let u=r.filter(e=>e.isGroup&&!e.parentId);for(let t of u){let n={id:t.id},i=e(e=>{s.set(e.id,n),r.filter(t=>t.parentId===e.id).forEach(i)},`assignLane`);i(t)}let d=r.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,i=e.y??0,a=Wn;return{nodeId:e.id,minX:r-t/2-a,maxX:r+t/2+a,minY:i-n/2-a,maxY:i+n/2+a,visualXHalfExtent:l?n/2+a:t/2+a}}),f=e((e,t,n,r)=>{let i=c.find(n=>n.orientation===e&&Math.abs(n.coord-t)<1);return i||(i={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},c.push(i)),i.spanMin=Math.min(i.spanMin,n),i.spanMax=Math.max(i.spanMax,r),i},`getOrAddPipe`),p=e((e,t)=>{let n=e.width??10,r=e.height??10,i=e.x??0,a=e.y??0;switch(t){case`top`:return{x:i,y:a-r/2};case`bottom`:return{x:i,y:a+r/2};case`left`:return{x:i-n/2,y:a};case`right`:return{x:i+n/2,y:a}}},`portForSide`),m=e((e,t,n)=>p(e,Xn(e,t,n?`bottom`:`top`)),`getOrthogonalPort`),h=[],g=[],_=new Set,v=1e3,y=e((e,t,n)=>{if(h.length===0)return 0;let r=Math.abs(t.y-n.y)<$,i=Math.abs(t.x-n.x)<$;if(!r&&!i)return 0;let a=0;if(r){let r=t.y,i=Math.min(t.x,n.x)-$,o=Math.max(t.x,n.x)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex===e||t.orientation!==`vertical`||t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v)}else if(i){let r=t.x,i=Math.min(t.y,n.y)-$,o=Math.max(t.y,n.y)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex===e||t.orientation!==`horizontal`||t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v)}return a},`crossingPenalty`),b=a.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=o.get(e.start),r=o.get(e.end),i=s.get(e.start),a=s.get(e.end);return{idx:t,crossLane:i&&a&&i.id!==a.id?1:0,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),x=e((e,t,n,r)=>{let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return!!d.find(c=>n&&c.nodeId===n||r&&c.nodeId===r?!1:Math.abs(e.x-t.x)>$?c.minY<e.y&&c.maxY>e.y&&c.maxX>i&&c.minX<a:c.minX<e.x&&c.maxX>e.x&&c.maxY>o&&c.minY<s)},`isSegmentBlocked`),S=new Map,C=new Map;for(let e of a)!e.start||!e.end||e.start===e.end||(C.set(e.start,(C.get(e.start)??0)+1),C.set(e.end,(C.get(e.end)??0)+1));let w=e((e,t)=>Xn(e,t,`bottom`),`determineSide`),T=new Map;for(let[e,t]of a.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)continue;let i=(r.x??0)-(n.x??0),a=(r.y??0)-(n.y??0);T.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:w(n,{x:r.x??0,y:r.y??0}),dstSide:w(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(i),absDy:Math.abs(a),dxSign:Math.sign(i),dySign:Math.sign(a)})}let E=e(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.absDx===0?1/0:e.absDy/e.absDx:e.absDy===0?1/0:e.absDx/e.absDy,`preferenceStrength`),D=e(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.dxSign>=0?`right`:`left`:e.dySign>=0?`bottom`:`top`,`secondarySide`),O=new Map;for(let e of T.values()){let t=`${e.srcId}:${e.srcSide}`;O.has(t)||O.set(t,[]),O.get(t).push(e)}let k=new Map,A=e((e,t)=>`${e}:${t}`,`loadKey`);for(let e of T.values())k.set(A(e.srcId,e.srcSide),(k.get(A(e.srcId,e.srcSide))??0)+1),k.set(A(e.dstId,e.dstSide),(k.get(A(e.dstId,e.dstSide))??0)+1);for(let e of O.values())if(!(e.length<2)){e.sort((e,t)=>{let n=E(e),r=E(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=D(n),i=k.get(A(n.srcId,n.srcSide))??0,a=k.get(A(n.srcId,r))??0;a>=i||(k.set(A(n.srcId,n.srcSide),i-1),k.set(A(n.srcId,r),a+1),n.srcSide=r)}}let j=e(e=>{let t=e?.shape;return t===`question`||t===`diamond`},`isDiamondNode`),M=new Map;for(let e of T.values())M.has(e.dstId)||M.set(e.dstId,new Set),M.get(e.dstId).add(e.dstSide);for(let e of T.values()){if(!j(o.get(e.srcId)))continue;let t=M.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=D(e);if(t.has(n)||(k.get(A(e.srcId,n))??0)>0)continue;let r=k.get(A(e.srcId,e.srcSide))??0;k.set(A(e.srcId,e.srcSide),Math.max(0,r-1)),k.set(A(e.srcId,n),1),e.srcSide=n}for(let e of T.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:i,dstSide:a}=e,s=o.get(n),c=o.get(r),l=`${n}:${i}:src`,u=i===`top`||i===`bottom`?c.x??0:c.y??0;S.has(l)||S.set(l,[]),S.get(l).push({edgeIdx:t,oppositeCoord:u});let d=`${r}:${a}:dst`,f=a===`top`||a===`bottom`?s.x??0:s.y??0;S.has(d)||S.set(d,[]),S.get(d).push({edgeIdx:t,oppositeCoord:f})}let ee=new Map;for(let[e,t]of S){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(`:`),r=n.slice(0,-2).join(`:`),i=n[n.length-2],a=n[n.length-1],s=o.get(r);if(!s)continue;let c=i===`left`||i===`right`?s.height??10:s.width??10,l=s.shape,u=l===`question`||l===`diamond`?c*.3:c,d=Math.min(20,Math.max(8,u/(t.length+1))),f=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=f+e*d,r=`${n.edgeIdx}:${a}`;ee.set(r,t)}}let N=e(e=>!!a[e]?.labelNodeId,`edgeHasLabelNode`),P=e((e,t)=>e?(S.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>N(e))||(S.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>N(e)):!1,`faceHasLabelNode`),F=e((e,t,n)=>t===`top`||t===`bottom`?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},`applyPortOffset`),I=e((e,t,n)=>{let r=T.get(e),i={x:n.x??0,y:n.y??0},a={x:t.x??0,y:t.y??0},o=r?.srcSide??w(t,i),s=r?.dstSide??w(n,a),c=r?p(t,r.srcSide):m(t,i,!0),l=r?p(n,r.dstSide):m(n,a,!1),u=ee.get(`${e}:src`),d=ee.get(`${e}:dst`);return u!==void 0&&(c=F(c,o,u)),d!==void 0&&(l=F(l,s,d)),{pSrcPort:c,pDstPort:l,srcSide:o,dstSide:s}},`portsForEdge`);for(let t of b){let n=a[t];if(g[t]=[],!n.start||!n.end||n.points&&n.points.length>0||n.start===n.end)continue;let r=o.get(n.start),i=o.get(n.end);if(!r||!i)continue;let{pSrcPort:s,pDstPort:u,srcSide:p,dstSide:m}=I(t,r,i),v={...s},b={...u},w=p===`top`||p===`bottom`,T=m===`top`||m===`bottom`;w?v.y=s.y>(r.y??0)?s.y+Jn:s.y-Jn:v.x=s.x>(r.x??0)?s.x+Jn:s.x-Jn,T?b.y=u.y>(i.y??0)?u.y+Jn:u.y-Jn:b.x=u.x>(i.x??0)?u.x+Jn:u.x-Jn;let E=e((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},`isPointInObstacle`),D=e((e,t,n,r,i)=>{if(i){let i=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+Gn:r.minX-Gn,y:i?r.maxY+Kn:r.minY-Kn,leavesPositiveSide:i}}let a=e.x>(t.x??0),o=(n.y??0)>=e.y;return{x:a?r.maxX+Gn:r.minX-Gn,y:o?r.maxY+Kn:r.minY-Kn,leavesPositiveSide:a}},`obstacleDetour`),O=[],k=[n.start,n.end],A=E(v,k);if(A.inside&&A.obstacle){let e=A.obstacle;if(w){let t=D(s,r,i,e,!0);v.x=t.x,v.y=t.y;let n=t.leavesPositiveSide?Math.min(e.minY-2,s.y+Jn):Math.max(e.maxY+2,s.y-Jn);O=[{x:s.x,y:n},{x:t.x,y:n},{x:t.x,y:t.y}]}else{let t=D(s,r,i,e,!1),n=t.leavesPositiveSide?Math.min(e.minX-2,s.x+Jn):Math.max(e.maxX+2,s.x-Jn);v.x=t.x,v.y=t.y,O=[{x:n,y:s.y},{x:n,y:t.y},{x:t.x,y:t.y}]}}let j=[],M=E(b,k);if(M.inside&&M.obstacle){let e=M.obstacle;if(T){let t=D(u,i,r,e,!0);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:u.x,y:t.y}]}else{let t=D(u,i,r,e,!1);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:t.x,y:u.y}]}}if(O.length===0&&j.length===0){let e=Gn,r=Math.abs(v.x-b.x)<e,i=Math.abs(v.y-b.y)<e,a=ee.get(`${t}:src`)!==void 0||ee.get(`${t}:dst`)!==void 0,o=(S.get(`${n.start??``}:${p}:src`)?.length??0)+(S.get(`${n.start??``}:${p}:dst`)?.length??0),c=(S.get(`${n.end??``}:${m}:src`)?.length??0)+(S.get(`${n.end??``}:${m}:dst`)?.length??0),l=o>1||c>1,d=C.get(n.start??``)??0,f=C.get(n.end??``)??0,g=o>1&&P(n.start,p)||c>1&&P(n.end,m);if((r||i)&&!a&&(!l||l&&!g&&(o<=1||d<=2)&&(c<=1||f<=2))&&!x(s,u,n.start,n.end)){n.points=[{...s},{...v},{...b},{...u}],_.add(t);let e=i?`horizontal`:`vertical`,r=i?s.y:s.x,a=i?Math.min(s.x,u.x):Math.min(s.y,u.y),o=i?Math.max(s.x,u.x):Math.max(s.y,u.y),c={id:`fast-path-${e}-${r.toFixed(0)}-${t}`,orientation:e,coord:r,spanMin:a,spanMax:o,tracks:[]};h.push({edgeIndex:t,segmentIndex:0,orientation:e,pipe:c,trackIndex:0,from:a,to:o});continue}}v.x=f(`vertical`,v.x,v.y,v.y).coord,b.x=f(`vertical`,b.x,b.y,b.y).coord;let N=Math.min(v.x,b.x)-50,F=Math.max(v.x,b.x)+50,L=Math.min(v.y,b.y)-50,R=Math.max(v.y,b.y)+50;for(let e of d){let t=Math.min(v.x,b.x),n=Math.max(v.x,b.x),r=Math.min(v.y,b.y),i=Math.max(v.y,b.y);e.minX<n&&e.maxX>t&&e.minY<i&&e.maxY>r&&(N=Math.min(N,e.minX-qn),F=Math.max(F,e.maxX+qn),L=Math.min(L,e.minY-qn),R=Math.max(R,e.maxY+qn))}for(let e of d){if(e.maxX<N||e.minX>F||e.maxY<L||e.minY>R)continue;let t=Gn;f(`horizontal`,e.minY-t,N,F),f(`horizontal`,e.maxY+t,N,F);let n=Kn;f(`vertical`,e.minX-n,L,R),f(`vertical`,e.maxX+n,L,R)}f(`horizontal`,v.y,N,F),f(`horizontal`,b.y,N,F);let z=c.filter(e=>e.orientation===`horizontal`&&e.coord>=L&&e.coord<=R),te=c.filter(e=>e.orientation===`vertical`&&e.coord>=N&&e.coord<=F),B=e((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,`getKey`),V=B(v.x,v.y),ne=B(b.x,b.y),re=new Map,ie=new Map,ae=new Map,oe=new Set,H=[];re.set(V,0),ae.set(V,`n`),H.push({key:V,f:Math.hypot(b.x-v.x,b.y-v.y),pt:v}),oe.add(V);let U=[],W=e((e,t)=>x(e,t,n.start,n.end),`checkSegmentBlocked`),se={x:b.x,y:v.y},ce=W(v,se),le=W(se,b),ue=ce||le,G={x:v.x,y:b.y},de=W(v,G),fe=W(G,b);if(ue?de||fe||(U=Math.abs(v.x-b.x)<$?[v,b]:[v,G,b]):U=Math.abs(v.y-b.y)<$||Math.abs(v.x-b.x)<$?[v,b]:[v,se,b],U.length===0)for(;H.length>0;){H.sort((e,t)=>e.f-t.f);let e=H.shift();if(oe.delete(e.key),e.key===ne){let e=ne,t=b;for(U=[t];ie.has(e);){let n=ie.get(e);U.unshift(n),t=n,e=B(n.x,n.y)}break}let r=e.pt.x,i=e.pt.y,a=te.sort((e,t)=>e.coord-t.coord),o=a.findIndex(e=>Math.abs(e.coord-r)<1),s=z.sort((e,t)=>e.coord-t.coord),c=s.findIndex(e=>Math.abs(e.coord-i)<1),l=[];o>0&&l.push({x:a[o-1].coord,y:i}),o>=0&&o<a.length-1&&l.push({x:a[o+1].coord,y:i}),c>0&&l.push({x:r,y:s[c-1].coord}),c>=0&&c<s.length-1&&l.push({x:r,y:s[c+1].coord});for(let a of l){let o=Math.min(r,a.x),s=Math.max(r,a.x),c=Math.min(i,a.y),l=Math.max(i,a.y);if(d.some(e=>e.nodeId===n.start||e.nodeId===n.end?!1:o===s?e.minX<r&&e.maxX>r&&e.maxY>c&&e.minY<l:e.minY<i&&e.maxY>i&&e.maxX>o&&e.minX<s))continue;let u=B(a.x,a.y),f=Math.abs(a.x-r)+Math.abs(a.y-i),p=y(t,e.pt,a),m=0,h=b.x-v.x,g=b.y-v.y,_=a.x-r,x=a.y-i;(g>10&&x<-5||g<-10&&x>5)&&(m=Math.abs(x)*100),(h>10&&_<-5||h<-10&&_>5)&&(m+=Math.abs(_)*50);let S=0,C=ae.get(e.key)??`n`,w=Math.abs(_)>$?`h`:`v`;C!==`n`&&C!==w&&(S=50);let T=f+p+m+S,E=(re.get(e.key)??1/0)+T,D=Math.abs(b.x-a.x)+Math.abs(b.y-a.y);if(E<(re.get(u)??1/0)){if(ie.set(u,e.pt),re.set(u,E),ae.set(u,w),!oe.has(u))H.push({key:u,f:E+D,pt:a}),oe.add(u);else{let e=H.findIndex(e=>e.key===u);e!==-1&&(H[e].f=E+D)}}}}if(U.length===0&&(U=[v,{x:v.x,y:b.y},b]),U.length>4){let t=U[0],n=U[U.length-1],r=Math.min(t.x,n.x),i=Math.max(t.x,n.x),a=Math.min(t.y,n.y),o=Math.max(t.y,n.y);for(let e of U)r=Math.min(r,e.x),i=Math.max(i,e.x),a=Math.min(a,e.y),o=Math.max(o,e.y);let s=i>Math.max(t.x,n.x),c=r<Math.min(t.x,n.x);if(l){let e=Kn;if(s){let r=Math.max(t.x,n.x),a=Math.min(t.y,n.y),o=Math.max(t.y,n.y),s=d.filter(e=>e.minX<r&&e.maxX>r&&e.minY<o&&e.maxY>a);if(s.length>0){let r=Math.max(t.x,n.x);for(let t of s){let n=(t.minX+t.maxX)/2;if(t.visualXHalfExtent===void 0||isNaN(t.visualXHalfExtent))continue;let i=n+t.visualXHalfExtent+e;r=Math.max(r,i)}isNaN(r)||(i=r)}}if(c){let i=d.filter(r=>r.minX<Math.min(t.x,n.x)+e&&r.minY<Math.max(t.y,n.y)&&r.maxY>Math.min(t.y,n.y));if(i.length>0){let a=Math.min(t.x,n.x);for(let t of i){let n=(t.minX+t.maxX)/2-t.visualXHalfExtent-e;a=Math.min(a,n)}r=a}}}let u=e(e=>{let r=n.y>t.y,i=d.filter(e=>{let r=Math.min(t.x,n.x)<e.maxX&&Math.max(t.x,n.x)>e.minX,i=Math.min(t.y,n.y)<e.maxY&&Math.max(t.y,n.y)>e.minY;return r&&i}),a=i;if(l&&i.length>0){let t=i.filter(t=>t.minX<e&&t.maxX>e);t.length>0&&(a=t)}if(a.length===0)return n.y;let o=Gn;if(r){let e=Math.max(...a.map(e=>e.maxY))+o;if(e<n.y-$)return e}else{let e=Math.min(...a.map(e=>e.minY))-o;if(e>n.y+$)return e}return n.y},`findBestReturnY`),f=e(e=>{let r=u(e),i={x:e,y:t.y},a={x:e,y:r},o={x:n.x,y:r},s=W(t,i),c=W(i,a),l=W(a,o),d=r!==n.y&&W(o,n);return!s&&!c&&!l&&!d?Math.abs(r-n.y)<$?[t,i,a,n]:[t,i,a,o,n]:null},`trySimplifyWithDetourX`),p=s&&!c?f(i):c&&!s?f(r):null;p&&(U=p)}let K=[s,...O,...U,...j.reverse(),u];if(K.length>=3){let e=K[K.length-1],t=K[K.length-2],n=K[K.length-3],r=Math.abs(n.y-t.y)<$&&Math.abs(t.y-e.y)<$,i=Math.abs(n.x-t.x)<$&&Math.abs(t.x-e.x)<$;if(r){let r=Math.sign(t.x-n.x),i=Math.sign(e.x-n.x);r!==0&&r===i&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&K.splice(-2,1)}else if(i){let r=Math.sign(t.y-n.y),i=Math.sign(e.y-n.y);r!==0&&r===i&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&K.splice(-2,1)}}let q=[K[0]];for(let e=1;e<K.length-1;e++){if(e===1){q.push(K[e]);continue}let t=q[q.length-1],n=K[e],r=K[e+1];if(Math.abs(t.y-n.y)<$&&Math.abs(n.y-r.y)<$){if(n.x>t.x!=r.x>n.x){q.push(n);continue}continue}if(Math.abs(t.x-n.x)<$&&Math.abs(n.x-r.x)<$){if(n.y>t.y!=r.y>n.y){q.push(n);continue}continue}q.push(n)}q.push(K[K.length-1]);for(let e=0;e<q.length-1;e++){let n=q[e],r=q[e+1],i=Math.abs(n.x-r.x)<$?`vertical`:`horizontal`,a=i===`vertical`?n.x:n.y,o=i===`vertical`?Math.min(n.y,r.y):Math.min(n.x,r.x),s=i===`vertical`?Math.max(n.y,r.y):Math.max(n.x,r.x),c=f(i,a,o,s),l={edgeIndex:t,segmentIndex:e,orientation:i,pipe:c,trackIndex:0,from:o,to:s};h.push(l),g[t].push(h.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:o,to:s})}}let L=e((e,t)=>e.from<t.to&&t.from<e.to,`segmentsOverlap`),R=e((e,t,n,r)=>{let i=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&L(n,e)),a=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&L(n,t));return i&&a?(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0):!1},`trySwapSegmentsAcrossTracks`),z=e(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},`createNewTrack`),te=e((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},`moveSegmentToTrack`),B=e((e,t)=>{let n=g[e.edgeIndex];for(let r of n){let n=h[r];n.pipe===e.pipe&&te(n,t)}},`moveSegmentChainToTrack`),V=e(e=>{let t=g[e.edgeIndex],n=t.indexOf(h.indexOf(e)),r=[];return n>0&&r.push(h[t[n-1]]),n<t.length-1&&r.push(h[t[n+1]]),r},`getAdjacentSegmentsAlongEdge`),ne=e((e,t)=>{if(e.orientation===t.orientation)return!1;let n=e.orientation===`horizontal`?e:t,r=e.orientation===`horizontal`?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},`haveAnyCrossing`),re=e((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&L(e,t)))return n.index;return-1},`findAvailableTrack`),ie=e((e,t)=>{if(e.trackIndex===t.trackIndex)return L(e,t);let n=V(e),r=V(t);return n.some(e=>r.some(t=>ne(e,t)))},`segmentsConflict`),ae=e((e,t,n)=>{if(R(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=re(e.pipe,t);n(t,r===-1?z(e.pipe):r)},`resolveTrackConflict`),oe=e(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let i=e[n],a=e[r];i.pipe===a.pipe&&ie(i,a)&&(t++,ae(i,a,B))}return t},`resolveHandleConflicts`),H=new Map,U=e(e=>{if(H.has(e))return H.get(e);let t=g[e];if(t.length===0){let t={dest:0,deviation:0,base:0,delta:0};return H.set(e,t),t}let n=h[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let i=h[t[e]];if(i.orientation===`horizontal`){let e=i.from,t=i.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let i=Math.abs(r-n),a={dest:r,deviation:i,base:n,delta:r-n};return H.set(e,a),a},`getDestInfo`),W=e(()=>{let t=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.start&&(n.has(t.start)||n.set(t.start,[]),n.get(t.start).push(e));let r=e(e=>{let t=a[e];if(!t.start||!t.end)return 0;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)return 0;let i=(r.x??0)-(n.x??0),s=(r.y??0)-(n.y??0);return Math.abs(i)+Math.abs(s)},`getEdgeDistance`);for(let e of n.values()){e.sort((e,t)=>{let n=U(e),i=U(t);if(Math.abs(n.deviation-i.deviation)>1)return n.deviation-i.deviation;if(Math.abs(n.dest-i.dest)>1)return n.dest-i.dest;let a=r(e),o=r(t);if(Math.abs(a-o)>1)return o-a;let s=g[e].length,c=g[t].length;if(s!==c)return s-c;if(s===1){let n=g[e][0],r=g[t][0];if(h[n]&&h[r]){let e=h[n],t=h[r],i=Math.abs(e.to-e.from),a=Math.abs(t.to-t.from);if(Math.abs(i-a)>1)return i-a}}return 0});let n=e.map(e=>h[g[e][0]]);t+=oe(n)}return t},`fixSourceHandleCrossings`),se=e(()=>{let t=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.end&&(n.has(t.end)||n.set(t.end,[]),n.get(t.end).push(e));for(let r of n.values()){r.sort((t,n)=>{let r=e(e=>{let t=g[e];if(t.length<2)return 0;let n=h[t[t.length-2]];return Math.abs(n.to-n.from)},`getDist`),i=r(t),a=r(n);return Math.abs(i-a)>.1?i-a:t-n});let n=r.map(e=>h[g[e][g[e].length-1]]);t+=oe(n)}return t},`fixTargetHandleCrossings`),ce=e(()=>{let e=0;for(let t of c){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=g[t.edgeIndex].find(e=>h[e].segmentIndex===t.segmentIndex);e!==void 0&&n.push(h[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let i=n[t],a=n[r];ie(i,a)&&(e++,ae(i,a,te))}}return e},`fixPipeCrossings`),le=0;for(;le<10;){let e=0;if(e+=W(),e+=se(),e+=ce(),e===0)break;le++}let ue=new Map;for(let t of c){let n=[];t.tracks.forEach(e=>{e.segments.forEach(t=>{n.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,trackIndex:e.index,from:t.from,to:t.to})})}),n.sort((e,t)=>e.from-t.from);let r=[];if(n.length>0){let e=[n[0]],t=n[0].to;for(let i=1;i<n.length;i++){let a=n[i];a.from<t?(e.push(a),t=Math.max(t,a.to)):(r.push(e),e=[a],t=a.to)}r.push(e)}for(let n of r){let r=new Set;n.forEach(e=>r.add(e.trackIndex));let i=new Map;n.forEach(e=>{let t=U(e.edgeIndex);i.set(e.trackIndex,(i.get(e.trackIndex)??0)+t.delta)});let a=[...r].filter(e=>(i.get(e)??0)<-1),o=[...r].filter(e=>(i.get(e)??0)>1),s=[...r].filter(e=>Math.abs(i.get(e)??0)<=1);a.sort((e,t)=>(i.get(t)??0)-(i.get(e)??0)),o.sort((e,t)=>(i.get(e)??0)-(i.get(t)??0));let c=e((e,r)=>{n.filter(t=>t.trackIndex===e).forEach(e=>{let n=_.has(e.edgeIndex)?t.coord:r;ue.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},`assignCoord`),l=0;for(let e of a)l++,c(e,t.coord-l*Yn);if(s.length===0&&r.size>0){let e=[...r].sort((e,t)=>Math.abs(i.get(e)??0)-Math.abs(i.get(t)??0))[0],t=a.indexOf(e);t!==-1&&a.splice(t,1);let n=o.indexOf(e);n!==-1&&o.splice(n,1),s.push(e)}let u=0;for(let e of s){if(u===0)c(e,t.coord);else{let n=u%2==1?1:-1,r=Math.ceil(u/2);c(e,t.coord+n*r*Yn*.5)}u++}let d=0;for(let e of o)d++,c(e,t.coord+d*Yn)}}for(let[e,t]of a.entries()){let n=g[e]??[];if(n.length===0)continue;let r=[],{pSrcPort:i,pDstPort:a}=I(e,o.get(t.start),o.get(t.end)),s=n.map(e=>{let t=h[e],n=ue.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(i);for(let e=0;e<s.length;e++){let t=s[e],n=r[r.length-1],i=t.orient===`vertical`?n.y:n.x,a=t.orient===`vertical`?n.x:n.y,o=s[e+1],c=e<s.length-1;if(Math.abs(a-t.coord)>$&&r.push(Qn(t,i)),c&&o.orient===t.orient){if(Math.abs(t.coord-o.coord)>$){let e=t.orient===`vertical`?(i+o.from)/2:Zn(t,o);r.push(Qn(t,e),Qn(o,e))}else(e===0||e===s.length-2)&&r.push(Qn(t,Zn(t,o)))}else if(c)r.push(Qn(t,o.coord));else{let e=Math.abs(t.from-i)<Math.abs(t.to-i)?t.to:t.from;r.push(Qn(t,e))}}let c=r[r.length-1];(Math.abs(c.x-a.x)>$||Math.abs(c.y-a.y)>$)&&r.push(a);let l=[];r.length>0&&l.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=l[l.length-1];(Math.abs(t.x-n.x)>$||Math.abs(t.y-n.y)>$)&&l.push(t)}t.points=l}for(let e of a){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}t.edges=(t.edges??[]).filter(e=>!e.isLayoutOnly);let G=e((e,t)=>{let n=t.x??0,r=t.y??0,i=t.width??0,a=t.height??0;if(i<=0||a<=0)return e;let o=n-i/2,s=n+i/2,c=r-a/2,l=r+a/2;if(e.x<o||e.x>s||e.y<c||e.y>l)return e;let u=e.x-o,d=s-e.x,f=e.y-c,p=l-e.y,m=Math.min(u,d,f,p);return m===u?{x:o,y:e.y}:m===d?{x:s,y:e.y}:m===f?{x:e.x,y:c}:{x:e.x,y:l}},`nodeBoundaryClamp`);for(let e of t.edges){let t=e.points;if(!t||t.length<2)continue;let n=e.start,r=e.end,i=n?o.get(n):void 0,a=r?o.get(r):void 0;i&&(t[0]=G(t[0],i)),a&&(t[t.length-1]=G(t[t.length-1],a))}return t}e($n,`routeEdgesOrthogonal`);function er(e){return e.direction??`TB`}e(er,`getSwimlaneDirection`);function tr(e){let t=O(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,o=e.config.swimlane?.automaticLaneOrdering??!1,s=er(e),{ordered:c,coordinates:l}=Un(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:o,direction:s});k(t,c,l,{nodeGap:n,layerGap:r});for(let t of e.edges??[])delete t.points;$n(e,s);for(let t of e.edges??[])(!t.curve||t.curve===`basis`)&&(t.curve=`rounded`);return Nt(e,s),Mt(e),s}e(tr,`runSwimlaneLayoutCore`);function nr(e){D(e);let t=j(e);e.nodes=t.nodes,e.edges=t.edges}e(nr,`prepareSwimlaneLayout`);var rr=r({prepareLayout:nr,runLayoutCore:tr,afterPaint:C});export{rr as render};
@@ -0,0 +1,8 @@
1
+ import{t as e}from"./chunk-AQ6EADP3-CZhslHi-.js";import"./chunk-H7VHZCWX-CwFRFlEn.js";import"./chunk-QJSWEUOL-kvKBktmc.js";import"./chunk-5IMINLNL-Cl3N81sR.js";import"./chunk-ZNLK7HRR-B-wIfXTw.js";import"./chunk-2NMSUPJH-DuxvnX1p.js";import"./chunk-STOV2HOB-GnExfzIX.js";import"./chunk-VY2OSTJR-BYk2nUI_.js";import"./chunk-DZP67EKU-9RpG5Rdc.js";import"./chunk-Z6V44ARX-CWGOZvke.js";import"./chunk-VRZKL3EH-BzaZ6KlD.js";import"./chunk-ZQN7UHIL-CNp35E78.js";import"./chunk-4OADUZ5Q-DHE3k_pb.js";import"./chunk-NUDPKBEF-CL0e9XiQ.js";import"./chunk-YDMLL4PJ-BHgx6nXf.js";import"./chunk-AZZRMDJM-y-xJBuMz.js";import"./chunk-EICP7K5X-8YS1Gtlr.js";import"./chunk-RCXAM2GK-BeKcutEV.js";import"./chunk-VTHDQ7BV-BqUEu5Ml.js";import{n as t,t as n}from"./chunk-CLS4B6BI-BRLlisnG.js";var r=e(e=>`${t(e)}
2
+ .swimlane.cluster rect {
3
+ stroke: ${e.clusterBorder} !important;
4
+ }
5
+ [data-look="neo"].cluster rect {
6
+ filter: none;
7
+ }
8
+ `,`getStyles`),i=n({defaultLayout:`swimlane`,styles:r});export{i as diagram};
@@ -0,0 +1,120 @@
1
+ import{r as e,t}from"./chunk-AQ6EADP3-CZhslHi-.js";import{V as n,W as r,q as i}from"./chunk-H7VHZCWX-CwFRFlEn.js";import{B as a,K as o,P as s,c,h as l,it as u,l as d,r as f}from"./chunk-QJSWEUOL-kvKBktmc.js";import{t as p}from"./chunk-IJBDOHL6-CgcssvZb.js";import"./chunk-STOV2HOB-GnExfzIX.js";import{p as m}from"./chunk-VY2OSTJR-BYk2nUI_.js";var h=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[6,11,13,14,15,17,19,20,23,24],r=[1,12],i=[1,13],a=[1,14],o=[1,15],s=[1,16],c=[1,19],l=[1,20],u={trace:t(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:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 3:r.setDirection(`LR`);break;case 4:r.setDirection(`TD`);break;case 5:this.$=[];break;case 6:a[s-1].push(a[s]),this.$=a[s-1];break;case 7:case 8:this.$=a[s];break;case 9:case 10:this.$=[];break;case 11:r.getCommonDb().setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 12:this.$=a[s].trim(),r.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[s].trim(),r.getCommonDb().setAccDescription(this.$);break;case 15:r.addSection(a[s].substr(8)),this.$=a[s].substr(8);break;case 18:r.addTask(a[s],0,``),this.$=a[s];break;case 19:r.addEvent(a[s].substr(2)),this.$=a[s]}},`anonymous`),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(n,[2,5],{5:6}),e(n,[2,2]),e(n,[2,3]),e(n,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:i,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(n,[2,10],{1:[2,1]}),e(n,[2,6]),{12:21,14:r,15:i,17:a,19:o,20:s,21:17,22:18,23:c,24:l},e(n,[2,8]),e(n,[2,9]),e(n,[2,11]),{16:[1,22]},{18:[1,23]},e(n,[2,14]),e(n,[2,15]),e(n,[2,16]),e(n,[2,17]),e(n,[2,18]),e(n,[2,19]),e(n,[2,7]),e(n,[2,12]),e(n,[2,13])],defaultActions:{},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,typeof h.yylloc>`u`&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e;return e=i.pop()||h.lex()||p,typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:((S===null||typeof S>`u`)&&(S=x()),T=s[w]&&s[w][S]),typeof T>`u`||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
+ `+h.showPosition()+`
3
+ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),typeof E<`u`)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};u.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,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:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(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:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
5
+ `+t+`^`},`showPosition`),test_match:t(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={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&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,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(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:t(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):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:t(function(){return this.next()||this.lex()},`lex`),begin:t(function(e){this.conditionStack.push(e)},`begin`),popState:t(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:t(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:t(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:t(function(e){this.begin(e)},`pushState`),stateStackSize:t(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:t(function(e,t,n,r){switch(n){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin(`acc_title`),15;case 10:return this.popState(),`acc_title_value`;case 11:return this.begin(`acc_descr`),17;case 12:return this.popState(),`acc_descr_value`;case 13:this.begin(`acc_descr_multiline`);break;case 14:this.popState();break;case 15:return`acc_descr_multiline_value`;case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return`INVALID`}},`anonymous`),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}})();function d(){this.yy={}}return t(d,`Parser`),d.prototype=u,u.Parser=d,new d})();h.parser=h;var g=h,_={};e(_,{addEvent:()=>M,addSection:()=>O,addTask:()=>j,addTaskOrg:()=>N,clear:()=>T,default:()=>ee,getCommonDb:()=>w,getDirection:()=>D,getSections:()=>k,getTasks:()=>A,setDirection:()=>E});var v=``,y=0,b=`LR`,x=[],S=[],C=[],w=t(()=>u,`getCommonDb`),T=t(function(){x.length=0,S.length=0,v=``,C.length=0,b=`LR`,l()},`clear`),E=t(function(e){b=e},`setDirection`),D=t(function(){return b},`getDirection`),O=t(function(e){v=e,x.push(e)},`addSection`),k=t(function(){return x},`getSections`),A=t(function(){let e=P(),t=0;for(;!e&&t<100;)e=P(),t++;return S.push(...C),S},`getTasks`),j=t(function(e,t,n){let r={id:y++,section:v,type:v,task:e,score:t||0,events:n?[n]:[]};C.push(r)},`addTask`),M=t(function(e){C.find(e=>e.id===y-1).events.push(e)},`addEvent`),N=t(function(e){let t={section:v,type:v,description:e,task:e,classes:[]};S.push(t)},`addTaskOrg`),P=t(function(){let e=t(function(e){return C[e].processed},`compileTask`),n=!0;for(let[t,r]of C.entries())e(t),n&&=r.processed;return n},`compileTasks`),ee={clear:T,getCommonDb:w,getDirection:D,setDirection:E,addSection:O,getSections:k,getTasks:A,addTask:j,addTaskOrg:N,addEvent:M},F=0,I=t(function(e,t){let n=e.append(`rect`);return n.attr(`x`,t.x),n.attr(`y`,t.y),n.attr(`fill`,t.fill),n.attr(`stroke`,t.stroke),n.attr(`width`,t.width),n.attr(`height`,t.height),n.attr(`rx`,t.rx),n.attr(`ry`,t.ry),t.class!==void 0&&n.attr(`class`,t.class),n},`drawRect`),te=t(function(e,n){let i=e.append(`circle`).attr(`cx`,n.cx).attr(`cy`,n.cy).attr(`class`,`face`).attr(`r`,15).attr(`stroke-width`,2).attr(`overflow`,`visible`),a=e.append(`g`);a.append(`circle`).attr(`cx`,n.cx-5).attr(`cy`,n.cy-5).attr(`r`,1.5).attr(`stroke-width`,2).attr(`fill`,`#666`).attr(`stroke`,`#666`),a.append(`circle`).attr(`cx`,n.cx+5).attr(`cy`,n.cy-5).attr(`r`,1.5).attr(`stroke-width`,2).attr(`fill`,`#666`).attr(`stroke`,`#666`);function o(e){let t=r().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(6.8181818181818175);e.append(`path`).attr(`class`,`mouth`).attr(`d`,t).attr(`transform`,`translate(`+n.cx+`,`+(n.cy+2)+`)`)}t(o,`smile`);function s(e){let t=r().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(6.8181818181818175);e.append(`path`).attr(`class`,`mouth`).attr(`d`,t).attr(`transform`,`translate(`+n.cx+`,`+(n.cy+7)+`)`)}t(s,`sad`);function c(e){e.append(`line`).attr(`class`,`mouth`).attr(`stroke`,2).attr(`x1`,n.cx-5).attr(`y1`,n.cy+7).attr(`x2`,n.cx+5).attr(`y2`,n.cy+7).attr(`class`,`mouth`).attr(`stroke-width`,`1px`).attr(`stroke`,`#666`)}return t(c,`ambivalent`),n.score>3?o(a):n.score<3?s(a):c(a),i},`drawFace`),ne=t(function(e,t){let n=e.append(`circle`);return n.attr(`cx`,t.cx),n.attr(`cy`,t.cy),n.attr(`class`,`actor-`+t.pos),n.attr(`fill`,t.fill),n.attr(`stroke`,t.stroke),n.attr(`r`,t.r),n.class!==void 0&&n.attr(`class`,n.class),t.title!==void 0&&n.append(`title`).text(t.title),n},`drawCircle`),L=t(function(e,t){let n=t.text.replace(/<br\s*\/?>/gi,` `),r=e.append(`text`);r.attr(`x`,t.x),r.attr(`y`,t.y),r.attr(`class`,`legend`),r.style(`text-anchor`,t.anchor),t.class!==void 0&&r.attr(`class`,t.class);let i=r.append(`tspan`);return i.attr(`x`,t.x+t.textMargin*2),i.text(n),r},`drawText`),re=t(function(e,n){function r(e,t,n,r,i){return e+`,`+t+` `+(e+n)+`,`+t+` `+(e+n)+`,`+(t+r-i)+` `+(e+n-i*1.2)+`,`+(t+r)+` `+e+`,`+(t+r)}t(r,`genPoints`);let i=e.append(`polygon`);i.attr(`points`,r(n.x,n.y,50,20,7)),i.attr(`class`,`labelBox`),n.y+=n.labelMargin,n.x+=.5*n.labelMargin,L(e,n)},`drawLabel`),R=t(function(e,t,n){let r=e.append(`g`),i=B();i.x=t.x,i.y=t.y,i.fill=t.fill,i.width=n.width,i.height=n.height,i.class=`journey-section section-type-`+t.num,i.rx=3,i.ry=3,I(r,i),V(n)(t.text,r,i.x,i.y,i.width,i.height,{class:`journey-section section-type-`+t.num},n,t.colour)},`drawSection`),z=-1,ie=t(function(e,t,n,r){let i=t.x+n.width/2,a=e.append(`g`);z++,a.append(`line`).attr(`id`,r+`-task`+z).attr(`x1`,i).attr(`y1`,t.y).attr(`x2`,i).attr(`y2`,450).attr(`class`,`task-line`).attr(`stroke-width`,`1px`).attr(`stroke-dasharray`,`4 2`).attr(`stroke`,`#666`),te(a,{cx:i,cy:300+(5-t.score)*30,score:t.score});let o=B();o.x=t.x,o.y=t.y,o.fill=t.fill,o.width=n.width,o.height=n.height,o.class=`task task-type-`+t.num,o.rx=3,o.ry=3,I(a,o),V(n)(t.task,a,o.x,o.y,o.width,o.height,{class:`task`},n,t.colour)},`drawTask`),ae=t(function(e,t){I(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:`rect`}).lower()},`drawBackgroundRect`),oe=t(function(){return{x:0,y:0,fill:void 0,"text-anchor":`start`,width:100,height:100,textMargin:0,rx:0,ry:0}},`getTextObj`),B=t(function(){return{x:0,y:0,width:100,anchor:`start`,height:100,rx:0,ry:0}},`getNoteRect`),V=(function(){function e(e,t,n,r,a,o,s,c){i(t.append(`text`).attr(`x`,n+a/2).attr(`y`,r+o/2+5).style(`font-color`,c).style(`text-anchor`,`middle`).text(e),s)}t(e,`byText`);function n(e,t,n,r,a,o,s,c,l){let{taskFontSize:u,taskFontFamily:d}=c,f=e.split(/<br\s*\/?>/gi);for(let e=0;e<f.length;e++){let c=e*u-u*(f.length-1)/2,p=t.append(`text`).attr(`x`,n+a/2).attr(`y`,r).attr(`fill`,l).style(`text-anchor`,`middle`).style(`font-size`,u).style(`font-family`,d);p.append(`tspan`).attr(`x`,n+a/2).attr(`dy`,c).text(f[e]),p.attr(`y`,r+o/2).attr(`dominant-baseline`,`central`).attr(`alignment-baseline`,`central`),i(p,s)}}t(n,`byTspan`);function r(e,t,r,a,o,s,c,l){let u=t.append(`switch`),d=u.append(`foreignObject`).attr(`x`,r).attr(`y`,a).attr(`width`,o).attr(`height`,s).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(e),n(e,u,r,a,o,s,c,l),i(d,c)}t(r,`byFo`);function i(e,t){for(let n in t)n in t&&e.attr(n,t[n])}return t(i,`_setTextAttrs`),function(t){return t.textPlacement===`fo`?r:t.textPlacement===`old`?e:n}})(),se=t(function(e,t){F=0,z=-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 H(e,t){e.each(function(){var e=n(this),r=e.text().split(/(\s+|<br>)/).reverse(),i,a=[],o=1.1,s=e.attr(`y`),c=parseFloat(e.attr(`dy`)),l=e.text(null).append(`tspan`).attr(`x`,0).attr(`y`,s).attr(`dy`,c+`em`);for(let n=0;n<r.length;n++)i=r[r.length-1-n],a.push(i),l.text(a.join(` `).trim()),(l.node().getComputedTextLength()>t||i===`<br>`)&&(a.pop(),l.text(a.join(` `).trim()),a=i===`<br>`?[``]:[i],l=e.append(`tspan`).attr(`x`,0).attr(`y`,s).attr(`dy`,o+`em`).text(i))})}t(H,`wrap`);var ce=t(function(e,t,r,i,a,o=!1){let{theme:s,look:c}=i,l=s?.includes(`redux`),u=r%(i?.themeVariables?.THEME_COLOR_LIMIT??12)-1,d=e.append(`g`);t.section=u,d.attr(`class`,(t.class?t.class+` `:``)+`timeline-node `+(`section-`+u));let f=d.append(`g`),p=d.append(`g`),m=p.append(`text`).text(t.descr).attr(`dy`,`1em`).attr(`alignment-baseline`,`middle`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).call(H,t.width).node().getBBox(),h=i.fontSize?.replace?i.fontSize.replace(`px`,``):i.fontSize;if(t.height=m.height+h*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width+=2*t.padding,p.attr(`transform`,`translate(`+t.width/2+`, `+t.padding/2+`)`),l&&p.attr(`transform`,`translate(${t.width/2}, ${o?t.padding/2+3:t.padding})`),ue(f,t,u,a,i),c===`neo`&&(d.attr(`data-look`,`neo`),l)){let t=s.includes(`dark`),r=e.node()?.ownerSVGElement??e.node(),i=n(r),a=i.attr(`id`)??``,o=a?`${a}-drop-shadow`:`drop-shadow`;if(i.select(`#${o}`).empty()){let e=i.select(`defs`);(e.empty()?i.append(`defs`):e).append(`filter`).attr(`id`,o).attr(`height`,`130%`).attr(`width`,`130%`).append(`feDropShadow`).attr(`dx`,`4`).attr(`dy`,`4`).attr(`stdDeviation`,0).attr(`flood-opacity`,t?`0.2`:`0.06`).attr(`flood-color`,t?`#FFFFFF`:`#000000`)}}return t},`drawNode`),le=t(function(e,t,n){let r=e.append(`g`),i=r.append(`text`).text(t.descr).attr(`dy`,`1em`).attr(`alignment-baseline`,`middle`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).call(H,t.width).node().getBBox(),a=n.fontSize?.replace?n.fontSize.replace(`px`,``):n.fontSize;return r.remove(),i.height+a*1.1*.5+t.padding},`getVirtualNodeHeight`),ue=t(function(e,t,n,r,i){let{theme:a}=i,o=a?.includes(`redux`)?0:5,s=o>0?`M0 ${t.height-5} v${-t.height+10} q0,-${o},${o},-${o} h${t.width-10} q${o},0,${o},${o} v${t.height-5} H0 Z`:`M0 ${t.height-5} v${-(t.height-5)} h${t.width} v${t.height} H0 Z`;e.append(`path`).attr(`id`,r+`-node-`+F++).attr(`class`,`node-bkg node-`+t.type).attr(`d`,s),a?.includes(`redux`)||e.append(`line`).attr(`class`,`node-line-`+n).attr(`x1`,0).attr(`y1`,t.height).attr(`x2`,t.width).attr(`y2`,t.height)},`defaultBkg`),U={drawRect:I,drawCircle:ne,drawSection:R,drawText:L,drawLabel:re,drawTask:ie,drawBackgroundRect:ae,getTextObj:oe,getNoteRect:B,initGraphics:se,drawNode:ce,getVirtualNodeHeight:le},de=t(function(e,t,r,o){let s=a(),{look:l,theme:u,themeVariables:d}=s,{useGradient:f,gradientStart:p,gradientStop:m}=d,h=s.timeline?.leftMargin??50;i.debug(`timeline`,o.db);let g=s.securityLevel,_;g===`sandbox`&&(_=n(`#i`+t));let v=n(g===`sandbox`?_.nodes()[0].contentDocument.body:`body`).select(`#`+t);v.append(`g`);let y=o.db.getTasks(),b=o.db.getCommonDb().getDiagramTitle();i.debug(`task`,y),U.initGraphics(v,t);let x=o.db.getSections();i.debug(`sections`,x);let S=0,C=0,w=0,T=0,E=50+h,D=50;T=50;let O=0,k=!0;x.forEach(function(e){let t={number:O,descr:e,section:O,width:150,padding:20,maxHeight:S},n=U.getVirtualNodeHeight(v,t,s);i.debug(`sectionHeight before draw`,n),S=Math.max(S,n+20)});let A=0,j=0;i.debug(`tasks.length`,y.length);for(let[e,t]of y.entries()){let n={number:e,descr:t,section:t.section,width:150,padding:20,maxHeight:C},r=U.getVirtualNodeHeight(v,n,s);i.debug(`taskHeight before draw`,r),C=Math.max(C,r+20),A=Math.max(A,t.events.length);let a=0;for(let e of t.events){let n={descr:e,section:t.section,number:t.section,width:150,padding:20,maxHeight:50};a+=U.getVirtualNodeHeight(v,n,s)}t.events.length>0&&(a+=(t.events.length-1)*10),j=Math.max(j,a)}i.debug(`maxSectionHeight before draw`,S),i.debug(`maxTaskHeight before draw`,C),x&&x.length>0?x.forEach(e=>{let n=y.filter(t=>t.section===e),r={number:O,descr:e,section:O,width:200*Math.max(n.length,1)-50,padding:20,maxHeight:S};i.debug(`sectionNode`,r);let a=v.append(`g`),o=U.drawNode(a,r,O,s,t);i.debug(`sectionNode output`,o),a.attr(`transform`,`translate(${E}, ${T})`),D+=S+50,n.length>0&&W(v,n,O,E,D,C,s,A,j,S,!1,t),E+=200*Math.max(n.length,1),D=T,O++}):(k=!1,W(v,y,O,E,D,C,s,A,j,S,!0,t));let M=v.node().getBBox();if(i.debug(`bounds`,M),b&&v.append(`text`).text(b).attr(`x`,l===`neo`?M.x*2+h:M.width/2-h).attr(`font-size`,`4ex`).attr(`font-weight`,`bold`).attr(`y`,20),w=k?S+C+150:C+100,v.append(`g`).attr(`class`,`lineWrapper`).append(`line`).attr(`x1`,h).attr(`y1`,w).attr(`x2`,M.width+3*h).attr(`y2`,w).attr(`stroke-width`,4).attr(`stroke`,`black`).attr(`marker-end`,`url(#${t}-arrowhead)`),l===`neo`&&f&&u!==`neutral`){let e=v.select(`defs`),t=(e.empty()?v.append(`defs`):e).append(`linearGradient`).attr(`id`,v.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`,p).attr(`stop-opacity`,1),t.append(`stop`).attr(`offset`,`100%`).attr(`stop-color`,m).attr(`stop-opacity`,1)}c(void 0,v,s.timeline?.padding??50,s.timeline?.useMaxWidth??!1)},`draw`),W=t(function(e,t,n,r,a,o,s,c,l,u,d,f){for(let c of t){let t={descr:c.task,section:n,number:n,width:150,padding:20,maxHeight:o};i.debug(`taskNode`,t);let u=e.append(`g`).attr(`class`,`taskWrapper`),p=U.drawNode(u,t,n,s,f).height;if(i.debug(`taskHeight after draw`,p),u.attr(`transform`,`translate(${r}, ${a})`),o=Math.max(o,p),c.events){let t=e.append(`g`).attr(`class`,`lineWrapper`),i=o;a+=100,i+=fe(e,c.events,n,r,a,s,f),a-=100,t.append(`line`).attr(`x1`,r+95).attr(`y1`,a+o).attr(`x2`,r+95).attr(`y2`,a+o+100+l+100).attr(`stroke-width`,2).attr(`stroke`,`black`).attr(`marker-end`,`url(#${f}-arrowhead)`).attr(`stroke-dasharray`,`5,5`)}r+=200,d&&!s.timeline?.disableMulticolor&&n++}a-=10},`drawTasks`),fe=t(function(e,t,n,r,a,o,s){let c=0,l=a;a+=100;for(let l of t){let t={descr:l,section:n,number:n,width:150,padding:20,maxHeight:50};i.debug(`eventNode`,t);let u=e.append(`g`).attr(`class`,`eventWrapper`),d=U.drawNode(u,t,n,o,s,!0).height;c+=d,u.attr(`transform`,`translate(${r}, ${a})`),a=a+10+d}return a=l,c},`drawEvents`),pe={setConf:t(()=>{},`setConf`),draw:de},G=200,K=5,me=G+K*2,q=G+100,he=q+K*2,J=10,ge=0,Y=20,X=20,Z=30,Q=50,_e=t(function(e,t,n,r){let o=a(),s=o.timeline?.leftMargin??50;i.debug(`timeline`,r.db);let l=p(t);l.append(`g`);let u=r.db.getTasks(),d=r.db.getCommonDb().getDiagramTitle();i.debug(`task`,u),U.initGraphics(l);let f=r.db.getSections();i.debug(`sections`,f);let h=0,g=0,_=50+s,v=50,y=v,b=_,x=me+X,S=he+Q,C=b+x,w=0,T=f&&f.length>0,E=T?C:_+x,D=Math.max(50,x+S-K*2);f.forEach(function(e){let t={number:w,descr:e,section:w,width:D,padding:K,maxHeight:h},n=U.getVirtualNodeHeight(l,t,o);i.debug(`sectionHeight before draw`,n),h=Math.max(h,n)});let O=0;i.debug(`tasks.length`,u.length);for(let[e,t]of u.entries()){let n={number:e,descr:t,section:t.section,width:G,padding:K,maxHeight:g},r=U.getVirtualNodeHeight(l,n,o);i.debug(`taskHeight before draw`,r),g=Math.max(g,r);let a=0;for(let e of t.events){let n={descr:e,section:t.section,number:t.section,width:q,padding:K,maxHeight:50};a+=U.getVirtualNodeHeight(l,n,o)}t.events.length>0&&(a+=(t.events.length-1)*J),O=Math.max(O,a)+ge}i.debug(`maxSectionHeight before draw`,h),i.debug(`maxTaskHeight before draw`,g);let k=Math.max(g,O)+Z;T?f.forEach(e=>{let t=u.filter(t=>t.section===e),n={number:w,descr:e,section:w,width:D,padding:K,maxHeight:h};i.debug(`sectionNode`,n);let r=l.append(`g`),a=U.drawNode(r,n,w,o);i.debug(`sectionNode output`,a);let s=E-x;r.attr(`transform`,`translate(${s}, ${v})`);let c=v+a.height+Y;t.length>0&&$(l,t,w,E,c,g,o,k,!1);let d=t.length,f=a.height+Y+k*Math.max(d,1)-(d>0?Z*2:0);v+=f,w++}):$(l,u,w,E,v,g,o,k,!0);let A=l.node()?.getBBox();if(!A)throw Error(`bbox not found`);if(i.debug(`bounds`,A),d){if(l.append(`text`).text(d).attr(`x`,A.width/2-s).attr(`font-size`,`4ex`).attr(`font-weight`,`bold`).attr(`y`,20),A=l.node()?.getBBox(),!A)throw Error(`bbox not found`);i.debug(`bounds after title`,A)}let[j]=m(o.fontSize),M=(j??16)*2,N=(j??16)*.5+20,P=l.append(`g`).attr(`class`,`lineWrapper`);P.append(`line`).attr(`x1`,E).attr(`y1`,y-M).attr(`x2`,E).attr(`y2`,A.y+A.height+N).attr(`stroke-width`,4).attr(`stroke`,`black`).attr(`marker-end`,`url(#arrowhead)`),P.lower(),c(void 0,l,o.timeline?.padding??50,o.timeline?.useMaxWidth??!1)},`draw`),$=t(function(e,t,n,r,a,o,s,c,l){for(let u of t){let t={descr:u.task,section:n,number:n,width:G,padding:K,maxHeight:o};i.debug(`taskNode`,t);let d=e.append(`g`).attr(`class`,`taskWrapper`),f=U.drawNode(d,t,n,s),p=f.height;i.debug(`taskHeight after draw`,p);let m=r-X-f.width;if(d.attr(`transform`,`translate(${m}, ${a})`),o=Math.max(o,p),u.events&&u.events.length>0){let t=a,i=r+Q;ve(e,u.events,n,r,i,t,s)}a+=c,l&&!s.timeline?.disableMulticolor&&n++}},`drawTasks`),ve=t(function(e,t,n,r,a,o,s){let c=o;for(let o of t){let t={descr:o,section:n,number:n,width:q,padding:K,maxHeight:0};i.debug(`eventNode`,t);let l=e.append(`g`).attr(`class`,`eventWrapper`),u=U.drawNode(l,t,n,s).height;l.attr(`transform`,`translate(${a}, ${c})`);let d=e.append(`g`).attr(`class`,`lineWrapper`),f=c+u/2;d.append(`line`).attr(`x1`,r).attr(`y1`,f).attr(`x2`,a).attr(`y2`,f).attr(`stroke-width`,2).attr(`stroke`,`black`).attr(`marker-end`,`url(#arrowhead)`).attr(`stroke-dasharray`,`5,5`),c=c+u+J}return c-o},`drawEvents`),ye={setConf:t(()=>{},`setConf`),draw:_e},be=t(e=>{let{theme:t}=d(),n=t?.includes(`dark`),r=t?.includes(`color`),i=e.svgId?.replace(/^#/,``)??``,a=i?`url(#${i}-drop-shadow)`:e.dropShadow??`none`,o=``;for(let t=0;t<e.THEME_COLOR_LIMIT;t++){let i=`${17-3*t}`,s=r?e.borderColorArray[t]:e.mainBkg,c=r?e.borderColorArray[t]:e.nodeBorder;o+=`
7
+ .section-${t-1} rect,
8
+ .section-${t-1} path,
9
+ .section-${t-1} circle {
10
+ fill: ${n&&r?e.mainBkg:s};
11
+ stroke: ${c};
12
+ stroke-width: ${e.strokeWidth};
13
+ filter: ${a};
14
+ }
15
+
16
+ .section-${t-1} text {
17
+ fill: ${e.nodeBorder};
18
+ font-weight: ${e.fontWeight}
19
+ }
20
+
21
+ .node-icon-${t-1} {
22
+ font-size: 40px;
23
+ color: ${e[`cScaleLabel`+t]};
24
+ }
25
+
26
+ .section-edge-${t-1} {
27
+ stroke: ${e[`cScale`+t]};
28
+ }
29
+
30
+ .edge-depth-${t-1} {
31
+ stroke-width: ${i};
32
+ }
33
+
34
+ .section-${t-1} line {
35
+ stroke: ${e[`cScaleInv`+t]};
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 o},`genReduxSections`),xe=t(e=>{let t=``;for(let t=0;t<e.THEME_COLOR_LIMIT;t++)e[`lineColor`+t]=e[`lineColor`+t]||e[`cScaleInv`+t],f(e[`lineColor`+t])?e[`lineColor`+t]=o(e[`lineColor`+t],20):e[`lineColor`+t]=s(e[`lineColor`+t],20);for(let n=0;n<e.THEME_COLOR_LIMIT;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`),Se=t(e=>{let{theme:t}=d(),n=t?.includes(`redux`),r=t===`neutral`,i=e.svgId?.replace(/^#/,``)??``,a=``;if(e.useGradient&&i&&e.THEME_COLOR_LIMIT&&!r)for(let t=0;t<e.THEME_COLOR_LIMIT;t++)a+=`
86
+ .section-${t-1}[data-look="neo"] rect,
87
+ .section-${t-1}[data-look="neo"] path,
88
+ .section-${t-1}[data-look="neo"] circle {
89
+ fill: ${e.mainBkg};
90
+ stroke: url(#${i}-gradient);
91
+ stroke-width: 2;
92
+ }
93
+ .section-${t-1}[data-look="neo"] line {
94
+ stroke: url(#${i}-gradient);
95
+ stroke-width: 2;
96
+ }`;return`
97
+ .edge {
98
+ stroke-width: 3;
99
+ }
100
+ ${n?be(e):xe(e)}
101
+ ${a}
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`),Ce={db:_,renderer:{setConf:t(()=>{},`setConf`),draw:t((e,t,n,r)=>(r?.db?.getDirection?.()??`LR`)===`TD`?ye.draw(e,t,n,r):pe.draw(e,t,n,r),`draw`)},parser:g,styles:Se};export{Ce as diagram};
@@ -0,0 +1 @@
1
+ import"./chunk-ZS6VBONO-D-IFTJgn.js";import{t as e}from"./chunk-SFMINX4W-BW2NSwFJ.js";export{e as createTreeViewServices};
@@ -0,0 +1 @@
1
+ import"./chunk-ZS6VBONO-D-IFTJgn.js";import{n as e}from"./chunk-GDY2UAB4-QtXfmDIW.js";export{e as createTreemapServices};
@@ -0,0 +1,34 @@
1
+ import{t as e}from"./chunk-AQ6EADP3-CZhslHi-.js";import{V as t}from"./chunk-H7VHZCWX-CwFRFlEn.js";import{F as n,K as r,O as i,P as a,Q as o,V as s,X as c,Y as l,h as u,l as d,q as f,r as p,v as m,x as h}from"./chunk-QJSWEUOL-kvKBktmc.js";import{t as g}from"./chunk-IJBDOHL6-CgcssvZb.js";import{t as _}from"./chunk-5IMINLNL-Cl3N81sR.js";import"./chunk-STOV2HOB-GnExfzIX.js";import{a as v}from"./chunk-VY2OSTJR-BYk2nUI_.js";var y=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[5,8],r=[7,8,11,12,17,19,22,24],i=[1,17],a=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],s=[1,31],c=[1,39],l=[7,8,11,12,17,19,22,24,27],u=[1,57],d=[1,56],f=[1,58],p=[1,59],m=[1,60],h=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:`error`,5:`VENN`,7:`EOF`,8:`NEWLINE`,11:`TITLE`,12:`SET`,14:`BRACKET_LABEL`,15:`COLON`,16:`NUMERIC`,17:`UNION`,19:`TEXT`,20:`IDENTIFIER`,21:`STRING`,22:`INDENT_TEXT`,24:`STYLE`,27:`COMMA`,31:`HEXCOLOR`,32:`RGBCOLOR`,33:`RGBACOLOR`},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 1:return a[s-1];case 2:case 3:case 4:this.$=[];break;case 5:a[s-1].push(a[s]),this.$=a[s-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=a[s];break;case 8:r.setDiagramTitle(a[s].substr(6)),this.$=a[s].substr(6);break;case 9:r.addSubsetData([a[s]],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 10:r.addSubsetData([a[s-1]],a[s],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 11:r.addSubsetData([a[s-2]],void 0,parseFloat(a[s])),r.setIndentMode&&r.setIndentMode(!0);break;case 12:r.addSubsetData([a[s-3]],a[s-2],parseFloat(a[s])),r.setIndentMode&&r.setIndentMode(!0);break;case 13:if(a[s].length<2)throw Error(`union requires multiple identifiers`);r.validateUnionIdentifiers&&r.validateUnionIdentifiers(a[s]),r.addSubsetData(a[s],void 0,void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 14:if(a[s-1].length<2)throw Error(`union requires multiple identifiers`);r.validateUnionIdentifiers&&r.validateUnionIdentifiers(a[s-1]),r.addSubsetData(a[s-1],a[s],void 0),r.setIndentMode&&r.setIndentMode(!0);break;case 15:if(a[s-2].length<2)throw Error(`union requires multiple identifiers`);r.validateUnionIdentifiers&&r.validateUnionIdentifiers(a[s-2]),r.addSubsetData(a[s-2],void 0,parseFloat(a[s])),r.setIndentMode&&r.setIndentMode(!0);break;case 16:if(a[s-3].length<2)throw Error(`union requires multiple identifiers`);r.validateUnionIdentifiers&&r.validateUnionIdentifiers(a[s-3]),r.addSubsetData(a[s-3],a[s-2],parseFloat(a[s])),r.setIndentMode&&r.setIndentMode(!0);break;case 17:case 18:case 19:r.addTextData(a[s-1],a[s],void 0);break;case 20:case 21:r.addTextData(a[s-2],a[s-1],a[s]);break;case 23:r.addStyleData(a[s-1],a[s]);break;case 24:case 25:case 26:var c=r.getCurrentSets();if(!c)throw Error(`text requires set`);r.addTextData(c,a[s],void 0);break;case 27:case 28:var c=r.getCurrentSets();if(!c)throw Error(`text requires set`);r.addTextData(c,a[s-1],a[s]);break;case 29:case 41:this.$=[a[s]];break;case 30:case 42:this.$=[...a[s-2],a[s]];break;case 31:this.$=[a[s-2],a[s]];break;case 33:this.$=a[s].join(` `);break;case 34:this.$=[a[s]];break;case 35:a[s-1].push(a[s]),this.$=a[s-1];break;case 43:case 44:this.$=a[s]}},`anonymous`),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(r,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(r,[2,5]),t(r,[2,6]),t(r,[2,7]),t(r,[2,8]),{13:16,20:i,21:a},{13:20,18:19,20:i,21:a},{13:20,18:21,20:i,21:a},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:i,21:a},t(r,[2,9],{14:[1,27],15:[1,28]}),t(o,[2,43]),t(o,[2,44]),t(r,[2,13],{14:[1,29],15:[1,30],27:s}),t(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:s},t(r,[2,22]),t(r,[2,24],{14:[1,35]}),t(r,[2,25],{14:[1,36]}),t(r,[2,26]),{20:c,25:37,26:38,27:s},t(r,[2,10],{15:[1,40]}),{16:[1,41]},t(r,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:i,21:a},t(r,[2,17],{14:[1,45]}),t(r,[2,18],{14:[1,46]}),t(r,[2,19]),t(r,[2,27]),t(r,[2,28]),t(r,[2,23],{27:[1,47]}),t(l,[2,29]),{15:[1,48]},{16:[1,49]},t(r,[2,11]),{16:[1,50]},t(r,[2,15]),t(o,[2,42]),t(r,[2,20]),t(r,[2,21]),{20:c,26:51},{16:u,20:d,21:[1,53],28:52,29:54,30:55,31:f,32:p,33:m},t(r,[2,12]),t(r,[2,16]),t(l,[2,30]),t(l,[2,31]),t(l,[2,32]),t(l,[2,33],{30:61,16:u,20:d,31:f,32:p,33:m}),t(h,[2,34]),t(h,[2,36]),t(h,[2,37]),t(h,[2,38]),t(h,[2,39]),t(h,[2,40]),t(h,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,typeof h.yylloc>`u`&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e;return e=i.pop()||h.lex()||p,typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:((S===null||typeof S>`u`)&&(S=x()),T=s[w]&&s[w][S]),typeof T>`u`||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
+ `+h.showPosition()+`
3
+ Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),typeof E<`u`)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};g.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(function(e,t){return this.yy=t||this.yy||{},this._input=e,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:e(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:e(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
+ `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:e(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
5
+ `+t+`^`},`showPosition`),test_match:e(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={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&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,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(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:e(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):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:e(function(){return this.next()||this.lex()},`lex`),begin:e(function(e){this.conditionStack.push(e)},`begin`),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:e(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:e(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:e(function(e){this.begin(e)},`pushState`),stateStackSize:e(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:e(function(e,t,n,r){switch(n){case 0:break;case 1:break;case 2:break;case 3:if(e.getIndentMode&&e.getIndentMode())return e.consumeIndentText=!0,this.begin(`INITIAL`),22;break;case 4:break;case 5:e.setIndentMode&&e.setIndentMode(!1),this.begin(`INITIAL`),this.unput(t.yytext);break;case 6:return this.begin(`bol`),8;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(e.consumeIndentText)e.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return t.yytext=t.yytext.slice(2,-2),14;case 17:return t.yytext=t.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},`anonymous`),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}}})();function _(){this.yy={}}return e(_,`Parser`),_.prototype=g,g.Parser=_,new _})();y.parser=y;var b=y,x=[],S=[],C=[],w=new Set,T,E=!1,D=e((e,t,n)=>{let r=P(e).sort(),i=n??10/e.length**2;T=r,r.length===1&&w.add(r[0]),x.push({sets:r,size:i,label:t?k(t):void 0})},`addSubsetData`),O=e(()=>x,`getSubsetData`),k=e(e=>{let t=e.trim();return t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t},`normalizeText`),A=e(e=>e&&k(e),`normalizeStyleValue`),j=e((e,t,n)=>{let r=k(t);S.push({sets:P(e).sort(),id:r,label:n?k(n):void 0})},`addTextData`),M=e((e,t)=>{let n=P(e).sort(),r={};for(let[e,n]of t)r[e]=A(n)??n;C.push({targets:n,styles:r})},`addStyleData`),N=e(()=>C,`getStyleData`),P=e(e=>e.map(e=>k(e)),`normalizeIdentifierList`),F=e(e=>{let t=P(e).filter(e=>!w.has(e));if(t.length>0)throw Error(`unknown set identifier: ${t.join(`, `)}`)},`validateUnionIdentifiers`),I=e(()=>S,`getTextData`),L=e(()=>T,`getCurrentSets`),R=e(()=>E,`getIndentMode`),ee=e(e=>{E=e},`setIndentMode`),te=m.venn;function ne(){return v(te,d().venn)}e(ne,`getConfig`);var re={getConfig:ne,clear:e(()=>{u(),x.length=0,S.length=0,C.length=0,w.clear(),T=void 0,E=!1},`customClear`),setAccTitle:o,getAccTitle:s,setDiagramTitle:n,getDiagramTitle:c,getAccDescription:f,setAccDescription:l,addSubsetData:D,getSubsetData:O,addTextData:j,addStyleData:M,validateUnionIdentifiers:F,getTextData:I,getStyleData:N,getCurrentSets:L,getIndentMode:R,setIndentMode:ee},ie=e(e=>`
7
+ .venn-title {
8
+ font-size: 32px;
9
+ fill: ${e.vennTitleTextColor};
10
+ font-family: ${e.fontFamily};
11
+ }
12
+
13
+ .venn-circle text {
14
+ font-size: 48px;
15
+ font-family: ${e.fontFamily};
16
+ }
17
+
18
+ .venn-intersection text {
19
+ font-size: 48px;
20
+ fill: ${e.vennSetTextColor};
21
+ font-family: ${e.fontFamily};
22
+ }
23
+
24
+ .venn-text-node {
25
+ font-family: ${e.fontFamily};
26
+ color: ${e.vennSetTextColor};
27
+ }
28
+ `,`getStyles`);function z(e,t){let n=oe(e),r=n.filter(t=>ae(t,e)),i=0,a=0,o=[];if(r.length>1){let t=ce(r);for(let e=0;e<r.length;++e){let n=r[e];n.angle=Math.atan2(n.x-t.x,n.y-t.y)}r.sort((e,t)=>t.angle-e.angle);let n=r[r.length-1];for(let t=0;t<r.length;++t){let s=r[t];a+=(n.x+s.x)*(s.y-n.y);let c={x:(s.x+n.x)/2,y:(s.y+n.y)/2},l=null;for(let t=0;t<s.parentIndex.length;++t)if(n.parentIndex.includes(s.parentIndex[t])){let r=e[s.parentIndex[t]],i=Math.atan2(s.x-r.x,s.y-r.y),a=Math.atan2(n.x-r.x,n.y-r.y),o=a-i;o<0&&(o+=2*Math.PI);let u=a-o/2,d=V(c,{x:r.x+r.radius*Math.sin(u),y:r.y+r.radius*Math.cos(u)});d>r.radius*2&&(d=r.radius*2),(l==null||l.width>d)&&(l={circle:r,width:d,p1:s,p2:n,large:d>r.radius,sweep:!0})}l!=null&&(o.push(l),i+=B(l.circle.radius,l.width),n=s)}}else{let t=e[0];for(let n=1;n<e.length;++n)e[n].radius<t.radius&&(t=e[n]);let n=!1;for(let r=0;r<e.length;++r)if(V(e[r],t)>Math.abs(t.radius-e[r].radius)){n=!0;break}n?i=a=0:(i=t.radius*t.radius*Math.PI,o.push({circle:t,p1:{x:t.x,y:t.y+t.radius},p2:{x:t.x-1e-10,y:t.y+t.radius},width:t.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=i+a,t.arcArea=i,t.polygonArea=a,t.arcs=o,t.innerPoints=r,t.intersectionPoints=n),i+a}e(z,`intersectionArea`);function ae(e,t){return t.every(t=>V(e,t)<t.radius+1e-10)}e(ae,`containedInCircles`);function oe(e){let t=[];for(let n=0;n<e.length;++n)for(let r=n+1;r<e.length;++r){let i=se(e[n],e[r]);for(let e of i)e.parentIndex=[n,r],t.push(e)}return t}e(oe,`getIntersectionPoints`);function B(e,t){return e*e*Math.acos(1-t/e)-(e-t)*Math.sqrt(t*(2*e-t))}e(B,`circleArea`);function V(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}e(V,`distance`);function H(e,t,n){if(n>=e+t)return 0;if(n<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let r=e-(n*n-t*t+e*e)/(2*n),i=t-(n*n-e*e+t*t)/(2*n);return B(e,r)+B(t,i)}e(H,`circleOverlap`);function se(e,t){let n=V(e,t),r=e.radius,i=t.radius;if(n>=r+i||n<=Math.abs(r-i))return[];let a=(r*r-i*i+n*n)/(2*n),o=Math.sqrt(r*r-a*a),s=e.x+a*(t.x-e.x)/n,c=e.y+a*(t.y-e.y)/n,l=-(t.y-e.y)*(o/n),u=-(t.x-e.x)*(o/n);return[{x:s+l,y:c-u},{x:s-l,y:c+u}]}e(se,`circleCircleIntersection`);function ce(e){let t={x:0,y:0};for(let n of e)t.x+=n.x,t.y+=n.y;return t.x/=e.length,t.y/=e.length,t}e(ce,`getCenter`);function le(e,t,n,r){r||={};let i=r.maxIterations||100,a=r.tolerance||1e-10,o=e(t),s=e(n),c=n-t;if(o*s>0)throw`Initial bisect points must have opposite signs`;if(o===0)return t;if(s===0)return n;for(let n=0;n<i;++n){c/=2;let n=t+c,r=e(n);if(r*o>=0&&(t=n),Math.abs(c)<a||r===0)return n}return t+c}e(le,`bisect`);function U(e){let t=Array(e);for(let n=0;n<e;++n)t[n]=0;return t}e(U,`zeros`);function ue(e,t){return U(e).map(()=>U(t))}e(ue,`zerosM`);function W(e,t){let n=0;for(let r=0;r<e.length;++r)n+=e[r]*t[r];return n}e(W,`dot`);function G(e){return Math.sqrt(W(e,e))}e(G,`norm2`);function K(e,t,n){for(let r=0;r<t.length;++r)e[r]=t[r]*n}e(K,`scale`);function q(e,t,n,r,i){for(let a=0;a<e.length;++a)e[a]=t*n[a]+r*i[a]}e(q,`weightedSum`);function de(t,n,r){r||={};let i=r.maxIterations||n.length*200,a=r.nonZeroDelta||1.05,o=r.zeroDelta||.001,s=r.minErrorDelta||1e-6,c=r.minErrorDelta||1e-5,l=r.rho===void 0?1:r.rho,u=r.chi===void 0?2:r.chi,d=r.psi===void 0?-.5:r.psi,f=r.sigma===void 0?.5:r.sigma,p,m=n.length,h=Array(m+1);h[0]=n,h[0].fx=t(n),h[0].id=0;for(let e=0;e<m;++e){let r=n.slice();r[e]=r[e]?r[e]*a:o,h[e+1]=r,h[e+1].fx=t(r),h[e+1].id=e+1}function g(e){for(let t=0;t<e.length;t++)h[m][t]=e[t];h[m].fx=e.fx}e(g,`updateSimplex`);let _=e((e,t)=>e.fx-t.fx,`sortOrder`),v=n.slice(),y=n.slice(),b=n.slice(),x=n.slice();for(let e=0;e<i;++e){if(h.sort(_),r.history){let e=h.map(e=>{let t=e.slice();return t.fx=e.fx,t.id=e.id,t});e.sort((e,t)=>e.id-t.id),r.history.push({x:h[0].slice(),fx:h[0].fx,simplex:e})}p=0;for(let e=0;e<m;++e)p=Math.max(p,Math.abs(h[0][e]-h[1][e]));if(Math.abs(h[0].fx-h[m].fx)<s&&p<c)break;for(let e=0;e<m;++e){v[e]=0;for(let t=0;t<m;++t)v[e]+=h[t][e];v[e]/=m}let e=h[m];if(q(y,1+l,v,-l,e),y.fx=t(y),y.fx<h[0].fx)q(x,1+u,v,-u,e),x.fx=t(x),x.fx<y.fx?g(x):g(y);else if(y.fx>=h[m-1].fx){let n=!1;if(y.fx>e.fx?(q(b,1+d,v,-d,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(q(b,1-d*l,v,d*l,e),b.fx=t(b),b.fx<y.fx?g(b):n=!0),n){if(f>=1)break;for(let e=1;e<h.length;++e)q(h[e],1-f,h[0],f,h[e]),h[e].fx=t(h[e])}}else g(y)}return h.sort(_),{fx:h[0].fx,x:h[0]}}e(de,`nelderMead`);function fe(t,n,r,i,a,o,s){let c=r.fx,l=W(r.fxprime,n),u=c,d=c,f=l,p=0;a||=1,o||=1e-6,s||=.1;function m(e,d,p){for(let m=0;m<16;++m)if(a=(e+d)/2,q(i.x,1,r.x,a,n),u=i.fx=t(i.x,i.fxprime),f=W(i.fxprime,n),u>c+o*a*l||u>=p)d=a;else{if(Math.abs(f)<=-s*l)return a;f*(d-e)>=0&&(d=e),e=a,p=u}return 0}e(m,`zoom`);for(let e=0;e<10;++e){if(q(i.x,1,r.x,a,n),u=i.fx=t(i.x,i.fxprime),f=W(i.fxprime,n),u>c+o*a*l||e&&u>=d)return m(p,a,d);if(Math.abs(f)<=-s*l)return a;if(f>=0)return m(a,p,u);d=u,p=a,a*=2}return a}e(fe,`wolfeLineSearch`);function pe(e,t,n){let r={x:t.slice(),fx:0,fxprime:t.slice()},i={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),o,s,c=1,l;n||={},l=n.maxIterations||t.length*20,r.fx=e(r.x,r.fxprime),o=r.fxprime.slice(),K(o,r.fxprime,-1);for(let t=0;t<l;++t){if(c=fe(e,o,r,i,c),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),!c)K(o,r.fxprime,-1);else{q(a,1,i.fxprime,-1,r.fxprime);let e=W(r.fxprime,r.fxprime),t=Math.max(0,W(a,i.fxprime)/e);q(o,t,o,-1,i.fxprime),s=r,r=i,i=s}if(G(r.fxprime)<=1e-5)break}return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),r}e(pe,`conjugateGradient`);function me(e,t={}){t.maxIterations=t.maxIterations||500;let n=t.initialLayout||ye,r=t.lossFunction||Y,i=ge(e,t),a=n(i,t),o=Object.keys(a),s=[];for(let e of o)s.push(a[e].x),s.push(a[e].y);let c=de(e=>{let t={};for(let n=0;n<o.length;++n){let r=o[n];t[r]={x:e[2*n],y:e[2*n+1],radius:a[r].radius}}return r(t,i)},s,t).x;for(let e=0;e<o.length;++e){let t=o[e];a[t].x=c[2*e],a[t].y=c[2*e+1]}return a}e(me,`venn`);var he=1e-10;function J(e,t,n){return Math.min(e,t)*Math.min(e,t)*Math.PI<=n+he?Math.abs(e-t):le(r=>H(e,t,r)-n,0,e+t)}e(J,`distanceFromIntersectArea`);function ge(t,n={}){let r=n.distinct,i=t.map(e=>Object.assign({},e));function a(e){return e.join(`;`)}if(e(a,`toKey`),r){let e=new Map;for(let t of i)for(let n=0;n<t.sets.length;n++){let r=String(t.sets[n]);e.set(r,t.size+(e.get(r)||0));for(let i=n+1;i<t.sets.length;i++){let n=String(t.sets[i]),a=`${r};${n}`,o=`${n};${r}`;e.set(a,t.size+(e.get(a)||0)),e.set(o,t.size+(e.get(o)||0))}}for(let t of i)t.sets.length<3&&(t.size=e.get(a(t.sets)))}let o=[],s=new Set;for(let e of i)if(e.sets.length===1)o.push(e.sets[0]);else if(e.sets.length===2){let t=e.sets[0],n=e.sets[1];s.add(a(e.sets)),s.add(a([n,t]))}o.sort((e,t)=>e===t?0:e<t?-1:1);for(let e=0;e<o.length;++e){let t=o[e];for(let n=e+1;n<o.length;++n){let e=o[n];s.has(a([t,e]))||i.push({sets:[t,e],size:0})}}return i}e(ge,`addMissingAreas`);function _e(e,t,n){let r=ue(t.length,t.length),i=ue(t.length,t.length);return e.filter(e=>e.sets.length===2).forEach(e=>{let a=n[e.sets[0]],o=n[e.sets[1]],s=J(Math.sqrt(t[a].size/Math.PI),Math.sqrt(t[o].size/Math.PI),e.size);r[a][o]=r[o][a]=s;let c=0;e.size+1e-10>=Math.min(t[a].size,t[o].size)?c=1:e.size<=1e-10&&(c=-1),i[a][o]=i[o][a]=c}),{distances:r,constraints:i}}e(_e,`getDistanceMatrices`);function ve(e,t,n,r){for(let e=0;e<t.length;++e)t[e]=0;let i=0;for(let a=0;a<n.length;++a){let o=e[2*a],s=e[2*a+1];for(let c=a+1;c<n.length;++c){let l=e[2*c],u=e[2*c+1],d=n[a][c],f=r[a][c],p=(l-o)*(l-o)+(u-s)*(u-s),m=Math.sqrt(p),h=p-d*d;f>0&&m<=d||f<0&&m>=d||(i+=2*h*h,t[2*a]+=4*h*(o-l),t[2*a+1]+=4*h*(s-u),t[2*c]+=4*h*(l-o),t[2*c+1]+=4*h*(u-s))}}return i}e(ve,`constrainedMDSGradient`);function ye(e,t={}){let n=xe(e,t),r=t.lossFunction||Y;if(e.length>=8){let i=be(e,t),a=r(i,e),o=r(n,e);a+1e-8<o&&(n=i)}return n}e(ye,`bestInitialLayout`);function be(t,n={}){let r=n.restarts||10,i=[],a={};for(let e of t)e.sets.length===1&&(a[e.sets[0]]=i.length,i.push(e));let{distances:o,constraints:s}=_e(t,i,a),c=G(o.map(G))/o.length;o=o.map(e=>e.map(e=>e/c));let l=e((e,t)=>ve(e,t,o,s),`obj`),u=null;for(let e=0;e<r;++e){let e=pe(l,U(o.length*2).map(Math.random),n);(!u||e.fx<u.fx)&&(u=e)}let d=u.x,f={};for(let e=0;e<i.length;++e){let t=i[e];f[t.sets[0]]={x:d[2*e]*c,y:d[2*e+1]*c,radius:Math.sqrt(t.size/Math.PI)}}if(n.history)for(let e of n.history)K(e.x,c);return f}e(be,`constrainedMDSLayout`);function xe(t,n){let r=n&&n.lossFunction?n.lossFunction:Y,i={},a={};for(let e of t)if(e.sets.length===1){let t=e.sets[0];i[t]={x:1e10,y:1e10,rowid:i.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},a[t]=[]}t=t.filter(e=>e.sets.length===2);for(let e of t){let t=e.weight==null?1:e.weight,n=e.sets[0],r=e.sets[1];e.size+he>=Math.min(i[n].size,i[r].size)&&(t=0),a[n].push({set:r,size:e.size,weight:t}),a[r].push({set:n,size:e.size,weight:t})}let o=[];Object.keys(a).forEach(e=>{let t=0;for(let n=0;n<a[e].length;++n)t+=a[e][n].size*a[e][n].weight;o.push({set:e,size:t})});function s(e,t){return t.size-e.size}e(s,`sortOrder`),o.sort(s);let c={};function l(e){return e.set in c}e(l,`isPositioned`);function u(e,t){i[t].x=e.x,i[t].y=e.y,c[t]=!0}e(u,`positionSet`),u({x:0,y:0},o[0].set);for(let e=1;e<o.length;++e){let n=o[e].set,c=a[n].filter(l),f=i[n];if(c.sort(s),c.length===0)throw`ERROR: missing pairwise overlap information`;let p=[];for(var d=0;d<c.length;++d){let e=i[c[d].set],t=J(f.radius,e.radius,c[d].size);p.push({x:e.x+t,y:e.y}),p.push({x:e.x-t,y:e.y}),p.push({y:e.y+t,x:e.x}),p.push({y:e.y-t,x:e.x});for(let n=d+1;n<c.length;++n){let r=i[c[n].set],a=J(f.radius,r.radius,c[n].size),o=se({x:e.x,y:e.y,radius:t},{x:r.x,y:r.y,radius:a});p.push(...o)}}let m=1e50,h=p[0];for(let e of p){i[n].x=e.x,i[n].y=e.y;let a=r(i,t);a<m&&(m=a,h=e)}u(h,n)}return i}e(xe,`greedyLayout`);function Y(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=H(n.radius,i.radius,V(n,i))}else t=z(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight;n+=i*(t-r.size)*(t-r.size)}return n}e(Y,`lossFunction`);function Se(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=H(n.radius,i.radius,V(n,i))}else t=z(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight,a=Math.log((t+1)/(r.size+1));n+=i*a*a}return n}e(Se,`logRatioLossFunction`);function Ce(e,t,n){if(n==null?e.sort((e,t)=>t.radius-e.radius):e.sort(n),e.length>0){let t=e[0].x,n=e[0].y;for(let r of e)r.x-=t,r.y-=n}if(e.length===2&&V(e[0],e[1])<Math.abs(e[1].radius-e[0].radius)&&(e[1].x=e[0].x+e[0].radius-e[1].radius-1e-10,e[1].y=e[0].y),e.length>1){let n=Math.atan2(e[1].x,e[1].y)-t,r=Math.cos(n),i=Math.sin(n);for(let t of e){let e=t.x,n=t.y;t.x=r*e-i*n,t.y=i*e+r*n}}if(e.length>2){let n=Math.atan2(e[2].x,e[2].y)-t;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){let t=e[1].y/(1e-10+e[1].x);for(let n of e){var r=(n.x+t*n.y)/(1+t*t);n.x=2*r-n.x,n.y=2*r*t-n.y}}}}e(Ce,`orientateCircles`);function we(t){t.forEach(e=>{e.parent=e});function n(e){return e.parent!==e&&(e.parent=n(e.parent)),e.parent}e(n,`find`);function r(e,t){let r=n(e);r.parent=n(t)}e(r,`union`);for(let e=0;e<t.length;++e)for(let n=e+1;n<t.length;++n){let i=t[e].radius+t[n].radius;V(t[e],t[n])+1e-10<i&&r(t[n],t[e])}let i=new Map;for(let e=0;e<t.length;++e){let r=n(t[e]).parent.setid;i.has(r)||i.set(r,[]),i.get(r).push(t[e])}return t.forEach(e=>{delete e.parent}),Array.from(i.values())}e(we,`disjointCluster`);function X(t){let n=e(e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),-1/0),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),1/0)}),`minMax`);return{xRange:n(`x`),yRange:n(`y`)}}e(X,`getBoundingBox`);function Te(t,n,r){n??=Math.PI/2;let i=Oe(t).map(e=>Object.assign({},e)),a=we(i);for(let e of a){Ce(e,n,r);let t=X(e);e.size=(t.xRange.max-t.xRange.min)*(t.yRange.max-t.yRange.min),e.bounds=t}a.sort((e,t)=>t.size-e.size),i=a[0];let o=i.bounds,s=(o.xRange.max-o.xRange.min)/50;function c(e,t,n){if(!e)return;let r=e.bounds,a,c;if(t)a=o.xRange.max-r.xRange.min+s;else{a=o.xRange.max-r.xRange.max;let e=(r.xRange.max-r.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;e<0&&(a+=e)}if(n)c=o.yRange.max-r.yRange.min+s;else{c=o.yRange.max-r.yRange.max;let e=(r.yRange.max-r.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;e<0&&(c+=e)}for(let t of e)t.x+=a,t.y+=c,i.push(t)}e(c,`addCluster`);let l=1;for(;l<a.length;)c(a[l],!0,!1),c(a[l+1],!1,!0),c(a[l+2],!0,!0),l+=3,o=X(i);return De(i)}e(Te,`normalizeSolution`);function Ee(e,t,n,r,i){let a=Oe(e);t-=2*r,n-=2*r;let{xRange:o,yRange:s}=X(a);if(o.max===o.min||s.max===s.min)return console.log(`not scaling solution: zero size detected`),e;let c,l;if(i){let e=Math.sqrt(i/Math.PI)*2;c=t/e,l=n/e}else c=t/(o.max-o.min),l=n/(s.max-s.min);let u=Math.min(l,c),d=(t-(o.max-o.min)*u)/2,f=(n-(s.max-s.min)*u)/2;return De(a.map(e=>({radius:u*e.radius,x:r+d+(e.x-o.min)*u,y:r+f+(e.y-s.min)*u,setid:e.setid})))}e(Ee,`scaleSolution`);function De(e){let t={};for(let n of e)t[n.setid]=n;return t}e(De,`toObjectNotation`);function Oe(e){return Object.keys(e).map(t=>Object.assign(e[t],{setid:t}))}e(Oe,`fromObjectNotation`);function ke(t={}){let n=!1,r=600,i=350,a=15,o=1e3,s=Math.PI/2,c=!0,l=null,u=!0,d=!0,f=null,p=null,m=!1,h=null,g=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,_={},v=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:[`#1f77b4`,`#ff7f0e`,`#2ca02c`,`#d62728`,`#9467bd`,`#8c564b`,`#e377c2`,`#7f7f7f`,`#bcbd22`,`#17becf`],y=0,b=e(function(e){if(e in _)return _[e];var t=_[e]=v[y];return y+=1,y>=v.length&&(y=0),t},`colours`),x=me,S=Y;function C(_){let v=_.datum(),y=new Set;v.forEach(e=>{e.size==0&&e.sets.length==1&&y.add(e.sets[0])}),v=v.filter(e=>!e.sets.some(e=>y.has(e)));let C={},w={};if(v.length>0){let e=x(v,{lossFunction:S,distinct:m});c&&(e=Te(e,s,p)),C=Ee(e,r,i,a,l),w=Me(C,v,g)}let T={};v.forEach(e=>{e.label&&(T[e.sets]=e.label)});function E(e){if(e.sets in T)return T[e.sets];if(e.sets.length==1)return``+e.sets[0]}e(E,`label`),_.selectAll(`svg`).data([C]).enter().append(`svg`);let D=_.select(`svg`);n?D.attr(`viewBox`,`0 0 ${r} ${i}`):D.attr(`width`,r).attr(`height`,i);let O={},k=!1;D.selectAll(`.venn-area path`).each(function(e){let t=this.getAttribute(`d`);e.sets.length==1&&t&&!m&&(k=!0,O[e.sets[0]]=Pe(t))});function A(e){return t=>Le(e.sets.map(e=>{let n=O[e],a=C[e];return n||={x:r/2,y:i/2,radius:1},a||={x:r/2,y:i/2,radius:1},{x:n.x*(1-t)+a.x*t,y:n.y*(1-t)+a.y*t,radius:n.radius*(1-t)+a.radius*t}}),h)}e(A,`pathTween`);let j=D.selectAll(`.venn-area`).data(v,e=>e.sets),M=j.enter().append(`g`).attr(`class`,e=>`venn-area venn-${e.sets.length==1?`circle`:`intersection`}${e.colour||e.color?` venn-coloured`:``}`).attr(`data-venn-sets`,e=>e.sets.join(`_`)),N=M.append(`path`),P=M.append(`text`).attr(`class`,`label`).text(e=>E(e)).attr(`text-anchor`,`middle`).attr(`dy`,`.35em`).attr(`x`,r/2).attr(`y`,i/2);d&&(N.style(`fill-opacity`,`0`).filter(e=>e.sets.length==1).style(`fill`,e=>e.colour?e.colour:e.color?e.color:b(e.sets)).style(`fill-opacity`,`.25`),P.style(`fill`,e=>e.colour||e.color?`#FFF`:t.textFill?t.textFill:e.sets.length==1?b(e.sets):`#444`));function F(e){return typeof e.transition==`function`?e.transition(`venn`).duration(o):e}e(F,`asTransition`);let I=_;k&&typeof I.transition==`function`?(I=F(_),I.selectAll(`path`).attrTween(`d`,A)):I.selectAll(`path`).attr(`d`,e=>Le(e.sets.map(e=>C[e])),h);let L=I.selectAll(`text`).filter(e=>e.sets in w).text(e=>E(e)).attr(`x`,e=>Math.floor(w[e.sets].x)).attr(`y`,e=>Math.floor(w[e.sets].y));u&&(k?`on`in L?L.on(`end`,Z(C,E)):L.each(`end`,Z(C,E)):L.each(Z(C,E)));let R=F(j.exit()).remove();typeof j.transition==`function`&&R.selectAll(`path`).attrTween(`d`,A);let ee=R.selectAll(`text`).attr(`x`,r/2).attr(`y`,i/2);return f!==null&&(P.style(`font-size`,`0px`),L.style(`font-size`,f),ee.style(`font-size`,`0px`)),{circles:C,textCentres:w,nodes:j,enter:M,update:I,exit:R}}return e(C,`chart`),C.wrap=function(e){return arguments.length?(u=e,C):u},C.useViewBox=function(){return n=!0,C},C.width=function(e){return arguments.length?(r=e,C):r},C.height=function(e){return arguments.length?(i=e,C):i},C.padding=function(e){return arguments.length?(a=e,C):a},C.distinct=function(e){return arguments.length?(m=e,C):m},C.colours=function(e){return arguments.length?(b=e,C):b},C.colors=function(e){return arguments.length?(b=e,C):b},C.fontSize=function(e){return arguments.length?(f=e,C):f},C.round=function(e){return arguments.length?(h=e,C):h},C.duration=function(e){return arguments.length?(o=e,C):o},C.layoutFunction=function(e){return arguments.length?(x=e,C):x},C.normalize=function(e){return arguments.length?(c=e,C):c},C.scaleToFit=function(e){return arguments.length?(l=e,C):l},C.styled=function(e){return arguments.length?(d=e,C):d},C.orientation=function(e){return arguments.length?(s=e,C):s},C.orientationOrder=function(e){return arguments.length?(p=e,C):p},C.lossFunction=function(e){return arguments.length?(S=e==="default"?Y:e===`logRatio`?Se:e,C):S},C}e(ke,`VennDiagram`);function Z(t,n){return function(r){let i=this,a=t[r.sets[0]].radius||50,o=n(r)||``,s=o.split(/\s+/).reverse(),c=(o.length+s.length)/3,l=s.pop(),u=[l],d=0,f=1.1;i.textContent=null;let p=[];function m(e){let t=i.ownerDocument.createElementNS(i.namespaceURI,`tspan`);return t.textContent=e,p.push(t),i.append(t),t}e(m,`append`);let h=m(l);for(;l=s.pop(),l;){u.push(l);let e=u.join(` `);h.textContent=e,e.length>c&&h.getComputedTextLength()>a&&(u.pop(),h.textContent=u.join(` `),u=[l],h=m(l),d++)}let g=.35-d*f/2,_=i.getAttribute(`x`),v=i.getAttribute(`y`);p.forEach((e,t)=>{e.setAttribute(`x`,_),e.setAttribute(`y`,v),e.setAttribute(`dy`,`${g+t*f}em`)})}}e(Z,`wrapText`);function Q(e,t,n){let r=t[0].radius-V(t[0],e);for(let n=1;n<t.length;++n){let i=t[n].radius-V(t[n],e);i<=r&&(r=i)}for(let t=0;t<n.length;++t){let i=V(n[t],e)-n[t].radius;i<=r&&(r=i)}return r}e(Q,`circleMargin`);function Ae(e,t,n){let r=[];for(let t of e)r.push({x:t.x,y:t.y}),r.push({x:t.x+t.radius/2,y:t.y}),r.push({x:t.x-t.radius/2,y:t.y}),r.push({x:t.x,y:t.y+t.radius/2}),r.push({x:t.x,y:t.y-t.radius/2});let i=r[0],a=Q(r[0],e,t);for(let n=1;n<r.length;++n){let o=Q(r[n],e,t);o>=a&&(i=r[n],a=o)}let o=de(n=>-1*Q({x:n[0],y:n[1]},e,t),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,s={x:n?0:o[0],y:o[1]},c=!0;for(let t of e)if(V(s,t)>t.radius){c=!1;break}for(let e of t)if(V(s,e)<e.radius){c=!1;break}if(c)return s;if(e.length==1)return{x:e[0].x,y:e[0].y};let l={};return z(e,l),l.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:l.arcs.length==1?{x:l.arcs[0].circle.x,y:l.arcs[0].circle.y}:t.length?Ae(e,[]):ce(l.arcs.map(e=>e.p1))}e(Ae,`computeTextCentre`);function je(e){let t={},n=Object.keys(e);for(let e of n)t[e]=[];for(let r=0;r<n.length;r++){let i=n[r],a=e[i];for(let o=r+1;o<n.length;++o){let r=n[o],s=e[r],c=V(a,s);c+s.radius<=a.radius+1e-10?t[r].push(i):c+a.radius<=s.radius+1e-10&&t[i].push(r)}}return t}e(je,`getOverlappingCircles`);function Me(e,t,n){let r={},i=je(e);for(let a=0;a<t.length;++a){let o=t[a].sets,s={},c={};for(let e=0;e<o.length;++e){s[o[e]]=!0;let t=i[o[e]];for(let e=0;e<t.length;++e)c[t[e]]=!0}let l=[],u=[];for(let t in e)t in s?l.push(e[t]):t in c||u.push(e[t]);let d=Ae(l,u,n);r[o]=d,d.disjoint&&t[a].size>0&&console.log(`WARNING: area `+o+` not represented on screen`)}return r}e(Me,`computeTextCentres`);function Ne(e,t,n){let r=[];return r.push(`
29
+ M`,e,t),r.push(`
30
+ m`,-n,0),r.push(`
31
+ a`,n,n,0,1,0,n*2,0),r.push(`
32
+ a`,n,n,0,1,0,-n*2,0),r.join(` `)}e(Ne,`circlePath`);function Pe(e){let t=e.split(` `);return{x:Number.parseFloat(t[1]),y:Number.parseFloat(t[2]),radius:-Number.parseFloat(t[4])}}e(Pe,`circleFromPath`);function Fe(e){if(e.length===0)return[];let t={};return z(e,t),t.arcs}e(Fe,`intersectionAreaArcs`);function Ie(e,t){if(e.length===0)return`M 0 0`;let n=10**(t||0),r=t==null?e=>e:e=>Math.round(e*n)/n;if(e.length==1){let t=e[0].circle;return Ne(r(t.x),r(t.y),r(t.radius))}let i=[`
33
+ M`,r(e[0].p2.x),r(e[0].p2.y)];for(let t of e){let e=r(t.circle.radius);i.push(`
34
+ A`,e,e,0,+!!t.large,+!!t.sweep,r(t.p1.x),r(t.p1.y))}return i.join(` `)}e(Ie,`arcsToPath`);function Le(e,t){return Ie(Fe(e),t)}e(Le,`intersectionAreaPath`);function Re(t,n={}){let{lossFunction:r,layoutFunction:i=me,normalize:a=!0,orientation:o=Math.PI/2,orientationOrder:s,width:c=600,height:l=350,padding:u=15,scaleToFit:d=!1,symmetricalTextCentre:f=!1,distinct:p,round:m=2}=n,h=i(t,{lossFunction:r==="default"||!r?Y:r===`logRatio`?Se:r,distinct:p});a&&(h=Te(h,o,s));let g=Ee(h,c,l,u,d),_=Me(g,t,f),v=new Map(Object.keys(g).map(e=>[e,{set:e,x:g[e].x,y:g[e].y,radius:g[e].radius}])),y=t.map(e=>{let t=e.sets.map(e=>v.get(e)),n=Fe(t);return{circles:t,arcs:n,path:Ie(n,m),area:e,has:new Set(e.sets)}});function b(e){let t=``;for(let n of y)n.has.size>e.length&&e.every(e=>n.has.has(e))&&(t+=` `+n.path);return t}return e(b,`genDistinctPath`),y.map(({circles:e,arcs:t,path:n,area:r})=>({data:r,text:_[r.sets],circles:e,arcs:t,path:n,distinctPath:n+b(r.sets)}))}e(Re,`layout`);function ze(e){let t=new Map;for(let n of e){let e=n.targets.join(`|`),r=t.get(e);r?Object.assign(r,n.styles):t.set(e,{...n.styles})}return t}e(ze,`buildStyleByKey`);var Be=e((e,n,o,s)=>{let c=s.db,l=c.getConfig?.(),{themeVariables:u,look:f,handDrawnSeed:m}=d(),v=f===`handDrawn`,y=[u.venn1,u.venn2,u.venn3,u.venn4,u.venn5,u.venn6,u.venn7,u.venn8].filter(Boolean),b=c.getDiagramTitle?.(),x=c.getSubsetData(),S=c.getTextData(),C=ze(c.getStyleData()),w=He(x),T=l?.width??800,E=l?.height??450,D=T/1600,O=b?48*D:0,k=u.primaryTextColor??u.textColor,A=g(n);A.attr(`viewBox`,`0 0 ${T} ${E}`),b&&A.append(`text`).text(b).attr(`class`,`venn-title`).attr(`font-size`,`${32*D}px`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).attr(`x`,`50%`).attr(`y`,32*D).style(`fill`,u.vennTitleTextColor||u.titleColor);let j=t(document.createElement(`div`)),M=ke().width(T).height(E-O);j.datum(w).call(M);let N=v?_.svg(j.select(`svg`).node()):void 0,P=Re(w,{width:T,height:E-O,padding:l?.padding??15}),F=new Map;for(let e of P){let t=$([...e.data.sets].sort());F.set(t,e)}S.length>0&&Ve(l,F,j,S,D,C);let I=p(u.background||`#f4f4f4`);j.selectAll(`.venn-circle`).each(function(e,n){let i=t(this),o=$([...e.sets].sort()),s=C.get(o),c=s?.fill||y[n%y.length]||u.primaryColor;i.classed(`venn-set-${n%8}`,!0);let l=s?.[`fill-opacity`]??.1,d=s?.stroke||c,f=s?.[`stroke-width`]||`${5*D}`;if(v&&N){let e=F.get(o);if(e&&e.circles.length>0){let t=e.circles[0],r=N.circle(t.x,t.y,t.radius*2,{roughness:.7,seed:m,fill:h(c,.7),fillStyle:`hachure`,fillWeight:2,hachureGap:8,hachureAngle:-41+n*60,stroke:d,strokeWidth:parseFloat(String(f))});i.select(`path`).remove(),i.node()?.insertBefore(r,i.select(`text`).node())}}else i.select(`path`).style(`fill`,c).style(`fill-opacity`,l).style(`stroke`,d).style(`stroke-width`,f).style(`stroke-opacity`,.95);let p=s?.color||(I?r(c,30):a(c,30));i.select(`text`).style(`font-size`,`${48*D}px`).style(`fill`,p)}),v&&N?j.selectAll(`.venn-intersection`).each(function(e){let n=t(this),r=$([...e.sets].sort()),i=C.get(r),a=i?.fill;if(a){let e=n.select(`path`),t=e.attr(`d`);if(t){let n=N.path(t,{roughness:.7,seed:m,fill:h(a,.3),fillStyle:`cross-hatch`,fillWeight:2,hachureGap:6,hachureAngle:60,stroke:`none`}),r=e.node();r?.parentNode?.insertBefore(n,r),e.remove()}}else n.select(`path`).style(`fill-opacity`,0);n.select(`text`).style(`font-size`,`${48*D}px`).style(`fill`,i?.color??u.vennSetTextColor??k)}):(j.selectAll(`.venn-intersection text`).style(`font-size`,`${48*D}px`).style(`fill`,e=>{let t=$([...e.sets].sort());return C.get(t)?.color??u.vennSetTextColor??k}),j.selectAll(`.venn-intersection path`).style(`fill-opacity`,e=>{let t=$([...e.sets].sort());return+!!C.get(t)?.fill}).style(`fill`,e=>{let t=$([...e.sets].sort());return C.get(t)?.fill??`transparent`}));let L=A.append(`g`).attr(`transform`,`translate(0, ${O})`),R=j.select(`svg`).node();if(R&&`childNodes`in R)for(let e of[...R.childNodes])L.node()?.appendChild(e);i(A,E,T,l?.useMaxWidth??!0)},`draw`);function $(e){return e.join(`|`)}e($,`stableSetsKey`);function Ve(e,t,n,r,i,a){let o=e?.useDebugLayout??!1,s=n.select(`svg`).append(`g`).attr(`class`,`venn-text-nodes`),c=new Map;for(let e of r){let t=$(e.sets),n=c.get(t);n?n.push(e):c.set(t,[e])}for(let[e,n]of c.entries()){let r=t.get(e);if(!r?.text)continue;let c=r.text.x,l=r.text.y,u=Math.min(...r.circles.map(e=>e.radius)),d=Math.min(...r.circles.map(e=>e.radius-Math.hypot(c-e.x,l-e.y))),f=Number.isFinite(d)?Math.max(0,d):0;f===0&&Number.isFinite(u)&&(f=u*.6);let p=s.append(`g`).attr(`class`,`venn-text-area`).attr(`font-size`,`${40*i}px`);o&&p.append(`circle`).attr(`class`,`venn-text-debug-circle`).attr(`cx`,c).attr(`cy`,l).attr(`r`,f).attr(`fill`,`none`).attr(`stroke`,`purple`).attr(`stroke-width`,1.5*i).attr(`stroke-dasharray`,`${6*i} ${4*i}`);let m=Math.max(80*i,f*2*.95),h=Math.max(60*i,f*2*.95),g=(r.data.label&&r.data.label.length>0?Math.min(32*i,f*.25):0)+(n.length<=2?30*i:0),_=c-m/2,v=l-h/2+g,y=Math.max(1,Math.ceil(Math.sqrt(n.length))),b=Math.max(1,Math.ceil(n.length/y)),x=m/y,S=h/b;for(let[e,t]of n.entries()){let n=e%y,r=Math.floor(e/y),s=_+x*(n+.5),c=v+S*(r+.5);o&&p.append(`rect`).attr(`class`,`venn-text-debug-cell`).attr(`x`,_+x*n).attr(`y`,v+S*r).attr(`width`,x).attr(`height`,S).attr(`fill`,`none`).attr(`stroke`,`teal`).attr(`stroke-width`,1*i).attr(`stroke-dasharray`,`${4*i} ${3*i}`);let l=x*.9,u=S*.9,d=p.append(`foreignObject`).attr(`class`,`venn-text-node-fo`).attr(`width`,l).attr(`height`,u).attr(`x`,s-l/2).attr(`y`,c-u/2).attr(`overflow`,`visible`),f=a.get(t.id)?.color,m=d.append(`xhtml:span`).attr(`class`,`venn-text-node`).style(`display`,`flex`).style(`width`,`100%`).style(`height`,`100%`).style(`white-space`,`normal`).style(`align-items`,`center`).style(`justify-content`,`center`).style(`text-align`,`center`).style(`overflow-wrap`,`normal`).style(`word-break`,`normal`).text(t.label??t.id);f&&m.style(`color`,f)}}}e(Ve,`renderTextNodes`);function He(e){let t=new Set(e.map(e=>[...e.sets].sort().join(`|`))),n=new Map(e.filter(e=>e.sets.length===1&&e.size!==void 0).map(e=>[e.sets[0],e.size])),r=[];for(let i of e){if(i.sets.length<3)continue;let e=[...i.sets].sort();for(let i=0;i<e.length-1;i++)for(let a=i+1;a<e.length;a++){let o=[e[i],e[a]],s=o.join(`|`);if(!t.has(s)){t.add(s);let e=n.get(o[0]),i=n.get(o[1]),a=e!==void 0&&i!==void 0?Math.min(e,i)/4:2.5;r.push({sets:o,size:a,label:``})}}}return r.length>0?[...e,...r]:e}e(He,`ensurePairwiseSubsets`);var Ue={parser:b,db:re,renderer:{draw:Be},styles:ie};export{Ue as diagram};
@@ -0,0 +1 @@
1
+ import"./chunk-ZS6VBONO-D-IFTJgn.js";import{n as e}from"./chunk-3SMGFRGC-C0WC5bhP.js";export{e as createWardleyServices};