fika-editor 3.0.3 → 3.0.4

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 (119) hide show
  1. package/dist/embed/183.js +25 -31
  2. package/dist/embed/agentic-manifest.json +2 -2
  3. package/dist/embed/chunks/{9121.js → 1091.js} +1 -1
  4. package/dist/embed/chunks/112.js +64 -0
  5. package/dist/embed/chunks/1131.js +1 -1
  6. package/dist/embed/chunks/{7854.js → 1483.js} +1 -1
  7. package/dist/embed/chunks/1488.js +93 -0
  8. package/dist/embed/chunks/1742.js +90 -0
  9. package/dist/embed/chunks/190.js +1 -0
  10. package/dist/embed/chunks/2062.js +94 -0
  11. package/dist/embed/chunks/{1904.js → 2214.js} +1 -1
  12. package/dist/embed/chunks/2395.js +1 -0
  13. package/dist/embed/chunks/{7594.js → 2619.js} +1 -1
  14. package/dist/embed/chunks/2638.js +1 -0
  15. package/dist/embed/chunks/2853.js +1 -0
  16. package/dist/embed/chunks/2982.js +24 -0
  17. package/dist/embed/chunks/3009.js +1 -0
  18. package/dist/embed/chunks/3017.js +1 -0
  19. package/dist/embed/chunks/3084.js +27 -0
  20. package/dist/embed/chunks/3270.js +62 -0
  21. package/dist/embed/chunks/3275.js +226 -0
  22. package/dist/embed/chunks/3312.js +1 -0
  23. package/dist/embed/chunks/3671.js +1 -0
  24. package/dist/embed/chunks/4000.js +23 -0
  25. package/dist/embed/chunks/4392.js +41 -0
  26. package/dist/embed/chunks/451.js +32 -0
  27. package/dist/embed/chunks/4630.js +148 -0
  28. package/dist/embed/chunks/4764.js +1 -0
  29. package/dist/embed/chunks/{4552.js → 4779.js} +1 -1
  30. package/dist/embed/chunks/4929.js +215 -0
  31. package/dist/embed/chunks/4936.js +12 -12
  32. package/dist/embed/chunks/4975.js +98 -97
  33. package/dist/embed/chunks/5250.js +153 -1
  34. package/dist/embed/chunks/529.js +36 -0
  35. package/dist/embed/chunks/5428.js +1 -0
  36. package/dist/embed/chunks/{4619.js → 549.js} +2 -2
  37. package/dist/embed/chunks/5493.js +1 -0
  38. package/dist/embed/chunks/5681.js +1 -0
  39. package/dist/embed/chunks/5863.js +1 -0
  40. package/dist/embed/chunks/612.js +1 -0
  41. package/dist/embed/chunks/6520.js +1 -0
  42. package/dist/embed/chunks/6762.js +1 -0
  43. package/dist/embed/chunks/6771.js +1 -0
  44. package/dist/embed/chunks/7029.js +1 -0
  45. package/dist/embed/chunks/7057.js +1 -0
  46. package/dist/embed/chunks/7091.js +1 -0
  47. package/dist/embed/chunks/718.js +1 -0
  48. package/dist/embed/chunks/7276.js +79 -0
  49. package/dist/embed/chunks/7305.js +115 -0
  50. package/dist/embed/chunks/7463.js +1 -1
  51. package/dist/embed/chunks/7471.js +1 -0
  52. package/dist/embed/chunks/7798.js +1 -0
  53. package/dist/embed/chunks/788.js +29 -19
  54. package/dist/embed/chunks/7946.js +1 -0
  55. package/dist/embed/chunks/{3729.js → 8407.js} +16 -4
  56. package/dist/embed/chunks/8628.js +1 -0
  57. package/dist/embed/chunks/8665.js +1 -0
  58. package/dist/embed/chunks/9009.js +1 -0
  59. package/dist/embed/chunks/9010.js +1 -0
  60. package/dist/embed/chunks/9256.js +8 -0
  61. package/dist/embed/chunks/9464.js +77 -0
  62. package/dist/embed/chunks/9678.js +1 -0
  63. package/dist/embed/chunks/{273.js → 9686.js} +1 -1
  64. package/dist/embed/chunks/9918.js +138 -0
  65. package/dist/embed/fika-embed.js +2 -2
  66. package/dist/types/store/index.d.ts +2 -2
  67. package/dist/types/store/slides.d.ts +2 -0
  68. package/package.json +8 -8
  69. package/dist/embed/chunks/1169.js +0 -1
  70. package/dist/embed/chunks/1605.js +0 -1
  71. package/dist/embed/chunks/1804.js +0 -8
  72. package/dist/embed/chunks/1916.js +0 -1
  73. package/dist/embed/chunks/2143.js +0 -62
  74. package/dist/embed/chunks/2246.js +0 -1
  75. package/dist/embed/chunks/2289.js +0 -80
  76. package/dist/embed/chunks/2632.js +0 -1
  77. package/dist/embed/chunks/2796.js +0 -34
  78. package/dist/embed/chunks/3088.js +0 -1
  79. package/dist/embed/chunks/3443.js +0 -1
  80. package/dist/embed/chunks/3581.js +0 -77
  81. package/dist/embed/chunks/397.js +0 -1
  82. package/dist/embed/chunks/4335.js +0 -1
  83. package/dist/embed/chunks/435.js +0 -1
  84. package/dist/embed/chunks/4354.js +0 -27
  85. package/dist/embed/chunks/4359.js +0 -1
  86. package/dist/embed/chunks/4515.js +0 -1
  87. package/dist/embed/chunks/4607.js +0 -1
  88. package/dist/embed/chunks/4625.js +0 -153
  89. package/dist/embed/chunks/4794.js +0 -1
  90. package/dist/embed/chunks/4891.js +0 -226
  91. package/dist/embed/chunks/5026.js +0 -1
  92. package/dist/embed/chunks/5480.js +0 -1
  93. package/dist/embed/chunks/5659.js +0 -64
  94. package/dist/embed/chunks/5792.js +0 -141
  95. package/dist/embed/chunks/5889.js +0 -1
  96. package/dist/embed/chunks/6014.js +0 -1
  97. package/dist/embed/chunks/627.js +0 -115
  98. package/dist/embed/chunks/6522.js +0 -1
  99. package/dist/embed/chunks/6567.js +0 -1
  100. package/dist/embed/chunks/6778.js +0 -1
  101. package/dist/embed/chunks/6999.js +0 -93
  102. package/dist/embed/chunks/7048.js +0 -1
  103. package/dist/embed/chunks/7101.js +0 -1
  104. package/dist/embed/chunks/717.js +0 -148
  105. package/dist/embed/chunks/7175.js +0 -90
  106. package/dist/embed/chunks/7311.js +0 -23
  107. package/dist/embed/chunks/7376.js +0 -1
  108. package/dist/embed/chunks/7588.js +0 -41
  109. package/dist/embed/chunks/7916.js +0 -79
  110. package/dist/embed/chunks/809.js +0 -1
  111. package/dist/embed/chunks/810.js +0 -1
  112. package/dist/embed/chunks/8212.js +0 -36
  113. package/dist/embed/chunks/8239.js +0 -1
  114. package/dist/embed/chunks/8620.js +0 -1
  115. package/dist/embed/chunks/8716.js +0 -215
  116. package/dist/embed/chunks/8941.js +0 -1
  117. package/dist/embed/chunks/9465.js +0 -5
  118. package/dist/embed/chunks/9761.js +0 -1
  119. package/dist/embed/chunks/9976.js +0 -1
