@theruansilva/omp-web 2.2.0 → 2.2.1
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.
- package/dist/client/assets/{CodeViewer-DEVekDfo.js → CodeViewer-B61IQaP0.js} +1 -1
- package/dist/client/assets/{TerminalPanel-CLZRR8T3.js → TerminalPanel-BcxMZQKk.js} +1 -1
- package/dist/client/assets/{UnifiedDiffViewer-DkUYn4xn.js → UnifiedDiffViewer-BnFQlZDg.js} +1 -1
- package/dist/client/assets/{abnfDiagram-O67JEVCF-CN3HoUk0.js → abnfDiagram-O67JEVCF-BCWHgm_-.js} +1 -1
- package/dist/client/assets/{arc-DfCyV39Y.js → arc-BUpZciy9.js} +1 -1
- package/dist/client/assets/{architectureDiagram-NJMV4G6O-B18ZPEpX.js → architectureDiagram-NJMV4G6O-CVWCwiqh.js} +1 -1
- package/dist/client/assets/{blockDiagram-BEXU5L5S-DauyTopu.js → blockDiagram-BEXU5L5S-W5WSJa_J.js} +2 -2
- package/dist/client/assets/{c4Diagram-YGBWAQC7-BzItBhD8.js → c4Diagram-YGBWAQC7-BWpacECA.js} +1 -1
- package/dist/client/assets/channel-ChkqWR3Z.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-CTeOQu6b.js → chunk-2Q5K7J3B-D0TV4T28.js} +1 -1
- package/dist/client/assets/{chunk-3FUC2YCW-OWYL0CxB.js → chunk-3FUC2YCW-BlkJ2B9v.js} +2 -2
- package/dist/client/assets/{chunk-5VM5RSS4-BPto9x5-.js → chunk-5VM5RSS4-LRh3HbZr.js} +1 -1
- package/dist/client/assets/{chunk-GTNCS2PH-DqPy7R2d.js → chunk-GTNCS2PH-CBiTovUf.js} +1 -1
- package/dist/client/assets/{chunk-GWA4HPMP-C4N-dUua.js → chunk-GWA4HPMP-Dnu3R9yI.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-C4b1ijjH.js → chunk-JWPE2WC7-C2yjQs6c.js} +1 -1
- package/dist/client/assets/{chunk-NETBCI7D-Ds_9Juid.js → chunk-NETBCI7D-Dxos4L3P.js} +1 -1
- package/dist/client/assets/{chunk-WEXAMYUT-DC9hisqc.js → chunk-WEXAMYUT-DrLvxPom.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-DZnUPupk.js → chunk-XXDRQBXY-Cub_nego.js} +1 -1
- package/dist/client/assets/{classDiagram-v2-NBCMYWYE-CDSg6Hoa.js → classDiagram-v2-NBCMYWYE-CIe2lhk7.js} +1 -1
- package/dist/client/assets/{cose-bilkent-JH36ORCC-B4ISJxq4.js → cose-bilkent-JH36ORCC-DOGZoTZg.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-Dk9BE-CS.js → cynefin-OW5HDTMX-DXF0a63d.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-VND7K2PF-D4LOjD3M.js → cynefinDiagram-VND7K2PF-C_Qmhc8V.js} +1 -1
- package/dist/client/assets/dagre-6A5THRUB-CEhDrD4X.js +4 -0
- package/dist/client/assets/{diagram-22UHCM2B-D_zb_SLQ.js → diagram-22UHCM2B-CgN81sDZ.js} +1 -1
- package/dist/client/assets/{diagram-3UASUU5V-D5rEpDmK.js → diagram-3UASUU5V-Dk1gOSew.js} +1 -1
- package/dist/client/assets/{diagram-ATOU4E4O-BdTFXxOS.js → diagram-ATOU4E4O-C_tcqhr3.js} +1 -1
- package/dist/client/assets/{diagram-CDSNMT55-B8gtHdg9.js → diagram-CDSNMT55-Dj-WM3vk.js} +1 -1
- package/dist/client/assets/{diagram-MLGK6HIB-C-NGINWH.js → diagram-MLGK6HIB-CDowox_d.js} +1 -1
- package/dist/client/assets/{diagram-MPIPVDR6-D3_T-c5C.js → diagram-MPIPVDR6-CaThzNCZ.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-ZINNZB2B-BIASbt52.js → ebnfDiagram-ZINNZB2B-BZbLdwcz.js} +1 -1
- package/dist/client/assets/{elk-276RUBZZ-CuNF0hHg.js → elk-276RUBZZ-DGku1nk-.js} +3 -3
- package/dist/client/assets/{erDiagram-OPXOYQCR-Cmi_qmGj.js → erDiagram-OPXOYQCR-D0nJ53i7.js} +1 -1
- package/dist/client/assets/{flowDiagram-KWPJA3E3-DP-SrXc2.js → flowDiagram-KWPJA3E3-DeB8-O7Y.js} +1 -1
- package/dist/client/assets/{ganttDiagram-FUAMR5RP-olLEnoMM.js → ganttDiagram-FUAMR5RP-CBcW8sXy.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-X574FWY7-uPZ9lEq1.js → gitGraphDiagram-X574FWY7-CC-b8FLq.js} +1 -1
- package/dist/client/assets/graph-D8UmR1vK.js +1 -0
- package/dist/client/assets/{index-D-PvDSJs.js → index-CyN73uMY.js} +369 -362
- package/dist/client/assets/{infoDiagram-VRGFBTTK-D0Q5E5gc.js → infoDiagram-VRGFBTTK-DL3QMN01.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-OU5B5YK6-C21L3hk6.js → ishikawaDiagram-OU5B5YK6-Brt56LtP.js} +1 -1
- package/dist/client/assets/{journeyDiagram-ZHPQQLJL-C9o5XEso.js → journeyDiagram-ZHPQQLJL-Df8VwbDr.js} +1 -1
- package/dist/client/assets/{kanban-definition-PNTS6WVX-BioH9OyY.js → kanban-definition-PNTS6WVX-cVbdWfVg.js} +1 -1
- package/dist/client/assets/{linear-BwJ7-DLx.js → linear-DugbH7BO.js} +1 -1
- package/dist/client/assets/{mindmap-definition-NLK3R4M7-ogoKSGSi.js → mindmap-definition-NLK3R4M7-BDqwqJMJ.js} +1 -1
- package/dist/client/assets/{pegDiagram-GJSIUBJH-Ck2_wE3g.js → pegDiagram-GJSIUBJH-w6CrSKt0.js} +1 -1
- package/dist/client/assets/{pieDiagram-5QR66LMP-C5wm07EA.js → pieDiagram-5QR66LMP-D0utByOI.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-O4NWA36T-UKQ2brr3.js → quadrantDiagram-O4NWA36T-DIAIplx2.js} +1 -1
- package/dist/client/assets/{railroadDiagram-XR7U4H2S-BgY4ABv4.js → railroadDiagram-XR7U4H2S-BX9P-jy7.js} +1 -1
- package/dist/client/assets/{requirementDiagram-PLB6GJNP-B50WsncI.js → requirementDiagram-PLB6GJNP-C55JlmRI.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-IPEJSGJF-BHtyWxOk.js → sankeyDiagram-IPEJSGJF-VeHnKI-a.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-PO4LG4MO-D_kxHIBS.js → sequenceDiagram-PO4LG4MO-CTUoXviF.js} +1 -1
- package/dist/client/assets/{sizeCapture-INFHLROL-MzN60-aT.js → sizeCapture-INFHLROL-DBKjJDUZ.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-GCMORJYK-CBiPlAo0.js → stateDiagram-v2-GCMORJYK-DzonJh3D.js} +1 -1
- package/dist/client/assets/swimlanes-2SLR337P-Cnsd5mvJ.js +1 -0
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-iyBCc4Xc.js +8 -0
- package/dist/client/assets/{timeline-definition-EJHVYXUP-BemXf1bb.js → timeline-definition-EJHVYXUP-C9nhaxck.js} +1 -1
- package/dist/client/assets/usecaseDiagram-POWQR4AR-jfXBWSzR.js +370 -0
- package/dist/client/assets/vendor-editor-core-D-5q2tVX.js +49 -0
- package/dist/client/assets/{vendor-editor-languages-pDmyn-oC.js → vendor-editor-languages-B6WRt0aC.js} +1 -1
- package/dist/client/assets/{vennDiagram-UO4OBE2U-2mimeV2G.js → vennDiagram-UO4OBE2U-BigR6haV.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VNRHLVJA-Bg2MjtpE.js → wardleyDiagram-VNRHLVJA-BXJexKTM.js} +1 -1
- package/dist/client/assets/{xychartDiagram-PMCCYNJV-7_nvdM0t.js → xychartDiagram-PMCCYNJV-HL5cuxsZ.js} +1 -1
- package/dist/client/index.html +3 -3
- package/dist/config.js +11 -12
- package/dist/config.js.map +1 -1
- package/dist/server/configRoutes.js +6 -0
- package/dist/server/configRoutes.js.map +1 -1
- package/dist/shared/apiTypes.d.ts +2 -0
- package/docs/config.md +16 -1
- package/package.json +2 -1
- package/dist/client/assets/_basePickBy-vr4256UX.js +0 -1
- package/dist/client/assets/_baseUniq-CHc60b6y.js +0 -1
- package/dist/client/assets/channel-BeMMNdGw.js +0 -1
- package/dist/client/assets/dagre-6A5THRUB-BdboVbbt.js +0 -4
- package/dist/client/assets/graph-C2De1HlQ.js +0 -1
- package/dist/client/assets/swimlanes-2SLR337P-BCdsVfp-.js +0 -1
- package/dist/client/assets/swimlanesDiagram-TC7HE7FX-Da17CLQY.js +0 -8
- package/dist/client/assets/usecaseDiagram-POWQR4AR-Vqj4Zp6V.js +0 -370
- package/dist/client/assets/vendor-editor-core-BG7M-EQ-.js +0 -10
package/docs/config.md
CHANGED
|
@@ -11,7 +11,7 @@ PI WEB uses two config files:
|
|
|
11
11
|
- **Global PI WEB config:** `$OMP_WEB_CONFIG`, or `$XDG_CONFIG_HOME/omp-web/config.json`, or `~/.config/omp-web/config.json`.
|
|
12
12
|
- **Project-local PI WEB config:** `<project>/.omp-web/config.json` for commit-able project settings.
|
|
13
13
|
|
|
14
|
-
Each PI WEB machine has its own config. When using Fleet/machine federation, Settings uses the selected machine for config that affects work running there: session daemon tools, PI WEB plugin enablement, external path access, and upload defaults. Gateway/browser-only settings stay local to the gateway: keyboard shortcuts, remote machine registry/tokens, and gateway host/port/allowed-hosts. Remote servers that do not advertise selected-machine settings support report those settings as unavailable instead of silently falling back to the gateway.
|
|
14
|
+
Each PI WEB machine has its own config. When using Fleet/machine federation, Settings uses the selected machine for config that affects work running there: session daemon tools, PI WEB plugin enablement, external path access, and upload defaults. Gateway/browser-only settings stay local to the gateway: Vim mode defaults, keyboard shortcuts, remote machine registry/tokens, and gateway host/port/allowed-hosts. Remote servers that do not advertise selected-machine settings support report those settings as unavailable instead of silently falling back to the gateway.
|
|
15
15
|
|
|
16
16
|
Pi package settings are separate from PI WEB config. They live in Pi's package-manager settings on the target machine and are managed by Pi (`pi install`, `pi remove`, `pi update`) or **Settings → Pi packages**. In a federated setup, **Settings → Pi packages** targets the currently selected machine. The PI WEB `plugins` config key only enables or disables discovered PI WEB browser plugins on the machine whose config you are editing; it does not install, remove, or update Pi packages.
|
|
17
17
|
|
|
@@ -39,6 +39,7 @@ Process restarts depend on the key:
|
|
|
39
39
|
- `plugins`: reload the browser tab after changing PI WEB plugin enablement.
|
|
40
40
|
- Pi package install/remove/update: not a PI WEB config key; after a mutation, type `/reload` in each idle PI WEB session on the target machine to refresh Pi runtime resources such as extensions, skills, prompt templates, themes, and context/system prompt files as supported by Pi. Reload the browser page separately for PI WEB browser plugin changes. A routine session daemon restart is not required.
|
|
41
41
|
- `shortcuts`: saved settings apply in the browser after config refresh/save.
|
|
42
|
+
- `vimMode`: applies after config refresh; a saved browser preference overrides it.
|
|
42
43
|
|
|
43
44
|
## Global config example
|
|
44
45
|
|
|
@@ -46,6 +47,7 @@ Process restarts depend on the key:
|
|
|
46
47
|
{
|
|
47
48
|
"host": "127.0.0.1",
|
|
48
49
|
"port": 8504,
|
|
50
|
+
"vimMode": true,
|
|
49
51
|
"pathAccess": {
|
|
50
52
|
"allowedPaths": ["~/SDKs", "/opt/reference"]
|
|
51
53
|
},
|
|
@@ -98,6 +100,7 @@ Rows with JSON key `—` are runtime-only environment variables, not config-file
|
|
|
98
100
|
| Web/API bind host | `host` | `OMP_WEB_HOST` | Global | Not supported locally | Restart web/API |
|
|
99
101
|
| Web/API port | `port` | `OMP_WEB_PORT`, `PORT` | Global | Not supported locally | Restart web/API |
|
|
100
102
|
| Dev-server allowed hosts | `allowedHosts` | `OMP_WEB_ALLOWED_HOSTS` | Global | Not supported locally | Restart dev web/UI |
|
|
103
|
+
| Vim keybindings default | `vimMode` | — | Global/browser | Not supported locally | Applies after config refresh; saved browser preference wins |
|
|
101
104
|
| External filesystem roots | `pathAccess.allowedPaths` | — | Global + project | **Merges**: global roots first, then project roots; duplicates removed | Next file request; refresh existing views if needed |
|
|
102
105
|
| Manual file upload default folder | `uploads.defaultFolder` | — | Global + project | **Overrides**: project value wins for workspaces in that project; otherwise global/default applies | New Upload dialogs and direct drag/drop batches after config/workspace refresh |
|
|
103
106
|
| Upload/body limit | `maxUploadBytes` | `OMP_WEB_MAX_UPLOAD_BYTES` | Global | Not supported locally | Restart web/API and session daemon on that machine |
|
|
@@ -121,6 +124,18 @@ Rows with JSON key `—` are runtime-only environment variables, not config-file
|
|
|
121
124
|
|
|
122
125
|
## Key details
|
|
123
126
|
|
|
127
|
+
### Vim mode default
|
|
128
|
+
|
|
129
|
+
`vimMode` sets the initial Vim keybinding state for browsers without a saved preference. It defaults to `false`. Set it to `true` in the global config for hands-off deployments that should start in Vim mode:
|
|
130
|
+
|
|
131
|
+
```json
|
|
132
|
+
{
|
|
133
|
+
"vimMode": true
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Users can still enable or disable Vim keybindings in **Settings → General**. That browser-local preference persists and overrides the config default.
|
|
138
|
+
|
|
124
139
|
### External path access
|
|
125
140
|
|
|
126
141
|
`pathAccess.allowedPaths` grants PI WEB's file explorer and absolute `@` path completions access to specific filesystem roots outside the current workspace.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theruansilva/omp-web",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "Web UI for Oh My Pi Coding Agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "theruansilva",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@codemirror/view": "^6.42.1",
|
|
61
61
|
"@oh-my-pi/pi-catalog": "^18.1.11",
|
|
62
62
|
"@progmruansilva/squircles": "^1.2.0",
|
|
63
|
+
"@replit/codemirror-vim": "^6.4.0",
|
|
63
64
|
"@sinclair/typebox": "^0.34.52",
|
|
64
65
|
"@xterm/addon-fit": "^0.11.0",
|
|
65
66
|
"@xterm/xterm": "^6.0.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as or,m as d,n as E,o as O,p as T,q,b as H,s as z,t as fr,c as ur,u as cr,k as m,w as gr,x as W,y as lr,z as dr,A as br,U as F,S as M,B as Y,C as w,D as J,E as y,F as pr,G as yr,H as Tr,I as Q,J as hr,K as I,L as vr,M as Ar,N as Or,O as mr,P as X,Q as wr,R as Ir}from"./_baseUniq-CHc60b6y.js";var $r=/\s/;function xr(r){for(var n=r.length;n--&&$r.test(r.charAt(n)););return n}var Pr=/^\s+/;function jr(r){return r&&r.slice(0,xr(r)+1).replace(Pr,"")}var B=NaN,Sr=/^[-+]0x[0-9a-f]+$/i,Er=/^0b[01]+$/i,Fr=/^0o[0-7]+$/i,Mr=parseInt;function Br(r){if(typeof r=="number")return r;if(or(r))return B;if(d(r)){var n=typeof r.valueOf=="function"?r.valueOf():r;r=d(n)?n+"":n}if(typeof r!="string")return r===0?r:+r;r=jr(r);var t=Er.test(r);return t||Fr.test(r)?Mr(r.slice(2),t?2:8):Sr.test(r)?B:+r}var C=1/0,Cr=17976931348623157e292;function _r(r){if(!r)return r===0?r:0;if(r=Br(r),r===C||r===-C){var n=r<0?-1:1;return n*Cr}return r===r?r:0}function Lr(r){var n=_r(r),t=n%1;return n===n?t?n-t:n:0}var _=Object.create,Ur=(function(){function r(){}return function(n){if(!d(n))return{};if(_)return _(n);r.prototype=n;var t=new r;return r.prototype=void 0,t}})();function Nr(r,n){var t=-1,e=r.length;for(n||(n=Array(e));++t<e;)n[t]=r[t];return n}function Z(r,n,t){n=="__proto__"&&E?E(r,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):r[n]=t}var Gr=Object.prototype,Kr=Gr.hasOwnProperty;function $(r,n,t){var e=r[n];(!(Kr.call(r,n)&&O(e,t))||t===void 0&&!(n in r))&&Z(r,n,t)}function h(r,n,t,e){var a=!t;t||(t={});for(var s=-1,i=n.length;++s<i;){var o=n[s],u=void 0;u===void 0&&(u=r[o]),a?Z(t,o,u):$(t,o,u)}return t}function V(r,n,t){if(!d(t))return!1;var e=typeof n;return(e=="number"?T(t)&&q(n,t.length):e=="string"&&n in t)?O(t[n],r):!1}function Tt(r){return H(function(n,t){var e=-1,a=t.length,s=a>1?t[a-1]:void 0,i=a>2?t[2]:void 0;for(s=r.length>3&&typeof s=="function"?(a--,s):void 0,i&&V(t[0],t[1],i)&&(s=a<3?void 0:s,a=1),n=Object(n);++e<a;){var o=t[e];o&&r(n,o,e,s)}return n})}function Dr(r){var n=[];if(r!=null)for(var t in Object(r))n.push(t);return n}var Rr=Object.prototype,qr=Rr.hasOwnProperty;function Hr(r){if(!d(r))return Dr(r);var n=z(r),t=[];for(var e in r)e=="constructor"&&(n||!qr.call(r,e))||t.push(e);return t}function v(r){return T(r)?fr(r,!0):Hr(r)}function ht(r){var n=r==null?0:r.length;return n?ur(r):[]}var k=cr(Object.getPrototypeOf,Object);function zr(r,n){return r&&h(n,m(n),r)}function Wr(r,n){return r&&h(n,v(n),r)}var rr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,L=rr&&typeof module=="object"&&module&&!module.nodeType&&module,Yr=L&&L.exports===rr,U=Yr?gr.Buffer:void 0,N=U?U.allocUnsafe:void 0;function Jr(r,n){if(n)return r.slice();var t=r.length,e=N?N(t):new r.constructor(t);return r.copy(e),e}function Qr(r,n){return h(r,W(r),n)}var Xr=Object.getOwnPropertySymbols,nr=Xr?function(r){for(var n=[];r;)dr(n,W(r)),r=k(r);return n}:lr;function Zr(r,n){return h(r,nr(r),n)}function Vr(r){return br(r,v,nr)}var kr=Object.prototype,rn=kr.hasOwnProperty;function nn(r){var n=r.length,t=new r.constructor(n);return n&&typeof r[0]=="string"&&rn.call(r,"index")&&(t.index=r.index,t.input=r.input),t}function x(r){var n=new r.constructor(r.byteLength);return new F(n).set(new F(r)),n}function tn(r,n){var t=n?x(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.byteLength)}var en=/\w*$/;function an(r){var n=new r.constructor(r.source,en.exec(r));return n.lastIndex=r.lastIndex,n}var G=M?M.prototype:void 0,K=G?G.valueOf:void 0;function sn(r){return K?Object(K.call(r)):{}}function on(r,n){var t=n?x(r.buffer):r.buffer;return new r.constructor(t,r.byteOffset,r.length)}var fn="[object Boolean]",un="[object Date]",cn="[object Map]",gn="[object Number]",ln="[object RegExp]",dn="[object Set]",bn="[object String]",pn="[object Symbol]",yn="[object ArrayBuffer]",Tn="[object DataView]",hn="[object Float32Array]",vn="[object Float64Array]",An="[object Int8Array]",On="[object Int16Array]",mn="[object Int32Array]",wn="[object Uint8Array]",In="[object Uint8ClampedArray]",$n="[object Uint16Array]",xn="[object Uint32Array]";function Pn(r,n,t){var e=r.constructor;switch(n){case yn:return x(r);case fn:case un:return new e(+r);case Tn:return tn(r,t);case hn:case vn:case An:case On:case mn:case wn:case In:case $n:case xn:return on(r,t);case cn:return new e;case gn:case bn:return new e(r);case ln:return an(r);case dn:return new e;case pn:return sn(r)}}function jn(r){return typeof r.constructor=="function"&&!z(r)?Ur(k(r)):{}}var Sn="[object Map]";function En(r){return Y(r)&&w(r)==Sn}var D=y&&y.isMap,Fn=D?J(D):En,Mn="[object Set]";function Bn(r){return Y(r)&&w(r)==Mn}var R=y&&y.isSet,Cn=R?J(R):Bn,_n=1,Ln=2,Un=4,tr="[object Arguments]",Nn="[object Array]",Gn="[object Boolean]",Kn="[object Date]",Dn="[object Error]",er="[object Function]",Rn="[object GeneratorFunction]",qn="[object Map]",Hn="[object Number]",ar="[object Object]",zn="[object RegExp]",Wn="[object Set]",Yn="[object String]",Jn="[object Symbol]",Qn="[object WeakMap]",Xn="[object ArrayBuffer]",Zn="[object DataView]",Vn="[object Float32Array]",kn="[object Float64Array]",rt="[object Int8Array]",nt="[object Int16Array]",tt="[object Int32Array]",et="[object Uint8Array]",at="[object Uint8ClampedArray]",it="[object Uint16Array]",st="[object Uint32Array]",f={};f[tr]=f[Nn]=f[Xn]=f[Zn]=f[Gn]=f[Kn]=f[Vn]=f[kn]=f[rt]=f[nt]=f[tt]=f[qn]=f[Hn]=f[ar]=f[zn]=f[Wn]=f[Yn]=f[Jn]=f[et]=f[at]=f[it]=f[st]=!0;f[Dn]=f[er]=f[Qn]=!1;function A(r,n,t,e,a,s){var i,o=n&_n,u=n&Ln,c=n&Un;if(i!==void 0)return i;if(!d(r))return r;var g=Q(r);if(g){if(i=nn(r),!o)return Nr(r,i)}else{var p=w(r),P=p==er||p==Rn;if(pr(r))return Jr(r,o);if(p==ar||p==tr||P&&!a){if(i=u||P?{}:jn(r),!o)return u?Zr(r,Wr(i,r)):Qr(r,zr(i,r))}else{if(!f[p])return a?r:{};i=Pn(r,p,o)}}s||(s=new yr);var j=s.get(r);if(j)return j;s.set(r,i),Cn(r)?r.forEach(function(l){i.add(A(l,n,t,l,r,s))}):Fn(r)&&r.forEach(function(l,b){i.set(b,A(l,n,t,b,r,s))});var sr=c?u?Vr:hr:u?v:m,S=g?void 0:sr(r);return Tr(S||r,function(l,b){S&&(b=l,l=r[b]),$(i,b,A(l,n,t,b,r,s))}),i}var ir=Object.prototype,ot=ir.hasOwnProperty,vt=H(function(r,n){r=Object(r);var t=-1,e=n.length,a=e>2?n[2]:void 0;for(a&&V(n[0],n[1],a)&&(e=1);++t<e;)for(var s=n[t],i=v(s),o=-1,u=i.length;++o<u;){var c=i[o],g=r[c];(g===void 0||O(g,ir[c])&&!ot.call(r,c))&&(r[c]=s[c])}return r});function At(r){var n=r==null?0:r.length;return n?r[n-1]:void 0}function ft(r){return function(n,t,e){var a=Object(n);if(!T(n)){var s=I(t);n=m(n),t=function(o){return s(a[o],o,a)}}var i=r(n,t,e);return i>-1?a[s?n[i]:i]:void 0}}var ut=Math.max;function ct(r,n,t){var e=r==null?0:r.length;if(!e)return-1;var a=t==null?0:Lr(t);return a<0&&(a=ut(e+a,0)),vr(r,I(n),a)}var Ot=ft(ct);function gt(r,n){var t=-1,e=T(r)?Array(r.length):[];return Ar(r,function(a,s,i){e[++t]=n(a,s,i)}),e}function mt(r,n){var t=Q(r)?Or:gt;return t(r,I(n))}var lt=Object.prototype,dt=lt.hasOwnProperty;function bt(r,n){return r!=null&&dt.call(r,n)}function wt(r,n){return r!=null&&mr(r,n,bt)}function pt(r,n,t,e){if(!d(r))return r;n=X(n,r);for(var a=-1,s=n.length,i=s-1,o=r;o!=null&&++a<s;){var u=wr(n[a]),c=t;if(u==="__proto__"||u==="constructor"||u==="prototype")return r;if(a!=i){var g=o[u];c=void 0,c===void 0&&(c=d(g)?g:q(n[a+1])?[]:{})}$(o,u,c),o=o[u]}return r}function It(r,n,t){for(var e=-1,a=n.length,s={};++e<a;){var i=n[e],o=Ir(r,i);t(o,i)&&pt(s,X(i,r),o)}return s}export{Z as a,A as b,h as c,Nr as d,Jr as e,ht as f,k as g,on as h,jn as i,Tt as j,v as k,gt as l,It as m,V as n,$ as o,mt as p,wt as q,Ot as r,At as s,_r as t,vt as u,Lr as v,Vr as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var Lr=typeof global=="object"&&global&&global.Object===Object&&global,te=typeof self=="object"&&self&&self.Object===Object&&self,w=Lr||te||Function("return this")(),y=w.Symbol,Fr=Object.prototype,ne=Fr.hasOwnProperty,ae=Fr.toString,j=y?y.toStringTag:void 0;function ie(r){var e=ne.call(r,j),t=r[j];try{r[j]=void 0;var n=!0}catch{}var a=ae.call(r);return n&&(e?r[j]=t:delete r[j]),a}var se=Object.prototype,oe=se.toString;function fe(r){return oe.call(r)}var ue="[object Null]",ce="[object Undefined]",lr=y?y.toStringTag:void 0;function R(r){return r==null?r===void 0?ce:ue:lr&&lr in Object(r)?ie(r):fe(r)}function m(r){return r!=null&&typeof r=="object"}var le="[object Symbol]";function er(r){return typeof r=="symbol"||m(r)&&R(r)==le}function Dr(r,e){for(var t=-1,n=r==null?0:r.length,a=Array(n);++t<n;)a[t]=e(r[t],t,r);return a}var h=Array.isArray,pr=y?y.prototype:void 0,gr=pr?pr.toString:void 0;function Nr(r){if(typeof r=="string")return r;if(h(r))return Dr(r,Nr)+"";if(er(r))return gr?gr.call(r):"";var e=r+"";return e=="0"&&1/r==-1/0?"-0":e}function tr(r){var e=typeof r;return r!=null&&(e=="object"||e=="function")}function H(r){return r}var pe="[object AsyncFunction]",ge="[object Function]",he="[object GeneratorFunction]",de="[object Proxy]";function Gr(r){if(!tr(r))return!1;var e=R(r);return e==ge||e==he||e==pe||e==de}var W=w["__core-js_shared__"],hr=(function(){var r=/[^.]+$/.exec(W&&W.keys&&W.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""})();function _e(r){return!!hr&&hr in r}var ye=Function.prototype,be=ye.toString;function x(r){if(r!=null){try{return be.call(r)}catch{}try{return r+""}catch{}}return""}var ve=/[\\^$.*+?()[\]{}|]/g,Te=/^\[object .+?Constructor\]$/,we=Function.prototype,Ae=Object.prototype,Oe=we.toString,Pe=Ae.hasOwnProperty,$e=RegExp("^"+Oe.call(Pe).replace(ve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Se(r){if(!tr(r)||_e(r))return!1;var e=Gr(r)?$e:Te;return e.test(x(r))}function me(r,e){return r?.[e]}function I(r,e){var t=me(r,e);return Se(t)?t:void 0}var V=I(w,"WeakMap");function Ee(r,e,t){switch(t.length){case 0:return r.call(e);case 1:return r.call(e,t[0]);case 2:return r.call(e,t[0],t[1]);case 3:return r.call(e,t[0],t[1],t[2])}return r.apply(e,t)}function xe(){}var Ie=800,Ce=16,Re=Date.now;function je(r){var e=0,t=0;return function(){var n=Re(),a=Ce-(n-t);if(t=n,a>0){if(++e>=Ie)return arguments[0]}else e=0;return r.apply(void 0,arguments)}}function Me(r){return function(){return r}}var dr=(function(){try{var r=I(Object,"defineProperty");return r({},"",{}),r}catch{}})(),Le=dr?function(r,e){return dr(r,"toString",{configurable:!0,enumerable:!1,value:Me(e),writable:!0})}:H,Fe=je(Le);function De(r,e){for(var t=-1,n=r==null?0:r.length;++t<n&&e(r[t],t,r)!==!1;);return r}function Ne(r,e,t,n){for(var a=r.length,i=t+-1;++i<a;)if(e(r[i],i,r))return i;return-1}function Ge(r){return r!==r}function Ue(r,e,t){for(var n=t-1,a=r.length;++n<a;)if(r[n]===e)return n;return-1}function ze(r,e,t){return e===e?Ue(r,e,t):Ne(r,Ge,t)}function He(r,e){var t=r==null?0:r.length;return!!t&&ze(r,e,0)>-1}var Be=9007199254740991,Ke=/^(?:0|[1-9]\d*)$/;function Ur(r,e){var t=typeof r;return e=e??Be,!!e&&(t=="number"||t!="symbol"&&Ke.test(r))&&r>-1&&r%1==0&&r<e}function zr(r,e){return r===e||r!==r&&e!==e}var _r=Math.max;function qe(r,e,t){return e=_r(e===void 0?r.length-1:e,0),function(){for(var n=arguments,a=-1,i=_r(n.length-e,0),s=Array(i);++a<i;)s[a]=n[e+a];a=-1;for(var o=Array(e+1);++a<e;)o[a]=n[a];return o[e]=t(s),Ee(r,this,o)}}function Na(r,e){return Fe(qe(r,e,H),r+"")}var Xe=9007199254740991;function nr(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Xe}function B(r){return r!=null&&nr(r.length)&&!Gr(r)}var Ze=Object.prototype;function Hr(r){var e=r&&r.constructor,t=typeof e=="function"&&e.prototype||Ze;return r===t}function Ye(r,e){for(var t=-1,n=Array(r);++t<r;)n[t]=e(t);return n}var We="[object Arguments]";function yr(r){return m(r)&&R(r)==We}var Br=Object.prototype,Je=Br.hasOwnProperty,Qe=Br.propertyIsEnumerable,K=yr((function(){return arguments})())?yr:function(r){return m(r)&&Je.call(r,"callee")&&!Qe.call(r,"callee")};function Ve(){return!1}var Kr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,br=Kr&&typeof module=="object"&&module&&!module.nodeType&&module,ke=br&&br.exports===Kr,vr=ke?w.Buffer:void 0,rt=vr?vr.isBuffer:void 0,z=rt||Ve,et="[object Arguments]",tt="[object Array]",nt="[object Boolean]",at="[object Date]",it="[object Error]",st="[object Function]",ot="[object Map]",ft="[object Number]",ut="[object Object]",ct="[object RegExp]",lt="[object Set]",pt="[object String]",gt="[object WeakMap]",ht="[object ArrayBuffer]",dt="[object DataView]",_t="[object Float32Array]",yt="[object Float64Array]",bt="[object Int8Array]",vt="[object Int16Array]",Tt="[object Int32Array]",wt="[object Uint8Array]",At="[object Uint8ClampedArray]",Ot="[object Uint16Array]",Pt="[object Uint32Array]",c={};c[_t]=c[yt]=c[bt]=c[vt]=c[Tt]=c[wt]=c[At]=c[Ot]=c[Pt]=!0;c[et]=c[tt]=c[ht]=c[nt]=c[dt]=c[at]=c[it]=c[st]=c[ot]=c[ft]=c[ut]=c[ct]=c[lt]=c[pt]=c[gt]=!1;function $t(r){return m(r)&&nr(r.length)&&!!c[R(r)]}function St(r){return function(e){return r(e)}}var qr=typeof exports=="object"&&exports&&!exports.nodeType&&exports,M=qr&&typeof module=="object"&&module&&!module.nodeType&&module,mt=M&&M.exports===qr,J=mt&&Lr.process,Tr=(function(){try{var r=M&&M.require&&M.require("util").types;return r||J&&J.binding&&J.binding("util")}catch{}})(),wr=Tr&&Tr.isTypedArray,ar=wr?St(wr):$t,Et=Object.prototype,xt=Et.hasOwnProperty;function It(r,e){var t=h(r),n=!t&&K(r),a=!t&&!n&&z(r),i=!t&&!n&&!a&&ar(r),s=t||n||a||i,o=s?Ye(r.length,String):[],f=o.length;for(var u in r)(e||xt.call(r,u))&&!(s&&(u=="length"||a&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Ur(u,f)))&&o.push(u);return o}function Ct(r,e){return function(t){return r(e(t))}}var Rt=Ct(Object.keys,Object),jt=Object.prototype,Mt=jt.hasOwnProperty;function Xr(r){if(!Hr(r))return Rt(r);var e=[];for(var t in Object(r))Mt.call(r,t)&&t!="constructor"&&e.push(t);return e}function q(r){return B(r)?It(r):Xr(r)}var Lt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ft=/^\w*$/;function ir(r,e){if(h(r))return!1;var t=typeof r;return t=="number"||t=="symbol"||t=="boolean"||r==null||er(r)?!0:Ft.test(r)||!Lt.test(r)||e!=null&&r in Object(e)}var L=I(Object,"create");function Dt(){this.__data__=L?L(null):{},this.size=0}function Nt(r){var e=this.has(r)&&delete this.__data__[r];return this.size-=e?1:0,e}var Gt="__lodash_hash_undefined__",Ut=Object.prototype,zt=Ut.hasOwnProperty;function Ht(r){var e=this.__data__;if(L){var t=e[r];return t===Gt?void 0:t}return zt.call(e,r)?e[r]:void 0}var Bt=Object.prototype,Kt=Bt.hasOwnProperty;function qt(r){var e=this.__data__;return L?e[r]!==void 0:Kt.call(e,r)}var Xt="__lodash_hash_undefined__";function Zt(r,e){var t=this.__data__;return this.size+=this.has(r)?0:1,t[r]=L&&e===void 0?Xt:e,this}function E(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}E.prototype.clear=Dt;E.prototype.delete=Nt;E.prototype.get=Ht;E.prototype.has=qt;E.prototype.set=Zt;function Yt(){this.__data__=[],this.size=0}function X(r,e){for(var t=r.length;t--;)if(zr(r[t][0],e))return t;return-1}var Wt=Array.prototype,Jt=Wt.splice;function Qt(r){var e=this.__data__,t=X(e,r);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Jt.call(e,t,1),--this.size,!0}function Vt(r){var e=this.__data__,t=X(e,r);return t<0?void 0:e[t][1]}function kt(r){return X(this.__data__,r)>-1}function rn(r,e){var t=this.__data__,n=X(t,r);return n<0?(++this.size,t.push([r,e])):t[n][1]=e,this}function A(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}A.prototype.clear=Yt;A.prototype.delete=Qt;A.prototype.get=Vt;A.prototype.has=kt;A.prototype.set=rn;var F=I(w,"Map");function en(){this.size=0,this.__data__={hash:new E,map:new(F||A),string:new E}}function tn(r){var e=typeof r;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?r!=="__proto__":r===null}function Z(r,e){var t=r.__data__;return tn(e)?t[typeof e=="string"?"string":"hash"]:t.map}function nn(r){var e=Z(this,r).delete(r);return this.size-=e?1:0,e}function an(r){return Z(this,r).get(r)}function sn(r){return Z(this,r).has(r)}function on(r,e){var t=Z(this,r),n=t.size;return t.set(r,e),this.size+=t.size==n?0:1,this}function O(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e<t;){var n=r[e];this.set(n[0],n[1])}}O.prototype.clear=en;O.prototype.delete=nn;O.prototype.get=an;O.prototype.has=sn;O.prototype.set=on;var fn="Expected a function";function sr(r,e){if(typeof r!="function"||e!=null&&typeof e!="function")throw new TypeError(fn);var t=function(){var n=arguments,a=e?e.apply(this,n):n[0],i=t.cache;if(i.has(a))return i.get(a);var s=r.apply(this,n);return t.cache=i.set(a,s)||i,s};return t.cache=new(sr.Cache||O),t}sr.Cache=O;var un=500;function cn(r){var e=sr(r,function(n){return t.size===un&&t.clear(),n}),t=e.cache;return e}var ln=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,pn=/\\(\\)?/g,gn=cn(function(r){var e=[];return r.charCodeAt(0)===46&&e.push(""),r.replace(ln,function(t,n,a,i){e.push(a?i.replace(pn,"$1"):n||t)}),e});function hn(r){return r==null?"":Nr(r)}function Zr(r,e){return h(r)?r:ir(r,e)?[r]:gn(hn(r))}function Y(r){if(typeof r=="string"||er(r))return r;var e=r+"";return e=="0"&&1/r==-1/0?"-0":e}function Yr(r,e){e=Zr(e,r);for(var t=0,n=e.length;r!=null&&t<n;)r=r[Y(e[t++])];return t&&t==n?r:void 0}function dn(r,e,t){var n=r==null?void 0:Yr(r,e);return n===void 0?t:n}function Wr(r,e){for(var t=-1,n=e.length,a=r.length;++t<n;)r[a+t]=e[t];return r}var Ar=y?y.isConcatSpreadable:void 0;function _n(r){return h(r)||K(r)||!!(Ar&&r&&r[Ar])}function Ga(r,e,t,n,a){var i=-1,s=r.length;for(t||(t=_n),a||(a=[]);++i<s;){var o=r[i];t(o)?Wr(a,o):n||(a[a.length]=o)}return a}function yn(r,e,t,n){var a=-1,i=r==null?0:r.length;for(n&&i&&(t=r[++a]);++a<i;)t=e(t,r[a],a,r);return t}function bn(){this.__data__=new A,this.size=0}function vn(r){var e=this.__data__,t=e.delete(r);return this.size=e.size,t}function Tn(r){return this.__data__.get(r)}function wn(r){return this.__data__.has(r)}var An=200;function On(r,e){var t=this.__data__;if(t instanceof A){var n=t.__data__;if(!F||n.length<An-1)return n.push([r,e]),this.size=++t.size,this;t=this.__data__=new O(n)}return t.set(r,e),this.size=t.size,this}function T(r){var e=this.__data__=new A(r);this.size=e.size}T.prototype.clear=bn;T.prototype.delete=vn;T.prototype.get=Tn;T.prototype.has=wn;T.prototype.set=On;function Jr(r,e){for(var t=-1,n=r==null?0:r.length,a=0,i=[];++t<n;){var s=r[t];e(s,t,r)&&(i[a++]=s)}return i}function Pn(){return[]}var $n=Object.prototype,Sn=$n.propertyIsEnumerable,Or=Object.getOwnPropertySymbols,mn=Or?function(r){return r==null?[]:(r=Object(r),Jr(Or(r),function(e){return Sn.call(r,e)}))}:Pn;function En(r,e,t){var n=e(r);return h(r)?n:Wr(n,t(r))}function Pr(r){return En(r,q,mn)}var k=I(w,"DataView"),rr=I(w,"Promise"),C=I(w,"Set"),$r="[object Map]",xn="[object Object]",Sr="[object Promise]",mr="[object Set]",Er="[object WeakMap]",xr="[object DataView]",In=x(k),Cn=x(F),Rn=x(rr),jn=x(C),Mn=x(V),v=R;(k&&v(new k(new ArrayBuffer(1)))!=xr||F&&v(new F)!=$r||rr&&v(rr.resolve())!=Sr||C&&v(new C)!=mr||V&&v(new V)!=Er)&&(v=function(r){var e=R(r),t=e==xn?r.constructor:void 0,n=t?x(t):"";if(n)switch(n){case In:return xr;case Cn:return $r;case Rn:return Sr;case jn:return mr;case Mn:return Er}return e});var Ir=w.Uint8Array,Ln="__lodash_hash_undefined__";function Fn(r){return this.__data__.set(r,Ln),this}function Dn(r){return this.__data__.has(r)}function D(r){var e=-1,t=r==null?0:r.length;for(this.__data__=new O;++e<t;)this.add(r[e])}D.prototype.add=D.prototype.push=Fn;D.prototype.has=Dn;function Nn(r,e){for(var t=-1,n=r==null?0:r.length;++t<n;)if(e(r[t],t,r))return!0;return!1}function Qr(r,e){return r.has(e)}var Gn=1,Un=2;function Vr(r,e,t,n,a,i){var s=t&Gn,o=r.length,f=e.length;if(o!=f&&!(s&&f>o))return!1;var u=i.get(r),g=i.get(e);if(u&&g)return u==e&&g==r;var l=-1,p=!0,b=t&Un?new D:void 0;for(i.set(r,e),i.set(e,r);++l<o;){var d=r[l],_=e[l];if(n)var P=s?n(_,d,l,e,r,i):n(d,_,l,r,e,i);if(P!==void 0){if(P)continue;p=!1;break}if(b){if(!Nn(e,function($,S){if(!Qr(b,S)&&(d===$||a(d,$,t,n,i)))return b.push(S)})){p=!1;break}}else if(!(d===_||a(d,_,t,n,i))){p=!1;break}}return i.delete(r),i.delete(e),p}function zn(r){var e=-1,t=Array(r.size);return r.forEach(function(n,a){t[++e]=[a,n]}),t}function or(r){var e=-1,t=Array(r.size);return r.forEach(function(n){t[++e]=n}),t}var Hn=1,Bn=2,Kn="[object Boolean]",qn="[object Date]",Xn="[object Error]",Zn="[object Map]",Yn="[object Number]",Wn="[object RegExp]",Jn="[object Set]",Qn="[object String]",Vn="[object Symbol]",kn="[object ArrayBuffer]",ra="[object DataView]",Cr=y?y.prototype:void 0,Q=Cr?Cr.valueOf:void 0;function ea(r,e,t,n,a,i,s){switch(t){case ra:if(r.byteLength!=e.byteLength||r.byteOffset!=e.byteOffset)return!1;r=r.buffer,e=e.buffer;case kn:return!(r.byteLength!=e.byteLength||!i(new Ir(r),new Ir(e)));case Kn:case qn:case Yn:return zr(+r,+e);case Xn:return r.name==e.name&&r.message==e.message;case Wn:case Qn:return r==e+"";case Zn:var o=zn;case Jn:var f=n&Hn;if(o||(o=or),r.size!=e.size&&!f)return!1;var u=s.get(r);if(u)return u==e;n|=Bn,s.set(r,e);var g=Vr(o(r),o(e),n,a,i,s);return s.delete(r),g;case Vn:if(Q)return Q.call(r)==Q.call(e)}return!1}var ta=1,na=Object.prototype,aa=na.hasOwnProperty;function ia(r,e,t,n,a,i){var s=t&ta,o=Pr(r),f=o.length,u=Pr(e),g=u.length;if(f!=g&&!s)return!1;for(var l=f;l--;){var p=o[l];if(!(s?p in e:aa.call(e,p)))return!1}var b=i.get(r),d=i.get(e);if(b&&d)return b==e&&d==r;var _=!0;i.set(r,e),i.set(e,r);for(var P=s;++l<f;){p=o[l];var $=r[p],S=e[p];if(n)var cr=s?n(S,$,p,e,r,i):n($,S,p,r,e,i);if(!(cr===void 0?$===S||a($,S,t,n,i):cr)){_=!1;break}P||(P=p=="constructor")}if(_&&!P){var N=r.constructor,G=e.constructor;N!=G&&"constructor"in r&&"constructor"in e&&!(typeof N=="function"&&N instanceof N&&typeof G=="function"&&G instanceof G)&&(_=!1)}return i.delete(r),i.delete(e),_}var sa=1,Rr="[object Arguments]",jr="[object Array]",U="[object Object]",oa=Object.prototype,Mr=oa.hasOwnProperty;function fa(r,e,t,n,a,i){var s=h(r),o=h(e),f=s?jr:v(r),u=o?jr:v(e);f=f==Rr?U:f,u=u==Rr?U:u;var g=f==U,l=u==U,p=f==u;if(p&&z(r)){if(!z(e))return!1;s=!0,g=!1}if(p&&!g)return i||(i=new T),s||ar(r)?Vr(r,e,t,n,a,i):ea(r,e,f,t,n,a,i);if(!(t&sa)){var b=g&&Mr.call(r,"__wrapped__"),d=l&&Mr.call(e,"__wrapped__");if(b||d){var _=b?r.value():r,P=d?e.value():e;return i||(i=new T),a(_,P,t,n,i)}}return p?(i||(i=new T),ia(r,e,t,n,a,i)):!1}function fr(r,e,t,n,a){return r===e?!0:r==null||e==null||!m(r)&&!m(e)?r!==r&&e!==e:fa(r,e,t,n,fr,a)}var ua=1,ca=2;function la(r,e,t,n){var a=t.length,i=a;if(r==null)return!i;for(r=Object(r);a--;){var s=t[a];if(s[2]?s[1]!==r[s[0]]:!(s[0]in r))return!1}for(;++a<i;){s=t[a];var o=s[0],f=r[o],u=s[1];if(s[2]){if(f===void 0&&!(o in r))return!1}else{var g=new T,l;if(!(l===void 0?fr(u,f,ua|ca,n,g):l))return!1}}return!0}function kr(r){return r===r&&!tr(r)}function pa(r){for(var e=q(r),t=e.length;t--;){var n=e[t],a=r[n];e[t]=[n,a,kr(a)]}return e}function re(r,e){return function(t){return t==null?!1:t[r]===e&&(e!==void 0||r in Object(t))}}function ga(r){var e=pa(r);return e.length==1&&e[0][2]?re(e[0][0],e[0][1]):function(t){return t===r||la(t,r,e)}}function ha(r,e){return r!=null&&e in Object(r)}function da(r,e,t){e=Zr(e,r);for(var n=-1,a=e.length,i=!1;++n<a;){var s=Y(e[n]);if(!(i=r!=null&&t(r,s)))break;r=r[s]}return i||++n!=a?i:(a=r==null?0:r.length,!!a&&nr(a)&&Ur(s,a)&&(h(r)||K(r)))}function _a(r,e){return r!=null&&da(r,e,ha)}var ya=1,ba=2;function va(r,e){return ir(r)&&kr(e)?re(Y(r),e):function(t){var n=dn(t,r);return n===void 0&&n===e?_a(t,r):fr(e,n,ya|ba)}}function Ta(r){return function(e){return e?.[r]}}function wa(r){return function(e){return Yr(e,r)}}function Aa(r){return ir(r)?Ta(Y(r)):wa(r)}function ee(r){return typeof r=="function"?r:r==null?H:typeof r=="object"?h(r)?va(r[0],r[1]):ga(r):Aa(r)}function Oa(r){return function(e,t,n){for(var a=-1,i=Object(e),s=n(e),o=s.length;o--;){var f=s[++a];if(t(i[f],f,i)===!1)break}return e}}var Pa=Oa();function $a(r,e){return r&&Pa(r,e,q)}function Sa(r,e){return function(t,n){if(t==null)return t;if(!B(t))return r(t,n);for(var a=t.length,i=-1,s=Object(t);++i<a&&n(s[i],i,s)!==!1;);return t}}var ur=Sa($a);function Ua(r){return m(r)&&B(r)}function ma(r){return typeof r=="function"?r:H}function za(r,e){var t=h(r)?De:ur;return t(r,ma(e))}function Ea(r,e){var t=[];return ur(r,function(n,a,i){e(n,a,i)&&t.push(n)}),t}function Ha(r,e){var t=h(r)?Jr:Ea;return t(r,ee(e))}function xa(r,e){return Dr(e,function(t){return r[t]})}function Ba(r){return r==null?[]:xa(r,q(r))}var Ia="[object Map]",Ca="[object Set]",Ra=Object.prototype,ja=Ra.hasOwnProperty;function Ka(r){if(r==null)return!0;if(B(r)&&(h(r)||typeof r=="string"||typeof r.splice=="function"||z(r)||ar(r)||K(r)))return!r.length;var e=v(r);if(e==Ia||e==Ca)return!r.size;if(Hr(r))return!Xr(r).length;for(var t in r)if(ja.call(r,t))return!1;return!0}function qa(r){return r===void 0}function Ma(r,e,t,n,a){return a(r,function(i,s,o){t=n?(n=!1,i):e(t,i,s,o)}),t}function Xa(r,e,t){var n=h(r)?yn:Ma,a=arguments.length<3;return n(r,ee(e),t,a,ur)}var La=1/0,Fa=C&&1/or(new C([,-0]))[1]==La?function(r){return new C(r)}:xe,Da=200;function Za(r,e,t){var n=-1,a=He,i=r.length,s=!0,o=[],f=o;if(i>=Da){var u=Fa(r);if(u)return or(u);s=!1,a=Qr,f=new D}else f=o;r:for(;++n<i;){var g=r[n],l=g;if(g=g!==0?g:0,s&&l===l){for(var p=f.length;p--;)if(f[p]===l)continue r;o.push(g)}else a(f,l,t)||(f!==o&&f.push(l),o.push(g))}return o}export{$a as $,En as A,m as B,v as C,St as D,Tr as E,z as F,T as G,De as H,h as I,Pr as J,ee as K,Ne as L,ur as M,Dr as N,da as O,Zr as P,Y as Q,Yr as R,y as S,Fe as T,Ir as U,qe as V,R as W,ar as X,K as Y,Pa as Z,ma as _,Za as a,H as a0,_a as a1,hn as a2,D as a3,He as a4,Qr as a5,ze as a6,Jr as a7,Ea as a8,Nn as a9,xe as aa,Na as b,Ga as c,Me as d,Gr as e,Ha as f,za as g,qa as h,Ua as i,Ka as j,q as k,er as l,tr as m,dr as n,zr as o,B as p,Ur as q,Xa as r,Hr as s,It as t,Ct as u,Ba as v,w,mn as x,Pn as y,Wr as z};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ao as r,ap as n}from"./index-D-PvDSJs.js";const t=(a,o)=>r.lang.round(n.parse(a)[o]);export{t as c};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{s as ne,a as an,c as on,b as dn,f as pe,e as k,i as sn}from"./chunk-3FUC2YCW-OWYL0CxB.js";import{_ as y,c as un,l as m,bL as fn,bM as cn,aE as ln,aC as ve,an as ge,al as hn,az as pn,bd as vn}from"./index-D-PvDSJs.js";import{G as x}from"./graph-C2De1HlQ.js";import{T as gn,V as wn,B as bn,W as mn,o as yn,F as En,X as Ln,I as X,i as xn,Y as we,m as _e,e as Nn,Z as Me,G as kn,_ as Ie,$ as De,K as re,l as J,a0 as te,N as Y,R as On,D as Pn,a1 as Sn,b as Cn,c as Rn,a2 as _n,g as l,d as Mn,h as L,f as D,v as S,r as A}from"./_baseUniq-CHc60b6y.js";import{f as R,g as In,b as Dn,a as Te,c as Tn,k as ae,d as Xn,e as Bn,h as jn,i as An,j as Fn,l as Gn,m as Yn,n as U,t as V,o as Vn,p as E,q as Xe,r as ie,s as B,u as qn}from"./_basePickBy-vr4256UX.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";function Wn(e){return gn(wn(e,void 0,R),e+"")}var $n="[object Object]",Hn=Function.prototype,zn=Object.prototype,Be=Hn.toString,Jn=zn.hasOwnProperty,Un=Be.call(Object);function Zn(e){if(!bn(e)||mn(e)!=$n)return!1;var n=In(e);if(n===null)return!0;var r=Jn.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&Be.call(r)==Un}var Kn=1,Qn=4;function er(e){return Dn(e,Kn|Qn)}function Z(e,n,r){(r!==void 0&&!yn(e[n],r)||r===void 0&&!(n in e))&&Te(e,n,r)}function K(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}function nr(e){return Tn(e,ae(e))}function rr(e,n,r,t,a,o,i){var d=K(e,r),s=K(n,r),u=i.get(s);if(u){Z(e,r,u);return}var f=o?o(d,s,r+"",e,n,i):void 0,c=f===void 0;if(c){var h=X(s),p=!h&&En(s),g=!h&&!p&&Ln(s);f=s,h||p||g?X(d)?f=d:xn(d)?f=Xn(d):p?(c=!1,f=Bn(s,!0)):g?(c=!1,f=jn(s,!0)):f=[]:Zn(s)||we(s)?(f=d,we(d)?f=nr(d):(!_e(d)||Nn(d))&&(f=An(s))):c=!1}c&&(i.set(s,f),a(f,s,t,o,i),i.delete(s)),Z(e,r,f)}function je(e,n,r,t,a){e!==n&&Me(n,function(o,i){if(a||(a=new kn),_e(o))rr(e,n,i,r,je,t,a);else{var d=t?t(K(e,i),o,i+"",e,n,a):void 0;d===void 0&&(d=o),Z(e,i,d)}},ae)}function tr(e,n){return e==null?e:Me(e,Ie(n),ae)}function ar(e,n){return e&&De(e,Ie(n))}function ir(e,n){return e>n}function Ae(e,n){return e<n}function F(e,n){var r={};return n=re(n),De(e,function(t,a,o){Te(r,a,n(t,a,o))}),r}function oe(e,n,r){for(var t=-1,a=e.length;++t<a;){var o=e[t],i=n(o);if(i!=null&&(d===void 0?i===i&&!J(i):r(i,d)))var d=i,s=o}return s}function O(e){return e&&e.length?oe(e,te,ir):void 0}var Q=Fn(function(e,n,r){je(e,n,r)});function M(e){return e&&e.length?oe(e,te,Ae):void 0}function de(e,n){return e&&e.length?oe(e,re(n),Ae):void 0}function or(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function dr(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,o=J(e),i=n!==void 0,d=n===null,s=n===n,u=J(n);if(!d&&!u&&!o&&e>n||o&&i&&s&&!d&&!u||t&&i&&s||!r&&s||!a)return 1;if(!t&&!o&&!u&&e<n||u&&r&&a&&!t&&!o||d&&r&&a||!i&&a||!s)return-1}return 0}function sr(e,n,r){for(var t=-1,a=e.criteria,o=n.criteria,i=a.length,d=r.length;++t<i;){var s=dr(a[t],o[t]);if(s){if(t>=d)return s;var u=r[t];return s*(u=="desc"?-1:1)}}return e.index-n.index}function ur(e,n,r){n.length?n=Y(n,function(o){return X(o)?function(i){return On(i,o.length===1?o[0]:o)}:o}):n=[te];var t=-1;n=Y(n,Pn(re));var a=Gn(e,function(o,i,d){var s=Y(n,function(u){return u(o)});return{criteria:s,index:++t,value:o}});return or(a,function(o,i){return sr(o,i,r)})}function fr(e,n){return Yn(e,n,function(r,t){return Sn(e,t)})}var j=Wn(function(e,n){return e==null?{}:fr(e,n)}),cr=Math.ceil,lr=Math.max;function hr(e,n,r,t){for(var a=-1,o=lr(cr((n-e)/(r||1)),0),i=Array(o);o--;)i[++a]=e,e+=r;return i}function pr(e){return function(n,r,t){return t&&typeof t!="number"&&U(n,r,t)&&(r=t=void 0),n=V(n),r===void 0?(r=n,n=0):r=V(r),t=t===void 0?n<r?1:-1:V(t),hr(n,r,t)}}var C=pr(),T=Cn(function(e,n){if(e==null)return[];var r=n.length;return r>1&&U(e,n[0],n[1])?n=[]:r>2&&U(n[0],n[1],n[2])&&(n=[n[0]]),ur(e,Rn(n),[])}),vr=0;function se(e){var n=++vr;return _n(e)+n}function gr(e,n,r){for(var t=-1,a=e.length,o=n.length,i={};++t<a;){var d=t<o?n[t]:void 0;r(i,e[t],d)}return i}function wr(e,n){return gr(e||[],n||[],Vn)}class br{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return be(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&be(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,mr)),t=t._prev;return"["+n.join(", ")+"]"}}function be(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function mr(e,n){if(e!=="_next"&&e!=="_prev")return n}var yr=Mn(1);function Er(e,n){if(e.nodeCount()<=1)return[];var r=xr(e,n||yr),t=Lr(r.graph,r.buckets,r.zeroIdx);return R(E(t,function(a){return e.outEdges(a.v,a.w)}))}function Lr(e,n,r){for(var t=[],a=n[n.length-1],o=n[0],i;e.nodeCount();){for(;i=o.dequeue();)q(e,n,r,i);for(;i=a.dequeue();)q(e,n,r,i);if(e.nodeCount()){for(var d=n.length-2;d>0;--d)if(i=n[d].dequeue(),i){t=t.concat(q(e,n,r,i,!0));break}}}return t}function q(e,n,r,t,a){var o=a?[]:void 0;return l(e.inEdges(t.v),function(i){var d=e.edge(i),s=e.node(i.v);a&&o.push({v:i.v,w:i.w}),s.out-=d,ee(n,r,s)}),l(e.outEdges(t.v),function(i){var d=e.edge(i),s=i.w,u=e.node(s);u.in-=d,ee(n,r,u)}),e.removeNode(t.v),o}function xr(e,n){var r=new x,t=0,a=0;l(e.nodes(),function(d){r.setNode(d,{v:d,in:0,out:0})}),l(e.edges(),function(d){var s=r.edge(d.v,d.w)||0,u=n(d),f=s+u;r.setEdge(d.v,d.w,f),a=Math.max(a,r.node(d.v).out+=u),t=Math.max(t,r.node(d.w).in+=u)});var o=C(a+t+3).map(function(){return new br}),i=t+1;return l(r.nodes(),function(d){ee(o,i,r.node(d))}),{graph:r,buckets:o,zeroIdx:i}}function ee(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Nr(e){var n=e.graph().acyclicer==="greedy"?Er(e,r(e)):kr(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,se("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function kr(e){var n=[],r={},t={};function a(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,l(e.outEdges(o),function(i){Object.prototype.hasOwnProperty.call(r,i.w)?n.push(i):a(i.w)}),delete r[o])}return l(e.nodes(),a),n}function Or(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function _(e,n,r,t){var a;do a=se(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function Pr(e){var n=new x().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function Fe(e){var n=new x({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function me(e,n){var r=e.x,t=e.y,a=n.x-r,o=n.y-t,i=e.width/2,d=e.height/2;if(!a&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var s,u;return Math.abs(o)*i>Math.abs(a)*d?(o<0&&(d=-d),s=d*a/o,u=d):(a<0&&(i=-i),s=i,u=i*o/a),{x:r+s,y:t+u}}function G(e){var n=E(C(Ge(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;L(a)||(n[a][t.order]=r)}),n}function Sr(e){var n=M(E(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);Xe(t,"rank")&&(t.rank-=n)})}function Cr(e){var n=M(E(e.nodes(),function(o){return e.node(o).rank})),r=[];l(e.nodes(),function(o){var i=e.node(o).rank-n;r[i]||(r[i]=[]),r[i].push(o)});var t=0,a=e.graph().nodeRankFactor;l(r,function(o,i){L(o)&&i%a!==0?--t:t&&l(o,function(d){e.node(d).rank+=t})})}function ye(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),_(e,"border",a,n)}function Ge(e){return O(E(e.nodes(),function(n){var r=e.node(n).rank;if(!L(r))return r}))}function Rr(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function _r(e,n){return n()}function Mr(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,i=a.maxRank+1;o<i;++o)Ee(e,"borderLeft","_bl",r,a,o),Ee(e,"borderRight","_br",r,a,o)}}l(e.children(),n)}function Ee(e,n,r,t,a,o){var i={width:0,height:0,rank:o,borderType:n},d=a[n][o-1],s=_(e,"border",i,r);a[n][o]=s,e.setParent(s,t),d&&e.setEdge(d,s,{weight:1})}function Ir(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&Ye(e)}function Dr(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&Tr(e),(n==="lr"||n==="rl")&&(Xr(e),Ye(e))}function Ye(e){l(e.nodes(),function(n){Le(e.node(n))}),l(e.edges(),function(n){Le(e.edge(n))})}function Le(e){var n=e.width;e.width=e.height,e.height=n}function Tr(e){l(e.nodes(),function(n){W(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,W),Object.prototype.hasOwnProperty.call(r,"y")&&W(r)})}function W(e){e.y=-e.y}function Xr(e){l(e.nodes(),function(n){$(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,$),Object.prototype.hasOwnProperty.call(r,"x")&&$(r)})}function $(e){var n=e.x;e.x=e.y,e.y=n}function Br(e){e.graph().dummyChains=[],l(e.edges(),function(n){jr(e,n)})}function jr(e,n){var r=n.v,t=e.node(r).rank,a=n.w,o=e.node(a).rank,i=n.name,d=e.edge(n),s=d.labelRank;if(o!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<o;++c,++t)d.points=[],u={width:0,height:0,edgeLabel:d,edgeObj:n,rank:t},f=_(e,"edge",u,"_d"),t===s&&(u.width=d.width,u.height=d.height,u.dummy="edge-label",u.labelpos=d.labelpos),e.setEdge(r,f,{weight:d.weight},i),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:d.weight},i)}}function Ar(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function ue(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var o=M(E(e.outEdges(t),function(i){return r(i.w)-e.edge(i).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),a.rank=o}l(e.sources(),r)}function I(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function Ve(e){var n=new x({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,o;Fr(n,e)<t;)a=Gr(n,e),o=n.hasNode(a.v)?I(e,a):-I(e,a),Yr(n,e,o);return n}function Fr(e,n){function r(t){l(n.nodeEdges(t),function(a){var o=a.v,i=t===o?a.w:o;!e.hasNode(i)&&!I(n,a)&&(e.setNode(i,{}),e.setEdge(t,i,{}),r(i))})}return l(e.nodes(),r),e.nodeCount()}function Gr(e,n){return de(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return I(n,r)})}function Yr(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function Vr(){}Vr.prototype=new Error;function qe(e,n,r){X(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],o={};return l(n,function(i){if(!e.hasNode(i))throw new Error("Graph does not have node: "+i);We(e,i,r==="post",o,t,a)}),a}function We(e,n,r,t,a,o){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||o.push(n),l(a(n),function(i){We(e,i,r,t,a,o)}),r&&o.push(n))}function qr(e,n){return qe(e,n,"post")}function Wr(e,n){return qe(e,n,"pre")}P.initLowLimValues=ce;P.initCutValues=fe;P.calcCutValue=$e;P.leaveEdge=ze;P.enterEdge=Je;P.exchangeEdges=Ue;function P(e){e=Pr(e),ue(e);var n=Ve(e);ce(n),fe(n,e);for(var r,t;r=ze(n);)t=Je(n,e,r),Ue(n,e,r,t)}function fe(e,n){var r=qr(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){$r(e,n,t)})}function $r(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=$e(e,n,r)}function $e(e,n,r){var t=e.node(r),a=t.parent,o=!0,i=n.edge(r,a),d=0;return i||(o=!1,i=n.edge(a,r)),d=i.weight,l(n.nodeEdges(r),function(s){var u=s.v===r,f=u?s.w:s.v;if(f!==a){var c=u===o,h=n.edge(s).weight;if(d+=c?h:-h,zr(e,r,f)){var p=e.edge(r,f).cutvalue;d+=c?-p:p}}}),d}function ce(e,n){arguments.length<2&&(n=e.nodes()[0]),He(e,{},1,n)}function He(e,n,r,t,a){var o=r,i=e.node(t);return n[t]=!0,l(e.neighbors(t),function(d){Object.prototype.hasOwnProperty.call(n,d)||(r=He(e,n,r,d,t))}),i.low=o,i.lim=r++,a?i.parent=a:delete i.parent,r}function ze(e){return ie(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Je(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var o=e.node(t),i=e.node(a),d=o,s=!1;o.lim>i.lim&&(d=i,s=!0);var u=D(n.edges(),function(f){return s===xe(e,e.node(f.v),d)&&s!==xe(e,e.node(f.w),d)});return de(u,function(f){return I(n,f)})}function Ue(e,n,r,t){var a=r.v,o=r.w;e.removeEdge(a,o),e.setEdge(t.v,t.w,{}),ce(e),fe(e,n),Hr(e,n)}function Hr(e,n){var r=ie(e.nodes(),function(a){return!n.node(a).parent}),t=Wr(e,r);t=t.slice(1),l(t,function(a){var o=e.node(a).parent,i=n.edge(a,o),d=!1;i||(i=n.edge(o,a),d=!0),n.node(a).rank=n.node(o).rank+(d?i.minlen:-i.minlen)})}function zr(e,n,r){return e.hasEdge(n,r)}function xe(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Jr(e){switch(e.graph().ranker){case"network-simplex":Ne(e);break;case"tight-tree":Zr(e);break;case"longest-path":Ur(e);break;default:Ne(e)}}var Ur=ue;function Zr(e){ue(e),Ve(e)}function Ne(e){P(e)}function Kr(e){var n=_(e,"root",{},"_root"),r=Qr(e),t=O(S(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(i){e.edge(i).minlen*=a});var o=et(e)+1;l(e.children(),function(i){Ze(e,n,a,o,t,r,i)}),e.graph().nodeRankFactor=a}function Ze(e,n,r,t,a,o,i){var d=e.children(i);if(!d.length){i!==n&&e.setEdge(n,i,{weight:0,minlen:r});return}var s=ye(e,"_bt"),u=ye(e,"_bb"),f=e.node(i);e.setParent(s,i),f.borderTop=s,e.setParent(u,i),f.borderBottom=u,l(d,function(c){Ze(e,n,r,t,a,o,c);var h=e.node(c),p=h.borderTop?h.borderTop:c,g=h.borderBottom?h.borderBottom:c,w=h.borderTop?t:2*t,v=p!==g?1:a-o[i]+1;e.setEdge(s,p,{weight:w,minlen:v,nestingEdge:!0}),e.setEdge(g,u,{weight:w,minlen:v,nestingEdge:!0})}),e.parent(i)||e.setEdge(n,s,{weight:0,minlen:a+o[i]})}function Qr(e){var n={};function r(t,a){var o=e.children(t);o&&o.length&&l(o,function(i){r(i,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function et(e){return A(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function nt(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function rt(e,n,r){var t={},a;l(r,function(o){for(var i=e.parent(o),d,s;i;){if(d=e.parent(i),d?(s=t[d],t[d]=i):(s=a,a=i),s&&s!==i){n.setEdge(s,i);return}i=d}})}function tt(e,n,r){var t=at(e),a=new x({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return e.node(o)});return l(e.nodes(),function(o){var i=e.node(o),d=e.parent(o);(i.rank===n||i.minRank<=n&&n<=i.maxRank)&&(a.setNode(o),a.setParent(o,d||t),l(e[r](o),function(s){var u=s.v===o?s.w:s.v,f=a.edge(u,o),c=L(f)?0:f.weight;a.setEdge(u,o,{weight:e.edge(s).weight+c})}),Object.prototype.hasOwnProperty.call(i,"minRank")&&a.setNode(o,{borderLeft:i.borderLeft[n],borderRight:i.borderRight[n]}))}),a}function at(e){for(var n;e.hasNode(n=se("_root")););return n}function it(e,n){for(var r=0,t=1;t<n.length;++t)r+=ot(e,n[t-1],n[t]);return r}function ot(e,n,r){for(var t=wr(r,E(r,function(u,f){return f})),a=R(E(n,function(u){return T(E(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var i=2*o-1;o-=1;var d=E(new Array(i),function(){return 0}),s=0;return l(a.forEach(function(u){var f=u.pos+o;d[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=d[f+1]),f=f-1>>1,d[f]+=u.weight;s+=u.weight*c})),s}function dt(e){var n={},r=D(e.nodes(),function(d){return!e.children(d).length}),t=O(E(r,function(d){return e.node(d).rank})),a=E(C(t+1),function(){return[]});function o(d){if(!Xe(n,d)){n[d]=!0;var s=e.node(d);a[s.rank].push(d),l(e.successors(d),o)}}var i=T(r,function(d){return e.node(d).rank});return l(i,o),a}function st(e,n){return E(n,function(r){var t=e.inEdges(r);if(t.length){var a=A(t,function(o,i){var d=e.edge(i),s=e.node(i.v);return{sum:o.sum+d.weight*s.order,weight:o.weight+d.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function ut(e,n){var r={};l(e,function(a,o){var i=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i:o};L(a.barycenter)||(i.barycenter=a.barycenter,i.weight=a.weight)}),l(n.edges(),function(a){var o=r[a.v],i=r[a.w];!L(o)&&!L(i)&&(i.indegree++,o.out.push(r[a.w]))});var t=D(r,function(a){return!a.indegree});return ft(t)}function ft(e){var n=[];function r(o){return function(i){i.merged||(L(i.barycenter)||L(o.barycenter)||i.barycenter>=o.barycenter)&&ct(o,i)}}function t(o){return function(i){i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return E(D(n,function(o){return!o.merged}),function(o){return j(o,["vs","i","barycenter","weight"])})}function ct(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function lt(e,n){var r=Rr(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=T(r.rhs,function(f){return-f.i}),o=[],i=0,d=0,s=0;t.sort(ht(!!n)),s=ke(o,a,s),l(t,function(f){s+=f.vs.length,o.push(f.vs),i+=f.barycenter*f.weight,d+=f.weight,s=ke(o,a,s)});var u={vs:R(o)};return d&&(u.barycenter=i/d,u.weight=d),u}function ke(e,n,r){for(var t;n.length&&(t=B(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function ht(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function Ke(e,n,r,t){var a=e.children(n),o=e.node(n),i=o?o.borderLeft:void 0,d=o?o.borderRight:void 0,s={};i&&(a=D(a,function(g){return g!==i&&g!==d}));var u=st(e,a);l(u,function(g){if(e.children(g.v).length){var w=Ke(e,g.v,r,t);s[g.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&vt(g,w)}});var f=ut(u,r);pt(f,s);var c=lt(f,t);if(i&&(c.vs=R([i,c.vs,d]),e.predecessors(i).length)){var h=e.node(e.predecessors(i)[0]),p=e.node(e.predecessors(d)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+p.order)/(c.weight+2),c.weight+=2}return c}function pt(e,n){l(e,function(r){r.vs=R(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function vt(e,n){L(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function gt(e){var n=Ge(e),r=Oe(e,C(1,n+1),"inEdges"),t=Oe(e,C(n-1,-1,-1),"outEdges"),a=dt(e);Pe(e,a);for(var o=Number.POSITIVE_INFINITY,i,d=0,s=0;s<4;++d,++s){wt(d%2?r:t,d%4>=2),a=G(e);var u=it(e,a);u<o&&(s=0,i=er(a),o=u)}Pe(e,i)}function Oe(e,n,r){return E(n,function(t){return tt(e,t,r)})}function wt(e,n){var r=new x;l(e,function(t){var a=t.graph().root,o=Ke(t,a,r,n);l(o.vs,function(i,d){t.node(i).order=d}),rt(t,r,o.vs)})}function Pe(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function bt(e){var n=yt(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,o=mt(e,n,a.v,a.w),i=o.path,d=o.lca,s=0,u=i[s],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=i[s])!==d&&e.node(u).maxRank<t.rank;)s++;u===d&&(f=!1)}if(!f){for(;s<i.length-1&&e.node(u=i[s+1]).minRank<=t.rank;)s++;u=i[s]}e.setParent(r,u),r=e.successors(r)[0]}})}function mt(e,n,r,t){var a=[],o=[],i=Math.min(n[r].low,n[t].low),d=Math.max(n[r].lim,n[t].lim),s,u;s=r;do s=e.parent(s),a.push(s);while(s&&(n[s].low>i||d>n[s].lim));for(u=s,s=t;(s=e.parent(s))!==u;)o.push(s);return{path:a.concat(o.reverse()),lca:u}}function yt(e){var n={},r=0;function t(a){var o=r;l(e.children(a),t),n[a]={low:o,lim:r++}}return l(e.children(),t),n}function Et(e,n){var r={};function t(a,o){var i=0,d=0,s=a.length,u=B(o);return l(o,function(f,c){var h=xt(e,f),p=h?e.node(h).order:s;(h||f===u)&&(l(o.slice(d,c+1),function(g){l(e.predecessors(g),function(w){var v=e.node(w),b=v.order;(b<i||p<b)&&!(v.dummy&&e.node(g).dummy)&&Qe(r,w,g)})}),d=c+1,i=p)}),o}return A(n,t),r}function Lt(e,n){var r={};function t(o,i,d,s,u){var f;l(C(i,d),function(c){f=o[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var p=e.node(h);p.dummy&&(p.order<s||p.order>u)&&Qe(r,h,f)})})}function a(o,i){var d=-1,s,u=0;return l(i,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(s=e.node(h[0]).order,t(i,u,c,d,s),u=c,d=s)}t(i,u,i.length,s,o.length)}),i}return A(n,a),r}function xt(e,n){if(e.node(n).dummy)return ie(e.predecessors(n),function(r){return e.node(r).dummy})}function Qe(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Nt(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function kt(e,n,r,t){var a={},o={},i={};return l(n,function(d){l(d,function(s,u){a[s]=s,o[s]=s,i[s]=u})}),l(n,function(d){var s=-1;l(d,function(u){var f=t(u);if(f.length){f=T(f,function(w){return i[w]});for(var c=(f.length-1)/2,h=Math.floor(c),p=Math.ceil(c);h<=p;++h){var g=f[h];o[u]===u&&s<i[g]&&!Nt(r,u,g)&&(o[g]=u,o[u]=a[u]=a[g],s=i[g])}}})}),{root:a,align:o}}function Ot(e,n,r,t,a){var o={},i=Pt(e,n,r,a),d=a?"borderLeft":"borderRight";function s(c,h){for(var p=i.nodes(),g=p.pop(),w={};g;)w[g]?c(g):(w[g]=!0,p.push(g),p=p.concat(h(g))),g=p.pop()}function u(c){o[c]=i.inEdges(c).reduce(function(h,p){return Math.max(h,o[p.v]+i.edge(p))},0)}function f(c){var h=i.outEdges(c).reduce(function(g,w){return Math.min(g,o[w.w]-i.edge(w))},Number.POSITIVE_INFINITY),p=e.node(c);h!==Number.POSITIVE_INFINITY&&p.borderType!==d&&(o[c]=Math.max(o[c],h))}return s(u,i.predecessors.bind(i)),s(f,i.successors.bind(i)),l(t,function(c){o[c]=o[r[c]]}),o}function Pt(e,n,r,t){var a=new x,o=e.graph(),i=Mt(o.nodesep,o.edgesep,t);return l(n,function(d){var s;l(d,function(u){var f=r[u];if(a.setNode(f),s){var c=r[s],h=a.edge(c,f);a.setEdge(c,f,Math.max(i(e,u,s),h||0))}s=u})}),a}function St(e,n){return de(S(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return tr(r,function(o,i){var d=It(e,i)/2;t=Math.max(o+d,t),a=Math.min(o-d,a)}),t-a})}function Ct(e,n){var r=S(n),t=M(r),a=O(r);l(["u","d"],function(o){l(["l","r"],function(i){var d=o+i,s=e[d],u;if(s!==n){var f=S(s);u=i==="l"?t-M(f):a-O(f),u&&(e[d]=F(s,function(c){return c+u}))}})})}function Rt(e,n){return F(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=T(E(e,t));return(a[1]+a[2])/2})}function _t(e){var n=G(e),r=Q(Et(e,n),Lt(e,n)),t={},a;l(["u","d"],function(i){a=i==="u"?n:S(n).reverse(),l(["l","r"],function(d){d==="r"&&(a=E(a,function(c){return S(c).reverse()}));var s=(i==="u"?e.predecessors:e.successors).bind(e),u=kt(e,a,r,s),f=Ot(e,a,u.root,u.align,d==="r");d==="r"&&(f=F(f,function(c){return-c})),t[i+d]=f})});var o=St(e,t);return Ct(t,o),Rt(t,e.graph().align)}function Mt(e,n,r){return function(t,a,o){var i=t.node(a),d=t.node(o),s=0,u;if(s+=i.width/2,Object.prototype.hasOwnProperty.call(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":u=-i.width/2;break;case"r":u=i.width/2;break}if(u&&(s+=r?u:-u),u=0,s+=(i.dummy?n:e)/2,s+=(d.dummy?n:e)/2,s+=d.width/2,Object.prototype.hasOwnProperty.call(d,"labelpos"))switch(d.labelpos.toLowerCase()){case"l":u=d.width/2;break;case"r":u=-d.width/2;break}return u&&(s+=r?u:-u),u=0,s}}function It(e,n){return e.node(n).width}function Dt(e){e=Fe(e),Tt(e),ar(_t(e),function(n,r){e.node(r).x=n})}function Tt(e){var n=G(e),r=e.graph().ranksep,t=0;l(n,function(a){var o=O(E(a,function(i){return e.node(i).height}));l(a,function(i){e.node(i).y=t+o/2}),t+=o+r})}function Xt(e,n){var r=_r;r("layout",()=>{var t=r(" buildLayoutGraph",()=>Ht(e));r(" runLayout",()=>Bt(t,r)),r(" updateInputGraph",()=>jt(e,t))})}function Bt(e,n){n(" makeSpaceForEdgeLabels",()=>zt(e)),n(" removeSelfEdges",()=>ta(e)),n(" acyclic",()=>Nr(e)),n(" nestingGraph.run",()=>Kr(e)),n(" rank",()=>Jr(Fe(e))),n(" injectEdgeLabelProxies",()=>Jt(e)),n(" removeEmptyRanks",()=>Cr(e)),n(" nestingGraph.cleanup",()=>nt(e)),n(" normalizeRanks",()=>Sr(e)),n(" assignRankMinMax",()=>Ut(e)),n(" removeEdgeLabelProxies",()=>Zt(e)),n(" normalize.run",()=>Br(e)),n(" parentDummyChains",()=>bt(e)),n(" addBorderSegments",()=>Mr(e)),n(" order",()=>gt(e)),n(" insertSelfEdges",()=>aa(e)),n(" adjustCoordinateSystem",()=>Ir(e)),n(" position",()=>Dt(e)),n(" positionSelfEdges",()=>ia(e)),n(" removeBorderNodes",()=>ra(e)),n(" normalize.undo",()=>Ar(e)),n(" fixupEdgeLabelCoords",()=>ea(e)),n(" undoCoordinateSystem",()=>Dr(e)),n(" translateGraph",()=>Kt(e)),n(" assignNodeIntersects",()=>Qt(e)),n(" reversePoints",()=>na(e)),n(" acyclic.undo",()=>Or(e))}function jt(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var At=["nodesep","edgesep","ranksep","marginx","marginy"],Ft={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gt=["acyclicer","ranker","rankdir","align"],Yt=["width","height"],Vt={width:0,height:0},qt=["minlen","weight","width","height","labeloffset"],Wt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},$t=["labelpos"];function Ht(e){var n=new x({multigraph:!0,compound:!0}),r=z(e.graph());return n.setGraph(Q({},Ft,H(r,At),j(r,Gt))),l(e.nodes(),function(t){var a=z(e.node(t));n.setNode(t,qn(H(a,Yt),Vt)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=z(e.edge(t));n.setEdge(t,Q({},Wt,H(a,qt),j(a,$t)))}),n}function zt(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Jt(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),o={rank:(a.rank-t.rank)/2+t.rank,e:n};_(e,"edge-proxy",o,"_ep")}})}function Ut(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=O(n,t.maxRank))}),e.graph().maxRank=n}function Zt(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function Kt(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,o=e.graph(),i=o.marginx||0,d=o.marginy||0;function s(u){var f=u.x,c=u.y,h=u.width,p=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-p/2),a=Math.max(a,c+p/2)}l(e.nodes(),function(u){s(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&s(f)}),n-=i,t-=d,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),o.width=r-n+i,o.height=a-t+d}function Qt(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),o,i;r.points?(o=r.points[0],i=r.points[r.points.length-1]):(r.points=[],o=a,i=t),r.points.unshift(me(t,o)),r.points.push(me(a,i))})}function ea(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function na(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function ra(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),o=e.node(B(r.borderLeft)),i=e.node(B(r.borderRight));r.width=Math.abs(i.x-o.x),r.height=Math.abs(a.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function ta(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function aa(e){var n=G(e);l(n,function(r){var t=0;l(r,function(a,o){var i=e.node(a);i.order=o+t,l(i.selfEdges,function(d){_(e,"selfedge",{width:d.label.width,height:d.label.height,rank:i.rank,order:o+ ++t,e:d.e,label:d.label},"_se")}),delete i.selfEdges})})}function ia(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,o=t.y,i=r.x-a,d=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*i/3,y:o-d},{x:a+5*i/6,y:o-d},{x:a+i,y:o},{x:a+5*i/6,y:o+d},{x:a+2*i/3,y:o+d}],r.label.x=r.x,r.label.y=r.y}})}function H(e,n){return F(j(e,n),Number)}function z(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var Se=y((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),Ce=y((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),oa=y(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),da=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],sa=y((e,n,r,t,a)=>{const o=[],i=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&i.add(f),c!==t&&i.add(c)}),i.forEach(f=>{const c=e.node(f);typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)}),o.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof c?.x=="number"&&typeof c?.y=="number"&&o.push(c)})}),o.length===0)return Ce(a);const d=o.reduce((f,c)=>({x:f.x+c.x/o.length,y:f.y+c.y/o.length}),{x:0,y:0}),s=d.x-n.x,u=d.y-n.y;return Math.abs(s)>Math.abs(u)?s>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":Ce(a)},"getSelfLoopSide"),ua=y((e,n="top",r=0,t=0)=>{const a=e.x,o=e.y-r,i=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,e.width*.8)),u=Se(Math.max(t,e.width*.35),36,s),f=Se(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=o+d;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+i;return[{x:c,y:o-u/2},{x:c+f,y:o-u/2},{x:c+f,y:o+u/2},{x:c,y:o+u/2}]}case"left":{const c=a-i;return[{x:c,y:o-u/2},{x:c-f,y:o-u/2},{x:c-f,y:o+u/2},{x:c,y:o+u/2}]}default:{const c=o-d;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),fa=y((e,n,r="top",t=0,a={})=>{const i=e.x,d=e.y-t,s=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:i,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+s/2+4,y:d};case"left":return{x:Math.min(...n.map(f=>f.x))-s/2-4,y:d};default:return{x:i,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),en=y((e,n=0,{mergeSelfLoops:r=!0}={})=>{const t=new Map,a=[],o=e.graph()?.rankdir;return e.edges().forEach(i=>{const d=e.edge(i);if(r&&d.selfLoop){const s=d.selfLoop.id;t.has(s)||t.set(s,[]),t.get(s).push({edge:d,start:i.v,end:i.w})}else a.push({edge:d,start:i.v,end:i.w})}),t.forEach(i=>{if(i.length!==3){i.forEach(b=>a.push(b));return}i.sort((b,N)=>b.edge.selfLoop.order-N.edge.selfLoop.order);const[d,s,u]=i,f=d.edge.originalEdge??s.edge.originalEdge??u.edge.originalEdge??s.edge,c=e.node(f.start);if(!c){i.forEach(b=>a.push(b));return}const h={width:s.edge.width,height:s.edge.height},p=sa(e,c,i,f.start,o),g=ua(c,p,n,h.width??0),w=fa(c,g,p,n,h),v={...s.edge,...f,id:f.id,points:g,start:f.start,end:f.end,x:w.x,y:w.y,width:h.width,height:h.height,labelStyle:s.edge.labelStyle,fromCluster:d.edge.fromCluster??s.edge.fromCluster??u.edge.fromCluster,toCluster:d.edge.toCluster??s.edge.toCluster??u.edge.toCluster};delete v.selfLoop,delete v.originalEdge,a.push({edge:v,start:v.start,end:v.end})}),a},"getEdgesToRender"),nn=y(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:o})=>{const i=n.graph().rankdir;m.trace("Dir in recursive render - dir:",i);const{clusters:d,edgePaths:s,edgeLabels:u,nodes:f,rootGroups:c}=dn(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=oa(r);await Promise.all(n.nodes().map(async function(w){const v=n.node(w);if(a!==void 0){const b=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
|
|
2
|
-
Node.id = `,w,`
|
|
3
|
-
data=`,b.height,`
|
|
4
|
-
Parent cluster`,a.height),n.setNode(a.id,b),n.parent(w)||(m.trace("Setting parent",w,a.id),n.setParent(w,a.id,b))}if(m.info("(Insert) Node XXX"+w+": "+JSON.stringify(n.node(w))),v?.clusterNode){m.info("Cluster identified XBX",w,v.width,n.node(w));const{ranksep:b,nodesep:N}=n.graph();v.graph.setGraph({...v.graph.graph(),ranksep:b+25,nodesep:N});const le=await va({element:f,graph:v.graph,diagramType:r,id:t,parentCluster:n.node(w),siteConfig:o}),he=le.elem;fn(v,he),v.diff=le.diff||0,m.info("New compound node after recursive render XAX",w,"width",v.width,"height",v.height),cn(he,v)}else n.children(w).length>0?(m.trace("Cluster - the non recursive path XBX",w,v.id,v,v.width,"Graph:",n),m.trace(pe(v.id,n)),k.set(v.id,{id:pe(v.id,n),node:v})):(m.trace("Node - the non recursive path XAX",w,f,n.node(w),i),await sn(f,n.node(w),{config:o,dir:i}))})),await y(async()=>{const w=n.edges().map(async function(v){const b=n.edge(v.v,v.w,v.name);if(m.info("Edge "+v.v+" -> "+v.w+": "+JSON.stringify(v)),m.info("Edge "+v.v+" -> "+v.w+": ",v," ",JSON.stringify(n.edge(v))),m.info("Fix",k,"ids:",v.v,v.w,"Translating: ",k.get(v.v),k.get(v.w)),h&&b.selfLoop){if(b.selfLoop.order!==1)return;const N={...b.originalEdge,...b,id:b.selfLoop.id,startLabelLeft:b.originalEdge?.startLabelLeft??b.startLabelLeft,startLabelRight:b.originalEdge?.startLabelRight??b.startLabelRight,endLabelLeft:b.originalEdge?.endLabelLeft??b.endLabelLeft,endLabelRight:b.originalEdge?.endLabelRight??b.endLabelRight};await ve(u,N),b.width=N.width,b.height=N.height,b.labelStyle=N.labelStyle;return}await ve(u,b)});await Promise.all(w)},"processEdges")();const{subGraphTitleTotalMargin:g}=ln(o);return{elem:c,graph:n,groups:{clusters:d,edgePaths:s,edgeLabels:u,nodes:f,rootGroups:c},diagramType:r,id:t,mergeSelfLoops:h,subGraphTitleTotalMargin:g}},"measureDagreGraph"),rn=y(e=>{m.info("############################################# XXX"),m.info("### Layout ### XXX"),m.info("############################################# XXX"),Xt(e)},"runDagreGraphLayout"),ca=y((e,n,r)=>{const t=e.node(n);if(!t)return;const a={...t};return t?.clusterNode?a.y=(t.y??0)+r:e.children(n).length>0?a.height=(t.height??0)+r:a.y=(t.y??0)+r/2,a},"normalizeDagreNode"),Re=y((e,n)=>{da.forEach(r=>{n[r]!==void 0&&(e[r]=n[r])})},"applyDagreNodeLayout"),la=y((e,n,r,t)=>({...e,start:e.start??n,end:e.end??r,points:(e.points??[]).map(a=>({...a,y:typeof a.y=="number"?a.y+t:a.y}))}),"normalizeDagreEdge"),ha=y((e,n)=>{const{graph:r,mergeSelfLoops:t,subGraphTitleTotalMargin:a=0}=n,o=new Map(e.nodes.map(d=>[d.id,d]));ne(r).forEach(d=>{const s=ca(r,d,a);if(!s)return;Re(r.node(d),s);const u=o.get(d);u&&Re(u,s)});const i=a/2;return e.edges=en(r,i,{mergeSelfLoops:t}).map(({edge:d,start:s,end:u})=>la(d,s,u,i)),e},"applyDagreLayoutResult"),pa=y(async({elem:e,graph:n,groups:{clusters:r,edgePaths:t},diagramType:a,id:o,mergeSelfLoops:i,subGraphTitleTotalMargin:d})=>{let s=0;await Promise.all(ne(n).map(async function(c){const h=n.node(c);if(m.info("Position XBX => "+c+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h?.clusterNode)h.y+=d,m.info("A tainted cluster node XBX1",c,h.id,h.width,h.height,h.x,h.y,n.parent(c)),k.get(h.id).node=h,ge(h);else if(n.children(c).length>0){m.info("A pure cluster node XBX1",c,h.id,h.x,h.y,h.width,h.height,n.parent(c)),h.height+=d,n.node(h.parentId);const p=h?.padding/2||0,g=h?.labelBBox?.height||0,w=g-p||0;m.debug("OffsetY",w,"labelHeight",g,"halfPadding",p),await hn(r,h),k.get(h.id).node=h}else{const p=n.node(h.parentId);h.y+=d/2,m.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",p,p?.offsetY,h),ge(h)}}));const u=d/2;return en(n,u,{mergeSelfLoops:i}).forEach(function({edge:c,start:h,end:p}){m.info("Edge "+h+" -> "+p+": "+JSON.stringify(c),c),c.points.forEach(b=>b.y+=u);const g=n.node(h),w=n.node(p),v=pn(t,c,k,a,g,w,o);vn(c,v)}),n.nodes().forEach(function(c){const h=n.node(c);m.info(c,h.type,h.diff),h.isGroup&&(s=h.diff)}),m.warn("Returning from recursive render XAX",e,s),{elem:e,diff:s}},"paintDagreLayoutCore"),va=y(async e=>{const n=await nn(e);return rn(n.graph),await pa(n)},"renderDagreSubgraph"),tn=y(e=>{const n=new x({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(r=>{n.setNode(r.id,{...r}),r.parentId&&n.setParent(r.id,r.parentId)}),m.debug("Edges:",e.edges),e.edges.forEach(r=>{if(r.start===r.end){const t=r.start,a=t+"---"+t+"---1",o=t+"---"+t+"---2",i=n.node(t);n.setNode(a,{domId:a,id:a,parentId:i.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(a,i.parentId),n.setNode(o,{domId:o,id:o,parentId:i.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(o,i.parentId);const d=structuredClone(r),s=structuredClone(r),u=structuredClone(r),f=structuredClone(r);s.originalEdge=d,s.selfLoop={id:d.id,order:0},u.originalEdge=d,u.selfLoop={id:d.id,order:1},f.originalEdge=d,f.selfLoop={id:d.id,order:2},s.label="",s.arrowTypeEnd="none",s.endLabelLeft="",s.endLabelRight="",s.startLabelLeft="",s.id=t+"-cyclic-special-1",u.startLabelRight="",u.startLabelLeft="",u.endLabelLeft="",u.endLabelRight="",u.arrowTypeStart="none",u.arrowTypeEnd="none",u.id=t+"-cyclic-special-mid",f.label="",f.startLabelRight="",f.startLabelLeft="",f.arrowTypeStart="none",i.isGroup&&(s.fromCluster=t,f.toCluster=t),f.id=t+"-cyclic-special-2",f.arrowTypeStart="none",n.setEdge(t,a,s,t+"-cyclic-special-0"),n.setEdge(a,o,u,t+"-cyclic-special-1"),n.setEdge(o,t,f,t+"-cyclic-special-2")}else n.setEdge(r.start,r.end,{...r},r.id)}),an(n),{graph:n}},"prepareLayoutForDagre"),ga=y(async(e,{element:n,preparedLayout:r})=>{const t=r??tn(e),a=un(),o=await nn({element:n,graph:t.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return t.measuredLayout=o,o},"measureDagreLayout"),wa=y((e,n)=>{const r=n.preparedLayout?.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return rn(r.graph),ha(e,r),r},"runDagreLayoutCore"),ba=y((e,{measure:n})=>ne(n.graph).map(r=>n.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),ma=y((e,n,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),Pa=on({prepareLayout:tn,measureLayout:ga,runLayoutCore:wa,paintOptions:{clusterDb:k,getNodes:ba,getEdgeNode:ma,skipNode:y((e,{measure:n})=>!n.graph.hasNode(e.id),"skipNode"),isCluster:y((e,{measure:n})=>n.graph.hasNode(e.id)&&(n.graph.children(e.id)??[]).length>0,"isCluster")}});export{ha as applyDagreLayoutResult,en as getEdgesToRender,ga as measureDagreLayout,tn as prepareLayoutForDagre,Pa as render,wa as runDagreLayoutCore};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as N,a as j,c as v,i as P,d as f,e as b,k as _,f as g,g as o,h as l,v as p,r as D,j as E}from"./_baseUniq-CHc60b6y.js";var w=N(function(d){return j(v(d,1,P,!0))}),F="\0",a="\0",O="";class L{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,"directed")?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,"multigraph")?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=f(void 0),this._defaultEdgeLabelFn=f(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[a]={}),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(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return b(e)||(e=f(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return _(this._nodes)}sources(){var e=this;return g(this.nodes(),function(t){return E(e._in[t])})}sinks(){var e=this;return g(this.nodes(),function(t){return E(e._out[t])})}setNodes(e,t){var s=arguments,i=this;return o(e,function(r){s.length>1?i.setNode(r,t):i.setNode(r)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=a,this._children[e]={},this._children[a][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=s=>this.removeEdge(this._edgeObjs[s]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],o(this.children(e),s=>{this.setParent(s)}),delete this._children[e]),o(_(this._in[e]),t),delete this._in[e],delete this._preds[e],o(_(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(l(t))t=a;else{t+="";for(var s=t;!l(s);s=this.parent(s))if(s===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==a)return t}}children(e){if(l(e)&&(e=a),this._isCompound){var t=this._children[e];if(t)return _(t)}else{if(e===a)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return _(t)}successors(e){var t=this._sucs[e];if(t)return _(t)}neighbors(e){var t=this.predecessors(e);if(t)return w(t,this.successors(e))}isLeaf(e){var t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var s=this;o(this._nodes,function(n,h){e(h)&&t.setNode(h,n)}),o(this._edgeObjs,function(n){t.hasNode(n.v)&&t.hasNode(n.w)&&t.setEdge(n,s.edge(n))});var i={};function r(n){var h=s.parent(n);return h===void 0||t.hasNode(h)?(i[n]=h,h):h in i?i[h]:r(h)}return this._isCompound&&o(t.nodes(),function(n){t.setParent(n,r(n))}),t}setDefaultEdgeLabel(e){return b(e)||(e=f(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return p(this._edgeObjs)}setPath(e,t){var s=this,i=arguments;return D(e,function(r,n){return i.length>1?s.setEdge(r,n,t):s.setEdge(r,n),n}),this}setEdge(){var e,t,s,i,r=!1,n=arguments[0];typeof n=="object"&&n!==null&&"v"in n?(e=n.v,t=n.w,s=n.name,arguments.length===2&&(i=arguments[1],r=!0)):(e=n,t=arguments[1],s=arguments[3],arguments.length>2&&(i=arguments[2],r=!0)),e=""+e,t=""+t,l(s)||(s=""+s);var h=c(this._isDirected,e,t,s);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,h))return r&&(this._edgeLabels[h]=i),this;if(!l(s)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[h]=r?i:this._defaultEdgeLabelFn(e,t,s);var u=M(this._isDirected,e,t,s);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[h]=u,y(this._preds[t],e),y(this._sucs[e],t),this._in[t][h]=u,this._out[e][h]=u,this._edgeCount++,this}edge(e,t,s){var i=arguments.length===1?m(this._isDirected,arguments[0]):c(this._isDirected,e,t,s);return this._edgeLabels[i]}hasEdge(e,t,s){var i=arguments.length===1?m(this._isDirected,arguments[0]):c(this._isDirected,e,t,s);return Object.prototype.hasOwnProperty.call(this._edgeLabels,i)}removeEdge(e,t,s){var i=arguments.length===1?m(this._isDirected,arguments[0]):c(this._isDirected,e,t,s),r=this._edgeObjs[i];return r&&(e=r.v,t=r.w,delete this._edgeLabels[i],delete this._edgeObjs[i],C(this._preds[t],e),C(this._sucs[e],t),delete this._in[t][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,t){var s=this._in[e];if(s){var i=p(s);return t?g(i,function(r){return r.v===t}):i}}outEdges(e,t){var s=this._out[e];if(s){var i=p(s);return t?g(i,function(r){return r.w===t}):i}}nodeEdges(e,t){var s=this.inEdges(e,t);if(s)return s.concat(this.outEdges(e,t))}}L.prototype._nodeCount=0;L.prototype._edgeCount=0;function y(d,e){d[e]?d[e]++:d[e]=1}function C(d,e){--d[e]||delete d[e]}function c(d,e,t,s){var i=""+e,r=""+t;if(!d&&i>r){var n=i;i=r,r=n}return i+O+r+O+(l(s)?F:s)}function M(d,e,t,s){var i=""+e,r=""+t;if(!d&&i>r){var n=i;i=r,r=n}var h={v:i,w:r};return s&&(h.name=s),h}function m(d,e){return c(d,e.v,e.w,e.name)}export{L as G};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as sr}from"./chunk-NETBCI7D-Ds_9Juid.js";import{c as rr}from"./chunk-3FUC2YCW-OWYL0CxB.js";import{_ as a,l as yn}from"./index-D-PvDSJs.js";import"./graph-C2De1HlQ.js";import"./_baseUniq-CHc60b6y.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";function Lo(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));sr(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}a(Lo,"applySwimlaneLineJumps");var hn="__swimlane_default__",ir=21,Io=20;function xn(t){return Math.max(t.padding??Io,Io)}a(xn,"topLaneHorizontalPadding");function To(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const l=n-s/2,f=Math.min(r,n+s/2),u=Math.min(ir,Math.max(0,f-l)),g=l+u;if(g<=l){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:l,bottom:g}}a(To,"assignTopLaneTitleRect");function wo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===hn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:hn,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((r,l)=>Math.max(r,l.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=hn}a(wo,"prepareLayoutForSwimlanes");function Eo(t){const e=new Map;for(const u of t.nodes??[])e.set(u.id,u);const n=[];for(const u of t.edges??[]){const g=typeof u.start=="string"?u.start:void 0,b=typeof u.end=="string"?u.end:void 0;!g||!b||u.labelNodeId||n.push({id:u.id,src:g,dst:b,ref:u})}const o=t.nodes??[],s=o.filter(u=>u.isGroup),r=o.filter(u=>!u.isGroup);return{nodes:[...[...s].reverse(),...r].map(u=>u.id),edges:n,layout:t,nodeById:e}}a(Eo,"toGraphView");function Ao(t,e,n,o){const{layout:s}=t,r=t.nodeById,l=o?.layerGap??100,f=o?.nodeGap??40;let u=0;for(const v of e.layers){let d=0;for(const h of v){const i=r.get(h);if(!i){d++;continue}i.layer=u,i.order=d;const y=n.x[h]??d*f,L=n.y[h]??u*l;i.x=y,i.y=L,d++}u++}const g=s.nodes??[],b=new Map,p=[];for(const v of g){if(!v?.isGroup)continue;v.parentId||p.push(v);const d=g.filter(I=>I.parentId===v.id);let h=1/0,i=-1/0,y=1/0,L=-1/0;for(const I of d){const E=I.x??n.x[I.id],T=I.y??n.y[I.id],m=I.width??0,M=I.height??0;E!=null&&T!=null&&(h=Math.min(h,E-m/2),i=Math.max(i,E+m/2),y=Math.min(y,T-M/2),L=Math.max(L,T+M/2))}if(h===1/0||y===1/0)v.x=v.x??0,v.y=v.y??0,v.width=v.width??0,v.height=v.height??0;else{const I=v.padding??20,E=v.parentId?I:2*xn(v),T=I,m=Math.max(0,i-h)+E,M=Math.max(0,L-y)+T,A=(h+i)/2,R=(y+L)/2;v.x=A,v.y=R,v.width=m,v.height=M,b.set(v.id,{minX:h,maxX:i,minY:y,maxY:L})}}if(p.length>0&&b.size>0){let v=1/0,d=-1/0,h=0;for(const i of p){const y=i.padding??20;y>h&&(h=y);const L=b.get(i.id);L&&(v=Math.min(v,L.minY),d=Math.max(d,L.maxY))}if(v!==1/0&&d!==-1/0){const i=Math.max(0,d-v),L=Math.max(h,36),I=i+2*L,E=(v+d)/2;for(const k of p)k.y=E,k.height=I,k.swimlaneContentTop=v;const T=[...p].sort((k,O)=>{const F=k.x??0,D=O.x??0;return F-D}),m=[],M=[],A=[];for(const k of T){const O=b.get(k.id);if(!O)continue;const F=Math.max(0,O.maxX-O.minX)+2*xn(k),D=(O.minX+O.maxX)/2;m.push(k.id),M.push(D),A.push(F)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],A[0]);else{const O=[];for(let j=0;j<R-1;j++)O.push(M[j+1]-M[j]);const F=new Array(R);F[0]=0;for(let j=0;j<R-1;j++)F[j+1]=2*O[j]-F[j];let D=0,B=Number.POSITIVE_INFINITY;for(let j=0;j<R;j++){const Z=A[j];j%2===0?D=Math.max(D,Z-F[j]):B=Math.min(B,F[j]-Z)}let G=D;D<=B?G=(D+B)/2:G=D;for(let j=0;j<R;j++){const Z=F[j]+(j%2===0?G:-G),dt=Math.max(A[j],Z);k.set(m[j],dt)}}for(const O of p){const F=k.get(O.id);F!=null&&(O.width=F),To(O)}}}}}a(Ao,"writeBackToLayoutData");var cr="[EdgeLabelNodes]";function Ro(t){const e=[],n=[],o=new Map;for(const l of t.nodes)o.set(l.id,l);for(const l of t.edges){if(!l.label||l.label.length===0||l.isLayoutOnly||l.labelNodeId)continue;const f=l.start?o.get(l.start):void 0,u=l.end?o.get(l.end):void 0;if(!f||!u){yn.warn(cr,`Edge ${l.id} has missing source or target node`);continue}const g=`edge-label-${l.start}-${l.end}-${l.id}`,p=f.parentId!==u.parentId?u.parentId:f.parentId,v={id:g,label:l.label,edgeStart:l.start??"",edgeEnd:l.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:p,isGroup:!1,labelStyle:Array.isArray(l.labelStyle)?l.labelStyle[0]:l.labelStyle??"",...f.dir?{dir:f.dir}:{}};e.push(v),l.labelNodeId=g,l.label=void 0,l.text=void 0;const d={id:`${l.id}-to-label`,start:l.start,end:g,type:"normal",isLayoutOnly:!0},h={id:`${l.id}-from-label`,start:g,end:l.end,type:"normal",isLayoutOnly:!0};n.push(d,h)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}a(Ro,"createEdgeLabelNodes");var _t=.001;function Kn(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:we(e,n,o,s)}:void 0}a(Kn,"measuredNodeRect");function qn(t){if(t.isGroup)return;const e=Kn(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}a(qn,"nodeBoundsInfoFor");function oe(t,e,n=_t){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}a(oe,"samePoint");function ft(t,e,n=_t){return Math.abs(t.x-e.x)<n}a(ft,"sameX");function ht(t,e,n=_t){return Math.abs(t.y-e.y)<n}a(ht,"sameY");function wt(t,e,n=_t){return ht(t,e,n)&&Math.abs(t.x-e.x)>n}a(wt,"isHorizontalSegment");function Et(t,e,n=_t){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}a(Et,"isVerticalSegment");function $t(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}a($t,"overlapLength");function ie(t,e,n=_t){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?$t(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?$t(t.a.y,t.b.y,e.a.y,e.b.y):0}a(ie,"sameAxisSegmentOverlapLength");function Ee(t,e=_t){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],l=wt(s,r,e),f=Et(s,r,e);(l||f)&&n.push({index:o,a:s,b:r,horizontal:l,vertical:f})}return n}a(Ee,"orthogonalSegmentsForPoints");function Qt(t,e=_t){const n=Ee(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}a(Qt,"countOrthogonalBends");function mt(t,e=_t){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}a(mt,"dedupeConsecutivePoints");function Zn(t,e=_t){if(!t||t.length!==4)return;const[n,o,s,r]=t;return wt(n,o,e)&&Et(o,s,e)&&wt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Et(n,o,e)&&wt(o,s,e)&&Et(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}a(Zn,"classifyThreeSegmentRoute");function Je(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),l=Math.min(t.y,e.y),f=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&f>n.top-o&&l<n.bottom+o}a(Je,"segmentBoundsOverlapRect");function Jn(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}a(Jn,"pointInsideRect");function No(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}a(No,"rectContainsRect");function ze(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}a(ze,"rectsOverlap");function bn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}a(bn,"inflateRect");function we(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}a(we,"rectFromCenterSize");function qt(t){return Kn(t)?.rect}a(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}a(Ie,"portForRectSide");function Qn(t,e,n,o,s,r=_t){const l=e==="left"||e==="right",f=o==="left"||o==="right";if(l&&f){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(ht(t,n,r))return[t,n];const p=(t.x+n.x)/2;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const p=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:p,y:t.y},{x:p,y:n.y},n]}return}if(!l&&!f){if(e===o){if(ft(t,n,r))return;const v=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:v},{x:n.x,y:v},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(ft(t,n,r))return[t,n];const p=(t.y+n.y)/2;return[t,{x:t.x,y:p},{x:n.x,y:p},n]}if(l&&!f){const b=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,p=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return b&&p?[t,{x:n.x,y:t.y},n]:void 0}const u=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,g=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return u&&g?[t,{x:t.x,y:n.y},n]:void 0}a(Qn,"buildOrthogonalPortPath");function to(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}a(to,"buildSameSideTrackPath");function Qe(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=qn(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}a(Qe,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=qn(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}a(me,"collectNodeRectEntries");function Oo(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,l=o.width??0,f=o.height??0;n.push({nodeId:o.id,...we(s,r,l,f)})}return n}a(Oo,"collectLayoutNodeRects");function eo(t,e,n=_t){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),l=e.get(s);if(!(!r||!l))return{srcId:o,dstId:s,srcInfo:r,dstInfo:l,collinearX:Math.abs(r.cx-l.cx)<n,collinearY:Math.abs(r.cy-l.cy)<n}}a(eo,"getNodePairGeometry");function At(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&Je(t,e,r.rect,-s))return!0;return!1}a(At,"segmentHitsAnyRect");function no(t,e,n,o,s=_t,r=1e-6){const l=ht(t,e,s),f=ft(t,e,s),u=ht(n,o,s),g=ft(n,o,s);if(l&&u||f&&g||!(l||f)||!(u||g))return!1;const b=l?{a:t,b:e}:{a:n,b:o},p=f?{a:t,b:e}:{a:n,b:o},v=b.a.y,d=Math.min(b.a.x,b.b.x),h=Math.max(b.a.x,b.b.x),i=p.a.x,y=Math.min(p.a.y,p.b.y),L=Math.max(p.a.y,p.b.y);if(i<d||i>h||v<y||v>L)return!1;const I=Math.abs(i-b.a.x)<r&&Math.abs(v-b.a.y)<r||Math.abs(i-b.b.x)<r&&Math.abs(v-b.b.y)<r,E=Math.abs(i-p.a.x)<r&&Math.abs(v-p.a.y)<r||Math.abs(i-p.b.x)<r&&Math.abs(v-p.b.y)<r;return!(I&&E)}a(no,"orthogonalSegmentsCross");function Bo(t,e,n,o,s=_t){const r=ht(t,e,s),l=ft(t,e,s),f=ht(n,o,s),u=ft(n,o,s);return l&&u&&ft(t,n,s)?$t(t.y,e.y,n.y,o.y)>s:r&&f&&ht(t,n,s)?$t(t.x,e.x,n.x,o.x)>s:!1}a(Bo,"sameAxisSegmentsOverlap");function $e(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(const l of n){if(l===o||l.isLayoutOnly)continue;const f=l.points;if(!(!f||f.length<2))for(let u=0;u<f.length-1;u++){const g=f[u],b=f[u+1];if(!(r&&oe(g,b,s))&&(no(t,e,g,b,s)||Bo(t,e,g,b,s)))return!0}}return!1}a($e,"segmentConflictsWithAnyEdge");function ae(t,e,n,o,s=_t){const r=ht(t,e,s),l=ft(t,e,s),f=ht(n,o,s),u=ft(n,o,s);if(!(r&&u||l&&f))return!1;const g=r?{a:t,b:e}:{a:n,b:o},b=r?{a:n,b:o}:{a:t,b:e},p=g.a.y,v=Math.min(g.a.x,g.b.x),d=Math.max(g.a.x,g.b.x),h=b.a.x,i=Math.min(b.a.y,b.b.y),y=Math.max(b.a.y,b.b.y);return h>v+s&&h<d-s&&p>i+s&&p<y-s}a(ae,"orthogonalSegmentsStrictlyCross");function In(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}a(In,"strictlyBetween");function Po(t,e,n){return ft(t,e)&&ft(e,n)?In(e.y,t.y,n.y):ht(t,e)&&ht(e,n)?In(e.x,t.x,n.x):!1}a(Po,"isCollinearIntermediate");function ko(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],l=o+1<t.length?t[o+1]:void 0;if(s&&l){if(oe(s,l)){o++,e=!0;continue}if(Po(s,r,l)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}a(ko,"simplifyPolylineOnce");function Ve(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!ft(s,r)&&!ht(s,r)){const l=e.length>=2?e[e.length-2]:void 0,u=(l?ft(l,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(u)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}a(Ve,"orthogonalizePolyline");function ce(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ko(e);if(e=o.points,!o.changed)break}return e}a(ce,"simplifyPolyline");var nt=.001,ar=.5,Mo=4;function oo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?qt(s):void 0,dstRect:r?qt(r):void 0}}a(oo,"endpointContextFor");function Fo(t,e,n){if(ht(t,e,nt))return{x:t.x<n.left?n.left:n.right,y:t.y};if(ft(t,e,nt)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}a(Fo,"segmentEnterPoint");function Mn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&Jn(t[s],e,ar);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const l=Fo(t[s],t[r],e);return n?[l,...t.slice(s)]:[...t.slice(0,s+1),l]}a(Mn,"clipEndpoint");function _o(t,e){for(const n of t){const o=oo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Mn(s,o.srcRect,!0)),o.dstRect&&(s=Mn(s,o.dstRect,!1)),s=ce(Ve(s)),s=so(s,o.srcRect,o.dstRect),o.edge.points=ce(Ve(s))}}a(_o,"clipEdgeEndpointsToNodeBoundaries");function Sn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.y<n.top-nt||e.y>n.bottom+nt)return e;if(o){if(t.x<n.left-nt)return{x:n.left,y:t.y};if(t.x>n.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.x<n.left-nt||e.x>n.right+nt)return e;if(o){if(t.y<n.top-nt)return{x:t.x,y:n.top};if(t.y>n.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}a(Sn,"snapEndpointToBoundary");function je(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!oe(r,o,nt))return r}return t[e+n]}a(je,"firstDistinctAdjacent");function Ue(t,e){const n=t+Mo,o=e-Mo;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}a(Ue,"cornerClearanceRange");function Cn(t,e,n){const{lo:o,hi:s}=Ue(e,n);return Math.min(s,Math.max(o,t))}a(Cn,"clampToCornerClearance");function Ho(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}a(Ho,"intersectRanges");function vn(t,e){return e==="left"||e==="right"?Ue(t.top,t.bottom):Ue(t.left,t.right)}a(vn,"clearanceRangeForSide");function We(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)<nt)return"left";if(Math.abs(t.x-n.right)<nt)return"right"}if(ft(t,e,nt)&&s){if(Math.abs(t.y-n.top)<nt)return"top";if(Math.abs(t.y-n.bottom)<nt)return"bottom"}}a(We,"terminalSideForSegment");function Re(t){return t==="left"||t==="right"}a(Re,"isHorizontalSide");function Do(t,e,n,o,s){const r=[],l=n?We(t,e,n):void 0,f=o?We(e,t,o):void 0;return n&&l&&Re(l)===s&&r.push(vn(n,l)),o&&f&&Re(f)===s&&r.push(vn(o,f)),r.length>0?Ho(r):void 0}a(Do,"straightClearanceRange");function Ln(t,e,n,o,s){const r=Do(t,e,n,o,s);if(!r)return;const l=s?t.y:t.x,f=Math.min(r.hi,Math.max(r.lo,l));if(!(Math.abs(f-l)<nt))return s?[{x:t.x,y:f},{x:e.x,y:f}]:[{x:f,y:t.y},{x:f,y:e.y}]}a(Ln,"clearStraightEndpointCornerAxis");function so(t,e,n){if(t.length!==2)return t;const[o,s]=t;return ht(o,s,nt)?Ln(o,s,e,n,!0)??t:ft(o,s,nt)?Ln(o,s,e,n,!1)??t:t}a(so,"clearStraightEndpointCornerConnections");function Xo(t,e,n){return Re(n)?{x:t.x,y:Cn(t.y,e.top,e.bottom)}:{x:Cn(t.x,e.left,e.right),y:t.y}}a(Xo,"cornerClearedEndpoint");function Yo(t,e,n,o,s,r){const l=t.map(f=>({...f}));for(let f=e;f>=0&&f<t.length;f+=n){const u=t[f];if(r&&!ht(u,o,nt)||!r&&!ft(u,o,nt))break;r?l[f].y=s.y:l[f].x=s.x}return l}a(Yo,"moveCollinearEndpointRun");function Tn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],l=je(t,o,s);if(!l)return t;const f=We(r,l,e);if(!f)return t;const u=Re(f),g=Xo(r,e,f);return oe(r,g,nt)?t:Yo(t,o,s,r,g,u)}a(Tn,"clearEndpointCornerConnection");function wn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)<nt&&Math.abs(e.y-n.top)<nt&&o)return"top";if(Math.abs(t.y-n.bottom)<nt&&Math.abs(e.y-n.bottom)<nt&&o)return"bottom";if(Math.abs(t.x-n.left)<nt&&Math.abs(e.x-n.left)<nt&&s)return"left";if(Math.abs(t.x-n.right)<nt&&Math.abs(e.x-n.right)<nt&&s)return"right"}a(wn,"borderSideForSegment");function En(t,e,n,o){switch(t){case"top":return ft(e,n,nt)&&n.y<o.top-nt;case"bottom":return ft(e,n,nt)&&n.y>o.bottom+nt;case"left":return ht(e,n,nt)&&n.x<o.left-nt;case"right":return ht(e,n,nt)&&n.x>o.right+nt}}a(En,"leavesOutward");function An(t,e,n){if(t.length<3)return t;if(n){const r=wn(t[0],t[1],e);return r&&En(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=wn(t[o-1],t[o],e);return s&&En(s,t[o-1],t[o-2],e)?t.slice(0,o):t}a(An,"collapseOwnBorderStub");function Go(t,e,n){let o=t;if(e){const r=je(o,0,1);if(r){const l=Sn(r,o[0],e);l!==o[0]&&(o=[l,...o.slice(1)])}o=An(o,e,!0)}if(n){const r=o.length-1,l=je(o,r,-1);if(l){const f=Sn(l,o[r],n,!0);f!==o[r]&&(o=[...o.slice(0,r),f])}o=An(o,n,!1)}const s=so(o,e,n);return s!==o||o.length===2?s:(e&&(o=Tn(o,e,!0)),n&&(o=Tn(o,n,!1)),o)}a(Go,"snapAndCollapseEndpoints");function Rn(t,e){for(const n of t){const o=oo(n,e,2);if(!o)continue;const s=mt(o.points,nt),r=Go(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const l=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=l}}a(Rn,"prepareEdgeEndpointsForRenderer");function ro(t){return new Map(t.map(e=>[e.id,e]))}a(ro,"buildNodeMap");function zo(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}a(zo,"resolveTopLevelGroupId");function Nn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}a(Nn,"groupDepth");function io(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const l=r.x,f=r.y;if(typeof l!="number"||typeof f!="number")continue;const u=r.width??0,g=r.height??0;e=Math.min(e,l-u/2),n=Math.max(n,l+u/2),o=Math.min(o,f-g/2),s=Math.max(s,f+g/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}a(io,"boundsForChildren");function $o(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}a($o,"applyGroupBounds");function Vo(t){const e=ro(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Nn(s,e)-Nn(o,e));for(const o of n){const s=t.filter(l=>l.parentId===o.id),r=io(s);r&&$o(o,r)}}a(Vo,"recomputeNestedGroupBounds");function Ke(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(u=>!u.isGroup);let r=1/0,l=-1/0;for(const u of s){const g=u[e];typeof g=="number"&&(r=Math.min(r,g),l=Math.max(l,g))}if(!Number.isFinite(r)||!Number.isFinite(l))return!1;const f=a(u=>r+l-u,"mirror");for(const u of n){const g=u[e];typeof g=="number"&&(u[e]=f(g));const b=u.groupTitleRect;b&&(u.groupTitleRect=e==="x"?{...b,left:f(b.right),right:f(b.left)}:{...b,top:f(b.bottom),bottom:f(b.top)})}for(const u of o)for(const g of u.points??[])g[e]=f(g[e]);return!0}a(Ke,"mirrorAxis");function jo(t){return(t.nodes??[]).some(n=>!n.isGroup)?Ke(t,"y"):!0}a(jo,"applyBtDirectionTransform");function Uo(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(B=>!B.isGroup);let r=1/0,l=1/0;for(const B of s){const G=B.x??0,j=B.y??0;G<r&&(r=G),j<l&&(l=j)}if(!Number.isFinite(r)||!Number.isFinite(l))return!1;const f=36;let u=0,g=0;for(const B of s)u+=B.width??0,g+=B.height??0;const b=u/s.length,p=g/s.length,v=p>0?Math.max(1,b/p):1;for(const B of s){const G=B.x??0,Z=((B.y??0)-l)*v+f,dt=G-r;B.x=Z,B.y=dt}for(const B of o)if(B.points)for(const G of B.points){const j=G.x,dt=(G.y-l)*v+f,pt=j-r;G.x=dt,G.y=pt}Vo(n);const d=n.filter(B=>B.isGroup&&!B.parentId);if(d.length===0)return e==="RL"&&Ke(t,"x"),!0;const h=ro(n),i=new Map;for(const B of n){if(B.isGroup)continue;const G=zo(B,h);if(!G)continue;const j=i.get(G)??[];j.push(B),i.set(G,j)}let y=0;for(const B of d){const G=B.padding??0;G>y&&(y=G)}const L=[];let I=1/0,E=-1/0;for(const B of d){const G=i.get(B.id)??[],j=io(G);j&&(I=Math.min(I,j.minX),E=Math.max(E,j.maxX),L.push({lane:B,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(I===1/0||E===-1/0)return!0;const T=Math.max(0,E-I),m=Math.max(y,10),M=T+2*m,A=f+M,O=(I+E)/2-M/2-f,F=O+A/2,D=Math.max(y,f);L.sort((B,G)=>B.centerY-G.centerY);for(let B=0;B<L.length;B++){const G=L[B];let j,Z;if(B===0?j=G.contentTop-D:j=(L[B-1].contentBottom+G.contentTop)/2,B===L.length-1)Z=G.contentBottom+D;else{const kt=L[B+1];Z=(G.contentBottom+kt.contentTop)/2}const dt=Math.max(0,Z-j),pt=(j+Z)/2;G.lane.x=F,G.lane.y=pt,G.lane.width=A,G.lane.height=dt,G.lane.swimlaneContentTop=G.contentTop,G.lane.groupTitleRect={left:O,right:O+f,top:j,bottom:Z}}return e==="RL"&&Ke(t,"x"),!0}a(Uo,"applyLrDirectionTransform");var se=1e-6,lr=8,He=lr,fr=[0,He,-He,2*He,-2*He];function Wo(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const l=Zn(mt(r,se),se);if(!l)continue;const{p3:f}=l,u=l.kind==="HVH",g=eo(s,n,se);if(!g)continue;const{srcId:b,dstId:p,srcInfo:v,dstInfo:d,collinearX:h,collinearY:i}=g;if(h||i)continue;let y;const L=v.rect;for(const I of fr){let E,T,m;if(u){const F=d.cy>v.cy?L.bottom:L.top,D=v.cx+I;if(D<=L.left+se||D>=L.right-se)continue;E={x:D,y:F},T={x:D,y:f.y},m={x:f.x,y:f.y}}else{const F=d.cx>v.cx?L.right:L.left,D=v.cy+I;if(D<=L.top+se||D>=L.bottom-se)continue;E={x:F,y:D},T={x:f.x,y:D},m={x:f.x,y:f.y}}const M=oe(E,T,se),A=oe(T,m,se);if(M&&A||!M&&At(E,T,o,[b],1)||!A&&At(T,m,o,[p],1))continue;const R=!M&&$e(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!A&&$e(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){M?y=[T,m]:A?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}a(Wo,"portSwapToLShape");function Ko(t,e){const{realNodeRects:r,labelNodeRects:l}=me(e.values());for(const f of t){if(f.isLayoutOnly)continue;const u=f.points;if(!u||u.length<4)continue;const g=mt(u,.001);if(g.length<4)continue;const b=g.length-1,p=g[b],v=g[b-1],d=g[b-2],h=p.x-v.x,i=p.y-v.y,y=Math.hypot(h,i);if(y>=10||y<.001)continue;const L=v.x-d.x,I=v.y-d.y;if(Math.hypot(L,I)<.001)continue;const T=wt(v,p,.001),m=Et(v,p,.001),M=wt(d,v,.001),A=Et(d,v,.001);if(!(T&&A||m&&M))continue;const R=f.end,k=f.start,O=R?e.get(R):void 0;if(!O)continue;const F=O.x??0,D=O.y??0,B=qt(O);if(!B)continue;let G,j;if(A){const W=I<0;G={x:F,y:d.y},j={x:F,y:W?B.bottom:B.top}}else{const W=L>0;G={x:d.x,y:D},j={x:W?B.right:B.left,y:D}}if(At(G,j,r,R?[R]:[],-2)||At(G,j,l,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&Jn(G,et,2))continue}const Z=a((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W<g.length-1;W++)dt.add(Z(g[W],g[W+1]));const pt=a((W,et)=>{for(const at of t){if(at===f||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt<gt.length-1;xt++){const vt=gt[xt],Vt=gt[xt+1];if(!dt.has(Z(vt,Vt))&&ae(W,et,vt,Vt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(pt(G,j))continue;if(b-3>=0){const W=g[b-3],et=[k,R].filter(at=>!!at);if(At(W,G,r,et,-2)||pt(W,G))continue}const Bt=[...g.slice(0,b-2),G,j];f.points=Bt;const Q=f.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt<Bt.length-1;Vt++){const jt=Bt[Vt],Ut=Bt[Vt+1],te=Math.hypot(Ut.x-jt.x,Ut.y-jt.y),Me=ht(jt,Ut,.001),fe=ft(jt,Ut,.001);(Me&&te>=et+2||fe&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}a(Ko,"collapseShortTerminalStub");var J=.001,Ft=8,it=Ee,gn=a((t,e)=>ft(t,e,J)||ht(t,e,J),"orthogonallyAligned");function qo(t,e){const s=a((d,h)=>{const i=d.x??0,y=d.y??0,L=h.x-i,I=h.y-y;let E=(d.width??0)/2,T=(d.height??0)/2;return Math.abs(I)*E>Math.abs(L)*T?(I<0&&(T=-T),{x:i+(I===0?0:T*L/I),y:y+T}):(L<0&&(E=-E),{x:i+E,y:y+(L===0?0:E*I/L)})},"rectIntersect"),r=a((d,h)=>{const i=mt(d.points??[]);if(i.length<2)return;const y=h?d.start:d.end,L=y?e.get(y):void 0,I=L?qt(L):void 0;if(!L||!y||!I)return;const E=h?i[0]:i[i.length-1],T=h?i[1]:i[i.length-2],m=s(L,E);let M=E;if(gn(T,m)&&(M=T),ft(m,M,J))return{edge:d,edgeId:String(d.id??""),nodeId:y,atStart:h,orientation:"V",coord:m.x,min:Math.min(m.y,M.y),max:Math.max(m.y,M.y),boundary:m,railEnd:M,rect:I};if(ht(m,M,J))return{edge:d,edgeId:String(d.id??""),nodeId:y,atStart:h,orientation:"H",coord:m.y,min:Math.min(m.x,M.x),max:Math.max(m.x,M.x),boundary:m,railEnd:M,rect:I}},"terminalLaneFor"),l=a((d,h)=>Math.max(0,Math.min(d.max,h.max)-Math.max(d.min,h.min)),"projectedOverlapLength"),f=a((d,h)=>d.nodeId!==h.nodeId||d.orientation!==h.orientation?!1:d.orientation==="H"?(Math.abs(d.boundary.x-d.rect.left)<1||Math.abs(d.boundary.x-d.rect.right)<1)&&ft(d.boundary,h.boundary,1):(Math.abs(d.boundary.y-d.rect.top)<1||Math.abs(d.boundary.y-d.rect.bottom)<1)&&ht(d.boundary,h.boundary,1),"sameTerminalFace"),u=a((d,h)=>d.nodeId!==h.nodeId||d.orientation!==h.orientation?!1:l(d,h)>=Ft&&Math.abs(d.coord-h.coord)<.5,"exactTerminalLaneConflict"),g=a((d,h)=>{if(d.nodeId!==h.nodeId||d.orientation!==h.orientation||d.orientation!=="H"||d.atStart===h.atStart)return!1;const i=l(d,h);if(i<Ft)return!1;const y=d.rect.bottom-d.rect.top;return i<y||i>2*y?!1:f(d,h)&&Math.abs(d.coord-h.coord)<16},"nearTerminalLaneConflict"),b=a((d,h)=>{const i=mt(d.edge.points??[]);if(i.length<2)return;const y=d.orientation==="V"?{x:d.boundary.x+h,y:d.boundary.y}:{x:d.boundary.x,y:d.boundary.y+h},L=d.orientation==="V"?{x:d.railEnd.x+h,y:d.railEnd.y}:{x:d.railEnd.x,y:d.railEnd.y+h};if(!a(()=>Math.abs(d.boundary.y-d.rect.top)<1||Math.abs(d.boundary.y-d.rect.bottom)<1?ht(y,d.boundary,J)&&y.x>=d.rect.left+1&&y.x<=d.rect.right-1:Math.abs(d.boundary.x-d.rect.left)<1||Math.abs(d.boundary.x-d.rect.right)<1?ft(y,d.boundary,J)&&y.y>=d.rect.top+1&&y.y<=d.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(d.atStart){const M=i.length>1&&oe(i[1],d.railEnd,J),A=i.slice(M?2:1),R=A[0];return R&&!gn(R,L)?void 0:[y,L,...A]}const E=i.length>1&&oe(i[i.length-2],d.railEnd,J),T=i.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!gn(m,L)))return[...T,L,y]},"shiftedCandidate"),p=a(d=>{const h=d.edge,i=mt(h.points??[]);if(i.length!==2)return!1;const y=h.start,L=h.end,I=y?e.get(y):void 0,E=L?e.get(L):void 0;if(!I||!E)return!1;const T=I.x??0,m=I.y??0,M=E.x??0,A=E.y??0,[R,k]=i;return ht(R,k,J)&&Math.abs(m-A)<1&&Math.abs(T-M)>1||ft(R,k,J)&&Math.abs(T-M)<1&&Math.abs(m-A)>1},"laneIsStraightCollinearConnector"),v=[-7,7,-14,14,-21,21];for(let d=0;d<8;d++){const h=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let i=!1;for(let y=0;y<h.length&&!i;y++)for(let L=y+1;L<h.length&&!i;L++){const I=h[y],E=h[L];if(I.edge===E.edge||!(u(I,E)||g(I,E)))continue;const T=!u(I,E),m=[I,E].sort((M,A)=>{const R=p(M),k=p(A);return R!==k?Number(R)-Number(k):+!A.atStart-+!M.atStart});for(const M of m){for(const A of v){const R=b(M,A);if(!R)continue;const k=r({...M.edge,points:R},M.atStart);if(!(!k||h.some(O=>O.edge!==M.edge&&(u(k,O)||T&&g(k,O))))){M.edge.points=R,i=!0;break}}if(i)break}}if(!i)return}}a(qo,"separateSharedRenderedTerminalLanes");function Zo(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=a((f,u)=>{const g=f.start,b=f.end,p=it(u);if(p.length!==u.length-1)return!1;const v=[g,b].filter(d=>!!d);for(const d of p)if(At(d.a,d.b,o,v,-2)||At(d.a,d.b,s,[],-2))return!1;for(const d of t){if(d===f||d.isLayoutOnly)continue;const h=d.points;if(!(!h||h.length<2)){for(const i of p)for(const y of it(mt(h)))if(ie(i,y,.5)>=Ft||ae(i.a,i.b,y.a,y.b,J))return!1}}return!0},"candidateIsSafe"),l=a((f,u)=>{if(u+4>=f.length)return;const g=f[u],b=f[u+1],p=f[u+2],v=f[u+3],d=f[u+4],h=wt(g,b)&&Et(b,p)&&wt(p,v)&&Et(v,d)&&ft(g,v,J)&&ft(g,d,J)&&ft(b,p,J)&&(b.x-g.x)*(v.x-p.x)<0,i=Et(g,b)&&wt(b,p)&&Et(p,v)&&wt(v,d)&&ht(g,v,J)&&ht(g,d,J)&&ht(b,p,J)&&(b.y-g.y)*(v.y-p.y)<0;if(h||i)return mt([...f.slice(0,u+1),d,...f.slice(u+5)]);if(u+5>=f.length)return;const y=f[u+5],L=Et(g,b)&&wt(b,p)&&Et(p,v)&&wt(v,d)&&Et(d,y)&&ft(g,d,J)&&ft(g,y,J)&&ft(p,v,J)&&(p.x-b.x)*(d.x-v.x)<0,I=wt(g,b)&&Et(b,p)&&wt(p,v)&&Et(v,d)&&wt(d,y)&&ht(g,d,J)&&ht(g,y,J)&&ht(p,v,J)&&(p.y-b.y)*(d.y-v.y)<0;if(!(!L&&!I))return mt([...f.slice(0,u+1),y,...f.slice(u+6)])},"withoutDogleg");for(let f=0;f<8;f++){let u=!1;for(const g of t){if(g.isLayoutOnly)continue;const b=mt(g.points??[]);for(let p=0;p<=b.length-5;p++){const v=l(b,p);if(!(!v||!r(g,v))){g.points=v,u=!0;break}}if(u)break}if(!u)return}}a(Zo,"collapseRedundantRectangularDoglegs");function On(t,e){const{realNodeRects:r,labelNodeRects:l}=me(e.values()),f=t.filter(h=>!h.isLayoutOnly),u=a((h,i,y)=>mt(h===i?y??[]:h.points??[]),"pointsFor"),g=a((h,i)=>{let y=0;for(let L=0;L<f.length;L++){const I=it(u(f[L],h,i));for(let E=L+1;E<f.length;E++){const T=it(u(f[E],h,i));for(const m of I)for(const M of T)ae(m.a,m.b,M.a,M.b,J)&&y++}}return y},"strictCrossingCount"),b=a(h=>{const i=it(h);if(i.length!==3)return;const y=i[1];if(!(i[0].horizontal===y.horizontal||i[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),p=a((h,i)=>{const y=[h.start,h.end].filter(L=>!!L);return r.filter(L=>{if(y.includes(L.id))return!1;const I=L.rect;return i.horizontal?$t(i.a.x,i.b.x,I.left,I.right)>=Ft&&i.a.y>=I.top-2&&i.a.y<=I.bottom+2:$t(i.a.y,i.b.y,I.top,I.bottom)>=Ft&&i.a.x>=I.left-2&&i.a.x<=I.right+2})},"blockingRectsFor"),v=a((h,i,y)=>{const L=h.map(E=>({...E}));if(i.horizontal)L[i.index].y=y,L[i.index+1].y=y;else if(i.vertical)L[i.index].x=y,L[i.index+1].x=y;else return;const I=ce(mt(L));return it(I).length===I.length-1?I:void 0},"candidateByMovingRail"),d=a((h,i,y)=>{const L=[h.start,h.end].filter(E=>!!E),I=it(i);if(I.length!==i.length-1)return!1;for(const E of I)if(At(E.a,E.b,r,L,-2)||At(E.a,E.b,l,[],-2))return!1;for(const E of f)if(E!==h){for(const T of I)for(const m of it(u(E)))if(ie(T,m,.5)>=Ft)return!1}return g(h,i)<=y},"candidateIsSafe");for(let h=0;h<8;h++){const i=g();let y=!1;for(const L of f){const I=u(L),E=b(I);if(!E)continue;const T=p(L,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(M=>M.rect.top))-20,Math.max(...T.map(M=>M.rect.bottom))+20]:[Math.min(...T.map(M=>M.rect.left))-20,Math.max(...T.map(M=>M.rect.right))+20];for(const M of m){const A=v(I,E.segment,M);if(!(!A||!d(L,A,i))){L.points=A,y=!0;break}}if(y)break}if(!y)return}}a(On,"liftObstacleHuggingSameSideRails");function Bn(t,e){const o=a(u=>{const g=u.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=a(u=>{if(!u.isGroup||u.parentId)return;const g=u.direction,b=typeof g=="string"?g.toUpperCase():"";if(b==="LR"||b==="RL"||b==="BT")return;const p=o(u),v=u.y,d=u.height;if(!p||typeof v!="number"||typeof d!="number"||!Number.isFinite(v)||!Number.isFinite(d)||d<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(i<=0||h<i))return{node:u,rect:p}},"topLaneTitleFor"),r=a((u,g)=>{if(!u.horizontal)return!1;const b=u.a.y;return b<=g.top+J||b>=g.bottom-J?!1:$t(u.a.x,u.b.x,g.left,g.right)>=Ft},"horizontalSegmentIntersectsTitle"),l=[...e.values()].map(s).filter(u=>!!u);if(l.length===0)return;let f=0;for(const u of t){if(u.isLayoutOnly)continue;const g=mt(u.points??[]);for(const b of it(g))for(const p of l)r(b,p.rect)&&(f=Math.max(f,p.rect.bottom-b.a.y+4))}if(!(f<=J))for(const u of l){const g=u.node.y,b=u.node.height;typeof g!="number"||typeof b!="number"||!Number.isFinite(g)||!Number.isFinite(b)||b<=0||(u.node.y=g-f/2,u.node.height=b+f,u.node.groupTitleRect={...u.rect,top:u.rect.top-f,bottom:u.rect.bottom-f})}}a(Bn,"liftTopLaneTitleBandsAboveRails");function Pn(t,e){const o=a(g=>{const b=g.groupTitleRect;if(!(!b||typeof b.left!="number"||typeof b.right!="number"||typeof b.top!="number"||typeof b.bottom!="number"||!Number.isFinite(b.left)||!Number.isFinite(b.right)||!Number.isFinite(b.top)||!Number.isFinite(b.bottom)||b.right<=b.left||b.bottom<=b.top))return{left:b.left,right:b.right,top:b.top,bottom:b.bottom}},"validTitleRect"),s=a(g=>{if(!g.isGroup||g.parentId||g.direction!=="LR")return;const p=o(g),v=g.x,d=g.width;if(!p||typeof v!="number"||typeof d!="number"||!Number.isFinite(v)||!Number.isFinite(d)||d<=0)return;const h=p.right-p.left,i=p.bottom-p.top;if(!(h<=0||i<h))return{node:g,rect:p}},"leftLaneTitleFor"),r=a((g,b)=>{if(!g.vertical)return!1;const p=g.a.x;return p<=b.left+J||p>=b.right-J?!1:$t(g.a.y,g.b.y,b.top,b.bottom)>=Ft},"verticalSegmentIntersectsTitle"),l=a((g,b)=>{if(!g.horizontal)return!1;const p=g.a.y;return p<=b.top+J||p>=b.bottom-J?!1:$t(g.a.x,g.b.x,b.left,b.right)>=Ft},"horizontalSegmentIntersectsTitle"),f=[...e.values()].map(s).filter(g=>!!g);if(f.length===0)return;let u=0;for(const g of t){if(g.isLayoutOnly)continue;const b=mt(g.points??[]);for(const p of it(b))for(const v of f)if(r(p,v.rect))u=Math.max(u,v.rect.right-p.a.x+4);else if(l(p,v.rect)){const d=Math.min(p.a.x,p.b.x);u=Math.max(u,v.rect.right-d+4)}}if(!(u<=J))for(const g of f){const b=g.node.x,p=g.node.width;typeof b!="number"||typeof p!="number"||!Number.isFinite(b)||!Number.isFinite(p)||p<=0||(g.node.x=b-u/2,g.node.width=p+u,g.node.groupTitleRect={...g.rect,left:g.rect.left-u,right:g.rect.right-u})}}a(Pn,"shiftLeftLaneTitleBandsLeftOfRails");function Jo(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(h=>!h.isLayoutOnly),r=a((h,i=new Map)=>mt(i.get(h)??h.points??[]),"replacementPointsFor"),l=a((h=new Map)=>{let i=0;for(let y=0;y<s.length;y++){const L=it(r(s[y],h));for(let I=y+1;I<s.length;I++){const E=it(r(s[I],h));for(const T of L)for(const m of E)ae(T.a,T.b,m.a,m.b,J)&&i++}}return i},"crossingCount"),f=a((h=new Map)=>s.reduce((i,y)=>i+Qt(r(y,h)),0),"totalBends"),u=a(h=>{const i=r(h);if(i.length<4)return;const y=i[i.length-2],L=i[i.length-1];if(!(!wt(y,L,J)&&!Et(y,L,J)))return{tailStart:y,terminal:L}},"terminalTailFor"),g=a((h,i)=>{const y=r(h);if(y.length<3)return;const L=y[0],I=y[1];let E;if(wt(L,I,J))E={x:I.x,y:i.tailStart.y};else if(Et(L,I,J))E={x:i.tailStart.x,y:I.y};else return;const T=ce(mt([L,I,E,i.tailStart,i.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),b=a((h,i)=>{const y=[h.start,h.end].filter(L=>!!L);for(const L of it(i))if(At(L.a,L.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),p=a((h,i,y)=>{for(const L of s)if(L!==h){for(const I of it(i))for(const E of it(r(L,y)))if(ie(I,E,.5)>=Ft)return!0}return!1},"pathHasSharedTrack"),v=a((h,i,y)=>!b(h,i)&&!p(h,i,y),"candidateIsSafe"),d=a(()=>{const h=new Map;for(const i of s){const y=i.end;if(!y||!e.has(y)||r(i).length<4)continue;const I=h.get(y)??[];I.push(i),h.set(y,I)}return h},"edgesByDestination");for(let h=0;h<4;h++){const i=l();if(i===0)return;const y=f();let L,I=i,E=y;for(const T of d().values())for(let m=0;m<T.length;m++)for(let M=m+1;M<T.length;M++){const A=T[m],R=T[M],k=u(A),O=u(R);if(!k||!O)continue;const F=g(A,O),D=g(R,k);if(!F||!D)continue;const B=new Map([[A,F],[R,D]]);if(!v(A,F,B)||!v(R,D,B))continue;const G=l(B),j=f(B);G>=i||G>I||G===I&&j>=E||(L=B,I=G,E=j)}if(!L)return;for(const[T,m]of L)T.points=m}}a(Jo,"swapDestinationTerminalTailsToReduceCrossings");function Qo(t,e){const{realNodeRects:r,labelNodeRects:l}=me(e.values()),f=t.filter(T=>!T.isLayoutOnly),u=a((T,m=new Map)=>mt(m.get(T)??T.points??[]),"replacementPointsFor"),g=a((T=new Map)=>{let m=0;for(let M=0;M<f.length;M++){const A=it(u(f[M],T));for(let R=M+1;R<f.length;R++){const k=it(u(f[R],T));for(const O of A)for(const F of k)ae(O.a,O.b,F.a,F.b,J)&&m++}}return m},"strictCrossingCount"),b=a((T=new Map)=>f.reduce((m,M)=>m+Qt(u(M,T)),0),"totalBends"),p=a(T=>{const m=T.start,M=T.end,A=m?e.get(m):void 0,R=M?e.get(M):void 0,k=A?qt(A):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),v=a((T,m,M)=>{if(M.index<=0||M.index+1>=m.length-1)return;const A=p(T);if(A){if(M.vertical){const R=M.a.x,k=Math.min(A.src.left,A.dst.left),O=Math.max(A.src.right,A.dst.right),F=R<k-J?"left":R>O+J?"right":void 0;return F?{edge:T,points:m,segmentIndex:M.index,axis:"vertical",side:F,coord:R,min:Math.min(M.a.y,M.b.y),max:Math.max(M.a.y,M.b.y)}:void 0}if(M.horizontal){const R=M.a.y,k=Math.min(A.src.top,A.dst.top),O=Math.max(A.src.bottom,A.dst.bottom),F=R<k-J?"top":R>O+J?"bottom":void 0;return F?{edge:T,points:m,segmentIndex:M.index,axis:"horizontal",side:F,coord:R,min:Math.min(M.a.x,M.b.x),max:Math.max(M.a.x,M.b.x)}:void 0}}},"externalRailForSegment"),d=a(()=>{const T=[];for(const m of f){const M=u(m);for(const A of it(M)){const R=v(m,M,A);R&&T.push(R)}}return T},"collectExternalRails"),h=a((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&$t(T.min,T.max,m.min,m.max)>=Ft,"railsInteract"),i=a(T=>{const m=[],M=new Set;for(const A of T){if(M.has(A))continue;const R=[A],k=[];for(M.add(A);R.length>0;){const O=R.pop();k.push(O);for(const F of T)!M.has(F)&&h(O,F)&&(M.add(F),R.push(F))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=a(T=>{const m=[];for(const M of T)m.some(A=>Math.abs(A-M.coord)<J)||m.push(M.coord);for(;m.length<T.length;){const M=Math.min(...m),A=Math.max(...m),R=T[0].side;m.push(R==="left"||R==="top"?M-12*(T.length-m.length):A+12*(T.length-m.length))}return m},"uniqueCoordsFor"),L=a(T=>{const m=T.map(R=>R.coord),M=y(T),A=[];if(T.length<=6){const R=new Array(M.length).fill(!1),k=[],O=a(()=>{if(k.length===T.length){k.some((F,D)=>Math.abs(F-m[D])>=J)&&A.push([...k]);return}for(const[F,D]of M.entries())R[F]||(R[F]=!0,k.push(D),O(),k.pop(),R[F]=!1)},"visit");return O(),A}for(let R=0;R<m.length;R++)for(let k=R+1;k<m.length;k++){const O=[...m];[O[R],O[k]]=[O[k],O[R]],A.push(O)}return A},"coordinateAssignmentsFor"),I=a((T,m)=>{const M=new Map;for(const[R,k]of T.entries()){const O=m[R],F=M.get(k.edge)??k.points.map(D=>({x:D.x,y:D.y}));k.axis==="vertical"?(F[k.segmentIndex].x=O,F[k.segmentIndex+1].x=O):(F[k.segmentIndex].y=O,F[k.segmentIndex+1].y=O),M.set(k.edge,F)}const A=new Map;for(const[R,k]of M){const O=ce(mt(k));if(it(O).length!==O.length-1)return;A.set(R,O)}return A},"replacementsForAssignment"),E=a(T=>{for(const[m,M]of T){const A=[m.start,m.end].filter(R=>!!R);for(const R of it(M))if(At(R.a,R.b,r,A,-2)||At(R.a,R.b,l,[],-2))return!1}for(let m=0;m<f.length;m++){const M=f[m],A=T.has(M),R=it(u(M,T));for(let k=m+1;k<f.length;k++){const O=f[k];if(!A&&!T.has(O))continue;const F=it(u(O,T));for(const D of R)for(const B of F)if(ie(D,B,.5)>=Ft)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=g();if(m===0)return;let M,A=m,R=b(),k=Number.POSITIVE_INFINITY;for(const O of i(d()))for(const F of L(O)){const D=I(O,F);if(!D||!E(D))continue;const B=g(D);if(B>=m)continue;const G=b(D),j=O.reduce((Z,dt,pt)=>Z+Math.abs(F[pt]-dt.coord),0);B>A||B===A&&(G>R||G===R&&j>=k)||(M=D,A=B,R=G,k=j)}if(!M)return;for(const[O,F]of M)O.points=F}}a(Qo,"reassignCrossingExternalRailChannels");function ts(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(d=>!d.isLayoutOnly),l=a((d,h,i)=>mt(d===h?i??[]:d.points??[]),"pointsFor"),f=a(d=>it(d).reduce((h,i)=>{const y=i.a.x-i.b.x,L=i.a.y-i.b.y;return h+Math.hypot(y,L)},0),"pathLength"),u=a((d,h)=>{let i=0;for(let y=0;y<r.length;y++){const L=it(l(r[y],d,h));for(let I=y+1;I<r.length;I++){const E=it(l(r[I],d,h));for(const T of L)for(const m of E)ae(T.a,T.b,m.a,m.b,J)&&i++}}return i},"strictCrossingCount"),g=a((d,h)=>{if(d.horizontal){const i=d.a.y;return(Math.abs(i-h.top)<1||Math.abs(i-h.bottom)<1)&&$t(d.a.x,d.b.x,h.left,h.right)>=Ft}if(d.vertical){const i=d.a.x;return(Math.abs(i-h.left)<1||Math.abs(i-h.right)<1)&&$t(d.a.y,d.b.y,h.top,h.bottom)>=Ft}return!1},"segmentRunsAlongRectBorder"),b=a(d=>{const h=[d.start,d.end].filter(y=>!!y),i=[];for(const y of h){const L=e.get(y),I=L?qt(L):void 0;I&&i.push(I)}return i},"endpointRectsFor"),p=a((d,h)=>{if(h+3>=d.length)return[];const i=d[h],y=d[h+1],L=d[h+2],I=d[h+3],E=wt(i,y,J)&&Et(y,L,J)&&wt(L,I,J),T=Et(i,y,J)&&wt(y,L,J)&&Et(L,I,J);if(!E&&!T)return[];if(!(E?Math.sign(y.x-i.x)!==Math.sign(I.x-L.x):Math.sign(y.y-i.y)!==Math.sign(I.y-L.y)))return[];const M=ft(i,I,J)||ht(i,I,J)?[]:[{x:i.x,y:I.y},{x:I.x,y:i.y}],A=M.length===0?[[...d.slice(0,h+1),...d.slice(h+3)]]:M.map(k=>[...d.slice(0,h+1),k,...d.slice(h+3)]),R=new Set;return A.map(k=>ce(mt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(F=>oe(F,I,J)))return!1;const O=k.map(F=>`${F.x.toFixed(3)},${F.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),v=a((d,h,i)=>{const y=[d.start,d.end].filter(I=>!!I),L=b(d);for(const I of it(h))if(At(I.a,I.b,o,y,-2)||At(I.a,I.b,s,[],-2)||L.some(E=>g(I,E)))return!1;for(const I of r)if(I!==d){for(const E of it(h))for(const T of it(l(I)))if(ie(E,T,.5)>=Ft)return!1}return u(d,h)<=i},"candidateIsSafe");for(let d=0;d<8;d++){const h=u();let i,y,L=h,I=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=l(T),M=Qt(m,J),A=f(m);for(let R=0;R<=m.length-4;R++)for(const k of p(m,R)){const O=Qt(k,J),F=f(k);if(!(O<M||O===M&&F<A-J)||!v(T,k,h))continue;const B=u(T,k);B>L||B===L&&(O>I||O===I&&F>=E)||(i=T,y=k,L=B,I=O,E=F)}}if(!i||!y)return;i.points=y}}a(ts,"shortcutRedundantOrthogonalJogs");function es(t,e){const l=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const _=N.x??0,H=N.y??0,V=qt(N);V&&l.push({id:String(N.id??""),cx:_,cy:H,rect:V})}if(l.length===0)return;const f=new Map(l.map(N=>[N.id,N])),u=l.map(N=>({id:N.id,rect:N.rect})),g=["top","bottom","left","right"],b={top:Math.min(...l.map(N=>N.rect.top))-20,bottom:Math.max(...l.map(N=>N.rect.bottom))+20,left:Math.min(...l.map(N=>N.rect.left))-20,right:Math.max(...l.map(N=>N.rect.right))+20},p=t.filter(N=>!N.isLayoutOnly),v=new Map(p.map((N,_)=>[N,_])),d=a(N=>{const _=N==="left"||N==="top"?-1:1,H=[];for(let V=0;V<=2;V++)H.push(b[N]+_*20*V);return H},"outwardTracksForSide"),h=a((N,_=new Map)=>mt(_.get(N)??N.points??[]),"replacementPointsFor"),i=a((N,_)=>{let H=0;for(const V of N)for(const c of _)ae(V.a,V.b,c.a,c.b,J)&&H++;return H},"crossingCountBetweenSegments"),y=a((N,_)=>i(it(N),it(_)),"crossingCountBetweenPaths"),L=a((N=new Map)=>{let _=0;const H=[],V=new Set,c=[],x=a(S=>{V.has(S)||(V.add(S),c.push(S))},"addEdge");for(let S=0;S<p.length;S++){const C=p[S],w=h(C,N);for(let P=S+1;P<p.length;P++){const U=p[P],q=y(w,h(U,N));q>0&&(_+=q,H.push({first:C,second:U,count:q}),x(C),x(U))}}return c.sort((S,C)=>(v.get(S)??0)-(v.get(C)??0)),{count:_,pairs:H,edgeSet:V,edges:c}},"crossingSnapshot"),I=a((N,_)=>{const H=new Set(_.keys());if(H.size===0)return N.count;let V=0;for(const x of N.pairs)(H.has(x.first)||H.has(x.second))&&(V+=x.count);let c=0;for(let x=0;x<p.length;x++){const S=p[x],C=H.has(S),w=h(S,_);for(let P=x+1;P<p.length;P++){const U=p[P];!C&&!H.has(U)||(c+=y(w,h(U,_)))}}return N.count-V+c},"crossingCountWithReplacements"),E=a(N=>{const _=new Map;for(const c of N.pairs){const x=_.get(c.first)??new Set;x.add(c.second),_.set(c.first,x);const S=_.get(c.second)??new Set;S.add(c.first),_.set(c.second,S)}const H=[],V=new Set;for(const c of N.edges){if(V.has(c))continue;const x=[c],S=[];for(V.add(c);x.length>0;){const C=x.pop();S.push(C);for(const w of _.get(C)??[])V.has(w)||(V.add(w),x.push(w))}S.sort((C,w)=>(v.get(C)??0)-(v.get(w)??0)),S.length>1&&H.push(S)}return H},"crossingComponents"),T=a(N=>[N.start,N.end].filter(_=>!!_),"endpointIdsFor"),m=a(N=>{const _=[];for(const H of E(N)){const V=new Set(H),c=new Set(H.flatMap(S=>T(S))),x=[...H];for(const S of p)V.has(S)||T(S).some(C=>c.has(C))&&x.push(S);x.sort((S,C)=>(v.get(S)??0)-(v.get(C)??0)),_.push(x)}return _},"pairSearchGroups"),M=a((N,_,H)=>I(N,new Map([[_,H]])),"crossingCountWithSingleReplacement"),A=a(N=>{const _=new Map;for(const H of N.pairs)_.set(H.first,(_.get(H.first)??0)+H.count),_.set(H.second,(_.get(H.second)??0)+H.count);return _},"currentCrossingsByEdge"),R=a(N=>N.slice(1).reduce((_,H,V)=>{const c=N[V];return _+Math.abs(H.x-c.x)+Math.abs(H.y-c.y)},0),"pathLength"),k=a((N=new Map)=>p.reduce((_,H)=>_+Qt(h(H,N)),0),"totalBends"),O=a((N=new Map)=>p.reduce((_,H)=>_+R(h(H,N)),0),"totalLength"),F=a((N,_,H=new Map)=>{const V=it(_);for(const c of p)if(c!==N){for(const x of V)for(const S of it(h(c,H)))if(ie(x,S,.5)>=Ft)return!0}return!1},"pathHasSegmentConflict"),D=a((N,_)=>{const H=[N.start,N.end].filter(V=>!!V);for(const V of it(_))if(At(V.a,V.b,u,H,-2))return!0;return!1},"pathHitsNode"),B=a((N,_)=>{const H=ce(mt(_));it(H).length===H.length-1&&N.push(H)},"pushOrthogonalCandidate"),G=a(N=>N==="left"||N==="right","sideIsHorizontal"),j=a((N,_,H)=>{switch(_){case"left":return Math.min(N.x,H.x)-20;case"right":return Math.max(N.x,H.x)+20;case"top":return Math.min(N.y,H.y)-20;case"bottom":return Math.max(N.y,H.y)+20}},"localTrackForSameSide"),Z=a((N,_,H,V)=>{const c=H==="left"||H==="top"?-1:1,x=[j(_,H,V),b[H]];for(const S of x)for(let C=0;C<=2;C++)B(N,to(_,H,V,S+c*20*C))},"addSameSideCandidates"),dt=a((N,_,H,V,c)=>{for(const x of d(H))for(const S of d(c))B(N,[_,{x,y:_.y},{x,y:S},{x:V.x,y:S},V])},"addHorizontalToVerticalCandidates"),pt=a((N,_,H,V,c)=>{for(const x of d(H))for(const S of d(c))B(N,[_,{x:_.x,y:x},{x:S,y:x},{x:S,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=a((N,_,H,V,c)=>{const x=[...d("top"),...d("bottom")];for(const S of d(H))for(const C of d(c))for(const w of x)B(N,[_,{x:S,y:_.y},{x:S,y:w},{x:C,y:w},{x:C,y:V.y},V])},"addHorizontalPairCandidates"),Bt=a((N,_,H,V,c)=>{const x=[...d("left"),...d("right")];for(const S of d(H))for(const C of d(c))for(const w of x)B(N,[_,{x:_.x,y:S},{x:w,y:S},{x:w,y:C},{x:V.x,y:C},V])},"addVerticalPairCandidates"),Q=a(N=>{const _=new Set;return N.map(H=>mt(H)).filter(H=>{const V=H.map(c=>`${c.x.toFixed(3)},${c.y.toFixed(3)}`).join("|");return _.has(V)||H.length<2?!1:(_.add(V),!0)})},"dedupeCandidatePaths"),W=a((N,_,H,V)=>{const c=[],x=Qn(N,_,H,V,20,J);x&&B(c,x),_===V&&Z(c,N,_,H);const S=G(_),C=G(V);return S&&!C?dt(c,N,_,H,V):!S&&C?pt(c,N,_,H,V):S?kt(c,N,_,H,V):Bt(c,N,_,H,V),Q(c)},"buildCandidatesForSides"),et=a((N,_,H,V)=>{const c=[...d("left"),...d("right")],x=[...d("top"),...d("bottom")];for(const S of g){const C=Ie(V,S),w=S==="top"||S==="bottom"?d(S):x;for(const P of c){B(N,[_,H,{x:P,y:H.y},{x:P,y:C.y},C]);for(const U of w)B(N,[_,H,{x:P,y:H.y},{x:P,y:U},{x:C.x,y:U},C])}}},"addVerticalDepartureOuterTrackCandidates"),at=a((N,_,H,V)=>{const c=[...d("left"),...d("right")],x=[...d("top"),...d("bottom")];for(const S of g){const C=Ie(V,S),w=S==="left"||S==="right"?d(S):c;for(const P of x){B(N,[_,H,{x:H.x,y:P},{x:C.x,y:P},C]);for(const U of w)B(N,[_,H,{x:H.x,y:P},{x:U,y:P},{x:U,y:C.y},C])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=a(N=>{const _=N.start,H=N.end,V=H?f.get(H):void 0;if(!_||!V)return[];const c=mt(N.points??[]);if(c.length<4)return[];const x=c[0],S=c[1],C=[];return Et(x,S,J)?et(C,x,S,V):wt(x,S,J)&&at(C,x,S,V),C},"terminalPreservingOuterTrackCandidates"),xt=a(N=>{const _=N.start,H=N.end,V=_?f.get(_):void 0,c=H?f.get(H):void 0;if(!V||!c)return[];const x=[];for(const S of g){const C=Ie(V,S);for(const w of g)x.push(...W(C,S,Ie(c,w),w))}return x.push(...gt(N)),x},"candidatePathsFor"),vt=a(()=>new Map(p.map(N=>[N,it(h(N))])),"currentSegmentsByEdge"),Vt=a((N,_,H)=>{const V=new Set;for(const c of p){if(c===N)continue;const x=H.get(c)??it(h(c));_.some(S=>x.some(C=>ie(S,C,.5)>=Ft))&&V.add(c)}return V},"sharedTrackConflictsFor"),jt=a((N,_,H,V)=>{const c=new Set;return xt(N).map(S=>ce(mt(S))).filter(S=>{if(D(N,S))return!1;const C=S.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return c.has(C)||S.length<2?!1:(c.add(C),!0)}).map(S=>{const C=it(S);let w=0;for(const P of p)P!==N&&(w+=i(C,H.get(P)??it(h(P))));return{candidate:S,candidateSegments:C,crossings:_.count-(V.get(N)??0)+w,bends:Qt(S,J),totalBends:Qt(S),length:R(S)}}).filter(({crossings:S})=>S<=_.count).sort((S,C)=>S.crossings-C.crossings||S.bends-C.bends||S.length-C.length).slice(0,48).map(S=>({path:S.candidate,segments:S.candidateSegments,sharedTrackConflicts:Vt(N,S.candidateSegments,H),totalBends:S.totalBends,length:S.length}))},"pairCandidatesFor"),Ut=a((N,_,H,V,c,x)=>{let S=0;for(const w of N.pairs)(w.first===_||w.second===_||w.first===V||w.second===V)&&(S+=w.count);let C=i(H.segments,c.segments);for(const w of p){if(w===_||w===V)continue;const P=x.get(w)??it(h(w));C+=i(H.segments,P)+i(c.segments,P)}return N.count-S+C},"pairCrossingCount"),te=a((N,_)=>{for(const H of N.sharedTrackConflicts)if(H!==_)return!1;return!0},"conflictsOnlyWith"),Me=a((N,_)=>N.segments.some(H=>_.segments.some(V=>ie(H,V,.5)>=Ft)),"candidatesShareTrack"),fe=a((N,_,H,V)=>te(_,H.edge)&&te(V,N.edge)&&!Me(_,V),"pairCandidatesAreCompatible"),Se=a((N,_,H,V,c)=>{const x=Ut(N.current,_.edge,H,V.edge,c,N.baseSegments);if(!(x>=N.current.count))return{replacements:new Map([[_.edge,H.path],[V.edge,c.path]]),crossings:x,bends:N.currentBends-(N.baseBendsByEdge.get(_.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+H.totalBends+c.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(_.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+H.length+c.length}},"scorePairReplacement"),on=a((N,_)=>N.crossings<_.crossings||N.crossings===_.crossings&&(N.bends<_.bends||N.bends===_.bends&&N.length<_.length),"pairScoreIsBetter"),sn=a((N,_,H,V)=>{let c=V;for(const x of _.candidates)for(const S of H.candidates){if(!fe(_,x,H,S))continue;const C=Se(N,_,x,H,S);C&&on(C,c)&&(c=C)}return c},"bestScoreForOptionPair"),rn=a(N=>{const _=k(),H=O(),V=vt(),c=A(N),x=new Map(p.map(q=>[q,Qt(h(q))])),S=new Map(p.map(q=>[q,R(h(q))])),C=new Map,w=m(N);for(const q of w)for(const $ of q){if(C.has($))continue;const Y=jt($,N,V,c);Y.length>0&&C.set($,{edge:$,candidates:Y})}let P={replacements:new Map,crossings:N.count,bends:_,length:H};const U={current:N,currentBends:_,currentLength:H,baseBendsByEdge:x,baseLengthByEdge:S,baseSegments:V};for(const q of w){const $=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>C.get(ot)).filter(ot=>!!ot);for(let ot=0;ot<Y.length;ot++){const rt=Y[ot];for(let st=ot+1;st<Y.length;st++){const tt=Y[st];!$.has(rt.edge)&&!$.has(tt.edge)||(P=sn(U,rt,tt,P))}}}return P.replacements.size>0?P.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const _=L(),H=_.count;if(H===0)return;let V,c,x=H,S=Number.POSITIVE_INFINITY;for(const w of _.edges){const P=Qt(h(w),J);for(const U of xt(w)){const q=D(w,U),$=!q&&F(w,U),Y=M(_,w,U),ot=Qt(U,J);q||$||!(Y<H||Y===H&&ot<P)||Y>x||Y===x&&ot>=S||(V=w,c=U,x=Y,S=ot)}}if(V&&c){V.points=c;continue}const C=rn(_);if(!C)return;for(const[w,P]of C)w.points=P}}a(es,"resolveRenderedOrthogonalCrossings");var ge=.001,dr=8;function ns(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=["top","bottom","left","right"],r=20,l={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},f=a((i,y,L,I)=>{const E=[],T=Qn(i,y,L,I,r,ge);return T&&E.push(T),y===I&&E.push(to(i,y,L,l[y])),E},"buildOrthogonalPathCandidates"),u=a((i,y)=>{for(let L=0;L<i.length-1;L++){const I=i[L],E=i[L+1];if(At(I,E,o,y,1))return!0}return!1},"pathHitsNode"),g=a((i,y,L=!1)=>{let I=0;const E=Ee(i,ge),T=y.start,m=y.end;for(const M of t){if(M===y||M.isLayoutOnly)continue;const A=M.start,R=M.end;if(!L&&T&&m&&(A===T||A===m||R===T||R===m))continue;const k=M.points;if(!(!k||k.length<2))for(const O of E)for(const F of Ee(k,ge)){if(no(O.a,O.b,F.a,F.b,ge,ge)){I++;continue}ie(O,F,ge)>=dr&&I++}}return I},"pathConflictCount"),b=4,p=a((i,y)=>{const L=Math.abs(i.y-y.rect.top),I=Math.abs(i.y-y.rect.bottom),E=Math.abs(i.x-y.rect.left),T=Math.abs(i.x-y.rect.right);let m="top",M=L;return I<M&&(m="bottom",M=I),E<M&&(m="left",M=E),T<M&&(m="right",M=T),m},"nearestSideOfRect"),v=new Map,d=a((i,y,L)=>{const I=v.get(i)??[];I.push({side:y,edgeId:L}),v.set(i,I)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const y=i.points??[];if(y.length<1)continue;const L=i.id??"",I=i.start,E=i.end;if(I){const T=n.get(I);T&&d(I,p(y[0],T),L)}if(E){const T=n.get(E);T&&d(E,p(y[y.length-1],T),L)}}const h=a((i,y,L)=>v.get(i)?.some(I=>I.edgeId!==L&&I.side===y)??!1,"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const y=i.points;if(!y||y.length<2)continue;const L=Qt(y,ge);if(L<b)continue;const I=i.start,E=i.end;if(!I||!E)continue;const T=n.get(I),m=n.get(E);if(!T||!m)continue;const M=i.id??"",A=g(y,i,!0),R=g(y,i);let k,O=A,F=L;for(const D of s){if(h(I,D,M))continue;const B=Ie(T,D);for(const G of s){if(h(E,G,M))continue;const j=Ie(m,G);for(const Z of f(B,D,j,G)){if(u(Z,[I,E]))continue;const dt=Qt(Z,ge);if(A>0){const pt=g(Z,i,!0);if(pt>O||pt===O&&dt>=F)continue;O=pt,F=dt,k=Z;continue}g(Z,i)>R||dt<F&&(F=dt,k=Z)}}}if(k){i.points=k;const D=v.get(I);D&&v.set(I,D.filter(G=>G.edgeId!==M));const B=v.get(E);B&&v.set(E,B.filter(G=>G.edgeId!==M)),d(I,p(k[0],T),M),d(E,p(k[k.length-1],m),M)}}}a(ns,"simplifyDetouredEdges");var Kt=.001,So=10,De=7;function kn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const l=r.x-s.x,f=r.y-s.y;if(!(Math.abs(l)+Math.abs(f)<Kt)){if(Math.abs(f)<=Kt){const g=s.x+Math.sign(l)*So;return{left:Math.min(s.x,g),right:Math.max(s.x,g),top:s.y-De,bottom:s.y+De}}if(Math.abs(l)<=Kt){const g=s.y+Math.sign(f)*So;return{left:s.x-De,right:s.x+De,top:Math.min(s.y,g),bottom:Math.max(s.y,g)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}a(kn,"markerClearanceRectFor");function os(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}a(os,"normalizeRect");function Fn(t,e){const n=mt(e),o=kn(n,!0),s=kn(n,!1);return[o,s].some(r=>r&&ze(t,os(r)))}a(Fn,"labelOverlapsOwnMarker");function Ye(t,e){const n=[];for(const h of t){if(h.isLayoutOnly)continue;const i=h.points;if(!(!i||i.length<2))for(let y=0;y<i.length-1;y++)n.push({edgeId:h.id,p1:i[y],p2:i[y+1]})}const o=[],s=[];for(const h of e.values()){const i=h.isGroup,y=h.parentId;if(i&&!y){const I=qt(h);I&&s.push({id:h.id,rect:I});continue}if(i||h.isEdgeLabel)continue;const L=qt(h);L&&o.push({nodeId:h.id,rect:L})}const r=3,l=1,f=12,u=a((h,i)=>{const y=bn(i,r);for(const{nodeId:L,rect:I}of o)if(L!==h&&ze(y,I))return!0;return!1},"labelOverlapsForeignNode"),g=a((h,i)=>{const y=bn(i,r);for(const L of n)if(L.edgeId!==h&&Je(L.p1,L.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),b=a((h,i,y)=>u(h,y)||g(i,y),"labelOverlapsAnything"),p=[],v=a(h=>{for(const{id:i,rect:y}of s)if(No(y,h))return i},"findContainingLane"),d=a((h,i)=>p.some(y=>y.labelId!==h&&ze(i,y.rect)),"overlapsPlacedLabel");for(const h of t){if(h.isLayoutOnly)continue;const i=h.labelNodeId;if(!i)continue;const y=e.get(i);if(!y)continue;const L=h.points;if(!L||L.length<2)continue;const I=y.width??0,E=y.height??0;if(I<=0||E<=0)continue;const T=[];for(let Q=0;Q<L.length-1;Q++){const W=L[Q],et=L[Q+1],at=Math.abs(W.x-et.x),gt=Math.abs(W.y-et.y);at<Kt&><Kt||at>=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx<T.length-1):T,M=m.length>0?m:T,A=I>=E?"horizontal":"vertical",R=a(Q=>[...Q].sort((W,et)=>{const at=W.orientation===A,gt=et.orientation===A;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?I:E)+2,vt=et.length>=(et.orientation==="horizontal"?I:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],F=[.5,.25,.75,.05,.95,.15,.85,.1,.9],D=a((Q,W)=>{const et=L[Q.idx],at=L[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),B=a((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=a((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=a(Q=>{const W=we(Q.midX,Q.midY,I,E),et=v(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+I/2+l,xt=at.rect.right-I/2-l,vt=at.rect.top+E/2+l,Vt=at.rect.bottom-E/2-l;if(gt>xt||vt>Vt)return;const jt={midX:B(Q.midX,gt,xt),midY:B(Q.midY,vt,Vt)},Ut=we(jt.midX,jt.midY,I,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),Z=a((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=a((Q,W)=>{const at=(Q.orientation==="horizontal"?I/2:E/2)+f;if(Q===k){const gt=L[Q.idx];if(Z(Q,W,gt)+Kt<at)return!1}if(Q===O){const gt=L[Q.idx+1];if(Z(Q,W,gt)+Kt<at)return!1}return!0},"labelClearsTerminalEndpoints"),pt=a(Q=>{const W=R(Q);for(const et of W)for(const at of F){const gt=D(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!Fn(xt.rect,L)&&!d(i,xt.rect)&&!b(i,h.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=a((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!Fn(vt.rect,L)&&!d(i,vt.rect)&&!u(i,vt.rect)&&(et||!g(h.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Bt=pt(M)??(M.length<T.length?pt(T):void 0)??kt(T,!0)??kt(T,!1)??kt(T,!1,!0);if(Bt){y.x=Bt.anchor.midX,y.y=Bt.anchor.midY,y.parentId=Bt.laneId;const Q=we(Bt.anchor.midX,Bt.anchor.midY,I,E),W=p.findIndex(et=>et.labelId===i);W>=0?p[W]={labelId:i,rect:Q}:p.push({labelId:i,rect:Q})}}}a(Ye,"anchorLabelsToPolyline");var mn=1e-6,ur=8,Co=ur/2,hr=3;function _n(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}a(_n,"pairKey");function ss(t,e){const{nodeInfoById:n,realNodeRects:o}=Qe(e),s=new Map;for(const l of e){const f=l.id;if(!l.isGroup&&l.isEdgeLabel){s.set(f,{w:l.width??0,h:l.height??0});continue}}const r=a((l,f,u,g)=>{const b=_n(f,u);let p=0;const v=a(d=>{if(!d)return;const h=s.get(d);if(!h)return;const i=g==="x"?h.w/2:h.h/2;i>p&&(p=i)},"consider");v(l.labelNodeId);for(const d of t){if(d===l||d.isLayoutOnly)continue;const h=d.start,i=d.end;!h||!i||_n(h,i)===b&&v(d.labelNodeId)}return p>0?p+hr:0},"labelClearanceFor");for(const l of t){if(l.isLayoutOnly)continue;const f=l.points;if(!Zn(f,mn))continue;const u=eo(l,n,mn);if(!u)continue;const{srcId:g,dstId:b,srcInfo:p,dstInfo:v,collinearX:d,collinearY:h}=u;if(d===h)continue;let i,y;if(d){const m=v.cy>p.cy;i={x:p.cx,y:m?p.rect.bottom:p.rect.top},y={x:v.cx,y:m?v.rect.top:v.rect.bottom}}else{const m=v.cx>p.cx;i={x:m?p.rect.right:p.rect.left,y:p.cy},y={x:m?v.rect.left:v.rect.right,y:v.cy}}if(At(i,y,o,[g,b],1))continue;const I=r(l,g,b,d?"x":"y"),E=I>Co?I:Co,T=[0,E,-E];for(const m of T){const M={...i},A={...y};if(d){if(M.x+=m,A.x+=m,M.x<=p.rect.left||M.x>=p.rect.right||A.x<=v.rect.left||A.x>=v.rect.right)continue}else if(M.y+=m,A.y+=m,M.y<=p.rect.top||M.y>=p.rect.bottom||A.y<=v.rect.top||A.y>=v.rect.bottom)continue;if(!At(M,A,o,[g,b],1)&&!$e(M,A,t,l,{epsilon:mn})){l.points=[M,A];break}}}}a(ss,"straightenCollinearSiblingDetours");function Hn(t,e){const{realNodeRects:u,labelNodeRects:g}=me(e.values()),b=a((m,M)=>Ee(M,.001).map(A=>({...A,edge:m,interior:A.index>=1&&A.index<=M.length-3})),"segmentsFor"),p=a(()=>{const m=[];for(const M of t){if(M.isLayoutOnly)continue;const A=M.points;!A||A.length<2||m.push(...b(M,mt(A)))}return m},"allSegments"),v=a((m,M)=>m.horizontal&&M.horizontal?$t(m.a.x,m.b.x,M.a.x,M.b.x)>=8&&Math.abs(m.a.y-M.a.y)<7:m.vertical&&M.vertical?$t(m.a.y,m.b.y,M.a.y,M.b.y)>=8&&Math.abs(m.a.x-M.a.x)<7:!1,"hasCrowdedParallelTrack"),d=a((m,M)=>{const A=m.start,R=m.end,k=b(m,M);if(k.length!==M.length-1)return!1;const O=[A,R].filter(D=>!!D),F=m.labelNodeId?[m.labelNodeId]:[];for(const D of k)if(At(D.a,D.b,u,O,-2)||At(D.a,D.b,g,F,-2))return!1;for(const D of t){if(D===m||D.isLayoutOnly)continue;const B=D.points;if(!(!B||B.length<2)){for(const G of k)for(const j of b(D,mt(B)))if(v(G,j)||ae(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),h=a((m,M)=>{const A=mt(m.edge.points??[]);if(A.length<4||m.index>=A.length-1)return;const R=A.map(k=>({...k}));if(m.horizontal)R[m.index].y+=M,R[m.index+1].y+=M;else if(m.vertical)R[m.index].x+=M,R[m.index+1].x+=M;else return;return b(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),i=a((m,M)=>({x:m.x??(M.left+M.right)/2,y:m.y??(M.top+M.bottom)/2}),"nodeCenter"),y=a(m=>{const M=m.edge,A=mt(M.points??[]);if(A.length!==4||m.index!==1)return;const R=M.start?e.get(M.start):void 0,k=M.end?e.get(M.end):void 0,O=R?qt(R):void 0,F=k?qt(k):void 0,D=A.slice(m.index+2);if(!(!R||!k||!O||!F||D.length===0))return{sourceCenter:i(R,O),targetCenter:i(k,F),sourceRect:O,tail:D}},"sourceDetourContextFor"),L=a((m,M,A,R,k,O)=>{const F=R.y>=A.y,D=F?k.bottom:k.top,B=D+(F?20:-20);if(F&&m.b.y<=B+.001||!F&&m.b.y>=B-.001)return;const G=m.a.x+M;return mt([{x:A.x,y:D},{x:A.x,y:B},{x:G,y:B},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),I=a((m,M,A,R,k,O)=>{const F=R.x>=A.x,D=F?k.right:k.left,B=D+(F?20:-20);if(F&&m.b.x<=B+.001||!F&&m.b.x>=B-.001)return;const G=m.a.y+M;return mt([{x:D,y:A.y},{x:B,y:A.y},{x:B,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=a((m,M)=>{const A=y(m);if(A){if(m.vertical)return L(m,M,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(m.horizontal)return I(m,M,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const M=p();let A=!1;for(let R=0;R<M.length&&!A;R++)for(let k=R+1;k<M.length&&!A;k++){const O=M[R],F=M[k];if(O.edge===F.edge||!v(O,F))continue;const D=[O,F].filter(B=>B.interior);for(const B of D){for(const G of T){const j=h(B,G);if(j&&d(B.edge,j)){B.edge.points=j,A=!0;break}const Z=E(B,G);if(Z&&d(B.edge,Z)){B.edge.points=Z,A=!0;break}}if(A)break}}if(!A)return}}a(Hn,"nudgeSharedInteriorSubpaths");function rs(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,l=o.x-n.x,f=o.y-n.y,u=s*f-r*l;if(Math.abs(u)<1e-10)return!1;const g=n.x-t.x,b=n.y-t.y,p=(g*f-b*l)/u,v=(g*r-b*s)/u,d=.01;return p>d&&p<1-d&&v>d&&v<1-d}a(rs,"segmentsIntersect");function is(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=Oo(e),r=[];for(const f of n){if(f.isLayoutOnly)continue;const u=f.points;if(!u||u.length<2)continue;const g=f.start,b=f.end,p=f.labelNodeId,v=f.id??`${g}->${b}`;for(const d of s)if(!(d.nodeId===g||d.nodeId===b)&&!(p&&d.nodeId===p)){for(let h=0;h<u.length-1;h++)if(Je(u[h],u[h+1],d,-1)){o.push({type:"edge-node-overlap",edgeId:v,targetId:d.nodeId,detail:`segment ${h} passes through node "${d.nodeId}"`});break}}for(let d=0;d<u.length-1;d++)r.push({edgeId:v,start:g,end:b,p1:u[d],p2:u[d+1]})}const l=new Set;for(let f=0;f<r.length;f++)for(let u=f+1;u<r.length;u++){const g=r[f],b=r[u];if(g.edgeId!==b.edgeId&&!(g.start===b.start||g.start===b.end||g.end===b.start||g.end===b.end)&&rs(g.p1,g.p2,b.p1,b.p2)){const p=g.edgeId<b.edgeId?`${g.edgeId}|${b.edgeId}`:`${b.edgeId}|${g.edgeId}`;l.has(p)||(l.add(p),o.push({type:"edge-edge-crossing",edgeId:g.edgeId,targetId:b.edgeId,detail:`edges "${g.edgeId}" and "${b.edgeId}" cross`}))}}if(o.length>0){const f=o.filter(g=>g.type==="edge-node-overlap").length,u=o.filter(g=>g.type==="edge-edge-crossing").length;yn.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${f} edge-node overlap(s), ${u} edge crossing(s)`);for(const g of o)yn.warn(`[SWIMLANE_VALIDATE] ${g.type}: ${g.detail}`)}return o}a(is,"validateSwimlanesLayout");function cs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(f=>!f.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!Uo(t,e)||e==="BT"&&s.length>0&&!jo(t))return;for(const f of o){if(f.isLayoutOnly)continue;const u=f.points;!u||u.length<2||(f.points=ce(Ve(u)))}ns(o,n),ss(o,n),Wo(o,n);const r=new Map;for(const f of n)r.set(String(f.id),f);Ye(o,r),_o(o,r),Ko(o,r),Hn(o,r),qo(o,r),Zo(o,r),On(o,r),Jo(o,r);const l=a(()=>{es(o,r),Qo(o,r),ts(o,r),Ye(o,r),Rn(o,r),On(o,r),Ye(o,r),Rn(o,r)},"finalizeRenderedEdges");l(),Hn(o,r),l(),Bn(o,r),Pn(o,r),Bn(o,r),Pn(o,r)}a(cs,"postProcessSwimlaneLayout");function pe(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const l=`${r.id}:${r.src}->${r.dst}`;n.has(l)||(n.add(l),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}a(pe,"normalizeGraph");function co(t,e){return t.edges.filter(n=>n.dst===e)}a(co,"incoming");function as(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}a(as,"buildSuccessorMap");function ao(t){const e=as(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}a(ao,"buildSortedSuccessorMap");function tn(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}a(tn,"buildInDegreeMap");function lo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}a(lo,"sortedZeroInDegreeNodes");function en(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}a(en,"buildPredecessorSuccessorMaps");function fo(t,e,n,o){let s=0;for(const l of t.nodes)o?.skipGroups&&t.nodeById.get(l)?.isGroup||(s=Math.max(s,n[l]??0));const r=Array.from({length:s+1},()=>[]);for(const l of e)o?.skipGroups&&t.nodeById.get(l)?.isGroup||r[Math.max(0,n[l]??0)].push(l);return r}a(fo,"buildLayersFromRanks");function Ne(t){const e=tn(t),n=lo(e),o=[],s=ao(t);for(;n.length;){const r=n.shift();o.push(r);for(const l of s.get(r)??[])if(e.set(l,(e.get(l)??0)-1),(e.get(l)??0)===0){let f=0;for(;f<n.length&&n[f]<l;)f++;n.splice(f,0,l)}}return o.length===t.nodes.length?o:null}a(Ne,"topoSortIfAcyclic");function Ae(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}a(Ae,"buildLayerIndex");function uo(t){const e=new Array(t.length),n=a((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let l=n(o,r)+n(r,s),f=o,u=r,g=o;for(;f<r||u<s;)u>=s||f<r&&t[f]<=t[u]?e[g++]=t[f++]:(e[g++]=t[u++],l+=r-f);for(let b=o;b<s;b++)t[b]=e[b];return l},"count");return n(0,t.length)}a(uo,"countInversions");function ls(t){const e=pe(t),n=new Map;for(const p of e.nodes)n.set(p,[]);for(const p of e.edges)n.get(p.src).push(p);for(const p of n.values())p.sort((v,d)=>v.dst===d.dst?v.id.localeCompare(d.id):v.dst.localeCompare(d.dst));const o=Object.create(null);for(const p of e.nodes)o[p]=0;const s=[],r=a(p=>{o[p]=1;for(const v of n.get(p)??[]){const d=v.dst;o[d]===0?r(d):o[d]===1&&s.push(v)}o[p]=2},"dfs"),l=tn(e),f=[...e.nodes.filter(p=>(l.get(p)??0)===0),...e.nodes.filter(p=>(l.get(p)??0)!==0)];for(const p of f)o[p]===0&&r(p);const u=new Set(s.map(p=>`${p.id}:${p.src}->${p.dst}`)),g=e.edges.map(p=>u.has(`${p.id}:${p.src}->${p.dst}`)?{id:p.id,src:p.dst,dst:p.src,weight:p.weight,ref:p.ref}:p);return{acyclic:{nodes:[...e.nodes],edges:g,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}a(ls,"removeCycles_DFS");function fs(t){const e=new Map,n=a(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const f=n(r)??r;return e.set(o,f),f},"resolve");for(const o of t.nodes)n(o);return e}a(fs,"buildTopLaneMap");function le(t){const e=fs(t);return n=>e.get(n)??null}a(le,"createTopLaneResolver");function nn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}a(nn,"buildTopLaneOrder");function ho(t,e){const n=nn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const l of e)!o.has(l)||s.has(l)||(s.add(l),r.push(l));for(const l of n)s.has(l)||r.push(l);return r}a(ho,"resolveTopLaneOrder");var gr={EPSILON:1e-6},qe={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},vo={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function ds(t,e){const n=pe(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=en(n);for(const m of r.values())m.sort((M,A)=>M.localeCompare(A));const l=Ne(n)??[...n.nodes].sort((m,M)=>m.localeCompare(M)),f=new Map;for(const[m,M]of l.entries())f.set(M,m);const u=new Map,g=new Map;for(const m of n.nodes)g.set(m,[]);for(const m of l){const M=(r.get(m)??[]).filter(A=>u.has(A));if(M.length>0){const A=us(m,M,{laneOf:o,rankHint:s,topoIndex:f});u.set(m,A),g.get(A).push(m)}else u.has(m)||u.set(m,null)}for(const m of n.nodes)u.has(m)||u.set(m,null);const b=new Set;for(const m of n.nodes)(u.get(m)??null)===null&&b.add(m);const p=[...b].sort((m,M)=>{const A=f.get(m)??0,R=f.get(M)??0;return A===R?m.localeCompare(M):A-R}),v=hs(n),d=new Map;for(const[m,M]of v.entries())d.set(m,[...M].sort((A,R)=>A.localeCompare(R)));const h=gs(d),i=ms(d),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of i)for(const M of m.nodes){const A=y.get(M);A?A.push(m.id):y.set(M,[m.id])}const L=[],I=[],E=new Set,T=a(m=>{if(!E.has(m)){E.add(m),L.push(m);for(const M of g.get(m)??[])T(M);I.push(m)}},"walk");for(const m of p)T(m);for(const m of l)T(m);return{parent:u,children:g,roots:p,componentOf:h,blocks:i,nodeBlocks:y,adjacency:d,preorder:L,postorder:I,topologicalOrder:l}}a(ds,"buildDrivingTree");function us(t,e,n){const o=n.laneOf(t);return[...e].sort((r,l)=>{const f=n.laneOf(r),u=n.laneOf(l),g=f!=null&&f===o,b=u!=null&&u===o;if(g!==b)return g?-1:1;const p=n.rankHint?.[r],v=n.rankHint?.[l];if(p!=null&&v!=null&&p!==v)return v-p;const d=n.topoIndex.get(r)??0,h=n.topoIndex.get(l)??0;return d!==h?d-h:r.localeCompare(l)})[0]}a(us,"chooseParent");function hs(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}a(hs,"buildAdjacency");function gs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const l of t.get(r)??[])e.has(l)||s.push(l)}}n++}return e}a(gs,"assignComponents");function ms(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const l=a((f,u)=>{e.set(f,++r),n.set(f,r);for(const g of t.get(f)??[])g!==u&&(e.has(g)?(e.get(g)??0)<(e.get(f)??0)&&(o.push([f,g]),n.set(f,Math.min(n.get(f)??r,e.get(g)??r))):(o.push([f,g]),l(g,f),n.set(f,Math.min(n.get(f)??r,n.get(g)??r)),(n.get(g)??0)>=(e.get(f)??0)&&s.push(ps(f,g,o,s.length))))},"visit");for(const f of t.keys())e.has(f)||l(f,null);return s}a(ms,"computeBlocks");function ps(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const l=n.pop();if(s.push(l),r.add(l[0]),r.add(l[1]),l[0]===t&&l[1]===e||l[0]===e&&l[1]===t)break}return{id:o,edges:s,nodes:[...r]}}a(ps,"popBlock");function ys(t,e,n){const o=[...t.nodes],s=new Map;for(const[I,E]of o.entries())s.set(E,I);const r=o.length,l=new Array(r).fill(-1),f=new Array(r).fill(0),u=[],g=new Set;for(const I of o){const E=n.parent.get(I)??null,T=s.get(I);T!=null&&E==null&&(l[T]=-1,f[T]=0,g.has(I)||(g.add(I),u.push(I)))}for(;u.length>0;){const I=u.shift(),E=s.get(I);if(E==null)continue;const T=n.children.get(I)??[];for(const m of T){if(g.has(m))continue;const M=s.get(m);M!=null&&(l[M]=E,f[M]=f[E]+1,g.add(m),u.push(m))}}for(const I of o){if(g.has(I))continue;const E=s.get(I);E!=null&&(l[E]=-1,f[E]=0,g.add(I))}const b=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),p=Array.from({length:b},()=>new Array(r).fill(-1));for(let I=0;I<r;I++)p[0][I]=l[I];for(let I=1;I<b;I++)for(let E=0;E<r;E++){const T=p[I-1][E];p[I][E]=T===-1?-1:p[I-1][T]}const v=a((I,E)=>{if(I===-1||E===-1)return-1;f[I]<f[E]&&([I,E]=[E,I]);const T=f[I]-f[E];for(let m=0;m<b;m++)if(T>>m&1&&(I=p[m][I],I===-1))return-1;if(I===E)return I;for(let m=b-1;m>=0;m--){const M=p[m][I],A=p[m][E];M===-1||A===-1||M!==A&&(I=M,E=A)}return p[0][I]},"lcaIndex"),d=Array.from({length:r},()=>new Map);for(const I of t.edges){let E=I.src,T=I.dst,m=e[E],M=e[T];if(m==null||M==null||(m>M&&([E,T]=[T,E],[m,M]=[M,m]),m==null||M==null||m===M))continue;const A=s.get(E),R=s.get(T);if(A==null||R==null)continue;const k=v(A,R);if(k===-1)continue;const O=d[k];for(let F=m;F<M;F++)O.set(F,(O.get(F)??0)+1)}const h=new Map,i=a((I,E)=>{if(E.size!==0)for(const[T,m]of E)I.set(T,(I.get(T)??0)+m)},"mergeInto"),y=new Set,L=a(I=>{const E=s.get(I);y.add(I);const T=E==null?void 0:d[E],m=T?new Map(T):new Map,M=n.children.get(I)??[];for(const A of M){const R=L(A),k=e[I];if(k!=null){let O=h.get(I);O||(O=new Map,h.set(I,O));let F=R.get(k)??0;const D=e[A];D!=null&&D>k&&(F+=1),O.set(A,F)}i(m,R)}return m},"dfs");for(const I of n.roots)y.has(I)||L(I);for(const I of o)y.has(I)||L(I);return h}a(ys,"computeSubtreeCrossCounts");function xs(t,e,n){const o=new Map,s=a(r=>{let l=n[r]??0;const f=[...e.get(r)??[]];f.sort(go(n));for(const u of f){s(u);const g=o.get(u);g!=null&&(l=Math.min(l,g))}o.set(r,l)},"annotate");for(const r of t)s(r);return o}a(xs,"annotateMinimumLayers");function go(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}a(go,"compareByRankThenId");function bs(t,e,n,o){let s=0;for(const u of e){const g=n[u]??0;g>s&&(s=g)}const r=Array.from({length:s+1},()=>[]),l=new Set,f=a(u=>{if(l.has(u))return;l.add(u);const g=n[u]??0;r[g]||(r[g]=[]),r[g].push(u);for(const b of o(u))f(b)},"emit");for(const u of t)f(u);for(const u of e)if(!l.has(u)){const g=n[u]??0;r[g]||(r[g]=[]),r[g].push(u),l.add(u)}return r}a(bs,"emitNodesInTreeOrder");function Is(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}a(Is,"deduplicateLayers");function Ms(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const l=e[s]??0,f=[],u=[],g=n.get(s);for(const b of r){const p=o.get(b)??l;p>l?f.push({child:b,min:p}):u.push(b)}return f.sort((b,p)=>b.min===p.min?b.child.localeCompare(p.child):b.min-p.min),u.sort((b,p)=>{const v=g?.get(b)??0,d=g?.get(p)??0;if(v!==d)return v-d;const h=o.get(b)??l,i=o.get(p)??l;return h!==i?h-i:b.localeCompare(p)}),[...f.map(b=>b.child),...u]}}a(Ms,"createChildOrderer");function Ze(t,e,n){const o=ds(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const p of t.nodes)s.has(p)||s.set(p,[]);const l=ys(t,e,o),f=[...r].sort(go(e)),u=xs(f,s,e),g=Ms(s,e,l,u);let b=bs(f,t.nodes,e,g);return b=Is(b),b}a(Ze,"buildMultitreeLayerOrder");function Ss(t,e,n){const o=new Set(t),s=new Set(e),r=Ae(e),l=[];for(const f of n)o.has(f.src)&&s.has(f.dst)&&l.push(r.get(f.dst));return uo(l)}a(Ss,"countCrossingsBetweenAdjacent");function Dn(t,e,n){const o=[];for(const r of e){const l=n[r.src],f=n[r.dst];if(l==null||f==null||l===f)continue;let u=r.src,g=r.dst,b=l,p=f;l>f&&(u=r.dst,g=r.src,b=f,p=l);for(let v=b;v<p;v++)o.push({id:`${r.id}@${v}`,src:u,dst:g,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Ss(t[r],t[r+1],o);return s}a(Dn,"totalCrossings");function Cs(t,e){const n={...e},{preds:o}=en(t),s=le(t),r=Ze(t,n,s);let l=Dn(r,t.edges,n);const f=qe.MAX_CROSSING_OPTIMIZATION_PASSES;for(let u=0;u<f;u++){let g=!1;const b=[...t.nodes].sort((p,v)=>(n[v]??0)-(n[p]??0));for(const p of b){const v=n[p]??0;if(v===0)continue;let d=0;for(const L of o.get(p)??[])d=Math.max(d,(n[L]??0)+1);if(d>=v)continue;const h=v;n[p]=d;const i=Ze(t,n,s),y=Dn(i,t.edges,n);y<l?(l=y,g=!0):n[p]=h}if(!g)break}return n}a(Cs,"optimizeRanksByCrossings");function vs(t,e){const n=le(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const l=t.edges.filter(i=>i.src===s);if(l.length===0)continue;let f=!1,u=0;for(const i of l){const y=n(i.dst);y==null||y===r?f=!0:u++}if(u===0||f)continue;let g=0,b=!1;for(const i of t.edges){if(i.dst!==s)continue;const y=n(i.src);y&&(y===r?b=!0:g++)}if(g>0||!b)continue;const p=e[s]??0,v=p+u;let d=0;for(const i of t.edges)i.dst===s&&(d=Math.max(d,(e[i.src]??0)+1));const h=Math.max(p,d,v);h!==p&&(e[s]=h)}}a(vs,"adjustCrossLaneSources");function Ls(t,e){const n=pe(t),o=Ne(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=le(n);let l=Object.create(null);for(const u of o){const g=co(n,u),b=e?.ignoreCrossLaneEdges?g.filter(p=>{const v=r(p.src),d=r(u);return!v||!d?!0:v===d}):g;if(b.length===0)l[u]=0;else if(s&&b.length===1){const p=b[0].src,v=r(p),d=r(u);v!==d?l[u]=l[p]??0:l[u]=(l[p]??0)+1}else{let p=-1/0;for(const v of b)p=Math.max(p,(l[v.src]??0)+1);l[u]=p===-1/0?0:p}}return(e?.optimizeRanksByCrossings??!1)&&(l=Cs(n,l)),e?.ignoreCrossLaneEdges&&vs(n,l),{layers:Ze(n,l,r),rankOf:l,dummy:new Set}}a(Ls,"assignLayers_LongestPath");function Ts(t,e){const n=pe(t),s={...Ls(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=le(n),{preds:l,succs:f}=en(n,h=>{if(e?.ignoreCrossLaneEdges){const i=r(h.src),y=r(h.dst);if(i&&y&&i!==y)return!1}return!0}),u=Ne(n)??[...n.nodes],g=[...u].reverse(),b=a((h,i)=>{let y=0;for(const E of l.get(h)??[])y=Math.max(y,(s[E]??0)+1);let L=Number.POSITIVE_INFINITY;const I=f.get(h)??[];return I.length>0&&(L=Math.min(...I.map(E=>(s[E]??0)-1))),Number.isFinite(L)||(L=Math.max(y,i)),Math.min(Math.max(i,y),L)},"clampFeasible"),p=qe.GRAVITY_ITERATIONS,v=a(h=>{let i=!1;for(const y of h){const L=l.get(y)??[],I=f.get(y)??[];if(L.length===0&&I.length===0)continue;const E=L.length>0?L.reduce((A,R)=>A+(s[R]??0)+1,0)/L.length:s[y]??0,T=I.length>0?I.reduce((A,R)=>A+(s[R]??0)-1,0)/I.length:s[y]??0,m=Math.round((E+T)/2),M=b(y,m);M!==s[y]&&(s[y]=M,i=!0)}return i},"relaxOrder");for(let h=0;h<p;h++){const i=v(u),y=v(g);if(!i&&!y)break}for(const h of u){let i=0;for(const y of l.get(h)??[])i=Math.max(i,(s[y]??0)+1);(s[h]??0)<i&&(s[h]=i)}for(const h of g){const i=f.get(h)??[];if(i.length>0){const y=Math.min(...i.map(L=>(s[L]??0)-1));(s[h]??0)>y&&(s[h]=y)}}return{layers:fo(n,u,s),rankOf:s,dummy:new Set}}a(Ts,"assignLayers_Gravity");function ws(t){const e=tn(t),n=ao(t);let o=lo(e);const s=[];for(;o.length>0;){const r=[];for(const l of o){s.push(l);for(const f of n.get(l)??[])e.set(f,(e.get(f)??0)-1),(e.get(f)??0)===0&&r.push(f)}o=r.sort((l,f)=>l.localeCompare(f))}return s.length===t.nodes.length?s:null}a(ws,"topoSortByGenerationIfAcyclic");function Es(t,e){const n=pe(t),o=e?.direction==="LR"?ws(n)??[...n.nodes].sort():Ne(n)??[...n.nodes].sort(),s=le(n),r=a(b=>s(b)??b,"laneOf"),l=Object.create(null),f=new Map,u=a((b,p)=>e?.ignoreCrossLaneEdges??!0?r(b)===r(p)?1:0:1,"edgeWeight");for(const b of o){if(n.nodeById.get(b)?.isGroup)continue;const v=co(n,b);let d=0;if(v.length>0)for(const L of v){const I=L.src,E=l[I]??0;d=Math.max(d,E+u(I,b))}const h=r(b),i=f.get(h)??0,y=Math.max(d,i);l[b]=y,f.set(h,y+1)}return{layers:fo(n,o,l,{skipGroups:!0}),rankOf:l,dummy:new Set}}a(Es,"assignLayers_LaneAwareCompact");function As(t,e){const n=pe(e),{rankOf:o}=t,s=t.layers.map(d=>[...d]),r=new Set(t.dummy?[...t.dummy]:[]);let l=0;const f=new Map(n.nodeById),u=a(d=>{const h=`placeholder-${l++}`,i={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(f.set(h,i),r.add(h);s.length<=d;)s.push([]);return s[d].push(h),o[h]=d,h},"addDummyAt"),g=[...n.edges].sort((d,h)=>d.id===h.id?d.src===h.src?d.dst.localeCompare(h.dst):d.src.localeCompare(h.src):d.id.localeCompare(h.id)),b=[];for(const d of g){const h=o[d.src]??0,i=o[d.dst]??0;if(i-h<=1){b.push(d);continue}let y=d.src;for(let I=h+1,E=0;I<i;I++,E++){const T=u(I);b.push({id:`${d.id}#${E}`,src:y,dst:T,weight:d.weight,ref:d.ref}),y=T}const L=i-h-2;b.push({id:`${d.id}#${Math.max(L+1,0)}`,src:y,dst:d.dst,weight:d.weight,ref:d.ref})}const v={nodes:[...n.nodes,...[...r].filter(d=>!n.nodes.includes(d))],edges:b,layout:n.layout,nodeById:f};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:v}}a(As,"makeProperLayering");function Xn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}a(Xn,"median");function Yn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}a(Yn,"barycenter");function Rs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}a(Rs,"neighborPositionsFor");function Ns(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}a(Ns,"currentOrderTieBreak");function Gn(t,e,n){const o=new Set(t),s=new Set(e),r=Ae(t),l=Ae(e),f=[];for(const g of n)o.has(g.src)&&s.has(g.dst)&&f.push({u:r.get(g.src),v:l.get(g.dst)});f.sort((g,b)=>g.u===b.u?g.v-b.v:g.u-b.u);const u=f.map(g=>g.v);return uo(u)}a(Gn,"countCrossingsBetweenAdjacent");function Ge(t,e,n){return[...t].sort((o,s)=>{const r=Xn(e.get(o)??[]),l=Xn(e.get(s)??[]);return r===l?Ns(o,s,n):isFinite(r)?isFinite(l)?r-l:-1:1})}a(Ge,"sortByHeuristic");function zn(t,e,n,o,s,r){const l=Ae(t),f=Ae(e),u=Rs(e,l,n,o);if(!s||!r||r.length===0)return Ge(e,u,f);const g=new Map;for(const v of e){const d=s(v),h=g.get(d)??[];h.push(v),g.set(d,h)}const b=[];for(const v of r){const d=g.get(v);if(!d||d.length===0)continue;const h=Ge(d,u,f);b.push(...h)}const p=g.get(null);if(p&&p.length>0){const v=Ge(p,u,f);for(const d of v){const h=Yn(u.get(d)??[]);let i=b.length;if(isFinite(h))for(const[y,L]of b.entries()){const I=Yn(u.get(L)??[]);if(h<I){i=y;break}}b.splice(i,0,d)}}return b}a(zn,"reorderLayer");function $n(t,e,n,o,s){const r=[...e],l=new Set(t),f=new Set(e),u=o?new Set(o):null,g=n.filter(i=>l.has(i.src)&&f.has(i.dst)),b=u?n.filter(i=>f.has(i.src)&&u.has(i.dst)):void 0,p=a(i=>{let y=Gn(t,i,g);return b&&o&&(y+=Gn(i,o,b)),y},"crossingScore"),v=s?new Map:null;if(s&&v)for(const i of e)v.set(i,s(i));let d=!0,h=p(r);for(;d;){d=!1;for(let i=0;i+1<r.length;i++){if(v){const I=v.get(r[i]),E=v.get(r[i+1]);if(I!==E)continue}const y=h;[r[i],r[i+1]]=[r[i+1],r[i]];const L=p(r);L<y?(h=L,d=!0):[r[i],r[i+1]]=[r[i+1],r[i]]}}return r}a($n,"transposeImprove");function Os(t,e,n){const o=t.layers.map(f=>[...f]),s=e.edges,r=le(e),l=ho(e,n?.laneOrder);for(let f=0;f<3;f++){for(let u=1;u<o.length;u++)o[u]=zn(o[u-1],o[u],s,"down",r,l),o[u]=$n(o[u-1],o[u],s,o[u+1],r);for(let u=o.length-2;u>=0;u--)o[u]=zn(o[u+1],o[u],s,"up",r,l),o[u]=$n(o[u+1],o[u],s,o[u-1],r)}return{layers:o}}a(Os,"orderLayers");function Bs(t,e,n){const o=n?.layerGap??vo.DEFAULT_LAYER_GAP,s=n?.nodeGap??vo.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,l=n?.direction??"TB",f=l==="LR"||l==="RL",u=t.layers,g=Object.create(null),b=Object.create(null),p=a(O=>e.nodeById.get(O),"getNode"),v=a(O=>p(O)?.width??0,"getWidth"),d=a(O=>p(O)?.height??0,"getHeight"),h=le(e),i=ho(e,n?.laneOrder),y=u.map(O=>O.reduce((F,D)=>Math.max(F,d(D)),0)),L=[];if(f)for(let O=0;O+1<u.length;O++){const F=u[O].reduce((pt,kt)=>Math.max(pt,v(kt)),0),D=u[O+1].reduce((pt,kt)=>Math.max(pt,v(kt)),0),B=y[O],G=y[O+1],j=B/2+G/2,Z=(F+D)/2,dt=Math.max(0,Z-j-o);L.push(dt)}const I=new Set;for(const O of u)for(const F of O)I.add(h(F));const E=I.has(null),T=i.filter(O=>I.has(O)),m=[...E?[null]:[],...T],M=Object.create(null);for(const O of T)M[O]=0;E&&(M.null=0);for(const O of u){const F=Object.create(null),D=[];for(const B of O){const G=h(B);G===null?D.push(B):(F[G]||=[]).push(B)}for(const[B,G]of Object.entries(F)){const j=G.reduce((Z,dt)=>Z+v(dt),0)+s*Math.max(0,G.length-1);M[B]=Math.max(M[B]??0,j)}if(E&&D.length){const B=D.reduce((G,j)=>G+v(j),0)+s*Math.max(0,D.length-1);M.null=Math.max(M.null??0,B)}}const A=new Map;{const O=m.map(B=>(B===null?M.null:M[B])??0);let D=-(O.reduce((B,G)=>B+G,0)+r*Math.max(0,m.length-1))/2;for(let B=0;B<m.length;B++){const G=m[B],j=O[B]??0,Z=D+j/2;A.set(G,Z),D+=j,B<m.length-1&&(D+=r)}}let R=0;for(const[O,F]of u.entries()){const D=y[O]??0,B=new Map;for(const j of F){const Z=h(j),dt=B.get(Z)??[];dt.push(j),B.set(Z,dt)}for(const j of m){const Z=B.get(j)??[];if(Z.length===0)continue;const dt=A.get(j);if(Z.length===1){const pt=Z[0];g[pt]=dt,b[pt]=R+D/2}else{const pt=Z.map(Q=>v(Q)),kt=pt.reduce((Q,W)=>Q+W,0)+s*(Z.length-1);let Bt=dt-kt/2;for(const[Q,W]of Z.entries()){const et=pt[Q];g[W]=Bt+et/2,b[W]=R+D/2,Bt+=et+s}}}const G=L[O]??0;R+=D+o+G}const k=new Map;for(const O of e.edges){const F=O.ref.id;k.has(F)||k.set(F,[]),k.get(F).push(O)}for(const[,O]of k){if(O.length===0)continue;const F=O[0].ref,D=F.start,B=F.end;if(D==null||B==null)continue;const G=Math.round(((g[D]??0)+(g[B]??0))/2),j=new Set;for(const Z of O)j.add(Z.src),j.add(Z.dst);for(const Z of j){if(Z===D||Z===B)continue;e.nodeById.get(Z)?.isDummy&&(g[Z]=G)}}return{x:g,y:b}}a(Bs,"assignCoordinates");var Ps=8;function ks(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}a(ks,"hashString");function Fs(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}a(Fs,"mulberry32");function _s(t,e){const n=[...t],o=Fs(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}a(_s,"deterministicShuffle");function Hs(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}a(Hs,"sourceDistance");function Vn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:l}of e){const f=n.get(s),u=n.get(r);f==null||u==null||(o+=l*Math.abs(f-u))}return o}a(Vn,"laneArrangementCost");function Ds(t){const e=nn(t);if(e.length<2)return[];const n=new Map(e.map((r,l)=>[r,l])),o=le(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const l=typeof r.start=="string"?r.start:void 0,f=typeof r.end=="string"?r.end:void 0;if(!l||!f||!t.nodeById.has(l)||!t.nodeById.has(f))continue;const u=o(l),g=o(f);if(!u||!g||u===g)continue;const b=n.get(u),p=n.get(g);if(b==null||p==null)continue;const[v,d]=b<=p?[u,g]:[g,u],h=`${v}\0${d}`,i=s.get(h);i?i.weight++:s.set(h,{a:v,b:d,weight:1})}return[...s.values()]}a(Ds,"buildWeightedLaneEdges");function jn(t,e,n){const o=[...t];let s=Vn(o,e),r=!0,l=0;const f=Math.max(1,o.length);for(;r&&l<f;){r=!1,l++;for(let u=0;u+1<o.length;u++){[o[u],o[u+1]]=[o[u+1],o[u]];const g=Vn(o,e);g<s?(s=g,r=!0):[o[u],o[u+1]]=[o[u+1],o[u]]}}return{order:o,cost:s,sourceDistance:Hs(o,n)}}a(jn,"greedySwitch");function Xs(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}a(Xs,"isBetterCandidate");function Ys(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:l})=>`${s}:${r}:${l}`).join("|");return ks(`${t.join("|")}#${o}#${n}`)}a(Ys,"seedForRestart");function Gs(t,e={}){const n=nn(t);if(n.length<2)return n;const o=Ds(t);if(o.length===0)return n;const s=new Map(n.map((f,u)=>[f,u]));let r=jn(n,o,s);const l=Math.max(0,e.restarts??Ps);for(let f=0;f<l;f++){const u=Ys(n,o,f),g=_s(n,u),b=jn(g,o,s);Xs(b,r)&&(r=b)}return r.order}a(Gs,"optimizeTopLaneOrder");function zs(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=pe(t),r=e?.automaticLaneOrdering?Gs(s,{restarts:Ps}):void 0,l=ls(s),f=l.acyclic,u=n?Es(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Ts(f,{compactSingleInput:e?.compactSingleInput??qe.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:g,graphWithDummies:b}=As(u,f),p=Os(g,b,{laneOrder:r}),v=Bs(p,b,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:f,reversed:l.reversed,layering:g,ordered:p,coordinates:v}}a(zs,"sugiyamaLayout");var ct=gr.EPSILON,mr=8,xe=15,Te=15,Xe=25,ne=20,pn=10;function Un(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,l=e.y-s,f=Math.abs(r),u=Math.abs(l);return f<ct&&u<ct?n:u>ct&&u*3>=f?l>0?"bottom":"top":f>ct?r>0?"right":"left":n}a(Un,"chooseOrthogonalSide");function Wn(t,e){return Math.abs(t.to-e.from)<ct||Math.abs(t.to-e.to)<ct?t.to:t.from}a(Wn,"sharedLineEndpointCoord");function be(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}a(be,"pointOnLine");function $s(t,e){const n=t.nodes??[],o=t.edges??[],s=[];for(const c of o)c.isLayoutOnly||s.push({...c,__originalEdge:c});const r=new Map,l=new Map,f=[],u=e==="LR";for(const c of n)r.set(c.id,c);const g=n.filter(c=>c.isGroup&&!c.parentId);for(const c of g){const x={id:c.id},S=a(C=>{l.set(C.id,x),n.filter(w=>w.parentId===C.id).forEach(S)},"assignLane");S(c)}const b=n.filter(c=>!c.isGroup&&!c.isEdgeLabel).map(c=>{const x=c.width??10,S=c.height??10,C=c.x??0,w=c.y??0,P=mr;return{nodeId:c.id,minX:C-x/2-P,maxX:C+x/2+P,minY:w-S/2-P,maxY:w+S/2+P,visualXHalfExtent:u?S/2+P:x/2+P}}),p=a((c,x,S,C)=>{let w=f.find(P=>P.orientation===c&&Math.abs(P.coord-x)<1);return w||(w={id:`pipe-${c}-${x.toFixed(0)}`,orientation:c,coord:x,spanMin:S,spanMax:C,tracks:[]},f.push(w)),w.spanMin=Math.min(w.spanMin,S),w.spanMax=Math.max(w.spanMax,C),w},"getOrAddPipe"),v=a((c,x)=>{const S=c.width??10,C=c.height??10,w=c.x??0,P=c.y??0;switch(x){case"top":return{x:w,y:P-C/2};case"bottom":return{x:w,y:P+C/2};case"left":return{x:w-S/2,y:P};case"right":return{x:w+S/2,y:P}}},"portForSide"),d=a((c,x,S)=>v(c,Un(c,x,S?"bottom":"top")),"getOrthogonalPort"),h=[],i=[],y=new Set,L=1e3,I=a((c,x,S)=>{if(h.length===0)return 0;const C=Math.abs(x.y-S.y)<ct,w=Math.abs(x.x-S.x)<ct;if(!C&&!w)return 0;let P=0;if(C){const U=x.y,q=Math.min(x.x,S.x)-ct,$=Math.max(x.x,S.x)+ct;if($<=q)return 0;for(const Y of h)Y.edgeIndex===c||Y.orientation!=="vertical"||Y.pipe.coord<q||Y.pipe.coord>$||Y.from-ct<=U&&Y.to+ct>=U&&(P+=L)}else if(w){const U=x.x,q=Math.min(x.y,S.y)-ct,$=Math.max(x.y,S.y)+ct;if($<=q)return 0;for(const Y of h)Y.edgeIndex===c||Y.orientation!=="horizontal"||Y.pipe.coord<q||Y.pipe.coord>$||Y.from-ct<=U&&Y.to+ct>=U&&(P+=L)}return P},"crossingPenalty"),E=s.map((c,x)=>{if(!c.start||!c.end)return{idx:x,crossLane:0,dx:0,dy:0};const S=r.get(c.start),C=r.get(c.end),w=l.get(c.start),P=l.get(c.end),U=w&&P&&w.id!==P.id?1:0,q=S&&C?Math.abs((C.x??0)-(S.x??0)):0,$=S&&C?Math.abs((C.y??0)-(S.y??0)):0;return{idx:x,crossLane:U,dx:q,dy:$}}).sort((c,x)=>{if(c.crossLane!==x.crossLane)return x.crossLane-c.crossLane;const S=c.dx+c.dy,C=x.dx+x.dy;return Math.abs(S-C)>1?S-C:c.idx-x.idx}).map(c=>c.idx),T=a((c,x,S,C)=>{const w=Math.min(c.x,x.x),P=Math.max(c.x,x.x),U=Math.min(c.y,x.y),q=Math.max(c.y,x.y);return!!b.find(Y=>S&&Y.nodeId===S||C&&Y.nodeId===C?!1:Math.abs(c.x-x.x)>ct?Y.minY<c.y&&Y.maxY>c.y&&Y.maxX>w&&Y.minX<P:Y.minX<c.x&&Y.maxX>c.x&&Y.maxY>U&&Y.minY<q)},"isSegmentBlocked"),m=new Map,M=new Map;for(const c of s)!c.start||!c.end||c.start===c.end||(M.set(c.start,(M.get(c.start)??0)+1),M.set(c.end,(M.get(c.end)??0)+1));const A=a((c,x)=>Un(c,x,"bottom"),"determineSide"),R=new Map;for(const[c,x]of s.entries()){if(!x.start||!x.end||x.start===x.end||x.points&&x.points.length>0)continue;const S=r.get(x.start),C=r.get(x.end);if(!S||!C)continue;const w=(C.x??0)-(S.x??0),P=(C.y??0)-(S.y??0);R.set(c,{edgeIdx:c,srcId:x.start,dstId:x.end,srcSide:A(S,{x:C.x??0,y:C.y??0}),dstSide:A(C,{x:S.x??0,y:S.y??0}),absDx:Math.abs(w),absDy:Math.abs(P),dxSign:Math.sign(w),dySign:Math.sign(P)})}const k=a(c=>c.srcSide==="top"||c.srcSide==="bottom"?c.absDx===0?1/0:c.absDy/c.absDx:c.absDy===0?1/0:c.absDx/c.absDy,"preferenceStrength"),O=a(c=>c.srcSide==="top"||c.srcSide==="bottom"?c.dxSign>=0?"right":"left":c.dySign>=0?"bottom":"top","secondarySide"),F=new Map;for(const c of R.values()){const x=`${c.srcId}:${c.srcSide}`;F.has(x)||F.set(x,[]),F.get(x).push(c)}const D=new Map,B=a((c,x)=>`${c}:${x}`,"loadKey");for(const c of R.values())D.set(B(c.srcId,c.srcSide),(D.get(B(c.srcId,c.srcSide))??0)+1),D.set(B(c.dstId,c.dstSide),(D.get(B(c.dstId,c.dstSide))??0)+1);for(const c of F.values())if(!(c.length<2)){c.sort((x,S)=>{const C=k(x),w=k(S);return Math.abs(C-w)>1e-9?w-C:x.edgeIdx-S.edgeIdx});for(let x=1;x<c.length;x++){const S=c[x],C=O(S),w=D.get(B(S.srcId,S.srcSide))??0,P=D.get(B(S.srcId,C))??0;P>=w||(D.set(B(S.srcId,S.srcSide),w-1),D.set(B(S.srcId,C),P+1),S.srcSide=C)}}const G=a(c=>{const x=c?.shape;return x==="question"||x==="diamond"},"isDiamondNode"),j=new Map;for(const c of R.values())j.has(c.dstId)||j.set(c.dstId,new Set),j.get(c.dstId).add(c.dstSide);for(const c of R.values()){if(!G(r.get(c.srcId)))continue;const x=j.get(c.srcId);if(!x?.has(c.srcSide))continue;const S=O(c);if(x.has(S)||(D.get(B(c.srcId,S))??0)>0)continue;const C=D.get(B(c.srcId,c.srcSide))??0;D.set(B(c.srcId,c.srcSide),Math.max(0,C-1)),D.set(B(c.srcId,S),1),c.srcSide=S}for(const c of R.values()){const{edgeIdx:x,srcId:S,dstId:C,srcSide:w,dstSide:P}=c,U=r.get(S),q=r.get(C),$=`${S}:${w}:src`,Y=w==="top"||w==="bottom"?q.x??0:q.y??0;m.has($)||m.set($,[]),m.get($).push({edgeIdx:x,oppositeCoord:Y});const ot=`${C}:${P}:dst`,rt=P==="top"||P==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:x,oppositeCoord:rt})}const Z=new Map,dt=8;for(const[c,x]of m){if(x.length<2)continue;x.sort((Lt,Ht)=>Lt.oppositeCoord-Ht.oppositeCoord);const S=c.split(":"),C=S.slice(0,-2).join(":"),w=S[S.length-2],P=S[S.length-1],U=r.get(C);if(!U)continue;const $=w==="left"||w==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?$*.3:$,tt=Math.min(20,Math.max(dt,rt/(x.length+1))),Rt=-(tt*(x.length-1))/2;for(const[Lt,Ht]of x.entries()){const Zt=Rt+Lt*tt,cn=`${Ht.edgeIdx}:${P}`;Z.set(cn,Zt)}}const pt=a(c=>!!s[c]?.labelNodeId,"edgeHasLabelNode"),kt=a((c,x)=>c?(m.get(`${c}:${x}:src`)??[]).some(({edgeIdx:S})=>pt(S))||(m.get(`${c}:${x}:dst`)??[]).some(({edgeIdx:S})=>pt(S)):!1,"faceHasLabelNode"),Bt=a((c,x,S)=>x==="top"||x==="bottom"?{x:c.x+S,y:c.y}:{x:c.x,y:c.y+S},"applyPortOffset"),Q=a((c,x,S)=>{const C=R.get(c),w={x:S.x??0,y:S.y??0},P={x:x.x??0,y:x.y??0},U=C?.srcSide??A(x,w),q=C?.dstSide??A(S,P);let $=C?v(x,C.srcSide):d(x,w,!0),Y=C?v(S,C.dstSide):d(S,P,!1);const ot=Z.get(`${c}:src`),rt=Z.get(`${c}:dst`);return ot!==void 0&&($=Bt($,U,ot)),rt!==void 0&&(Y=Bt(Y,q,rt)),{pSrcPort:$,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const c of E){const x=s[c];if(i[c]=[],!x.start||!x.end||x.points&&x.points.length>0||x.start===x.end)continue;const S=r.get(x.start),C=r.get(x.end);if(!S||!C)continue;const{pSrcPort:w,pDstPort:P,srcSide:U,dstSide:q}=Q(c,S,C),$={...w},Y={...P},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=w.y>(S.y??0);$.y=X?w.y+ne:w.y-ne}else{const X=w.x>(S.x??0);$.x=X?w.x+ne:w.x-ne}if(rt){const X=P.y>(C.y??0);Y.y=X?P.y+ne:P.y-ne}else{const X=P.x>(C.x??0);Y.x=X?P.x+ne:P.x-ne}const st=a((X,z)=>{for(const K of b)if(!z.includes(K.nodeId)&&X.x>K.minX&&X.x<K.maxX&&X.y>K.minY&&X.y<K.maxY)return{inside:!0,obstacle:K};return{inside:!1}},"isPointInObstacle"),tt=a((X,z,K,lt,Ct)=>{if(Ct){const Nt=X.y>(z.y??0);return{x:(K.x??0)>=X.x?lt.maxX+xe:lt.minX-xe,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>(z.x??0),Tt=(K.y??0)>=X.y;return{x:bt?lt.maxX+xe:lt.minX-xe,y:Tt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[x.start,x.end],Lt=st($,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const z=tt(w,S,C,X,!0);$.x=z.x,$.y=z.y;const K=z.leavesPositiveSide?Math.min(X.minY-2,w.y+ne):Math.max(X.maxY+2,w.y-ne);yt=[{x:w.x,y:K},{x:z.x,y:K},{x:z.x,y:z.y}]}else{const z=tt(w,S,C,X,!1),K=z.leavesPositiveSide?Math.min(X.minX-2,w.x+ne):Math.max(X.maxX+2,w.x-ne);$.x=z.x,$.y=z.y,yt=[{x:K,y:w.y},{x:K,y:z.y},{x:z.x,y:z.y}]}}let Ht=[];const Zt=st(Y,Rt);if(Zt.inside&&Zt.obstacle){const X=Zt.obstacle;if(rt){const z=tt(P,C,S,X,!0);Y.x=z.x,Y.y=z.y,Ht=[{x:z.x,y:z.y},{x:P.x,y:z.y}]}else{const z=tt(P,C,S,X,!1);Y.x=z.x,Y.y=z.y,Ht=[{x:z.x,y:z.y},{x:z.x,y:P.y}]}}if(yt.length===0&&Ht.length===0){const X=xe,z=Math.abs($.x-Y.x)<X,K=Math.abs($.y-Y.y)<X,lt=Z.get(`${c}:src`)!==void 0||Z.get(`${c}:dst`)!==void 0,Ct=(m.get(`${x.start??""}:${U}:src`)?.length??0)+(m.get(`${x.start??""}:${U}:dst`)?.length??0),bt=(m.get(`${x.end??""}:${q}:src`)?.length??0)+(m.get(`${x.end??""}:${q}:dst`)?.length??0),Tt=Ct>1||bt>1,Nt=M.get(x.start??"")??0,ut=M.get(x.end??"")??0,Yt=Ct>1&&kt(x.start,U)||bt>1&&kt(x.end,q),ee=Ct<=1||Nt<=2,Pt=bt<=1||ut<=2;if((z||K)&&!lt&&(!Tt||Tt&&!Yt&&ee&&Pt)&&!T(w,P,x.start,x.end)){x.points=[{...w},{...$},{...Y},{...P}],y.add(c);const It=K?"horizontal":"vertical",zt=K?w.y:w.x,Mt=K?Math.min(w.x,P.x):Math.min(w.y,P.y),St=K?Math.max(w.x,P.x):Math.max(w.y,P.y),Wt={id:`fast-path-${It}-${zt.toFixed(0)}-${c}`,orientation:It,coord:zt,spanMin:Mt,spanMax:St,tracks:[]};h.push({edgeIndex:c,segmentIndex:0,orientation:It,pipe:Wt,trackIndex:0,from:Mt,to:St});continue}}const cn=p("vertical",$.x,$.y,$.y);$.x=cn.coord;const Ws=p("vertical",Y.x,Y.y,Y.y);Y.x=Ws.coord;let de=Math.min($.x,Y.x)-50,ue=Math.max($.x,Y.x)+50,Ce=Math.min($.y,Y.y)-50,ve=Math.max($.y,Y.y)+50;for(const X of b){const z=Math.min($.x,Y.x),K=Math.max($.x,Y.x),lt=Math.min($.y,Y.y),Ct=Math.max($.y,Y.y);X.minX<K&&X.maxX>z&&X.minY<Ct&&X.maxY>lt&&(de=Math.min(de,X.minX-Xe),ue=Math.max(ue,X.maxX+Xe),Ce=Math.min(Ce,X.minY-Xe),ve=Math.max(ve,X.maxY+Xe))}for(const X of b){if(X.maxX<de||X.minX>ue||X.maxY<Ce||X.minY>ve)continue;const z=xe;p("horizontal",X.minY-z,de,ue),p("horizontal",X.maxY+z,de,ue);const K=Te;p("vertical",X.minX-K,Ce,ve),p("vertical",X.maxX+K,Ce,ve)}p("horizontal",$.y,de,ue),p("horizontal",Y.y,de,ue);const Ks=f.filter(X=>X.orientation==="horizontal"&&X.coord>=Ce&&X.coord<=ve),qs=f.filter(X=>X.orientation==="vertical"&&X.coord>=de&&X.coord<=ue),Oe=a((X,z)=>`${X.toFixed(1)},${z.toFixed(1)}`,"getKey"),Be=Oe($.x,$.y),mo=Oe(Y.x,Y.y),Pe=new Map,an=new Map,ln=new Map,ke=new Set,ye=[];Pe.set(Be,0),ln.set(Be,"n"),ye.push({key:Be,f:Math.hypot(Y.x-$.x,Y.y-$.y),pt:$}),ke.add(Be);let Dt=[];const he=a((X,z)=>T(X,z,x.start,x.end),"checkSegmentBlocked"),fn={x:Y.x,y:$.y},Zs=he($,fn),Js=he(fn,Y),Qs=Zs||Js,dn={x:$.x,y:Y.y},tr=he($,dn),er=he(dn,Y);if(Qs?tr||er||(Math.abs($.x-Y.x)<ct?Dt=[$,Y]:Dt=[$,dn,Y]):Math.abs($.y-Y.y)<ct||Math.abs($.x-Y.x)<ct?Dt=[$,Y]:Dt=[$,fn,Y],Dt.length===0)for(;ye.length>0;){ye.sort((ut,Yt)=>ut.f-Yt.f);const X=ye.shift();if(ke.delete(X.key),X.key===mo){let ut=mo,Yt=Y;for(Dt=[Yt];an.has(ut);){const ee=an.get(ut);Dt.unshift(ee),Yt=ee,ut=Oe(ee.x,ee.y)}break}const z=X.pt.x,K=X.pt.y,lt=qs.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-z)<1),bt=Ks.sort((ut,Yt)=>ut.coord-Yt.coord),Tt=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct<lt.length-1&&Nt.push({x:lt[Ct+1].coord,y:K}),Tt>0&&Nt.push({x:z,y:bt[Tt-1].coord}),Tt>=0&&Tt<bt.length-1&&Nt.push({x:z,y:bt[Tt+1].coord});for(const ut of Nt){const Yt=Math.min(z,ut.x),ee=Math.max(z,ut.x),Pt=Math.min(K,ut.y),Gt=Math.max(K,ut.y);if(b.some(Jt=>Jt.nodeId===x.start||Jt.nodeId===x.end?!1:Yt!==ee?Jt.minY<K&&Jt.maxY>K&&Jt.maxX>Yt&&Jt.minX<ee:Jt.minX<z&&Jt.maxX>z&&Jt.maxY>Pt&&Jt.minY<Gt))continue;const It=Oe(ut.x,ut.y),zt=Math.abs(ut.x-z)+Math.abs(ut.y-K),Mt=I(c,X.pt,ut);let St=0;const Wt=Y.x-$.x,Le=Y.y-$.y,Fe=ut.x-z,un=ut.y-K;(Le>10&&un<-5||Le<-10&&un>5)&&(St=Math.abs(un)*100),(Wt>10&&Fe<-5||Wt<-10&&Fe>5)&&(St+=Math.abs(Fe)*50);let po=0;const yo=ln.get(X.key)??"n",xo=Math.abs(Fe)>ct?"h":"v";yo!=="n"&&yo!==xo&&(po=50);const nr=zt+Mt+St+po,_e=(Pe.get(X.key)??1/0)+nr,bo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(_e<(Pe.get(It)??1/0))if(an.set(It,X.pt),Pe.set(It,_e),ln.set(It,xo),!ke.has(It))ye.push({key:It,f:_e+bo,pt:ut}),ke.add(It);else{const Jt=ye.findIndex(or=>or.key===It);Jt!==-1&&(ye[Jt].f=_e+bo)}}}if(Dt.length===0&&(Dt=[$,{x:$.x,y:Y.y},Y]),Dt.length>4){const X=Dt[0],z=Dt[Dt.length-1];let K=Math.min(X.x,z.x),lt=Math.max(X.x,z.x),Ct=Math.min(X.y,z.y),bt=Math.max(X.y,z.y);for(const Pt of Dt)K=Math.min(K,Pt.x),lt=Math.max(lt,Pt.x),Ct=Math.min(Ct,Pt.y),bt=Math.max(bt,Pt.y);const Tt=lt>Math.max(X.x,z.x),Nt=K<Math.min(X.x,z.x);if(u){const Pt=Te;if(Tt){const Gt=Math.max(X.x,z.x),Ot=Math.min(X.y,z.y),It=Math.max(X.y,z.y),zt=b.filter(Mt=>Mt.minX<Gt&&Mt.maxX>Gt&&Mt.minY<It&&Mt.maxY>Ot);if(zt.length>0){let Mt=Math.max(X.x,z.x);for(const St of zt){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Le=Wt+St.visualXHalfExtent+Pt;Mt=Math.max(Mt,Le)}isNaN(Mt)||(lt=Mt)}}if(Nt){const Gt=b.filter(Ot=>Ot.minX<Math.min(X.x,z.x)+Pt&&Ot.minY<Math.max(X.y,z.y)&&Ot.maxY>Math.min(X.y,z.y));if(Gt.length>0){let Ot=Math.min(X.x,z.x);for(const It of Gt){const Mt=(It.minX+It.maxX)/2-It.visualXHalfExtent-Pt;Ot=Math.min(Ot,Mt)}K=Ot}}}const ut=a(Pt=>{const Gt=z.y>X.y,Ot=b.filter(Mt=>{const St=Math.min(X.x,z.x)<Mt.maxX&&Math.max(X.x,z.x)>Mt.minX,Wt=Math.min(X.y,z.y)<Mt.maxY&&Math.max(X.y,z.y)>Mt.minY;return St&&Wt});let It=Ot;if(u&&Ot.length>0){const Mt=Ot.filter(St=>St.minX<Pt&&St.maxX>Pt);Mt.length>0&&(It=Mt)}if(It.length===0)return z.y;const zt=xe;if(Gt){const St=Math.max(...It.map(Wt=>Wt.maxY))+zt;if(St<z.y-ct)return St}else{const St=Math.min(...It.map(Wt=>Wt.minY))-zt;if(St>z.y+ct)return St}return z.y},"findBestReturnY"),Yt=a(Pt=>{const Gt=ut(Pt),Ot={x:Pt,y:X.y},It={x:Pt,y:Gt},zt={x:z.x,y:Gt},Mt=he(X,Ot),St=he(Ot,It),Wt=he(It,zt),Le=Gt!==z.y?he(zt,z):!1;return!Mt&&!St&&!Wt&&!Le?Math.abs(Gt-z.y)<ct?[X,Ot,It,z]:[X,Ot,It,zt,z]:null},"trySimplifyWithDetourX"),ee=Tt&&!Nt?Yt(lt):Nt&&!Tt?Yt(K):null;ee&&(Dt=ee)}const Xt=[w,...yt,...Dt,...Ht.reverse(),P];if(Xt.length>=3){const X=Xt[Xt.length-1],z=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-z.y)<ct&&Math.abs(z.y-X.y)<ct,Ct=Math.abs(K.x-z.x)<ct&&Math.abs(z.x-X.x)<ct;if(lt){const bt=Math.sign(z.x-K.x),Tt=Math.sign(X.x-K.x);bt!==0&&bt===Tt&&Math.abs(z.x-K.x)>Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign(z.y-K.y),Tt=Math.sign(X.y-K.y);bt!==0&&bt===Tt&&Math.abs(z.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const re=[Xt[0]];for(let X=1;X<Xt.length-1;X++){if(X===1){re.push(Xt[X]);continue}const z=re[re.length-1],K=Xt[X],lt=Xt[X+1];if(Math.abs(z.y-K.y)<ct&&Math.abs(K.y-lt.y)<ct){const Ct=K.x>z.x,bt=lt.x>K.x;if(Ct!==bt){re.push(K);continue}continue}if(Math.abs(z.x-K.x)<ct&&Math.abs(K.x-lt.x)<ct){const Ct=K.y>z.y,bt=lt.y>K.y;if(Ct!==bt){re.push(K);continue}continue}re.push(K)}re.push(Xt[Xt.length-1]);for(let X=0;X<re.length-1;X++){const z=re[X],K=re[X+1],lt=Math.abs(z.x-K.x)<ct?"vertical":"horizontal",Ct=lt==="vertical"?z.x:z.y,bt=lt==="vertical"?Math.min(z.y,K.y):Math.min(z.x,K.x),Tt=lt==="vertical"?Math.max(z.y,K.y):Math.max(z.x,K.x),Nt=p(lt,Ct,bt,Tt),ut={edgeIndex:c,segmentIndex:X,orientation:lt,pipe:Nt,trackIndex:0,from:bt,to:Tt};h.push(ut),i[c].push(h.length-1),Nt.tracks[0]||(Nt.tracks[0]={index:0,coord:Nt.coord,segments:[]}),Nt.tracks[0].segments.push({edgeIndex:c,segmentIndex:X,from:bt,to:Tt})}}const W=a((c,x)=>c.from<x.to&&x.from<c.to,"segmentsOverlap"),et=a((c,x,S,C)=>{const w=!C.segments.some(U=>(U.edgeIndex!==x.edgeIndex||U.segmentIndex!==x.segmentIndex)&&W(U,c)),P=!S.segments.some(U=>(U.edgeIndex!==c.edgeIndex||U.segmentIndex!==c.segmentIndex)&&W(U,x));return w&&P?(c.trackIndex=C.index,x.trackIndex=S.index,S.segments=[...S.segments.filter(U=>U.edgeIndex!==c.edgeIndex||U.segmentIndex!==c.segmentIndex),{edgeIndex:x.edgeIndex,segmentIndex:x.segmentIndex,from:x.from,to:x.to}],C.segments=[...C.segments.filter(U=>U.edgeIndex!==x.edgeIndex||U.segmentIndex!==x.segmentIndex),{edgeIndex:c.edgeIndex,segmentIndex:c.segmentIndex,from:c.from,to:c.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=a(c=>{const x=c.tracks.length;return c.tracks[x]={index:x,coord:c.coord,segments:[]},x},"createNewTrack"),gt=a((c,x)=>{const S=c.pipe.tracks[c.trackIndex];S.segments=S.segments.filter(w=>w.edgeIndex!==c.edgeIndex||w.segmentIndex!==c.segmentIndex),c.trackIndex=x,c.pipe.tracks[x].segments.push({edgeIndex:c.edgeIndex,segmentIndex:c.segmentIndex,from:c.from,to:c.to})},"moveSegmentToTrack"),xt=a((c,x)=>{const S=i[c.edgeIndex];for(const C of S){const w=h[C];w.pipe===c.pipe&>(w,x)}},"moveSegmentChainToTrack"),vt=a(c=>{const x=i[c.edgeIndex],S=x.indexOf(h.indexOf(c)),C=[];return S>0&&C.push(h[x[S-1]]),S<x.length-1&&C.push(h[x[S+1]]),C},"getAdjacentSegmentsAlongEdge"),Vt=a((c,x)=>{if(c.orientation===x.orientation)return!1;const S=c.orientation==="horizontal"?c:x,C=c.orientation==="horizontal"?x:c;return C.pipe.coord>S.from&&C.pipe.coord<S.to&&S.pipe.coord>C.from&&S.pipe.coord<C.to},"haveAnyCrossing"),jt=a((c,x)=>{for(const S of c.tracks)if(!S.segments.some(w=>(w.edgeIndex!==x.edgeIndex||w.segmentIndex!==x.segmentIndex)&&W(w,x)))return S.index;return-1},"findAvailableTrack"),Ut=a((c,x)=>{if(c.trackIndex===x.trackIndex)return W(c,x);const S=vt(c),C=vt(x);return S.some(w=>C.some(P=>Vt(w,P)))},"segmentsConflict"),te=a((c,x,S)=>{if(et(c,x,c.pipe.tracks[c.trackIndex],x.pipe.tracks[x.trackIndex]))return;const C=jt(c.pipe,x);S(x,C!==-1?C:at(c.pipe))},"resolveTrackConflict"),Me=a(c=>{let x=0;for(let S=0;S<c.length;S++)for(let C=S+1;C<c.length;C++){const w=c[S],P=c[C];w.pipe===P.pipe&&Ut(w,P)&&(x++,te(w,P,xt))}return x},"resolveHandleConflicts"),fe=new Map,Se=a(c=>{if(fe.has(c))return fe.get(c);const x=i[c];if(x.length===0){const q={dest:0,deviation:0,base:0,delta:0};return fe.set(c,q),q}const C=h[x[0]].pipe.coord;let w=C;for(let q=1;q<x.length;q++){const $=h[x[q]];if($.orientation==="horizontal"){const Y=$.from,ot=$.to;w=Math.abs(Y-C)>Math.abs(ot-C)?Y:ot;break}}const P=Math.abs(w-C),U={dest:w,deviation:P,base:C,delta:w-C};return fe.set(c,U),U},"getDestInfo"),on=a(()=>{let c=0;const x=new Map;for(const[C,w]of s.entries())i[C].length!==0&&w.start&&(x.has(w.start)||x.set(w.start,[]),x.get(w.start).push(C));const S=a(C=>{const w=s[C];if(!w.start||!w.end)return 0;const P=r.get(w.start),U=r.get(w.end);if(!P||!U)return 0;const q=(U.x??0)-(P.x??0),$=(U.y??0)-(P.y??0);return Math.abs(q)+Math.abs($)},"getEdgeDistance");for(const C of x.values()){C.sort((P,U)=>{const q=Se(P),$=Se(U);if(Math.abs(q.deviation-$.deviation)>1)return q.deviation-$.deviation;if(Math.abs(q.dest-$.dest)>1)return q.dest-$.dest;const Y=S(P),ot=S(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=i[P].length,st=i[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=i[P][0],yt=i[U][0];if(h[tt]&&h[yt]){const Rt=h[tt],Lt=h[yt],Ht=Math.abs(Rt.to-Rt.from),Zt=Math.abs(Lt.to-Lt.from);if(Math.abs(Ht-Zt)>1)return Ht-Zt}}return 0});const w=C.map(P=>h[i[P][0]]);c+=Me(w)}return c},"fixSourceHandleCrossings"),sn=a(()=>{let c=0;const x=new Map;for(const[S,C]of s.entries())i[S].length!==0&&C.end&&(x.has(C.end)||x.set(C.end,[]),x.get(C.end).push(S));for(const S of x.values()){S.sort((w,P)=>{const U=a(Y=>{const ot=i[Y];if(ot.length<2)return 0;const rt=h[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(w),$=U(P);return Math.abs(q-$)>.1?q-$:w-P});const C=S.map(w=>h[i[w][i[w].length-1]]);c+=Me(C)}return c},"fixTargetHandleCrossings"),rn=a(()=>{let c=0;for(const x of f){const S=[];for(const C of x.tracks)for(const w of C.segments){const P=i[w.edgeIndex].find(U=>h[U].segmentIndex===w.segmentIndex);P!==void 0&&S.push(h[P])}S.sort((C,w)=>C.edgeIndex-w.edgeIndex||C.segmentIndex-w.segmentIndex);for(let C=0;C<S.length;C++)for(let w=C+1;w<S.length;w++){const P=S[C],U=S[w];Ut(P,U)&&(c++,te(P,U,gt))}}return c},"fixPipeCrossings");let N=0;const _=10;for(;N<_;){let c=0;if(c+=on(),c+=sn(),c+=rn(),c===0)break;N++}const H=new Map;for(const c of f){const x=[];c.tracks.forEach(C=>{C.segments.forEach(w=>{x.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:C.index,from:w.from,to:w.to})})}),x.sort((C,w)=>C.from-w.from);const S=[];if(x.length>0){let C=[x[0]],w=x[0].to;for(let P=1;P<x.length;P++){const U=x[P];U.from<w?(C.push(U),w=Math.max(w,U.to)):(S.push(C),C=[U],w=U.to)}S.push(C)}for(const C of S){const w=new Set;C.forEach(tt=>w.add(tt.trackIndex));const P=new Map;C.forEach(tt=>{const yt=Se(tt.edgeIndex);P.set(tt.trackIndex,(P.get(tt.trackIndex)??0)+yt.delta)});const U=[...w].filter(tt=>(P.get(tt)??0)<-1),q=[...w].filter(tt=>(P.get(tt)??0)>1),$=[...w].filter(tt=>Math.abs(P.get(tt)??0)<=1);U.sort((tt,yt)=>(P.get(yt)??0)-(P.get(tt)??0)),q.sort((tt,yt)=>(P.get(tt)??0)-(P.get(yt)??0));const Y=a((tt,yt)=>{C.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?c.coord:yt;H.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,c.coord-ot*pn);if($.length===0&&w.size>0){const tt=[...w].sort((Lt,Ht)=>Math.abs(P.get(Lt)??0)-Math.abs(P.get(Ht)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),$.push(tt)}let rt=0;for(const tt of $){if(rt===0)Y(tt,c.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,c.coord+yt*Rt*pn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,c.coord+st*pn)}}for(const[c,x]of s.entries()){const S=i[c]??[];if(S.length===0)continue;const C=[],w=r.get(x.start),P=r.get(x.end),{pSrcPort:U,pDstPort:q}=Q(c,w,P),$=S.map(rt=>{const st=h[rt],tt=H.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});C.push(U);for(let rt=0;rt<$.length;rt++){const st=$[rt],tt=C[C.length-1],yt=st.orient==="vertical"?tt.y:tt.x,Rt=st.orient==="vertical"?tt.x:tt.y,Lt=$[rt+1],Ht=rt<$.length-1;if(Math.abs(Rt-st.coord)>ct&&C.push(be(st,yt)),Ht&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Zt=st.orient==="vertical"?(yt+Lt.from)/2:Wn(st,Lt);C.push(be(st,Zt),be(Lt,Zt))}else(rt===0||rt===$.length-2)&&C.push(be(st,Wn(st,Lt)));else if(Ht)C.push(be(st,Lt.coord));else{const Zt=Math.abs(st.from-yt)<Math.abs(st.to-yt)?st.to:st.from;C.push(be(st,Zt))}}const Y=C[C.length-1];(Math.abs(Y.x-q.x)>ct||Math.abs(Y.y-q.y)>ct)&&C.push(q);const ot=[];C.length>0&&ot.push(C[0]);for(let rt=1;rt<C.length;rt++){const st=C[rt],tt=ot[ot.length-1];(Math.abs(st.x-tt.x)>ct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}x.points=ot}for(const c of s){const x=c.__originalEdge;x&&c.points&&(x.points=c.points)}t.edges=(t.edges??[]).filter(c=>!c.isLayoutOnly);const V=a((c,x)=>{const S=x.x??0,C=x.y??0,w=x.width??0,P=x.height??0;if(w<=0||P<=0)return c;const U=S-w/2,q=S+w/2,$=C-P/2,Y=C+P/2;if(c.x<U||c.x>q||c.y<$||c.y>Y)return c;const ot=c.x-U,rt=q-c.x,st=c.y-$,tt=Y-c.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:c.y}:yt===rt?{x:q,y:c.y}:yt===st?{x:c.x,y:$}:{x:c.x,y:Y}},"nodeBoundaryClamp");for(const c of t.edges){const x=c.points;if(!x||x.length<2)continue;const S=c.start,C=c.end,w=S?r.get(S):void 0,P=C?r.get(C):void 0;w&&(x[0]=V(x[0],w)),P&&(x[x.length-1]=V(x[x.length-1],P))}return t}a($s,"routeEdgesOrthogonal");function Vs(t){return t.direction??"TB"}a(Vs,"getSwimlaneDirection");function js(t){const e=Eo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,l=t.config.swimlane?.automaticLaneOrdering??!1,f=Vs(t),{ordered:u,coordinates:g}=zs(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:l,direction:f});Ao(e,u,g,{nodeGap:n,layerGap:o});for(const b of t.edges??[])delete b.points;$s(t,f);for(const b of t.edges??[])(!b.curve||b.curve==="basis")&&(b.curve="rounded");return cs(t,f),is(t),f}a(js,"runSwimlaneLayoutCore");function Us(t){wo(t);const e=Ro(t);t.nodes=e.nodes,t.edges=e.edges}a(Us,"prepareSwimlaneLayout");var vr=rr({prepareLayout:Us,runLayoutCore:js,afterPaint:Lo});export{vr as render};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{c as r,s as e}from"./flowDiagram-KWPJA3E3-DP-SrXc2.js";import{_ as o}from"./index-D-PvDSJs.js";import"./chunk-5VM5RSS4-BPto9x5-.js";import"./chunk-XXDRQBXY-DZnUPupk.js";import"./chunk-WEXAMYUT-DC9hisqc.js";import"./chunk-GWA4HPMP-C4N-dUua.js";import"./channel-BeMMNdGw.js";import"./vendor-editor-core-BG7M-EQ-.js";import"./vendor-editor-languages-pDmyn-oC.js";var a=o(t=>`${e(t)}
|
|
2
|
-
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
-
stroke: ${t.clusterBorder} !important;
|
|
4
|
-
}
|
|
5
|
-
[data-look="neo"].cluster rect {
|
|
6
|
-
filter: none;
|
|
7
|
-
}
|
|
8
|
-
`,"getStyles"),m=a,y=r({styles:m});export{y as diagram};
|