copilot-operator 0.1.53 → 0.1.55

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 (148) hide show
  1. package/README.md +6 -0
  2. package/dist/src/api/operator.controller.js +38 -0
  3. package/dist/src/api/operator.service.js +28 -4
  4. package/dist/src/orchestrator/hold.js +25 -0
  5. package/dist/src/orchestrator/leadLedger.js +88 -0
  6. package/dist/src/orchestrator/leadRunner.js +22 -0
  7. package/dist/src/orchestrator/taskRunner.js +10 -4
  8. package/dist/src/plan/kerrigan.js +2 -2
  9. package/dist/src/plan/systemGuide.js +157 -6
  10. package/dist/src/protocol/leadSchema.js +36 -2
  11. package/dist/src/session/store.js +3 -0
  12. package/dist/src/session/workspace.js +22 -0
  13. package/dist/src/session/workspaceSearch.js +162 -0
  14. package/dist/src/vcs/git.js +1 -1
  15. package/dist/web/404.html +2 -2
  16. package/dist/web/_next/static/chunks/1017.ce926873b598fb89.js +1 -0
  17. package/dist/web/_next/static/chunks/1077.3c07f38a61cef38a.js +1 -0
  18. package/dist/web/_next/static/chunks/12.06a7f14bd6716249.js +1 -0
  19. package/dist/web/_next/static/chunks/1350.a5dc706c8110fd34.js +24 -0
  20. package/dist/web/_next/static/chunks/1548.55dadf800d6c2a79.js +1 -0
  21. package/dist/web/_next/static/chunks/1706.db51b57351297898.js +309 -0
  22. package/dist/web/_next/static/chunks/1707.7d64ffc060c697a0.js +193 -0
  23. package/dist/web/_next/static/chunks/1880.87829ecb91209eda.js +24 -0
  24. package/dist/web/_next/static/chunks/20154aaa.28032c3aa5bcd84d.js +1 -0
  25. package/dist/web/_next/static/chunks/2037.d1bb5e37c7fe85ae.js +104 -0
  26. package/dist/web/_next/static/chunks/2163.83d1085b99ac1773.js +1 -0
  27. package/dist/web/_next/static/chunks/2398d077.79ae940919b9695e.js +1 -0
  28. package/dist/web/_next/static/chunks/2435.9b433b38d34b4b2e.js +1 -0
  29. package/dist/web/_next/static/chunks/2506.bc8515842e225d2a.js +1 -0
  30. package/dist/web/_next/static/chunks/2529.c88688b437d71d68.js +41 -0
  31. package/dist/web/_next/static/chunks/2908.4e0e875d2d471932.js +1 -0
  32. package/dist/web/_next/static/chunks/3117.a4e1c3348e8bead9.js +1 -0
  33. package/dist/web/_next/static/chunks/3131-8ec8b632ebf0450d.js +1 -0
  34. package/dist/web/_next/static/chunks/3134-b6a7bc1f267c39aa.js +1 -0
  35. package/dist/web/_next/static/chunks/3233.1dcc2798f7f5efa0.js +149 -0
  36. package/dist/web/_next/static/chunks/344.41cc997c8c8deeed.js +115 -0
  37. package/dist/web/_next/static/chunks/3690.f691d3fcbd70073d.js +1 -0
  38. package/dist/web/_next/static/chunks/3804.593b14643e74a2a1.js +1 -0
  39. package/dist/web/_next/static/chunks/3816.9f5568918e35e4ef.js +77 -0
  40. package/dist/web/_next/static/chunks/3859.f56f3c6ac4b74cf1.js +94 -0
  41. package/dist/web/_next/static/chunks/3976.11b159e82e0aa974.js +1 -0
  42. package/dist/web/_next/static/chunks/3986.d47ed4855773e6dd.js +1 -0
  43. package/dist/web/_next/static/chunks/441.172f3f581f0030d1.js +226 -0
  44. package/dist/web/_next/static/chunks/442.2e236a6c5c413bd9.js +1 -0
  45. package/dist/web/_next/static/chunks/4459.d6df347eb58fccd7.js +1 -0
  46. package/dist/web/_next/static/chunks/4619.ae3628373decf74f.js +34 -0
  47. package/dist/web/_next/static/chunks/4623.d5711a8d967e49f4.js +1 -0
  48. package/dist/web/_next/static/chunks/4670.6b811cc3f67a851c.js +62 -0
  49. package/dist/web/_next/static/chunks/4812.0af1380aa478f6d3.js +93 -0
  50. package/dist/web/_next/static/chunks/4969.4f7aff472cf938bf.js +1 -0
  51. package/dist/web/_next/static/chunks/5790.fe114d1a18741d62.js +86 -0
  52. package/dist/web/_next/static/chunks/603.4055460889ea24d8.js +1 -0
  53. package/dist/web/_next/static/chunks/6072.b4b359b24b1738d4.js +286 -0
  54. package/dist/web/_next/static/chunks/6230.8645bbed143793da.js +1 -0
  55. package/dist/web/_next/static/chunks/6260.6b5b5c9713d7133f.js +1 -0
  56. package/dist/web/_next/static/chunks/63b9f8e2.218fd437b256a7e4.js +1 -0
  57. package/dist/web/_next/static/chunks/6421.3ace3aefc3e7350e.js +1 -0
  58. package/dist/web/_next/static/chunks/6542.963ec591b5c2bc5a.js +1 -0
  59. package/dist/web/_next/static/chunks/6885.8fb8eeb9e792b515.js +1 -0
  60. package/dist/web/_next/static/chunks/6891.dd910309748ad46b.js +1 -0
  61. package/dist/web/_next/static/chunks/714.88c495053f62f187.js +1 -0
  62. package/dist/web/_next/static/chunks/7220.f1e8a10d52a7ee87.js +1 -0
  63. package/dist/web/_next/static/chunks/7307.39c27470a879fd0a.js +1 -0
  64. package/dist/web/_next/static/chunks/7333.04d0e45b223dadd4.js +32 -0
  65. package/dist/web/_next/static/chunks/7489.395193bf37b80884.js +1 -0
  66. package/dist/web/_next/static/chunks/7496.17282033df0e8794.js +148 -0
  67. package/dist/web/_next/static/chunks/7500-1353339f7e2eda10.js +1 -0
  68. package/dist/web/_next/static/chunks/7507.9fd648884587a7f3.js +287 -0
  69. package/dist/web/_next/static/chunks/76.f9c2aea58a61692f.js +1 -0
  70. package/dist/web/_next/static/chunks/7664.bd6265e6e94e1ecd.js +79 -0
  71. package/dist/web/_next/static/chunks/7872.9b08a88b7289949f.js +64 -0
  72. package/dist/web/_next/static/chunks/7921-56de379f7bdfbacf.js +1 -0
  73. package/dist/web/_next/static/chunks/795.710d39b80c9ae80c.js +1 -0
  74. package/dist/web/_next/static/chunks/8173.b82aa1855e641605.js +1 -0
  75. package/dist/web/_next/static/chunks/8216.b248ebe0af447347.js +8 -0
  76. package/dist/web/_next/static/chunks/82d3f3cb.23be11b749288234.js +62 -0
  77. package/dist/web/_next/static/chunks/8381.2d6783c030f8a913.js +27 -0
  78. package/dist/web/_next/static/chunks/85120a0e.ac16dccf0b8d73d3.js +66 -0
  79. package/dist/web/_next/static/chunks/8547.0a9997b67008c706.js +1 -0
  80. package/dist/web/_next/static/chunks/8584.b34930a6837344a6.js +1 -0
  81. package/dist/web/_next/static/chunks/8662.f2663643214caed1.js +38 -0
  82. package/dist/web/_next/static/chunks/8689.e564346c6e0d16be.js +1 -0
  83. package/dist/web/_next/static/chunks/9067.5651e8647cef053f.js +1 -0
  84. package/dist/web/_next/static/chunks/9125.8589db5ba200cbf1.js +1 -0
  85. package/dist/web/_next/static/chunks/9202.8dcf7e6a85cc3d36.js +1 -0
  86. package/dist/web/_next/static/chunks/9249.916a423ac8a07e76.js +1 -0
  87. package/dist/web/_next/static/chunks/9313.e4f6405d96375c40.js +92 -0
  88. package/dist/web/_next/static/chunks/937.6d8406b06135134f.js +1 -0
  89. package/dist/web/_next/static/chunks/9418.1e8f8e14bb5fe3ae.js +217 -0
  90. package/dist/web/_next/static/chunks/9591.fabd60bd0d10341c.js +1 -0
  91. package/dist/web/_next/static/chunks/972.db753db904050e48.js +23 -0
  92. package/dist/web/_next/static/chunks/9747.ad6b319cf12169ee.js +1 -0
  93. package/dist/web/_next/static/chunks/9763.da9015d4a1b533b9.js +36 -0
  94. package/dist/web/_next/static/chunks/9884.8712c5ed7b044ff2.js +1 -0
  95. package/dist/web/_next/static/chunks/9891.91a2c59fd073fd48.js +74 -0
  96. package/dist/web/_next/static/chunks/9984.cdabea5a592e42a1.js +1 -0
  97. package/dist/web/_next/static/chunks/a9ddb983.8bbb677720017a57.js +122 -0
  98. package/dist/web/_next/static/chunks/app/_not-found/page-1264c0db9665169c.js +1 -0
  99. package/dist/web/_next/static/chunks/app/defaults/page-ba24062a86d50e12.js +1 -0
  100. package/dist/web/_next/static/chunks/app/layout-46efb208d7c88648.js +1 -0
  101. package/dist/web/_next/static/chunks/app/page-07f80fd07281a230.js +1 -0
  102. package/dist/web/_next/static/chunks/app/system/page-825f53f14d16033d.js +1 -0
  103. package/dist/web/_next/static/chunks/c7879cf7-fabe25011515220e.js +1 -0
  104. package/dist/web/_next/static/chunks/c7ea4e13.9b71b5f026a1d6d4.js +1 -0
  105. package/dist/web/_next/static/chunks/f99cb6a2.3f570aeba3860608.js +160 -0
  106. package/dist/web/_next/static/chunks/framework-a8bf4d38dd23845f.js +1 -0
  107. package/dist/web/_next/static/chunks/main-app-f747f0f5ddb4213b.js +1 -0
  108. package/dist/web/_next/static/chunks/main-d3bbfb91b54fbcc3.js +1 -0
  109. package/dist/web/_next/static/chunks/pages/_app-5b348989bba3d570.js +1 -0
  110. package/dist/web/_next/static/chunks/pages/_error-cf88c6d2cc5868d7.js +1 -0
  111. package/dist/web/_next/static/chunks/webpack-ab0451ef95a8f52a.js +1 -0
  112. package/dist/web/_next/static/css/{06f314fa5fccd68d.css → 131c746a9d388eda.css} +1 -1
  113. package/dist/web/_next/static/{FGzV3mVZpXRCVjiw1diNu → w1xPyNasTvFr11R3F7HkS}/_buildManifest.js +1 -1
  114. package/dist/web/defaults.html +2 -2
  115. package/dist/web/defaults.txt +16 -16
  116. package/dist/web/index.html +3 -2
  117. package/dist/web/index.txt +16 -16
  118. package/dist/web/system.html +2 -2
  119. package/dist/web/system.txt +16 -16
  120. package/package.json +6 -2
  121. package/prompts/lead1.md +29 -5
  122. package/dist/web/_next/static/chunks/12.f1f4d35b52633e8d.js +0 -1
  123. package/dist/web/_next/static/chunks/131-bae98f790a541679.js +0 -1
  124. package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +0 -1
  125. package/dist/web/_next/static/chunks/163.980c5145848efbdf.js +0 -1
  126. package/dist/web/_next/static/chunks/220.447d1d8624d4644c.js +0 -1
  127. package/dist/web/_next/static/chunks/489.158bbe303a595fba.js +0 -1
  128. package/dist/web/_next/static/chunks/500-34d01f8d8d73eb2c.js +0 -1
  129. package/dist/web/_next/static/chunks/548.c6dfd1cb270f3c93.js +0 -1
  130. package/dist/web/_next/static/chunks/584.fc9e061dd4069406.js +0 -1
  131. package/dist/web/_next/static/chunks/67.1a3ca07919abce27.js +0 -1
  132. package/dist/web/_next/static/chunks/714.5b2e291a430adc9c.js +0 -1
  133. package/dist/web/_next/static/chunks/747.157732b5b3f3c435.js +0 -1
  134. package/dist/web/_next/static/chunks/77.d478a6f2eafe31e3.js +0 -1
  135. package/dist/web/_next/static/chunks/921-b2219533c5a6e38f.js +0 -1
  136. package/dist/web/_next/static/chunks/app/_not-found/page-0d0d8e7e62efca12.js +0 -1
  137. package/dist/web/_next/static/chunks/app/defaults/page-b7e4e94a55e65806.js +0 -1
  138. package/dist/web/_next/static/chunks/app/layout-2b3718748721c1ac.js +0 -1
  139. package/dist/web/_next/static/chunks/app/page-59b9867b52914a6c.js +0 -1
  140. package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +0 -1
  141. package/dist/web/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js +0 -1
  142. package/dist/web/_next/static/chunks/framework-9ac6a346bd42cedd.js +0 -1
  143. package/dist/web/_next/static/chunks/main-6be4444e2d667e41.js +0 -1
  144. package/dist/web/_next/static/chunks/main-app-e3a5f713ba31557e.js +0 -1
  145. package/dist/web/_next/static/chunks/pages/_app-32d20d5a04949d29.js +0 -1
  146. package/dist/web/_next/static/chunks/pages/_error-abbab53f25ea29b0.js +0 -1
  147. package/dist/web/_next/static/chunks/webpack-0c3cad1f3181d857.js +0 -1
  148. /package/dist/web/_next/static/{FGzV3mVZpXRCVjiw1diNu → w1xPyNasTvFr11R3F7HkS}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6543],{63610:(e,t,n)=>{n.r(t),n.d(t,{render:()=>t3});var r=n(88547),o=n(53117);n(14637),n(4461),n(11152),n(63570),n(7103),n(56960),n(23810),n(23742),n(73607),n(97562);var l=n(13318),i=n(36744);function a(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(!1===n)return;let o=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}));(0,r.Z)(t.groups.edgePaths,o,{enabled:!0,jumpRadius:6,jumpStyle:"gap"===n?"gap":"arc"})}(0,i.K)(a,"applySwimlaneLineJumps");var s="__swimlane_default__";function f(e){return Math.max(e.padding??20,20)}function d(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;if(s<=i)return void delete e.groupTitleRect;e.groupTitleRect={left:t-r/2,right:t+r/2,top:i,bottom:s}}function u(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===s);for(let l of(o?o.isGroup&&(o.shape="swimlane",t&&(o.direction=t)):(o={id:s,label:"",isGroup:!0,shape:"swimlane",padding:20,look:e.config?.look,colorIndex:n.reduce((e,t)=>Math.max(e,t.colorIndex??-1),-1)+1,...t?{direction:t}:{}},n.push(o)),r))l.parentId=s}function h(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 g(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 u=o.nodes??[],h=new Map,g=[];for(let e of u){if(!e?.isGroup)continue;e.parentId||g.push(e);let t=u.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(r===1/0||l===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=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,h.set(e.id,{minX:r,maxX:o,minY:l,maxY:i})}}if(g.length>0&&h.size>0){let e=1/0,t=-1/0,n=0;for(let r of g){let o=r.padding??20;o>n&&(n=o);let l=h.get(r.id);l&&(e=Math.min(e,l.minY),t=Math.max(t,l.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),o=(e+t)/2;for(let t of g)t.y=o,t.height=r,t.swimlaneContentTop=e;let l=[...g].sort((e,t)=>(e.x??0)-(t.x??0)),i=[],a=[],s=[];for(let e of l){let t=h.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 u=i.length;if(u>0){let e=new Map;if(1===u)e.set(i[0],s[0]);else{let t=[];for(let e=0;e<u-1;e++)t.push(a[e+1]-a[e]);let n=Array(u);n[0]=0;for(let e=0;e<u-1;e++)n[e+1]=2*t[e]-n[e];let r=0,o=1/0;for(let e=0;e<u;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<u;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 g){let n=e.get(t.id);null!=n&&(t.width=n),d(t)}}}}}function c(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,i=o.end?r.get(o.end):void 0;if(!e||!i){l.R.warn("[EdgeLabelNodes]",`Edge ${o.id} has missing source or target node`);continue}let a=`edge-label-${o.start}-${o.end}-${o.id}`,s=e.parentId!==i.parentId?i.parentId:e.parentId,f={id:a,label:o.label,edgeStart:o.start??"",edgeEnd:o.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:s,isGroup:!1,labelStyle:Array.isArray(o.labelStyle)?o.labelStyle[0]:o.labelStyle??"",...e.dir?{dir:e.dir}:{}};t.push(f),o.labelNodeId=a,o.label=void 0,o.text=void 0;let d={id:`${o.id}-to-label`,start:o.start,end:a,type:"normal",isLayoutOnly:!0},u={id:`${o.id}-from-label`,start:a,end:o.end,type:"normal",isLayoutOnly:!0};n.push(d,u)}let o=[...e.nodes,...t],i=[...e.edges,...n];return{...e,nodes:o,edges:i}}function x(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:E(t,n,r,o)}:void 0}function p(e){if(e.isGroup)return;let t=x(e);if(t)return{id:String(e.id??""),cx:t.cx,cy:t.cy,rect:t.rect}}function m(e,t,n=.001){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function y(e,t,n=.001){return Math.abs(e.x-t.x)<n}function b(e,t,n=.001){return Math.abs(e.y-t.y)<n}function M(e,t,n=.001){return b(e,t,n)&&Math.abs(e.x-t.x)>n}function K(e,t,n=.001){return y(e,t,n)&&Math.abs(e.y-t.y)>n}function I(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 S(e,t,n=.001){return e.horizontal&&t.horizontal&&b(e.a,t.a,n)?I(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&y(e.a,t.a,n)?I(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=M(o,l,t),a=K(o,l,t);(i||a)&&n.push({index:r,a:o,b:l,horizontal:i,vertical:a})}return n}function v(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 C(e,t=.001){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;e&&m(e,r,t)||n.push({x:r.x,y:r.y})}return n}function L(e,t=.001){if(!e||4!==e.length)return;let[n,r,o,l]=e;return M(n,r,t)&&K(r,o,t)&&M(o,l,t)?{kind:"HVH",p0:n,p1:r,p2:o,p3:l}:K(n,r,t)&&M(r,o,t)&&K(o,l,t)?{kind:"VHV",p0:n,p1:r,p2:o,p3:l}:void 0}function k(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 T(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 O(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}function R(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}function F(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}function E(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}function $(e){return x(e)?.rect}function N(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 B(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(b(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(b(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(y(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(y(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 A(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 X(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=p(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}function z(e){let t=[],n=[];for(let r of e){let e=p(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 Y(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,...E(e,o,l,i)})}return n}function G(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 P(e,t,n,r=[],o=0){for(let l of n)if(!r.includes(l.id)&&k(e,t,l.rect,-o))return!0;return!1}function D(e,t,n,r,o=.001,l=1e-6){let i=b(e,t,o),a=y(e,t,o),s=b(n,r,o),f=y(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),x=u.a.x,p=Math.min(u.a.y,u.b.y),m=Math.max(u.a.y,u.b.y);if(x<g||x>c||h<p||h>m)return!1;let M=Math.abs(x-d.a.x)<l&&Math.abs(h-d.a.y)<l||Math.abs(x-d.b.x)<l&&Math.abs(h-d.b.y)<l,K=Math.abs(x-u.a.x)<l&&Math.abs(h-u.a.y)<l||Math.abs(x-u.b.x)<l&&Math.abs(h-u.b.y)<l;return!(M&&K)}function _(e,t,n,r,o=.001){let l=b(e,t,o),i=y(e,t,o),a=b(n,r,o),s=y(n,r,o);return i&&s&&y(e,n,o)?I(e.y,t.y,n.y,r.y)>o:!!(l&&a&&b(e,n,o))&&I(e.x,t.x,n.x,r.x)>o}function H(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&&m(i,a,o))&&(D(e,t,i,a,o)||_(e,t,i,a,o)))return!0}}return!1}function j(e,t,n,r,o=.001){let l=b(e,t,o),i=y(e,t,o),a=b(n,r,o),s=y(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,x=Math.min(d.a.y,d.b.y),p=Math.max(d.a.y,d.b.y);return c>h+o&&c<g-o&&u>x+o&&u<p-o}function V(e,t,n){let r=Math.min(t,n),o=Math.max(t,n);return e>r+.001&&e<o-.001}function U(e,t,n){return y(e,t)&&y(t,n)?V(t.y,e.y,n.y):!!(b(e,t)&&b(t,n))&&V(t.x,e.x,n.x)}function W(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(m(o,i)){r++,t=!0;continue}if(U(o,l,i)){t=!0;continue}}n.push(l)}return{points:n,changed:t}}function Z(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],o=e[n];if(!y(r,o)&&!b(r,o)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&y(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&&m(t,e)||n.push(e)}return n}function q(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=W(t);if(t=e.points,!e.changed)break}return t}function J(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?$(r):void 0,dstRect:o?$(o):void 0}}function Q(e,t,n){if(b(e,t,.001))return{x:e.x<n.left?n.left:n.right,y:e.y};if(y(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 ee(e,t,n){let r=n?1:-1,o=n?0:e.length-1;for(;o>=0&&o<e.length&&T(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=Q(e[o],e[l],t);return n?[i,...e.slice(o)]:[...e.slice(0,o+1),i]}function et(e,t){for(let n of e){let e=J(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=ee(r,e.srcRect,!0)),e.dstRect&&(r=ee(r,e.dstRect,!1)),r=eh(r=q(Z(r)),e.srcRect,e.dstRect),e.edge.points=q(Z(r))}}function en(e,t,n,r=!1){if(b(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(y(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 er(e,t,n){let r=e[t];for(let o=t+n;o>=0&&o<e.length;o+=n){let t=e[o];if(!m(t,r,.001))return t}return e[t+n]}function eo(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 el(e,t,n){let{lo:r,hi:o}=eo(t,n);return Math.min(o,Math.max(r,e))}function ei(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 ea(e,t){return"left"===t||"right"===t?eo(e.top,e.bottom):eo(e.left,e.right)}function es(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(b(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(y(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 ed(e,t,n,r,o){let l=[],i=n?es(e,t,n):void 0,a=r?es(t,e,r):void 0;return n&&i&&ef(i)===o&&l.push(ea(n,i)),r&&a&&ef(a)===o&&l.push(ea(r,a)),l.length>0?ei(l):void 0}function eu(e,t,n,r,o){let l=ed(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 eh(e,t,n){if(2!==e.length)return e;let[r,o]=e;return b(r,o,.001)?eu(r,o,t,n,!0)??e:y(r,o,.001)?eu(r,o,t,n,!1)??e:e}function eg(e,t,n){return ef(n)?{x:e.x,y:el(e.y,t.top,t.bottom)}:{x:el(e.x,t.left,t.right),y:e.y}}function ec(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&&!b(t,r,.001)||!l&&!y(t,r,.001))break;l?i[a].y=o.y:i[a].x=o.x}return i}function ex(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,o=n?1:-1,l=e[r],i=er(e,r,o);if(!i)return e;let a=es(l,i,t);if(!a)return e;let s=ef(a),f=eg(l,t,a);return m(l,f,.001)?e:ec(e,r,o,l,f,s)}function ep(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 em(e,t,n,r){switch(e){case"top":return y(t,n,.001)&&n.y<r.top-.001;case"bottom":return y(t,n,.001)&&n.y>r.bottom+.001;case"left":return b(t,n,.001)&&n.x<r.left-.001;case"right":return b(t,n,.001)&&n.x>r.right+.001}}function ey(e,t,n){if(e.length<3)return e;if(n){let n=ep(e[0],e[1],t);return n&&em(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,o=ep(e[r-1],e[r],t);return o&&em(o,e[r-1],e[r-2],t)?e.slice(0,r):e}function eb(e,t,n){let r=e;if(t){let e=er(r,0,1);if(e){let n=en(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=ey(r,t,!0)}if(n){let e=r.length-1,t=er(r,e,-1);if(t){let o=en(t,r[e],n,!0);o!==r[e]&&(r=[...r.slice(0,e),o])}r=ey(r,n,!1)}let o=eh(r,t,n);return o!==r||2===r.length?o:(t&&(r=ex(r,t,!0)),n&&(r=ex(r,n,!1)),r)}function eM(e,t){for(let n of e){let e=J(n,t,2);if(!e)continue;let r=eb(C(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 eK(e){return new Map(e.map(e=>[e.id,e]))}function eI(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 eS(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 t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:o}}function ev(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 eC(e){let t=eK(e);for(let n of e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>eS(n,t)-eS(e,t))){let t=ew(e.filter(e=>e.parentId===n.id));t&&ev(n,t)}}function eL(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup),l=1/0,a=-1/0;for(let e of o){let n=e[t];"number"==typeof n&&(l=Math.min(l,n),a=Math.max(a,n))}if(!Number.isFinite(l)||!Number.isFinite(a))return!1;let s=(0,i.K)(e=>l+a-e,"mirror");for(let e of n){let n=e[t];"number"==typeof n&&(e[t]=s(n));let r=e.groupTitleRect;r&&(e.groupTitleRect="x"===t?{...r,left:s(r.right),right:s(r.left)}:{...r,top:s(r.bottom),bottom:s(r.top)})}for(let e of r)for(let n of e.points??[])n[t]=s(n[t]);return!0}function ek(e){return!(e.nodes??[]).some(e=>!e.isGroup)||eL(e,"y")}function eT(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}eC(n);let h=n.filter(e=>e.isGroup&&!e.parentId);if(0===h.length)return"RL"===t&&eL(e,"x"),!0;let g=eK(n),c=new Map;for(let e of n){if(e.isGroup)continue;let t=eI(e,g);if(!t)continue;let n=c.get(t)??[];n.push(e),c.set(t,n)}let x=0;for(let e of h){let t=e.padding??0;t>x&&(x=t)}let p=[],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),p.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(m===1/0||y===-1/0)return!0;let b=Math.max(0,y-m)+2*Math.max(x,10),M=36+b,K=(m+y)/2-b/2-36,I=K+M/2,S=Math.max(x,36);p.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<p.length;e++){let t,n,r=p[e];if(t=0===e?r.contentTop-S:(p[e-1].contentBottom+r.contentTop)/2,e===p.length-1)n=r.contentBottom+S;else{let t=p[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&&eL(e,"x"),!0}(0,i.K)(f,"topLaneHorizontalPadding"),(0,i.K)(d,"assignTopLaneTitleRect"),(0,i.K)(u,"prepareLayoutForSwimlanes"),(0,i.K)(h,"toGraphView"),(0,i.K)(g,"writeBackToLayoutData"),(0,i.K)(c,"createEdgeLabelNodes"),(0,i.K)(x,"measuredNodeRect"),(0,i.K)(p,"nodeBoundsInfoFor"),(0,i.K)(m,"samePoint"),(0,i.K)(y,"sameX"),(0,i.K)(b,"sameY"),(0,i.K)(M,"isHorizontalSegment"),(0,i.K)(K,"isVerticalSegment"),(0,i.K)(I,"overlapLength"),(0,i.K)(S,"sameAxisSegmentOverlapLength"),(0,i.K)(w,"orthogonalSegmentsForPoints"),(0,i.K)(v,"countOrthogonalBends"),(0,i.K)(C,"dedupeConsecutivePoints"),(0,i.K)(L,"classifyThreeSegmentRoute"),(0,i.K)(k,"segmentBoundsOverlapRect"),(0,i.K)(T,"pointInsideRect"),(0,i.K)(O,"rectContainsRect"),(0,i.K)(R,"rectsOverlap"),(0,i.K)(F,"inflateRect"),(0,i.K)(E,"rectFromCenterSize"),(0,i.K)($,"rectOfNodeBounds"),(0,i.K)(N,"portForRectSide"),(0,i.K)(B,"buildOrthogonalPortPath"),(0,i.K)(A,"buildSameSideTrackPath"),(0,i.K)(X,"collectRealNodeBounds"),(0,i.K)(z,"collectNodeRectEntries"),(0,i.K)(Y,"collectLayoutNodeRects"),(0,i.K)(G,"getNodePairGeometry"),(0,i.K)(P,"segmentHitsAnyRect"),(0,i.K)(D,"orthogonalSegmentsCross"),(0,i.K)(_,"sameAxisSegmentsOverlap"),(0,i.K)(H,"segmentConflictsWithAnyEdge"),(0,i.K)(j,"orthogonalSegmentsStrictlyCross"),(0,i.K)(V,"strictlyBetween"),(0,i.K)(U,"isCollinearIntermediate"),(0,i.K)(W,"simplifyPolylineOnce"),(0,i.K)(Z,"orthogonalizePolyline"),(0,i.K)(q,"simplifyPolyline"),(0,i.K)(J,"endpointContextFor"),(0,i.K)(Q,"segmentEnterPoint"),(0,i.K)(ee,"clipEndpoint"),(0,i.K)(et,"clipEdgeEndpointsToNodeBoundaries"),(0,i.K)(en,"snapEndpointToBoundary"),(0,i.K)(er,"firstDistinctAdjacent"),(0,i.K)(eo,"cornerClearanceRange"),(0,i.K)(el,"clampToCornerClearance"),(0,i.K)(ei,"intersectRanges"),(0,i.K)(ea,"clearanceRangeForSide"),(0,i.K)(es,"terminalSideForSegment"),(0,i.K)(ef,"isHorizontalSide"),(0,i.K)(ed,"straightClearanceRange"),(0,i.K)(eu,"clearStraightEndpointCornerAxis"),(0,i.K)(eh,"clearStraightEndpointCornerConnections"),(0,i.K)(eg,"cornerClearedEndpoint"),(0,i.K)(ec,"moveCollinearEndpointRun"),(0,i.K)(ex,"clearEndpointCornerConnection"),(0,i.K)(ep,"borderSideForSegment"),(0,i.K)(em,"leavesOutward"),(0,i.K)(ey,"collapseOwnBorderStub"),(0,i.K)(eb,"snapAndCollapseEndpoints"),(0,i.K)(eM,"prepareEdgeEndpointsForRenderer"),(0,i.K)(eK,"buildNodeMap"),(0,i.K)(eI,"resolveTopLevelGroupId"),(0,i.K)(eS,"groupDepth"),(0,i.K)(ew,"boundsForChildren"),(0,i.K)(ev,"applyGroupBounds"),(0,i.K)(eC,"recomputeNestedGroupBounds"),(0,i.K)(eL,"mirrorAxis"),(0,i.K)(ek,"applyBtDirectionTransform"),(0,i.K)(eT,"applyLrDirectionTransform");var eO=[0,8,-8,16,-16];function eR(e,t){let{nodeInfoById:n,realNodeRects:r}=X(t);for(let t of e){let o;if(t.isLayoutOnly)continue;let l=t.points;if(!l||l.length<4)continue;let i=L(C(l,1e-6),1e-6);if(!i)continue;let{p3:a}=i,s="HVH"===i.kind,f=G(t,n,1e-6);if(!f)continue;let{srcId:d,dstId:u,srcInfo:h,dstInfo:g,collinearX:c,collinearY:x}=f;if(c||x)continue;let p=h.rect;for(let n of eO){let l,i,f;if(s){let e=g.cy>h.cy?p.bottom:p.top,t=h.cx+n;if(t<=p.left+1e-6||t>=p.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?p.right:p.left,t=h.cy+n;if(t<=p.top+1e-6||t>=p.bottom-1e-6)continue;l={x:e,y:t},i={x:a.x,y:t},f={x:a.x,y:a.y}}let c=m(l,i,1e-6),x=m(i,f,1e-6);if(c&&x||!c&&P(l,i,r,[d],1)||!x&&P(i,f,r,[u],1))continue;let y=!c&&H(l,i,e,t,{epsilon:1e-6,skipDegenerateOther:!0}),b=!x&&H(i,f,e,t,{epsilon:1e-6,skipDegenerateOther:!0});if(!y&&!b){o=c?[i,f]:x?[l,i]:[l,i,f];break}}o&&(t.points=o)}}function eF(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values());for(let o of e){let l,a;if(o.isLayoutOnly)continue;let s=o.points;if(!s||s.length<4)continue;let f=C(s,.001);if(f.length<4)continue;let d=f.length-1,u=f[d],h=f[d-1],g=f[d-2],c=Math.hypot(u.x-h.x,u.y-h.y);if(c>=10||c<.001)continue;let x=h.x-g.x,p=h.y-g.y;if(.001>Math.hypot(x,p))continue;let m=M(h,u,.001),I=K(h,u,.001),S=M(g,h,.001),w=K(g,h,.001);if(!(m&&w||I&&S))continue;let v=o.end,L=o.start,k=v?t.get(v):void 0;if(!k)continue;let O=k.x??0,R=k.y??0,F=$(k);if(!F)continue;if(w){let e=p<0;l={x:O,y:g.y},a={x:O,y:e?F.bottom:F.top}}else{let e=x>0;l={x:g.x,y:R},a={x:e?F.right:F.left,y:R}}if(P(l,a,n,v?[v]:[],-2)||P(l,a,r,[],-2))continue;if(L){let e=t.get(L),n=e?$(e):void 0;if(n&&T(l,n,2))continue}let E=(0,i.K)((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,"ownSegmentKey"),N=new Set;for(let e=0;e<f.length-1;e++)N.add(E(f[e],f[e+1]));let B=(0,i.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(!N.has(E(o,l))&&j(t,n,o,l,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(B(l,a))continue;if(d-3>=0){let e=f[d-3];if(P(e,l,n,[L,v].filter(e=>!!e),-2)||B(e,l))continue}let A=[...f.slice(0,d-2),l,a];o.points=A;let X=o.labelNodeId;if(X){let e=t.get(X);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<A.length-1;e++){let i=A[e],a=A[e+1],s=Math.hypot(a.x-i.x,a.y-i.y),f=b(i,a,.001),d=y(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,i.K)(eR,"portSwapToLShape"),(0,i.K)(eF,"collapseShortTerminalStub");var eE=(0,i.K)(e=>"string"==typeof e?e.toUpperCase():"","upperCaseDirection"),e$=(0,i.K)((e,t)=>y(e,t,.001)||b(e,t,.001),"orthogonallyAligned");function eN(e,t){let n=(0,i.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,i.K)((e,r)=>{let o=C(e.points??[]);if(o.length<2)return;let l=r?e.start:e.end,i=l?t.get(l):void 0,a=i?$(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(e$(f,d)&&(u=f),y(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}:b(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,i.K)((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),"projectedOverlapLength"),l=(0,i.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))&&y(e.boundary,t.boundary,1):(1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom))&&b(e.boundary,t.boundary,1)),"sameTerminalFace"),a=(0,i.K)((e,t)=>e.nodeId===t.nodeId&&e.orientation===t.orientation&&o(e,t)>=8&&.5>Math.abs(e.coord-t.coord),"exactTerminalLaneConflict"),s=(0,i.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"),f=(0,i.K)((e,t)=>{let n=C(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,i.K)(()=>1>Math.abs(e.boundary.y-e.rect.top)||1>Math.abs(e.boundary.y-e.rect.bottom)?b(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))&&y(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&&m(n[1],e.railEnd,.001),l=n.slice(t?2:1),i=l[0];if(i&&!e$(i,o))return;return[r,o,...l]}let l=n.length>1&&m(n[n.length-2],e.railEnd,.001),a=n.slice(0,l?-2:-1),s=a[a.length-1];if(!s||e$(s,o))return[...a,o,r]},"shiftedCandidate"),d=(0,i.K)(e=>{let n=e.edge,r=C(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 b(h,g,.001)&&1>Math.abs(f-u)&&Math.abs(s-d)>1||y(h,g,.001)&&1>Math.abs(s-d)&&Math.abs(f-u)>1},"laneIsStraightCollinearConnector"),u=[-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],i=t[o];if(l.edge===i.edge||!(a(l,i)||s(l,i)))continue;let h=!a(l,i);for(let e of[l,i].sort((e,t)=>{let n=d(e),r=d(t);return n!==r?Number(n)-Number(r):Number(!t.atStart)-Number(!e.atStart)})){for(let o of u){let l=f(e,o);if(!l)continue;let i=r({...e.edge,points:l},e.atStart);if(!(!i||t.some(t=>t.edge!==e.edge&&(a(i,t)||h&&s(i,t))))){e.edge.points=l,n=!0;break}}if(n)break}}if(!n)return}}function eB(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=(0,i.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(P(e.a,e.b,n,s,-2)||P(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(C(e)))if(S(t,n,.5)>=8||j(t.a,t.b,n.a,n.b,.001))return!1}}return!0},"candidateIsSafe"),l=(0,i.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=M(n,r)&&K(r,o)&&M(o,l)&&K(l,i)&&y(n,l,.001)&&y(n,i,.001)&&y(r,o,.001)&&(r.x-n.x)*(l.x-o.x)<0,s=K(n,r)&&M(r,o)&&K(o,l)&&M(l,i)&&b(n,l,.001)&&b(n,i,.001)&&b(r,o,.001)&&(r.y-n.y)*(l.y-o.y)<0;if(a||s)return C([...e.slice(0,t+1),i,...e.slice(t+5)]);if(t+5>=e.length)return;let f=e[t+5],d=K(n,r)&&M(r,o)&&K(o,l)&&M(l,i)&&K(i,f)&&y(n,i,.001)&&y(n,f,.001)&&y(o,l,.001)&&(o.x-r.x)*(i.x-l.x)<0,u=M(n,r)&&K(r,o)&&M(o,l)&&K(l,i)&&M(i,f)&&b(n,i,.001)&&b(n,f,.001)&&b(o,l,.001)&&(o.y-r.y)*(i.y-l.y)<0;if(d||u)return C([...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=C(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 eA(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>C(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.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)j(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),s=(0,i.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"),f=(0,i.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?I(t.a.x,t.b.x,n.left,n.right)>=8&&t.a.y>=n.top-2&&t.a.y<=n.bottom+2:I(t.a.y,t.b.y,n.top,n.bottom)>=8&&t.a.x>=n.left-2&&t.a.x<=n.right+2})},"blockingRectsFor"),d=(0,i.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=q(C(r));return w(o).length===o.length-1?o:void 0},"candidateByMovingRail"),u=(0,i.K)((e,t,i)=>{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(P(e.a,e.b,n,s,-2)||P(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(S(e,n,.5)>=8)return!1}return a(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e=a(),t=!1;for(let n of o){let r=l(n),o=s(r);if(!o)continue;let i=f(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=d(r,o.segment,l);if(i&&u(n,i,e)){n.points=i,t=!0;break}}if(t)break}}if(!t)return}}function eX(e,t,n){let r=(0,i.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"),o=(0,i.K)(e=>{if(!e.isGroup||e.parentId)return;let t=eE(e.direction??n);if("LR"===t||"RL"===t||"BT"===t)return;let o=r(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"),l=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<t.top-.001)&&!(n>t.bottom+.001)&&I(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...t.values()].map(o).filter(e=>!!e);if(0===a.length)return;let s=0;for(let t of e)if(!t.isLayoutOnly)for(let e of w(C(t.points??[])))for(let t of a)l(e,t.rect)&&(s=Math.max(s,t.rect.bottom-e.a.y+4));if(!(s<=.001))for(let e of a){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-s/2,e.node.height=n+s,e.node.groupTitleRect={...e.rect,top:e.rect.top-s,bottom:e.rect.bottom-s})}}function ez(e,t,n){let r=(0,i.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"),o=(0,i.K)(e=>{if(!e.isGroup||e.parentId||"LR"!==eE(e.direction??n))return;let t=r(e),o=e.x,l=e.width;if(!t||"number"!=typeof o||"number"!=typeof l||!Number.isFinite(o)||!Number.isFinite(l)||l<=0)return;let i=t.right-t.left,a=t.bottom-t.top;if(!(i<=0)&&!(a<i))return{node:e,rect:t}},"leftLaneTitleFor"),l=(0,i.K)((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return!(n<t.left-.001)&&!(n>t.right+.001)&&I(e.a.y,e.b.y,t.top,t.bottom)>=8},"verticalSegmentIntersectsTitle"),a=(0,i.K)((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return!(n<t.top-.001)&&!(n>t.bottom+.001)&&I(e.a.x,e.b.x,t.left,t.right)>=8},"horizontalSegmentIntersectsTitle"),s=[...t.values()].map(o).filter(e=>!!e);if(0===s.length)return;let f=0;for(let t of e)if(!t.isLayoutOnly){for(let e of w(C(t.points??[])))for(let t of s)if(l(e,t.rect))f=Math.max(f,t.rect.right-e.a.x+4);else if(a(e,t.rect)){let n=Math.min(e.a.x,e.b.x);f=Math.max(f,t.rect.right-n+4)}}if(!(f<=.001))for(let e of s){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-f/2,e.node.width=n+f,e.node.groupTitleRect={...e.rect,left:e.rect.left-f,right:e.rect.right-f})}}function eY(e,t){let{realNodeRects:n}=z(t.values()),r=e.filter(e=>!e.isLayoutOnly),o=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),l=(0,i.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)j(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"crossingCount"),a=(0,i.K)((e=new Map)=>r.reduce((t,n)=>t+v(o(n,e)),0),"totalBends"),s=(0,i.K)(e=>{let t=o(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(M(n,r,.001)||K(n,r,.001))return{tailStart:n,terminal:r}},"terminalTailFor"),f=(0,i.K)((e,t)=>{let n,r=o(e);if(r.length<3)return;let l=r[0],i=r[1];if(M(l,i,.001))n={x:i.x,y:t.tailStart.y};else{if(!K(l,i,.001))return;n={x:t.tailStart.x,y:i.y}}let a=q(C([l,i,n,t.tailStart,t.terminal]));return w(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=(0,i.K)((e,t)=>{let r=[e.start,e.end].filter(e=>!!e);for(let e of w(t))if(P(e.a,e.b,n,r,-2))return!0;return!1},"pathHasNodeHit"),u=(0,i.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(S(e,t,.5)>=8)return!0}return!1},"pathHasSharedTrack"),h=(0,i.K)((e,t,n)=>!d(e,t)&&!u(e,t,n),"candidateIsSafe"),g=(0,i.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=a(),r=t,o=n;for(let n of g().values())for(let i=0;i<n.length;i++)for(let d=i+1;d<n.length;d++){let u=n[i],g=n[d],c=s(u),x=s(g);if(!c||!x)continue;let p=f(u,x),m=f(g,c);if(!p||!m)continue;let y=new Map([[u,p],[g,m]]);if(!h(u,p,y)||!h(g,m,y))continue;let b=l(y),M=a(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 eG(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),a=(0,i.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)j(e.a,e.b,r.a,r.b,.001)&&t++}}return t},"strictCrossingCount"),s=(0,i.K)((e=new Map)=>o.reduce((t,n)=>t+v(l(n,e)),0),"totalBends"),f=(0,i.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?$(o):void 0,a=l?$(l):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=(0,i.K)((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=f(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"),u=(0,i.K)(()=>{let e=[];for(let t of o){let n=l(t);for(let r of w(n)){let o=d(t,n,r);o&&e.push(o)}}return e},"collectExternalRails"),h=(0,i.K)((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&I(e.min,e.max,t.min,t.max)>=8,"railsInteract"),g=(0,i.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,i.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"),x=(0,i.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=[],a=(0,i.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),a(),l.pop(),o[e]=!1)},"visit");return a(),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"),p=(0,i.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=q(C(t));if(w(n).length!==n.length-1)return;r.set(e,n)}return r},"replacementsForAssignment"),m=(0,i.K)(e=>{for(let[t,o]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of w(o))if(P(t.a,t.b,n,e,-2)||P(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(S(e,t,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let e=0;e<4;e++){let e,t=a();if(0===t)return;let n=t,r=s(),o=1/0;for(let l of g(u()))for(let i of x(l)){let f=p(l,i);if(!f||!m(f))continue;let d=a(f);if(d>=t)continue;let u=s(f),h=l.reduce((e,t,n)=>e+Math.abs(i[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 eP(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=e.filter(e=>!e.isLayoutOnly),l=(0,i.K)((e,t,n)=>C(e===t?n??[]:e.points??[]),"pointsFor"),a=(0,i.K)(e=>w(e).reduce((e,t)=>e+Math.hypot(t.a.x-t.b.x,t.a.y-t.b.y),0),"pathLength"),s=(0,i.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)j(e.a,e.b,t.a,t.b,.001)&&n++}}return n},"strictCrossingCount"),f=(0,i.K)((e,t)=>{if(e.horizontal){let n=e.a.y;return(1>Math.abs(n-t.top)||1>Math.abs(n-t.bottom))&&I(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))&&I(e.a.y,e.b.y,t.top,t.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=(0,i.K)(e=>{let n=[e.start,e.end].filter(e=>!!e),r=[];for(let e of n){let n=t.get(e),o=n?$(n):void 0;o&&r.push(o)}return r},"endpointRectsFor"),u=(0,i.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=M(n,r,.001)&&K(r,o,.001)&&M(o,l,.001),a=K(n,r,.001)&&M(r,o,.001)&&K(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=y(n,l,.001)||b(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=>q(C(e))).filter(e=>{if(w(e).length!==e.length-1||!e.some(e=>m(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,i.K)((e,t,i)=>{let a=[e.start,e.end].filter(e=>!!e),u=d(e);for(let e of w(t))if(P(e.a,e.b,n,a,-2)||P(e.a,e.b,r,[],-2)||u.some(t=>f(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(S(e,t,.5)>=8)return!1}return s(e,t)<=i},"candidateIsSafe");for(let e=0;e<8;e++){let e,t,n=s(),r=n,i=1/0,f=1/0;for(let d of o){let o=l(d),g=v(o,.001),c=a(o);for(let l=0;l<=o.length-4;l++)for(let x of u(o,l)){let o=v(x,.001),l=a(x);if(!(o<g||o===g&&l<c-.001)||!h(d,x,n))continue;let u=s(d,x);u>r||u===r&&(o>i||o===i&&l>=f)||(e=d,t=x,r=u,i=o,f=l)}}if(!e||!t)return;e.points=t}}function eD(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=$(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"],a={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},s=e.filter(e=>!e.isLayoutOnly),f=new Map(s.map((e,t)=>[e,t])),d=(0,i.K)(e=>{let t="left"===e||"top"===e?-1:1,n=[];for(let r=0;r<=2;r++)n.push(a[e]+20*t*r);return n},"outwardTracksForSide"),u=(0,i.K)((e,t=new Map)=>C(t.get(e)??e.points??[]),"replacementPointsFor"),h=(0,i.K)((e,t)=>{let n=0;for(let r of e)for(let e of t)j(r.a,r.b,e.a,e.b,.001)&&n++;return n},"crossingCountBetweenSegments"),g=(0,i.K)((e,t)=>h(w(e),w(t)),"crossingCountBetweenPaths"),c=(0,i.K)((e=new Map)=>{let t=0,n=[],r=new Set,o=[],l=(0,i.K)(e=>{r.has(e)||(r.add(e),o.push(e))},"addEdge");for(let r=0;r<s.length;r++){let o=s[r],i=u(o,e);for(let a=r+1;a<s.length;a++){let r=s[a],f=g(i,u(r,e));f>0&&(t+=f,n.push({first:o,second:r,count:f}),l(o),l(r))}}return o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),{count:t,pairs:n,edgeSet:r,edges:o}},"crossingSnapshot"),x=(0,i.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<s.length;e++){let r=s[e],l=n.has(r),i=u(r,t);for(let r=e+1;r<s.length;r++){let e=s[r];(l||n.has(e))&&(o+=g(i,u(e,t)))}}return e.count-r+o},"crossingCountWithReplacements"),p=(0,i.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)=>(f.get(e)??0)-(f.get(t)??0)),l.length>1&&n.push(l)}return n},"crossingComponents"),m=(0,i.K)(e=>[e.start,e.end].filter(e=>!!e),"endpointIdsFor"),y=(0,i.K)(e=>{let t=[];for(let n of p(e)){let e=new Set(n),r=new Set(n.flatMap(e=>m(e))),o=[...n];for(let t of s)!e.has(t)&&m(t).some(e=>r.has(e))&&o.push(t);o.sort((e,t)=>(f.get(e)??0)-(f.get(t)??0)),t.push(o)}return t},"pairSearchGroups"),b=(0,i.K)((e,t,n)=>x(e,new Map([[t,n]])),"crossingCountWithSingleReplacement"),I=(0,i.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"),L=(0,i.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"),k=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+v(u(n,e)),0),"totalBends"),T=(0,i.K)((e=new Map)=>s.reduce((t,n)=>t+L(u(n,e)),0),"totalLength"),O=(0,i.K)((e,t,n=new Map)=>{let r=w(t);for(let t of s)if(t!==e){for(let e of r)for(let r of w(u(t,n)))if(S(e,r,.5)>=8)return!0}return!1},"pathHasSegmentConflict"),R=(0,i.K)((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of w(t))if(P(e.a,e.b,o,n,-2))return!0;return!1},"pathHitsNode"),F=(0,i.K)((e,t)=>{let n=q(C(t));w(n).length===n.length-1&&e.push(n)},"pushOrthogonalCandidate"),E=(0,i.K)(e=>"left"===e||"right"===e,"sideIsHorizontal"),X=(0,i.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"),z=(0,i.K)((e,t,n,r)=>{let o="left"===n||"top"===n?-1:1;for(let l of[X(t,n,r),a[n]])for(let i=0;i<=2;i++)F(e,A(t,n,r,l+20*o*i))},"addSameSideCandidates"),Y=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))F(e,[t,{x:l,y:t.y},{x:l,y:n},{x:r.x,y:n},r])},"addHorizontalToVerticalCandidates"),G=(0,i.K)((e,t,n,r,o)=>{for(let l of d(n))for(let n of d(o))F(e,[t,{x:t.x,y:l},{x:n,y:l},{x:n,y:r.y},r])},"addVerticalToHorizontalCandidates"),D=(0,i.K)((e,t,n,r,o)=>{let l=[...d("top"),...d("bottom")];for(let i of d(n))for(let n of d(o))for(let o of l)F(e,[t,{x:i,y:t.y},{x:i,y:o},{x:n,y:o},{x:n,y:r.y},r])},"addHorizontalPairCandidates"),_=(0,i.K)((e,t,n,r,o)=>{let l=[...d("left"),...d("right")];for(let i of d(n))for(let n of d(o))for(let o of l)F(e,[t,{x:t.x,y:i},{x:o,y:i},{x:o,y:n},{x:r.x,y:n},r])},"addVerticalPairCandidates"),H=(0,i.K)(e=>{let t=new Set;return e.map(e=>C(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"),V=(0,i.K)((e,t,n,r)=>{let o=[],l=B(e,t,n,r,20,.001);l&&F(o,l),t===r&&z(o,e,t,n);let i=E(t),a=E(r);return i&&!a?Y(o,e,t,n,r):!i&&a?G(o,e,t,n,r):i?D(o,e,t,n,r):_(o,e,t,n,r),H(o)},"buildCandidatesForSides"),U=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=N(r,a),s="top"===a||"bottom"===a?d(a):i;for(let r of o)for(let o of(F(e,[t,n,{x:r,y:n.y},{x:r,y:l.y},l]),s))F(e,[t,n,{x:r,y:n.y},{x:r,y:o},{x:l.x,y:o},l])}},"addVerticalDepartureOuterTrackCandidates"),W=(0,i.K)((e,t,n,r)=>{let o=[...d("left"),...d("right")],i=[...d("top"),...d("bottom")];for(let a of l){let l=N(r,a),s="left"===a||"right"===a?d(a):o;for(let r of i)for(let o of(F(e,[t,n,{x:n.x,y:r},{x:l.x,y:r},l]),s))F(e,[t,n,{x:n.x,y:r},{x:o,y:r},{x:o,y:l.y},l])}},"addHorizontalDepartureOuterTrackCandidates"),Z=(0,i.K)(e=>{let t=e.start,n=e.end,o=n?r.get(n):void 0;if(!t||!o)return[];let l=C(e.points??[]);if(l.length<4)return[];let i=l[0],a=l[1],s=[];return K(i,a,.001)?U(s,i,a,o):M(i,a,.001)&&W(s,i,a,o),s},"terminalPreservingOuterTrackCandidates"),J=(0,i.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=N(o,e);for(let n of l)a.push(...V(t,e,N(i,n),n))}return a.push(...Z(e)),a},"candidatePathsFor"),Q=(0,i.K)(()=>new Map(s.map(e=>[e,w(u(e))])),"currentSegmentsByEdge"),ee=(0,i.K)((e,t,n)=>{let r=new Set;for(let o of s){if(o===e)continue;let l=n.get(o)??w(u(o));t.some(e=>l.some(t=>S(e,t,.5)>=8))&&r.add(o)}return r},"sharedTrackConflictsFor"),et=(0,i.K)((e,t,n,r)=>{let o=new Set;return J(e).map(e=>q(C(e))).filter(t=>{if(R(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 s)t!==e&&(i+=h(l,n.get(t)??w(u(t))));return{candidate:o,candidateSegments:l,crossings:t.count-(r.get(e)??0)+i,bends:v(o,.001),totalBends:v(o),length:L(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:ee(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},"pairCandidatesFor"),en=(0,i.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 a=h(n.segments,o.segments);for(let e of s){if(e===t||e===r)continue;let i=l.get(e)??w(u(e));a+=h(n.segments,i)+h(o.segments,i)}return e.count-i+a},"pairCrossingCount"),er=(0,i.K)((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},"conflictsOnlyWith"),eo=(0,i.K)((e,t)=>e.segments.some(e=>t.segments.some(t=>S(e,t,.5)>=8)),"candidatesShareTrack"),el=(0,i.K)((e,t,n,r)=>er(t,n.edge)&&er(r,e.edge)&&!eo(t,r),"pairCandidatesAreCompatible"),ei=(0,i.K)((e,t,n,r,o)=>{let l=en(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"),ea=(0,i.K)((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),"pairScoreIsBetter"),es=(0,i.K)((e,t,n,r)=>{let o=r;for(let r of t.candidates)for(let l of n.candidates){if(!el(t,r,n,l))continue;let i=ei(e,t,r,n,l);i&&ea(i,o)&&(o=i)}return o},"bestScoreForOptionPair"),ef=(0,i.K)(e=>{let t=k(),n=T(),r=Q(),o=I(e),l=new Map(s.map(e=>[e,v(u(e))])),i=new Map(s.map(e=>[e,L(u(e))])),a=new Map,f=y(e);for(let t of f)for(let n of t){if(a.has(n))continue;let t=et(n,e,r,o);t.length>0&&a.set(n,{edge:n,candidates:t})}let d={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=>a.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))&&(d=es(h,t,e,d))}}}return d.replacements.size>0?d.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=v(u(i),.001);for(let s of J(i)){let f=R(i,s),d=!f&&O(i,s),u=b(n,i,s),h=v(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=ef(n);if(!i)return;for(let[e,t]of i)e.points=t}}function e_(e,t){let{nodeInfoById:n,realNodeRects:r}=X(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},a=(0,i.K)((e,t,n,r)=>{let o=[],i=B(e,t,n,r,20,.001);return i&&o.push(i),t===r&&o.push(A(e,t,n,l[t])),o},"buildOrthogonalPathCandidates"),s=(0,i.K)((e,t)=>{for(let n=0;n<e.length-1;n++)if(P(e[n],e[n+1],r,t,1))return!0;return!1},"pathHitsNode"),f=(0,i.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(D(e.a,e.b,t.a,t.b,.001,.001)){o++;continue}S(e,t,.001)>=8&&o++}}return o},"pathConflictCount"),d=(0,i.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"),u=new Map,h=(0,i.K)((e,t,n)=>{let r=u.get(e)??[];r.push({side:t,edgeId:n}),u.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,d(e[0],t),r)}if(l){let t=n.get(l);t&&h(l,d(e[e.length-1],t),r)}}let g=(0,i.K)((e,t,n)=>u.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=v(r,.001);if(l<4)continue;let i=t.start,c=t.end;if(!i||!c)continue;let x=n.get(i),p=n.get(c);if(!x||!p)continue;let m=t.id??"",y=f(r,t,!0),b=f(r,t),M=y,K=l;for(let n of o){if(g(i,n,m))continue;let r=N(x,n);for(let l of o)if(!g(c,l,m))for(let o of a(r,n,N(p,l),l)){if(s(o,[i,c]))continue;let n=v(o,.001);if(y>0){let r=f(o,t,!0);if(r>M||r===M&&n>=K)continue;M=r,K=n,e=o;continue}!(f(o,t)>b)&&n<K&&(K=n,e=o)}}if(e){t.points=e;let n=u.get(i);n&&u.set(i,n.filter(e=>e.edgeId!==m));let r=u.get(c);r&&u.set(c,r.filter(e=>e.edgeId!==m)),h(i,d(e[0],x),m),h(c,d(e[e.length-1],p),m)}}}function eH(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 ej(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 eV(e,t){let n=C(t);return[eH(n,!0),eH(n,!1)].some(t=>t&&R(e,ej(t)))}function eU(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=$(e);t&&o.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let l=$(e);l&&r.push({nodeId:e.id,rect:l})}let l=(0,i.K)((e,t)=>{let n=F(t,3);for(let{nodeId:t,rect:o}of r)if(t!==e&&R(n,o))return!0;return!1},"labelOverlapsForeignNode"),a=(0,i.K)((e,t)=>{let r=F(t,3);for(let t of n)if(t.edgeId!==e&&k(t.p1,t.p2,r))return!0;return!1},"labelOverlapsForeignEdge"),s=(0,i.K)((e,t,n)=>l(e,n)||a(t,n),"labelOverlapsAnything"),f=[],d=(0,i.K)(e=>{for(let{id:t,rect:n}of o)if(O(n,e))return t},"findContainingLane"),u=(0,i.K)((e,t)=>f.some(n=>n.labelId!==e&&R(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 x=[];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||x.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===x.length)continue;let p=x.length>=3?x.filter(e=>e.idx>0&&e.idx<x.length-1):x,m=p.length>0?p:x,y=g>=c?"horizontal":"vertical",b=(0,i.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=x[0],K=x[x.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],S=(0,i.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"),w=(0,i.K)((e,t,n)=>Math.min(n,Math.max(t,e)),"clamp"),v=(0,i.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,i.K)(e=>{let t=E(e.midX,e.midY,g,c),n=d(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 f={midX:w(e.midX,l,i),midY:w(e.midY,a,s)},u=E(f.midX,f.midY,g,c);return v(e,u)?{laneId:r.id,anchor:f,rect:u}:void 0},"placementForAnchor"),L=(0,i.K)((e,t,n)=>"horizontal"===e.orientation?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),"distanceAlongSegment"),k=(0,i.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"),T=(0,i.K)(t=>{for(let r of b(t))for(let t of I){let o=S(r,t);if(!k(r,o))continue;let l=C(o);if(!(!l||eV(l.rect,h))&&!u(e,l.rect)&&!s(e,n.id,l.rect))return{laneId:l.laneId,anchor:l.anchor}}},"tryPool"),O=(0,i.K)((t,r,o=!1)=>{for(let i of b(t)){let t={midX:i.midX,midY:i.midY};if(r&&!k(i,t))continue;let s=C(t);if(s&&!eV(s.rect,h)&&!u(e,s.rect)&&!l(e,s.rect)&&(o||!a(n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"findLaneContainingFallback"),R=T(m)??(m.length<x.length?T(x):void 0)??O(x,!0)??O(x,!1)??O(x,!1,!0);if(R){r.x=R.anchor.midX,r.y=R.anchor.midY,r.parentId=R.laneId;let t=E(R.anchor.midX,R.anchor.midY,g,c),n=f.findIndex(t=>t.labelId===e);n>=0?f[n]={labelId:e,rect:t}:f.push({labelId:e,rect:t})}}}(0,i.K)(eN,"separateSharedRenderedTerminalLanes"),(0,i.K)(eB,"collapseRedundantRectangularDoglegs"),(0,i.K)(eA,"liftObstacleHuggingSameSideRails"),(0,i.K)(eX,"liftTopLaneTitleBandsAboveRails"),(0,i.K)(ez,"shiftLeftLaneTitleBandsLeftOfRails"),(0,i.K)(eY,"swapDestinationTerminalTailsToReduceCrossings"),(0,i.K)(eG,"reassignCrossingExternalRailChannels"),(0,i.K)(eP,"shortcutRedundantOrthogonalJogs"),(0,i.K)(eD,"resolveRenderedOrthogonalCrossings"),(0,i.K)(e_,"simplifyDetouredEdges"),(0,i.K)(eH,"markerClearanceRectFor"),(0,i.K)(ej,"normalizeRect"),(0,i.K)(eV,"labelOverlapsOwnMarker"),(0,i.K)(eU,"anchorLabelsToPolyline");function eW(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}function eZ(e,t){let{nodeInfoById:n,realNodeRects:r}=X(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,i.K)((t,n,r,l)=>{let a=eW(n,r),s=0,f=(0,i.K)(e=>{if(!e)return;let t=o.get(e);if(!t)return;let n="x"===l?t.w/2:t.h/2;n>s&&(s=n)},"consider");for(let n of(f(t.labelNodeId),e)){if(n===t||n.isLayoutOnly)continue;let e=n.start,r=n.end;e&&r&&eW(e,r)===a&&f(n.labelNodeId)}return s>0?s+3:0},"labelClearanceFor");for(let t of e){let o,i;if(t.isLayoutOnly||!L(t.points,1e-6))continue;let a=G(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(P(o,i,r,[s,f],1))continue;let c=l(t,s,f,h?"x":"y"),x=c>4?c:4;for(let n of[0,x,-x]){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(!P(l,a,r,[s,f],1)&&!H(l,a,e,t,{epsilon:1e-6})){t.points=[l,a];break}}}}function eq(e,t){let{realNodeRects:n,labelNodeRects:r}=z(t.values()),o=(0,i.K)((e,t)=>w(t,.001).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),"segmentsFor"),l=(0,i.K)(()=>{let t=[];for(let n of e){if(n.isLayoutOnly)continue;let e=n.points;e&&!(e.length<2)&&t.push(...o(n,C(e)))}return t},"allSegments"),a=(0,i.K)((e,t)=>e.horizontal&&t.horizontal?I(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&&I(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&7>Math.abs(e.a.x-t.a.x),"hasCrowdedParallelTrack"),s=(0,i.K)((t,l)=>{let i=t.start,s=t.end,f=o(t,l);if(f.length!==l.length-1)return!1;let d=[i,s].filter(e=>!!e),u=t.labelNodeId?[t.labelNodeId]:[];for(let e of f)if(P(e.a,e.b,n,d,-2)||P(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,C(e)))if(a(t,r)||j(t.a,t.b,r.a,r.b,.001))return!1}}return!0},"candidateIsSafe"),f=(0,i.K)((e,t)=>{let n=C(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"),d=(0,i.K)((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),"nodeCenter"),u=(0,i.K)(e=>{let n=e.edge,r=C(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?$(o):void 0,a=l?$(l):void 0,s=r.slice(e.index+2);if(o&&l&&i&&a&&0!==s.length)return{sourceCenter:d(o,i),targetCenter:d(l,a),sourceRect:i,tail:s}},"sourceDetourContextFor"),h=(0,i.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 C([{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,i.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 C([{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,i.K)((e,t)=>{let n=u(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"),x=[-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&&a(o,l))for(let e of[o,l].filter(e=>e.interior)){for(let n of x){let r=f(e,n);if(r&&s(e.edge,r)){e.edge.points=r,t=!0;break}let o=c(e,n);if(o&&s(e.edge,o)){e.edge.points=o,t=!0;break}}if(t)break}}if(!t)return}}function eJ(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 eQ(e){let t=e.nodes??[],n=e.edges??[],r=[];if(!n.length||!t.length)return r;let o=Y(t),i=[];for(let e of n){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,l=e.end,a=e.labelNodeId,s=e.id??`${n}->${l}`;for(let e of o)if(e.nodeId!==n&&e.nodeId!==l&&(!a||e.nodeId!==a)){for(let n=0;n<t.length-1;n++)if(k(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++)i.push({edgeId:s,start:n,end:l,p1:t[e],p2:t[e+1]})}let a=new Set;for(let e=0;e<i.length;e++)for(let t=e+1;t<i.length;t++){let n=i[e],o=i[t];if(n.edgeId!==o.edgeId&&n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&eJ(n.p1,n.p2,o.p1,o.p2)){let e=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;a.has(e)||(a.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(l.R.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${e} edge-node overlap(s), ${t} edge crossing(s)`),r))l.R.warn(`[SWIMLANE_VALIDATE] ${n.type}: ${n.detail}`)}return r}function e0(e,t){let n=e.nodes??[],r=e.edges??[],o=n.filter(e=>!e.isGroup);if(("LR"===t||"RL"===t)&&o.length>0&&!eT(e,t)||"BT"===t&&o.length>0&&!ek(e))return;for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;t&&!(t.length<2)&&(e.points=q(Z(t)))}e_(r,n),eZ(r,n),eR(r,n);let l=new Map;for(let e of n)l.set(String(e.id),e);eU(r,l),et(r,l),eF(r,l),eq(r,l),eN(r,l),eB(r,l),eA(r,l),eY(r,l);let a=(0,i.K)(()=>{eD(r,l),eN(r,l),eG(r,l),eP(r,l),eU(r,l),eM(r,l),eA(r,l),eU(r,l),eM(r,l)},"finalizeRenderedEdges");a(),eq(r,l),a(),eX(r,l,t),ez(r,l,t),eX(r,l,t),ez(r,l,t)}function e1(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 e2(e,t){return e.edges.filter(e=>e.dst===t)}function e6(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 e5(e){let t=e6(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}function e3(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 e8(e,t){let n=[...t.entries()].filter(([,e])=>0===e).map(([e])=>e).sort((e,t)=>e.localeCompare(t)),r=new Set(e.edges.flatMap(e=>[e.src,e.dst])),o=(0,i.K)(t=>!r.has(t)&&!e.nodeById.get(t)?.isGroup,"isUnconnected"),l=[...t.keys()].filter(e=>0===t.get(e)&&o(e)),a=0;return n.map(e=>o(e)?l[a++]:e)}function e4(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 e7(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 e9(e){let t=e3(e),n=e8(e,t),r=[],o=e5(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 te(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}function tt(e){let t=Array(e.length),n=(0,i.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 tn(e){let t=e1(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,i.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"),a=e3(t);for(let e of[...t.nodes.filter(e=>(a.get(e)??0)===0),...t.nodes.filter(e=>(a.get(e)??0)!==0)])0===r[e]&&l(e);let s=new Set(o.map(e=>`${e.id}:${e.src}->${e.dst}`)),f=t.edges.map(e=>s.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:f,layout:t.layout,nodeById:new Map(t.nodeById)},reversed:o}}function tr(e){let t=new Map,n=(0,i.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 to(e){let t=tr(e);return e=>t.get(e)??null}function tl(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}function ti(e,t){let n=tl(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,i.K)(eW,"pairKey"),(0,i.K)(eZ,"straightenCollinearSiblingDetours"),(0,i.K)(eq,"nudgeSharedInteriorSubpaths"),(0,i.K)(eJ,"segmentsIntersect"),(0,i.K)(eQ,"validateSwimlanesLayout"),(0,i.K)(e0,"postProcessSwimlaneLayout"),(0,i.K)(e1,"normalizeGraph"),(0,i.K)(e2,"incoming"),(0,i.K)(e6,"buildSuccessorMap"),(0,i.K)(e5,"buildSortedSuccessorMap"),(0,i.K)(e3,"buildInDegreeMap"),(0,i.K)(e8,"sortedZeroInDegreeNodes"),(0,i.K)(e4,"buildPredecessorSuccessorMaps"),(0,i.K)(e7,"buildLayersFromRanks"),(0,i.K)(e9,"topoSortIfAcyclic"),(0,i.K)(te,"buildLayerIndex"),(0,i.K)(tt,"countInversions"),(0,i.K)(tn,"removeCycles_DFS"),(0,i.K)(tr,"buildTopLaneMap"),(0,i.K)(to,"createTopLaneResolver"),(0,i.K)(tl,"buildTopLaneOrder"),(0,i.K)(ti,"resolveTopLaneOrder");var ta={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},ts={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function tf(e,t){let n=e1(e),r=t?.laneOf??(()=>null),o=t?.rankHint,{preds:l}=e4(n);for(let e of l.values())e.sort((e,t)=>e.localeCompare(t));let a=e9(n)??[...n.nodes].sort((e,t)=>e.localeCompare(t)),s=new Map;for(let[e,t]of a.entries())s.set(t,e);let f=new Map,d=new Map;for(let e of n.nodes)d.set(e,[]);for(let e of a){let t=(l.get(e)??[]).filter(e=>f.has(e));if(t.length>0){let n=td(e,t,{laneOf:r,rankHint:o,topoIndex:s});f.set(e,n),d.get(n).push(e)}else f.has(e)||f.set(e,null)}for(let e of n.nodes)f.has(e)||f.set(e,null);let u=new Set;for(let e of n.nodes)(f.get(e)??null)===null&&u.add(e);let h=[...u].sort((e,t)=>{let n=s.get(e)??0,r=s.get(t)??0;return n===r?e.localeCompare(t):n-r}),g=tu(n),c=new Map;for(let[e,t]of g.entries())c.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let x=th(c),p=tg(c),m=new Map;for(let e of n.nodes)m.set(e,[]);for(let e of p)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,i.K)(e=>{if(!M.has(e)){for(let t of(M.add(e),y.push(e),d.get(e)??[]))K(t);b.push(e)}},"walk");for(let e of h)K(e);for(let e of a)K(e);return{parent:f,children:d,roots:h,componentOf:x,blocks:p,nodeBlocks:m,adjacency:c,preorder:y,postorder:b,topologicalOrder:a}}function td(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 tu(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 th(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 tg(e){let t=new Map,n=new Map,r=[],o=[],l=0,a=(0,i.K)((i,s)=>{for(let f of(t.set(i,++l),n.set(i,l),e.get(i)??[]))f!==s&&(t.has(f)?(t.get(f)??0)<(t.get(i)??0)&&(r.push([i,f]),n.set(i,Math.min(n.get(i)??l,t.get(f)??l))):(r.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??l,n.get(f)??l)),(n.get(f)??0)>=(t.get(i)??0)&&o.push(tc(i,f,r,o.length))))},"visit");for(let n of e.keys())t.has(n)||a(n,null);return o}function tc(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 tx(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,a=Array(l).fill(-1),s=Array(l).fill(0),f=[],d=new Set;for(let e of r){let t=n.parent.get(e)??null,r=o.get(e);null!=r&&null==t&&(a[r]=-1,s[r]=0,d.has(e)||(d.add(e),f.push(e)))}for(;f.length>0;){let e=f.shift(),t=o.get(e);if(null!=t)for(let r of n.children.get(e)??[]){if(d.has(r))continue;let e=o.get(r);null!=e&&(a[e]=t,s[e]=s[t]+1,d.add(r),f.push(r))}}for(let e of r){if(d.has(e))continue;let t=o.get(e);null!=t&&(a[t]=-1,s[t]=0,d.add(e))}let u=Math.max(1,Math.ceil(Math.log2(Math.max(1,l)))+1),h=Array.from({length:u},()=>Array(l).fill(-1));for(let e=0;e<l;e++)h[0][e]=a[e];for(let e=1;e<u;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,i.K)((e,t)=>{if(-1===e||-1===t)return -1;s[e]<s[t]&&([e,t]=[t,e]);let n=s[e]-s[t];for(let t=0;t<u;t++)if(n>>t&1&&-1===(e=h[t][e]))return -1;if(e===t)return e;for(let n=u-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 x=new Map,p=(0,i.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,i.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=x.get(e);l||(l=new Map,x.set(e,l));let i=n.get(o)??0,a=t[r];null!=a&&a>o&&(i+=1),l.set(r,i)}p(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 x}function tp(e,t,n){let r=new Map,o=(0,i.K)(e=>{let l=n[e]??0,i=[...t.get(e)??[]];for(let e of(i.sort(tm(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 tm(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},()=>[]),a=new Set,s=(0,i.K)(e=>{if(a.has(e))return;a.add(e);let t=n[e]??0;for(let n of(l[t]||(l[t]=[]),l[t].push(e),r(e)))s(n)},"emit");for(let t of e)s(t);for(let e of t)if(!a.has(e)){let t=n[e]??0;l[t]||(l[t]=[]),l[t].push(e),a.add(e)}return l}function tb(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 tM(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 tK(e,t,n){let r=tf(e,{rankHint:t,laneOf:n}),{children:o,roots:l}=r;for(let t of e.nodes)o.has(t)||o.set(t,[]);let i=tx(e,t,r),a=[...l].sort(tm(t)),s=tp(a,o,t),f=tM(o,t,i,s),d=ty(a,e.nodes,t,f);return tb(d)}function tI(e,t,n){let r=new Set(e),o=new Set(t),l=te(t),i=[];for(let e of n)r.has(e.src)&&o.has(e.dst)&&i.push(l.get(e.dst));return tt(i)}function tS(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+=tI(e[t],e[t+1],r);return o}function tw(e,t){let n={...t},{preds:r}=e4(e),o=to(e),l=tS(tK(e,n,o),e.edges,n),i=ta.MAX_CROSSING_OPTIMIZATION_PASSES;for(let t=0;t<i;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=tS(tK(e,n,o),e.edges,n);f<l?(l=f,t=!0):n[i]=a}if(!t)break}return n}function tv(e,t){let n=to(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 tC(e,t){let n=e1(e),r=e9(n)??[...n.nodes].sort(),o=t?.compactSingleInput??!1,l=to(n),i=Object.create(null);for(let e of r){let r=e2(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]=t===-1/0?0:t}}return t?.optimizeRanksByCrossings&&(i=tw(n,i)),t?.ignoreCrossLaneEdges&&tv(n,i),{layers:tK(n,i,l),rankOf:i,dummy:new Set}}function tL(e,t){let n=e1(e),r={...tC(n,{compactSingleInput:t?.compactSingleInput,ignoreCrossLaneEdges:t?.ignoreCrossLaneEdges,optimizeRanksByCrossings:t?.optimizeRanksByCrossings}).rankOf},o=to(n),{preds:l,succs:a}=e4(n,e=>{if(t?.ignoreCrossLaneEdges){let t=o(e.src),n=o(e.dst);if(t&&n&&t!==n)return!1}return!0}),s=e9(n)??[...n.nodes],f=[...s].reverse(),d=(0,i.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,i=a.get(e)??[];return i.length>0&&(o=Math.min(...i.map(e=>(r[e]??0)-1))),Number.isFinite(o)||(o=Math.max(n,t)),Math.min(Math.max(t,n),o)},"clampFeasible"),u=ta.GRAVITY_ITERATIONS,h=(0,i.K)(e=>{let t=!1;for(let n of e){let e=l.get(n)??[],o=a.get(n)??[];if(0===e.length&&0===o.length)continue;let i=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=d(n,i);s!==r[n]&&(r[n]=s,t=!0)}return t},"relaxOrder");for(let e=0;e<u;e++){let e=h(s),t=h(f);if(!e&&!t)break}for(let e of s){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 f){let t=a.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:e7(n,s,r),rankOf:r,dummy:new Set}}function tk(e){let t=e3(e),n=e5(e),r=e8(e,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 tT(e,t){let n=e1(e),r=t?.direction==="LR"?tk(n)??[...n.nodes].sort():e9(n)??[...n.nodes].sort(),o=to(n),l=(0,i.K)(e=>o(e)??e,"laneOf"),a=Object.create(null),s=new Map,f=(0,i.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=e2(n,e),o=0;if(r.length>0)for(let t of r){let n=t.src;o=Math.max(o,(a[n]??0)+f(n,e))}let i=l(e),d=Math.max(o,s.get(i)??0);a[e]=d,s.set(i,d+1)}return{layers:e7(n,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function tO(e,t){let n=e1(t),{rankOf:r}=e,o=e.layers.map(e=>[...e]),l=new Set(e.dummy?[...e.dummy]:[]),a=0,s=new Map(n.nodeById),f=(0,i.K)(e=>{let t=`placeholder-${a++}`;for(s.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"),d=[...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)),u=[];for(let e of d){let t=r[e.src]??0,n=r[e.dst]??0;if(n-t<=1){u.push(e);continue}let o=e.src;for(let r=t+1,l=0;r<n;r++,l++){let t=f(r);u.push({id:`${e.id}#${l}`,src:o,dst:t,weight:e.weight,ref:e.ref}),o=t}let l=n-t-2;u.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:u,layout:n.layout,nodeById:s};return{layering:{layers:o,rankOf:r,dummy:l},graphWithDummies:h}}function tR(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 tF(e){return 0===e.length?1/0:e.reduce((e,t)=>e+t,0)/e.length}function tE(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 t$(e,t,n){let r=n.get(e)??0,o=n.get(t)??0;return r!==o?r-o:e.localeCompare(t)}function tN(e,t,n){let r=new Set(e),o=new Set(t),l=te(e),i=te(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),tt(a.map(e=>e.v))}function tB(e,t,n){return[...e].sort((e,r)=>{let o=tR(t.get(e)??[]),l=tR(t.get(r)??[]);return o===l?t$(e,r,n):isFinite(o)?isFinite(l)?o-l:-1:1})}function tA(e,t,n,r,o,l){let i=te(e),a=te(t),s=tE(t,i,n,r);if(!o||!l||0===l.length)return tB(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=tB(t,s,a);d.push(...n)}let u=f.get(null);if(u&&u.length>0)for(let e of tB(u,s,a)){let t=tF(s.get(e)??[]),n=d.length;if(isFinite(t)){for(let[e,r]of d.entries())if(t<tF(s.get(r)??[])){n=e;break}}d.splice(n,0,e)}return d}function tX(e,t,n,r,o){let l=[...t],a=new Set(e),s=new Set(t),f=r?new Set(r):null,d=n.filter(e=>a.has(e.src)&&s.has(e.dst)),u=f?n.filter(e=>s.has(e.src)&&f.has(e.dst)):void 0,h=(0,i.K)(t=>{let n=tN(e,t,d);return u&&r&&(n+=tN(t,r,u)),n},"crossingScore"),g=o?new Map:null;if(o&&g)for(let e of t)g.set(e,o(e));let c=!0,x=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=x;[l[e],l[e+1]]=[l[e+1],l[e]];let n=h(l);n<t?(x=n,c=!0):[l[e],l[e+1]]=[l[e+1],l[e]]}}return l}function tz(e,t,n){let r=e.layers.map(e=>[...e]),o=t.edges,l=to(t),i=ti(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=tA(r[e-1],r[e],o,"down",l,i),r[e]=tX(r[e-1],r[e],o,r[e+1],l);for(let e=r.length-2;e>=0;e--)r[e]=tA(r[e+1],r[e],o,"up",l,i),r[e]=tX(r[e+1],r[e],o,r[e-1],l)}return{layers:r}}function tY(e,t,n){let r=n?.layerGap??ts.DEFAULT_LAYER_GAP,o=n?.nodeGap??ts.DEFAULT_NODE_GAP,l=n?.laneGap??2*o,a=n?.direction??"TB",s=e.layers,f=Object.create(null),d=Object.create(null),u=(0,i.K)(e=>t.nodeById.get(e),"getNode"),h=(0,i.K)(e=>u(e)?.width??0,"getWidth"),g=(0,i.K)(e=>u(e)?.height??0,"getHeight"),c=to(t),x=ti(t,n?.laneOrder),p=s.map(e=>e.reduce((e,t)=>Math.max(e,g(t)),0)),m=[];if("LR"===a||"RL"===a)for(let e=0;e+1<s.length;e++){let t=s[e].reduce((e,t)=>Math.max(e,h(t)),0),n=s[e+1].reduce((e,t)=>Math.max(e,h(t)),0),o=Math.max(0,(t+n)/2-(p[e]/2+p[e+1]/2)-r);m.push(o)}let y=new Set;for(let e of s)for(let t of e)y.add(c(t));let b=y.has(null),M=x.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),s)){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 S=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;S.set(r,i),t+=o,n<K.length-1&&(t+=l)}}let w=0;for(let[e,t]of s.entries()){let n=p[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=S.get(e);if(1===t.length){let e=t[0];f[e]=r,d[e]=w+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];f[i]=l+t/2,d[i]=w+n/2,l+=t+o}}}w+=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(((f[r]??0)+(f[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&&(f[e]=l)}}return{x:f,y:d}}function tG(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 tP(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 tD(e,t){let n=[...e],r=tP(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 t_(e,t){let n=0;for(let[r,o]of e.entries())n+=Math.abs(r-(t.get(o)??r));return n}function tH(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 tj(e){let t=tl(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=to(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 tV(e,t,n){let r=[...e],o=tH(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=tH(r,t);n<o?(o=n,l=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:o,sourceDistance:t_(r,n)}}function tU(e,t){return e.cost!==t.cost?e.cost<t.cost:e.sourceDistance<t.sourceDistance}function tW(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 tG(`${e.join("|")}#${r}#${n}`)}function tZ(e,t={}){let n=tl(e);if(n.length<2)return n;let r=tj(e);if(0===r.length)return n;let o=new Map(n.map((e,t)=>[e,t])),l=tV(n,r,o),i=Math.max(0,t.restarts??8);for(let e=0;e<i;e++){let t=tW(n,r,e),i=tV(tD(n,t),r,o);tU(i,l)&&(l=i)}return l.order}function tq(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,o=e1(e),l=t?.automaticLaneOrdering?tZ(o,{restarts:8}):void 0,i=tn(o),a=i.acyclic,{layering:s,graphWithDummies:f}=tO(n?tT(a,{compactSingleInput:t?.compactSingleInput??ta.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:t?.direction}):tL(a,{compactSingleInput:t?.compactSingleInput??ta.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),a),d=tz(s,f,{laneOrder:l}),u=tY(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 tJ(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 tQ(e,t){return 1e-6>Math.abs(e.to-t.from)||1e-6>Math.abs(e.to-t.to)?e.to:e.from}function t0(e,t){return"vertical"===e.orient?{x:e.coord,y:t}:{x:t,y:e.coord}}function t1(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,a=new Map,s=[],f="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,i.K)(e=>{a.set(e.id,t),n.filter(t=>t.parentId===e.id).forEach(r)},"assignLane");r(e)}let d=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:f?n/2+8:t/2+8}}),u=(0,i.K)((e,t,n,r)=>{let o=s.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:[]},s.push(o)),o.spanMin=Math.min(o.spanMin,n),o.spanMax=Math.max(o.spanMax,r),o},"getOrAddPipe"),h=(0,i.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,i.K)((e,t,n)=>h(e,tJ(e,t,n?"bottom":"top")),"getOrthogonalPort"),c=[],x=[],p=new Set,m=(0,i.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=a.get(e.start),i=a.get(e.end),s=o&&i&&o.id!==i.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,i.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!!d.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,i.K)((e,t)=>tJ(e,t,"bottom"),"determineSide"),S=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);S.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 w=(0,i.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,i.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 S.values()){let t=`${e.srcId}:${e.srcSide}`;C.has(t)||C.set(t,[]),C.get(t).push(e)}let L=new Map,k=(0,i.K)((e,t)=>`${e}:${t}`,"loadKey");for(let e of S.values())L.set(k(e.srcId,e.srcSide),(L.get(k(e.srcId,e.srcSide))??0)+1),L.set(k(e.dstId,e.dstSide),(L.get(k(e.dstId,e.dstSide))??0)+1);for(let e of C.values())if(!(e.length<2)){e.sort((e,t)=>{let n=w(e),r=w(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(k(n.srcId,n.srcSide))??0,l=L.get(k(n.srcId,r))??0;l>=o||(L.set(k(n.srcId,n.srcSide),o-1),L.set(k(n.srcId,r),l+1),n.srcSide=r)}}let T=(0,i.K)(e=>{let t=e?.shape;return"question"===t||"diamond"===t},"isDiamondNode"),O=new Map;for(let e of S.values())O.has(e.dstId)||O.set(e.dstId,new Set),O.get(e.dstId).add(e.dstSide);for(let e of S.values()){if(!T(l.get(e.srcId)))continue;let t=O.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=v(e);if(t.has(n)||(L.get(k(e.srcId,n))??0)>0)continue;let r=L.get(k(e.srcId,e.srcSide))??0;L.set(k(e.srcId,e.srcSide),Math.max(0,r-1)),L.set(k(e.srcId,n),1),e.srcSide=n}for(let e of S.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 R=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}`;R.set(r,t)}}let F=(0,i.K)(e=>!!o[e]?.labelNodeId,"edgeHasLabelNode"),E=(0,i.K)((e,t)=>!!e&&((M.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>F(e))||(M.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>F(e))),"faceHasLabelNode"),$=(0,i.K)((e,t,n)=>"top"===t||"bottom"===t?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},"applyPortOffset"),N=(0,i.K)((e,t,n)=>{let r=S.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=R.get(`${e}:src`),u=R.get(`${e}:dst`);return void 0!==d&&(s=$(s,i,d)),void 0!==u&&(f=$(f,a,u)),{pSrcPort:s,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(let e of y){let t=o[e];if(x[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:a,pDstPort:h,srcSide:g,dstSide:y}=N(e,n,r),I={...a},S={...h},w="top"===g||"bottom"===g,v="top"===y||"bottom"===y;w?I.y=a.y>(n.y??0)?a.y+20:a.y-20:I.x=a.x>(n.x??0)?a.x+20:a.x-20,v?S.y=h.y>(r.y??0)?h.y+20:h.y-20:S.x=h.x>(r.x??0)?h.x+20:h.x-20;let C=(0,i.K)((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),L=(0,i.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=[t.start,t.end],O=C(I,T);if(O.inside&&O.obstacle){let e=O.obstacle;if(w){let t=L(a,n,r,e,!0);I.x=t.x,I.y=t.y;let o=t.leavesPositiveSide?Math.min(e.minY-2,a.y+20):Math.max(e.maxY+2,a.y-20);k=[{x:a.x,y:o},{x:t.x,y:o},{x:t.x,y:t.y}]}else{let t=L(a,n,r,e,!1),o=t.leavesPositiveSide?Math.min(e.minX-2,a.x+20):Math.max(e.maxX+2,a.x-20);I.x=t.x,I.y=t.y,k=[{x:o,y:a.y},{x:o,y:t.y},{x:t.x,y:t.y}]}}let F=[],$=C(S,T);if($.inside&&$.obstacle){let e=$.obstacle;if(v){let t=L(h,r,n,e,!0);S.x=t.x,S.y=t.y,F=[{x:t.x,y:t.y},{x:h.x,y:t.y}]}else{let t=L(h,r,n,e,!1);S.x=t.x,S.y=t.y,F=[{x:t.x,y:t.y},{x:t.x,y:h.y}]}}if(0===k.length&&0===F.length){let n=15>Math.abs(I.x-S.x),r=15>Math.abs(I.y-S.y),o=void 0!==R.get(`${e}:src`)||void 0!==R.get(`${e}:dst`),l=(M.get(`${t.start??""}:${g}:src`)?.length??0)+(M.get(`${t.start??""}:${g}:dst`)?.length??0),i=(M.get(`${t.end??""}:${y}:src`)?.length??0)+(M.get(`${t.end??""}:${y}:dst`)?.length??0),s=l>1||i>1,f=K.get(t.start??"")??0,d=K.get(t.end??"")??0,u=l>1&&E(t.start,g)||i>1&&E(t.end,y),x=l<=1||f<=2,m=i<=1||d<=2,w=s&&!u&&x&&m;if((n||r)&&!o&&(!s||w)&&!b(a,h,t.start,t.end)){t.points=[{...a},{...I},{...S},{...h}],p.add(e);let n=r?"horizontal":"vertical",o=r?a.y:a.x,l=r?Math.min(a.x,h.x):Math.min(a.y,h.y),i=r?Math.max(a.x,h.x):Math.max(a.y,h.y),s={id:`fast-path-${n}-${o.toFixed(0)}-${e}`,orientation:n,coord:o,spanMin:l,spanMax:i,tracks:[]};c.push({edgeIndex:e,segmentIndex:0,orientation:n,pipe:s,trackIndex:0,from:l,to:i});continue}}let B=u("vertical",I.x,I.y,I.y);I.x=B.coord;let A=u("vertical",S.x,S.y,S.y);S.x=A.coord;let X=Math.min(I.x,S.x)-50,z=Math.max(I.x,S.x)+50,Y=Math.min(I.y,S.y)-50,G=Math.max(I.y,S.y)+50;for(let e of d){let t=Math.min(I.x,S.x),n=Math.max(I.x,S.x),r=Math.min(I.y,S.y),o=Math.max(I.y,S.y);e.minX<n&&e.maxX>t&&e.minY<o&&e.maxY>r&&(X=Math.min(X,e.minX-25),z=Math.max(z,e.maxX+25),Y=Math.min(Y,e.minY-25),G=Math.max(G,e.maxY+25))}for(let e of d)e.maxX<X||e.minX>z||e.maxY<Y||e.minY>G||(u("horizontal",e.minY-15,X,z),u("horizontal",e.maxY+15,X,z),u("vertical",e.minX-15,Y,G),u("vertical",e.maxX+15,Y,G));u("horizontal",I.y,X,z),u("horizontal",S.y,X,z);let P=s.filter(e=>"horizontal"===e.orientation&&e.coord>=Y&&e.coord<=G),D=s.filter(e=>"vertical"===e.orientation&&e.coord>=X&&e.coord<=z),_=(0,i.K)((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,"getKey"),H=_(I.x,I.y),j=_(S.x,S.y),V=new Map,U=new Map,W=new Map,Z=new Set,q=[];V.set(H,0),W.set(H,"n"),q.push({key:H,f:Math.hypot(S.x-I.x,S.y-I.y),pt:I}),Z.add(H);let J=[],Q=(0,i.K)((e,n)=>b(e,n,t.start,t.end),"checkSegmentBlocked"),ee={x:S.x,y:I.y},et=Q(I,ee),en=Q(ee,S),er=et||en,eo={x:I.x,y:S.y},el=Q(I,eo),ei=Q(eo,S),ea=el||ei;if(er?ea||(J=1e-6>Math.abs(I.x-S.x)?[I,S]:[I,eo,S]):J=1e-6>Math.abs(I.y-S.y)||1e-6>Math.abs(I.x-S.x)?[I,S]:[I,ee,S],0===J.length)for(;q.length>0;){q.sort((e,t)=>e.f-t.f);let n=q.shift();if(Z.delete(n.key),n.key===j){let e=j,t=S;for(J=[t];U.has(e);){let n=U.get(e);J.unshift(n),t=n,e=_(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=P.sort((e,t)=>e.coord-t.coord),s=a.findIndex(e=>1>Math.abs(e.coord-o)),f=[];for(let u of(i>0&&f.push({x:l[i-1].coord,y:o}),i>=0&&i<l.length-1&&f.push({x:l[i+1].coord,y:o}),s>0&&f.push({x:r,y:a[s-1].coord}),s>=0&&s<a.length-1&&f.push({x:r,y:a[s+1].coord}),f)){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(d.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 f=_(u.x,u.y),h=Math.abs(u.x-r)+Math.abs(u.y-o),g=m(e,n.pt,u),c=0,x=S.x-I.x,p=S.y-I.y,y=u.x-r,b=u.y-o;(p>10&&b<-5||p<-10&&b>5)&&(c=100*Math.abs(b)),(x>10&&y<-5||x<-10&&y>5)&&(c+=50*Math.abs(y));let M=0,K=W.get(n.key)??"n",w=Math.abs(y)>1e-6?"h":"v";"n"!==K&&K!==w&&(M=50);let v=h+g+c+M,C=(V.get(n.key)??1/0)+v,L=Math.abs(S.x-u.x)+Math.abs(S.y-u.y);if(C<(V.get(f)??1/0))if(U.set(f,n.pt),V.set(f,C),W.set(f,w),Z.has(f)){let e=q.findIndex(e=>e.key===f);-1!==e&&(q[e].f=C+L)}else q.push({key:f,f:C+L,pt:u}),Z.add(f)}}if(0===J.length&&(J=[I,{x:I.x,y:S.y},S]),J.length>4){let e=J[0],t=J[J.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 J)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 a=r>Math.max(e.x,t.x),s=n<Math.min(e.x,t.x);if(f){if(a){let n=Math.max(e.x,t.x),o=Math.min(e.y,t.y),l=Math.max(e.y,t.y),i=d.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(s){let r=d.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 u=(0,i.K)(n=>{let r=t.y>e.y,o=d.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(f&&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,i.K)(n=>{let r=u(n),o={x:n,y:e.y},l={x:n,y:r},i={x:t.x,y:r},a=Q(e,o),s=Q(o,l),f=Q(l,i),d=r!==t.y&&Q(i,t);return a||s||f||d?null:1e-6>Math.abs(r-t.y)?[e,o,l,t]:[e,o,l,i,t]},"trySimplifyWithDetourX"),g=a&&!s?h(r):s&&!a?h(n):null;g&&(J=g)}let es=[a,...k,...J,...F.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=u(o,l,i,a),f={edgeIndex:e,segmentIndex:t,orientation:o,pipe:s,trackIndex:0,from:i,to:a};c.push(f),x[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 B=(0,i.K)((e,t)=>e.from<t.to&&t.from<e.to,"segmentsOverlap"),A=(0,i.K)((e,t,n,r)=>{let o=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&B(n,e)),l=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&B(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"),X=(0,i.K)(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},"createNewTrack"),z=(0,i.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"),Y=(0,i.K)((e,t)=>{for(let n of x[e.edgeIndex]){let r=c[n];r.pipe===e.pipe&&z(r,t)}},"moveSegmentChainToTrack"),G=(0,i.K)(e=>{let t=x[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"),P=(0,i.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,i.K)((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&B(e,t)))return n.index;return -1},"findAvailableTrack"),_=(0,i.K)((e,t)=>{if(e.trackIndex===t.trackIndex)return B(e,t);let n=G(e),r=G(t);return n.some(e=>r.some(t=>P(e,t)))},"segmentsConflict"),H=(0,i.K)((e,t,n)=>{if(A(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=D(e.pipe,t);n(t,-1!==r?r:X(e.pipe))},"resolveTrackConflict"),j=(0,i.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&&_(o,l)&&(t++,H(o,l,Y))}return t},"resolveHandleConflicts"),V=new Map,U=(0,i.K)(e=>{if(V.has(e))return V.get(e);let t=x[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"),W=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==x[e].length&&n.start&&(t.has(n.start)||t.set(n.start,[]),t.get(n.start).push(e));let n=(0,i.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=U(e),o=U(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=x[e].length,s=x[t].length;if(a!==s)return a-s;if(1===a){let n=x[e][0],r=x[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[x[e][0]]));return e},"fixSourceHandleCrossings"),Z=(0,i.K)(()=>{let e=0,t=new Map;for(let[e,n]of o.entries())0!==x[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,i.K)(e=>{let t=x[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[x[e][x[e].length-1]]));return e},"fixTargetHandleCrossings"),q=(0,i.K)(()=>{let e=0;for(let t of s){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=x[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];_(o,l)&&(e++,H(o,l,z))}}return e},"fixPipeCrossings"),J=0;for(;J<10&&0!==0+W()+Z()+q();){;J++}let Q=new Map;for(let e of s){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=U(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),a=[...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 s=(0,i.K)((n,r)=>{t.filter(e=>e.trackIndex===n).forEach(t=>{let n=p.has(t.edgeIndex)?e.coord:r;Q.set(`${t.edgeIndex}-${t.segmentIndex}`,n)})},"assignCoord"),f=0;for(let t of o)f++,s(t,e.coord-10*f);if(0===a.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 i=l.indexOf(e);-1!==i&&l.splice(i,1),a.push(e)}let d=0;for(let t of a){if(0===d)s(t,e.coord);else{let n=d%2==1?1:-1,r=Math.ceil(d/2);s(t,e.coord+n*r*5)}d++}let u=0;for(let t of l)u++,s(t,e.coord+10*u)}}for(let[e,t]of o.entries()){let n=x[e]??[];if(0===n.length)continue;let r=[],{pSrcPort:o,pDstPort:i}=N(e,l.get(t.start),l.get(t.end)),a=n.map(e=>{let t=c[e],n=Q.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(t0(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:tQ(t,i);r.push(t0(t,e),t0(i,e))}else(0===e||e===a.length-2)&&r.push(t0(t,tQ(t,i)));else if(s)r.push(t0(t,i.coord));else{let e=Math.abs(t.from-o)<Math.abs(t.to-o)?t.to:t.from;r.push(t0(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,i.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 t2(e){return e.direction??"TB"}function t6(e){let t=h(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=t2(e),{ordered:s,coordinates:f}=tq(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:o,optimizeRanksByCrossings:l,automaticLaneOrdering:i,direction:a});for(let o of(g(t,s,f,{nodeGap:n,layerGap:r}),e.edges??[]))delete o.points;for(let t of(t1(e,a),e.edges??[]))t.curve&&"basis"!==t.curve||(t.curve="rounded");return e0(e,a),eQ(e),a}function t5(e){u(e);let t=c(e);e.nodes=t.nodes,e.edges=t.edges}(0,i.K)(tf,"buildDrivingTree"),(0,i.K)(td,"chooseParent"),(0,i.K)(tu,"buildAdjacency"),(0,i.K)(th,"assignComponents"),(0,i.K)(tg,"computeBlocks"),(0,i.K)(tc,"popBlock"),(0,i.K)(tx,"computeSubtreeCrossCounts"),(0,i.K)(tp,"annotateMinimumLayers"),(0,i.K)(tm,"compareByRankThenId"),(0,i.K)(ty,"emitNodesInTreeOrder"),(0,i.K)(tb,"deduplicateLayers"),(0,i.K)(tM,"createChildOrderer"),(0,i.K)(tK,"buildMultitreeLayerOrder"),(0,i.K)(tI,"countCrossingsBetweenAdjacent"),(0,i.K)(tS,"totalCrossings"),(0,i.K)(tw,"optimizeRanksByCrossings"),(0,i.K)(tv,"adjustCrossLaneSources"),(0,i.K)(tC,"assignLayers_LongestPath"),(0,i.K)(tL,"assignLayers_Gravity"),(0,i.K)(tk,"topoSortByGenerationIfAcyclic"),(0,i.K)(tT,"assignLayers_LaneAwareCompact"),(0,i.K)(tO,"makeProperLayering"),(0,i.K)(tR,"median"),(0,i.K)(tF,"barycenter"),(0,i.K)(tE,"neighborPositionsFor"),(0,i.K)(t$,"currentOrderTieBreak"),(0,i.K)(tN,"countCrossingsBetweenAdjacent"),(0,i.K)(tB,"sortByHeuristic"),(0,i.K)(tA,"reorderLayer"),(0,i.K)(tX,"transposeImprove"),(0,i.K)(tz,"orderLayers"),(0,i.K)(tY,"assignCoordinates"),(0,i.K)(tG,"hashString"),(0,i.K)(tP,"mulberry32"),(0,i.K)(tD,"deterministicShuffle"),(0,i.K)(t_,"sourceDistance"),(0,i.K)(tH,"laneArrangementCost"),(0,i.K)(tj,"buildWeightedLaneEdges"),(0,i.K)(tV,"greedySwitch"),(0,i.K)(tU,"isBetterCandidate"),(0,i.K)(tW,"seedForRestart"),(0,i.K)(tZ,"optimizeTopLaneOrder"),(0,i.K)(tq,"sugiyamaLayout"),(0,i.K)(tJ,"chooseOrthogonalSide"),(0,i.K)(tQ,"sharedLineEndpointCoord"),(0,i.K)(t0,"pointOnLine"),(0,i.K)(t1,"routeEdgesOrthogonal"),(0,i.K)(t2,"getSwimlaneDirection"),(0,i.K)(t6,"runSwimlaneLayoutCore"),(0,i.K)(t5,"prepareSwimlaneLayout");var t3=(0,o.xY)({prepareLayout:t5,runLayoutCore:t6,afterPaint:a})}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2435],{22435:(e,c,r)=>{r.d(c,{createArchitectureServices:()=>s.S});var s=r(51566);r(74775)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2506],{97:(t,e,r)=>{r.d(e,{A:()=>i});var n=r(28175);let i=function(t){return"function"==typeof t?t:n.A}},1165:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(23264),i=r(86613);let o=function(t){return"symbol"==typeof t||(0,i.A)(t)&&"[object Symbol]"==(0,n.A)(t)}},1798:(t,e,r)=>{r.d(e,{A:()=>i});var n=/^(?:0|[1-9]\d*)$/;let i=function(t,e){var r=typeof t;return!!(e=null==e?0x1fffffffffffff:e)&&("number"==r||"symbol"!=r&&n.test(t))&&t>-1&&t%1==0&&t<e}},2276:(t,e,r)=>{r.d(e,{A:()=>s});var n=r(36677),i=r(55328),o=r(28175),u=i.A?function(t,e){return(0,i.A)(t,"toString",{configurable:!0,enumerable:!1,value:(0,n.A)(e),writable:!0})}:o.A,a=Date.now;let s=function(t){var e=0,r=0;return function(){var n=a(),i=16-(n-r);if(r=n,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}(u)},2753:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(3562),i=r(1165),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,u=/^\w*$/;let a=function(t,e){if((0,n.A)(t))return!1;var r=typeof t;return!!("number"==r||"symbol"==r||"boolean"==r||null==t||(0,i.A)(t))||u.test(t)||!o.test(t)||null!=e&&t in Object(e)}},3562:(t,e,r)=>{r.d(e,{A:()=>n});let n=Array.isArray},4167:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}},5057:(t,e,r)=>{r.d(e,{A:()=>A});var n=r(97333),i=r(67610).A["__core-js_shared__"],o=function(){var t=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),u=r(75370),a=r(68078),s=/^\[object .+?Constructor\]$/,c=Object.prototype,l=Function.prototype.toString,f=c.hasOwnProperty,h=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");let d=function(t){return!!(0,u.A)(t)&&(!o||!(o in t))&&((0,n.A)(t)?h:s).test((0,a.A)(t))},A=function(t,e){var r=null==t?void 0:t[e];return d(r)?r:void 0}},5514:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(99723),i=r(54977);let o=function(t,e){return t&&(0,n.A)(t,e,i.A)}},6999:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return void 0===t}},7392:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}},7416:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(64211);let i=function(t,e){for(var r=t.length;r--;)if((0,n.A)(t[r][0],e))return r;return -1};var o=Array.prototype.splice;function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=function(){this.__data__=[],this.size=0},u.prototype.delete=function(t){var e=this.__data__,r=i(e,t);return!(r<0)&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)},u.prototype.get=function(t){var e=this.__data__,r=i(e,t);return r<0?void 0:e[r][1]},u.prototype.has=function(t){return i(this.__data__,t)>-1},u.prototype.set=function(t,e){var r=this.__data__,n=i(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};let a=u},15178:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return function(e){return t(e)}}},15863:(t,e,r)=>{r.d(e,{A:()=>n});let n="object"==typeof global&&global&&global.Object===Object&&global},17747:(t,e,r)=>{r.d(e,{T:()=>M});var n=r(36677),i=r(97333),o=r(54977),u=r(86232),a=r(26914),s=r(75257),c=r(65289),l=r(3562),f=r(85781),h=r(45962),d=r(57940),A=r(66708),p=Object.prototype.hasOwnProperty;let v=function(t){if(null==t)return!0;if((0,f.A)(t)&&((0,l.A)(t)||"string"==typeof t||"function"==typeof t.splice||(0,h.A)(t)||(0,A.A)(t)||(0,c.A)(t)))return!t.length;var e=(0,s.A)(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if((0,d.A)(t))return!(0,a.A)(t).length;for(var r in t)if(p.call(t,r))return!1;return!0};var _=r(74833),b=r(6999),g=r(59685),y=r(38281),j=r(53651),O=r(75956);let w=function(t){return t!=t},m=function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return -1},C=function(t,e){return!!(null==t?0:t.length)&&(e==e?m(t,e,0):(0,O.A)(t,w,0))>-1},E=function(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1};var P=r(96568),z=r(80370),N=r(7392),L=z.A&&1/(0,N.A)(new z.A([,-0]))[1]==1/0?function(t){return new z.A(t)}:function(){};let S=function(t,e,r){var n=-1,i=C,o=t.length,u=!0,a=[],s=a;if(r)u=!1,i=E;else if(o>=200){var c=e?null:L(t);if(c)return(0,N.A)(c);u=!1,i=P.A,s=new j.A}else s=e?[]:a;t:for(;++n<o;){var l=t[n],f=e?e(l):l;if(l=r||0!==l?l:0,u&&f==f){for(var h=s.length;h--;)if(s[h]===f)continue t;e&&s.push(f),a.push(l)}else i(s,f,r)||(s!==a&&s.push(f),a.push(l))}return a};var D=r(54794),x=(0,y.A)(function(t){return S((0,g.A)(t,1,D.A,!0))}),k=r(68290),F=r(18950);class M{constructor(t={}){this._isDirected=!Object.prototype.hasOwnProperty.call(t,"directed")||t.directed,this._isMultigraph=!!Object.prototype.hasOwnProperty.call(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.prototype.hasOwnProperty.call(t,"compound")&&t.compound,this._label=void 0,this._defaultNodeLabelFn=n.A(void 0),this._defaultEdgeLabelFn=n.A(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return i.A(t)||(t=n.A(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return o.A(this._nodes)}sources(){var t=this;return u.A(this.nodes(),function(e){return v(t._in[e])})}sinks(){var t=this;return u.A(this.nodes(),function(e){return v(t._out[e])})}setNodes(t,e){var r=arguments,n=this;return _.A(t,function(t){r.length>1?n.setNode(t,e):n.setNode(t)}),this}setNode(t,e){return Object.prototype.hasOwnProperty.call(this._nodes,t)?arguments.length>1&&(this._nodes[t]=e):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount),this}node(t){return this._nodes[t]}hasNode(t){return Object.prototype.hasOwnProperty.call(this._nodes,t)}removeNode(t){if(Object.prototype.hasOwnProperty.call(this._nodes,t)){var e=t=>this.removeEdge(this._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],_.A(this.children(t),t=>{this.setParent(t)}),delete this._children[t]),_.A(o.A(this._in[t]),e),delete this._in[t],delete this._preds[t],_.A(o.A(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw Error("Cannot set parent in a non-compound graph");if(b.A(e))e="\0";else{e+="";for(var r=e;!b.A(r);r=this.parent(r))if(r===t)throw Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if("\0"!==e)return e}}children(t){if(b.A(t)&&(t="\0"),this._isCompound){var e=this._children[t];if(e)return o.A(e)}else if("\0"===t)return this.nodes();else if(this.hasNode(t))return[]}predecessors(t){var e=this._preds[t];if(e)return o.A(e)}successors(t){var e=this._sucs[t];if(e)return o.A(e)}neighbors(t){var e=this.predecessors(t);if(e)return x(e,this.successors(t))}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var r=this;_.A(this._nodes,function(r,n){t(n)&&e.setNode(n,r)}),_.A(this._edgeObjs,function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,r.edge(t))});var n={};return this._isCompound&&_.A(e.nodes(),function(t){e.setParent(t,function t(i){var o=r.parent(i);return void 0===o||e.hasNode(o)?(n[i]=o,o):o in n?n[o]:t(o)}(t))}),e}setDefaultEdgeLabel(t){return i.A(t)||(t=n.A(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return k.A(this._edgeObjs)}setPath(t,e){var r=this,n=arguments;return F.A(t,function(t,i){return n.length>1?r.setEdge(t,i,e):r.setEdge(t,i),i}),this}setEdge(){var t,e,r,n,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,r=o.name,2==arguments.length&&(n=arguments[1],i=!0)):(t=o,e=arguments[1],r=arguments[3],arguments.length>2&&(n=arguments[2],i=!0)),t=""+t,e=""+e,b.A(r)||(r=""+r);var u=B(this._isDirected,t,e,r);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,u))return i&&(this._edgeLabels[u]=n),this;if(!b.A(r)&&!this._isMultigraph)throw Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[u]=i?n:this._defaultEdgeLabelFn(t,e,r);var a=function(t,e,r,n){var i=""+e,o=""+r;if(!t&&i>o){var u=i;i=o,o=u}var a={v:i,w:o};return n&&(a.name=n),a}(this._isDirected,t,e,r);return t=a.v,e=a.w,Object.freeze(a),this._edgeObjs[u]=a,T(this._preds[e],t),T(this._sucs[t],e),this._in[e][u]=a,this._out[t][u]=a,this._edgeCount++,this}edge(t,e,r){var n=1==arguments.length?I(this._isDirected,arguments[0]):B(this._isDirected,t,e,r);return this._edgeLabels[n]}hasEdge(t,e,r){var n=1==arguments.length?I(this._isDirected,arguments[0]):B(this._isDirected,t,e,r);return Object.prototype.hasOwnProperty.call(this._edgeLabels,n)}removeEdge(t,e,r){var n=1==arguments.length?I(this._isDirected,arguments[0]):B(this._isDirected,t,e,r),i=this._edgeObjs[n];return i&&(t=i.v,e=i.w,delete this._edgeLabels[n],delete this._edgeObjs[n],$(this._preds[e],t),$(this._sucs[t],e),delete this._in[e][n],delete this._out[t][n],this._edgeCount--),this}inEdges(t,e){var r=this._in[t];if(r){var n=k.A(r);return e?u.A(n,function(t){return t.v===e}):n}}outEdges(t,e){var r=this._out[t];if(r){var n=k.A(r);return e?u.A(n,function(t){return t.w===e}):n}}nodeEdges(t,e){var r=this.inEdges(t,e);if(r)return r.concat(this.outEdges(t,e))}}function T(t,e){t[e]?t[e]++:t[e]=1}function $(t,e){--t[e]||delete t[e]}function B(t,e,r,n){var i=""+e,o=""+r;if(!t&&i>o){var u=i;i=o,o=u}return i+"\x01"+o+"\x01"+(b.A(n)?"\0":n)}function I(t,e){return B(t,e.v,e.w,e.name)}M.prototype._nodeCount=0,M.prototype._edgeCount=0},18950:(t,e,r)=>{r.d(e,{A:()=>s});let n=function(t,e,r,n){var i=-1,o=null==t?0:t.length;for(n&&o&&(r=t[++i]);++i<o;)r=e(r,t[i],i,t);return r};var i=r(69386),o=r(83657);let u=function(t,e,r,n,i){return i(t,function(t,i,o){r=n?(n=!1,t):e(r,t,i,o)}),r};var a=r(3562);let s=function(t,e,r){var s=(0,a.A)(t)?n:u,c=arguments.length<3;return s(t,(0,o.A)(e,4),r,c,i.A)}},23264:(t,e,r)=>{r.d(e,{A:()=>f});var n=r(93726),i=Object.prototype,o=i.hasOwnProperty,u=i.toString,a=n.A?n.A.toStringTag:void 0;let s=function(t){var e=o.call(t,a),r=t[a];try{t[a]=void 0;var n=!0}catch(t){}var i=u.call(t);return n&&(e?t[a]=r:delete t[a]),i};var c=Object.prototype.toString,l=n.A?n.A.toStringTag:void 0;let f=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":l&&l in Object(t)?s(t):c.call(t)}},26914:(t,e,r)=>{r.d(e,{A:()=>u});var n=r(57940),i=(0,r(76096).A)(Object.keys,Object),o=Object.prototype.hasOwnProperty;let u=function(t){if(!(0,n.A)(t))return i(t);var e=[];for(var r in Object(t))o.call(t,r)&&"constructor"!=r&&e.push(r);return e}},27442:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return function(e){return null==e?void 0:e[t]}}},28074:(t,e,r)=>{r.d(e,{A:()=>o});let n=function(t,e){return null!=t&&e in Object(t)};var i=r(41113);let o=function(t,e){return null!=t&&(0,i.A)(t,e,n)}},28137:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(95852),i=r(65514);let o=function(t,e){e=(0,n.A)(e,t);for(var r=0,o=e.length;null!=t&&r<o;)t=t[(0,i.A)(e[r++])];return r&&r==o?t:void 0}},28175:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return t}},29806:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(7416),i=r(59644),o=r(51269);function u(t){var e=this.__data__=new n.A(t);this.size=e.size}u.prototype.clear=function(){this.__data__=new n.A,this.size=0},u.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},u.prototype.get=function(t){return this.__data__.get(t)},u.prototype.has=function(t){return this.__data__.has(t)},u.prototype.set=function(t,e){var r=this.__data__;if(r instanceof n.A){var u=r.__data__;if(!i.A||u.length<199)return u.push([t,e]),this.size=++r.size,this;r=this.__data__=new o.A(u)}return r.set(t,e),this.size=r.size,this};let a=u},36677:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return function(){return t}}},38281:(t,e,r)=>{r.d(e,{A:()=>u});var n=r(28175),i=r(77701),o=r(2276);let u=function(t,e){return(0,o.A)((0,i.A)(t,e,n.A),t+"")}},40507:(t,e,r)=>{r.d(e,{A:()=>n});let n=r(67610).A.Uint8Array},41113:(t,e,r)=>{r.d(e,{A:()=>c});var n=r(95852),i=r(65289),o=r(3562),u=r(1798),a=r(60629),s=r(65514);let c=function(t,e,r){e=(0,n.A)(e,t);for(var c=-1,l=e.length,f=!1;++c<l;){var h=(0,s.A)(e[c]);if(!(f=null!=t&&r(t,h)))break;t=t[h]}return f||++c!=l?f:!!(l=null==t?0:t.length)&&(0,a.A)(l)&&(0,u.A)(h,l)&&((0,o.A)(t)||(0,i.A)(t))}},41251:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}},41905:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var u=t[r];e(u,r,t)&&(o[i++]=u)}return o}},42970:(t,e,r)=>{r.d(e,{A:()=>l});let n=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var i=r(65289),o=r(3562),u=r(45962),a=r(1798),s=r(66708),c=Object.prototype.hasOwnProperty;let l=function(t,e){var r=(0,o.A)(t),l=!r&&(0,i.A)(t),f=!r&&!l&&(0,u.A)(t),h=!r&&!l&&!f&&(0,s.A)(t),d=r||l||f||h,A=d?n(t.length,String):[],p=A.length;for(var v in t)(e||c.call(t,v))&&!(d&&("length"==v||f&&("offset"==v||"parent"==v)||h&&("buffer"==v||"byteLength"==v||"byteOffset"==v)||(0,a.A)(v,p)))&&A.push(v);return A}},45022:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(){return[]}},45962:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(67610),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=i&&"object"==typeof module&&module&&!module.nodeType&&module,u=o&&o.exports===i?n.A.Buffer:void 0;let a=(u?u.isBuffer:void 0)||function(){return!1}},51269:(t,e,r)=>{r.d(e,{A:()=>h});var n=(0,r(5057).A)(Object,"create"),i=Object.prototype.hasOwnProperty,o=Object.prototype.hasOwnProperty;function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}u.prototype.clear=function(){this.__data__=n?n(null):{},this.size=0},u.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=!!e,e},u.prototype.get=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return i.call(e,t)?e[t]:void 0},u.prototype.has=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)},u.prototype.set=function(t,e){var r=this.__data__;return this.size+=+!this.has(t),r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this};var a=r(7416),s=r(59644);let c=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t},l=function(t,e){var r=t.__data__;return c(e)?r["string"==typeof e?"string":"hash"]:r.map};function f(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}f.prototype.clear=function(){this.size=0,this.__data__={hash:new u,map:new(s.A||a.A),string:new u}},f.prototype.delete=function(t){var e=l(this,t).delete(t);return this.size-=!!e,e},f.prototype.get=function(t){return l(this,t).get(t)},f.prototype.has=function(t){return l(this,t).has(t)},f.prototype.set=function(t,e){var r=l(this,t),n=r.size;return r.set(t,e),this.size+=+(r.size!=n),this};let h=f},52554:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},53651:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(51269);function i(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new n.A;++e<r;)this.add(t[e])}i.prototype.add=i.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},i.prototype.has=function(t){return this.__data__.has(t)};let o=i},54794:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(85781),i=r(86613);let o=function(t){return(0,i.A)(t)&&(0,n.A)(t)}},54977:(t,e,r)=>{r.d(e,{A:()=>u});var n=r(42970),i=r(26914),o=r(85781);let u=function(t){return(0,o.A)(t)?(0,n.A)(t):(0,i.A)(t)}},55328:(t,e,r)=>{r.d(e,{A:()=>i});var n=r(5057);let i=function(){try{var t=(0,n.A)(Object,"defineProperty");return t({},"",{}),t}catch(t){}}()},55682:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(15863),i="object"==typeof exports&&exports&&!exports.nodeType&&exports,o=i&&"object"==typeof module&&module&&!module.nodeType&&module,u=o&&o.exports===i&&n.A.process;let a=function(){try{var t=o&&o.require&&o.require("util").types;if(t)return t;return u&&u.binding&&u.binding("util")}catch(t){}}()},57441:(t,e,r)=>{r.d(e,{A:()=>u});var n=r(76172),i=r(85783),o=r(54977);let u=function(t){return(0,n.A)(t,o.A,i.A)}},57940:(t,e,r)=>{r.d(e,{A:()=>i});var n=Object.prototype;let i=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||n)}},59644:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(5057),i=r(67610);let o=(0,n.A)(i.A,"Map")},59685:(t,e,r)=>{r.d(e,{A:()=>c});var n=r(41251),i=r(93726),o=r(65289),u=r(3562),a=i.A?i.A.isConcatSpreadable:void 0;let s=function(t){return(0,u.A)(t)||(0,o.A)(t)||!!(a&&t&&t[a])},c=function t(e,r,i,o,u){var a=-1,c=e.length;for(i||(i=s),u||(u=[]);++a<c;){var l=e[a];r>0&&i(l)?r>1?t(l,r-1,i,o,u):(0,n.A)(u,l):o||(u[u.length]=l)}return u}},60629:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=0x1fffffffffffff}},64211:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){return t===e||t!=t&&e!=e}},65289:(t,e,r)=>{r.d(e,{A:()=>c});var n=r(23264),i=r(86613);let o=function(t){return(0,i.A)(t)&&"[object Arguments]"==(0,n.A)(t)};var u=Object.prototype,a=u.hasOwnProperty,s=u.propertyIsEnumerable;let c=o(function(){return arguments}())?o:function(t){return(0,i.A)(t)&&a.call(t,"callee")&&!s.call(t,"callee")}},65514:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(1165),i=1/0;let o=function(t){if("string"==typeof t||(0,n.A)(t))return t;var e=t+"";return"0"==e&&1/t==-i?"-0":e}},66708:(t,e,r)=>{r.d(e,{A:()=>l});var n=r(23264),i=r(60629),o=r(86613),u={};u["[object Float32Array]"]=u["[object Float64Array]"]=u["[object Int8Array]"]=u["[object Int16Array]"]=u["[object Int32Array]"]=u["[object Uint8Array]"]=u["[object Uint8ClampedArray]"]=u["[object Uint16Array]"]=u["[object Uint32Array]"]=!0,u["[object Arguments]"]=u["[object Array]"]=u["[object ArrayBuffer]"]=u["[object Boolean]"]=u["[object DataView]"]=u["[object Date]"]=u["[object Error]"]=u["[object Function]"]=u["[object Map]"]=u["[object Number]"]=u["[object Object]"]=u["[object RegExp]"]=u["[object Set]"]=u["[object String]"]=u["[object WeakMap]"]=!1;var a=r(15178),s=r(55682),c=s.A&&s.A.isTypedArray;let l=c?(0,a.A)(c):function(t){return(0,o.A)(t)&&(0,i.A)(t.length)&&!!u[(0,n.A)(t)]}},67610:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(15863),i="object"==typeof self&&self&&self.Object===Object&&self;let o=n.A||i||Function("return this")()},68078:(t,e,r)=>{r.d(e,{A:()=>i});var n=Function.prototype.toString;let i=function(t){if(null!=t){try{return n.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},68290:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(4167),i=r(54977);let o=function(t){var e;return null==t?[]:(e=(0,i.A)(t),(0,n.A)(e,function(e){return t[e]}))}},69386:(t,e,r)=>{r.d(e,{A:()=>u});var n,i=r(5514),o=r(85781);let u=(n=i.A,function(t,e){if(null==t)return t;if(!(0,o.A)(t))return n(t,e);for(var r=t.length,i=-1,u=Object(t);++i<r&&!1!==e(u[i],i,u););return t})},74833:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(52554),i=r(69386),o=r(97),u=r(3562);let a=function(t,e){return((0,u.A)(t)?n.A:i.A)(t,(0,o.A)(e))}},75257:(t,e,r)=>{r.d(e,{A:()=>w});var n=r(5057),i=r(67610),o=(0,n.A)(i.A,"DataView"),u=r(59644),a=(0,n.A)(i.A,"Promise"),s=r(80370),c=(0,n.A)(i.A,"WeakMap"),l=r(23264),f=r(68078),h="[object Map]",d="[object Promise]",A="[object Set]",p="[object WeakMap]",v="[object DataView]",_=(0,f.A)(o),b=(0,f.A)(u.A),g=(0,f.A)(a),y=(0,f.A)(s.A),j=(0,f.A)(c),O=l.A;(o&&O(new o(new ArrayBuffer(1)))!=v||u.A&&O(new u.A)!=h||a&&O(a.resolve())!=d||s.A&&O(new s.A)!=A||c&&O(new c)!=p)&&(O=function(t){var e=(0,l.A)(t),r="[object Object]"==e?t.constructor:void 0,n=r?(0,f.A)(r):"";if(n)switch(n){case _:return v;case b:return h;case g:return d;case y:return A;case j:return p}return e});let w=O},75370:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},75956:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return -1}},76096:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){return function(r){return t(e(r))}}},76172:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(41251),i=r(3562);let o=function(t,e,r){var o=e(t);return(0,i.A)(t)?o:(0,n.A)(o,r(t))}},77701:(t,e,r)=>{r.d(e,{A:()=>o});let n=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)};var i=Math.max;let o=function(t,e,r){return e=i(void 0===e?t.length-1:e,0),function(){for(var o=arguments,u=-1,a=i(o.length-e,0),s=Array(a);++u<a;)s[u]=o[e+u];u=-1;for(var c=Array(e+1);++u<e;)c[u]=o[u];return c[e]=r(s),n(t,this,c)}}},80370:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(5057),i=r(67610);let o=(0,n.A)(i.A,"Set")},80383:(t,e,r)=>{r.d(e,{A:()=>f});var n=r(93726),i=r(4167),o=r(3562),u=r(1165),a=1/0,s=n.A?n.A.prototype:void 0,c=s?s.toString:void 0;let l=function t(e){if("string"==typeof e)return e;if((0,o.A)(e))return(0,i.A)(e,t)+"";if((0,u.A)(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-a?"-0":r},f=function(t){return null==t?"":l(t)}},82506:(t,e,r)=>{r.d(e,{T:()=>n.T});var n=r(17747)},83657:(t,e,r)=>{r.d(e,{A:()=>W});var n=r(29806),i=r(53651);let o=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var u=r(96568);let a=function(t,e,r,n,a,s){var c=1&r,l=t.length,f=e.length;if(l!=f&&!(c&&f>l))return!1;var h=s.get(t),d=s.get(e);if(h&&d)return h==e&&d==t;var A=-1,p=!0,v=2&r?new i.A:void 0;for(s.set(t,e),s.set(e,t);++A<l;){var _=t[A],b=e[A];if(n)var g=c?n(b,_,A,e,t,s):n(_,b,A,t,e,s);if(void 0!==g){if(g)continue;p=!1;break}if(v){if(!o(e,function(t,e){if(!(0,u.A)(v,e)&&(_===t||a(_,t,r,n,s)))return v.push(e)})){p=!1;break}}else if(!(_===b||a(_,b,r,n,s))){p=!1;break}}return s.delete(t),s.delete(e),p};var s=r(93726),c=r(40507),l=r(64211);let f=function(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r};var h=r(7392),d=s.A?s.A.prototype:void 0,A=d?d.valueOf:void 0;let p=function(t,e,r,n,i,o,u){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!o(new c.A(t),new c.A(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return(0,l.A)(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var s=f;case"[object Set]":var d=1&n;if(s||(s=h.A),t.size!=e.size&&!d)break;var p=u.get(t);if(p)return p==e;n|=2,u.set(t,e);var v=a(s(t),s(e),n,i,o,u);return u.delete(t),v;case"[object Symbol]":if(A)return A.call(t)==A.call(e)}return!1};var v=r(57441),_=Object.prototype.hasOwnProperty;let b=function(t,e,r,n,i,o){var u=1&r,a=(0,v.A)(t),s=a.length;if(s!=(0,v.A)(e).length&&!u)return!1;for(var c=s;c--;){var l=a[c];if(!(u?l in e:_.call(e,l)))return!1}var f=o.get(t),h=o.get(e);if(f&&h)return f==e&&h==t;var d=!0;o.set(t,e),o.set(e,t);for(var A=u;++c<s;){var p=t[l=a[c]],b=e[l];if(n)var g=u?n(b,p,l,e,t,o):n(p,b,l,t,e,o);if(!(void 0===g?p===b||i(p,b,r,n,o):g)){d=!1;break}A||(A="constructor"==l)}if(d&&!A){var y=t.constructor,j=e.constructor;y!=j&&"constructor"in t&&"constructor"in e&&!("function"==typeof y&&y instanceof y&&"function"==typeof j&&j instanceof j)&&(d=!1)}return o.delete(t),o.delete(e),d};var g=r(75257),y=r(3562),j=r(45962),O=r(66708),w="[object Arguments]",m="[object Array]",C="[object Object]",E=Object.prototype.hasOwnProperty;let P=function(t,e,r,i,o,u){var s=(0,y.A)(t),c=(0,y.A)(e),l=s?m:(0,g.A)(t),f=c?m:(0,g.A)(e);l=l==w?C:l,f=f==w?C:f;var h=l==C,d=f==C,A=l==f;if(A&&(0,j.A)(t)){if(!(0,j.A)(e))return!1;s=!0,h=!1}if(A&&!h)return u||(u=new n.A),s||(0,O.A)(t)?a(t,e,r,i,o,u):p(t,e,l,r,i,o,u);if(!(1&r)){var v=h&&E.call(t,"__wrapped__"),_=d&&E.call(e,"__wrapped__");if(v||_){var P=v?t.value():t,z=_?e.value():e;return u||(u=new n.A),o(P,z,r,i,u)}}return!!A&&(u||(u=new n.A),b(t,e,r,i,o,u))};var z=r(86613);let N=function t(e,r,n,i,o){return e===r||(null!=e&&null!=r&&((0,z.A)(e)||(0,z.A)(r))?P(e,r,n,i,t,o):e!=e&&r!=r)},L=function(t,e,r,i){var o=r.length,u=o,a=!i;if(null==t)return!u;for(t=Object(t);o--;){var s=r[o];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++o<u;){var c=(s=r[o])[0],l=t[c],f=s[1];if(a&&s[2]){if(void 0===l&&!(c in t))return!1}else{var h=new n.A;if(i)var d=i(l,f,c,t,e,h);if(!(void 0===d?N(f,l,3,i,h):d))return!1}}return!0};var S=r(75370);let D=function(t){return t==t&&!(0,S.A)(t)};var x=r(54977);let k=function(t){for(var e=(0,x.A)(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,D(i)]}return e},F=function(t,e){return function(r){return null!=r&&r[t]===e&&(void 0!==e||t in Object(r))}},M=function(t){var e=k(t);return 1==e.length&&e[0][2]?F(e[0][0],e[0][1]):function(r){return r===t||L(r,t,e)}};var T=r(28137);let $=function(t,e,r){var n=null==t?void 0:(0,T.A)(t,e);return void 0===n?r:n};var B=r(28074),I=r(2753),U=r(65514),R=r(28175),V=r(27442);let G=function(t){return(0,I.A)(t)?(0,V.A)((0,U.A)(t)):function(e){return(0,T.A)(e,t)}},W=function(t){if("function"==typeof t)return t;if(null==t)return R.A;if("object"==typeof t){var e,r;return(0,y.A)(t)?(e=t[0],r=t[1],(0,I.A)(e)&&D(r)?F((0,U.A)(e),r):function(t){var n=$(t,e);return void 0===n&&n===r?(0,B.A)(t,e):N(r,n,3)}):M(t)}return G(t)}},85781:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(97333),i=r(60629);let o=function(t){return null!=t&&(0,i.A)(t.length)&&!(0,n.A)(t)}},85783:(t,e,r)=>{r.d(e,{A:()=>a});var n=r(41905),i=r(45022),o=Object.prototype.propertyIsEnumerable,u=Object.getOwnPropertySymbols;let a=u?function(t){return null==t?[]:(t=Object(t),(0,n.A)(u(t),function(e){return o.call(t,e)}))}:i.A},86232:(t,e,r)=>{r.d(e,{A:()=>s});var n=r(41905),i=r(69386);let o=function(t,e){var r=[];return(0,i.A)(t,function(t,n,i){e(t,n,i)&&r.push(t)}),r};var u=r(83657),a=r(3562);let s=function(t,e){return((0,a.A)(t)?n.A:o)(t,(0,u.A)(e,3))}},86613:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t){return null!=t&&"object"==typeof t}},93726:(t,e,r)=>{r.d(e,{A:()=>n});let n=r(67610).A.Symbol},95852:(t,e,r)=>{r.d(e,{A:()=>f});var n=r(3562),i=r(2753),o=r(51269);function u(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw TypeError("Expected a function");var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var u=t.apply(this,n);return r.cache=o.set(i,u)||o,u};return r.cache=new(u.Cache||o.A),r}u.Cache=o.A;var a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,c=function(t){var e=u(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(a,function(t,r,n,i){e.push(n?i.replace(s,"$1"):r||t)}),e}),l=r(80383);let f=function(t,e){return(0,n.A)(t)?t:(0,i.A)(t,e)?[t]:c((0,l.A)(t))}},96568:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e){return t.has(e)}},97333:(t,e,r)=>{r.d(e,{A:()=>o});var n=r(23264),i=r(75370);let o=function(t){if(!(0,i.A)(t))return!1;var e=(0,n.A)(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},99723:(t,e,r)=>{r.d(e,{A:()=>n});let n=function(t,e,r){for(var n=-1,i=Object(t),o=r(t),u=o.length;u--;){var a=o[++n];if(!1===e(i[a],a,i))break}return t}}}]);
@@ -0,0 +1,41 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2529],{42529:(t,e,a)=>{a.d(e,{diagram:()=>E});var r=a(77433),i=a(83176),n=a(73607),l=a(97562),s=a(13318),o=a(36744),c=a(96260),d={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},g={axes:[],curves:[],options:d},u=structuredClone(g),p=l.UI.radar,x=(0,o.K)(()=>(0,n.$t)({...p,...(0,l.zj)().radar}),"getConfig"),h=(0,o.K)(()=>u.axes,"getAxes"),m=(0,o.K)(()=>u.curves,"getCurves"),$=(0,o.K)(()=>u.options,"getOptions"),f=(0,o.K)(t=>{u.axes=t.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),y=(0,o.K)(t=>{u.curves=t.map(t=>({name:t.name,label:t.label??t.name,entries:v(t.entries)}))},"setCurves"),v=(0,o.K)(t=>{if(void 0==t[0].axis)return t.map(t=>t.value);let e=h();if(0===e.length)throw Error("Axes must be populated before curves for reference entries");return e.map(e=>{let a=t.find(t=>t.axis?.$refText===e.name);if(void 0===a)throw Error("Missing entry for axis "+e.label);return a.value})},"computeCurveEntries"),w={getAxes:h,getCurves:m,getOptions:$,setAxes:f,setCurves:y,setOptions:(0,o.K)(t=>{let e=t.reduce((t,e)=>(t[e.name]=e,t),{});u.options={showLegend:e.showLegend?.value??d.showLegend,ticks:e.ticks?.value??d.ticks,max:e.max?.value??d.max,min:e.min?.value??d.min,graticule:e.graticule?.value??d.graticule},u.options.ticks>32&&(s.R.warn(`Radar diagram ticks (${u.options.ticks}) exceeds maximum allowed (32). Using 32 instead.`),u.options.ticks=32)},"setOptions"),getConfig:x,clear:(0,o.K)(()=>{(0,l.IU)(),u=structuredClone(g)},"clear"),setAccTitle:l.SV,getAccTitle:l.iN,setDiagramTitle:l.ke,getDiagramTitle:l.ab,getAccDescription:l.m7,setAccDescription:l.EI},b=(0,o.K)(t=>{(0,r.S)(t,w);let{axes:e,curves:a,options:i}=t;w.setAxes(e),w.setCurves(a),w.setOptions(i)},"populate"),C={parse:(0,o.K)(async t=>{let e=await (0,c.qg)("radar",t);s.R.debug(e),b(e)},"parse")},k=(0,o.K)((t,e,a,r)=>{let n=r.db,l=n.getAxes(),s=n.getCurves(),o=n.getOptions(),c=n.getConfig(),d=n.getDiagramTitle(),g=K((0,i.D)(e),c),u=o.max??Math.max(...s.map(t=>Math.max(...t.entries))),p=o.min,x=Math.min(c.width,c.height)/2;M(g,l,x,o.ticks,o.graticule),L(g,l,x,c),T(g,l,s,p,u,o.graticule,c),I(g,s,o.showLegend,c),g.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-c.height/2-c.marginTop)},"draw"),K=(0,o.K)((t,e)=>{let a=e.width+e.marginLeft+e.marginRight,r=e.height+e.marginTop+e.marginBottom,i={x:e.marginLeft+e.width/2,y:e.marginTop+e.height/2};return(0,l.a$)(t,r,a,e.useMaxWidth??!0),t.attr("viewBox",`0 0 ${a} ${r}`).attr("overflow","visible"),t.append("g").attr("transform",`translate(${i.x}, ${i.y})`)},"drawFrame"),M=(0,o.K)((t,e,a,r,i)=>{if("circle"===i)for(let e=0;e<r;e++){let i=a*(e+1)/r;t.append("circle").attr("r",i).attr("class","radarGraticule")}else if("polygon"===i){let i=e.length;for(let n=0;n<r;n++){let l=a*(n+1)/r,s=e.map((t,e)=>{let a=2*e*Math.PI/i-Math.PI/2,r=l*Math.cos(a),n=l*Math.sin(a);return`${r},${n}`}).join(" ");t.append("polygon").attr("points",s).attr("class","radarGraticule")}}},"drawGraticule"),L=(0,o.K)((t,e,a,r)=>{let i=e.length;for(let n=0;n<i;n++){let l=e[n].label,s=2*n*Math.PI/i-Math.PI/2,o=Math.cos(s),c=Math.sin(s);t.append("line").attr("x1",0).attr("y1",0).attr("x2",a*r.axisScaleFactor*o).attr("y2",a*r.axisScaleFactor*c).attr("class","radarAxisLine");let d=o>.01?"start":o<-.01?"end":"middle",g=c>.01?"hanging":c<-.01?"auto":"central";t.append("text").text(l).attr("x",a*r.axisLabelFactor*o+4*o).attr("y",a*r.axisLabelFactor*c+4*c).attr("text-anchor",d).attr("dominant-baseline",g).attr("class","radarAxisLabel")}},"drawAxes");function T(t,e,a,r,i,n,l){let s=e.length,o=Math.min(l.width,l.height)/2;a.forEach((e,a)=>{if(e.entries.length!==s)return;let c=e.entries.map((t,e)=>{let a=2*Math.PI*e/s-Math.PI/2,n=A(t,r,i,o);return{x:n*Math.cos(a),y:n*Math.sin(a)}});"circle"===n?t.append("path").attr("d",S(c,l.curveTension)).attr("class",`radarCurve-${a}`):"polygon"===n&&t.append("polygon").attr("points",c.map(t=>`${t.x},${t.y}`).join(" ")).attr("class",`radarCurve-${a}`)})}function A(t,e,a,r){return r*(Math.min(Math.max(t,e),a)-e)/(a-e)}function S(t,e){let a=t.length,r=`M${t[0].x},${t[0].y}`;for(let i=0;i<a;i++){let n=t[(i-1+a)%a],l=t[i],s=t[(i+1)%a],o=t[(i+2)%a],c={x:l.x+(s.x-n.x)*e,y:l.y+(s.y-n.y)*e},d={x:s.x-(o.x-l.x)*e,y:s.y-(o.y-l.y)*e};r+=` C${c.x},${c.y} ${d.x},${d.y} ${s.x},${s.y}`}return`${r} Z`}function I(t,e,a,r){if(!a)return;let i=(r.width/2+r.marginRight)*3/4,n=-(3*(r.height/2+r.marginTop))/4;e.forEach((e,a)=>{let r=t.append("g").attr("transform",`translate(${i}, ${n+20*a})`);r.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${a}`),r.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(e.label)})}(0,o.K)(T,"drawCurves"),(0,o.K)(A,"relativeRadius"),(0,o.K)(S,"closedRoundCurve"),(0,o.K)(I,"drawLegend");var D=(0,o.K)((t,e)=>{let a="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++){let i=t[`cScale${r}`];a+=`
2
+ .radarCurve-${r} {
3
+ color: ${i};
4
+ fill: ${i};
5
+ fill-opacity: ${e.curveOpacity};
6
+ stroke: ${i};
7
+ stroke-width: ${e.curveStrokeWidth};
8
+ }
9
+ .radarLegendBox-${r} {
10
+ fill: ${i};
11
+ fill-opacity: ${e.curveOpacity};
12
+ stroke: ${i};
13
+ }
14
+ `}return a},"genIndexStyles"),O=(0,o.K)(t=>{let e=(0,l.P$)(),a=(0,l.zj)(),r=(0,n.$t)(e,a.themeVariables),i=(0,n.$t)(r.radar,t);return{themeVariables:r,radarOptions:i}},"buildRadarStyleOptions"),E={parser:C,db:w,renderer:{draw:k},styles:(0,o.K)(({radar:t}={})=>{let{themeVariables:e,radarOptions:a}=O(t);return`
15
+ .radarTitle {
16
+ font-size: ${e.fontSize};
17
+ color: ${e.titleColor};
18
+ dominant-baseline: hanging;
19
+ text-anchor: middle;
20
+ }
21
+ .radarAxisLine {
22
+ stroke: ${a.axisColor};
23
+ stroke-width: ${a.axisStrokeWidth};
24
+ }
25
+ .radarAxisLabel {
26
+ font-size: ${a.axisLabelFontSize}px;
27
+ color: ${a.axisColor};
28
+ }
29
+ .radarGraticule {
30
+ fill: ${a.graticuleColor};
31
+ fill-opacity: ${a.graticuleOpacity};
32
+ stroke: ${a.graticuleColor};
33
+ stroke-width: ${a.graticuleStrokeWidth};
34
+ }
35
+ .radarLegendText {
36
+ text-anchor: start;
37
+ font-size: ${a.legendFontSize}px;
38
+ dominant-baseline: hanging;
39
+ }
40
+ ${D(e,a)}
41
+ `},"styles")}},77433:(t,e,a)=>{function r(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}a.d(e,{S:()=>r}),(0,a(36744).K)(r,"populateCommonDb")}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2908],{32908:(e,s,c)=>{c.d(s,{createInfoServices:()=>a.v});var a=c(78551);c(74775)}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3117],{53117:(e,t,n)=>{n.d(t,{B:()=>c,OS:()=>k,QV:()=>_,dc:()=>N,ju:()=>b,sc:()=>P,sv:()=>h,xY:()=>X});var r=n(14637),a=n(4461),i=n(11152),d=n(63570),o=n(73607),s=n(97562),l=n(13318),g=n(36744),u=n(82506);function c(e,{edgePathsClass:t="edges edgePaths"}={}){let n=e.insert("g").attr("class","root"),r=n.insert("g").attr("class","clusters"),a=n.insert("g").attr("class",t);return{clusters:r,edgePaths:a,edgeLabels:n.insert("g").attr("class","edgeLabels"),nodes:n.insert("g").attr("class","nodes"),rootGroups:n}}async function f(e,t,n){if(t.label){let{shapeSvg:r,bbox:a}=await (0,d.Zk)(e,void 0===n?t:{...t,width:n});t.labelBBox={width:a.width,height:a.height},r.remove()}else t.labelBBox={width:0,height:0}}async function h(e,t,n){let r=await (0,i.on)(e,t,n),a=r.node()?.getBBox()??{width:0,height:0};return t.width=a.width,t.height=a.height,r}function p(e,t,n){let r=e,a=new Set;for(;r;){if(r.dir)return r.dir;if(!r.parentId||a.has(r.parentId))break;a.add(r.parentId),r=t.get(r.parentId)}return n}async function w(e,t,r={}){let i=new u.T({multigraph:!0,compound:!0}),d=[...t.edges],o=(0,s.D7)(),l=c(e),{edgeLabels:g,nodes:b}=l,R=new Map,m=new Map(t.nodes.map(e=>[e.id,e])),v=t.direction,y=null!=e.node();for(let e of(await Promise.all(t.nodes.map(async e=>{if(e.isGroup){if(y){let t=r.unwrapGroupLabels&&"markdown"!==e.labelType;await f(b,e,t?1/0:void 0)}i.setNode(e.id,{...e})}else{if(y){let t=await h(b,e,{config:o,dir:p(e,m,v)});R.set(e.id,t)}i.setNode(e.id,{...e})}})),d))y&&(0,a.a6)(e)&&await (0,a.jP)(g,e),i.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(6230).then(n.bind(n,36230));r(e,t)}return{graph:i,groups:l,nodeElements:R}}(0,g.K)(c,"createLayoutElementGroups"),(0,g.K)(f,"measureGroupLabel"),(0,g.K)(h,"insertMeasuredNode"),(0,g.K)(p,"resolveNodeDir"),(0,g.K)(w,"createGraphWithElements");var b=new Map,R=new Map,m=new Map,v=(0,g.K)(()=>{R.clear(),m.clear(),b.clear()},"clear"),y=(0,g.K)((e,t)=>{let n=R.get(t)||[];return l.R.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),C=(0,g.K)((e,t)=>{let n=R.get(t)||[];return l.R.info("Descendants of ",t," is ",n),l.R.info("Edge is ",e),e.v!==t&&e.w!==t&&(n?n.includes(e.v)||y(e.v,t)||y(e.w,t)||n.includes(e.w):(l.R.debug("Tilt, ",t,",not in descendants"),!1))},"edgeInCluster"),K=(0,g.K)((e,t,n,r)=>{l.R.debug("Copying children of ",e,"root",r,"data",t.node(e),r);let a=t.children(e)||[];e!==r&&a.push(e),l.R.debug("Copying (nodes) clusterId",e,"nodes",a),a.forEach(a=>{if(t.children(a).length>0)K(a,t,n,r);else{let i=t.node(a);l.R.info("cp ",a," to ",r," with parent ",e),n.setNode(a,i),r!==t.parent(a)&&(l.R.debug("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(l.R.debug("Setting parent",a,e),n.setParent(a,e)):(l.R.info("In copy ",e,"root",r,"data",t.node(e),r),l.R.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));let d=t.edges(a);l.R.debug("Copying Edges",d),d.forEach(a=>{l.R.info("Edge",a);let i=t.edge(a.v,a.w,a.name);l.R.info("Edge data",i,r);try{C(a,r)?(l.R.info("Copying as ",a.v,a.w,i,a.name),n.setEdge(a.v,a.w,i,a.name),l.R.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):l.R.info("Skipping copy of edge ",a.v,"--\x3e",a.w," rootId: ",r," clusterId:",e)}catch(e){l.R.error(e)}})}l.R.debug("Removing node",a),t.removeNode(a)})},"copy"),E=(0,g.K)((e,t)=>{let n=t.children(e),r=[...n];for(let a of n)m.set(a,e),r=[...r,...E(a,t)];return r},"extractDescendants"),L=(0,g.K)((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),a=e.edges().filter(e=>e.v===n||e.w===n),i=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),d=a.map(e=>({v:e.v,w:e.w}));return i.filter(e=>d.some(t=>e.v===t.v&&e.w===t.w))},"findCommonEdges"),N=(0,g.K)((e,t,n)=>{let r,a=t.children(e);if(l.R.trace("Searching children of id ",e,a),a.length<1)return e;for(let e of a){let a=N(e,t,n),i=L(t,n,a);if(a)if(!(i.length>0))return a;else r=a}return r},"findNonClusterChild"),x=(0,g.K)(e=>b.has(e)&&b.get(e).externalConnections&&b.has(e)?b.get(e).id:e,"getAnchorId"),k=(0,g.K)((e,t)=>{if(!e||t>10)return void l.R.debug("Opting out, no graph ");for(let t of(l.R.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(l.R.debug("Cluster identified",t," Replacement id in edges: ",N(t,e,t)),R.set(t,E(t,e)),b.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(l.R.debug("Cluster identified",t,R),r.forEach(e=>{y(e.v,t)^y(e.w,t)&&(l.R.debug("Edge: ",e," leaves cluster ",t),l.R.debug("Descendants of XXX ",t,": ",R.get(t)),b.get(t).externalConnections=!0)})):l.R.debug("Not a cluster ",t,R)}),b.keys())){let n=b.get(t).id,r=e.parent(n);r!==t&&b.has(r)&&!b.get(r).externalConnections&&(b.get(t).id=r);let a=e.edges().some(e=>e.v===t);if(n&&b.get(t)?.externalConnections&&a&&S(e,n,t)){let r=T(e,t,e.parent(n));r&&(b.get(t).id=r)}}e.edges().forEach(function(t){let n=e.edge(t);l.R.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),l.R.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let r=t.v,a=t.w;if(l.R.debug("Fix XXX",b,"ids:",t.v,t.w,"Translating: ",b.get(t.v)," --- ",b.get(t.w)),b.get(t.v)||b.get(t.w)){if(l.R.debug("Fixing and trying - removing XXX",t.v,t.w,t.name),r=x(t.v),a=x(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let a=e.parent(r);b.get(a).externalConnections=!0,n.fromCluster=t.v}if(a!==t.w){let r=e.parent(a);b.get(r).externalConnections=!0,n.toCluster=t.w}l.R.debug("Fix Replacing with XXX",r,a,t.name),e.setEdge(r,a,n,t.name)}}),I(e,0),l.R.trace(b)},"adjustClustersAndEdges"),I=(0,g.K)((e,t)=>{if(t>10)return void l.R.error("Bailing out");let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r=r||n.length>0}if(!r)return void l.R.debug("Done, no node has children",e.nodes());for(let r of(l.R.debug("Nodes = ",n,t),n))if(l.R.debug("Extracting node",r,b,b.has(r)&&!b.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",t),b.has(r))if(!b.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){l.R.debug("Cluster without external connections, without a parent and with children",r,t);let n="TB"===e.graph().rankdir?"LR":"TB";b.get(r)?.clusterData?.dir&&(n=b.get(r).clusterData.dir,l.R.debug("Fixing dir",b.get(r).clusterData.dir,n));let a=new u.T({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});K(r,e,a,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:b.get(r).clusterData,label:b.get(r).label,graph:a})}else l.R.debug("Cluster ** ",r," **not meeting the criteria !externalConnections:",!b.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),t),l.R.debug(b);else l.R.debug("Not a cluster",r,t);for(let r of(n=e.nodes(),l.R.debug("New list of nodes",n),n)){let n=e.node(r);l.R.debug(" Now next level",r,n),n?.clusterNode&&I(n.graph,t+1)}},"extractor"),D=(0,g.K)((e,t)=>{if(0===t.length)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=e.children(t),a=D(e,r);n=[...n,...a]}),n},"sorter"),P=(0,g.K)(e=>D(e,e.children()),"sortNodesByHierarchy"),S=(0,g.K)((e,t,n)=>{let r=e.parent(t);for(;r&&r!==n;){let t=b.get(r);if(t&&!t.externalConnections)return!0;r=e.parent(r)}return!1},"isNodeInExtractableCluster"),T=(0,g.K)((e,t,n)=>{for(let r of e.children(t)??[]){if(r===n||y(r,n))continue;let a=N(r,e,t);if(a&&!S(e,a,t))return a}return null},"findSafeAnchorNode");function X({prepareLayout:e,measureLayout:t,runLayoutCore:n,paintLayout:r,afterPaint:i,paintOptions:d}){let o=t??_;return(0,g.K)(async function(t,s,l,g){let u=s.select("g");(l?.insertMarkers??a.g0)(u,t.markers,t.type,t.diagramId),B();let c={element:u,helpers:l,options:g};c.preparedLayout=await e?.(t,c);let f=await o(t,c),h=await n(t,c),p={...c,measure:f};r?await r(t,p,h):await M(t,p,d),await i?.(t,p,h)},"render")}function B(){(0,i.IU)(),(0,a.IU)(),(0,r.IU)(),v()}async function _(e,{element:t},n){return await w(t,e,n)}async function M(e,t,n={}){let{measure:r}=t,{groups:a}=r;for(let r of n.getNodes?.(e,t)??e.nodes)n.skipNode?.(r,t)||await G(a,r,t,n);let i=U(e.nodes);for(let r of e.edges)j(r,n)||await A(a,r,i,e,n,t)}async function G(e,t,n,a){t.clusterNode?(0,i.U_)(t):O(t,n,a)?await (0,r.U)(e.clusters,t):(0,i.U_)(t)}function O(e,t,n){return!0===e.isGroup&&(n.isCluster?.(e,t)??!0)}function U(e){let t=new Map;for(let n of e)n?.id&&t.set(n.id,n);return t}function j(e,t){return e.isLayoutOnly||!!t.skipEdge?.(e)}async function A(e,t,n,r,i,d){let o=(0,a.Jo)(e.edgePaths,{...t},i.clusterDb??new Map,r.type,F(t.start,t,n,d,i),F(t.end,t,n,d,i),r.diagramId,$(t,i),r.layoutAlgorithm);(0,a.a6)(t)&&(a.lP.has(t.id)||await (0,a.jP)(e.edgeLabels,t),J(t,o))}function F(e,t,n,r,a){return a.getEdgeNode?.(e,t,r)??(e?n.get(e)??{}:{})}function $(e,t){return"function"==typeof t.skipIntersect?t.skipIntersect(e):t.skipIntersect??!1}function J(e,t){let n=t?.updatedPath??t?.originalPath,r=(0,s.zj)(),{subGraphTitleTotalMargin:d}=(0,i.Oi)({flowchart:r.flowchart??{}});if(e.label){let n=a.lP.get(e.id),{x:r,y:i}=(0,a.Pk)(e,t);n.attr("transform",`translate(${r}, ${i+d/2})`)}for(let[t,r]of[["startLeft",e.startLabelLeft],["startRight",e.startLabelRight],["endLeft",e.endLabelLeft],["endRight",e.endLabelRight]])if(r){let{x:r,y:i}=Q(e,t,n);a.UQ.get(e.id)[t].attr("transform",`translate(${r}, ${i})`)}}(0,g.K)(X,"createCommonLayoutRenderer"),(0,g.K)(B,"clearLayoutRenderState"),(0,g.K)(_,"defaultMeasureLayout"),(0,g.K)(M,"paintLayoutData"),(0,g.K)(G,"paintLayoutNode"),(0,g.K)(O,"shouldPaintAsCluster"),(0,g.K)(U,"buildNodeLookup"),(0,g.K)(j,"shouldSkipPaintEdge"),(0,g.K)(A,"paintLayoutEdge"),(0,g.K)(F,"getRenderedNode"),(0,g.K)($,"shouldSkipIntersect"),(0,g.K)(J,"positionRenderedEdgeLabel");var z={startLeft:"start_left",startRight:"start_right",endLeft:"end_left",endRight:"end_right"};function Q(e,t,n){let r=e.terminalLabelCenters?.[t];if(r)return{...r};if(!n)return{x:e.x,y:e.y};let a=t.startsWith("start")?e.arrowTypeStart:e.arrowTypeEnd;return o._K.calcTerminalLabelPosition(10*!!a,z[t],n)}(0,g.K)(Q,"terminalLabelTranslate")}}]);