@@ -1 +0,0 @@
1
- export const __rspack_esm_id=2632;export const __rspack_esm_ids=[2632];export const __webpack_modules__={99307(e,t,n){n.r(t);var r=n(62204),o=n(9290),l=n(9636);n(14782);var i=n(91865),a=n(6129);n(23656),n(15198);var s=n(24692),f=n(64183),d=n(31293),u=n(86827),h=n(697),g=n(49705).hp;async function c(e,t){let r=new h.T({multigraph:!0,compound:!0}),o=[...t.edges],i=(0,f.D7)(),a=e.insert("g").attr("class","root"),s=a.insert("g").attr("class","clusters"),d=a.insert("g").attr("class","edges edgePath"),u=a.insert("g").attr("class","edgeLabels"),g=a.insert("g").attr("class","nodes"),c=new Map,p=null!=e.node();for(let e of(await Promise.all(t.nodes.map(async e=>{if(e.isGroup)r.setNode(e.id,{...e});else{if(p){let t=await (0,l.on)(g,e,{config:i,dir:e.dir}),n=t.node()?.getBBox()??{width:0,height:0};c.set(e.id,t),e.width=n.width,e.height=n.height}r.setNode(e.id,{...e})}})),o))r.setEdge(e.start,e.end,{...e},e.id),t.edges.some(t=>t.id===e.id)||t.edges.push(e);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:r}=await n.e(818).then(n.bind(n,62857));r(e,t)}return{graph:r,groups:{clusters:s,edgePaths:d,edgeLabels:u,nodes:g,rootGroups:a},nodeElements:c}}function p(e){let t=[];for(let n=0;n<e.length-1;n++)t.push({a:e[n],b:e[n+1]});return t}function x(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(0===s)return null;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u<=1e-6||u>=1-1e-6||h<=1e-6||h>=1-1e-6?null:{point:{x:e.x+u*o,y:e.y+u*l},tA:u,tB:h}}function m(e){return Math.abs(e.b.x-e.a.x)>=Math.abs(e.b.y-e.a.y)}function y(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],o=p(r.points);for(let l=n+1;l<e.length;l++){let n=e[l],i=p(n.points);for(let[e,l]of o.entries())for(let[o,a]of i.entries()){let i=x(l.a,l.b,a.a,a.b);if(!i)continue;let s=m(l);s!==m(a)&&s?t.push({jumpEdgeId:r.id,otherEdgeId:n.id,segIndex:e,t:i.tA,point:i.point}):t.push({jumpEdgeId:n.id,otherEdgeId:r.id,segIndex:o,t:i.tB,point:i.point})}}}return t}function b(e){let t=Math.round(1e3*e)/1e3;return Number.isInteger(t),`${t}`}function M(e){return`${b(e.x)},${b(e.y)}`}function K(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)}function I(e,t){if(e.length<2)return e.map(e=>({...e}));let n=e.map(e=>({...e})),r=t.arrowTypeStart&&i.hq[t.arrowTypeStart];if(r){let t=e[0],o=e[1],l=Math.atan2(o.y-t.y,o.x-t.x);n[0].x=t.x+r*Math.cos(l),n[0].y=t.y+r*Math.sin(l)}let o=t.arrowTypeEnd&&i.hq[t.arrowTypeEnd];if(o){let t=e.length,r=e[t-2],l=e[t-1],i=Math.atan2(l.y-r.y,l.x-r.x);n[t-1].x=l.x-o*Math.cos(i),n[t-1].y=l.y-o*Math.sin(i)}return n}function w(e,t,n,r,o){let l=e.point.x,i=e.point.y,a={x:l-t*e.r,y:i-n*e.r},s={x:l+t*e.r,y:i+n*e.r},f=[`L${M(a)}`];return"arc"===o?f.push(`A${b(e.r)},${b(e.r)} 0 0 ${r} ${M(s)}`):f.push(`M${M(s)}`),f}function S(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=n.x-t.x,a=n.y-t.y,s=Math.hypot(o,l),f=Math.hypot(i,a);if(s<1e-5||f<1e-5)return null;let d=o/s,u=l/s,h=i/f,g=a/f,c=Math.acos(Math.max(-1,Math.min(1,d*h+u*g)));if(c<1e-5||1e-5>Math.abs(Math.PI-c))return null;let p=Math.min(r/Math.sin(c/2),s/2,f/2);return{startX:t.x-d*p,startY:t.y-u*p,endX:t.x+h*p,endY:t.y+g*p,ctrlX:t.x,ctrlY:t.y,cutLen:p}}function v(e,t,n){let r=e.points;if(r.length<2)return"";let o=I(r,e),l="rounded"===e.curve,i=p(o),a=new Map;for(let e of t){let t=i[e.segIndex];if(!t)continue;let r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),o=a.get(e.segIndex)??[];o.push({t:e.t,point:e.point,d:e.t*r,r:n.jumpRadius}),a.set(e.segIndex,o)}let s=[`M${M(o[0])}`];for(let e=0;e<i.length;e++){let t=i[e],r=Math.hypot(t.b.x-t.a.x,t.b.y-t.a.y),f=0===r?0:(t.b.x-t.a.x)/r,d=0===r?0:(t.b.y-t.a.y)/r,u=K(t),h=0;if(l&&e>0){let t=S(o[e-1],o[e],o[e+1]??o[e],5);t&&(h=t.cutLen)}let g=r,c=null;l&&e<i.length-1&&(c=S(o[e],o[e+1],o[e+2]??o[e+1],5))&&(g=r-c.cutLen);let p=[...a.get(e)??[]].sort((e,t)=>e.t-t.t);for(let e of p)e.r=Math.min(e.r,e.d-h,g-e.d);for(let e=0;e<p.length-1;e++){let t=p[e+1].d-p[e].d;if(p[e].r+p[e+1].r>t){let n=t/2;p[e].r=Math.min(p[e].r,n),p[e+1].r=Math.min(p[e+1].r,n)}}for(let e of p)e.r<.001||s.push(...w(e,f,d,u,n.jumpStyle));l&&c?(s.push(`L${b(c.startX)},${b(c.startY)}`),s.push(`Q${b(c.ctrlX)},${b(c.ctrlY)} ${b(c.endX)},${b(c.endY)}`)):s.push(`L${M(t.b)}`)}return s.join(" ")}function C(e){return/^[\d\s+,.LMelm-]*$/.test(e)}function L(e){return!e||"linear"===e||"rounded"===e||"step"===e||"stepBefore"===e||"stepAfter"===e}function $(e){if(!e)return null;try{let t="function"==typeof atob?atob(e):g.from(e,"base64").toString(),n=JSON.parse(t);if(!Array.isArray(n))return null;let r=[];for(let e of n)e&&"number"==typeof e.x&&"number"==typeof e.y&&r.push({x:e.x,y:e.y});return r.length>=2?r:null}catch{return null}}function k(e,t,n){if(!n.enabled)return;let r=e.node();if(!r)return;let o=new Map;for(let e of t)o.set(e.id,e);let l=[],i=new Map;for(let e of t){let t="u">typeof CSS&&CSS.escape?CSS.escape(e.id):e.id,n=r.querySelector(`path[data-id="${t}"]`);if(!n)continue;i.set(e.id,n);let o=$(n.getAttribute("data-points"))??e.points;l.push({...e,points:o})}let a=y(l);if(0===a.length)return;let s=new Map;for(let e of a){let t=s.get(e.jumpEdgeId)??[];t.push(e),s.set(e.jumpEdgeId,t)}for(let e of l){let t=s.get(e.id);if(!t||0===t.length)continue;let r=o.get(e.id),l=r?.curve;if(void 0!==l&&!L(l))continue;let a=i.get(e.id);if(!a||void 0===l&&!C(a.getAttribute("d")??""))continue;let f=a.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),u=d?Number.parseFloat(d[1]):null,h=d?Number.parseFloat(d[2]):null,g=v(e,t,n);if(a.setAttribute("d",g),null!==u&&null!==h&&"function"==typeof a.getTotalLength){let e=Math.max(0,a.getTotalLength()-u-h),t=`0 ${u} ${e} ${h}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${t};`).replace(/;\s*;+/g,";");a.setAttribute("style",n)}}}async function R(e,t){for(let n of e.nodes)n.isGroup?await (0,l.U)(t.clusters,n):(0,l.U_)(n);let n=new Map;for(let t of e.nodes)t?.id&&n.set(t.id,t);for(let r of e.edges){let l=r.start?n.get(r.start)??{}:{},i=r.end?n.get(r.end)??{}:{},a=(0,o.Jo)(t.edgePaths,{...r},{},e.type,l,i,e.diagramId);r.label&&await (0,o.jP)(t.rootGroups,r),r.label&&T(r,a)}let r=e.config?.swimlane?.lineHops;if(!1!==r){let n=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}));k(t.edgePaths,n,{enabled:!0,jumpRadius:6,jumpStyle:"gap"===r?"gap":"arc"})}}function T(e,t){let n=t?.updatedPath??t?.originalPath,r=(0,f.zj)(),{subGraphTitleTotalMargin:l}=(0,a.O)({flowchart:r.flowchart??{}});if(e.label){let r=o.lP.get(e.id),i=e.x,a=e.y;if(n){let r=s._K.calcLabelPosition(n);d.R.debug("Moving label "+e.label+" from (",i,",",a,") to (",r.x,",",r.y,") abc88"),t&&(i=r.x,a=r.y)}r.attr("transform",`translate(${i}, ${a+l/2})`)}if(e?.startLabelLeft){let t=o.UQ.get(e.id).startLeft,r=e?.x,l=e?.y;if(n){let t=s._K.calcTerminalLabelPosition(10*!!e.arrowTypeStart,"start_left",n);r=t.x,l=t.y}t.attr("transform",`translate(${r}, ${l})`)}if(e.startLabelRight){let t=o.UQ.get(e.id).startRight,r=e.x,l=e.y;if(n){let t=s._K.calcTerminalLabelPosition(10*!!e.arrowTypeStart,"start_right",n);r=t.x,l=t.y}t.attr("transform",`translate(${r}, ${l})`)}if(e.endLabelLeft){let t=o.UQ.get(e.id).endLeft,r=e.x,l=e.y;if(n){let t=s._K.calcTerminalLabelPosition(10*!!e.arrowTypeEnd,"end_left",n);r=t.x,l=t.y}t.attr("transform",`translate(${r}, ${l})`)}if(e.endLabelRight){let t=o.UQ.get(e.id).endRight,r=e.x,l=e.y;if(n){let t=s._K.calcTerminalLabelPosition(10*!!e.arrowTypeEnd,"end_right",n);r=t.x,l=t.y}t.attr("transform",`translate(${r}, ${l})`)}}(0,u.K)(c,"createGraphWithElements"),(0,u.K)(p,"buildSegmentList"),(0,u.K)(x,"segmentIntersection"),(0,u.K)(m,"isHorizontalSeg"),(0,u.K)(y,"findEdgeIntersections"),(0,u.K)(b,"fmt"),(0,u.K)(M,"pointToString"),(0,u.K)(K,"getArcSweepFlag"),(0,u.K)(I,"applyMarkerOffsets"),(0,u.K)(w,"emitJump"),(0,u.K)(S,"computeRoundedCorner"),(0,u.K)(v,"rewriteEdgePath"),(0,u.K)(C,"isStraightPath"),(0,u.K)(L,"curveSupportsLineHops"),(0,u.K)($,"decodeDataPoints"),(0,u.K)(k,"applyLineJumpsToSvg"),(0,u.K)(R,"adjustLayout"),(0,u.K)(T,"positionEdgeLabel");var O="__swimlane_default__";function F(e){return Math.max(e.padding??20,20)}function E(e){let{x:t,y:n,width:r,height:o}=e,l=e.swimlaneContentTop;if("number"!=typeof t||"number"!=typeof n||"number"!=typeof r||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(o)||!Number.isFinite(l)||r<=0||o<=0)return void delete e.groupTitleRect;let i=n-o/2,a=Math.min(21,Math.max(0,Math.min(l,n+o/2)-i)),s=i+a;s<=i?delete e.groupTitleRect:e.groupTitleRect={left:t-r/2,right:t+r/2,top:i,bottom:s}}function B(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(0===r.length)return;let o=n.find(e=>e.id===O);for(let e of(o?o.isGroup&&(o.shape="swimlane",t&&(o.direction=t)):(o={id:O,label:"",isGroup:!0,shape:"swimlane",padding:20,...t?{direction:t}:{}},n.push(o)),r))e.parentId=O}function N(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="string"==typeof t.start?t.start:void 0,r="string"==typeof t.end?t.end:void 0;e&&r&&(t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t}))}let r=e.nodes??[],o=r.filter(e=>e.isGroup),l=r.filter(e=>!e.isGroup);return{nodes:[...[...o].reverse(),...l].map(e=>e.id),edges:n,layout:e,nodeById:t}}function X(e,t,n,r){let{layout:o}=e,l=e.nodeById,i=r?.layerGap??100,a=r?.nodeGap??40,s=0;for(let e of t.layers){let t=0;for(let r of e){let e=l.get(r);if(!e){t++;continue}e.layer=s,e.order=t;let o=n.x[r]??t*a,f=n.y[r]??s*i;e.x=o,e.y=f,t++}s++}let f=o.nodes??[],d=new Map,u=[];for(let e of f){if(!e?.isGroup)continue;e.parentId||u.push(e);let t=f.filter(t=>t.parentId===e.id),r=1/0,o=-1/0,l=1/0,i=-1/0;for(let e of t){let t=e.x??n.x[e.id],a=e.y??n.y[e.id],s=e.width??0,f=e.height??0;null!=t&&null!=a&&(r=Math.min(r,t-s/2),o=Math.max(o,t+s/2),l=Math.min(l,a-f/2),i=Math.max(i,a+f/2))}if(1/0===r||1/0===l)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=Math.max(0,o-r)+(e.parentId?t:2*F(e)),a=Math.max(0,i-l)+t,s=(l+i)/2;e.x=(r+o)/2,e.y=s,e.width=n,e.height=a,d.set(e.id,{minX:r,maxX:o,minY:l,maxY:i})}}if(u.length>0&&d.size>0){let e=1/0,t=-1/0,n=0;for(let r of u){let o=r.padding??20;o>n&&(n=o);let l=d.get(r.id);l&&(e=Math.min(e,l.minY),t=Math.max(t,l.maxY))}if(1/0!==e&&-1/0!==t){let r=Math.max(0,t-e)+2*Math.max(n,36),o=(e+t)/2;for(let t of u)t.y=o,t.height=r,t.swimlaneContentTop=e;let l=[...u].sort((e,t)=>(e.x??0)-(t.x??0)),i=[],a=[],s=[];for(let e of l){let t=d.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*F(e),r=(t.minX+t.maxX)/2;i.push(e.id),a.push(r),s.push(n)}let f=i.length;if(f>0){let e=new Map;if(1===f)e.set(i[0],s[0]);else{let t=[];for(let e=0;e<f-1;e++)t.push(a[e+1]-a[e]);let n=Array(f);n[0]=0;for(let e=0;e<f-1;e++)n[e+1]=2*t[e]-n[e];let r=0,o=1/0;for(let e=0;e<f;e++){let t=s[e];e%2==0?r=Math.max(r,t-n[e]):o=Math.min(o,n[e]-t)}let l=r;l=r<=o?(r+o)/2:r;for(let t=0;t<f;t++){let r=n[t]+(t%2==0?l:-l),o=Math.max(s[t],r);e.set(i[t],o)}}for(let t of u){let n=e.get(t.id);null!=n&&(t.width=n),E(t)}}}}}function z(e){let t=[],n=[],r=new Map;for(let t of e.nodes)r.set(t.id,t);for(let o of e.edges){if(!o.label||0===o.label.length||o.isLayoutOnly||o.labelNodeId)continue;let e=o.start?r.get(o.start):void 0,l=o.end?r.get(o.end):void 0;if(!e||!l){d.R.warn("[EdgeLabelNodes]",`Edge ${o.id} has missing source or target node`);continue}let i=`edge-label-${o.start}-${o.end}-${o.id}`,a=e.parentId!==l.parentId?l.parentId:e.parentId,s={id:i,label:o.label,edgeStart:o.start??"",edgeEnd:o.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:a,isGroup:!1,labelStyle:Array.isArray(o.labelStyle)?o.labelStyle[0]:o.labelStyle??"",...e.dir?{dir:e.dir}:{}};t.push(s),o.labelNodeId=i,o.label=void 0,o.text=void 0;let f={id:`${o.id}-to-label`,start:o.start,end:i,type:"normal",isLayoutOnly:!0},u={id:`${o.id}-from-label`,start:i,end:o.end,type:"normal",isLayoutOnly:!0};n.push(f,u)}let o=[...e.nodes,...t],l=[...e.edges,...n];return{...e,nodes:o,edges:l}}function Y(e){let t=e.x??0,n=e.y??0,r=e.width??0,o=e.height??0;return r>0&&o>0?{cx:t,cy:n,rect:er(t,n,r,o)}:void 0}function A(e){if(e.isGroup)return;let t=Y(e);if(t)return{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}}function P(e,t,n=.001){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function G(e,t,n=.001){return Math.abs(e.x-t.x)<n}function D(e,t,n=.001){return Math.abs(e.y-t.y)<n}function H(e,t,n=.001){return D(e,t,n)&&Math.abs(e.x-t.x)>n}function _(e,t,n=.001){return G(e,t,n)&&Math.abs(e.y-t.y)>n}function j(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)))}function V(e,t,n=.001){return e.horizontal&&t.horizontal&&D(e.a,t.a,n)?j(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&G(e.a,t.a,n)?j(e.a.y,e.b.y,t.a.y,t.b.y):0}function W(e,t=.001){let n=[];for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1],i=H(o,l,t),a=_(o,l,t);(i||a)&&n.push({index:r,a:o,b:l,horizontal:i,vertical:a})}return n}function U(e,t=.001){let n=W(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}function q(e,t=.001){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;e&&P(e,r,t)||n.push({x:r.x,y:r.y})}return n}function J(e,t=.001){if(!e||4!==e.length)return;let[n,r,o,l]=e;return H(n,r,t)&&_(r,o,t)&&H(o,l,t)?{kind:"HVH",p0:n,p1:r,p2:o,p3:l}:_(n,r,t)&&H(r,o,t)&&_(o,l,t)?{kind:"VHV",p0:n,p1:r,p2:o,p3:l}:void 0}function Q(e,t,n,r=0){let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return l>n.left-r&&o<n.right+r&&a>n.top-r&&i<n.bottom+r}function Z(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}function ee(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function et(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function en(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function er(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function eo(e){return Y(e)?.rect}function el(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}}}function ei(e,t,n,r,o,l=.001){let i="left"===t||"right"===t,a="left"===r||"right"===r;if(i&&a){if("right"===t&&"left"===r&&e.x<n.x||"left"===t&&"right"===r&&e.x>n.x){if(D(e,n,l))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(D(e,n,l))return;let r="left"===t?Math.min(e.x,n.x)-o:Math.max(e.x,n.x)+o;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!i&&!a){if(t===r){if(G(e,n,l))return;let r="top"===t?Math.min(e.y,n.y)-o:Math.max(e.y,n.y)+o;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!("bottom"===t&&"top"===r&&e.y<n.y||"top"===t&&"bottom"===r&&e.y>n.y))return;if(G(e,n,l))return[e,n];let i=(e.y+n.y)/2;return[e,{x:e.x,y:i},{x:n.x,y:i},n]}if(i&&!a){let o="right"===t&&n.x>e.x||"left"===t&&n.x<e.x,l="top"===r&&e.y<n.y||"bottom"===r&&e.y>n.y;return o&&l?[e,{x:n.x,y:e.y},n]:void 0}let s="bottom"===t&&n.y>e.y||"top"===t&&n.y<e.y,f="left"===r&&e.x<n.x||"right"===r&&e.x>n.x;return s&&f?[e,{x:e.x,y:n.y},n]:void 0}function ea(e,t,n,r){return"left"===t||"right"===t?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}function es(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=A(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function ef(e){let t=[],n=[];for(let r of e){let e=A(r);if(!e)continue;let o={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(o):t.push(o)}return{realNodeRects:t,labelNodeRects:n}}function ed(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,o=r.y??0,l=r.width??0,i=r.height??0;n.push({nodeId:r.id,...er(e,o,l,i)})}return n}function eu(e,t,n=.001){let r=e.start,o=e.end;if(!r||!o)return;let l=t.get(r),i=t.get(o);if(l&&i)return{srcId:r,dstId:o,srcInfo:l,dstInfo:i,collinearX:Math.abs(l.cx-i.cx)<n,collinearY:Math.abs(l.cy-i.cy)<n}}function eh(e,t,n,r=[],o=0){for(let l of n)if(!r.includes(l.id)&&Q(e,t,l.rect,-o))return!0;return!1}function eg(e,t,n,r,o=.001,l=1e-6){let i=D(e,t,o),a=G(e,t,o),s=D(n,r,o),f=G(n,r,o);if(i&&s||a&&f||!(i||a)||!(s||f))return!1;let d=i?{a:e,b:t}:{a:n,b:r},u=a?{a:e,b:t}:{a:n,b:r},h=d.a.y,g=Math.min(d.a.x,d.b.x),c=Math.max(d.a.x,d.b.x),p=u.a.x,x=Math.min(u.a.y,u.b.y),m=Math.max(u.a.y,u.b.y);if(p<g||p>c||h<x||h>m)return!1;let y=Math.abs(p-d.a.x)<l&&Math.abs(h-d.a.y)<l||Math.abs(p-d.b.x)<l&&Math.abs(h-d.b.y)<l,b=Math.abs(p-u.a.x)<l&&Math.abs(h-u.a.y)<l||Math.abs(p-u.b.x)<l&&Math.abs(h-u.b.y)<l;return!(y&&b)}function ec(e,t,n,r,o=.001){let l=D(e,t,o),i=G(e,t,o),a=D(n,r,o),s=G(n,r,o);return i&&s&&G(e,n,o)?j(e.y,t.y,n.y,r.y)>o:!!(l&&a&&D(e,n,o))&&j(e.x,t.x,n.x,r.x)>o}function ep(e,t,n,r,{epsilon:o=.001,skipDegenerateOther:l=!1}={}){for(let i of n){if(i===r||i.isLayoutOnly)continue;let n=i.points;if(n&&!(n.length<2))for(let r=0;r<n.length-1;r++){let i=n[r],a=n[r+1];if(!(l&&P(i,a,o))&&(eg(e,t,i,a,o)||ec(e,t,i,a,o)))return!0}}return!1}function ex(e,t,n,r,o=.001){let l=D(e,t,o),i=G(e,t,o),a=D(n,r,o),s=G(n,r,o);if(!(l&&s||i&&a))return!1;let f=l?{a:e,b:t}:{a:n,b:r},d=l?{a:n,b:r}:{a:e,b:t},u=f.a.y,h=Math.min(f.a.x,f.b.x),g=Math.max(f.a.x,f.b.x),c=d.a.x,p=Math.min(d.a.y,d.b.y),x=Math.max(d.a.y,d.b.y);return c>h+o&&c<g-o&&u>p+o&&u<x-o}function em(e,t,n){let r=Math.min(t,n),o=Math.max(t,n);return e>r+.001&&e<o-.001}function ey(e,t,n){return G(e,t)&&G(t,n)?em(t.y,e.y,n.y):!!(D(e,t)&&D(t,n))&&em(t.x,e.x,n.x)}function eb(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let o=n[n.length-1],l=e[r],i=r+1<e.length?e[r+1]:void 0;if(o&&i){if(P(o,i)){r++,t=!0;continue}if(ey(o,l,i)){t=!0;continue}}n.push(l)}return{points:n,changed:t}}function eM(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],o=e[n];if(!G(r,o)&&!D(r,o)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&G(e,r)?{x:r.x,y:o.y}:{x:o.x,y:r.y};t.push(n)}t.push(o)}let n=[];for(let e of t){let t=n[n.length-1];t&&P(t,e)||n.push(e)}return n}function eK(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=eb(t);if(t=e.points,!e.changed)break}return t}function eI(e,t,n){if(e.isLayoutOnly||!e.points||e.points.length<n)return;let r=e.start?t.get(e.start):void 0,o=e.end?t.get(e.end):void 0;return{edge:e,points:e.points,srcRect:r?eo(r):void 0,dstRect:o?eo(o):void 0}}function ew(e,t,n){if(D(e,t,.001))return{x:e.x<n.left?n.left:n.right,y:e.y};if(G(e,t,.001)){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))}}function eS(e,t,n){let r=n?1:-1,o=n?0:e.length-1;for(;o>=0&&o<e.length&&Z(e[o],t,.5);)o+=r;if(o<0||o>=e.length)return e;let l=o-r;if(l<0||l>=e.length)return e;let i=ew(e[o],e[l],t);return n?[i,...e.slice(o)]:[...e.slice(0,o+1),i]}function ev(e,t){for(let n of e){let e=eI(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=eS(r,e.srcRect,!0)),e.dstRect&&(r=eS(r,e.dstRect,!1)),r=eN(r=eK(eM(r)),e.srcRect,e.dstRect),e.edge.points=eK(eM(r))}}function eC(e,t,n,r=!1){if(D(e,t,.001)){if(t.y<n.top-.001||t.y>n.bottom+.001)return t;if(r){if(e.x<n.left-.001)return{x:n.left,y:e.y};if(e.x>n.right+.001)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(G(e,t,.001)){if(t.x<n.left-.001||t.x>n.right+.001)return t;if(r){if(e.y<n.top-.001)return{x:e.x,y:n.top};if(e.y>n.bottom+.001)return{x:e.x,y:n.bottom}}let o=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:o?n.top:n.bottom}}return t}function eL(e,t,n){let r=e[t];for(let o=t+n;o>=0&&o<e.length;o+=n){let t=e[o];if(!P(t,r,.001))return t}return e[t+n]}function e$(e,t){let n=e+4,r=t-4;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}function ek(e,t,n){let{lo:r,hi:o}=e$(t,n);return Math.min(o,Math.max(r,e))}function eR(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}}function eT(e,t){return"left"===t||"right"===t?e$(e.top,e.bottom):e$(e.left,e.right)}function eO(e,t,n){let r=e.y>=n.top-.001&&e.y<=n.bottom+.001,o=e.x>=n.left-.001&&e.x<=n.right+.001;if(D(e,t,.001)&&r){if(.001>Math.abs(e.x-n.left))return"left";if(.001>Math.abs(e.x-n.right))return"right"}if(G(e,t,.001)&&o){if(.001>Math.abs(e.y-n.top))return"top";if(.001>Math.abs(e.y-n.bottom))return"bottom"}}function eF(e){return"left"===e||"right"===e}function eE(e,t,n,r,o){let l=[],i=n?eO(e,t,n):void 0,a=r?eO(t,e,r):void 0;return n&&i&&eF(i)===o&&l.push(eT(n,i)),r&&a&&eF(a)===o&&l.push(eT(r,a)),l.length>0?eR(l):void 0}function eB(e,t,n,r,o){let l=eE(e,t,n,r,o);if(!l)return;let i=o?e.y:e.x,a=Math.min(l.hi,Math.max(l.lo,i));if(!(.001>Math.abs(a-i)))return o?[{x:e.x,y:a},{x:t.x,y:a}]:[{x:a,y:e.y},{x:a,y:t.y}]}function eN(e,t,n){if(2!==e.length)return e;let[r,o]=e;return D(r,o,.001)?eB(r,o,t,n,!0)??e:G(r,o,.001)?eB(r,o,t,n,!1)??e:e}function eX(e,t,n){return eF(n)?{x:e.x,y:ek(e.y,t.top,t.bottom)}:{x:ek(e.x,t.left,t.right),y:e.y}}function ez(e,t,n,r,o,l){let i=e.map(e=>({...e}));for(let a=t;a>=0&&a<e.length;a+=n){let t=e[a];if(l&&!D(t,r,.001)||!l&&!G(t,r,.001))break;l?i[a].y=o.y:i[a].x=o.x}return i}function eY(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,o=n?1:-1,l=e[r],i=eL(e,r,o);if(!i)return e;let a=eO(l,i,t);if(!a)return e;let s=eF(a),f=eX(l,t,a);return P(l,f,.001)?e:ez(e,r,o,l,f,s)}function eA(e,t,n){let r=Math.min(e.x,t.x)>=n.left-.001&&Math.max(e.x,t.x)<=n.right+.001,o=Math.min(e.y,t.y)>=n.top-.001&&Math.max(e.y,t.y)<=n.bottom+.001;return .001>Math.abs(e.y-n.top)&&.001>Math.abs(t.y-n.top)&&r?"top":.001>Math.abs(e.y-n.bottom)&&.001>Math.abs(t.y-n.bottom)&&r?"bottom":.001>Math.abs(e.x-n.left)&&.001>Math.abs(t.x-n.left)&&o?"left":.001>Math.abs(e.x-n.right)&&.001>Math.abs(t.x-n.right)&&o?"right":void 0}function eP(e,t,n,r){switch(e){case"top":return G(t,n,.001)&&n.y<r.top-.001;case"bottom":return G(t,n,.001)&&n.y>r.bottom+.001;case"left":return D(t,n,.001)&&n.x<r.left-.001;case"right":return D(t,n,.001)&&n.x>r.right+.001}}function eG(e,t,n){if(e.length<3)return e;if(n){let n=eA(e[0],e[1],t);return n&&eP(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,o=eA(e[r-1],e[r],t);return o&&eP(o,e[r-1],e[r-2],t)?e.slice(0,r):e}function eD(e,t,n){let r=e;if(t){let e=eL(r,0,1);if(e){let n=eC(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=eG(r,t,!0)}if(n){let e=r.length-1,t=eL(r,e,-1);if(t){let o=eC(t,r[e],n,!0);o!==r[e]&&(r=[...r.slice(0,e),o])}r=eG(r,n,!1)}let o=eN(r,t,n);return o!==r||2===r.length?o:(t&&(r=eY(r,t,!0)),n&&(r=eY(r,n,!1)),r)}function eH(e,t){for(let n of e){let e=eI(n,t,2);if(!e)continue;let r=eD(q(e.points,.001),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let o=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=o}}function e_(e){return new Map(e.map(e=>[e.id,e]))}function ej(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}function eV(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}function eW(e){let t=1/0,n=-1/0,r=1/0,o=-1/0;for(let l of e){let e=l.x,i=l.y;if("number"!=typeof e||"number"!=typeof i)continue;let a=l.width??0,s=l.height??0;t=Math.min(t,e-a/2),n=Math.max(n,e+a/2),r=Math.min(r,i-s/2),o=Math.max(o,i+s/2)}return 1/0===t||1/0===r?null:{minX:t,maxX:n,minY:r,maxY:o}}function eU(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}function eq(e){let t=e_(e);for(let n of e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>eV(n,t)-eV(e,t))){let t=eW(e.filter(e=>e.parentId===n.id));t&&eU(n,t)}}function eJ(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,i=-1/0;for(let e of o){let n=e[t];"number"==typeof n&&(l=Math.min(l,n),i=Math.max(i,n))}if(!Number.isFinite(l)||!Number.isFinite(i))return!1;let a=(0,u.K)(e=>l+i-e,"mirror");for(let e of n){let n=e[t];"number"==typeof n&&(e[t]=a(n));let r=e.groupTitleRect;r&&(e.groupTitleRect="x"===t?{...r,left:a(r.right),right:a(r.left)}:{...r,top:a(r.bottom),bottom:a(r.top)})}for(let e of r)for(let n of e.points??[])n[t]=a(n[t]);return!0}function eQ(e){return!(e.nodes??[]).some(e=>!e.isGroup)||eJ(e,"y")}function eZ(e,t="LR"){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,i=1/0;for(let e of o){let t=e.x??0,n=e.y??0;t<l&&(l=t),n<i&&(i=n)}if(!Number.isFinite(l)||!Number.isFinite(i))return!1;let a=0,s=0;for(let e of o)a+=e.width??0,s+=e.height??0;let f=a/o.length,d=s/o.length,u=d>0?Math.max(1,f/d):1;for(let e of o){let t=e.x??0,n=((e.y??0)-i)*u+36,r=t-l;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-i)*u+36,r=e-l;t.x=n,t.y=r}eq(n);let h=n.filter(e=>e.isGroup&&!e.parentId);if(0===h.length)return"RL"===t&&eJ(e,"x"),!0;let g=e_(n),c=new Map;for(let e of n){if(e.isGroup)continue;let t=ej(e,g);if(!t)continue;let n=c.get(t)??[];n.push(e),c.set(t,n)}let p=0;for(let e of h){let t=e.padding??0;t>p&&(p=t)}let x=[],m=1/0,y=-1/0;for(let e of h){let t=eW(c.get(e.id)??[]);t&&(m=Math.min(m,t.minX),y=Math.max(y,t.maxX),x.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(1/0===m||-1/0===y)return!0;let b=Math.max(0,y-m)+2*Math.max(p,10),M=36+b,K=(m+y)/2-b/2-36,I=K+M/2,w=Math.max(p,36);x.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<x.length;e++){let t,n,r=x[e];if(t=0===e?r.contentTop-w:(x[e-1].contentBottom+r.contentTop)/2,e===x.length-1)n=r.contentBottom+w;else{let t=x[e+1];n=(r.contentBottom+t.contentTop)/2}let o=Math.max(0,n-t),l=(t+n)/2;r.lane.x=I,r.lane.y=l,r.lane.width=M,r.lane.height=o,r.lane.swimlaneContentTop=r.contentTop,r.lane.groupTitleRect={left:K,right:K+36,top:t,bottom:n}}return"RL"===t&&eJ(e,"x"),!0}(0,u.K)(F,"topLaneHorizontalPadding"),(0,u.K)(E,"assignTopLaneTitleRect"),(0,u.K)(B,"prepareLayoutForSwimlanes"),(0,u.K)(N,"toGraphView"),(0,u.K)(X,"writeBackToLayoutData"),(0,u.K)(z,"createEdgeLabelNodes"),(0,u.K)(Y,"measuredNodeRect"),(0,u.K)(A,"nodeBoundsInfoFor"),(0,u.K)(P,"samePoint"),(0,u.K)(G,"sameX"),(0,u.K)(D,"sameY"),(0,u.K)(H,"isHorizontalSegment"),(0,u.K)(_,"isVerticalSegment"),(0,u.K)(j,"overlapLength"),(0,u.K)(V,"sameAxisSegmentOverlapLength"),(0,u.K)(W,"orthogonalSegmentsForPoints"),(0,u.K)(U,"countOrthogonalBends"),(0,u.K)(q,"dedupeConsecutivePoints"),(0,u.K)(J,"classifyThreeSegmentRoute"),(0,u.K)(Q,"segmentBoundsOverlapRect"),(0,u.K)(Z,"pointInsideRect"),(0,u.K)(ee,"rectContainsRect"),(0,u.K)(et,"rectsOverlap"),(0,u.K)(en,"inflateRect"),(0,u.K)(er,"rectFromCenterSize"),(0,u.K)(eo,"rectOfNodeBounds"),(0,u.K)(el,"portForRectSide"),(0,u.K)(ei,"buildOrthogonalPortPath"),(0,u.K)(ea,"buildSameSideTrackPath"),(0,u.K)(es,"collectRealNodeBounds"),(0,u.K)(ef,"collectNodeRectEntries"),(0,u.K)(ed,"collectLayoutNodeRects"),(0,u.K)(eu,"getNodePairGeometry"),(0,u.K)(eh,"segmentHitsAnyRect"),(0,u.K)(eg,"orthogonalSegmentsCross"),(0,u.K)(ec,"sameAxisSegmentsOverlap"),(0,u.K)(ep,"segmentConflictsWithAnyEdge"),(0,u.K)(ex,"orthogonalSegmentsStrictlyCross"),(0,u.K)(em,"strictlyBetween"),(0,u.K)(ey,"isCollinearIntermediate"),(0,u.K)(eb,"simplifyPolylineOnce"),(0,u.K)(eM,"orthogonalizePolyline"),(0,u.K)(eK,"simplifyPolyline"),(0,u.K)(eI,"endpointContextFor"),(0,u.K)(ew,"segmentEnterPoint"),(0,u.K)(eS,"clipEndpoint"),(0,u.K)(ev,"clipEdgeEndpointsToNodeBoundaries"),(0,u.K)(eC,"snapEndpointToBoundary"),(0,u.K)(eL,"firstDistinctAdjacent"),(0,u.K)(e$,"cornerClearanceRange"),(0,u.K)(ek,"clampToCornerClearance"),(0,u.K)(eR,"intersectRanges"),(0,u.K)(eT,"clearanceRangeForSide"),(0,u.K)(eO,"terminalSideForSegment"),(0,u.K)(eF,"isHorizontalSide"),(0,u.K)(eE,"straightClearanceRange"),(0,u.K)(eB,"clearStraightEndpointCornerAxis"),(0,u.K)(eN,"clearStraightEndpointCornerConnections"),(0,u.K)(eX,"cornerClearedEndpoint"),(0,u.K)(ez,"moveCollinearEndpointRun"),(0,u.K)(eY,"clearEndpointCornerConnection"),(0,u.K)(eA,"borderSideForSegment"),(0,u.K)(eP,"leavesOutward"),(0,u.K)(eG,"collapseOwnBorderStub"),(0,u.K)(eD,"snapAndCollapseEndpoints"),(0,u.K)(eH,"prepareEdgeEndpointsForRenderer"),(0,u.K)(e_,"buildNodeMap"),(0,u.K)(ej,"resolveTopLevelGroupId"),(0,u.K)(eV,"groupDepth"),(0,u.K)(eW,"boundsForChildren"),(0,u.K)(eU,"applyGroupBounds"),(0,u.K)(eq,"recomputeNestedGroupBounds"),(0,u.K)(eJ,"mirrorAxis"),(0,u.K)(eQ,"applyBtDirectionTransform"),(0,u.K)(eZ,"applyLrDirectionTransform");var e0=[0,8,-8,16,-16];function e1(e,t){let{nodeInfoById:n,realNodeRects:r}=es(t);for(let t of e){let o;if(t.isLayoutOnly)continue;let l=t.points;if(!l||l.length<4)continue;let i=J(q(l,1e-6),1e-6);if(!i)continue;let{p3:a}=i,s="HVH"===i.kind,f=eu(t,n,1e-6);if(!f)continue;let{srcId:d,dstId:u,srcInfo:h,dstInfo:g,collinearX:c,collinearY:p}=f;if(c||p)continue;let x=h.rect;for(let n of e0){let l,i,f;if(s){let e=g.cy>h.cy?x.bottom:x.top,t=h.cx+n;if(t<=x.left+1e-6||t>=x.right-1e-6)continue;l={x:t,y:e},i={x:t,y:a.y},f={x:a.x,y:a.y}}else{let e=g.cx>h.cx?x.right:x.left,t=h.cy+n;if(t<=x.top+1e-6||t>=x.bottom-1e-6)continue;l={x:e,y:t},i={x:a.x,y:t},f={x:a.x,y:a.y}}let c=P(l,i,1e-6),p=P(i,f,1e-6);if(c&&p||!c&&eh(l,i,r,[d],1)||!p&&eh(i,f,r,[u],1))continue;let m=!c&&ep(l,i,e,t,{epsilon:1e-6,skipDegenerateOther:!0}),y=!p&&ep(i,f,e,t,{epsilon:1e-6,skipDegenerateOther:!0});if(!m&&!y){o=c?[i,f]:p?[l,i]:[l,i,f];break}}o&&(t.points=o)}}function e2(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values());for(let o of e){let l,i;if(o.isLayoutOnly)continue;let a=o.points;if(!a||a.length<4)continue;let s=q(a,.001);if(s.length<4)continue;let f=s.length-1,d=s[f],h=s[f-1],g=s[f-2],c=Math.hypot(d.x-h.x,d.y-h.y);if(c>=10||c<.001)continue;let p=h.x-g.x,x=h.y-g.y;if(.001>Math.hypot(p,x))continue;let m=H(h,d,.001),y=_(h,d,.001),b=H(g,h,.001),M=_(g,h,.001);if(!(m&&M||y&&b))continue;let K=o.end,I=o.start,w=K?t.get(K):void 0;if(!w)continue;let S=w.x??0,v=w.y??0,C=eo(w);if(!C)continue;if(M){let e=x<0;l={x:S,y:g.y},i={x:S,y:e?C.bottom:C.top}}else{let e=p>0;l={x:g.x,y:v},i={x:e?C.right:C.left,y:v}}if(eh(l,i,n,K?[K]:[],-2)||eh(l,i,r,[],-2))continue;if(I){let e=t.get(I),n=e?eo(e):void 0;if(n&&Z(l,n,2))continue}let L=(0,u.K)((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,"ownSegmentKey"),$=new Set;for(let e=0;e<s.length-1;e++)$.add(L(s[e],s[e+1]));let k=(0,u.K)((t,n)=>{for(let r of e){if(r===o||r.isLayoutOnly)continue;let e=r.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++){let o=e[r],l=e[r+1];if(!$.has(L(o,l))&&ex(t,n,o,l,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(k(l,i))continue;if(f-3>=0){let e=s[f-3];if(eh(e,l,n,[I,K].filter(e=>!!e),-2)||k(e,l))continue}let R=[...s.slice(0,f-2),l,i];o.points=R;let T=o.labelNodeId;if(T){let e=t.get(T);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let r,o,l=-1;for(let e=0;e<R.length-1;e++){let i=R[e],a=R[e+1],s=Math.hypot(a.x-i.x,a.y-i.y),f=D(i,a,.001),d=G(i,a,.001);(f&&s>=t+2||d&&s>=n+2)&&s>l&&(l=s,r=(i.x+a.x)/2,o=(i.y+a.y)/2)}void 0!==r&&void 0!==o&&(e.x=r,e.y=o)}}}}}(0,u.K)(e1,"portSwapToLShape"),(0,u.K)(e2,"collapseShortTerminalStub");var e6=(0,u.K)((e,t)=>G(e,t,.001)||D(e,t,.001),"orthogonallyAligned");function e5(e,t){let n=(0,u.K)((e,t)=>{let n=e.x??0,r=e.y??0,o=t.x-n,l=t.y-r,i=(e.width??0)/2,a=(e.height??0)/2;return Math.abs(l)*i>Math.abs(o)*a?(l<0&&(a=-a),{x:n+(0===l?0:a*o/l),y:r+a}):(o<0&&(i=-i),{x:n+i,y:r+(0===o?0:i*l/o)})},"rectIntersect"),r=(0,u.K)((e,r)=>{let o=q(e.points??[]);if(o.length<2)return;let l=r?e.start:e.end,i=l?t.get(l):void 0,a=i?eo(i):void 0;if(!i||!l||!a)return;let s=r?o[0]:o[o.length-1],f=r?o[1]:o[o.length-2],d=n(i,s),u=s;return(e6(f,d)&&(u=f),G(d,u,.001))?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"V",coord:d.x,min:Math.min(d.y,u.y),max:Math.max(d.y,u.y),boundary:d,railEnd:u,rect:a}:D(d,u,.001)?{edge:e,edgeId:String(e.id??""),nodeId:l,atStart:r,orientation:"H",coord:d.y,min:Math.min(d.x,u.x),max:Math.max(d.x,u.x),boundary:d,railEnd:u,rect:a}:void 0},"terminalLaneFor"),o=(0,u.K)((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),"projectedOverlapLength"),l=(0,u.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&("H"===e.orientation?(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&G(e.boundary,t.boundary,1):(1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom))&&D(e.boundary,t.boundary,1)),"sameTerminalFace"),i=(0,u.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&o(e,t)>=8&&.5>Math.abs(e.coord-t.coord),"exactTerminalLaneConflict"),a=(0,u.K)((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||"H"!==e.orientation||e.atStart===t.atStart)return!1;let n=o(e,t);if(n<8)return!1;let r=e.rect.bottom-e.rect.top;return!(n<r)&&!(n>2*r)&&l(e,t)&&16>Math.abs(e.coord-t.coord)},"nearTerminalLaneConflict"),s=(0,u.K)((e,t)=>{let n=q(e.edge.points??[]);if(n.length<2)return;let r="V"===e.orientation?{x:e.boundary.x+t,y:e.boundary.y}:{x:e.boundary.x,y:e.boundary.y+t},o="V"===e.orientation?{x:e.railEnd.x+t,y:e.railEnd.y}:{x:e.railEnd.x,y:e.railEnd.y+t};if(!(0,u.K)(()=>1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom)?D(r,e.boundary,.001)&&r.x>=e.rect.left+1&&r.x<=e.rect.right-1:!!(1>Math.abs(e.boundary.x-e.rect.left)||1>Math.abs(e.boundary.x-e.rect.right))&&G(r,e.boundary,.001)&&r.y>=e.rect.top+1&&r.y<=e.rect.bottom-1,"boundaryStaysOnSameFace")())return;if(e.atStart){let t=n.length>1&&P(n[1],e.railEnd,.001),l=n.slice(t?2:1),i=l[0];if(i&&!e6(i,o))return;return[r,o,...l]}let l=n.length>1&&P(n[n.length-2],e.railEnd,.001),i=n.slice(0,l?-2:-1),a=i[i.length-1];if(!a||e6(a,o))return[...i,o,r]},"shiftedCandidate"),f=(0,u.K)(e=>{let n=e.edge,r=q(n.points??[]);if(2!==r.length)return!1;let o=n.start,l=n.end,i=o?t.get(o):void 0,a=l?t.get(l):void 0;if(!i||!a)return!1;let s=i.x??0,f=i.y??0,d=a.x??0,u=a.y??0,[h,g]=r;return D(h,g,.001)&&1>Math.abs(f-u)&&Math.abs(s-d)>1||G(h,g,.001)&&1>Math.abs(s-d)&&Math.abs(f-u)>1},"laneIsStraightCollinearConnector"),d=[-7,7,-14,14,-21,21];for(let t=0;t<8;t++){let t=e.filter(e=>!e.isLayoutOnly).flatMap(e=>[r(e,!0),r(e,!1)]).filter(e=>!!e),n=!1;for(let e=0;e<t.length&&!n;e++)for(let o=e+1;o<t.length&&!n;o++){let l=t[e],u=t[o];if(l.edge===u.edge||!(i(l,u)||a(l,u)))continue;let h=!i(l,u);for(let e of[l,u].sort((e,t)=>{let n=f(e),r=f(t);return n!==r?Number(n)-Number(r):Number(!t.atStart)-Number(!e.atStart)})){for(let o of d){let l=s(e,o);if(!l)continue;let f=r({...e.edge,points:l},e.atStart);if(!(!f||t.some(t=>t.edge!==e.edge&&(i(f,t)||h&&a(f,t))))){e.edge.points=l,n=!0;break}}if(n)break}}if(!n)return}}function e3(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values()),o=(0,u.K)((t,o)=>{let l=t.start,i=t.end,a=W(o);if(a.length!==o.length-1)return!1;let s=[l,i].filter(e=>!!e);for(let e of a)if(eh(e.a,e.b,n,s,-2)||eh(e.a,e.b,r,[],-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of a)for(let n of W(q(e)))if(V(t,n,.5)>=8||ex(t.a,t.b,n.a,n.b,.001))return!1}}return!0},"candidateIsSafe"),l=(0,u.K)((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=e[t+4],a=H(n,r)&&_(r,o)&&H(o,l)&&_(l,i)&&G(n,l,.001)&&G(n,i,.001)&&G(r,o,.001)&&(r.x-n.x)*(l.x-o.x)<0,s=_(n,r)&&H(r,o)&&_(o,l)&&H(l,i)&&D(n,l,.001)&&D(n,i,.001)&&D(r,o,.001)&&(r.y-n.y)*(l.y-o.y)<0;if(a||s)return q([...e.slice(0,t+1),i,...e.slice(t+5)]);if(t+5>=e.length)return;let f=e[t+5],d=_(n,r)&&H(r,o)&&_(o,l)&&H(l,i)&&_(i,f)&&G(n,i,.001)&&G(n,f,.001)&&G(o,l,.001)&&(o.x-r.x)*(i.x-l.x)<0,u=H(n,r)&&_(r,o)&&H(o,l)&&_(l,i)&&H(i,f)&&D(n,i,.001)&&D(n,f,.001)&&D(o,l,.001)&&(o.y-r.y)*(i.y-l.y)<0;if(d||u)return q([...e.slice(0,t+1),f,...e.slice(t+6)])},"withoutDogleg");for(let t=0;t<8;t++){let t=!1;for(let n of e){if(n.isLayoutOnly)continue;let e=q(n.points??[]);for(let r=0;r<=e.length-5;r++){let i=l(e,r);if(i&&o(n,i)){n.points=i,t=!0;break}}if(t)break}if(!t)return}}function e8(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,u.K)((e,t,n)=>q(e===t?n??[]:e.points??[]),"pointsFor"),i=(0,u.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=W(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=W(l(o[a],e,t));for(let e of i)for(let t of r)ex(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),a=(0,u.K)(e=>{let t=W(e);if(3!==t.length)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"),s=(0,u.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);return n.filter(e=>{if(r.includes(e.id))return!1;let n=e.rect;return t.horizontal?j(t.a.x,t.b.x,n.left,n.right)>=8&&t.a.y>=n.top-2&&t.a.y<=n.bottom+2:j(t.a.y,t.b.y,n.top,n.bottom)>=8&&t.a.x>=n.left-2&&t.a.x<=n.right+2})},"blockingRectsFor"),f=(0,u.K)((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)return;r[t.index].x=n,r[t.index+1].x=n}let o=eK(q(r));return W(o).length===o.length-1?o:void 0},"candidateByMovingRail"),d=(0,u.K)((e,t,a)=>{let s=[e.start,e.end].filter(e=>!!e),f=W(t);if(f.length!==t.length-1)return!1;for(let e of f)if(eh(e.a,e.b,n,s,-2)||eh(e.a,e.b,r,[],-2))return!1;for(let t of o)if(t!==e){for(let e of f)for(let n of W(l(t)))if(V(e,n,.5)>=8)return!1}return i(e,t)<=a},"candidateIsSafe");for(let e=0;e<8;e++){let e=i(),t=!1;for(let n of o){let r=l(n),o=a(r);if(!o)continue;let i=s(n,o.segment);if(0!==i.length){for(let l of o.horizontal?[Math.min(...i.map(e=>e.rect.top))-20,Math.max(...i.map(e=>e.rect.bottom))+20]:[Math.min(...i.map(e=>e.rect.left))-20,Math.max(...i.map(e=>e.rect.right))+20]){let i=f(r,o.segment,l);if(i&&d(n,i,e)){n.points=i,t=!0;break}}if(t)break}}if(!t)return}}function e4(e,t){let n=(0,u.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&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"),r=(0,u.K)(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,r="string"==typeof t?t.toUpperCase():"";if("LR"===r||"RL"===r||"BT"===r)return;let o=n(e),l=e.y,i=e.height;if(!o||"number"!=typeof l||"number"!=typeof i||!Number.isFinite(l)||!Number.isFinite(i)||i<=0)return;let a=o.right-o.left,s=o.bottom-o.top;if(!(s<=0)&&!(a<s))return{node:e,rect:o}},"topLaneTitleFor"),o=(0,u.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&j(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),l=[...t.values()].map(r).filter(e=>!!e);if(0===l.length)return;let i=0;for(let t of e)if(!t.isLayoutOnly)for(let e of W(q(t.points??[])))for(let t of l)o(e,t.rect)&&(i=Math.max(i,t.rect.bottom-e.a.y+4));if(!(i<=.001))for(let e of l){let t=e.node.y,n=e.node.height;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.y=t-i/2,e.node.height=n+i,e.node.groupTitleRect={...e.rect,top:e.rect.top-i,bottom:e.rect.bottom-i})}}function e9(e,t){let n=(0,u.K)(e=>{let t=e.groupTitleRect;if(t&&"number"==typeof t.left&&"number"==typeof t.right&&"number"==typeof t.top&&"number"==typeof t.bottom&&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"),r=(0,u.K)(e=>{if(!e.isGroup||e.parentId||"LR"!==e.direction)return;let t=n(e),r=e.x,o=e.width;if(!t||"number"!=typeof r||"number"!=typeof o||!Number.isFinite(r)||!Number.isFinite(o)||o<=0)return;let l=t.right-t.left,i=t.bottom-t.top;if(!(l<=0)&&!(i<l))return{node:e,rect:t}},"leftLaneTitleFor"),o=(0,u.K)((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return!(n<=t.left+.001)&&!(n>=t.right-.001)&&j(e.a.y,e.b.y,t.top,t.bottom)>=8},"verticalSegmentIntersectsTitle"),l=(0,u.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<=t.top+.001)&&!(n>=t.bottom-.001)&&j(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),i=[...t.values()].map(r).filter(e=>!!e);if(0===i.length)return;let a=0;for(let t of e)if(!t.isLayoutOnly){for(let e of W(q(t.points??[])))for(let t of i)if(o(e,t.rect))a=Math.max(a,t.rect.right-e.a.x+4);else if(l(e,t.rect)){let n=Math.min(e.a.x,e.b.x);a=Math.max(a,t.rect.right-n+4)}}if(!(a<=.001))for(let e of i){let t=e.node.x,n=e.node.width;"number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n)&&!(n<=0)&&(e.node.x=t-a/2,e.node.width=n+a,e.node.groupTitleRect={...e.rect,left:e.rect.left-a,right:e.rect.right-a})}}function e7(e,t){let{realNodeRects:n}=ef(t.values()),r=e.filter(e=>!e.isLayoutOnly),o=(0,u.K)((e,t=new Map)=>q(t.get(e)??e.points??[]),"replacementPointsFor"),l=(0,u.K)((e=new Map)=>{let t=0;for(let n=0;n<r.length;n++){let l=W(o(r[n],e));for(let i=n+1;i<r.length;i++){let n=W(o(r[i],e));for(let e of l)for(let r of n)ex(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"crossingCount"),i=(0,u.K)((e=new Map)=>r.reduce((t,n)=>t+U(o(n,e)),0),"totalBends"),a=(0,u.K)(e=>{let t=o(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(H(n,r,.001)||_(n,r,.001))return{tailStart:n,terminal:r}},"terminalTailFor"),s=(0,u.K)((e,t)=>{let n,r=o(e);if(r.length<3)return;let l=r[0],i=r[1];if(H(l,i,.001))n={x:i.x,y:t.tailStart.y};else{if(!_(l,i,.001))return;n={x:t.tailStart.x,y:i.y}}let a=eK(q([l,i,n,t.tailStart,t.terminal]));return W(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),f=(0,u.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);for(let e of W(t))if(eh(e.a,e.b,n,r,-2))return!0;return!1},"pathHasNodeHit"),d=(0,u.K)((e,t,n)=>{for(let l of r)if(l!==e){for(let e of W(t))for(let t of W(o(l,n)))if(V(e,t,.5)>=8)return!0}return!1},"pathHasSharedTrack"),h=(0,u.K)((e,t,n)=>!f(e,t)&&!d(e,t,n),"candidateIsSafe"),g=(0,u.K)(()=>{let e=new Map;for(let n of r){let r=n.end;if(!r||!t.has(r)||o(n).length<4)continue;let l=e.get(r)??[];l.push(n),e.set(r,l)}return e},"edgesByDestination");for(let e=0;e<4;e++){let e,t=l();if(0===t)return;let n=i(),r=t,o=n;for(let n of g().values())for(let f=0;f<n.length;f++)for(let d=f+1;d<n.length;d++){let u=n[f],g=n[d],c=a(u),p=a(g);if(!c||!p)continue;let x=s(u,p),m=s(g,c);if(!x||!m)continue;let y=new Map([[u,x],[g,m]]);if(!h(u,x,y)||!h(g,m,y))continue;let b=l(y),M=i(y);!(b>=t)&&(b>r||b===r&&M>=o||(e=y,r=b,o=M))}if(!e)return;for(let[t,n]of e)t.points=n}}function te(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,u.K)((e,t=new Map)=>q(t.get(e)??e.points??[]),"replacementPointsFor"),i=(0,u.K)((e=new Map)=>{let t=0;for(let n=0;n<o.length;n++){let r=W(l(o[n],e));for(let i=n+1;i<o.length;i++){let n=W(l(o[i],e));for(let e of r)for(let r of n)ex(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"strictCrossingCount"),a=(0,u.K)((e=new Map)=>o.reduce((t,n)=>t+U(l(n,e)),0),"totalBends"),s=(0,u.K)(e=>{let n=e.start,r=e.end,o=n?t.get(n):void 0,l=r?t.get(r):void 0,i=o?eo(o):void 0,a=l?eo(l):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),f=(0,u.K)((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=s(e);if(r){if(n.vertical){let o=n.a.x,l=Math.min(r.src.left,r.dst.left),i=Math.max(r.src.right,r.dst.right),a=o<l-.001?"left":o>i+.001?"right":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"vertical",side:a,coord:o,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){let o=n.a.y,l=Math.min(r.src.top,r.dst.top),i=Math.max(r.src.bottom,r.dst.bottom),a=o<l-.001?"top":o>i+.001?"bottom":void 0;if(!a)return;return{edge:e,points:t,segmentIndex:n.index,axis:"horizontal",side:a,coord:o,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),d=(0,u.K)(()=>{let e=[];for(let t of o){let n=l(t);for(let r of W(n)){let o=f(t,n,r);o&&e.push(o)}}return e},"collectExternalRails"),h=(0,u.K)((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&j(e.min,e.max,t.min,t.max)>=8,"railsInteract"),g=(0,u.K)(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let o=[r],l=[];for(n.add(r);o.length>0;){let t=o.pop();for(let r of(l.push(t),e))!n.has(r)&&h(t,r)&&(n.add(r),o.push(r))}l.length>1&&t.push(l)}return t},"connectedComponents"),c=(0,u.K)(e=>{let t=[];for(let n of e)t.some(e=>.001>Math.abs(e-n.coord))||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),o=e[0].side;t.push("left"===o||"top"===o?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},"uniqueCoordsFor"),p=(0,u.K)(e=>{let t=e.map(e=>e.coord),n=c(e),r=[];if(e.length<=6){let o=Array(n.length).fill(!1),l=[],i=(0,u.K)(()=>{if(l.length===e.length){l.some((e,n)=>Math.abs(e-t[n])>=.001)&&r.push([...l]);return}for(let[e,t]of n.entries())o[e]||(o[e]=!0,l.push(t),i(),l.pop(),o[e]=!1)},"visit");return i(),r}for(let e=0;e<t.length;e++)for(let n=e+1;n<t.length;n++){let o=[...t];[o[e],o[n]]=[o[n],o[e]],r.push(o)}return r},"coordinateAssignmentsFor"),x=(0,u.K)((e,t)=>{let n=new Map;for(let[r,o]of e.entries()){let e=t[r],l=n.get(o.edge)??o.points.map(e=>({x:e.x,y:e.y}));"vertical"===o.axis?(l[o.segmentIndex].x=e,l[o.segmentIndex+1].x=e):(l[o.segmentIndex].y=e,l[o.segmentIndex+1].y=e),n.set(o.edge,l)}let r=new Map;for(let[e,t]of n){let n=eK(q(t));if(W(n).length!==n.length-1)return;r.set(e,n)}return r},"replacementsForAssignment"),m=(0,u.K)(e=>{for(let[t,o]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of W(o))if(eh(t.a,t.b,n,e,-2)||eh(t.a,t.b,r,[],-2))return!1}for(let t=0;t<o.length;t++){let n=o[t],r=e.has(n),i=W(l(n,e));for(let n=t+1;n<o.length;n++){let t=o[n];if(!r&&!e.has(t))continue;let a=W(l(t,e));for(let e of i)for(let t of a)if(V(e,t,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let e=0;e<4;e++){let e,t=i();if(0===t)return;let n=t,r=a(),o=1/0;for(let l of g(d()))for(let s of p(l)){let f=x(l,s);if(!f||!m(f))continue;let d=i(f);if(d>=t)continue;let u=a(f),h=l.reduce((e,t,n)=>e+Math.abs(s[n]-t.coord),0);d>n||d===n&&(u>r||u===r&&h>=o)||(e=f,n=d,r=u,o=h)}if(!e)return;for(let[t,n]of e)t.points=n}}function tt(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,u.K)((e,t,n)=>q(e===t?n??[]:e.points??[]),"pointsFor"),i=(0,u.K)(e=>W(e).reduce((e,t)=>e+Math.hypot(t.a.x-t.b.x,t.a.y-t.b.y),0),"pathLength"),a=(0,u.K)((e,t)=>{let n=0;for(let r=0;r<o.length;r++){let i=W(l(o[r],e,t));for(let a=r+1;a<o.length;a++){let r=W(l(o[a],e,t));for(let e of i)for(let t of r)ex(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),s=(0,u.K)((e,t)=>{if(e.horizontal){let n=e.a.y;return(1>Math.abs(n-t.top)||1>Math.abs(n-t.bottom))&&j(e.a.x,e.b.x,t.left,t.right)>=8}if(e.vertical){let n=e.a.x;return(1>Math.abs(n-t.left)||1>Math.abs(n-t.right))&&j(e.a.y,e.b.y,t.top,t.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),f=(0,u.K)(e=>{let n=[e.start,e.end].filter(e=>!!e),r=[];for(let e of n){let n=t.get(e),o=n?eo(n):void 0;o&&r.push(o)}return r},"endpointRectsFor"),d=(0,u.K)((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],o=e[t+2],l=e[t+3],i=H(n,r,.001)&&_(r,o,.001)&&H(o,l,.001),a=_(n,r,.001)&&H(r,o,.001)&&_(o,l,.001);if(!i&&!a||!(i?Math.sign(r.x-n.x)!==Math.sign(l.x-o.x):Math.sign(r.y-n.y)!==Math.sign(l.y-o.y)))return[];let s=G(n,l,.001)||D(n,l,.001)?[]:[{x:n.x,y:l.y},{x:l.x,y:n.y}],f=0===s.length?[[...e.slice(0,t+1),...e.slice(t+3)]]:s.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),d=new Set;return f.map(e=>eK(q(e))).filter(e=>{if(W(e).length!==e.length-1||!e.some(e=>P(e,l,.001)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!d.has(t)&&(d.add(t),!0)})},"shortcutCandidatesAt"),h=(0,u.K)((e,t,i)=>{let d=[e.start,e.end].filter(e=>!!e),u=f(e);for(let e of W(t))if(eh(e.a,e.b,n,d,-2)||eh(e.a,e.b,r,[],-2)||u.some(t=>s(e,t)))return!1;for(let n of o)if(n!==e){for(let e of W(t))for(let t of W(l(n)))if(V(e,t,.5)>=8)return!1}return a(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e,t,n=a(),r=n,s=1/0,f=1/0;for(let u of o){let o=l(u),g=U(o,.001),c=i(o);for(let l=0;l<=o.length-4;l++)for(let p of d(o,l)){let o=U(p,.001),l=i(p);if(!(o<g||o===g&&l<c-.001)||!h(u,p,n))continue;let d=a(u,p);d>r||d===r&&(o>s||o===s&&l>=f)||(e=u,t=p,r=d,s=o,f=l)}}if(!e||!t)return;e.points=t}}function tn(e,t){let n=[];for(let e of t.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,r=e.y??0,o=eo(e);o&&n.push({id:String(e.id??""),cx:t,cy:r,rect:o})}if(0===n.length)return;let r=new Map(n.map(e=>[e.id,e])),o=n.map(e=>({id:e.id,rect:e.rect})),l=["top","bottom","left","right"],i={top:Math.min(...n.map(e=>e.rect.top))-20,bottom:Math.max(...n.map(e=>e.rect.bottom))+20,left:Math.min(...n.map(e=>e.rect.left))-20,right:Math.max(...n.map(e=>e.rect.right))+20},a=e.filter(e=>!e.isLayoutOnly),s=new Map(a.map((e,t)=>[e,t])),f=(0,u.K)(e=>{let t="left"===e||"top"===e?-1:1,n=[];for(let r=0;r<=2;r++)n.push(i[e]+20*t*r);return n},"outwardTracksForSide"),d=(0,u.K)((e,t=new Map)=>q(t.get(e)??e.points??[]),"replacementPointsFor"),h=(0,u.K)((e,t)=>{let n=0;for(let r of e)for(let e of t)ex(r.a,r.b,e.a,e.b,.001)&&n++;return n},"crossingCountBetweenSegments"),g=(0,u.K)((e,t)=>h(W(e),W(t)),"crossingCountBetweenPaths"),c=(0,u.K)((e=new Map)=>{let t=0,n=[],r=new Set,o=[],l=(0,u.K)(e=>{r.has(e)||(r.add(e),o.push(e))},"addEdge");for(let r=0;r<a.length;r++){let o=a[r],i=d(o,e);for(let s=r+1;s<a.length;s++){let r=a[s],f=g(i,d(r,e));f>0&&(t+=f,n.push({first:o,second:r,count:f}),l(o),l(r))}}return o.sort((e,t)=>(s.get(e)??0)-(s.get(t)??0)),{count:t,pairs:n,edgeSet:r,edges:o}},"crossingSnapshot"),p=(0,u.K)((e,t)=>{let n=new Set(t.keys());if(0===n.size)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let o=0;for(let e=0;e<a.length;e++){let r=a[e],l=n.has(r),i=d(r,t);for(let r=e+1;r<a.length;r++){let e=a[r];(l||n.has(e))&&(o+=g(i,d(e,t)))}}return e.count-r+o},"crossingCountWithReplacements"),x=(0,u.K)(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 o of e.edges){if(r.has(o))continue;let e=[o],l=[];for(r.add(o);e.length>0;){let n=e.pop();for(let o of(l.push(n),t.get(n)??[]))r.has(o)||(r.add(o),e.push(o))}l.sort((e,t)=>(s.get(e)??0)-(s.get(t)??0)),l.length>1&&n.push(l)}return n},"crossingComponents"),m=(0,u.K)(e=>[e.start,e.end].filter(e=>!!e),"endpointIdsFor"),y=(0,u.K)(e=>{let t=[];for(let n of x(e)){let e=new Set(n),r=new Set(n.flatMap(e=>m(e))),o=[...n];for(let t of a)!e.has(t)&&m(t).some(e=>r.has(e))&&o.push(t);o.sort((e,t)=>(s.get(e)??0)-(s.get(t)??0)),t.push(o)}return t},"pairSearchGroups"),b=(0,u.K)((e,t,n)=>p(e,new Map([[t,n]])),"crossingCountWithSingleReplacement"),M=(0,u.K)(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"),K=(0,u.K)(e=>e.slice(1).reduce((t,n,r)=>{let o=e[r];return t+Math.abs(n.x-o.x)+Math.abs(n.y-o.y)},0),"pathLength"),I=(0,u.K)((e=new Map)=>a.reduce((t,n)=>t+U(d(n,e)),0),"totalBends"),w=(0,u.K)((e=new Map)=>a.reduce((t,n)=>t+K(d(n,e)),0),"totalLength"),S=(0,u.K)((e,t,n=new Map)=>{let r=W(t);for(let t of a)if(t!==e){for(let e of r)for(let r of W(d(t,n)))if(V(e,r,.5)>=8)return!0}return!1},"pathHasSegmentConflict"),v=(0,u.K)((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of W(t))if(eh(e.a,e.b,o,n,-2))return!0;return!1},"pathHitsNode"),C=(0,u.K)((e,t)=>{let n=eK(q(t));W(n).length===n.length-1&&e.push(n)},"pushOrthogonalCandidate"),L=(0,u.K)(e=>"left"===e||"right"===e,"sideIsHorizontal"),$=(0,u.K)((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=(0,u.K)((e,t,n,r)=>{let o="left"===n||"top"===n?-1:1;for(let l of[$(t,n,r),i[n]])for(let i=0;i<=2;i++)C(e,ea(t,n,r,l+20*o*i))},"addSameSideCandidates"),R=(0,u.K)((e,t,n,r,o)=>{for(let l of f(n))for(let n of f(o))C(e,[t,{x:l,y:t.y},{x:l,y:n},{x:r.x,y:n},r])},"addHorizontalToVerticalCandidates"),T=(0,u.K)((e,t,n,r,o)=>{for(let l of f(n))for(let n of f(o))C(e,[t,{x:t.x,y:l},{x:n,y:l},{x:n,y:r.y},r])},"addVerticalToHorizontalCandidates"),O=(0,u.K)((e,t,n,r,o)=>{let l=[...f("top"),...f("bottom")];for(let i of f(n))for(let n of f(o))for(let o of l)C(e,[t,{x:i,y:t.y},{x:i,y:o},{x:n,y:o},{x:n,y:r.y},r])},"addHorizontalPairCandidates"),F=(0,u.K)((e,t,n,r,o)=>{let l=[...f("left"),...f("right")];for(let i of f(n))for(let n of f(o))for(let o of l)C(e,[t,{x:t.x,y:i},{x:o,y:i},{x:o,y:n},{x:r.x,y:n},r])},"addVerticalPairCandidates"),E=(0,u.K)(e=>{let t=new Set;return e.map(e=>q(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!t.has(n)&&!(e.length<2)&&(t.add(n),!0)})},"dedupeCandidatePaths"),B=(0,u.K)((e,t,n,r)=>{let o=[],l=ei(e,t,n,r,20,.001);l&&C(o,l),t===r&&k(o,e,t,n);let i=L(t),a=L(r);return i&&!a?R(o,e,t,n,r):!i&&a?T(o,e,t,n,r):i?O(o,e,t,n,r):F(o,e,t,n,r),E(o)},"buildCandidatesForSides"),N=(0,u.K)((e,t,n,r)=>{let o=[...f("left"),...f("right")],i=[...f("top"),...f("bottom")];for(let a of l){let l=el(r,a),s="top"===a||"bottom"===a?f(a):i;for(let r of o)for(let o of(C(e,[t,n,{x:r,y:n.y},{x:r,y:l.y},l]),s))C(e,[t,n,{x:r,y:n.y},{x:r,y:o},{x:l.x,y:o},l])}},"addVerticalDepartureOuterTrackCandidates"),X=(0,u.K)((e,t,n,r)=>{let o=[...f("left"),...f("right")],i=[...f("top"),...f("bottom")];for(let a of l){let l=el(r,a),s="left"===a||"right"===a?f(a):o;for(let r of i)for(let o of(C(e,[t,n,{x:n.x,y:r},{x:l.x,y:r},l]),s))C(e,[t,n,{x:n.x,y:r},{x:o,y:r},{x:o,y:l.y},l])}},"addHorizontalDepartureOuterTrackCandidates"),z=(0,u.K)(e=>{let t=e.start,n=e.end,o=n?r.get(n):void 0;if(!t||!o)return[];let l=q(e.points??[]);if(l.length<4)return[];let i=l[0],a=l[1],s=[];return _(i,a,.001)?N(s,i,a,o):H(i,a,.001)&&X(s,i,a,o),s},"terminalPreservingOuterTrackCandidates"),Y=(0,u.K)(e=>{let t=e.start,n=e.end,o=t?r.get(t):void 0,i=n?r.get(n):void 0;if(!o||!i)return[];let a=[];for(let e of l){let t=el(o,e);for(let n of l)a.push(...B(t,e,el(i,n),n))}return a.push(...z(e)),a},"candidatePathsFor"),A=(0,u.K)(()=>new Map(a.map(e=>[e,W(d(e))])),"currentSegmentsByEdge"),P=(0,u.K)((e,t,n)=>{let r=new Set;for(let o of a){if(o===e)continue;let l=n.get(o)??W(d(o));t.some(e=>l.some(t=>V(e,t,.5)>=8))&&r.add(o)}return r},"sharedTrackConflictsFor"),G=(0,u.K)((e,t,n,r)=>{let o=new Set;return Y(e).map(e=>eK(q(e))).filter(t=>{if(v(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join("|");return!o.has(n)&&!(t.length<2)&&(o.add(n),!0)}).map(o=>{let l=W(o),i=0;for(let t of a)t!==e&&(i+=h(l,n.get(t)??W(d(t))));return{candidate:o,candidateSegments:l,crossings:t.count-(r.get(e)??0)+i,bends:U(o,.001),totalBends:U(o),length:K(o)}}).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:P(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},"pairCandidatesFor"),D=(0,u.K)((e,t,n,r,o,l)=>{let i=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(i+=n.count);let s=h(n.segments,o.segments);for(let e of a){if(e===t||e===r)continue;let i=l.get(e)??W(d(e));s+=h(n.segments,i)+h(o.segments,i)}return e.count-i+s},"pairCrossingCount"),j=(0,u.K)((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},"conflictsOnlyWith"),J=(0,u.K)((e,t)=>e.segments.some(e=>t.segments.some(t=>V(e,t,.5)>=8)),"candidatesShareTrack"),Q=(0,u.K)((e,t,n,r)=>j(t,n.edge)&&j(r,e.edge)&&!J(t,r),"pairCandidatesAreCompatible"),Z=(0,u.K)((e,t,n,r,o)=>{let l=D(e.current,t.edge,n,r.edge,o,e.baseSegments);if(!(l>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,o.path]]),crossings:l,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+o.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+o.length}},"scorePairReplacement"),ee=(0,u.K)((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),"pairScoreIsBetter"),et=(0,u.K)((e,t,n,r)=>{let o=r;for(let r of t.candidates)for(let l of n.candidates){if(!Q(t,r,n,l))continue;let i=Z(e,t,r,n,l);i&&ee(i,o)&&(o=i)}return o},"bestScoreForOptionPair"),en=(0,u.K)(e=>{let t=I(),n=w(),r=A(),o=M(e),l=new Map(a.map(e=>[e,U(d(e))])),i=new Map(a.map(e=>[e,K(d(e))])),s=new Map,f=y(e);for(let t of f)for(let n of t){if(s.has(n))continue;let t=G(n,e,r,o);t.length>0&&s.set(n,{edge:n,candidates:t})}let u={replacements:new Map,crossings:e.count,bends:t,length:n},h={current:e,currentBends:t,currentLength:n,baseBendsByEdge:l,baseLengthByEdge:i,baseSegments:r};for(let t of f){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 o=e+1;o<r.length;o++){let e=r[o];(n.has(t.edge)||n.has(e.edge))&&(u=et(h,t,e,u))}}}return u.replacements.size>0?u.replacements:void 0},"bestPairedReplacement");for(let e=0;e<4;e++){let e,t,n=c(),r=n.count;if(0===r)return;let o=r,l=1/0;for(let i of n.edges){let a=U(d(i),.001);for(let s of Y(i)){let f=v(i,s),d=!f&&S(i,s),u=b(n,i,s),h=U(s,.001);!f&&!d&&(u<r||u===r&&h<a)&&(u>o||u===o&&h>=l||(e=i,t=s,o=u,l=h))}}if(e&&t){e.points=t;continue}let i=en(n);if(!i)return;for(let[e,t]of i)e.points=t}}function tr(e,t){let{nodeInfoById:n,realNodeRects:r}=es(t),o=["top","bottom","left","right"],l={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},i=(0,u.K)((e,t,n,r)=>{let o=[],i=ei(e,t,n,r,20,.001);return i&&o.push(i),t===r&&o.push(ea(e,t,n,l[t])),o},"buildOrthogonalPathCandidates"),a=(0,u.K)((e,t)=>{for(let n=0;n<e.length-1;n++)if(eh(e[n],e[n+1],r,t,1))return!0;return!1},"pathHitsNode"),s=(0,u.K)((t,n,r=!1)=>{let o=0,l=W(t,.001),i=n.start,a=n.end;for(let t of e){if(t===n||t.isLayoutOnly)continue;let e=t.start,s=t.end;if(!r&&i&&a&&(e===i||e===a||s===i||s===a))continue;let f=t.points;if(f&&!(f.length<2))for(let e of l)for(let t of W(f,.001)){if(eg(e.a,e.b,t.a,t.b,.001,.001)){o++;continue}V(e,t,.001)>=8&&o++}}return o},"pathConflictCount"),f=(0,u.K)((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),o=Math.abs(e.x-t.rect.left),l=Math.abs(e.x-t.rect.right),i="top",a=n;return r<a&&(i="bottom",a=r),o<a&&(i="left",a=o),l<a&&(i="right",a=l),i},"nearestSideOfRect"),d=new Map,h=(0,u.K)((e,t,n)=>{let r=d.get(e)??[];r.push({side:t,edgeId:n}),d.set(e,r)},"addFaceClaim");for(let t of e){if(t.isLayoutOnly)continue;let e=t.points??[];if(e.length<1)continue;let r=t.id??"",o=t.start,l=t.end;if(o){let t=n.get(o);t&&h(o,f(e[0],t),r)}if(l){let t=n.get(l);t&&h(l,f(e[e.length-1],t),r)}}let g=(0,u.K)((e,t,n)=>d.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,"faceIsClaimed");for(let t of e){let e;if(t.isLayoutOnly)continue;let r=t.points;if(!r||r.length<2)continue;let l=U(r,.001);if(l<4)continue;let u=t.start,c=t.end;if(!u||!c)continue;let p=n.get(u),x=n.get(c);if(!p||!x)continue;let m=t.id??"",y=s(r,t,!0),b=s(r,t),M=y,K=l;for(let n of o){if(g(u,n,m))continue;let r=el(p,n);for(let l of o)if(!g(c,l,m))for(let o of i(r,n,el(x,l),l)){if(a(o,[u,c]))continue;let n=U(o,.001);if(y>0){let r=s(o,t,!0);if(r>M||r===M&&n>=K)continue;M=r,K=n,e=o;continue}!(s(o,t)>b)&&n<K&&(K=n,e=o)}}if(e){t.points=e;let n=d.get(u);n&&d.set(u,n.filter(e=>e.edgeId!==m));let r=d.get(c);r&&d.set(c,r.filter(e=>e.edgeId!==m)),h(u,f(e[0],p),m),h(c,f(e[e.length-1],x),m)}}}function to(e,t){let n=t?0:e.length-1,r=e[n],o=e[n+(t?1:-1)];if(!r||!o)return;let l=o.x-r.x,i=o.y-r.y;if(!(Math.abs(l)+Math.abs(i)<.001)){if(.001>=Math.abs(i)){let e=r.x+10*Math.sign(l);return{left:Math.min(r.x,e),right:Math.max(r.x,e),top:r.y-7,bottom:r.y+7}}if(.001>=Math.abs(l)){let e=r.y+10*Math.sign(i);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,e),bottom:Math.max(r.y,e)}}return{left:Math.min(r.x,o.x),right:Math.max(r.x,o.x),top:Math.min(r.y,o.y),bottom:Math.max(r.y,o.y)}}}function tl(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)}}function ti(e,t){let n=q(t);return[to(n,!0),to(n,!1)].some(t=>t&&et(e,tl(t)))}function ta(e,t){let n=[];for(let t of e){if(t.isLayoutOnly)continue;let e=t.points;if(e&&!(e.length<2))for(let r=0;r<e.length-1;r++)n.push({edgeId:t.id,p1:e[r],p2:e[r+1]})}let r=[],o=[];for(let e of t.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=eo(e);t&&o.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let l=eo(e);l&&r.push({nodeId:e.id,rect:l})}let l=(0,u.K)((e,t)=>{let n=en(t,3);for(let{nodeId:t,rect:o}of r)if(t!==e&&et(n,o))return!0;return!1},"labelOverlapsForeignNode"),i=(0,u.K)((e,t)=>{let r=en(t,3);for(let t of n)if(t.edgeId!==e&&Q(t.p1,t.p2,r))return!0;return!1},"labelOverlapsForeignEdge"),a=(0,u.K)((e,t,n)=>l(e,n)||i(t,n),"labelOverlapsAnything"),s=[],f=(0,u.K)(e=>{for(let{id:t,rect:n}of o)if(ee(n,e))return t},"findContainingLane"),d=(0,u.K)((e,t)=>s.some(n=>n.labelId!==e&&et(t,n.rect)),"overlapsPlacedLabel");for(let n of e){if(n.isLayoutOnly)continue;let e=n.labelNodeId;if(!e)continue;let r=t.get(e);if(!r)continue;let h=n.points;if(!h||h.length<2)continue;let g=r.width??0,c=r.height??0;if(g<=0||c<=0)continue;let p=[];for(let e=0;e<h.length-1;e++){let t=h[e],n=h[e+1],r=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);(!(r<.001)||!(o<.001))&&(r>=.001&&o>=.001||p.push({idx:e,length:r+o,orientation:r>=.001?"horizontal":"vertical",midX:(t.x+n.x)/2,midY:(t.y+n.y)/2}))}if(0===p.length)continue;let x=p.length>=3?p.filter(e=>e.idx>0&&e.idx<p.length-1):p,m=x.length>0?x:p,y=g>=c?"horizontal":"vertical",b=(0,u.K)(e=>[...e].sort((e,t)=>{let n=e.orientation===y;if(n!==(t.orientation===y))return n?-1:1;let r=e.length>=("horizontal"===e.orientation?g:c)+2;return r!==t.length>=("horizontal"===t.orientation?g:c)+2?r?-1:1:t.length-e.length}),"rankSegments"),M=p[0],K=p[p.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=(0,u.K)((e,t)=>{let n=h[e.idx],r=h[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},"anchorAtT"),S=(0,u.K)((e,t,n)=>Math.min(n,Math.max(t,e)),"clamp"),v=(0,u.K)((e,t)=>e.midX>=t.left-.001&&e.midX<=t.right+.001&&e.midY>=t.top-.001&&e.midY<=t.bottom+.001,"pointInsideRectInclusive"),C=(0,u.K)(e=>{let t=er(e.midX,e.midY,g,c),n=f(t);if(n)return{laneId:n,anchor:e,rect:t};let r=o.find(({rect:t})=>v(e,t));if(!r)return;let l=r.rect.left+g/2+1,i=r.rect.right-g/2-1,a=r.rect.top+c/2+1,s=r.rect.bottom-c/2-1;if(l>i||a>s)return;let d={midX:S(e.midX,l,i),midY:S(e.midY,a,s)},u=er(d.midX,d.midY,g,c);return v(e,u)?{laneId:r.id,anchor:d,rect:u}:void 0},"placementForAnchor"),L=(0,u.K)((e,t,n)=>"horizontal"===e.orientation?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),"distanceAlongSegment"),$=(0,u.K)((e,t)=>{let n=("horizontal"===e.orientation?g/2:c/2)+12;if(e===M){let r=h[e.idx];if(L(e,t,r)+.001<n)return!1}if(e===K){let r=h[e.idx+1];if(L(e,t,r)+.001<n)return!1}return!0},"labelClearsTerminalEndpoints"),k=(0,u.K)(t=>{for(let r of b(t))for(let t of I){let o=w(r,t);if(!$(r,o))continue;let l=C(o);if(!(!l||ti(l.rect,h))&&!d(e,l.rect)&&!a(e,n.id,l.rect))return{laneId:l.laneId,anchor:l.anchor}}},"tryPool"),R=(0,u.K)((t,r,o=!1)=>{for(let a of b(t)){let t={midX:a.midX,midY:a.midY};if(r&&!$(a,t))continue;let s=C(t);if(s&&!ti(s.rect,h)&&!d(e,s.rect)&&!l(e,s.rect)&&(o||!i(n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"findLaneContainingFallback"),T=k(m)??(m.length<p.length?k(p):void 0)??R(p,!0)??R(p,!1)??R(p,!1,!0);if(T){r.x=T.anchor.midX,r.y=T.anchor.midY,r.parentId=T.laneId;let t=er(T.anchor.midX,T.anchor.midY,g,c),n=s.findIndex(t=>t.labelId===e);n>=0?s[n]={labelId:e,rect:t}:s.push({labelId:e,rect:t})}}}(0,u.K)(e5,"separateSharedRenderedTerminalLanes"),(0,u.K)(e3,"collapseRedundantRectangularDoglegs"),(0,u.K)(e8,"liftObstacleHuggingSameSideRails"),(0,u.K)(e4,"liftTopLaneTitleBandsAboveRails"),(0,u.K)(e9,"shiftLeftLaneTitleBandsLeftOfRails"),(0,u.K)(e7,"swapDestinationTerminalTailsToReduceCrossings"),(0,u.K)(te,"reassignCrossingExternalRailChannels"),(0,u.K)(tt,"shortcutRedundantOrthogonalJogs"),(0,u.K)(tn,"resolveRenderedOrthogonalCrossings"),(0,u.K)(tr,"simplifyDetouredEdges"),(0,u.K)(to,"markerClearanceRectFor"),(0,u.K)(tl,"normalizeRect"),(0,u.K)(ti,"labelOverlapsOwnMarker"),(0,u.K)(ta,"anchorLabelsToPolyline");function ts(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function tf(e,t){let{nodeInfoById:n,realNodeRects:r}=es(t),o=new Map;for(let e of t){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){o.set(t,{w:e.width??0,h:e.height??0});continue}}let l=(0,u.K)((t,n,r,l)=>{let i=ts(n,r),a=0,s=(0,u.K)(e=>{if(!e)return;let t=o.get(e);if(!t)return;let n="x"===l?t.w/2:t.h/2;n>a&&(a=n)},"consider");for(let n of(s(t.labelNodeId),e)){if(n===t||n.isLayoutOnly)continue;let e=n.start,r=n.end;e&&r&&ts(e,r)===i&&s(n.labelNodeId)}return a>0?a+3:0},"labelClearanceFor");for(let t of e){let o,i;if(t.isLayoutOnly||!J(t.points,1e-6))continue;let a=eu(t,n,1e-6);if(!a)continue;let{srcId:s,dstId:f,srcInfo:d,dstInfo:u,collinearX:h,collinearY:g}=a;if(h===g)continue;if(h){let e=u.cy>d.cy;o={x:d.cx,y:e?d.rect.bottom:d.rect.top},i={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>d.cx;o={x:e?d.rect.right:d.rect.left,y:d.cy},i={x:e?u.rect.left:u.rect.right,y:u.cy}}if(eh(o,i,r,[s,f],1))continue;let c=l(t,s,f,h?"x":"y"),p=c>4?c:4;for(let n of[0,p,-p]){let l={...o},a={...i};if(h){if(l.x+=n,a.x+=n,l.x<=d.rect.left||l.x>=d.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(l.y+=n,a.y+=n,l.y<=d.rect.top||l.y>=d.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!eh(l,a,r,[s,f],1)&&!ep(l,a,e,t,{epsilon:1e-6})){t.points=[l,a];break}}}}function td(e,t){let{realNodeRects:n,labelNodeRects:r}=ef(t.values()),o=(0,u.K)((e,t)=>W(t,.001).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),"segmentsFor"),l=(0,u.K)(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;e&&!(e.length<2)&&t.push(...o(n,q(e)))}return t},"allSegments"),i=(0,u.K)((e,t)=>e.horizontal&&t.horizontal?j(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&7>Math.abs(e.a.y-t.a.y):!!e.vertical&&!!t.vertical&&j(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&7>Math.abs(e.a.x-t.a.x),"hasCrowdedParallelTrack"),a=(0,u.K)((t,l)=>{let a=t.start,s=t.end,f=o(t,l);if(f.length!==l.length-1)return!1;let d=[a,s].filter(e=>!!e),u=t.labelNodeId?[t.labelNodeId]:[];for(let e of f)if(eh(e.a,e.b,n,d,-2)||eh(e.a,e.b,r,u,-2))return!1;for(let n of e){if(n===t||n.isLayoutOnly)continue;let e=n.points;if(e&&!(e.length<2)){for(let t of f)for(let r of o(n,q(e)))if(i(t,r)||ex(t.a,t.b,r.a,r.b,.001))return!1}}return!0},"candidateIsSafe"),s=(0,u.K)((e,t)=>{let n=q(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)return;r[e.index].x+=t,r[e.index+1].x+=t}return o(e.edge,r).length===r.length-1?r:void 0},"shiftedCandidate"),f=(0,u.K)((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),"nodeCenter"),d=(0,u.K)(e=>{let n=e.edge,r=q(n.points??[]);if(4!==r.length||1!==e.index)return;let o=n.start?t.get(n.start):void 0,l=n.end?t.get(n.end):void 0,i=o?eo(o):void 0,a=l?eo(l):void 0,s=r.slice(e.index+2);if(o&&l&&i&&a&&0!==s.length)return{sourceCenter:f(o,i),targetCenter:f(l,a),sourceRect:i,tail:s}},"sourceDetourContextFor"),h=(0,u.K)((e,t,n,r,o,l)=>{let i=r.y>=n.y,a=i?o.bottom:o.top,s=a+(i?20:-20);if(i&&e.b.y<=s+.001||!i&&e.b.y>=s-.001)return;let f=e.a.x+t;return q([{x:n.x,y:a},{x:n.x,y:s},{x:f,y:s},{x:f,y:e.b.y},...l],.001)},"verticalSourceDetour"),g=(0,u.K)((e,t,n,r,o,l)=>{let i=r.x>=n.x,a=i?o.right:o.left,s=a+(i?20:-20);if(i&&e.b.x<=s+.001||!i&&e.b.x>=s-.001)return;let f=e.a.y+t;return q([{x:a,y:n.y},{x:s,y:n.y},{x:s,y:f},{x:e.b.x,y:f},...l],.001)},"horizontalSourceDetour"),c=(0,u.K)((e,t)=>{let n=d(e);if(n){if(e.vertical)return h(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return g(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},"sourceDetourCandidate"),p=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=l(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let o=e[n],l=e[r];if(o.edge!==l.edge&&i(o,l))for(let e of[o,l].filter(e=>e.interior)){for(let n of p){let r=s(e,n);if(r&&a(e.edge,r)){e.edge.points=r,t=!0;break}let o=c(e,n);if(o&&a(e.edge,o)){e.edge.points=o,t=!0;break}}if(t)break}}if(!t)return}}function tu(e,t,n,r){let o=t.x-e.x,l=t.y-e.y,i=r.x-n.x,a=r.y-n.y,s=o*a-l*i;if(1e-10>Math.abs(s))return!1;let f=n.x-e.x,d=n.y-e.y,u=(f*a-d*i)/s,h=(f*l-d*o)/s;return u>.01&&u<.99&&h>.01&&h<.99}function th(e){let t=e.nodes??[],n=e.edges??[],r=[];if(!n.length||!t.length)return r;let o=ed(t),l=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,i=e.end,a=e.labelNodeId,s=e.id??`${n}->${i}`;for(let e of o)if(e.nodeId!==n&&e.nodeId!==i&&(!a||e.nodeId!==a)){for(let n=0;n<t.length-1;n++)if(Q(t[n],t[n+1],e,-1)){r.push({type:"edge-node-overlap",edgeId:s,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)l.push({edgeId:s,start:n,end:i,p1:t[e],p2:t[e+1]})}let i=new Set;for(let e=0;e<l.length;e++)for(let t=e+1;t<l.length;t++){let n=l[e],o=l[t];if(n.edgeId!==o.edgeId&&n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&tu(n.p1,n.p2,o.p1,o.p2)){let e=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;i.has(e)||(i.add(e),r.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:o.edgeId,detail:`edges "${n.edgeId}" and "${o.edgeId}" cross`}))}}if(r.length>0){let e=r.filter(e=>"edge-node-overlap"===e.type).length,t=r.filter(e=>"edge-edge-crossing"===e.type).length;for(let n of(d.R.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`),r))d.R.warn(`[SWIMLANE_VALIDATE] ${n.type}: ${n.detail}`)}return r}function tg(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup);if(("LR"===t||"RL"===t)&&o.length>0&&!eZ(e,t)||"BT"===t&&o.length>0&&!eQ(e))return;for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;t&&!(t.length<2)&&(e.points=eK(eM(t)))}tr(r,n),tf(r,n),e1(r,n);let l=new Map;for(let e of n)l.set(String(e.id),e);ta(r,l),ev(r,l),e2(r,l),td(r,l),e5(r,l),e3(r,l),e8(r,l),e7(r,l);let i=(0,u.K)(()=>{tn(r,l),te(r,l),tt(r,l),ta(r,l),eH(r,l),e8(r,l),ta(r,l),eH(r,l)},"finalizeRenderedEdges");i(),td(r,l),i(),e4(r,l),e9(r,l),e4(r,l),e9(r,l)}function tc(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let o of e.edges){if(!t.has(o.src)||!t.has(o.dst))continue;let e=`${o.id}:${o.src}->${o.dst}`;n.has(e)||(n.add(e),r.push(o))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}function tp(e,t){return e.edges.filter(e=>e.dst===t)}function tx(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}function tm(e){let t=tx(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function ty(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}function tb(e){return[...e.entries()].filter(([,e])=>0===e).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}function tM(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let o of e.edges)t(o)&&(r.get(o.src).push(o.dst),n.get(o.dst).push(o.src));return{preds:n,succs:r}}function tK(e,t,n,r){let o=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(o=Math.max(o,n[t]??0));let l=Array.from({length:o+1},()=>[]);for(let o of t)r?.skipGroups&&e.nodeById.get(o)?.isGroup||l[Math.max(0,n[o]??0)].push(o);return l}function tI(e){let t=ty(e),n=tb(t),r=[],o=tm(e);for(;n.length;){let e=n.shift();for(let l of(r.push(e),o.get(e)??[]))if(t.set(l,(t.get(l)??0)-1),(t.get(l)??0)===0){let e=0;for(;e<n.length&&n[e]<l;)e++;n.splice(e,0,l)}}return r.length===e.nodes.length?r:null}function tw(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function tS(e){let t=Array(e.length),n=(0,u.K)((r,o)=>{if(o-r<=1)return 0;let l=r+o>>1,i=n(r,l)+n(l,o),a=r,s=l,f=r;for(;a<l||s<o;)s>=o||a<l&&e[a]<=e[s]?t[f++]=e[a++]:(t[f++]=e[s++],i+=l-a);for(let n=r;n<o;n++)e[n]=t[n];return i},"count");return n(0,e.length)}function tv(e){let t=tc(e),n=new Map;for(let e of t.nodes)n.set(e,[]);for(let e of t.edges)n.get(e.src).push(e);for(let e of n.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let r=Object.create(null);for(let e of t.nodes)r[e]=0;let o=[],l=(0,u.K)(e=>{for(let t of(r[e]=1,n.get(e)??[])){let e=t.dst;0===r[e]?l(e):1===r[e]&&o.push(t)}r[e]=2},"dfs");for(let e of[...t.nodes].sort((e,t)=>e.localeCompare(t)))0===r[e]&&l(e);let i=new Set(o.map(e=>`${e.id}:${e.src}->${e.dst}`)),a=t.edges.map(e=>i.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:[...t.nodes],edges:a,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:o}}function tC(e){let t=new Map,n=(0,u.K)(r=>{if(t.has(r))return t.get(r);let o=e.nodeById.get(r);if(!o)return t.set(r,null),null;let l=o.parentId;if(!l)return t.set(r,null),null;let i=n(l)??l;return t.set(r,i),i},"resolve");for(let t of e.nodes)n(t);return t}function tL(e){let t=tC(e);return e=>t.get(e)??null}function t$(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function tk(e,t){let n=t$(e);if(!t||0===t.length)return n;let r=new Set(n),o=new Set,l=[];for(let e of t)!r.has(e)||o.has(e)||(o.add(e),l.push(e));for(let e of n)o.has(e)||l.push(e);return l}(0,u.K)(ts,"pairKey"),(0,u.K)(tf,"straightenCollinearSiblingDetours"),(0,u.K)(td,"nudgeSharedInteriorSubpaths"),(0,u.K)(tu,"segmentsIntersect"),(0,u.K)(th,"validateSwimlanesLayout"),(0,u.K)(tg,"postProcessSwimlaneLayout"),(0,u.K)(tc,"normalizeGraph"),(0,u.K)(tp,"incoming"),(0,u.K)(tx,"buildSuccessorMap"),(0,u.K)(tm,"buildSortedSuccessorMap"),(0,u.K)(ty,"buildInDegreeMap"),(0,u.K)(tb,"sortedZeroInDegreeNodes"),(0,u.K)(tM,"buildPredecessorSuccessorMaps"),(0,u.K)(tK,"buildLayersFromRanks"),(0,u.K)(tI,"topoSortIfAcyclic"),(0,u.K)(tw,"buildLayerIndex"),(0,u.K)(tS,"countInversions"),(0,u.K)(tv,"removeCycles_DFS"),(0,u.K)(tC,"buildTopLaneMap"),(0,u.K)(tL,"createTopLaneResolver"),(0,u.K)(t$,"buildTopLaneOrder"),(0,u.K)(tk,"resolveTopLaneOrder");function tR(e,t){let n=tc(e),r=t?.laneOf??(()=>null),o=t?.rankHint,{preds:l}=tM(n);for(let e of l.values())e.sort((e,t)=>e.localeCompare(t));let i=tI(n)??[...n.nodes].sort((e,t)=>e.localeCompare(t)),a=new Map;for(let[e,t]of i.entries())a.set(t,e);let s=new Map,f=new Map;for(let e of n.nodes)f.set(e,[]);for(let e of i){let t=(l.get(e)??[]).filter(e=>s.has(e));if(t.length>0){let n=tT(e,t,{laneOf:r,rankHint:o,topoIndex:a});s.set(e,n),f.get(n).push(e)}else s.has(e)||s.set(e,null)}for(let e of n.nodes)s.has(e)||s.set(e,null);let d=new Set;for(let e of n.nodes)(s.get(e)??null)===null&&d.add(e);let h=[...d].sort((e,t)=>{let n=a.get(e)??0,r=a.get(t)??0;return n===r?e.localeCompare(t):n-r}),g=tO(n),c=new Map;for(let[e,t]of g.entries())c.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let p=tF(c),x=tE(c),m=new Map;for(let e of n.nodes)m.set(e,[]);for(let e of x)for(let t of e.nodes){let n=m.get(t);n?n.push(e.id):m.set(t,[e.id])}let y=[],b=[],M=new Set,K=(0,u.K)(e=>{if(!M.has(e)){for(let t of(M.add(e),y.push(e),f.get(e)??[]))K(t);b.push(e)}},"walk");for(let e of h)K(e);for(let e of i)K(e);return{parent:s,children:f,roots:h,componentOf:p,blocks:x,nodeBlocks:m,adjacency:c,preorder:y,postorder:b,topologicalOrder:i}}function tT(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let o=n.laneOf(e),l=n.laneOf(t),i=null!=o&&o===r;if(i!==(null!=l&&l===r))return i?-1:1;let a=n.rankHint?.[e],s=n.rankHint?.[t];if(null!=a&&null!=s&&a!==s)return s-a;let f=n.topoIndex.get(e)??0,d=n.topoIndex.get(t)??0;return f!==d?f-d:e.localeCompare(t)})[0]}function tO(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}function tF(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let o=[r];for(;o.length>0;){let r=o.pop();if(!t.has(r))for(let l of(t.set(r,n),e.get(r)??[]))t.has(l)||o.push(l)}n++}return t}function tE(e){let t=new Map,n=new Map,r=[],o=[],l=0,i=(0,u.K)((a,s)=>{for(let f of(t.set(a,++l),n.set(a,l),e.get(a)??[]))f!==s&&(t.has(f)?(t.get(f)??0)<(t.get(a)??0)&&(r.push([a,f]),n.set(a,Math.min(n.get(a)??l,t.get(f)??l))):(r.push([a,f]),i(f,a),n.set(a,Math.min(n.get(a)??l,n.get(f)??l)),(n.get(f)??0)>=(t.get(a)??0)&&o.push(tB(a,f,r,o.length))))},"visit");for(let n of e.keys())t.has(n)||i(n,null);return o}function tB(e,t,n,r){let o=[],l=new Set;for(;n.length>0;){let r=n.pop();if(o.push(r),l.add(r[0]),l.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:o,nodes:[...l]}}function tN(e,t,n){let r=[...e.nodes],o=new Map;for(let[e,t]of r.entries())o.set(t,e);let l=r.length,i=Array(l).fill(-1),a=Array(l).fill(0),s=[],f=new Set;for(let e of r){let t=n.parent.get(e)??null,r=o.get(e);null!=r&&null==t&&(i[r]=-1,a[r]=0,f.has(e)||(f.add(e),s.push(e)))}for(;s.length>0;){let e=s.shift(),t=o.get(e);if(null!=t)for(let r of n.children.get(e)??[]){if(f.has(r))continue;let e=o.get(r);null!=e&&(i[e]=t,a[e]=a[t]+1,f.add(r),s.push(r))}}for(let e of r){if(f.has(e))continue;let t=o.get(e);null!=t&&(i[t]=-1,a[t]=0,f.add(e))}let d=Math.max(1,Math.ceil(Math.log2(Math.max(1,l)))+1),h=Array.from({length:d},()=>Array(l).fill(-1));for(let e=0;e<l;e++)h[0][e]=i[e];for(let e=1;e<d;e++)for(let t=0;t<l;t++){let n=h[e-1][t];h[e][t]=-1===n?-1:h[e-1][n]}let g=(0,u.K)((e,t)=>{if(-1===e||-1===t)return -1;a[e]<a[t]&&([e,t]=[t,e]);let n=a[e]-a[t];for(let t=0;t<d;t++)if(n>>t&1&&-1===(e=h[t][e]))return -1;if(e===t)return e;for(let n=d-1;n>=0;n--){let r=h[n][e],o=h[n][t];-1!==r&&-1!==o&&r!==o&&(e=r,t=o)}return h[0][e]},"lcaIndex"),c=Array.from({length:l},()=>new Map);for(let n of e.edges){let e=n.src,r=n.dst,l=t[e],i=t[r];if(null==l||null==i||(l>i&&([e,r]=[r,e],[l,i]=[i,l]),null==l||null==i||l===i))continue;let a=o.get(e),s=o.get(r);if(null==a||null==s)continue;let f=g(a,s);if(-1===f)continue;let d=c[f];for(let e=l;e<i;e++)d.set(e,(d.get(e)??0)+1)}let p=new Map,x=(0,u.K)((e,t)=>{if(0!==t.size)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},"mergeInto"),m=new Set,y=(0,u.K)(e=>{let r=o.get(e);m.add(e);let l=null==r?void 0:c[r],i=l?new Map(l):new Map;for(let r of n.children.get(e)??[]){let n=y(r),o=t[e];if(null!=o){let l=p.get(e);l||(l=new Map,p.set(e,l));let i=n.get(o)??0,a=t[r];null!=a&&a>o&&(i+=1),l.set(r,i)}x(i,n)}return i},"dfs");for(let e of n.roots)m.has(e)||y(e);for(let e of r)m.has(e)||y(e);return p}function tX(e,t,n){let r=new Map,o=(0,u.K)(e=>{let l=n[e]??0,i=[...t.get(e)??[]];for(let e of(i.sort(tz(n)),i)){o(e);let t=r.get(e);null!=t&&(l=Math.min(l,t))}r.set(e,l)},"annotate");for(let t of e)o(t);return r}function tz(e){return(t,n)=>{let r=e[t]??0,o=e[n]??0;return r===o?t.localeCompare(n):r-o}}function tY(e,t,n,r){let o=0;for(let e of t){let t=n[e]??0;t>o&&(o=t)}let l=Array.from({length:o+1},()=>[]),i=new Set,a=(0,u.K)(e=>{if(i.has(e))return;i.add(e);let t=n[e]??0;for(let n of(l[t]||(l[t]=[]),l[t].push(e),r(e)))a(n)},"emit");for(let t of e)a(t);for(let e of t)if(!i.has(e)){let t=n[e]??0;l[t]||(l[t]=[]),l[t].push(e),i.add(e)}return l}function tA(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}function tP(e,t,n,r){return o=>{let l=e.get(o)??[];if(0===l.length)return[];let i=t[o]??0,a=[],s=[],f=n.get(o);for(let e of l){let t=r.get(e)??i;t>i?a.push({child:e,min:t}):s.push(e)}return a.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),s.sort((e,t)=>{let n=f?.get(e)??0,o=f?.get(t)??0;if(n!==o)return n-o;let l=r.get(e)??i,a=r.get(t)??i;return l!==a?l-a:e.localeCompare(t)}),[...a.map(e=>e.child),...s]}}function tG(e,t,n){let r=tR(e,{rankHint:t,laneOf:n}),{children:o,roots:l}=r;for(let t of e.nodes)o.has(t)||o.set(t,[]);let i=tN(e,t,r),a=[...l].sort(tz(t)),s=tX(a,o,t),f=tP(o,t,i,s),d=tY(a,e.nodes,t,f);return tA(d)}function tD(e,t,n){let r=new Set(e),o=new Set(t),l=tw(t),i=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&i.push(l.get(e.dst));return tS(i)}function tH(e,t,n){let r=[];for(let e of t){let t=n[e.src],o=n[e.dst];if(null==t||null==o||t===o)continue;let l=e.src,i=e.dst,a=t,s=o;t>o&&(l=e.dst,i=e.src,a=o,s=t);for(let t=a;t<s;t++)r.push({id:`${e.id}@${t}`,src:l,dst:i,ref:e.ref})}let o=0;for(let t=0;t+1<e.length;t++)o+=tD(e[t],e[t+1],r);return o}function t_(e,t){let n={...t},{preds:r}=tM(e),o=tL(e),l=tH(tG(e,n,o),e.edges,n);for(let t=0;t<4;t++){let t=!1;for(let i of[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0))){let a=n[i]??0;if(0===a)continue;let s=0;for(let e of r.get(i)??[])s=Math.max(s,(n[e]??0)+1);if(s>=a)continue;n[i]=s;let f=tH(tG(e,n,o),e.edges,n);f<l?(l=f,t=!0):n[i]=a}if(!t)break}return n}function tj(e,t){let n=tL(e);for(let r of[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n))){let o=n(r);if(!o)continue;let l=e.edges.filter(e=>e.src===r);if(0===l.length)continue;let i=!1,a=0;for(let e of l){let t=n(e.dst);null==t||t===o?i=!0:a++}if(0===a||i)continue;let s=0,f=!1;for(let t of e.edges){if(t.dst!==r)continue;let e=n(t.src);e&&(e===o?f=!0:s++)}if(s>0||!f)continue;let d=t[r]??0,u=d+a,h=0;for(let n of e.edges)n.dst===r&&(h=Math.max(h,(t[n.src]??0)+1));let g=Math.max(d,h,u);g!==d&&(t[r]=g)}}function tV(e,t){let n=tc(e),r=tI(n)??[...n.nodes].sort(),o=t?.compactSingleInput??!1,l=tL(n),i=Object.create(null);for(let e of r){let r=tp(n,e),a=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=l(t.src),r=l(e);return!n||!r||n===r}):r;if(0===a.length)i[e]=0;else if(o&&1===a.length){let t=a[0].src;l(t)!==l(e)?i[e]=i[t]??0:i[e]=(i[t]??0)+1}else{let t=-1/0;for(let e of a)t=Math.max(t,(i[e.src]??0)+1);i[e]=-1/0===t?0:t}}return t?.optimizeRanksByCrossings&&(i=t_(n,i)),t?.ignoreCrossLaneEdges&&tj(n,i),{layers:tG(n,i,l),rankOf:i,dummy:new Set}}function tW(e,t){let n=tc(e),r={...tV(n,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},o=tL(n),{preds:l,succs:i}=tM(n,e=>{if(t?.ignoreCrossLaneEdges){let t=o(e.src),n=o(e.dst);if(t&&n&&t!==n)return!1}return!0}),a=tI(n)??[...n.nodes],s=[...a].reverse(),f=(0,u.K)((e,t)=>{let n=0;for(let t of l.get(e)??[])n=Math.max(n,(r[t]??0)+1);let o=1/0,a=i.get(e)??[];return a.length>0&&(o=Math.min(...a.map(e=>(r[e]??0)-1))),Number.isFinite(o)||(o=Math.max(n,t)),Math.min(Math.max(t,n),o)},"clampFeasible"),d=(0,u.K)(e=>{let t=!1;for(let n of e){let e=l.get(n)??[],o=i.get(n)??[];if(0===e.length&&0===o.length)continue;let a=Math.round(((e.length>0?e.reduce((e,t)=>e+(r[t]??0)+1,0)/e.length:r[n]??0)+(o.length>0?o.reduce((e,t)=>e+(r[t]??0)-1,0)/o.length:r[n]??0))/2),s=f(n,a);s!==r[n]&&(r[n]=s,t=!0)}return t},"relaxOrder");for(let e=0;e<8;e++){let e=d(a),t=d(s);if(!e&&!t)break}for(let e of a){let t=0;for(let n of l.get(e)??[])t=Math.max(t,(r[n]??0)+1);(r[e]??0)<t&&(r[e]=t)}for(let e of s){let t=i.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(r[e]??0)-1));(r[e]??0)>n&&(r[e]=n)}}return{layers:tK(n,a,r),rankOf:r,dummy:new Set}}function tU(e){let t=ty(e),n=tm(e),r=tb(t),o=[];for(;r.length>0;){let e=[];for(let l of r)for(let r of(o.push(l),n.get(l)??[]))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 o.length===e.nodes.length?o:null}function tq(e,t){let n=tc(e),r=t?.direction==="LR"?tU(n)??[...n.nodes].sort():tI(n)??[...n.nodes].sort(),o=tL(n),l=(0,u.K)(e=>o(e)??e,"laneOf"),i=Object.create(null),a=new Map,s=(0,u.K)((e,n)=>t?.ignoreCrossLaneEdges??!0?+(l(e)===l(n)):1,"edgeWeight");for(let e of r){let t=n.nodeById.get(e);if(t?.isGroup)continue;let r=tp(n,e),o=0;if(r.length>0)for(let t of r){let n=t.src;o=Math.max(o,(i[n]??0)+s(n,e))}let f=l(e),d=Math.max(o,a.get(f)??0);i[e]=d,a.set(f,d+1)}return{layers:tK(n,r,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}function tJ(e,t){let n=tc(t),{rankOf:r}=e,o=e.layers.map(e=>[...e]),l=new Set(e.dummy?[...e.dummy]:[]),i=0,a=new Map(n.nodeById),s=(0,u.K)(e=>{let t=`placeholder-${i++}`;for(a.set(t,{id:t,isGroup:!1,isDummy:!0,width:0,height:0}),l.add(t);o.length<=e;)o.push([]);return o[e].push(t),r[t]=e,t},"addDummyAt"),f=[...n.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 f){let t=r[e.src]??0,n=r[e.dst]??0;if(n-t<=1){d.push(e);continue}let o=e.src;for(let r=t+1,l=0;r<n;r++,l++){let t=s(r);d.push({id:`${e.id}#${l}`,src:o,dst:t,weight:e.weight,ref:e.ref}),o=t}let l=n-t-2;d.push({id:`${e.id}#${Math.max(l+1,0)}`,src:o,dst:e.dst,weight:e.weight,ref:e.ref})}let h={nodes:[...n.nodes,...[...l].filter(e=>!n.nodes.includes(e))],edges:d,layout:n.layout,nodeById:a};return{layering:{layers:o,rankOf:r,dummy:l},graphWithDummies:h}}function tQ(e){let t=e.length;if(0===t)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])}function tZ(e){return 0===e.length?1/0:e.reduce((e,t)=>e+t,0)/e.length}function t0(e,t,n,r){let o=new Map;for(let t of e)o.set(t,[]);for(let e of n)"down"===r?t.has(e.src)&&o.has(e.dst)&&o.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&o.has(e.src)&&o.get(e.src).push(t.get(e.dst));return o}function t1(e,t,n){let r=n.get(e)??0,o=n.get(t)??0;return r!==o?r-o:e.localeCompare(t)}function t2(e,t,n){let r=new Set(e),o=new Set(t),l=tw(e),i=tw(t),a=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&a.push({u:l.get(e.src),v:i.get(e.dst)});return a.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),tS(a.map(e=>e.v))}function t6(e,t,n){return[...e].sort((e,r)=>{let o=tQ(t.get(e)??[]),l=tQ(t.get(r)??[]);return o===l?t1(e,r,n):isFinite(o)?isFinite(l)?o-l:-1:1})}function t5(e,t,n,r,o,l){let i=tw(e),a=tw(t),s=t0(t,i,n,r);if(!o||!l||0===l.length)return t6(t,s,a);let f=new Map;for(let e of t){let t=o(e),n=f.get(t)??[];n.push(e),f.set(t,n)}let d=[];for(let e of l){let t=f.get(e);if(!t||0===t.length)continue;let n=t6(t,s,a);d.push(...n)}let u=f.get(null);if(u&&u.length>0)for(let e of t6(u,s,a)){let t=tZ(s.get(e)??[]),n=d.length;if(isFinite(t)){for(let[e,r]of d.entries())if(t<tZ(s.get(r)??[])){n=e;break}}d.splice(n,0,e)}return d}function t3(e,t,n,r,o){let l=[...t],i=new Set(e),a=new Set(t),s=r?new Set(r):null,f=n.filter(e=>i.has(e.src)&&a.has(e.dst)),d=s?n.filter(e=>a.has(e.src)&&s.has(e.dst)):void 0,h=(0,u.K)(t=>{let n=t2(e,t,f);return d&&r&&(n+=t2(t,r,d)),n},"crossingScore"),g=o?new Map:null;if(o&&g)for(let e of t)g.set(e,o(e));let c=!0,p=h(l);for(;c;){c=!1;for(let e=0;e+1<l.length;e++){if(g&&g.get(l[e])!==g.get(l[e+1]))continue;let t=p;[l[e],l[e+1]]=[l[e+1],l[e]];let n=h(l);n<t?(p=n,c=!0):[l[e],l[e+1]]=[l[e+1],l[e]]}}return l}function t8(e,t,n){let r=e.layers.map(e=>[...e]),o=t.edges,l=tL(t),i=tk(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=t5(r[e-1],r[e],o,"down",l,i),r[e]=t3(r[e-1],r[e],o,r[e+1],l);for(let e=r.length-2;e>=0;e--)r[e]=t5(r[e+1],r[e],o,"up",l,i),r[e]=t3(r[e+1],r[e],o,r[e-1],l)}return{layers:r}}function t4(e,t,n){let r=n?.layerGap??100,o=n?.nodeGap??40,l=n?.laneGap??2*o,i=n?.direction??"TB",a=e.layers,s=Object.create(null),f=Object.create(null),d=(0,u.K)(e=>t.nodeById.get(e),"getNode"),h=(0,u.K)(e=>d(e)?.width??0,"getWidth"),g=(0,u.K)(e=>d(e)?.height??0,"getHeight"),c=tL(t),p=tk(t,n?.laneOrder),x=a.map(e=>e.reduce((e,t)=>Math.max(e,g(t)),0)),m=[];if("LR"===i||"RL"===i)for(let e=0;e+1<a.length;e++){let t=Math.max(0,(a[e].reduce((e,t)=>Math.max(e,h(t)),0)+a[e+1].reduce((e,t)=>Math.max(e,h(t)),0))/2-(x[e]/2+x[e+1]/2)-r);m.push(t)}let y=new Set;for(let e of a)for(let t of e)y.add(c(t));let b=y.has(null),M=p.filter(e=>y.has(e)),K=[...b?[null]:[],...M],I=Object.create(null);for(let e of M)I[e]=0;for(let e of(b&&(I.null=0),a)){let t=Object.create(null),n=[];for(let r of e){let e=c(r);null===e?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I[e]=Math.max(I[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+h(t),0)+o*Math.max(0,n.length-1);I.null=Math.max(I.null??0,e)}}let w=new Map;{let e=K.map(e=>(null===e?I.null:I[e])??0),t=-(e.reduce((e,t)=>e+t,0)+l*Math.max(0,K.length-1))/2;for(let n=0;n<K.length;n++){let r=K[n],o=e[n]??0,i=t+o/2;w.set(r,i),t+=o,n<K.length-1&&(t+=l)}}let S=0;for(let[e,t]of a.entries()){let n=x[e]??0,l=new Map;for(let e of t){let t=c(e),n=l.get(t)??[];n.push(e),l.set(t,n)}for(let e of K){let t=l.get(e)??[];if(0===t.length)continue;let r=w.get(e);if(1===t.length){let e=t[0];s[e]=r,f[e]=S+n/2}else{let e=t.map(e=>h(e)),l=r-(e.reduce((e,t)=>e+t,0)+o*(t.length-1))/2;for(let[r,i]of t.entries()){let t=e[r];s[i]=l+t/2,f[i]=S+n/2,l+=t+o}}}S+=n+r+(m[e]??0)}let v=new Map;for(let e of t.edges){let t=e.ref.id;v.has(t)||v.set(t,[]),v.get(t).push(e)}for(let[,e]of v){if(0===e.length)continue;let n=e[0].ref,r=n.start,o=n.end;if(null==r||null==o)continue;let l=Math.round(((s[r]??0)+(s[o]??0))/2),i=new Set;for(let t of e)i.add(t.src),i.add(t.dst);for(let e of i){if(e===r||e===o)continue;let n=t.nodeById.get(e);n?.isDummy&&(s[e]=l)}}return{x:s,y:f}}function t9(e){let t=0x811c9dc5;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,0x1000193);return t>>>0}function t7(e){let t=e>>>0;return()=>{let e=t+=0x6d2b79f5;return e=Math.imul(e^e>>>15,1|e),(((e^=e+Math.imul(e^e>>>7,61|e))^e>>>14)>>>0)/0x100000000}}function ne(e,t){let n=[...e],r=t7(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}function nt(e,t){let n=0;for(let[r,o]of e.entries())n+=Math.abs(r-(t.get(o)??r));return n}function nn(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:o,weight:l}of t){let t=n.get(e),i=n.get(o);null!=t&&null!=i&&(r+=l*Math.abs(t-i))}return r}function nr(e){let t=t$(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=tL(e),o=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let l="string"==typeof t.start?t.start:void 0,i="string"==typeof t.end?t.end:void 0;if(!l||!i||!e.nodeById.has(l)||!e.nodeById.has(i))continue;let a=r(l),s=r(i);if(!a||!s||a===s)continue;let f=n.get(a),d=n.get(s);if(null==f||null==d)continue;let[u,h]=f<=d?[a,s]:[s,a],g=`${u}\0${h}`,c=o.get(g);c?c.weight++:o.set(g,{a:u,b:h,weight:1})}return[...o.values()]}function no(e,t,n){let r=[...e],o=nn(r,t),l=!0,i=0,a=Math.max(1,r.length);for(;l&&i<a;){l=!1,i++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=nn(r,t);n<o?(o=n,l=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:o,sourceDistance:nt(r,n)}}function nl(e,t){return e.cost!==t.cost?e.cost<t.cost:e.sourceDistance<t.sourceDistance}function ni(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 t9(`${e.join("|")}#${r}#${n}`)}function na(e,t={}){let n=t$(e);if(n.length<2)return n;let r=nr(e);if(0===r.length)return n;let o=new Map(n.map((e,t)=>[e,t])),l=no(n,r,o),i=Math.max(0,t.restarts??8);for(let e=0;e<i;e++){let t=ni(n,r,e),i=no(ne(n,t),r,o);nl(i,l)&&(l=i)}return l.order}function ns(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,o=tc(e),l=t?.automaticLaneOrdering?na(o,{restarts:8}):void 0,i=tv(o),a=i.acyclic,{layering:s,graphWithDummies:f}=tJ(n?tq(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!0,direction:t?.direction}):tW(a,{compactSingleInput:t?.compactSingleInput??!0,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),a),d=t8(s,f,{laneOrder:l}),u=t4(d,f,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:l});return{acyclic:a,reversed:i.reversed,layering:s,ordered:d,coordinates:u}}function nf(e,t,n){let r=e.x??0,o=e.y??0,l=t.x-r,i=t.y-o,a=Math.abs(l),s=Math.abs(i);return a<1e-6&&s<1e-6?n:s>1e-6&&3*s>=a?i>0?"bottom":"top":a>1e-6?l>0?"right":"left":n}function nd(e,t){return 1e-6>Math.abs(e.to-t.from)||1e-6>Math.abs(e.to-t.to)?e.to:e.from}function nu(e,t){return"vertical"===e.orient?{x:e.coord,y:t}:{x:t,y:e.coord}}function nh(e,t){let n=e.nodes??[],r=e.edges??[],o=[];for(let e of r)e.isLayoutOnly||o.push({...e,__originalEdge:e});let l=new Map,i=new Map,a=[],s="LR"===t;for(let e of n)l.set(e.id,e);for(let e of n.filter(e=>e.isGroup&&!e.parentId)){let t={id:e.id},r=(0,u.K)(e=>{i.set(e.id,t),n.filter(t=>t.parentId===e.id).forEach(r)},"assignLane");r(e)}let f=n.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,o=e.y??0;return{nodeId:e.id,minX:r-t/2-8,maxX:r+t/2+8,minY:o-n/2-8,maxY:o+n/2+8,visualXHalfExtent:s?n/2+8:t/2+8}}),d=(0,u.K)((e,t,n,r)=>{let o=a.find(n=>n.orientation===e&&1>Math.abs(n.coord-t));return o||(o={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},a.push(o)),o.spanMin=Math.min(o.spanMin,n),o.spanMax=Math.max(o.spanMax,r),o},"getOrAddPipe"),h=(0,u.K)((e,t)=>{let n=e.width??10,r=e.height??10,o=e.x??0,l=e.y??0;switch(t){case"top":return{x:o,y:l-r/2};case"bottom":return{x:o,y:l+r/2};case"left":return{x:o-n/2,y:l};case"right":return{x:o+n/2,y:l}}},"portForSide"),g=(0,u.K)((e,t,n)=>h(e,nf(e,t,n?"bottom":"top")),"getOrthogonalPort"),c=[],p=[],x=new Set,m=(0,u.K)((e,t,n)=>{if(0===c.length)return 0;let r=1e-6>Math.abs(t.y-n.y),o=1e-6>Math.abs(t.x-n.x);if(!r&&!o)return 0;let l=0;if(r){let r=t.y,o=Math.min(t.x,n.x)-1e-6,i=Math.max(t.x,n.x)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"vertical"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}else if(o){let r=t.x,o=Math.min(t.y,n.y)-1e-6,i=Math.max(t.y,n.y)+1e-6;if(i<=o)return 0;for(let t of c)t.edgeIndex!==e&&"horizontal"===t.orientation&&!(t.pipe.coord<o)&&!(t.pipe.coord>i)&&t.from-1e-6<=r&&t.to+1e-6>=r&&(l+=1e3)}return l},"crossingPenalty"),y=o.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=l.get(e.start),r=l.get(e.end),o=i.get(e.start),a=i.get(e.end),s=o&&a&&o.id!==a.id?1:0;return{idx:t,crossLane:s,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),b=(0,u.K)((e,t,n,r)=>{let o=Math.min(e.x,t.x),l=Math.max(e.x,t.x),i=Math.min(e.y,t.y),a=Math.max(e.y,t.y);return!!f.find(s=>(!n||s.nodeId!==n)&&(!r||s.nodeId!==r)&&(Math.abs(e.x-t.x)>1e-6?s.minY<e.y&&s.maxY>e.y&&s.maxX>o&&s.minX<l:s.minX<e.x&&s.maxX>e.x&&s.maxY>i&&s.minY<a))},"isSegmentBlocked"),M=new Map,K=new Map;for(let e of o)e.start&&e.end&&e.start!==e.end&&(K.set(e.start,(K.get(e.start)??0)+1),K.set(e.end,(K.get(e.end)??0)+1));let I=(0,u.K)((e,t)=>nf(e,t,"bottom"),"determineSide"),w=new Map;for(let[e,t]of o.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let o=(r.x??0)-(n.x??0),i=(r.y??0)-(n.y??0);w.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:I(n,{x:r.x??0,y:r.y??0}),dstSide:I(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(o),absDy:Math.abs(i),dxSign:Math.sign(o),dySign:Math.sign(i)})}let S=(0,u.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?0===e.absDx?1/0:e.absDy/e.absDx:0===e.absDy?1/0:e.absDx/e.absDy,"preferenceStrength"),v=(0,u.K)(e=>"top"===e.srcSide||"bottom"===e.srcSide?e.dxSign>=0?"right":"left":e.dySign>=0?"bottom":"top","secondarySide"),C=new Map;for(let e of w.values()){let t=`${e.srcId}:${e.srcSide}`;C.has(t)||C.set(t,[]),C.get(t).push(e)}let L=new Map,$=(0,u.K)((e,t)=>`${e}:${t}`,"loadKey");for(let e of w.values())L.set($(e.srcId,e.srcSide),(L.get($(e.srcId,e.srcSide))??0)+1),L.set($(e.dstId,e.dstSide),(L.get($(e.dstId,e.dstSide))??0)+1);for(let e of C.values())if(!(e.length<2)){e.sort((e,t)=>{let n=S(e),r=S(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=v(n),o=L.get($(n.srcId,n.srcSide))??0,l=L.get($(n.srcId,r))??0;l>=o||(L.set($(n.srcId,n.srcSide),o-1),L.set($(n.srcId,r),l+1),n.srcSide=r)}}let k=(0,u.K)(e=>{let t=e?.shape;return"question"===t||"diamond"===t},"isDiamondNode"),R=new Map;for(let e of w.values())R.has(e.dstId)||R.set(e.dstId,new Set),R.get(e.dstId).add(e.dstSide);for(let e of w.values()){if(!k(l.get(e.srcId)))continue;let t=R.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=v(e);if(t.has(n)||(L.get($(e.srcId,n))??0)>0)continue;let r=L.get($(e.srcId,e.srcSide))??0;L.set($(e.srcId,e.srcSide),Math.max(0,r-1)),L.set($(e.srcId,n),1),e.srcSide=n}for(let e of w.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:o,dstSide:i}=e,a=l.get(n),s=l.get(r),f=`${n}:${o}:src`,d="top"===o||"bottom"===o?s.x??0:s.y??0;M.has(f)||M.set(f,[]),M.get(f).push({edgeIdx:t,oppositeCoord:d});let u=`${r}:${i}:dst`,h="top"===i||"bottom"===i?a.x??0:a.y??0;M.has(u)||M.set(u,[]),M.get(u).push({edgeIdx:t,oppositeCoord:h})}let T=new Map;for(let[e,t]of M){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(":"),r=n.slice(0,-2).join(":"),o=n[n.length-2],i=n[n.length-1],a=l.get(r);if(!a)continue;let s="left"===o||"right"===o?a.height??10:a.width??10,f=a.shape,d=Math.min(20,Math.max(8,("question"===f||"diamond"===f?.3*s:s)/(t.length+1))),u=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=u+e*d,r=`${n.edgeIdx}:${i}`;T.set(r,t)}}let O=(0,u.K)(e=>!!o[e]?.labelNodeId,"edgeHasLabelNode"),F=(0,u.K)((e,t)=>!!e&&((M.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>O(e))||(M.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>O(e))),"faceHasLabelNode"),E=(0,u.K)((e,t,n)=>"top"===t||"bottom"===t?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},"applyPortOffset"),B=(0,u.K)((e,t,n)=>{let r=w.get(e),o={x:n.x??0,y:n.y??0},l={x:t.x??0,y:t.y??0},i=r?.srcSide??I(t,o),a=r?.dstSide??I(n,l),s=r?h(t,r.srcSide):g(t,o,!0),f=r?h(n,r.dstSide):g(n,l,!1),d=T.get(`${e}:src`),u=T.get(`${e}:dst`);return void 0!==d&&(s=E(s,i,d)),void 0!==u&&(f=E(f,a,u)),{pSrcPort:s,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(let e of y){let t=o[e];if(p[e]=[],!t.start||!t.end||t.points&&t.points.length>0||t.start===t.end)continue;let n=l.get(t.start),r=l.get(t.end);if(!n||!r)continue;let{pSrcPort:i,pDstPort:h,srcSide:g,dstSide:y}=B(e,n,r),I={...i},w={...h},S="top"===g||"bottom"===g,v="top"===y||"bottom"===y;S?I.y=i.y>(n.y??0)?i.y+20:i.y-20:I.x=i.x>(n.x??0)?i.x+20:i.x-20,v?w.y=h.y>(r.y??0)?h.y+20:h.y-20:w.x=h.x>(r.x??0)?h.x+20:h.x-20;let C=(0,u.K)((e,t)=>{for(let n of f)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"),L=(0,u.K)((e,t,n,r,o)=>{if(o){let o=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+15:r.minX-15,y:o?r.maxY+15:r.minY-15,leavesPositiveSide:o}}let l=e.x>(t.x??0),i=(n.y??0)>=e.y;return{x:l?r.maxX+15:r.minX-15,y:i?r.maxY+15:r.minY-15,leavesPositiveSide:l}},"obstacleDetour"),$=[],k=[t.start,t.end],R=C(I,k);if(R.inside&&R.obstacle){let e=R.obstacle;if(S){let t=L(i,n,r,e,!0);I.x=t.x,I.y=t.y;let o=t.leavesPositiveSide?Math.min(e.minY-2,i.y+20):Math.max(e.maxY+2,i.y-20);$=[{x:i.x,y:o},{x:t.x,y:o},{x:t.x,y:t.y}]}else{let t=L(i,n,r,e,!1),o=t.leavesPositiveSide?Math.min(e.minX-2,i.x+20):Math.max(e.maxX+2,i.x-20);I.x=t.x,I.y=t.y,$=[{x:o,y:i.y},{x:o,y:t.y},{x:t.x,y:t.y}]}}let O=[],E=C(w,k);if(E.inside&&E.obstacle){let e=E.obstacle;if(v){let t=L(h,r,n,e,!0);w.x=t.x,w.y=t.y,O=[{x:t.x,y:t.y},{x:h.x,y:t.y}]}else{let t=L(h,r,n,e,!1);w.x=t.x,w.y=t.y,O=[{x:t.x,y:t.y},{x:t.x,y:h.y}]}}if(0===$.length&&0===O.length){let n=15>Math.abs(I.x-w.x),r=15>Math.abs(I.y-w.y),o=void 0!==T.get(`${e}:src`)||void 0!==T.get(`${e}:dst`),l=(M.get(`${t.start??""}:${g}:src`)?.length??0)+(M.get(`${t.start??""}:${g}:dst`)?.length??0),a=(M.get(`${t.end??""}:${y}:src`)?.length??0)+(M.get(`${t.end??""}:${y}:dst`)?.length??0),s=l>1||a>1,f=K.get(t.start??"")??0,d=K.get(t.end??"")??0,u=l>1&&F(t.start,g)||a>1&&F(t.end,y),p=l<=1||f<=2,m=a<=1||d<=2,S=s&&!u&&p&&m;if((n||r)&&!o&&(!s||S)&&!b(i,h,t.start,t.end)){t.points=[{...i},{...I},{...w},{...h}],x.add(e);let n=r?"horizontal":"vertical",o=r?i.y:i.x,l=r?Math.min(i.x,h.x):Math.min(i.y,h.y),a=r?Math.max(i.x,h.x):Math.max(i.y,h.y),s={id:`fast-path-${n}-${o.toFixed(0)}-${e}`,orientation:n,coord:o,spanMin:l,spanMax:a,tracks:[]};c.push({edgeIndex:e,segmentIndex:0,orientation:n,pipe:s,trackIndex:0,from:l,to:a});continue}}let N=d("vertical",I.x,I.y,I.y);I.x=N.coord;let X=d("vertical",w.x,w.y,w.y);w.x=X.coord;let z=Math.min(I.x,w.x)-50,Y=Math.max(I.x,w.x)+50,A=Math.min(I.y,w.y)-50,P=Math.max(I.y,w.y)+50;for(let e of f){let t=Math.min(I.x,w.x),n=Math.max(I.x,w.x),r=Math.min(I.y,w.y),o=Math.max(I.y,w.y);e.minX<n&&e.maxX>t&&e.minY<o&&e.maxY>r&&(z=Math.min(z,e.minX-25),Y=Math.max(Y,e.maxX+25),A=Math.min(A,e.minY-25),P=Math.max(P,e.maxY+25))}for(let e of f)e.maxX<z||e.minX>Y||e.maxY<A||e.minY>P||(d("horizontal",e.minY-15,z,Y),d("horizontal",e.maxY+15,z,Y),d("vertical",e.minX-15,A,P),d("vertical",e.maxX+15,A,P));d("horizontal",I.y,z,Y),d("horizontal",w.y,z,Y);let G=a.filter(e=>"horizontal"===e.orientation&&e.coord>=A&&e.coord<=P),D=a.filter(e=>"vertical"===e.orientation&&e.coord>=z&&e.coord<=Y),H=(0,u.K)((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,"getKey"),_=H(I.x,I.y),j=H(w.x,w.y),V=new Map,W=new Map,U=new Map,q=new Set,J=[];V.set(_,0),U.set(_,"n"),J.push({key:_,f:Math.hypot(w.x-I.x,w.y-I.y),pt:I}),q.add(_);let Q=[],Z=(0,u.K)((e,n)=>b(e,n,t.start,t.end),"checkSegmentBlocked"),ee={x:w.x,y:I.y},et=Z(I,ee),en=Z(ee,w),er=et||en,eo={x:I.x,y:w.y},el=Z(I,eo),ei=Z(eo,w),ea=el||ei;if(er?ea||(Q=1e-6>Math.abs(I.x-w.x)?[I,w]:[I,eo,w]):Q=1e-6>Math.abs(I.y-w.y)||1e-6>Math.abs(I.x-w.x)?[I,w]:[I,ee,w],0===Q.length)for(;J.length>0;){J.sort((e,t)=>e.f-t.f);let n=J.shift();if(q.delete(n.key),n.key===j){let e=j,t=w;for(Q=[t];W.has(e);){let n=W.get(e);Q.unshift(n),t=n,e=H(n.x,n.y)}break}let r=n.pt.x,o=n.pt.y,l=D.sort((e,t)=>e.coord-t.coord),i=l.findIndex(e=>1>Math.abs(e.coord-r)),a=G.sort((e,t)=>e.coord-t.coord),s=a.findIndex(e=>1>Math.abs(e.coord-o)),d=[];for(let u of(i>0&&d.push({x:l[i-1].coord,y:o}),i>=0&&i<l.length-1&&d.push({x:l[i+1].coord,y:o}),s>0&&d.push({x:r,y:a[s-1].coord}),s>=0&&s<a.length-1&&d.push({x:r,y:a[s+1].coord}),d)){let l=Math.min(r,u.x),i=Math.max(r,u.x),a=Math.min(o,u.y),s=Math.max(o,u.y);if(f.some(e=>e.nodeId!==t.start&&e.nodeId!==t.end&&(l!==i?e.minY<o&&e.maxY>o&&e.maxX>l&&e.minX<i:e.minX<r&&e.maxX>r&&e.maxY>a&&e.minY<s)))continue;let d=H(u.x,u.y),h=Math.abs(u.x-r)+Math.abs(u.y-o),g=m(e,n.pt,u),c=0,p=w.x-I.x,x=w.y-I.y,y=u.x-r,b=u.y-o;(x>10&&b<-5||x<-10&&b>5)&&(c=100*Math.abs(b)),(p>10&&y<-5||p<-10&&y>5)&&(c+=50*Math.abs(y));let M=0,K=U.get(n.key)??"n",S=Math.abs(y)>1e-6?"h":"v";"n"!==K&&K!==S&&(M=50);let v=h+g+c+M,C=(V.get(n.key)??1/0)+v,L=Math.abs(w.x-u.x)+Math.abs(w.y-u.y);if(C<(V.get(d)??1/0))if(W.set(d,n.pt),V.set(d,C),U.set(d,S),q.has(d)){let e=J.findIndex(e=>e.key===d);-1!==e&&(J[e].f=C+L)}else J.push({key:d,f:C+L,pt:u}),q.add(d)}}if(0===Q.length&&(Q=[I,{x:I.x,y:w.y},w]),Q.length>4){let e=Q[0],t=Q[Q.length-1],n=Math.min(e.x,t.x),r=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y);for(let e of Q)n=Math.min(n,e.x),r=Math.max(r,e.x),o=Math.min(o,e.y),l=Math.max(l,e.y);let i=r>Math.max(e.x,t.x),a=n<Math.min(e.x,t.x);if(s){if(i){let n=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y),i=f.filter(e=>e.minX<n&&e.maxX>n&&e.minY<l&&e.maxY>o);if(i.length>0){let n=Math.max(e.x,t.x);for(let e of i){let t=(e.minX+e.maxX)/2;void 0===e.visualXHalfExtent||isNaN(e.visualXHalfExtent)||(n=Math.max(n,t+e.visualXHalfExtent+15))}isNaN(n)||(r=n)}}if(a){let r=f.filter(n=>n.minX<Math.min(e.x,t.x)+15&&n.minY<Math.max(e.y,t.y)&&n.maxY>Math.min(e.y,t.y));if(r.length>0){let o=Math.min(e.x,t.x);for(let e of r)o=Math.min(o,(e.minX+e.maxX)/2-e.visualXHalfExtent-15);n=o}}}let d=(0,u.K)(n=>{let r=t.y>e.y,o=f.filter(n=>{let r=Math.min(e.x,t.x)<n.maxX&&Math.max(e.x,t.x)>n.minX,o=Math.min(e.y,t.y)<n.maxY&&Math.max(e.y,t.y)>n.minY;return r&&o}),l=o;if(s&&o.length>0){let e=o.filter(e=>e.minX<n&&e.maxX>n);e.length>0&&(l=e)}if(0===l.length)return t.y;if(r){let e=Math.max(...l.map(e=>e.maxY))+15;if(e<t.y-1e-6)return e}else{let e=Math.min(...l.map(e=>e.minY))-15;if(e>t.y+1e-6)return e}return t.y},"findBestReturnY"),h=(0,u.K)(n=>{let r=d(n),o={x:n,y:e.y},l={x:n,y:r},i={x:t.x,y:r},a=Z(e,o),s=Z(o,l),f=Z(l,i),u=r!==t.y&&Z(i,t);return a||s||f||u?null:1e-6>Math.abs(r-t.y)?[e,o,l,t]:[e,o,l,i,t]},"trySimplifyWithDetourX"),g=i&&!a?h(r):a&&!i?h(n):null;g&&(Q=g)}let es=[i,...$,...Q,...O.reverse(),h];if(es.length>=3){let e=es[es.length-1],t=es[es.length-2],n=es[es.length-3],r=1e-6>Math.abs(n.y-t.y)&&1e-6>Math.abs(t.y-e.y),o=1e-6>Math.abs(n.x-t.x)&&1e-6>Math.abs(t.x-e.x);if(r){let r=Math.sign(t.x-n.x),o=Math.sign(e.x-n.x);0!==r&&r===o&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&es.splice(-2,1)}else if(o){let r=Math.sign(t.y-n.y),o=Math.sign(e.y-n.y);0!==r&&r===o&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&es.splice(-2,1)}}let ef=[es[0]];for(let e=1;e<es.length-1;e++){if(1===e){ef.push(es[e]);continue}let t=ef[ef.length-1],n=es[e],r=es[e+1];if(1e-6>Math.abs(t.y-n.y)&&1e-6>Math.abs(n.y-r.y)){n.x>t.x!=r.x>n.x&&ef.push(n);continue}if(1e-6>Math.abs(t.x-n.x)&&1e-6>Math.abs(n.x-r.x)){n.y>t.y!=r.y>n.y&&ef.push(n);continue}ef.push(n)}ef.push(es[es.length-1]);for(let t=0;t<ef.length-1;t++){let n=ef[t],r=ef[t+1],o=1e-6>Math.abs(n.x-r.x)?"vertical":"horizontal",l="vertical"===o?n.x:n.y,i="vertical"===o?Math.min(n.y,r.y):Math.min(n.x,r.x),a="vertical"===o?Math.max(n.y,r.y):Math.max(n.x,r.x),s=d(o,l,i,a),f={edgeIndex:e,segmentIndex:t,orientation:o,pipe:s,trackIndex:0,from:i,to:a};c.push(f),p[e].push(c.length-1),s.tracks[0]||(s.tracks[0]={index:0,coord:s.coord,segments:[]}),s.tracks[0].segments.push({edgeIndex:e,segmentIndex:t,from:i,to:a})}}let N=(0,u.K)((e,t)=>e.from<t.to&&t.from<e.to,"segmentsOverlap"),X=(0,u.K)((e,t,n,r)=>{let o=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&N(n,e)),l=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&N(n,t));return!!o&&!!l&&(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)},"trySwapSegmentsAcrossTracks"),z=(0,u.K)(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},"createNewTrack"),Y=(0,u.K)((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"),A=(0,u.K)((e,t)=>{for(let n of p[e.edgeIndex]){let r=c[n];r.pipe===e.pipe&&Y(r,t)}},"moveSegmentChainToTrack"),P=(0,u.K)(e=>{let t=p[e.edgeIndex],n=t.indexOf(c.indexOf(e)),r=[];return n>0&&r.push(c[t[n-1]]),n<t.length-1&&r.push(c[t[n+1]]),r},"getAdjacentSegmentsAlongEdge"),G=(0,u.K)((e,t)=>{if(e.orientation===t.orientation)return!1;let n="horizontal"===e.orientation?e:t,r="horizontal"===e.orientation?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},"haveAnyCrossing"),D=(0,u.K)((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&N(e,t)))return n.index;return -1},"findAvailableTrack"),H=(0,u.K)((e,t)=>{if(e.trackIndex===t.trackIndex)return N(e,t);let n=P(e),r=P(t);return n.some(e=>r.some(t=>G(e,t)))},"segmentsConflict"),_=(0,u.K)((e,t,n)=>{if(X(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=D(e.pipe,t);n(t,-1!==r?r:z(e.pipe))},"resolveTrackConflict"),j=(0,u.K)(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let o=e[n],l=e[r];o.pipe===l.pipe&&H(o,l)&&(t++,_(o,l,A))}return t},"resolveHandleConflicts"),V=new Map,W=(0,u.K)(e=>{if(V.has(e))return V.get(e);let t=p[e];if(0===t.length){let t={dest:0,deviation:0,base:0,delta:0};return V.set(e,t),t}let n=c[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let o=c[t[e]];if("horizontal"===o.orientation){let e=o.from,t=o.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let o=Math.abs(r-n),l={dest:r,deviation:o,base:n,delta:r-n};return V.set(e,l),l},"getDestInfo"),U=(0,u.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.start&&(t.has(n.start)||t.set(n.start,[]),t.get(n.start).push(e));let n=(0,u.K)(e=>{let t=o[e];if(!t.start||!t.end)return 0;let n=l.get(t.start),r=l.get(t.end);return n&&r?Math.abs((r.x??0)-(n.x??0))+Math.abs((r.y??0)-(n.y??0)):0},"getEdgeDistance");for(let r of t.values())r.sort((e,t)=>{let r=W(e),o=W(t);if(Math.abs(r.deviation-o.deviation)>1)return r.deviation-o.deviation;if(Math.abs(r.dest-o.dest)>1)return r.dest-o.dest;let l=n(e),i=n(t);if(Math.abs(l-i)>1)return i-l;let a=p[e].length,s=p[t].length;if(a!==s)return a-s;if(1===a){let n=p[e][0],r=p[t][0];if(c[n]&&c[r]){let e=c[n],t=c[r],o=Math.abs(e.to-e.from),l=Math.abs(t.to-t.from);if(Math.abs(o-l)>1)return o-l}}return 0}),e+=j(r.map(e=>c[p[e][0]]));return e},"fixSourceHandleCrossings"),q=(0,u.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==p[e].length&&n.end&&(t.has(n.end)||t.set(n.end,[]),t.get(n.end).push(e));for(let n of t.values())n.sort((e,t)=>{let n=(0,u.K)(e=>{let t=p[e];if(t.length<2)return 0;let n=c[t[t.length-2]];return Math.abs(n.to-n.from)},"getDist"),r=n(e),o=n(t);return Math.abs(r-o)>.1?r-o:e-t}),e+=j(n.map(e=>c[p[e][p[e].length-1]]));return e},"fixTargetHandleCrossings"),J=(0,u.K)(()=>{let e=0;for(let t of a){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=p[t.edgeIndex].find(e=>c[e].segmentIndex===t.segmentIndex);void 0!==e&&n.push(c[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 o=n[t],l=n[r];H(o,l)&&(e++,_(o,l,Y))}}return e},"fixPipeCrossings"),Q=0;for(;Q<10&&0!==0+U()+q()+J();){;Q++}let Z=new Map;for(let e of a){let t=[];e.tracks.forEach(e=>{e.segments.forEach(n=>{t.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:e.index,from:n.from,to:n.to})})}),t.sort((e,t)=>e.from-t.from);let n=[];if(t.length>0){let e=[t[0]],r=t[0].to;for(let o=1;o<t.length;o++){let l=t[o];l.from<r?(e.push(l),r=Math.max(r,l.to)):(n.push(e),e=[l],r=l.to)}n.push(e)}for(let t of n){let n=new Set;t.forEach(e=>n.add(e.trackIndex));let r=new Map;t.forEach(e=>{let t=W(e.edgeIndex);r.set(e.trackIndex,(r.get(e.trackIndex)??0)+t.delta)});let o=[...n].filter(e=>(r.get(e)??0)<-1),l=[...n].filter(e=>(r.get(e)??0)>1),i=[...n].filter(e=>1>=Math.abs(r.get(e)??0));o.sort((e,t)=>(r.get(t)??0)-(r.get(e)??0)),l.sort((e,t)=>(r.get(e)??0)-(r.get(t)??0));let a=(0,u.K)((n,r)=>{t.filter(e=>e.trackIndex===n).forEach(t=>{let n=x.has(t.edgeIndex)?e.coord:r;Z.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},"assignCoord"),s=0;for(let t of o)s++,a(t,e.coord-10*s);if(0===i.length&&n.size>0){let e=[...n].sort((e,t)=>Math.abs(r.get(e)??0)-Math.abs(r.get(t)??0))[0],t=o.indexOf(e);-1!==t&&o.splice(t,1);let a=l.indexOf(e);-1!==a&&l.splice(a,1),i.push(e)}let f=0;for(let t of i){if(0===f)a(t,e.coord);else{let n=f%2==1?1:-1,r=Math.ceil(f/2);a(t,e.coord+n*r*5)}f++}let d=0;for(let t of l)d++,a(t,e.coord+10*d)}}for(let[e,t]of o.entries()){let n=p[e]??[];if(0===n.length)continue;let r=[],{pSrcPort:o,pDstPort:i}=B(e,l.get(t.start),l.get(t.end)),a=n.map(e=>{let t=c[e],n=Z.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(o);for(let e=0;e<a.length;e++){let t=a[e],n=r[r.length-1],o="vertical"===t.orient?n.y:n.x,l="vertical"===t.orient?n.x:n.y,i=a[e+1],s=e<a.length-1;if(Math.abs(l-t.coord)>1e-6&&r.push(nu(t,o)),s&&i.orient===t.orient)if(Math.abs(t.coord-i.coord)>1e-6){let e="vertical"===t.orient?(o+i.from)/2:nd(t,i);r.push(nu(t,e),nu(i,e))}else(0===e||e===a.length-2)&&r.push(nu(t,nd(t,i)));else if(s)r.push(nu(t,i.coord));else{let e=Math.abs(t.from-o)<Math.abs(t.to-o)?t.to:t.from;r.push(nu(t,e))}}let s=r[r.length-1];(Math.abs(s.x-i.x)>1e-6||Math.abs(s.y-i.y)>1e-6)&&r.push(i);let f=[];r.length>0&&f.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=f[f.length-1];(Math.abs(t.x-n.x)>1e-6||Math.abs(t.y-n.y)>1e-6)&&f.push(t)}t.points=f}for(let e of o){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}e.edges=(e.edges??[]).filter(e=>!e.isLayoutOnly);let ee=(0,u.K)((e,t)=>{let n=t.x??0,r=t.y??0,o=t.width??0,l=t.height??0;if(o<=0||l<=0)return e;let i=n-o/2,a=n+o/2,s=r-l/2,f=r+l/2;if(e.x<i||e.x>a||e.y<s||e.y>f)return e;let d=e.x-i,u=a-e.x,h=e.y-s,g=Math.min(d,u,h,f-e.y);return g===d?{x:i,y:e.y}:g===u?{x:a,y:e.y}:g===h?{x:e.x,y:s}:{x:e.x,y:f}},"nodeBoundaryClamp");for(let t of e.edges){let e=t.points;if(!e||e.length<2)continue;let n=t.start,r=t.end,o=n?l.get(n):void 0,i=r?l.get(r):void 0;o&&(e[0]=ee(e[0],o)),i&&(e[e.length-1]=ee(e[e.length-1],i))}return e}function ng(e){return e.direction??"TB"}function nc(e){let t=N(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,o=e.config.swimlane?.ignoreCrossLaneEdges??!0,l=e.config.swimlane?.optimizeRanksByCrossings??!0,i=e.config.swimlane?.automaticLaneOrdering??!1,a=ng(e),{ordered:s,coordinates:f}=ns(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:o,optimizeRanksByCrossings:l,automaticLaneOrdering:i,direction:a});for(let o of(X(t,s,f,{nodeGap:n,layerGap:r}),e.edges??[]))delete o.points;for(let t of(nh(e,a),e.edges??[]))t.curve&&"basis"!==t.curve||(t.curve="rounded");return tg(e,a),th(e),a}async function np(e,t){let n=t.select("g");(0,o.g0)(n,e.markers,e.type,e.diagramId),(0,l.gh)(),(0,o.IU)(),(0,l.IU)(),(0,r.IU)(),B(e);let i=z(e);e.nodes=i.nodes,e.edges=i.edges;let{groups:a}=await c(n,e);nc(e),await R(e,a)}(0,u.K)(tR,"buildDrivingTree"),(0,u.K)(tT,"chooseParent"),(0,u.K)(tO,"buildAdjacency"),(0,u.K)(tF,"assignComponents"),(0,u.K)(tE,"computeBlocks"),(0,u.K)(tB,"popBlock"),(0,u.K)(tN,"computeSubtreeCrossCounts"),(0,u.K)(tX,"annotateMinimumLayers"),(0,u.K)(tz,"compareByRankThenId"),(0,u.K)(tY,"emitNodesInTreeOrder"),(0,u.K)(tA,"deduplicateLayers"),(0,u.K)(tP,"createChildOrderer"),(0,u.K)(tG,"buildMultitreeLayerOrder"),(0,u.K)(tD,"countCrossingsBetweenAdjacent"),(0,u.K)(tH,"totalCrossings"),(0,u.K)(t_,"optimizeRanksByCrossings"),(0,u.K)(tj,"adjustCrossLaneSources"),(0,u.K)(tV,"assignLayers_LongestPath"),(0,u.K)(tW,"assignLayers_Gravity"),(0,u.K)(tU,"topoSortByGenerationIfAcyclic"),(0,u.K)(tq,"assignLayers_LaneAwareCompact"),(0,u.K)(tJ,"makeProperLayering"),(0,u.K)(tQ,"median"),(0,u.K)(tZ,"barycenter"),(0,u.K)(t0,"neighborPositionsFor"),(0,u.K)(t1,"currentOrderTieBreak"),(0,u.K)(t2,"countCrossingsBetweenAdjacent"),(0,u.K)(t6,"sortByHeuristic"),(0,u.K)(t5,"reorderLayer"),(0,u.K)(t3,"transposeImprove"),(0,u.K)(t8,"orderLayers"),(0,u.K)(t4,"assignCoordinates"),(0,u.K)(t9,"hashString"),(0,u.K)(t7,"mulberry32"),(0,u.K)(ne,"deterministicShuffle"),(0,u.K)(nt,"sourceDistance"),(0,u.K)(nn,"laneArrangementCost"),(0,u.K)(nr,"buildWeightedLaneEdges"),(0,u.K)(no,"greedySwitch"),(0,u.K)(nl,"isBetterCandidate"),(0,u.K)(ni,"seedForRestart"),(0,u.K)(na,"optimizeTopLaneOrder"),(0,u.K)(ns,"sugiyamaLayout"),(0,u.K)(nf,"chooseOrthogonalSide"),(0,u.K)(nd,"sharedLineEndpointCoord"),(0,u.K)(nu,"pointOnLine"),(0,u.K)(nh,"routeEdgesOrthogonal"),(0,u.K)(ng,"getSwimlaneDirection"),(0,u.K)(nc,"runSwimlaneLayoutCore"),(0,u.K)(np,"render"),n.d(t,{render:()=>np})}};
@@ -1,34 +0,0 @@
1
- export const __rspack_esm_id=2796;export const __rspack_esm_ids=[2796];export const __webpack_modules__={6471(t,e,n){n.d(e,{diagram:()=>te});var i=n(64183);n(31293);var r=n(86827),s=n(74045);function o(t,e){let n;if(void 0===e)for(let e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n>r||void 0===n&&r>=r)&&(n=r)}return n}function l(t){return t.target.depth}function a(t,e){return t.sourceLinks.length?t.depth:e-1}function h(t,e){let n=0;if(void 0===e)for(let e of t)(e*=1)&&(n+=e);else{let i=-1;for(let r of t)(r=+e(r,++i,t))&&(n+=r)}return n}function c(t,e){let n;if(void 0===e)for(let e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let i=-1;for(let r of t)null!=(r=e(r,++i,t))&&(n<r||void 0===n&&r>=r)&&(n=r)}return n}function u(t){return function(){return t}}function f(t,e){return d(t.source,e.source)||t.index-e.index}function y(t,e){return d(t.target,e.target)||t.index-e.index}function d(t,e){return t.y0-e.y0}function p(t){return t.value}function g(t){return t.index}function _(t){return t.nodes}function x(t){return t.links}function k(t,e){let n=t.get(e);if(!n)throw Error("missing: "+e);return n}function m({nodes:t}){for(let e of t){let t=e.y0,n=t;for(let n of e.sourceLinks)n.y0=t+n.width/2,t+=n.width;for(let t of e.targetLinks)t.y1=n+t.width/2,n+=t.width}}var b=Math.PI,v=2*b,S=v-1e-6;function E(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function w(){return new E}E.prototype=w.prototype={constructor:E,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,s){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+s)},arcTo:function(t,e,n,i,r){t*=1,e*=1,n*=1,i*=1,r*=1;var s=this._x1,o=this._y1,l=n-t,a=i-e,h=s-t,c=o-e,u=h*h+c*c;if(r<0)throw Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(u>1e-6)if(Math.abs(c*l-a*h)>1e-6&&r){var f=n-s,y=i-o,d=l*l+a*a,p=Math.sqrt(d),g=Math.sqrt(u),_=r*Math.tan((b-Math.acos((d+u-(f*f+y*y))/(2*p*g)))/2),x=_/g,k=_/p;Math.abs(x-1)>1e-6&&(this._+="L"+(t+x*h)+","+(e+x*c)),this._+="A"+r+","+r+",0,0,"+ +(c*f>h*y)+","+(this._x1=t+k*l)+","+(this._y1=e+k*a)}else this._+="L"+(this._x1=t)+","+(this._y1=e)},arc:function(t,e,n,i,r,s){t*=1,e*=1,n*=1,s=!!s;var o=n*Math.cos(i),l=n*Math.sin(i),a=t+o,h=e+l,c=1^s,u=s?i-r:r-i;if(n<0)throw Error("negative radius: "+n);null===this._x1?this._+="M"+a+","+h:(Math.abs(this._x1-a)>1e-6||Math.abs(this._y1-h)>1e-6)&&(this._+="L"+a+","+h),n&&(u<0&&(u=u%v+v),u>S?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-l)+"A"+n+","+n+",0,1,"+c+","+(this._x1=a)+","+(this._y1=h):u>1e-6&&(this._+="A"+n+","+n+",0,"+ +(u>=b)+","+c+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var K=Array.prototype.slice;function L(t){return function(){return t}}function A(t){return t[0]}function M(t){return t[1]}function I(t){return t.source}function T(t){return t.target}function P(t,e,n,i,r){t.moveTo(e,n),t.bezierCurveTo(e=(e+i)/2,n,e,r,i,r)}function $(t){return[t.source.x1,t.y0]}function N(t){return[t.target.x0,t.y1]}var C=function(){var t=(0,r.K)(function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},"o"),e=[1,9],n=[1,10],i=[1,5,10,12],s={trace:(0,r.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:(0,r.K)(function(t,e,n,i,r,s,o){var l=s.length-1;switch(r){case 7:let a=i.findOrCreateNode(s[l-4].trim().replaceAll('""','"')),h=i.findOrCreateNode(s[l-2].trim().replaceAll('""','"')),c=parseFloat(s[l].trim());i.addLink(a,h,c);break;case 8:case 9:case 11:this.$=s[l];break;case 10:this.$=s[l-1]}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:e,20:n},{1:[2,6],7:11,10:[1,12]},t(n,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(i,[2,8]),t(i,[2,9]),{19:[1,16]},t(i,[2,11]),{1:[2,1]},{1:[2,5]},t(n,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:e,20:n},{15:18,16:7,17:8,18:e,20:n},{18:[1,19]},t(n,[2,3]),{12:[1,20]},t(i,[2,10]),{15:21,16:7,17:8,18:e,20:n},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:(0,r.K)(function(t,e){if(e.recoverable)this.trace(t);else{var n=Error(t);throw n.hash=e,n}},"parseError"),parse:(0,r.K)(function(t){var e=this,n=[0],i=[],s=[null],o=[],l=this.table,a="",h=0,c=0,u=0,f=o.slice.call(arguments,1),y=Object.create(this.lexer),d={};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d[p]=this.yy[p]);y.setInput(t,d),d.lexer=y,d.parser=this,void 0===y.yylloc&&(y.yylloc={});var g=y.yylloc;o.push(g);var _=y.options&&y.options.ranges;function x(){var t;return"number"!=typeof(t=i.pop()||y.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.parseError?this.parseError=d.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,r.K)(function(t){n.length=n.length-2*t,s.length=s.length-t,o.length=o.length-t},"popStack"),(0,r.K)(x,"lex");for(var k,m,b,v,S,E,w,K,L,A={};;){if(b=n[n.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==k&&(k=x()),v=l[b]&&l[b][k]),void 0===v||!v.length||!v[0]){var M="";for(E in L=[],l[b])this.terminals_[E]&&E>2&&L.push("'"+this.terminals_[E]+"'");M=y.showPosition?"Parse error on line "+(h+1)+":\n"+y.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[k]||k)+"'":"Parse error on line "+(h+1)+": Unexpected "+(1==k?"end of input":"'"+(this.terminals_[k]||k)+"'"),this.parseError(M,{text:y.match,token:this.terminals_[k]||k,line:y.yylineno,loc:g,expected:L})}if(v[0]instanceof Array&&v.length>1)throw Error("Parse Error: multiple actions possible at state: "+b+", token: "+k);switch(v[0]){case 1:n.push(k),s.push(y.yytext),o.push(y.yylloc),n.push(v[1]),k=null,m?(k=m,m=null):(c=y.yyleng,a=y.yytext,h=y.yylineno,g=y.yylloc,u>0&&u--);break;case 2:if(w=this.productions_[v[1]][1],A.$=s[s.length-w],A._$={first_line:o[o.length-(w||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(w||1)].first_column,last_column:o[o.length-1].last_column},_&&(A._$.range=[o[o.length-(w||1)].range[0],o[o.length-1].range[1]]),void 0!==(S=this.performAction.apply(A,[a,c,h,d,v[1],s,o].concat(f))))return S;w&&(n=n.slice(0,-1*w*2),s=s.slice(0,-1*w),o=o.slice(0,-1*w)),n.push(this.productions_[v[1]][0]),s.push(A.$),o.push(A._$),K=l[n[n.length-2]][n[n.length-1]],n.push(K);break;case 3:return!0}}return!0},"parse")};function o(){this.yy={}}return s.lexer={EOF:1,parseError:(0,r.K)(function(t,e){if(this.yy.parser)this.yy.parser.parseError(t,e);else throw Error(t)},"parseError"),setInput:(0,r.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,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:(0,r.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.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),t},"input"),unput:(0,r.K)(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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 r=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===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,r.K)(function(){return this._more=!0,this},"more"),reject:(0,r.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,r.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,r.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,r.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,r.K)(function(){var t=this.pastInput(),e=Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,r.K)(function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={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&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var s in r)this[s]=r[s];return!1},"test_match"),next:(0,r.K)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,e,n,i,r=this._currentRules(),s=0;s<r.length;s++)if((n=this._input.match(this.rules[r[s]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=s,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[s])))return t;if(!this._backtrack)return!1;e=!1;continue}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,r.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,r.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,r.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,r.K)(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:(0,r.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,r.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,r.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,r.K)(function(t,e,n,i){switch(n){case 0:case 1:return this.pushState("csv"),4;case 2:return 10;case 3:return 5;case 4:return 12;case 5:return this.pushState("escaped_text"),18;case 6:return 20;case 7:return this.popState("escaped_text"),18;case 8:return 19}},"anonymous"),rules:[/^(?:sankey-beta\b)/i,/^(?:sankey\b)/i,/^(?:$)/i,/^(?:((\u000D\u000A)|(\u000A)))/i,/^(?:(\u002C))/i,/^(?:(\u0022))/i,/^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i,/^(?:(\u0022)(?!(\u0022)))/i,/^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],conditions:{csv:{rules:[2,3,4,5,6,7,8],inclusive:!1},escaped_text:{rules:[7,8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8],inclusive:!0}}},(0,r.K)(o,"Parser"),o.prototype=s,s.Parser=o,new o}();C.parser=C;var D=[],O=[],j=new Map,z=(0,r.K)(()=>{D=[],O=[],j=new Map,(0,i.IU)()},"clear"),F=class{constructor(t,e,n=0){this.source=t,this.target=e,this.value=n}static{(0,r.K)(this,"SankeyLink")}},U=(0,r.K)((t,e,n)=>{D.push(new F(t,e,n))},"addLink"),W=class{constructor(t){this.ID=t}static{(0,r.K)(this,"SankeyNode")}},V=(0,r.K)(t=>{t=i.Y2.sanitizeText(t,(0,i.D7)());let e=j.get(t);return void 0===e&&(e=new W(t),j.set(t,e),O.push(e)),e},"findOrCreateNode"),G=(0,r.K)(()=>O,"getNodes"),X=(0,r.K)(()=>D,"getLinks"),Y=(0,r.K)(()=>({nodes:O.map(t=>({id:t.ID})),links:D.map(t=>({source:t.source.ID,target:t.target.ID,value:t.value}))}),"getGraph"),q={nodesMap:j,getConfig:(0,r.K)(()=>(0,i.D7)().sankey,"getConfig"),getNodes:G,getLinks:X,getGraph:Y,addLink:U,findOrCreateNode:V,getAccTitle:i.iN,setAccTitle:i.SV,getAccDescription:i.m7,setAccDescription:i.EI,getDiagramTitle:i.ab,setDiagramTitle:i.ke,clear:z},B=class t{static{(0,r.K)(this,"Uid")}static{this.count=0}static next(e){return new t(e+ ++t.count)}constructor(t){this.id=t,this.href=`#${t}`}toString(){return"url("+this.href+")"}},Q={left:function(t){return t.depth},right:function(t,e){return e-1-t.height},center:function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?o(t.sourceLinks,l)-1:0},justify:a},R=(0,r.K)(t=>{let e=0,n=0;for(let i of t){let t=i.value??0;t>e&&(e=t,n=i.layer??0)}return n},"findCentralNodeLayer"),Z=(0,r.K)(function(t,e,n,l){let b,v,{securityLevel:S,sankey:E}=(0,i.D7)(),C=i.ME.sankey;"sandbox"===S&&(b=(0,s.Ltv)("#i"+e));let D="sandbox"===S?(0,s.Ltv)(b.nodes()[0].contentDocument.body):(0,s.Ltv)("body"),O="sandbox"===S?D.select(`[id="${e}"]`):(0,s.Ltv)(`[id="${e}"]`),j=E?.width??C.width,z=E?.height??C.width,F=E?.useMaxWidth??C.useMaxWidth,U=E?.nodeAlignment??C.nodeAlignment,W=E?.prefix??C.prefix,V=E?.suffix??C.suffix,G=E?.showValues??C.showValues,X=E?.nodeWidth??C.nodeWidth??10,Y=E?.nodePadding??C.nodePadding??12,q=E?.labelStyle??C.labelStyle??"legacy",Z=E?.nodeColors??{},H=l.db.getGraph(),J=Q[U];(function(){let t,e,n=0,i=0,r=1,s=1,l=24,b=8,v,S=g,E=a,w=_,K=x,L=6;function A(){let a={nodes:w.apply(null,arguments),links:K.apply(null,arguments)};return function({nodes:t,links:n}){for(let[e,n]of t.entries())n.index=e,n.sourceLinks=[],n.targetLinks=[];let i=new Map(t.map((e,n)=>[S(e,n,t),e]));for(let[t,e]of n.entries()){e.index=t;let{source:n,target:r}=e;"object"!=typeof n&&(n=e.source=k(i,n)),"object"!=typeof r&&(r=e.target=k(i,r)),n.sourceLinks.push(e),r.targetLinks.push(e)}if(null!=e)for(let{sourceLinks:n,targetLinks:i}of t)n.sort(e),i.sort(e)}(a),function({nodes:t}){for(let e of t)e.value=void 0===e.fixedValue?Math.max(h(e.sourceLinks,p),h(e.targetLinks,p)):e.fixedValue}(a),function({nodes:t}){let e=t.length,n=new Set(t),i=new Set,r=0;for(;n.size;){for(let t of n)for(let{target:e}of(t.depth=r,t.sourceLinks))i.add(e);if(++r>e)throw Error("circular link");n=i,i=new Set}}(a),function({nodes:t}){let e=t.length,n=new Set(t),i=new Set,r=0;for(;n.size;){for(let t of n)for(let{source:e}of(t.height=r,t.targetLinks))i.add(e);if(++r>e)throw Error("circular link");n=i,i=new Set}}(a),function(a){let u=function({nodes:e}){let i=c(e,t=>t.depth)+1,s=(r-n-l)/(i-1),o=Array(i);for(let t of e){let e=Math.max(0,Math.min(i-1,Math.floor(E.call(null,t,i))));t.layer=e,t.x0=n+e*s,t.x1=t.x0+l,o[e]?o[e].push(t):o[e]=[t]}if(t)for(let e of o)e.sort(t);return o}(a);v=Math.min(b,(s-i)/(c(u,t=>t.length)-1));let g=o(u,t=>(s-i-(t.length-1)*v)/h(t,p));for(let t of u){let n=i;for(let e of t)for(let t of(e.y0=n,e.y1=n+e.value*g,n=e.y1+v,e.sourceLinks))t.width=t.value*g;n=(s-n+v)/(t.length+1);for(let e=0;e<t.length;++e){let i=t[e];i.y0+=n*(e+1),i.y1+=n*(e+1)}var _=t;if(void 0===e)for(let{sourceLinks:t,targetLinks:e}of _)t.sort(y),e.sort(f)}for(let e=0;e<L;++e){let n=Math.pow(.99,e),i=Math.max(1-n,(e+1)/L);(function(e,n,i){for(let r=e.length,s=r-2;s>=0;--s){let r=e[s];for(let t of r){let e=0,i=0;for(let{target:n,value:r}of t.sourceLinks){let s=r*(n.layer-t.layer);e+=function(t,e){let n=e.y0-(e.targetLinks.length-1)*v/2;for(let{source:i,width:r}of e.targetLinks){if(i===t)break;n+=r+v}for(let{target:i,width:r}of t.sourceLinks){if(i===e)break;n-=r}return n}(t,n)*s,i+=s}if(!(i>0))continue;let r=(e/i-t.y0)*n;t.y0+=r,t.y1+=r,P(t)}void 0===t&&r.sort(d),M(r,i)}})(u,n,i),function(e,n,i){for(let r=1,s=e.length;r<s;++r){let s=e[r];for(let t of s){let e=0,i=0;for(let{source:n,value:r}of t.targetLinks){let s=r*(t.layer-n.layer);e+=function(t,e){let n=t.y0-(t.sourceLinks.length-1)*v/2;for(let{target:i,width:r}of t.sourceLinks){if(i===e)break;n+=r+v}for(let{source:i,width:r}of e.targetLinks){if(i===t)break;n-=r}return n}(n,t)*s,i+=s}if(!(i>0))continue;let r=(e/i-t.y0)*n;t.y0+=r,t.y1+=r,P(t)}void 0===t&&s.sort(d),M(s,i)}}(u,n,i)}}(a),m(a),a}function M(t,e){let n=t.length>>1,r=t[n];T(t,r.y0-v,n-1,e),I(t,r.y1+v,n+1,e),T(t,s,t.length-1,e),I(t,i,0,e)}function I(t,e,n,i){for(;n<t.length;++n){let r=t[n],s=(e-r.y0)*i;s>1e-6&&(r.y0+=s,r.y1+=s),e=r.y1+v}}function T(t,e,n,i){for(;n>=0;--n){let r=t[n],s=(r.y1-e)*i;s>1e-6&&(r.y0-=s,r.y1-=s),e=r.y0-v}}function P({sourceLinks:t,targetLinks:n}){if(void 0===e){for(let{source:{sourceLinks:t}}of n)t.sort(y);for(let{target:{targetLinks:e}}of t)e.sort(f)}}return A.update=function(t){return m(t),t},A.nodeId=function(t){return arguments.length?(S="function"==typeof t?t:u(t),A):S},A.nodeAlign=function(t){return arguments.length?(E="function"==typeof t?t:u(t),A):E},A.nodeSort=function(e){return arguments.length?(t=e,A):t},A.nodeWidth=function(t){return arguments.length?(l=+t,A):l},A.nodePadding=function(t){return arguments.length?(b=v=+t,A):b},A.nodes=function(t){return arguments.length?(w="function"==typeof t?t:u(t),A):w},A.links=function(t){return arguments.length?(K="function"==typeof t?t:u(t),A):K},A.linkSort=function(t){return arguments.length?(e=t,A):e},A.size=function(t){return arguments.length?(n=i=0,r=+t[0],s=+t[1],A):[r-n,s-i]},A.extent=function(t){return arguments.length?(n=+t[0][0],r=+t[1][0],i=+t[0][1],s=+t[1][1],A):[[n,i],[r,s]]},A.iterations=function(t){return arguments.length?(L=+t,A):L},A})().nodeId(t=>t.id).nodeWidth(X).nodePadding(Y+15*!!G).nodeAlign(J).extent([[0,0],[j,z]])(H);let tt=R(H.nodes),te=(0,s.UMr)(s.zt),tn=(0,r.K)(t=>Z[t]??te(t),"getNodeColor");O.append("g").attr("class","nodes").selectAll(".node").data(H.nodes).join("g").attr("class","node").attr("id",t=>(t.uid=B.next("node-")).id).attr("transform",function(t){return"translate("+t.x0+","+t.y0+")"}).attr("x",t=>t.x0).attr("y",t=>t.y0).append("rect").attr("height",t=>t.y1-t.y0).attr("width",t=>t.x1-t.x0).attr("fill",t=>tn(t.id));let ti=(0,r.K)(({id:t,value:e})=>G?`${t}
2
- ${W}${Math.round(100*e)/100}${V}`:t,"getText"),tr=(0,r.K)(t=>"outlined"===q?(t.layer??0)<tt?{x:t.x0-6,anchor:"end"}:{x:t.x1+6,anchor:"start"}:t.x0<j/2?{x:t.x1+6,anchor:"start"}:{x:t.x0-6,anchor:"end"},"getLabelPosition"),ts=O.append("g").attr("class","node-labels").attr("font-size",14),to=(0,r.K)(t=>ts.selectAll(t?`.${t}`:"text").data(H.nodes).join("text").attr("class",t??null).attr("x",t=>tr(t).x).attr("y",t=>(t.y1+t.y0)/2).attr("dy",`${G?"0":"0.35"}em`).attr("text-anchor",t=>tr(t).anchor).text(ti),"appendLabel");"outlined"===q?(to("sankey-label-bg"),to("sankey-label-fg")):to();let tl=O.append("g").attr("class","links").attr("fill","none").attr("stroke-opacity",.5).selectAll(".link").data(H.links).join("g").attr("class","link").style("mix-blend-mode","multiply"),ta=E?.linkColor??"gradient";if("gradient"===ta){let t=tl.append("linearGradient").attr("id",t=>(t.uid=B.next("linearGradient-")).id).attr("gradientUnits","userSpaceOnUse").attr("x1",t=>t.source.x1).attr("x2",t=>t.target.x0);t.append("stop").attr("offset","0%").attr("stop-color",t=>tn(t.source.id)),t.append("stop").attr("offset","100%").attr("stop-color",t=>tn(t.target.id))}switch(ta){case"gradient":v=(0,r.K)(t=>t.uid,"coloring");break;case"source":v=(0,r.K)(t=>tn(t.source.id),"coloring");break;case"target":v=(0,r.K)(t=>tn(t.target.id),"coloring");break;default:v=ta}tl.append("path").attr("d",(function(t){var e=I,n=T,i=A,r=M,s=null;function o(){var o,l=K.call(arguments),a=e.apply(this,l),h=n.apply(this,l);if(s||(s=o=w()),t(s,+i.apply(this,(l[0]=a,l)),+r.apply(this,l),+i.apply(this,(l[0]=h,l)),+r.apply(this,l)),o)return s=null,o+""||null}return o.source=function(t){return arguments.length?(e=t,o):e},o.target=function(t){return arguments.length?(n=t,o):n},o.x=function(t){return arguments.length?(i="function"==typeof t?t:L(+t),o):i},o.y=function(t){return arguments.length?(r="function"==typeof t?t:L(+t),o):r},o.context=function(t){return arguments.length?(s=null==t?null:t,o):s},o})(P).source($).target(N)).attr("stroke",v).attr("stroke-width",t=>Math.max(1,t.width)),(0,i.ot)(void 0,O,0,F)},"draw"),H=(0,r.K)(t=>t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g,"").replaceAll(/([\n\r])+/g,"\n").trim(),"prepareTextForParsing"),J=(0,r.K)(t=>`.label {
3
- font-family: ${t.fontFamily};
4
- }
5
-
6
- .node-labels {
7
- font-family: ${t.fontFamily};
8
- }
9
-
10
- /* Outlined label style - background stroke for better readability */
11
- .sankey-label-bg {
12
- stroke: ${t.mainBkg||t.background||"#fff"};
13
- stroke-width: 4px;
14
- stroke-linejoin: round;
15
- paint-order: stroke;
16
- }
17
-
18
- /* Foreground label text */
19
- .sankey-label-fg {
20
- fill: ${t.textColor};
21
- }
22
-
23
- /* Node styling */
24
- .node rect {
25
- shape-rendering: crispEdges;
26
- }
27
-
28
- /* Link styling */
29
- .link {
30
- fill: none;
31
- stroke-opacity: 0.5;
32
- mix-blend-mode: multiply;
33
- }
34
- `,"getStyles"),tt=C.parse.bind(C);C.parse=t=>tt(H(t));var te={styles:J,parser:C,db:q,renderer:{draw:Z}}}};
@@ -1 +0,0 @@
1
- export const __rspack_esm_id=3088;export const __rspack_esm_ids=[3088];export const __webpack_modules__={46755(e,n,r){r.d(n,{Zp:()=>nJ});var t,o,i,u=r(8058),a=r(12926),d=0,c=function(e){var n=++d;return(0,a.A)(e)+n},f=r(39142),s=r(65325),h=function(e){return(null==e?0:e.length)?(0,s.A)(e,1):[]},v=r(74722),g=Math.ceil,l=Math.max,p=function(e,n,r,t){for(var o=-1,i=l(g((n-e)/(r||1)),0),u=Array(i);i--;)u[t?i:++o]=e,e+=r;return u},A=r(66984),w=r(38446),b=r(25353),y=r(23149),m=function(e,n,r){if(!(0,y.A)(r))return!1;var t=typeof n;return("number"==t?!!((0,w.A)(r)&&(0,b.A)(n,r.length)):"string"==t&&n in r)&&(0,A.A)(r[n],e)},x=/\s/,k=function(e){for(var n=e.length;n--&&x.test(e.charAt(n)););return n},E=/^\s+/,O=r(61882),_=/^[-+]0x[0-9a-f]+$/i,j=/^0b[01]+$/i,P=/^0o[0-7]+$/i,N=parseInt,R=function(e){if("number"==typeof e)return e;if((0,O.A)(e))return 0/0;if((0,y.A)(e)){var n,r="function"==typeof e.valueOf?e.valueOf():e;e=(0,y.A)(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=(n=e)?n.slice(0,k(n)+1).replace(E,""):n;var t=j.test(e);return t||P.test(e)?N(e.slice(2),t?2:8):_.test(e)?0/0:+e},M=function(e){return e?1/0===(e=R(e))||-1/0===e?(e<0?-1:1)*17976931348623157e292:e==e?e:0:0===e?e:0},L=function(e,n,r){return r&&"number"!=typeof r&&m(e,n,r)&&(n=r=void 0),e=M(e),void 0===n?(n=e,e=0):n=M(n),r=void 0===r?e<n?1:-1:M(r),p(e,n,r,void 0)},C=r(697);class T{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,n=e._prev;if(n!==e)return G(n),n}enqueue(e){var n=this._sentinel;e._prev&&e._next&&G(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n}toString(){for(var e=[],n=this._sentinel,r=n._prev;r!==n;)e.push(JSON.stringify(r,S)),r=r._prev;return"["+e.join(", ")+"]"}}function G(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function S(e,n){if("_next"!==e&&"_prev"!==e)return n}var B=f.A(1);function q(e,n,r,t,o){var i=o?[]:void 0;return u.A(e.inEdges(t.v),function(t){var u=e.edge(t),a=e.node(t.v);o&&i.push({v:t.v,w:t.w}),a.out-=u,z(n,r,a)}),u.A(e.outEdges(t.v),function(t){var o=e.edge(t),i=t.w,u=e.node(i);u.in-=o,z(n,r,u)}),e.removeNode(t.v),i}function z(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var I=r(74743),D=r(52528),F=function(e,n,r){(void 0===r||(0,A.A)(e[n],r))&&(void 0!==r||n in e)||(0,D.A)(e,n,r)},V=r(62022),$=r(80154),J=r(1801),Z=r(39759),H=r(97648),K=r(58390),Q=r(92049),U=r(53533),W=r(91223),X=r(89610),Y=r(47627),ee=r(15647),en=r(53098),er=Object.prototype,et=Function.prototype.toString,eo=er.hasOwnProperty,ei=et.call(Object),eu=function(e){if(!(0,en.A)(e)||"[object Object]"!=(0,Y.A)(e))return!1;var n=(0,ee.A)(e);if(null===n)return!0;var r=eo.call(n,"constructor")&&n.constructor;return"function"==typeof r&&r instanceof r&&et.call(r)==ei},ea=r(96212),ed=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]},ec=r(22031),ef=r(29865),es=function(e,n,r,t,o,i,u){var a=ed(e,r),d=ed(n,r),c=u.get(d);if(c)return void F(e,r,c);var f=i?i(a,d,r+"",e,n,u):void 0,s=void 0===f;if(s){var h=(0,Q.A)(d),v=!h&&(0,W.A)(d),g=!h&&!v&&(0,ea.A)(d);(f=d,h||v||g)?(0,Q.A)(a)?f=a:(0,U.A)(a)?f=(0,Z.A)(a):v?(s=!1,f=(0,$.A)(d,!0)):g?(s=!1,f=(0,J.A)(d,!0)):f=[]:eu(d)||(0,K.A)(d)?(f=a,(0,K.A)(a))?f=(0,ec.A)(a,(0,ef.A)(a)):(!(0,y.A)(a)||(0,X.A)(a))&&(f=(0,H.A)(d)):s=!1}s&&(u.set(d,f),o(f,d,t,i,u),u.delete(d)),F(e,r,f)},eh=function e(n,r,t,o,i){n!==r&&(0,V.A)(r,function(u,a){if(i||(i=new I.A),(0,y.A)(u))es(n,r,a,t,e,o,i);else{var d=o?o(ed(n,a),u,a+"",n,r,i):void 0;void 0===d&&(d=u),F(n,a,d)}},ef.A)},ev=r(1945),eg=(t=function(e,n,r){eh(e,n,r)},(0,ev.A)(function(e,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,u=o>2?n[2]:void 0;for(i=t.length>3&&"function"==typeof i?(o--,i):void 0,u&&m(n[0],n[1],u)&&(i=o<3?void 0:i,o=1),e=Object(e);++r<o;){var a=n[r];a&&t(e,a,r)}return e})),el=r(66318),ep=r(52851),eA=r(46008),ew=r(30901),eb=function(e,n,r,t){if(!(0,y.A)(e))return e;n=(0,eA.A)(n,e);for(var o=-1,i=n.length,u=i-1,a=e;null!=a&&++o<i;){var d=(0,ew.A)(n[o]),c=r;if("__proto__"===d||"constructor"===d||"prototype"===d)break;if(o!=u){var f=a[d];void 0===(c=t?t(f,d,a):void 0)&&(c=(0,y.A)(f)?f:(0,b.A)(n[o+1])?[]:{})}(0,ep.A)(a,d,c),a=a[d]}return e},ey=function(e,n,r){for(var t=-1,o=n.length,i={};++t<o;){var u=n[t],a=(0,el.A)(e,u);r(a,u)&&eb(i,(0,eA.A)(u,e),a)}return i},em=r(30005),ex=r(22254),ek=r(88551),eE=(o=function(e,n){return null==e?{}:ey(e,n,function(n,r){return(0,em.A)(e,r)})},(0,ek.A)((0,ex.A)(o,void 0,h),o+"")),eO=Object.prototype,e_=eO.hasOwnProperty,ej=(0,ev.A)(function(e,n){e=Object(e);var r=-1,t=n.length,o=t>2?n[2]:void 0;for(o&&m(n[0],n[1],o)&&(t=1);++r<t;)for(var i=n[r],u=(0,ef.A)(i),a=-1,d=u.length;++a<d;){var c=u[a],f=e[c];(void 0===f||(0,A.A)(f,eO[c])&&!e_.call(e,c))&&(e[c]=i[c])}return e}),eP=function(e,n,r){for(var t=-1,o=e.length;++t<o;){var i=e[t],u=n(i);if(null!=u&&(void 0===a?u==u&&!(0,O.A)(u):r(u,a)))var a=u,d=i}return d},eN=function(e,n){return e>n},eR=r(29008),eM=function(e){return e&&e.length?eP(e,eR.A,eN):void 0},eL=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0},eC=r(79841),eT=r(24930),eG=function(e,n){var r={};return n=(0,eT.A)(n,3),(0,eC.A)(e,function(e,t,o){(0,D.A)(r,t,n(e,t,o))}),r},eS=r(69592),eB=function(e,n){return e<n},eq=function(e){return e&&e.length?eP(e,eR.A,eB):void 0},ez=Object.prototype.hasOwnProperty,eI=function(e,n){return null!=e&&ez.call(e,n)},eD=r(85054),eF=function(e,n){return null!=e&&(0,eD.A)(e,n,eI)},eV=r(41917),e$=function(){return eV.A.Date.now()};function eJ(e,n,r,t){var o;do o=c(t);while(e.hasNode(o))return r.dummy=n,e.setNode(o,r),o}function eZ(e){var n=new C.T({multigraph:e.isMultigraph()}).setGraph(e.graph());return u.A(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),u.A(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function eH(e,n){var r,t,o=e.x,i=e.y,u=n.x-o,a=n.y-i,d=e.width/2,c=e.height/2;if(!u&&!a)throw Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*d>Math.abs(u)*c?(a<0&&(c=-c),r=c*u/a,t=c):(u<0&&(d=-d),r=d,t=d*a/u),{x:o+r,y:i+t}}function eK(e){var n=v.A(L(eU(e)+1),function(){return[]});return u.A(e.nodes(),function(r){var t=e.node(r),o=t.rank;eS.A(o)||(n[o][t.order]=r)}),n}function eQ(e,n,r,t){var o={width:0,height:0};return arguments.length>=4&&(o.rank=r,o.order=t),eJ(e,"border",o,n)}function eU(e){return eM(v.A(e.nodes(),function(n){var r=e.node(n).rank;if(!eS.A(r))return r}))}function eW(e,n){var r=e$();try{return n()}finally{console.log(e+" time: "+(e$()-r)+"ms")}}function eX(e,n){return n()}function eY(e,n,r,t,o,i){var u=o[n][i-1],a=eJ(e,"border",{width:0,height:0,rank:i,borderType:n},r);o[n][i]=a,e.setParent(a,t),u&&e.setEdge(u,a,{weight:1})}function e0(e){u.A(e.nodes(),function(n){e1(e.node(n))}),u.A(e.edges(),function(n){e1(e.edge(n))})}function e1(e){var n=e.width;e.width=e.height,e.height=n}function e2(e){e.y=-e.y}function e5(e){var n=e.x;e.x=e.y,e.y=n}var e3=function(e,n){return e&&e.length?eP(e,(0,eT.A)(n,2),eB):void 0};function e8(e){var n={};u.A(e.sources(),function r(t){var o=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return o.rank;n[t]=!0;var i=eq(v.A(e.outEdges(t),function(n){return r(n.w)-e.edge(n).minlen}));return(1/0===i||null==i)&&(i=0),o.rank=i})}function e9(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function e4(e){var n,r,t,o,i=new C.T({directed:!1}),a=e.nodes()[0],d=e.nodeCount();for(i.setNode(a,{});n=i,r=e,u.A(n.nodes(),function e(t){u.A(r.nodeEdges(t),function(o){var i=o.v,u=t===i?o.w:i;n.hasNode(u)||e9(r,o)||(n.setNode(u,{}),n.setEdge(t,u,{}),e(u))})}),n.nodeCount()<d;)t=function(e,n){return e3(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return e9(n,r)})}(i,e),o=i.hasNode(t.v)?e9(e,t):-e9(e,t),function(e,n,r){u.A(e.nodes(),function(e){n.node(e).rank+=r})}(i,e,o);return i}var e6=r(27422),e7=r(25707),ne=function(e){var n=M(e),r=n%1;return n==n?r?n-r:n:0},nn=Math.max,nr=(i=function(e,n,r){var t=null==e?0:e.length;if(!t)return -1;var o=null==r?0:ne(r);return o<0&&(o=nn(t+o,0)),(0,e7.A)(e,(0,eT.A)(n,3),o)},function(e,n,r){var t=Object(e);if(!(0,w.A)(e)){var o=(0,eT.A)(n,3);e=(0,e6.A)(e),n=function(e){return o(t[e],e,t)}}var u=i(e,n,r);return u>-1?t[o?e[u]:u]:void 0}),nt=r(41629);f.A(1),f.A(1);var no=r(54418),ni=r(20351),nu=(0,r(70805).A)("length"),na=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),nd="\\ud800-\\udfff",nc="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",nf="\\ud83c[\\udffb-\\udfff]",ns="[^"+nd+"]",nh="(?:\\ud83c[\\udde6-\\uddff]){2}",nv="[\\ud800-\\udbff][\\udc00-\\udfff]",ng="(?:"+nc+"|"+nf+")?",nl="[\\ufe0e\\ufe0f]?",np="(?:\\u200d(?:"+[ns,nh,nv].join("|")+")"+nl+ng+")*",nA=RegExp(nf+"(?="+nf+")|"+("(?:"+[ns+nc+"?",nc,nh,nv,"["+nd+"]"].join("|"))+")"+(nl+ng+np),"g");function nw(){}function nb(e,n,r){Q.A(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],i={};return u.A(n,function(n){if(!e.hasNode(n))throw Error("Graph does not have node: "+n);!function e(n,r,t,o,i,a){!Object.prototype.hasOwnProperty.call(o,r)&&(o[r]=!0,t||a.push(r),u.A(i(r),function(r){e(n,r,t,o,i,a)}),t&&a.push(r))}(e,n,"post"===r,i,t,o)}),o}function ny(e){n=e,r=new C.T().setGraph(n.graph()),u.A(n.nodes(),function(e){r.setNode(e,n.node(e))}),u.A(n.edges(),function(e){var t=r.edge(e.v,e.w)||{weight:0,minlen:1},o=n.edge(e);r.setEdge(e.v,e.w,{weight:t.weight+o.weight,minlen:Math.max(t.minlen,o.minlen)})}),e8(e=r);var n,r,t,o,i=e4(e);for(nk(i),nm(i,e);t=nE(i);)o=nO(i,e,t),n_(i,e,t,o)}function nm(e,n){var r=nb(e,e.nodes(),"post");r=r.slice(0,r.length-1),u.A(r,function(r){var t,o,i,u;t=e,o=n,i=r,u=t.node(i).parent,t.edge(i,u).cutvalue=nx(t,o,i)})}function nx(e,n,r){var t=e.node(r).parent,o=!0,i=n.edge(r,t),a=0;return i||(o=!1,i=n.edge(t,r)),a=i.weight,u.A(n.nodeEdges(r),function(i){var u=i.v===r,d=u?i.w:i.v;if(d!==t){var c,f,s,h=u===o,v=n.edge(i).weight;if(a+=h?v:-v,c=e,f=r,s=d,c.hasEdge(f,s)){var g=e.edge(r,d).cutvalue;a+=h?-g:g}}}),a}function nk(e,n){arguments.length<2&&(n=e.nodes()[0]),function e(n,r,t,o,i){var a=t,d=n.node(o);return r[o]=!0,u.A(n.neighbors(o),function(i){Object.prototype.hasOwnProperty.call(r,i)||(t=e(n,r,t,i,o))}),d.low=a,d.lim=t++,i?d.parent=i:delete d.parent,t}(e,{},1,n)}function nE(e){return nr(e.edges(),function(n){return e.edge(n).cutvalue<0})}function nO(e,n,r){var t=r.v,o=r.w;n.hasEdge(t,o)||(t=r.w,o=r.v);var i=e.node(t),u=e.node(o),a=i,d=!1;return i.lim>u.lim&&(a=u,d=!0),e3(nt.A(n.edges(),function(n){return d===nj(e,e.node(n.v),a)&&d!==nj(e,e.node(n.w),a)}),function(e){return e9(n,e)})}function n_(e,n,r,t){var o,i,a,d,c=r.v,f=r.w;e.removeEdge(c,f),e.setEdge(t.v,t.w,{}),nk(e),nm(e,n),o=e,i=n,a=nr(o.nodes(),function(e){return!i.node(e).parent}),d=(d=nb(o,a,"pre")).slice(1),u.A(d,function(e){var n=o.node(e).parent,r=i.edge(e,n),t=!1;r||(r=i.edge(n,e),t=!0),i.node(e).rank=i.node(n).rank+(t?r.minlen:-r.minlen)})}function nj(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}nw.prototype=Error(),r(15219),ny.initLowLimValues=nk,ny.initCutValues=nm,ny.calcCutValue=nx,ny.leaveEdge=nE,ny.enterEdge=nO,ny.exchangeEdges=n_;var nP=r(74899),nN=r(6517),nR=r(63190),nM=function(e,n,r){for(var t=-1,o=e.length,i=n.length,u={};++t<o;){var a=t<i?n[t]:void 0;r(u,e[t],a)}return u},nL=r(45572),nC=r(52568),nT=function(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e},nG=r(52789),nS=function(e,n){if(e!==n){var r=void 0!==e,t=null===e,o=e==e,i=(0,O.A)(e),u=void 0!==n,a=null===n,d=n==n,c=(0,O.A)(n);if(!a&&!c&&!i&&e>n||i&&u&&d&&!a&&!c||t&&u&&d||!r&&d||!o)return 1;if(!t&&!i&&!c&&e<n||c&&r&&o&&!t&&!i||a&&r&&o||!u&&o||!d)return -1}return 0},nB=function(e,n,r){for(var t=-1,o=e.criteria,i=n.criteria,u=o.length,a=r.length;++t<u;){var d=nS(o[t],i[t]);if(d){if(t>=a)return d;return d*("desc"==r[t]?-1:1)}}return e.index-n.index},nq=function(e,n,r){n=n.length?(0,nL.A)(n,function(e){return(0,Q.A)(e)?function(n){return(0,el.A)(n,1===e.length?e[0]:e)}:e}):[eR.A];var t=-1;return n=(0,nL.A)(n,(0,nG.A)(eT.A)),nT((0,nC.A)(e,function(e,r,o){return{criteria:(0,nL.A)(n,function(n){return n(e)}),index:++t,value:e}}),function(e,n){return nB(e,n,r)})},nz=(0,ev.A)(function(e,n){if(null==e)return[];var r=n.length;return r>1&&m(e,n[0],n[1])?n=[]:r>2&&m(n[0],n[1],n[2])&&(n=[n[0]]),nq(e,(0,s.A)(n,1),[])});function nI(e,n,r){for(var t;n.length&&(t=eL(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function nD(e,n,r){return v.A(n,function(n){var t,o;return t=function(e){for(var n;e.hasNode(n=c("_root")););return n}(e),o=new C.T({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(n){return e.node(n)}),u.A(e.nodes(),function(i){var a=e.node(i),d=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,d||t),u.A(e[r](i),function(n){var r=n.v===i?n.w:n.v,t=o.edge(r,i),u=eS.A(t)?0:t.weight;o.setEdge(r,i,{weight:e.edge(n).weight+u})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),o})}function nF(e,n){u.A(n,function(n){u.A(n,function(n,r){e.node(n).order=r})})}var nV=r(99922);function n$(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0}),Object.defineProperty(e[n],r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function nJ(e,n){var r=n&&n.debugTiming?eW:eX;r("layout",()=>{var n=r(" buildLayoutGraph",()=>{var n,r,t;return n=e,r=new C.T({multigraph:!0,compound:!0}),t=n1(n.graph()),r.setGraph(eg({},nH,n0(t,nZ),eE(t,nK))),u.A(n.nodes(),function(e){var t=n1(n.node(e));r.setNode(e,ej(n0(t,nQ),nU)),r.setParent(e,n.parent(e))}),u.A(n.edges(),function(e){var t=n1(n.edge(e));r.setEdge(e,eg({},nX,n0(t,nW),eE(t,nY)))}),r});r(" runLayout",()=>{var e,t;return e=n,void((t=r)(" makeSpaceForEdgeLabels",()=>{var n,r;return r=(n=e).graph(),void(r.ranksep/=2,u.A(n.edges(),function(e){var t=n.edge(e);t.minlen*=2,"c"!==t.labelpos.toLowerCase()&&("TB"===r.rankdir||"BT"===r.rankdir?t.width+=t.labeloffset:t.height+=t.labeloffset)}))}),t(" removeSelfEdges",()=>{var n;return n=e,void u.A(n.edges(),function(e){if(e.v===e.w){var r=n.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:e,label:n.edge(e)}),n.removeEdge(e)}})}),t(" acyclic",()=>{var n,r,t,o,i,a;return n="greedy"===e.graph().acyclicer?function(e,n){if(1>=e.nodeCount())return[];var r,t,o,i,a,d,c,f=(r=e,t=n||B,o=new C.T,i=0,a=0,u.A(r.nodes(),function(e){o.setNode(e,{v:e,in:0,out:0})}),u.A(r.edges(),function(e){var n=o.edge(e.v,e.w)||0,r=t(e);o.setEdge(e.v,e.w,n+r),a=Math.max(a,o.node(e.v).out+=r),i=Math.max(i,o.node(e.w).in+=r)}),d=L(a+i+3).map(function(){return new T}),c=i+1,u.A(o.nodes(),function(e){z(d,c,o.node(e))}),{graph:o,buckets:d,zeroIdx:c}),s=function(e,n,r){for(var t,o=[],i=n[n.length-1],u=n[0];e.nodeCount();){for(;t=u.dequeue();)q(e,n,r,t);for(;t=i.dequeue();)q(e,n,r,t);if(e.nodeCount()){for(var a=n.length-2;a>0;--a)if(t=n[a].dequeue()){o=o.concat(q(e,n,r,t,!0));break}}}return o}(f.graph,f.buckets,f.zeroIdx);return h(v.A(s,function(n){return e.outEdges(n.v,n.w)}))}(e,(r=e,function(e){return r.edge(e).weight})):(t=e,o=[],i={},a={},u.A(t.nodes(),function e(n){Object.prototype.hasOwnProperty.call(a,n)||(a[n]=!0,i[n]=!0,u.A(t.outEdges(n),function(n){Object.prototype.hasOwnProperty.call(i,n.w)?o.push(n):e(n.w)}),delete i[n])}),o),void u.A(n,function(n){var r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,c("rev"))})}),t(" nestingGraph.run",()=>{var n,r,t,o,i,a,d,c;return n=eJ(e,"root",{},"_root"),a=e,d={},u.A(a.children(),function(e){!function e(n,r){var t=a.children(n);t&&t.length&&u.A(t,function(n){e(n,r+1)}),d[n]=r}(e,1)}),r=d,o=2*(t=eM(nP.A(r))-1)+1,e.graph().nestingRoot=n,u.A(e.edges(),function(n){e.edge(n).minlen*=o}),i=(c=e,nN.A(c.edges(),function(e,n){return e+c.edge(n).weight},0)+1),void(u.A(e.children(),function(a){!function e(n,r,t,o,i,a,d){var c=n.children(d);if(!c.length){d!==r&&n.setEdge(r,d,{weight:0,minlen:t});return}var f=eQ(n,"_bt"),s=eQ(n,"_bb"),h=n.node(d);n.setParent(f,d),h.borderTop=f,n.setParent(s,d),h.borderBottom=s,u.A(c,function(u){e(n,r,t,o,i,a,u);var c=n.node(u),h=c.borderTop?c.borderTop:u,v=c.borderBottom?c.borderBottom:u,g=c.borderTop?o:2*o,l=h!==v?1:i-a[d]+1;n.setEdge(f,h,{weight:g,minlen:l,nestingEdge:!0}),n.setEdge(v,s,{weight:g,minlen:l,nestingEdge:!0})}),n.parent(d)||n.setEdge(r,f,{weight:0,minlen:i+a[d]})}(e,n,o,i,t,r,a)}),e.graph().nodeRankFactor=o)}),t(" rank",()=>(function(e){switch(e.graph().ranker){case"network-simplex":default:ny(e);break;case"tight-tree":var n;e8(n=e),e4(n);break;case"longest-path":e8(e)}})(eZ(e))),t(" injectEdgeLabelProxies",()=>{var n;return n=e,void u.A(n.edges(),function(e){var r=n.edge(e);if(r.width&&r.height){var t=n.node(e.v),o={rank:(n.node(e.w).rank-t.rank)/2+t.rank,e:e};eJ(n,"edge-proxy",o,"_ep")}})}),t(" removeEmptyRanks",()=>{var n,r,t,o;return n=eq(v.A(e.nodes(),function(n){return e.node(n).rank})),r=[],u.A(e.nodes(),function(t){var o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)}),t=0,o=e.graph().nodeRankFactor,void u.A(r,function(n,r){eS.A(n)&&r%o!=0?--t:t&&u.A(n,function(n){e.node(n).rank+=t})})}),t(" nestingGraph.cleanup",()=>{var n;return n=e.graph(),void(e.removeNode(n.nestingRoot),delete n.nestingRoot,u.A(e.edges(),function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}),t(" normalizeRanks",()=>{var n;return n=eq(v.A(e.nodes(),function(n){return e.node(n).rank})),void u.A(e.nodes(),function(r){var t=e.node(r);eF(t,"rank")&&(t.rank-=n)})}),t(" assignRankMinMax",()=>{var n,r;return n=e,r=0,void(u.A(n.nodes(),function(e){var t=n.node(e);t.borderTop&&(t.minRank=n.node(t.borderTop).rank,t.maxRank=n.node(t.borderBottom).rank,r=eM(r,t.maxRank))}),n.graph().maxRank=r)}),t(" removeEdgeLabelProxies",()=>{var n;return n=e,void u.A(n.nodes(),function(e){var r=n.node(e);"edge-proxy"===r.dummy&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}),t(" normalize.run",()=>{e.graph().dummyChains=[],u.A(e.edges(),function(n){!function(e,n){var r,t,o=n.v,i=e.node(o).rank,u=n.w,a=e.node(u).rank,d=n.name,c=e.edge(n),f=c.labelRank;if(a!==i+1){e.removeEdge(n);var s=void 0;for(t=0,++i;i<a;++t,++i)c.points=[],r=eJ(e,"edge",s={width:0,height:0,edgeLabel:c,edgeObj:n,rank:i},"_d"),i===f&&(s.width=c.width,s.height=c.height,s.dummy="edge-label",s.labelpos=c.labelpos),e.setEdge(o,r,{weight:c.weight},d),0===t&&e.graph().dummyChains.push(r),o=r;e.setEdge(o,u,{weight:c.weight},d)}}(e,n)})}),t(" parentDummyChains",()=>{var n,r,t,o;return r=e,t={},o=0,u.A(r.children(),function e(n){var i=o;u.A(r.children(n),e),t[n]={low:i,lim:o++}}),n=t,void u.A(e.graph().dummyChains,function(r){for(var t=e.node(r),o=t.edgeObj,i=function(e,n,r,t){var o,i,u=[],a=[],d=Math.min(n[r].low,n[t].low),c=Math.max(n[r].lim,n[t].lim);o=r;do u.push(o=e.parent(o));while(o&&(n[o].low>d||c>n[o].lim))for(i=o,o=t;(o=e.parent(o))!==i;)a.push(o);return{path:u.concat(a.reverse()),lca:i}}(e,n,o.v,o.w),u=i.path,a=i.lca,d=0,c=u[0],f=!0;r!==o.w;){if(t=e.node(r),f){for(;(c=u[d])!==a&&e.node(c).maxRank<t.rank;)d++;c===a&&(f=!1)}if(!f){for(;d<u.length-1&&e.node(c=u[d+1]).minRank<=t.rank;)d++;c=u[d]}e.setParent(r,c),r=e.successors(r)[0]}})}),t(" addBorderSegments",()=>{u.A(e.children(),function n(r){var t=e.children(r),o=e.node(r);if(t.length&&u.A(t,n),Object.prototype.hasOwnProperty.call(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)eY(e,"borderLeft","_bl",r,o,i),eY(e,"borderRight","_br",r,o,i)}})}),t(" order",()=>(function(e){var n=eU(e),r=nD(e,L(1,n+1),"inEdges"),t=nD(e,L(n-1,-1,-1),"outEdges"),o=(i={},a=nt.A(e.nodes(),function(n){return!e.children(n).length}),d=eM(v.A(a,function(n){return e.node(n).rank})),c=v.A(L(d+1),function(){return[]}),f=nz(a,function(n){return e.node(n).rank}),u.A(f,function n(r){eF(i,r)||(i[r]=!0,c[e.node(r).rank].push(r),u.A(e.successors(r),n))}),c);nF(e,o);for(var i,a,d,c,f,s,g=1/0,l=0,p=0;p<4;++l,++p){(function(e,n){var r=new C.T;u.A(e,function(e){var t,o,i,a=e.graph().root,d=function e(n,r,t,o){var i,a,d,c,f,s,g,l,p,A,w,b,y=n.children(r),m=n.node(r),x=m?m.borderLeft:void 0,k=m?m.borderRight:void 0,E={};x&&(y=nt.A(y,function(e){return e!==x&&e!==k}));var O=(i=y,v.A(i,function(e){var r=n.inEdges(e);if(!r.length)return{v:e};var t=nN.A(r,function(e,r){var t=n.edge(r),o=n.node(r.v);return{sum:e.sum+t.weight*o.order,weight:e.weight+t.weight}},{sum:0,weight:0});return{v:e,barycenter:t.sum/t.weight,weight:t.weight}}));u.A(O,function(r){if(n.children(r.v).length){var i,u,a=e(n,r.v,t,o);E[r.v]=a,Object.prototype.hasOwnProperty.call(a,"barycenter")&&(i=r,u=a,eS.A(i.barycenter)?(i.barycenter=u.barycenter,i.weight=u.weight):(i.barycenter=(i.barycenter*i.weight+u.barycenter*u.weight)/(i.weight+u.weight),i.weight+=u.weight))}});var _=(a={},u.A(O,function(e,n){var r=a[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};eS.A(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),u.A(t.edges(),function(e){var n=a[e.v],r=a[e.w];eS.A(n)||eS.A(r)||(r.indegree++,n.out.push(a[e.w]))}),function(e){for(var n=[];e.length;){var r=e.pop();n.push(r),u.A(r.in.reverse(),function(e){return function(n){!n.merged&&(eS.A(n.barycenter)||eS.A(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}(r)),u.A(r.out,function(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}(r))}return v.A(nt.A(n,function(e){return!e.merged}),function(e){return eE(e,["vs","i","barycenter","weight"])})}(nt.A(a,function(e){return!e.indegree})));!function(e,n){u.A(e,function(e){e.vs=h(e.vs.map(function(e){return n[e]?n[e].vs:e}))})}(_,E);var j=(s=(d=function(e){return Object.prototype.hasOwnProperty.call(e,"barycenter")},c={lhs:[],rhs:[]},u.A(_,function(e){d(e)?c.lhs.push(e):c.rhs.push(e)}),f=c).lhs,g=nz(f.rhs,function(e){return-e.i}),l=[],p=0,A=0,w=0,s.sort(function(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}(!!o)),w=nI(l,g,w),u.A(s,function(e){w+=e.vs.length,l.push(e.vs),p+=e.barycenter*e.weight,A+=e.weight,w=nI(l,g,w)}),b={vs:h(l)},A&&(b.barycenter=p/A,b.weight=A),b);if(x&&(j.vs=h([x,j.vs,k]),n.predecessors(x).length)){var P=n.node(n.predecessors(x)[0]),N=n.node(n.predecessors(k)[0]);Object.prototype.hasOwnProperty.call(j,"barycenter")||(j.barycenter=0,j.weight=0),j.barycenter=(j.barycenter*j.weight+P.order+N.order)/(j.weight+2),j.weight+=2}return j}(e,a,r,n);u.A(d.vs,function(n,r){e.node(n).order=r}),t=d.vs,i={},u.A(t,function(n){for(var t,u,a=e.parent(n);a;){if((t=e.parent(a))?(u=i[t],i[t]=a):(u=o,o=a),u&&u!==a)return void r.setEdge(u,a);a=t}})})})(l%2?r:t,l%4>=2),o=eK(e);var A,w=function(e,n){for(var r=0,t=1;t<n.length;++t)r+=function(e,n,r){for(var t=nM(r||[],v.A(r,function(e,n){return n})||[],ep.A),o=h(v.A(n,function(n){return nz(v.A(e.outEdges(n),function(n){return{pos:t[n.w],weight:e.edge(n).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var a=2*i-1;i-=1;var d=v.A(Array(a),function(){return 0}),c=0;return u.A(o.forEach(function(e){var n=e.pos+i;d[n]+=e.weight;for(var r=0;n>0;)n%2&&(r+=d[n+1]),n=n-1>>1,d[n]+=e.weight;c+=e.weight*r})),c}(e,n[t-1],n[t]);return r}(e,o);w<g&&(p=0,A=o,s=(0,nR.A)(A,5),g=w)}nF(e,s)})(e)),t(" insertSelfEdges",()=>{var n,r;return r=eK(n=e),void u.A(r,function(e){var r=0;u.A(e,function(e,t){var o=n.node(e);o.order=t+r,u.A(o.selfEdges,function(e){eJ(n,"selfedge",{width:e.label.width,height:e.label.height,rank:o.rank,order:t+ ++r,e:e.e,label:e.label},"_se")}),delete o.selfEdges})})}),t(" adjustCoordinateSystem",()=>{var n;("lr"===(n=e.graph().rankdir.toLowerCase())||"rl"===n)&&e0(e)}),t(" position",()=>{var n,r,t,o,i,a,d,c,f,s,h,g,l,p,A,w,b;A=eK(p=n=eZ(n=e)),w=p.graph().ranksep,b=0,u.A(A,function(e){var n=eM(v.A(e,function(e){return p.node(e).height}));u.A(e,function(e){p.node(e).y=b+n/2}),b+=n+w}),o=eK(r=n),a=eg((i={},nN.A(o,function(e,n){var t=0,o=0,a=e.length,d=eL(n);return u.A(n,function(e,c){var f=function(e,n){if(e.node(n).dummy)return nr(e.predecessors(n),function(n){return e.node(n).dummy})}(r,e),s=f?r.node(f).order:a;(f||e===d)&&(u.A(n.slice(o,c+1),function(e){u.A(r.predecessors(e),function(n){var o=r.node(n),u=o.order;(u<t||s<u)&&!(o.dummy&&r.node(e).dummy)&&n$(i,n,e)})}),o=c+1,t=s)}),n}),i),function(e,n){var r={};function t(n,t,o,i,a){var d;u.A(L(t,o),function(t){d=n[t],e.node(d).dummy&&u.A(e.predecessors(d),function(n){var t=e.node(n);t.dummy&&(t.order<i||t.order>a)&&n$(r,n,d)})})}return nN.A(n,function(n,r){var o,i=-1,a=0;return u.A(r,function(u,d){if("border"===e.node(u).dummy){var c=e.predecessors(u);c.length&&(o=e.node(c[0]).order,t(r,a,d,i,o),a=d,i=o)}t(r,a,r.length,o,n.length)}),r}),r}(r,o)),d={},u.A(["u","d"],function(e){t="u"===e?o:nP.A(o).reverse(),u.A(["l","r"],function(n){"r"===n&&(t=v.A(t,function(e){return nP.A(e).reverse()}));var o,i,c,f,s=("u"===e?r.predecessors:r.successors).bind(r),h=(o=t,i={},c={},f={},u.A(o,function(e){u.A(e,function(e,n){i[e]=e,c[e]=e,f[e]=n})}),u.A(o,function(e){var n=-1;u.A(e,function(e){var r=s(e);if(r.length)for(var t=((r=nz(r,function(e){return f[e]})).length-1)/2,o=Math.floor(t),u=Math.ceil(t);o<=u;++o){var d=r[o];c[e]===e&&n<f[d]&&!function(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}(a,e,d)&&(c[d]=e,c[e]=i[e]=i[d],n=f[d])}})}),{root:i,align:c}),g=function(e,n,r,t,o){var i,a,d,c,f,s,h,v,g,l,p={},A=(i=e,a=n,d=r,c=o,v=new C.T,l=(f=(g=i.graph()).nodesep,s=g.edgesep,h=c,function(e,n,r){var t,o,i=e.node(n),u=e.node(r);if(t=0+i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":o=-i.width/2;break;case"r":o=i.width/2}if(o&&(t+=h?o:-o),o=0,t+=(i.dummy?s:f)/2,t+=(u.dummy?s:f)/2,t+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":o=u.width/2;break;case"r":o=-u.width/2}return o&&(t+=h?o:-o),o=0,t}),u.A(a,function(e){var n;u.A(e,function(e){var r=d[e];if(v.setNode(r),n){var t=d[n],o=v.edge(t,r);v.setEdge(t,r,Math.max(l(i,e,n),o||0))}n=e})}),v),w=o?"borderLeft":"borderRight";function b(e,n){for(var r=A.nodes(),t=r.pop(),o={};t;)o[t]?e(t):(o[t]=!0,r.push(t),r=r.concat(n(t))),t=r.pop()}return b(function(e){p[e]=A.inEdges(e).reduce(function(e,n){return Math.max(e,p[n.v]+A.edge(n))},0)},A.predecessors.bind(A)),b(function(n){var r=A.outEdges(n).reduce(function(e,n){return Math.min(e,p[n.w]-A.edge(n))},1/0),t=e.node(n);1/0!==r&&t.borderType!==w&&(p[n]=Math.max(p[n],r))},A.successors.bind(A)),u.A(t,function(e){p[e]=p[r[e]]}),p}(r,t,h.root,h.align,"r"===n);"r"===n&&(g=eG(g,function(e){return-e})),d[e+n]=g})}),c=e3(nP.A(d),function(e){var n,t=-1/0,o=1/0;return n=function(e,n){var i,u,a=(i=r,u=n,i.node(u).width/2);t=Math.max(e+a,t),o=Math.min(e-a,o)},null==e||(0,V.A)(e,(0,nV.A)(n),ef.A),t-o}),s=eq(f=nP.A(c)),h=eM(f),u.A(["u","d"],function(e){u.A(["l","r"],function(n){var r,t=e+n,o=d[t];if(o!==c){var i=nP.A(o);(r="l"===n?s-eq(i):h-eM(i))&&(d[t]=eG(o,function(e){return e+r}))}})}),g=r.graph().align,l=eG(d.ul,function(e,n){if(g)return d[g.toLowerCase()][n];var r=nz(v.A(d,n));return(r[1]+r[2])/2}),l&&(0,eC.A)(l,(0,nV.A)(function(e,r){n.node(r).x=e}))}),t(" positionSelfEdges",()=>{var n;return n=e,void u.A(n.nodes(),function(e){var r=n.node(e);if("selfedge"===r.dummy){var t=n.node(r.e.v),o=t.x+t.width/2,i=t.y,u=r.x-o,a=t.height/2;n.setEdge(r.e,r.label),n.removeNode(e),r.label.points=[{x:o+2*u/3,y:i-a},{x:o+5*u/6,y:i-a},{x:o+u,y:i},{x:o+5*u/6,y:i+a},{x:o+2*u/3,y:i+a}],r.label.x=r.x,r.label.y=r.y}})}),t(" removeBorderNodes",()=>{var n;return n=e,void(u.A(n.nodes(),function(e){if(n.children(e).length){var r=n.node(e),t=n.node(r.borderTop),o=n.node(r.borderBottom),i=n.node(eL(r.borderLeft)),u=n.node(eL(r.borderRight));r.width=Math.abs(u.x-i.x),r.height=Math.abs(o.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),u.A(n.nodes(),function(e){"border"===n.node(e).dummy&&n.removeNode(e)}))}),t(" normalize.undo",()=>{u.A(e.graph().dummyChains,function(n){var r,t=e.node(n),o=t.edgeLabel;for(e.setEdge(t.edgeObj,o);t.dummy;)r=e.successors(n)[0],e.removeNode(n),o.points.push({x:t.x,y:t.y}),"edge-label"===t.dummy&&(o.x=t.x,o.y=t.y,o.width=t.width,o.height=t.height),n=r,t=e.node(n)})}),t(" fixupEdgeLabelCoords",()=>{var n;return n=e,void u.A(n.edges(),function(e){var r=n.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}),t(" undoCoordinateSystem",()=>{var n,r,t;("bt"===(n=e.graph().rankdir.toLowerCase())||"rl"===n)&&(r=e,u.A(r.nodes(),function(e){e2(r.node(e))}),u.A(r.edges(),function(e){var n=r.edge(e);u.A(n.points,e2),Object.prototype.hasOwnProperty.call(n,"y")&&e2(n)})),("lr"===n||"rl"===n)&&(t=e,u.A(t.nodes(),function(e){e5(t.node(e))}),u.A(t.edges(),function(e){var n=t.edge(e);u.A(n.points,e5),Object.prototype.hasOwnProperty.call(n,"x")&&e5(n)}),e0(e))}),t(" translateGraph",()=>(function(e){var n=1/0,r=0,t=1/0,o=0,i=e.graph(),a=i.marginx||0,d=i.marginy||0;function c(e){var i=e.x,u=e.y,a=e.width,d=e.height;n=Math.min(n,i-a/2),r=Math.max(r,i+a/2),t=Math.min(t,u-d/2),o=Math.max(o,u+d/2)}u.A(e.nodes(),function(n){c(e.node(n))}),u.A(e.edges(),function(n){var r=e.edge(n);Object.prototype.hasOwnProperty.call(r,"x")&&c(r)}),n-=a,t-=d,u.A(e.nodes(),function(r){var o=e.node(r);o.x-=n,o.y-=t}),u.A(e.edges(),function(r){var o=e.edge(r);u.A(o.points,function(e){e.x-=n,e.y-=t}),Object.prototype.hasOwnProperty.call(o,"x")&&(o.x-=n),Object.prototype.hasOwnProperty.call(o,"y")&&(o.y-=t)}),i.width=r-n+a,i.height=o-t+d})(e)),t(" assignNodeIntersects",()=>{var n;return n=e,void u.A(n.edges(),function(e){var r,t,o=n.edge(e),i=n.node(e.v),u=n.node(e.w);o.points?(r=o.points[0],t=o.points[o.points.length-1]):(o.points=[],r=u,t=i),o.points.unshift(eH(i,r)),o.points.push(eH(u,t))})}),t(" reversePoints",()=>{var n;return n=e,void u.A(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}),t(" acyclic.undo",()=>{u.A(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}))}),r(" updateInputGraph",()=>{var r,t;return r=e,t=n,void(u.A(r.nodes(),function(e){var n=r.node(e),o=t.node(e);n&&(n.x=o.x,n.y=o.y,t.children(e).length&&(n.width=o.width,n.height=o.height))}),u.A(r.edges(),function(e){var n=r.edge(e),o=t.edge(e);n.points=o.points,Object.prototype.hasOwnProperty.call(o,"x")&&(n.x=o.x,n.y=o.y)}),r.graph().width=t.graph().width,r.graph().height=t.graph().height)})})}var nZ=["nodesep","edgesep","ranksep","marginx","marginy"],nH={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},nK=["acyclicer","ranker","rankdir","align"],nQ=["width","height"],nU={width:0,height:0},nW=["minlen","weight","width","height","labeloffset"],nX={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},nY=["labelpos"];function n0(e,n){return eG(eE(e,n),Number)}function n1(e){var n={};return u.A(e,function(e,r){n[r.toLowerCase()]=e}),n}}};
@@ -1 +0,0 @@
1
- export const __rspack_esm_id=3443;export const __rspack_esm_ids=[3443];export const __webpack_modules__={20206(e,_,s){var r=s(92275);s(51400),s.d(_,{createTreeViewServices:()=>r.I})}};