project-athena 0.1.0
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/LICENSE +21 -0
- package/README.md +247 -0
- package/dist/cli.js +8614 -0
- package/dist/cli.js.map +1 -0
- package/dist/web/assets/Editor-DmFaONG7.js +39 -0
- package/dist/web/assets/_basePickBy-QJXUw_pr.js +1 -0
- package/dist/web/assets/_baseUniq-DR4vVjyC.js +1 -0
- package/dist/web/assets/abnfDiagram-O67JEVCF-BEaDGLKl.js +1 -0
- package/dist/web/assets/arc-DgcGdgmL.js +1 -0
- package/dist/web/assets/architecture-7GRP2DOG-CHNxu4zI.js +1 -0
- package/dist/web/assets/architectureDiagram-NJMV4G6O-Cr_YqU4C.js +36 -0
- package/dist/web/assets/array-BifhSqXX.js +1 -0
- package/dist/web/assets/blockDiagram-BEXU5L5S-NA64lNxM.js +140 -0
- package/dist/web/assets/c4Diagram-YGBWAQC7-C9OZTI8T.js +38 -0
- package/dist/web/assets/channel-D_T5GGJX.js +1 -0
- package/dist/web/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
- package/dist/web/assets/chunk-3FUC2YCW-PivwegVV.js +2 -0
- package/dist/web/assets/chunk-5DYCD2WN-DH_dVKgx.js +1 -0
- package/dist/web/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
- package/dist/web/assets/chunk-742MDFTN-DTR6iTOw.js +1 -0
- package/dist/web/assets/chunk-7INBJB4K-XeJOzIDQ.js +62 -0
- package/dist/web/assets/chunk-7M6MHVWA-Bn-cXg0l.js +213 -0
- package/dist/web/assets/chunk-7PRAP22T-CPe5zfLc.js +1 -0
- package/dist/web/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
- package/dist/web/assets/chunk-FOHPRMQF-DzxwRta7.js +161 -0
- package/dist/web/assets/chunk-GTNCS2PH-DSn-mpqy.js +88 -0
- package/dist/web/assets/chunk-GWA4HPMP-DE4DJkth.js +1 -0
- package/dist/web/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
- package/dist/web/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
- package/dist/web/assets/chunk-MBY4JIJT-9uaOqseW.js +72 -0
- package/dist/web/assets/chunk-NETBCI7D-bxqe7jPe.js +1 -0
- package/dist/web/assets/chunk-O7XYJQB3-CjZQSnt8.js +126 -0
- package/dist/web/assets/chunk-UA2S7LBM-BfYbPxwY.js +1 -0
- package/dist/web/assets/chunk-WEXAMYUT-CT8bG5L7.js +1 -0
- package/dist/web/assets/chunk-XXDRQBXY-BvKO0v-W.js +1 -0
- package/dist/web/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
- package/dist/web/assets/chunk-Z7XXMR3K-CHWuLoFG.js +10 -0
- package/dist/web/assets/chunk-ZIGJFQKS-C6SOqBs6.js +2 -0
- package/dist/web/assets/classDiagram-v2-NBCMYWYE-CrSxkUNF.js +217 -0
- package/dist/web/assets/cose-bilkent-JH36ORCC-COXSdE6a.js +1 -0
- package/dist/web/assets/cynefin-OW5HDTMX-CMbTYwga.js +1 -0
- package/dist/web/assets/cynefinDiagram-VND7K2PF-B8wb03CF.js +62 -0
- package/dist/web/assets/cytoscape.esm-Yq6u8L66.js +321 -0
- package/dist/web/assets/dagre-6A5THRUB-Bz-BHtjW.js +4 -0
- package/dist/web/assets/defaultLocale-BFoDCU3G.js +1 -0
- package/dist/web/assets/diagram-22UHCM2B-C9M-mcex.js +200 -0
- package/dist/web/assets/diagram-3UASUU5V-q18RgATq.js +24 -0
- package/dist/web/assets/diagram-ATOU4E4O-zywdDXPc.js +3 -0
- package/dist/web/assets/diagram-CDSNMT55-BGMdofKO.js +30 -0
- package/dist/web/assets/diagram-MLGK6HIB-BdT0J6Xl.js +24 -0
- package/dist/web/assets/diagram-MPIPVDR6-BXdFmdOp.js +41 -0
- package/dist/web/assets/dist-B_J_HbC0.js +1 -0
- package/dist/web/assets/ebnfDiagram-ZINNZB2B-B7Mz8zd0.js +1 -0
- package/dist/web/assets/elk-276RUBZZ-CQ4lVw-r.js +27 -0
- package/dist/web/assets/erDiagram-OPXOYQCR-DmmZBLvC.js +99 -0
- package/dist/web/assets/eventmodeling-NTZA5JFV-BgPhBkRf.js +1 -0
- package/dist/web/assets/flowDiagram-KWPJA3E3-C3wNriu7.js +1 -0
- package/dist/web/assets/ganttDiagram-FUAMR5RP-B0egPzgH.js +292 -0
- package/dist/web/assets/gitGraph-4MIJSDKK-BdShI4JY.js +1 -0
- package/dist/web/assets/gitGraphDiagram-X574FWY7-jwG6nUmP.js +106 -0
- package/dist/web/assets/graphlib-C9Tl7QrK.js +1 -0
- package/dist/web/assets/index-BSiW3yI1.js +45 -0
- package/dist/web/assets/index-DKE3ojTe.css +1 -0
- package/dist/web/assets/info-A6RAGUB7-Hm3KO-lX.js +1 -0
- package/dist/web/assets/infoDiagram-VRGFBTTK-CdcggvNW.js +2 -0
- package/dist/web/assets/init-C-OQMol4.js +1 -0
- package/dist/web/assets/ishikawaDiagram-OU5B5YK6-C8x3tV6X.js +70 -0
- package/dist/web/assets/journeyDiagram-ZHPQQLJL-CLXIkiwl.js +139 -0
- package/dist/web/assets/kanban-definition-PNTS6WVX-P94klDAy.js +89 -0
- package/dist/web/assets/katex-ZlcWpGUi.js +257 -0
- package/dist/web/assets/line-DtGZCXZs.js +1 -0
- package/dist/web/assets/linear-BUnzfXgk.js +1 -0
- package/dist/web/assets/mermaid-parser.core-Du2mcMMx.js +7 -0
- package/dist/web/assets/mermaid.core-B4zgSyXF.js +44 -0
- package/dist/web/assets/mindmap-definition-NLK3R4M7-C0EF7lWr.js +96 -0
- package/dist/web/assets/ordinal-BDEzSJ7C.js +1 -0
- package/dist/web/assets/packet-AYTQ26CC-SJ1tKR5t.js +1 -0
- package/dist/web/assets/path-fybaL0A-.js +1 -0
- package/dist/web/assets/pegDiagram-GJSIUBJH-Dek_S7Z0.js +1 -0
- package/dist/web/assets/pie-WAS4IAKB-C0wgWLu4.js +1 -0
- package/dist/web/assets/pieDiagram-5QR66LMP-Dy1jV_P-.js +39 -0
- package/dist/web/assets/quadrantDiagram-O4NWA36T-Df6Jl4OG.js +7 -0
- package/dist/web/assets/radar-RG4KPBEZ-BCtk017a.js +1 -0
- package/dist/web/assets/railroad-74A4TZTK-_ZAooQok.js +1 -0
- package/dist/web/assets/railroad-abnf-HS5TGJTU-Bacbbg7g.js +1 -0
- package/dist/web/assets/railroad-ebnf-LZEXJU2U-Cb23oOsU.js +1 -0
- package/dist/web/assets/railroad-peg-WCYAUIDC-EPh5LyCw.js +1 -0
- package/dist/web/assets/railroadDiagram-XR7U4H2S-DNraioKj.js +1 -0
- package/dist/web/assets/requirementDiagram-PLB6GJNP-C09s8xl6.js +84 -0
- package/dist/web/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/dist/web/assets/rough.esm-Dy-Kn_BL.js +1 -0
- package/dist/web/assets/sankeyDiagram-IPEJSGJF-cwVwdash.js +40 -0
- package/dist/web/assets/sequenceDiagram-PO4LG4MO-Uz6m2m-d.js +169 -0
- package/dist/web/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
- package/dist/web/assets/src-oBChb5qS.js +1 -0
- package/dist/web/assets/stateDiagram-v2-GCMORJYK-DASY_MN7.js +291 -0
- package/dist/web/assets/swimlanes-2SLR337P-DjbxDj0Z.js +1 -0
- package/dist/web/assets/swimlanesDiagram-TC7HE7FX-Bv90z5my.js +8 -0
- package/dist/web/assets/timeline-definition-EJHVYXUP-Dffxj5AG.js +120 -0
- package/dist/web/assets/treeView-Q6P3EWNA-CXAvuG6A.js +1 -0
- package/dist/web/assets/treemap-WGGIJYW6-D_BSE2GX.js +1 -0
- package/dist/web/assets/usecaseDiagram-POWQR4AR-CKcfbpDB.js +328 -0
- package/dist/web/assets/vennDiagram-UO4OBE2U-DkJknm_I.js +34 -0
- package/dist/web/assets/wardley-WFR3VGLG-Drx6WB-t.js +1 -0
- package/dist/web/assets/wardleyDiagram-VNRHLVJA-fdjd5am3.js +78 -0
- package/dist/web/assets/xychartDiagram-PMCCYNJV-DCWTWMv0.js +7 -0
- package/dist/web/favicon.svg +1 -0
- package/dist/web/index.html +17 -0
- package/package.json +77 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import{n as e}from"./index-BSiW3yI1.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n,p as r}from"./src-oBChb5qS.js";import{H as i,U as a,a as o,q as s,s as c,v as l,w as u,x as d,y as f}from"./chunk-O7XYJQB3-CjZQSnt8.js";import{g as p,s as m}from"./chunk-ZIGJFQKS-C6SOqBs6.js";import"./chunk-742MDFTN-DTR6iTOw.js";import"./chunk-MBY4JIJT-9uaOqseW.js";import"./chunk-7PRAP22T-CPe5zfLc.js";import{a as h,i as g,o as _,r as v}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import"./chunk-7INBJB4K-XeJOzIDQ.js";import"./chunk-5DYCD2WN-DH_dVKgx.js";import"./chunk-Z7XXMR3K-CHWuLoFG.js";import{t as y}from"./chunk-GWA4HPMP-DE4DJkth.js";import{t as b}from"./chunk-XXDRQBXY-BvKO0v-W.js";import{t as x}from"./chunk-WEXAMYUT-CT8bG5L7.js";import"./chunk-UA2S7LBM-BfYbPxwY.js";import{i as S,r as C}from"./mermaid.core-B4zgSyXF.js";var w=(function(){var e=t(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,2],r=[1,3],i=[1,4],a=[2,4],o=[1,9],s=[1,11],c=[1,16],l=[1,17],u=[1,18],d=[1,19],f=[1,33],p=[1,20],m=[1,21],h=[1,22],g=[1,23],_=[1,24],v=[1,26],y=[1,27],b=[1,28],x=[1,29],S=[1,30],C=[1,31],w=[1,32],T=[1,35],E=[1,36],D=[1,37],O=[1,38],k=[1,34],A=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],j=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],M=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],N={trace:t(function(){},`trace`),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:`error`,4:`SPACE`,5:`NL`,6:`SD`,14:`DESCR`,15:`-->`,16:`HIDE_EMPTY`,17:`scale`,18:`WIDTH`,19:`COMPOSIT_STATE`,20:`STRUCT_START`,21:`STRUCT_STOP`,22:`STATE_DESCR`,23:`AS`,24:`ID`,25:`FORK`,26:`JOIN`,27:`CHOICE`,28:`CONCURRENT`,29:`note`,31:`NOTE_TEXT`,33:`acc_title`,34:`acc_title_value`,35:`acc_descr`,36:`acc_descr_value`,37:`acc_descr_multiline_value`,38:`CLICK`,39:`STRING`,40:`HREF`,41:`classDef`,42:`CLASSDEF_ID`,43:`CLASSDEF_STYLEOPTS`,44:`DEFAULT`,45:`style`,46:`STYLE_IDS`,47:`STYLEDEF_STYLEOPTS`,48:`class`,49:`CLASSENTITY_IDS`,50:`STYLECLASS`,51:`direction_tb`,52:`direction_bt`,53:`direction_rl`,54:`direction_lr`,56:`;`,57:`EDGE_STATE`,58:`STYLE_SEPARATOR`,59:`left_of`,60:`right_of`},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:t(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 3:return r.setRootDoc(a[s]),a[s];case 4:this.$=[];break;case 5:a[s]!=`nl`&&(a[s-1].push(a[s]),this.$=a[s-1]);break;case 6:case 7:this.$=a[s];break;case 8:this.$=`nl`;break;case 12:this.$=a[s];break;case 13:let e=a[s-1];e.description=r.trimColon(a[s]),this.$=e;break;case 14:this.$={stmt:`relation`,state1:a[s-2],state2:a[s]};break;case 15:let t=r.trimColon(a[s]);this.$={stmt:`relation`,state1:a[s-3],state2:a[s-1],description:t};break;case 19:this.$={stmt:`state`,id:a[s-3],type:`default`,description:``,doc:a[s-1]};break;case 20:var c=a[s],l=a[s-2].trim();if(a[s].match(`:`)){var u=a[s].split(`:`);c=u[0],l=[l,u[1]]}this.$={stmt:`state`,id:c,type:`default`,description:l};break;case 21:this.$={stmt:`state`,id:a[s-3],type:`default`,description:a[s-5],doc:a[s-1]};break;case 22:this.$={stmt:`state`,id:a[s],type:`fork`};break;case 23:this.$={stmt:`state`,id:a[s],type:`join`};break;case 24:this.$={stmt:`state`,id:a[s],type:`choice`};break;case 25:this.$={stmt:`state`,id:r.getDividerId(),type:`divider`};break;case 26:this.$={stmt:`state`,id:a[s-1].trim(),note:{position:a[s-2].trim(),text:a[s].trim()}};break;case 29:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 30:case 31:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 32:this.$={stmt:`click`,id:a[s-3],url:a[s-2],tooltip:a[s-1]};break;case 33:this.$={stmt:`click`,id:a[s-3],url:a[s-1],tooltip:``};break;case 34:case 35:this.$={stmt:`classDef`,id:a[s-1].trim(),classes:a[s].trim()};break;case 36:this.$={stmt:`style`,id:a[s-1].trim(),styleClass:a[s].trim()};break;case 37:this.$={stmt:`applyClass`,id:a[s-1].trim(),styleClass:a[s].trim()};break;case 38:r.setDirection(`TB`),this.$={stmt:`dir`,value:`TB`};break;case 39:r.setDirection(`BT`),this.$={stmt:`dir`,value:`BT`};break;case 40:r.setDirection(`RL`),this.$={stmt:`dir`,value:`RL`};break;case 41:r.setDirection(`LR`),this.$={stmt:`dir`,value:`LR`};break;case 44:case 45:this.$={stmt:`state`,id:a[s].trim(),type:`default`,description:``};break;case 46:this.$={stmt:`state`,id:a[s-2].trim(),classes:[a[s].trim()],type:`default`,description:``};break;case 47:this.$={stmt:`state`,id:a[s-2].trim(),classes:[a[s].trim()],type:`default`,description:``}}},`anonymous`),table:[{3:1,4:n,5:r,6:i},{1:[3]},{3:5,4:n,5:r,6:i},{3:6,4:n,5:r,6:i},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],a,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:c,17:l,19:u,22:d,24:f,25:p,26:m,27:h,28:g,29:_,32:25,33:v,35:y,37:b,38:x,41:S,45:C,48:w,51:T,52:E,53:D,54:O,57:k},e(A,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:c,17:l,19:u,22:d,24:f,25:p,26:m,27:h,28:g,29:_,32:25,33:v,35:y,37:b,38:x,41:S,45:C,48:w,51:T,52:E,53:D,54:O,57:k},e(A,[2,7]),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(A,[2,11]),e(A,[2,12],{14:[1,40],15:[1,41]}),e(A,[2,16]),{18:[1,42]},e(A,[2,18],{20:[1,43]}),{23:[1,44]},e(A,[2,22]),e(A,[2,23]),e(A,[2,24]),e(A,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(A,[2,28]),{34:[1,49]},{36:[1,50]},e(A,[2,31]),{13:51,24:f,57:k},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(j,[2,44],{58:[1,56]}),e(j,[2,45],{58:[1,57]}),e(A,[2,38]),e(A,[2,39]),e(A,[2,40]),e(A,[2,41]),e(A,[2,6]),e(A,[2,13]),{13:58,24:f,57:k},e(A,[2,17]),e(M,a,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(A,[2,29]),e(A,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(A,[2,14],{14:[1,71]}),{4:o,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:c,17:l,19:u,21:[1,72],22:d,24:f,25:p,26:m,27:h,28:g,29:_,32:25,33:v,35:y,37:b,38:x,41:S,45:C,48:w,51:T,52:E,53:D,54:O,57:k},e(A,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(A,[2,34]),e(A,[2,35]),e(A,[2,36]),e(A,[2,37]),e(j,[2,46]),e(j,[2,47]),e(A,[2,15]),e(A,[2,19]),e(M,a,{7:78}),e(A,[2,26]),e(A,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:s,8:8,9:10,10:12,11:13,12:14,13:15,16:c,17:l,19:u,21:[1,81],22:d,24:f,25:p,26:m,27:h,28:g,29:_,32:25,33:v,35:y,37:b,38:x,41:S,45:C,48:w,51:T,52:E,53:D,54:O,57:k},e(A,[2,32]),e(A,[2,33]),e(A,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:t(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:t(function(e){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(e,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}t(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}t(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
|
|
2
|
+
`+h.showPosition()+`
|
|
3
|
+
Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};N.lexer=(function(){return{EOF:1,parseError:t(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:t(function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match=``,this.conditionStack=[`INITIAL`],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},`setInput`),input:t(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},`input`),unput:t(function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:t(function(){return this._more=!0,this},`more`),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError(`Lexical error on line `+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:t(function(e){this.unput(this.match.slice(e))},`less`),pastInput:t(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?`...`:``)+e.substr(-20).replace(/\n/g,``)},`pastInput`),upcomingInput:t(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?`...`:``)).replace(/\n/g,``)},`upcomingInput`),showPosition:t(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
|
|
5
|
+
`+t+`^`},`showPosition`),test_match:t(function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),r=e[0].match(/(?:\r\n?|\n).*/g),r&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},`test_match`),next:t(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r;this._more||(this.yytext=``,this.match=``);for(var i=this._currentRules(),a=0;a<i.length;a++)if(n=this._input.match(this.rules[i[a]]),n&&(!t||n[0].length>t[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(e=this.test_match(n,i[a]),e!==!1)return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?(e=this.test_match(t,i[r]),e!==!1&&e):this._input===``?this.EOF:this.parseError(`Lexical error on line `+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:``,token:null,line:this.yylineno})},`next`),lex:t(function(){return this.next()||this.lex()},`lex`),begin:t(function(e){this.conditionStack.push(e)},`begin`),popState:t(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},`popState`),_currentRules:t(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},`_currentRules`),topState:t(function(e){return e=this.conditionStack.length-1-Math.abs(e||0),e>=0?this.conditionStack[e]:`INITIAL`},`topState`),pushState:t(function(e){this.begin(e)},`pushState`),stateStackSize:t(function(){return this.conditionStack.length},`stateStackSize`),options:{"case-insensitive":!0},performAction:t(function(e,n,r,i){function a(){let t=n.yytext.indexOf(`%%`);if(t===0)return!1;if(t>0){let r=n.yytext.slice(0,t),i=n.yytext.slice(t);i&&e.lexer.unput(i),n.yytext=r}return!0}switch(t(a,`processId`),r){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState(`SCALE`),17;case 14:return 18;case 15:this.popState();break;case 16:return this.begin(`acc_title`),33;case 17:return this.popState(),`acc_title_value`;case 18:return this.begin(`acc_descr`),35;case 19:return this.popState(),`acc_descr_value`;case 20:this.begin(`acc_descr_multiline`);break;case 21:this.popState();break;case 22:return`acc_descr_multiline_value`;case 23:return this.pushState(`CLASSDEF`),41;case 24:return this.popState(),this.pushState(`CLASSDEFID`),`DEFAULT_CLASSDEF_ID`;case 25:return this.popState(),this.pushState(`CLASSDEFID`),42;case 26:return this.popState(),43;case 27:return this.pushState(`CLASS`),48;case 28:return this.popState(),this.pushState(`CLASS_STYLE`),49;case 29:return this.popState(),50;case 30:return this.pushState(`STYLE`),45;case 31:return this.popState(),this.pushState(`STYLEDEF_STYLES`),46;case 32:return this.popState(),47;case 33:return this.pushState(`SCALE`),17;case 34:return 18;case 35:this.popState();break;case 36:this.pushState(`STATE`);break;case 37:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;case 38:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState(`STATE_STRING`);break;case 48:return this.pushState(`STATE_ID`),`AS`;case 49:return a()?(this.popState(),`ID`):void 0;case 50:this.popState();break;case 51:return`STATE_DESCR`;case 52:throw Error(`Error: State name must be a single word. Found: "`+n.yytext.trim()+`"`);case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState(`struct`),20;case 56:return this.popState(),21;case 57:break;case 58:return this.begin(`NOTE`),29;case 59:return this.popState(),this.pushState(`NOTE_ID`),59;case 60:return this.popState(),this.pushState(`NOTE_ID`),60;case 61:this.popState(),this.pushState(`FLOATING_NOTE`);break;case 62:return this.popState(),this.pushState(`FLOATING_NOTE_ID`),`AS`;case 63:break;case 64:return`NOTE_TEXT`;case 65:return a()?(this.popState(),`ID`):void 0;case 66:return a()?(this.popState(),this.pushState(`NOTE_TEXT`),24):void 0;case 67:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;case 68:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:return a()?24:void 0;case 74:return n.yytext=n.yytext.trim(),14;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return`INVALID`}},`anonymous`),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}}})();function P(){this.yy={}}return t(P,`Parser`),P.prototype=N,N.Parser=P,new P})();w.parser=w;var T=w,E=`TB`,D=`TB`,O=`dir`,k=`state`,A=`root`,j=`relation`,M=`classDef`,N=`style`,P=`applyClass`,F=`default`,ee=`divider`,te=`fill:none`,ne=`fill: #333`,re=`c`,ie=`markdown`,ae=`normal`,I=`rect`,L=`rectWithTitle`,oe=`stateStart`,se=`stateEnd`,R=`divider`,ce=`roundedWithTitle`,le=`note`,ue=`noteGroup`,z=`statediagram`,de=`${z}-state`,B=`transition`,fe=`note`,pe=`${B} note-edge`,me=`${z}-${fe}`,he=`${z}-cluster`,ge=`${z}-cluster-alt`,V=`parent`,H=`note`,_e=`state`,U=`----`,ve=`${U}${H}`,ye=`${U}${V}`,W=new Map,G=0,be=0,K=new Map,xe=t((e,t,n,r)=>{if(e===R&&n?.id!==void 0&&K.has(n.id)){let e=K.get(n.id);return K.set(t,e),e}let i=be++,a=r?void 0:i;return K.set(t,a),a},`colorSlotFor`);function q(e=``,t=0,n=``,r=U){return`${_e}-${e}${n!==null&&n.length>0?`${r}${n}`:``}-${t}`}t(q,`stateDomId`);var Se=t((e,t,r,i,a,o,s,l)=>{n.trace(`items`,t),t.forEach(t=>{switch(t.stmt){case k:X(e,t,r,i,a,o,s,l);break;case F:X(e,t,r,i,a,o,s,l);break;case j:{X(e,t.state1,r,i,a,o,s,l),X(e,t.state2,r,i,a,o,s,l);let n=s===`neo`,u={id:`edge`+G,start:t.state1.id,end:t.state2.id,arrowhead:`normal`,arrowTypeEnd:n?`arrow_barb_neo`:`arrow_barb`,style:te,labelStyle:``,label:c.sanitizeText(t.description??``,d()),arrowheadStyle:ne,labelpos:re,labelType:ie,thickness:ae,classes:B,look:s};a.push(u),G++}}})},`setupDoc`),Ce=t((e,t=D)=>{let n=t;if(e.doc)for(let t of e.doc)t.stmt===`dir`&&(n=t.value);return n},`getDir`);function J(e,t,n){if(!t.id||t.id===`</join></fork>`||t.id===`</choice>`)return;t.cssClasses&&(Array.isArray(t.cssCompiledStyles)||(t.cssCompiledStyles=[]),t.cssClasses.split(` `).forEach(e=>{let r=n.get(e);r&&(t.cssCompiledStyles=[...t.cssCompiledStyles??[],...r.styles])}));let r=e.find(e=>e.id===t.id);r?Object.assign(r,t):e.push(t)}t(J,`insertOrUpdateNode`);function we(e){return e?.classes?.join(` `)??``}t(we,`getClassesFromDbInfo`);function Y(e){return e?.styles??[]}t(Y,`getStylesFromDbInfo`);var X=t((e,t,r,i,a,o,s,l)=>{let u=t.id,f=r.get(u),p=we(f),m=Y(f),h=d(),g=p.trim()!==``||m.length>0;if(n.info(`dataFetcher parsedItem`,t,f,m),u!==`root`){let r=I;t.start===!0?r=oe:t.start===!1&&(r=se),t.type!==F&&(r=t.type),W.get(u)||W.set(u,{id:u,shape:r,description:c.sanitizeText(u,h),cssClasses:`${p} ${de}`,cssStyles:m});let d=W.get(u);t.description&&(Array.isArray(d.description)?(d.shape=L,d.description.push(t.description)):d.description?.length&&d.description.length>0?(d.shape=L,d.description=d.description===u?[t.description]:[d.description,t.description]):(d.shape=I,d.description=t.description),d.description=c.sanitizeTextOrArray(d.description,h)),d.description?.length===1&&d.shape===L&&(d.shape=d.type===`group`?ce:I),!d.type&&t.doc&&(n.info(`Setting cluster for XCX`,u,Ce(t)),d.type=`group`,d.isGroup=!0,d.dir=Ce(t),d.shape=t.type===ee?R:ce,d.colorIndex=xe(d.shape,u,e,g),d.cssClasses=`${d.cssClasses} ${he} ${o?ge:``}`);let f={labelStyle:``,shape:d.shape,label:d.description,cssClasses:d.cssClasses,cssCompiledStyles:[],cssStyles:d.cssStyles,id:u,dir:d.dir,domId:q(u,G),type:d.type,isGroup:d.type===`group`,colorIndex:d.colorIndex,padding:8,rx:10,ry:10,look:s,labelType:`markdown`};if(f.shape===R&&(f.label=``),e&&e.id!==`root`&&(n.trace(`Setting node `,u,` to be child of its parent `,e.id),f.parentId=e.id),f.centerLabel=!0,t.note){let e={labelStyle:``,shape:le,label:t.note.text,labelType:`markdown`,cssClasses:me,cssStyles:[],cssCompiledStyles:[],id:u+ve+`-`+G,domId:q(u,G,H),type:`node`,isGroup:!1,padding:h.flowchart?.padding,look:s,position:t.note.position},n=u+ye,r={labelStyle:``,shape:ue,label:t.note.text,cssClasses:d.cssClasses,cssStyles:[],id:u+ye,domId:q(u,G,V),type:`group`,isGroup:!0,padding:16,look:s,position:t.note.position};G++,r.id=n,e.parentId=n,J(i,r,l),J(i,e,l),J(i,f,l);let o=u,c=e.id;t.note.position===`left of`&&(o=e.id,c=u),a.push({id:o+`-`+c,start:o,end:c,arrowhead:`none`,arrowTypeEnd:``,style:te,labelStyle:``,classes:pe,pattern:`dashed`,arrowheadStyle:ne,labelpos:re,labelType:ie,thickness:ae,look:s})}else J(i,f,l)}t.doc&&(n.trace(`Adding nodes children `),Se(t,t.doc,r,i,a,!o,s,l))},`dataFetcher`),Te=t(()=>{W.clear(),G=0,be=0,K.clear()},`reset`),Ee=t((e,t=D)=>{if(!e.doc)return t;let n=t;for(let t of e.doc)t.stmt===`dir`&&(n=t.value);return n},`getDir`),De={getClasses:t(function(e,t){return t.db.getClasses()},`getClasses`),draw:t(async function(e,t,r,i){n.info(`REF0:`),n.info(`Drawing state diagram (v2)`,t);let{securityLevel:a,state:o,layout:s}=d();i.db.extract(i.db.getRootDocV2());let c=i.db.getData(),l=b(t,a);c.type=i.type,c.layoutAlgorithm=C(s),c.nodeSpacing=o?.nodeSpacing||50,c.rankSpacing=o?.rankSpacing||50,c.markers=d().look===`neo`?[`barbNeo`]:[`barb`],c.diagramId=t,await S(c,l);try{(typeof i.db.getLinks==`function`?i.db.getLinks():new Map).forEach((e,t)=>{let r=typeof t==`string`?t:typeof t?.id==`string`?t.id:``,i=c.nodes.find(e=>e.id===r);if(!r){n.warn(`⚠️ Invalid or missing stateId from key:`,JSON.stringify(t));return}let a=l.node()?.querySelectorAll(`g.node, g.rough-node`),o;if(a?.forEach(e=>{let t=e.textContent?.trim();(e.id===i?.domId||t===r)&&(o=e)}),!o){n.warn(`⚠️ Could not find node matching text:`,r);return}let s=o.parentNode;if(!s){n.warn(`⚠️ Node has no parent, cannot wrap:`,r);return}let u=document.createElementNS(`http://www.w3.org/2000/svg`,`a`),d=e.url.replace(/^"+|"+$/g,``);if(u.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,d),u.setAttribute(`target`,`_blank`),e.tooltip){let t=e.tooltip.replace(/^"+|"+$/g,``);u.setAttribute(`title`,t),o.setAttribute(`title`,t)}s.replaceChild(u,o),u.appendChild(o),n.info(`🔗 Wrapped node in <a> tag for:`,r,e.url)})}catch(e){n.error(`❌ Error injecting clickable links:`,e)}p.insertTitle(l,`statediagramTitleText`,o?.titleTopMargin??25,i.db.getDiagramTitle()),x(l,8,z,o?.useMaxWidth??!0)},`draw`),getDir:Ee},Z={START_NODE:`[*]`,START_TYPE:`start`,END_NODE:`[*]`,END_TYPE:`end`,COLOR_KEYWORD:`color`,FILL_KEYWORD:`fill`,BG_FILL:`bgFill`,STYLECLASS_SEP:`,`},Oe=t(()=>new Map,`newClassesList`),Q=t(()=>({relations:[],states:new Map,documents:{}}),`newDoc`),$=t(e=>JSON.parse(JSON.stringify(e)),`clone`),ke=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Oe(),this.documents={root:Q()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=f,this.setAccTitle=a,this.getAccDescription=l,this.setAccDescription=i,this.setDiagramTitle=s,this.getDiagramTitle=u,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,`StateDB`)}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let t of Array.isArray(e)?e:e.doc)switch(t.stmt){case k:this.addState(t.id.trim(),t.type,t.doc,t.description,t.note);break;case j:this.addRelation(t.state1,t.state2,t.description);break;case M:this.addStyleClass(t.id.trim(),t.classes);break;case N:this.handleStyleDef(t);break;case P:this.setCssClass(t.id.trim(),t.styleClass);break;case`click`:this.addLink(t.id,t.url,t.tooltip)}let t=this.getStates(),n=d();Te(),X(void 0,this.getRootDocV2(),t,this.nodes,this.edges,!0,n.look,this.classes);for(let e of this.nodes)if(Array.isArray(e.label)){if(e.description=e.label.slice(1),e.isGroup&&e.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${e.id}]`);e.label=e.label[0]}}handleStyleDef(e){let t=e.id.trim().split(`,`),n=e.styleClass.split(`,`);for(let e of t){let t=this.getState(e);if(!t){let n=e.trim();this.addState(n),t=this.getState(n)}t&&(t.styles=n.map(e=>e.replace(/;/g,``)?.trim()))}}setRootDoc(e){n.info(`Setting root doc`,e),this.rootDoc=e,this.version===1?this.extract(e):this.extract(this.getRootDocV2())}docTranslator(e,t,n){if(t.stmt===j){this.docTranslator(e,t.state1,!0),this.docTranslator(e,t.state2,!1);return}if(t.stmt===k&&(t.id===Z.START_NODE?(t.id=e.id+(n?`_start`:`_end`),t.start=n):t.id=t.id.trim()),t.stmt!==A&&t.stmt!==k||!t.doc)return;let r=[],i=[];for(let e of t.doc)if(e.type===ee){let t=$(e);t.doc=$(i),r.push(t),i=[]}else i.push(e);if(r.length>0&&i.length>0){let e={stmt:k,id:m(),type:`divider`,doc:$(i)};r.push($(e)),t.doc=r}t.doc.forEach(e=>this.docTranslator(t,e,!0))}getRootDocV2(){return this.docTranslator({id:A,stmt:A},{id:A,stmt:A,doc:this.rootDoc},!0),{id:A,doc:this.rootDoc}}addState(e,t=F,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,l=void 0){let u=e?.trim();if(!this.currentDocument.states.has(u))n.info(`Adding state `,u,i),this.currentDocument.states.set(u,{stmt:k,id:u,descriptions:[],type:t,doc:r,note:a,classes:[],styles:[],textStyles:[]});else{let e=this.currentDocument.states.get(u);if(!e)throw Error(`State not found: ${u}`);e.doc||=r,e.type||=t}if(i&&(n.info(`Setting state description`,u,i),(Array.isArray(i)?i:[i]).forEach(e=>this.addDescription(u,e.trim()))),a){let e=this.currentDocument.states.get(u);if(!e)throw Error(`State not found: ${u}`);e.note=a,e.note.text=c.sanitizeText(e.note.text,d())}o&&(n.info(`Setting state classes`,u,o),(Array.isArray(o)?o:[o]).forEach(e=>this.setCssClass(u,e.trim()))),s&&(n.info(`Setting state styles`,u,s),(Array.isArray(s)?s:[s]).forEach(e=>this.setStyle(u,e.trim()))),l&&(n.info(`Setting state styles`,u,s),(Array.isArray(l)?l:[l]).forEach(e=>this.setTextStyle(u,e.trim())))}clear(e){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Q()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Oe(),e||(this.links=new Map,o())}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){n.info(`Documents = `,this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,t,r){this.links.set(e,{url:t,tooltip:r}),n.warn(`Adding link`,e,t,r)}getLinks(){return this.links}startIdIfNeeded(e=``){return e===Z.START_NODE?(this.startEndCount++,`${Z.START_TYPE}${this.startEndCount}`):e}startTypeIfNeeded(e=``,t=F){return e===Z.START_NODE?Z.START_TYPE:t}endIdIfNeeded(e=``){return e===Z.END_NODE?(this.startEndCount++,`${Z.END_TYPE}${this.startEndCount}`):e}endTypeIfNeeded(e=``,t=F){return e===Z.END_NODE?Z.END_TYPE:t}addRelationObjs(e,t,n=``){let r=this.startIdIfNeeded(e.id.trim()),i=this.startTypeIfNeeded(e.id.trim(),e.type),a=this.startIdIfNeeded(t.id.trim()),o=this.startTypeIfNeeded(t.id.trim(),t.type);this.addState(r,i,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(a,o,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.currentDocument.relations.push({id1:r,id2:a,relationTitle:c.sanitizeText(n,d())})}addRelation(e,t,n){if(typeof e==`object`&&typeof t==`object`)this.addRelationObjs(e,t,n);else if(typeof e==`string`&&typeof t==`string`){let r=this.startIdIfNeeded(e.trim()),i=this.startTypeIfNeeded(e),a=this.endIdIfNeeded(t.trim()),o=this.endTypeIfNeeded(t);this.addState(r,i),this.addState(a,o),this.currentDocument.relations.push({id1:r,id2:a,relationTitle:n?c.sanitizeText(n,d()):void 0})}}addDescription(e,t){let n=this.currentDocument.states.get(e),r=t.startsWith(`:`)?t.replace(`:`,``).trim():t;n?.descriptions?.push(c.sanitizeText(r,d()))}cleanupLabel(e){return e.startsWith(`:`)?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,t=``){this.classes.has(e)||this.classes.set(e,{id:e,styles:[],textStyles:[]});let n=this.classes.get(e);t&&n&&t.split(Z.STYLECLASS_SEP).forEach(e=>{let t=e.replace(/([^;]*);/,`$1`).trim();if(RegExp(Z.COLOR_KEYWORD).exec(e)){let e=t.replace(Z.FILL_KEYWORD,Z.BG_FILL).replace(Z.COLOR_KEYWORD,Z.FILL_KEYWORD);n.textStyles.push(e)}n.styles.push(t)})}getClasses(){return this.classes}setupToolTips(t){let n=y();r(t).select(`svg`).selectAll(`g.node, g.rough-node`).on(`mouseover`,t=>{let i=r(t.currentTarget),a=i.attr(`title`);if(a===null)return;let o=t.currentTarget?.getBoundingClientRect();n.transition().duration(200).style(`opacity`,`.9`),n.style(`left`,window.scrollX+o.left+(o.right-o.left)/2+`px`).style(`top`,window.scrollY+o.bottom+`px`),n.html(e.sanitize(a)),i.classed(`hover`,!0)}).on(`mouseout`,e=>{n.transition().duration(500).style(`opacity`,0),r(e.currentTarget).classed(`hover`,!1)})}setCssClass(e,t){e.split(`,`).forEach(e=>{let n=this.getState(e);if(!n){let t=e.trim();this.addState(t),n=this.getState(t)}n?.classes?.push(t)})}setStyle(e,t){this.getState(e)?.styles?.push(t)}setTextStyle(e,t){this.getState(e)?.textStyles?.push(t)}bindFunctions(e){this.funs.forEach(t=>{t(e)})}getDirectionStatement(){return this.rootDoc.find(e=>e.stmt===O)}getDirection(){return this.getDirectionStatement()?.value??E}setDirection(e){let t=this.getDirectionStatement();t?t.value=e:this.rootDoc.unshift({stmt:O,value:e})}trimColon(e){return e.startsWith(`:`)?e.slice(1).trim():e.trim()}getData(){let e=d();for(let t of this.nodes)t.wrappingWidth??=e.state?.wrappingWidth,t.isGroup||(t.minWidth??=e.state?.minNodeWidth);return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:Ee(this.getRootDocV2())}}getConfig(){return d().state}},Ae=t(e=>{let{theme:t,bkgColorArray:n,borderColorArray:r}=e;if(!g(t,r))return``;let i=_(e.look),a=v(n),o=``;for(let e=0;e<h(r);e++){let t=r[e],s=a?`fill: ${n[e%n.length]};`:``,c=`[data-look="${i}"][data-color-id="color-${e}"]`;o+=`
|
|
7
|
+
|
|
8
|
+
/* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
|
|
9
|
+
the body, so what stays visible of \`outer\` is the band behind the label. */
|
|
10
|
+
${c}.statediagram-cluster rect.outer {
|
|
11
|
+
stroke: ${t};
|
|
12
|
+
${s}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
${c}.statediagram-cluster rect.inner {
|
|
16
|
+
stroke: ${t};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* Concurrency regions. Siblings of one composite share a slot, so a divided composite
|
|
20
|
+
reads as one thing split into parts rather than as several composites. */
|
|
21
|
+
${c}.statediagram-cluster rect.divider {
|
|
22
|
+
stroke: ${t};
|
|
23
|
+
${s}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* handDrawn draws the same container as roughjs shapes rather than plain rects, so it
|
|
27
|
+
needs its own rules. \`roundedWithTitle\` and \`divider\` name those groups \`outer\`,
|
|
28
|
+
\`inner\` and \`divider\` to match the classic branch, which is what lets these
|
|
29
|
+
discriminate -- a bare \`.statediagram-cluster path\` rule reached the body as well and
|
|
30
|
+
tinted the whole composite, losing \`compositeBackground\` and diverging from what
|
|
31
|
+
classic and neo do.
|
|
32
|
+
|
|
33
|
+
roughjs emits two paths per shape and marks them: the filled shape carries
|
|
34
|
+
\`stroke="none"\` and the sketched outline carries \`fill="none"\`. Splitting on that is
|
|
35
|
+
what keeps \`fill\` off the outline -- a rough outline is open squiggles, not a closed
|
|
36
|
+
region, so filling it produces smears -- and keeps \`stroke\` off the fill shape, which
|
|
37
|
+
would otherwise gain an edge it was drawn without. */
|
|
38
|
+
${c}.statediagram-cluster .outer path[stroke='none'] {
|
|
39
|
+
${s}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
${c}.statediagram-cluster .outer path[fill='none'] {
|
|
43
|
+
stroke: ${t};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/* No \`.inner\` rule on purpose. The body shape is left entirely alone under handDrawn,
|
|
47
|
+
where a rect's \`inner\` counterpart cannot be recoloured safely: roughjs draws a
|
|
48
|
+
hachure fill as *stroked* lines, so its fill paths carry \`fill="none"\` exactly like
|
|
49
|
+
the outline and no selector separates them. An \`.inner\` stroke rule therefore
|
|
50
|
+
repainted the hatching of every alt composite in the palette colour instead of
|
|
51
|
+
leaving it on \`altBackground\`. The container still reads as palette-coloured: the
|
|
52
|
+
\`outer\` shape spans the whole composite, so its outline already frames the body. */
|
|
53
|
+
|
|
54
|
+
/* Regions split the same way, which is why \`divider\` fills solid rather than taking
|
|
55
|
+
roughjs's default hachure -- see the note on that call. Hatched, both of its paths
|
|
56
|
+
carried \`fill="none"\` and these two rules degenerated: the tint matched nothing and
|
|
57
|
+
the border rule repainted the hatching. */
|
|
58
|
+
${c}.statediagram-cluster .divider path[stroke='none'] {
|
|
59
|
+
${s}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
${c}.statediagram-cluster .divider path[fill='none'] {
|
|
63
|
+
stroke: ${t};
|
|
64
|
+
}
|
|
65
|
+
`}return o},`genColor`),je={parser:T,get db(){return new ke(2)},renderer:De,styles:t(e=>`
|
|
66
|
+
${Ae(e)}
|
|
67
|
+
defs [id$="-barbEnd"] {
|
|
68
|
+
fill: ${e.transitionColor};
|
|
69
|
+
stroke: ${e.transitionColor};
|
|
70
|
+
}
|
|
71
|
+
g.stateGroup text {
|
|
72
|
+
fill: ${e.nodeBorder};
|
|
73
|
+
stroke: none;
|
|
74
|
+
font-size: 10px;
|
|
75
|
+
}
|
|
76
|
+
g.stateGroup text {
|
|
77
|
+
fill: ${e.textColor};
|
|
78
|
+
stroke: none;
|
|
79
|
+
font-size: 10px;
|
|
80
|
+
|
|
81
|
+
}
|
|
82
|
+
g.stateGroup .state-title {
|
|
83
|
+
font-weight: bolder;
|
|
84
|
+
fill: ${e.stateLabelColor};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
g.stateGroup rect {
|
|
88
|
+
fill: ${e.mainBkg};
|
|
89
|
+
stroke: ${e.nodeBorder};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
g.stateGroup line {
|
|
93
|
+
stroke: ${e.lineColor};
|
|
94
|
+
stroke-width: ${e.strokeWidth||1};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.transition {
|
|
98
|
+
stroke: ${e.transitionColor};
|
|
99
|
+
stroke-width: ${e.strokeWidth||1};
|
|
100
|
+
fill: none;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.stateGroup .composit {
|
|
104
|
+
fill: ${e.background};
|
|
105
|
+
border-bottom: 1px
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.stateGroup .alt-composit {
|
|
109
|
+
fill: #e0e0e0;
|
|
110
|
+
border-bottom: 1px
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.state-note {
|
|
114
|
+
stroke: ${e.noteBorderColor};
|
|
115
|
+
fill: ${e.noteBkgColor};
|
|
116
|
+
|
|
117
|
+
text {
|
|
118
|
+
fill: ${e.noteTextColor};
|
|
119
|
+
stroke: none;
|
|
120
|
+
font-size: 10px;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.stateLabel .box {
|
|
125
|
+
stroke: none;
|
|
126
|
+
stroke-width: 0;
|
|
127
|
+
fill: ${e.mainBkg};
|
|
128
|
+
opacity: 0.5;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.edgeLabel .label rect {
|
|
132
|
+
fill: ${e.labelBackgroundColor};
|
|
133
|
+
opacity: 0.5;
|
|
134
|
+
}
|
|
135
|
+
.edgeLabel {
|
|
136
|
+
background-color: ${e.edgeLabelBackground};
|
|
137
|
+
p {
|
|
138
|
+
background-color: ${e.edgeLabelBackground};
|
|
139
|
+
}
|
|
140
|
+
rect {
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
background-color: ${e.edgeLabelBackground};
|
|
143
|
+
fill: ${e.edgeLabelBackground};
|
|
144
|
+
}
|
|
145
|
+
text-align: center;
|
|
146
|
+
}
|
|
147
|
+
.edgeLabel .label text {
|
|
148
|
+
fill: ${e.transitionLabelColor||e.tertiaryTextColor};
|
|
149
|
+
}
|
|
150
|
+
.label div .edgeLabel {
|
|
151
|
+
color: ${e.transitionLabelColor||e.tertiaryTextColor};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.stateLabel text {
|
|
155
|
+
fill: ${e.stateLabelColor};
|
|
156
|
+
font-size: 10px;
|
|
157
|
+
font-weight: bold;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.node circle.state-start {
|
|
161
|
+
fill: ${e.specialStateColor};
|
|
162
|
+
stroke: ${e.specialStateColor};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.node .fork-join {
|
|
166
|
+
fill: ${e.specialStateColor};
|
|
167
|
+
stroke: ${e.specialStateColor};
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.node circle.state-end {
|
|
171
|
+
fill: ${e.innerEndBackground};
|
|
172
|
+
stroke: ${e.background};
|
|
173
|
+
stroke-width: 1.5
|
|
174
|
+
}
|
|
175
|
+
.end-state-inner {
|
|
176
|
+
fill: ${e.compositeBackground||e.background};
|
|
177
|
+
// stroke: ${e.background};
|
|
178
|
+
stroke-width: 1.5
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.node rect {
|
|
182
|
+
fill: ${e.stateBkg||e.mainBkg};
|
|
183
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
184
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
185
|
+
}
|
|
186
|
+
.node polygon {
|
|
187
|
+
fill: ${e.mainBkg};
|
|
188
|
+
stroke: ${e.stateBorder||e.nodeBorder};;
|
|
189
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
190
|
+
}
|
|
191
|
+
[id$="-barbEnd"] {
|
|
192
|
+
fill: ${e.lineColor};
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.statediagram-cluster rect {
|
|
196
|
+
fill: ${e.compositeTitleBackground};
|
|
197
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
198
|
+
stroke-width: ${e.strokeWidth||1}px;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.cluster-label, .nodeLabel {
|
|
202
|
+
color: ${e.stateLabelColor};
|
|
203
|
+
// line-height: 1;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.statediagram-cluster rect.outer {
|
|
207
|
+
rx: 5px;
|
|
208
|
+
ry: 5px;
|
|
209
|
+
}
|
|
210
|
+
.statediagram-state .divider {
|
|
211
|
+
stroke: ${e.stateBorder||e.nodeBorder};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.statediagram-state .title-state {
|
|
215
|
+
rx: 5px;
|
|
216
|
+
ry: 5px;
|
|
217
|
+
}
|
|
218
|
+
.statediagram-cluster.statediagram-cluster .inner {
|
|
219
|
+
fill: ${e.compositeBackground||e.background};
|
|
220
|
+
}
|
|
221
|
+
.statediagram-cluster.statediagram-cluster-alt .inner {
|
|
222
|
+
fill: ${e.altBackground?e.altBackground:`#efefef`};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.statediagram-cluster .inner {
|
|
226
|
+
rx:0;
|
|
227
|
+
ry:0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.statediagram-state rect.basic {
|
|
231
|
+
rx: 5px;
|
|
232
|
+
ry: 5px;
|
|
233
|
+
}
|
|
234
|
+
.statediagram-state rect.divider {
|
|
235
|
+
stroke-dasharray: 10,10;
|
|
236
|
+
fill: ${e.altBackground?e.altBackground:`#efefef`};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.note-edge {
|
|
240
|
+
stroke-dasharray: 5;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.statediagram-note rect {
|
|
244
|
+
fill: ${e.noteBkgColor};
|
|
245
|
+
stroke: ${e.noteBorderColor};
|
|
246
|
+
stroke-width: 1px;
|
|
247
|
+
rx: 0;
|
|
248
|
+
ry: 0;
|
|
249
|
+
}
|
|
250
|
+
.statediagram-note rect {
|
|
251
|
+
fill: ${e.noteBkgColor};
|
|
252
|
+
stroke: ${e.noteBorderColor};
|
|
253
|
+
stroke-width: 1px;
|
|
254
|
+
rx: 0;
|
|
255
|
+
ry: 0;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.statediagram-note text {
|
|
259
|
+
fill: ${e.noteTextColor};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.statediagram-note .nodeLabel {
|
|
263
|
+
color: ${e.noteTextColor};
|
|
264
|
+
}
|
|
265
|
+
.statediagram .edgeLabel {
|
|
266
|
+
color: red; // ${e.noteTextColor};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
[id$="-dependencyStart"], [id$="-dependencyEnd"] {
|
|
270
|
+
fill: ${e.lineColor};
|
|
271
|
+
stroke: ${e.lineColor};
|
|
272
|
+
stroke-width: ${e.strokeWidth||1};
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.statediagramTitleText {
|
|
276
|
+
text-anchor: middle;
|
|
277
|
+
font-size: 18px;
|
|
278
|
+
fill: ${e.textColor};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
[data-look="neo"].statediagram-cluster rect {
|
|
282
|
+
fill: ${e.mainBkg};
|
|
283
|
+
stroke: ${e.useGradient?`url(`+e.svgId+`-gradient)`:e.stateBorder||e.nodeBorder};
|
|
284
|
+
stroke-width: ${e.strokeWidth??1};
|
|
285
|
+
}
|
|
286
|
+
[data-look="neo"].statediagram-cluster rect.outer {
|
|
287
|
+
rx: ${e.radius}px;
|
|
288
|
+
ry: ${e.radius}px;
|
|
289
|
+
filter: ${e.dropShadow?e.dropShadow.replace(`url(#drop-shadow)`,`url(${e.svgId}-drop-shadow)`):`none`}
|
|
290
|
+
}
|
|
291
|
+
`,`getStyles`),init:t(e=>{e.state||={},e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{je as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-oBChb5qS.js";import"./chunk-O7XYJQB3-CjZQSnt8.js";import"./chunk-ZIGJFQKS-C6SOqBs6.js";import"./chunk-742MDFTN-DTR6iTOw.js";import"./chunk-MBY4JIJT-9uaOqseW.js";import"./chunk-7PRAP22T-CPe5zfLc.js";import"./chunk-7INBJB4K-XeJOzIDQ.js";import"./chunk-5DYCD2WN-DH_dVKgx.js";import"./chunk-Z7XXMR3K-CHWuLoFG.js";import"./chunk-UA2S7LBM-BfYbPxwY.js";import{r as n}from"./chunk-3FUC2YCW-PivwegVV.js";import{t as r}from"./chunk-NETBCI7D-bxqe7jPe.js";function i(e,{measure:t}){let n=e.config?.swimlane?.lineHops;if(n===!1)return;let i=n===`gap`?`gap`:`arc`,a=e.edges.filter(e=>Array.isArray(e.points)&&e.points.length>=2).map(e=>({id:e.id,points:e.points,curve:e.curve,arrowTypeStart:e.arrowTypeStart,arrowTypeEnd:e.arrowTypeEnd}));r(t.groups.edgePaths,a,{enabled:!0,jumpRadius:6,jumpStyle:i})}e(i,`applySwimlaneLineJumps`);var a=`__swimlane_default__`,o=21,s=20;function c(e){return Math.max(e.padding??s,s)}e(c,`topLaneHorizontalPadding`);function l(e){let{x:t,y:n,width:r,height:i}=e,a=e.swimlaneContentTop;if(typeof t!=`number`||typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||r<=0||i<=0){delete e.groupTitleRect;return}let s=n-i/2,c=Math.min(a,n+i/2),l=s+Math.min(o,Math.max(0,c-s));if(l<=s){delete e.groupTitleRect;return}e.groupTitleRect={left:t-r/2,right:t+r/2,top:s,bottom:l}}e(l,`assignTopLaneTitleRect`);function u(e){let t=e.direction,n=e.nodes??=[];for(let n of e.nodes??[])n.isGroup&&!n.parentId&&(n.shape=`swimlane`,t&&(n.direction=t));let r=n.filter(e=>!e.isGroup&&!e.parentId);if(r.length===0)return;let i=n.find(e=>e.id===a);i?i.isGroup&&(i.shape=`swimlane`,t&&(i.direction=t)):(i={id:a,label:``,isGroup:!0,shape:`swimlane`,padding:20,look:e.config?.look,colorIndex:n.reduce((e,t)=>Math.max(e,t.colorIndex??-1),-1)+1,...t?{direction:t}:{}},n.push(i));for(let e of r)e.parentId=a}e(u,`prepareLayoutForSwimlanes`);function d(e){let t=new Map;for(let n of e.nodes??[])t.set(n.id,n);let n=[];for(let t of e.edges??[]){let e=typeof t.start==`string`?t.start:void 0,r=typeof t.end==`string`?t.end:void 0;e&&r&&(t.labelNodeId||n.push({id:t.id,src:e,dst:r,ref:t}))}let r=e.nodes??[],i=r.filter(e=>e.isGroup),a=r.filter(e=>!e.isGroup);return{nodes:[...[...i].reverse(),...a].map(e=>e.id),edges:n,layout:e,nodeById:t}}e(d,`toGraphView`);function f(e,t,n,r){let{layout:i}=e,a=e.nodeById,o=r?.layerGap??100,s=r?.nodeGap??40,u=0;for(let e of t.layers){let t=0;for(let r of e){let e=a.get(r);if(!e){t++;continue}e.layer=u,e.order=t;let i=n.x[r]??t*s,c=n.y[r]??u*o;e.x=i,e.y=c,t++}u++}let d=i.nodes??[],f=new Map,p=[];for(let e of d){if(!e?.isGroup)continue;e.parentId||p.push(e);let t=d.filter(t=>t.parentId===e.id),r=1/0,i=-1/0,a=1/0,o=-1/0;for(let e of t){let t=e.x??n.x[e.id],s=e.y??n.y[e.id],c=e.width??0,l=e.height??0;t!=null&&s!=null&&(r=Math.min(r,t-c/2),i=Math.max(i,t+c/2),a=Math.min(a,s-l/2),o=Math.max(o,s+l/2))}if(r===1/0||a===1/0)e.x=e.x??0,e.y=e.y??0,e.width=e.width??0,e.height=e.height??0;else{let t=e.padding??20,n=e.parentId?t:2*c(e),s=t,l=Math.max(0,i-r)+n,u=Math.max(0,o-a)+s,d=(r+i)/2,p=(a+o)/2;e.x=d,e.y=p,e.width=l,e.height=u,f.set(e.id,{minX:r,maxX:i,minY:a,maxY:o})}}if(p.length>0&&f.size>0){let e=1/0,t=-1/0,n=0;for(let r of p){let i=r.padding??20;i>n&&(n=i);let a=f.get(r.id);a&&(e=Math.min(e,a.minY),t=Math.max(t,a.maxY))}if(e!==1/0&&t!==-1/0){let r=Math.max(0,t-e)+2*Math.max(n,36),i=(e+t)/2;for(let t of p)t.y=i,t.height=r,t.swimlaneContentTop=e;let a=[...p].sort((e,t)=>(e.x??0)-(t.x??0)),o=[],s=[],u=[];for(let e of a){let t=f.get(e.id);if(!t)continue;let n=Math.max(0,t.maxX-t.minX)+2*c(e),r=(t.minX+t.maxX)/2;o.push(e.id),s.push(r),u.push(n)}let d=o.length;if(d>0){let e=new Map;if(d===1)e.set(o[0],u[0]);else{let t=[];for(let e=0;e<d-1;e++)t.push(s[e+1]-s[e]);let n=Array(d);n[0]=0;for(let e=0;e<d-1;e++)n[e+1]=2*t[e]-n[e];let r=0,i=1/0;for(let e=0;e<d;e++){let t=u[e];e%2==0?r=Math.max(r,t-n[e]):i=Math.min(i,n[e]-t)}let a=r;a=r<=i?(r+i)/2:r;for(let t=0;t<d;t++){let r=n[t]+(t%2==0?a:-a),i=Math.max(u[t],r);e.set(o[t],i)}}for(let t of p){let n=e.get(t.id);n!=null&&(t.width=n),l(t)}}}}}e(f,`writeBackToLayoutData`);var p=`[EdgeLabelNodes]`;function m(e){let n=[],r=[],i=new Map;for(let t of e.nodes)i.set(t.id,t);for(let a of e.edges){if(!a.label||a.label.length===0||a.isLayoutOnly||a.labelNodeId)continue;let e=a.start?i.get(a.start):void 0,o=a.end?i.get(a.end):void 0;if(!e||!o){t.warn(p,`Edge ${a.id} has missing source or target node`);continue}let s=`edge-label-${a.start}-${a.end}-${a.id}`,c=e.parentId===o.parentId?e.parentId:o.parentId,l={id:s,label:a.label,edgeStart:a.start??``,edgeEnd:a.end??``,shape:`labelRect`,width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??``,...e.dir?{dir:e.dir}:{}};n.push(l),a.labelNodeId=s,a.label=void 0,a.text=void 0;let u={id:`${a.id}-to-label`,start:a.start,end:s,type:`normal`,isLayoutOnly:!0},d={id:`${a.id}-from-label`,start:s,end:a.end,type:`normal`,isLayoutOnly:!0};r.push(u,d)}let a=[...e.nodes,...n],o=[...e.edges,...r];return{...e,nodes:a,edges:o}}e(m,`createEdgeLabelNodes`);var h=.001;function g(e){let t=e.x??0,n=e.y??0,r=e.width??0,i=e.height??0;return r>0&&i>0?{cx:t,cy:n,rect:P(t,n,r,i)}:void 0}e(g,`measuredNodeRect`);function _(e){if(e.isGroup)return;let t=g(e);if(t)return{id:String(e.id??``),cx:t.cx,cy:t.cy,rect:t.rect}}e(_,`nodeBoundsInfoFor`);function v(e,t,n=h){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}e(v,`samePoint`);function y(e,t,n=h){return Math.abs(e.x-t.x)<n}e(y,`sameX`);function b(e,t,n=h){return Math.abs(e.y-t.y)<n}e(b,`sameY`);function x(e,t,n=h){return b(e,t,n)&&Math.abs(e.x-t.x)>n}e(x,`isHorizontalSegment`);function S(e,t,n=h){return y(e,t,n)&&Math.abs(e.y-t.y)>n}e(S,`isVerticalSegment`);function C(e,t,n,r){return Math.max(0,Math.min(Math.max(e,t),Math.max(n,r))-Math.max(Math.min(e,t),Math.min(n,r)))}e(C,`overlapLength`);function w(e,t,n=h){return e.horizontal&&t.horizontal&&b(e.a,t.a,n)?C(e.a.x,e.b.x,t.a.x,t.b.x):e.vertical&&t.vertical&&y(e.a,t.a,n)?C(e.a.y,e.b.y,t.a.y,t.b.y):0}e(w,`sameAxisSegmentOverlapLength`);function T(e,t=h){let n=[];for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=x(i,a,t),s=S(i,a,t);(o||s)&&n.push({index:r,a:i,b:a,horizontal:o,vertical:s})}return n}e(T,`orthogonalSegmentsForPoints`);function E(e,t=h){let n=T(e,t),r=0;for(let e=1;e<n.length;e++)n[e-1].horizontal!==n[e].horizontal&&r++;return r}e(E,`countOrthogonalBends`);function D(e,t=h){let n=[];for(let r of e){let e=n.length>0?n[n.length-1]:void 0;(!e||!v(e,r,t))&&n.push({x:r.x,y:r.y})}return n}e(D,`dedupeConsecutivePoints`);function O(e,t=h){if(!e||e.length!==4)return;let[n,r,i,a]=e;return x(n,r,t)&&S(r,i,t)&&x(i,a,t)?{kind:`HVH`,p0:n,p1:r,p2:i,p3:a}:S(n,r,t)&&x(r,i,t)&&S(i,a,t)?{kind:`VHV`,p0:n,p1:r,p2:i,p3:a}:void 0}e(O,`classifyThreeSegmentRoute`);function k(e,t,n,r=0){let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return a>n.left-r&&i<n.right+r&&s>n.top-r&&o<n.bottom+r}e(k,`segmentBoundsOverlapRect`);function A(e,t,n=0){return e.x>t.left+n&&e.x<t.right-n&&e.y>t.top+n&&e.y<t.bottom-n}e(A,`pointInsideRect`);function j(e,t){return e.left<=t.left&&e.right>=t.right&&e.top<=t.top&&e.bottom>=t.bottom}e(j,`rectContainsRect`);function M(e,t){return e.left<t.right&&e.right>t.left&&e.top<t.bottom&&e.bottom>t.top}e(M,`rectsOverlap`);function N(e,t){return{left:e.left-t,right:e.right+t,top:e.top-t,bottom:e.bottom+t}}e(N,`inflateRect`);function P(e,t,n,r){return{left:e-n/2,right:e+n/2,top:t-r/2,bottom:t+r/2}}e(P,`rectFromCenterSize`);function F(e){return g(e)?.rect}e(F,`rectOfNodeBounds`);function I(e,t){switch(t){case`top`:return{x:e.cx,y:e.rect.top};case`bottom`:return{x:e.cx,y:e.rect.bottom};case`left`:return{x:e.rect.left,y:e.cy};case`right`:return{x:e.rect.right,y:e.cy}}}e(I,`portForRectSide`);function ee(e,t,n,r,i,a=h){let o=t===`left`||t===`right`,s=r===`left`||r===`right`;if(o&&s){if(t===`right`&&r===`left`&&e.x<n.x||t===`left`&&r===`right`&&e.x>n.x){if(b(e,n,a))return[e,n];let t=(e.x+n.x)/2;return[e,{x:t,y:e.y},{x:t,y:n.y},n]}if(t===r){if(b(e,n,a))return;let r=t===`left`?Math.min(e.x,n.x)-i:Math.max(e.x,n.x)+i;return[e,{x:r,y:e.y},{x:r,y:n.y},n]}return}if(!o&&!s){if(t===r){if(y(e,n,a))return;let r=t===`top`?Math.min(e.y,n.y)-i:Math.max(e.y,n.y)+i;return[e,{x:e.x,y:r},{x:n.x,y:r},n]}if(!(t===`bottom`&&r===`top`&&e.y<n.y||t===`top`&&r===`bottom`&&e.y>n.y))return;if(y(e,n,a))return[e,n];let o=(e.y+n.y)/2;return[e,{x:e.x,y:o},{x:n.x,y:o},n]}if(o&&!s){let i=t===`right`&&n.x>e.x||t===`left`&&n.x<e.x,a=r===`top`&&e.y<n.y||r===`bottom`&&e.y>n.y;return i&&a?[e,{x:n.x,y:e.y},n]:void 0}let c=t===`bottom`&&n.y>e.y||t===`top`&&n.y<e.y,l=r===`left`&&e.x<n.x||r===`right`&&e.x>n.x;return c&&l?[e,{x:e.x,y:n.y},n]:void 0}e(ee,`buildOrthogonalPortPath`);function L(e,t,n,r){return t===`left`||t===`right`?[e,{x:r,y:e.y},{x:r,y:n.y},n]:[e,{x:e.x,y:r},{x:n.x,y:r},n]}e(L,`buildSameSideTrackPath`);function R(e){let t=new Map,n=[];for(let r of e){if(r.isEdgeLabel)continue;let e=_(r);e&&(t.set(e.id,e),n.push({id:e.id,rect:e.rect}))}return{nodeInfoById:t,realNodeRects:n}}e(R,`collectRealNodeBounds`);function z(e){let t=[],n=[];for(let r of e){let e=_(r);if(!e)continue;let i={id:e.id,rect:e.rect};r.isEdgeLabel?n.push(i):t.push(i)}return{realNodeRects:t,labelNodeRects:n}}e(z,`collectNodeRectEntries`);function te(e,{includeEdgeLabels:t=!0}={}){let n=[];for(let r of e){if(r.isGroup||!t&&r.isEdgeLabel)continue;let e=r.x??0,i=r.y??0,a=r.width??0,o=r.height??0;n.push({nodeId:r.id,...P(e,i,a,o)})}return n}e(te,`collectLayoutNodeRects`);function ne(e,t,n=h){let r=e.start,i=e.end;if(!r||!i)return;let a=t.get(r),o=t.get(i);if(a&&o)return{srcId:r,dstId:i,srcInfo:a,dstInfo:o,collinearX:Math.abs(a.cx-o.cx)<n,collinearY:Math.abs(a.cy-o.cy)<n}}e(ne,`getNodePairGeometry`);function B(e,t,n,r=[],i=0){for(let a of n)if(!r.includes(a.id)&&k(e,t,a.rect,-i))return!0;return!1}e(B,`segmentHitsAnyRect`);function re(e,t,n,r,i=h,a=1e-6){let o=b(e,t,i),s=y(e,t,i),c=b(n,r,i),l=y(n,r,i);if(o&&c||s&&l||!(o||s)||!(c||l))return!1;let u=o?{a:e,b:t}:{a:n,b:r},d=s?{a:e,b:t}:{a:n,b:r},f=u.a.y,p=Math.min(u.a.x,u.b.x),m=Math.max(u.a.x,u.b.x),g=d.a.x,_=Math.min(d.a.y,d.b.y),v=Math.max(d.a.y,d.b.y);if(g<p||g>m||f<_||f>v)return!1;let x=Math.abs(g-u.a.x)<a&&Math.abs(f-u.a.y)<a||Math.abs(g-u.b.x)<a&&Math.abs(f-u.b.y)<a,S=Math.abs(g-d.a.x)<a&&Math.abs(f-d.a.y)<a||Math.abs(g-d.b.x)<a&&Math.abs(f-d.b.y)<a;return!(x&&S)}e(re,`orthogonalSegmentsCross`);function ie(e,t,n,r,i=h){let a=b(e,t,i),o=y(e,t,i),s=b(n,r,i),c=y(n,r,i);return o&&c&&y(e,n,i)?C(e.y,t.y,n.y,r.y)>i:a&&s&&b(e,n,i)?C(e.x,t.x,n.x,r.x)>i:!1}e(ie,`sameAxisSegmentsOverlap`);function ae(e,t,n,r,{epsilon:i=h,skipDegenerateOther:a=!1}={}){for(let o of n){if(o===r||o.isLayoutOnly)continue;let n=o.points;if(!(!n||n.length<2))for(let r=0;r<n.length-1;r++){let o=n[r],s=n[r+1];if(!(a&&v(o,s,i))&&(re(e,t,o,s,i)||ie(e,t,o,s,i)))return!0}}return!1}e(ae,`segmentConflictsWithAnyEdge`);function V(e,t,n,r,i=h){let a=b(e,t,i),o=y(e,t,i),s=b(n,r,i),c=y(n,r,i);if(!(a&&c||o&&s))return!1;let l=a?{a:e,b:t}:{a:n,b:r},u=a?{a:n,b:r}:{a:e,b:t},d=l.a.y,f=Math.min(l.a.x,l.b.x),p=Math.max(l.a.x,l.b.x),m=u.a.x,g=Math.min(u.a.y,u.b.y),_=Math.max(u.a.y,u.b.y);return m>f+i&&m<p-i&&d>g+i&&d<_-i}e(V,`orthogonalSegmentsStrictlyCross`);function oe(e,t,n){let r=Math.min(t,n),i=Math.max(t,n);return e>r+h&&e<i-h}e(oe,`strictlyBetween`);function H(e,t,n){return y(e,t)&&y(t,n)?oe(t.y,e.y,n.y):b(e,t)&&b(t,n)?oe(t.x,e.x,n.x):!1}e(H,`isCollinearIntermediate`);function U(e){let t=!1,n=[];for(let r=0;r<e.length;r++){let i=n[n.length-1],a=e[r],o=r+1<e.length?e[r+1]:void 0;if(i&&o){if(v(i,o)){r++,t=!0;continue}if(H(i,a,o)){t=!0;continue}}n.push(a)}return{points:n,changed:t}}e(U,`simplifyPolylineOnce`);function W(e){let t=[e[0]];for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n];if(!y(r,i)&&!b(r,i)){let e=t.length>=2?t[t.length-2]:void 0,n=e&&y(e,r)?{x:r.x,y:i.y}:{x:i.x,y:r.y};t.push(n)}t.push(i)}let n=[];for(let e of t){let t=n[n.length-1];(!t||!v(t,e))&&n.push(e)}return n}e(W,`orthogonalizePolyline`);function G(e){if(e.length<3)return e;let t=[...e];for(let e=0;e<32;e++){let e=U(t);if(t=e.points,!e.changed)break}return t}e(G,`simplifyPolyline`);var K=.001,se=.5,ce=4;function le(e,t,n){let r=e;if(r.isLayoutOnly||!r.points||r.points.length<n)return;let i=r.start?t.get(r.start):void 0,a=r.end?t.get(r.end):void 0;return{edge:r,points:r.points,srcRect:i?F(i):void 0,dstRect:a?F(a):void 0}}e(le,`endpointContextFor`);function ue(e,t,n){if(b(e,t,K))return{x:e.x<n.left?n.left:n.right,y:e.y};if(y(e,t,K)){let t=e.y<n.top?n.top:n.bottom;return{x:e.x,y:t}}return{x:Math.min(n.right,Math.max(n.left,e.x)),y:Math.min(n.bottom,Math.max(n.top,e.y))}}e(ue,`segmentEnterPoint`);function de(e,t,n){let r=n?1:-1,i=n?0:e.length-1;for(;i>=0&&i<e.length&&A(e[i],t,se);)i+=r;if(i<0||i>=e.length)return e;let a=i-r;if(a<0||a>=e.length)return e;let o=ue(e[i],e[a],t);return n?[o,...e.slice(i)]:[...e.slice(0,i+1),o]}e(de,`clipEndpoint`);function q(e,t){for(let n of e){let e=le(n,t,2);if(!e)continue;let r=[...e.points];e.srcRect&&(r=de(r,e.srcRect,!0)),e.dstRect&&(r=de(r,e.dstRect,!1)),r=G(W(r)),r=xe(r,e.srcRect,e.dstRect),e.edge.points=G(W(r))}}e(q,`clipEdgeEndpointsToNodeBoundaries`);function J(e,t,n,r=!1){if(b(e,t,K)){if(t.y<n.top-K||t.y>n.bottom+K)return t;if(r){if(e.x<n.left-K)return{x:n.left,y:e.y};if(e.x>n.right+K)return{x:n.right,y:e.y}}return{x:Math.abs(t.x-n.left)<=Math.abs(t.x-n.right)?n.left:n.right,y:e.y}}if(y(e,t,K)){if(t.x<n.left-K||t.x>n.right+K)return t;if(r){if(e.y<n.top-K)return{x:e.x,y:n.top};if(e.y>n.bottom+K)return{x:e.x,y:n.bottom}}let i=Math.abs(t.y-n.top)<=Math.abs(t.y-n.bottom);return{x:e.x,y:i?n.top:n.bottom}}return t}e(J,`snapEndpointToBoundary`);function fe(e,t,n){let r=e[t];for(let i=t+n;i>=0&&i<e.length;i+=n){let t=e[i];if(!v(t,r,K))return t}return e[t+n]}e(fe,`firstDistinctAdjacent`);function pe(e,t){let n=e+ce,r=t-ce;return n<=r?{lo:n,hi:r}:{lo:(e+t)/2,hi:(e+t)/2}}e(pe,`cornerClearanceRange`);function me(e,t,n){let{lo:r,hi:i}=pe(t,n);return Math.min(i,Math.max(r,e))}e(me,`clampToCornerClearance`);function he(e){let t=Math.max(...e.map(e=>e.lo)),n=Math.min(...e.map(e=>e.hi));if(!(t>n))return{lo:t,hi:n}}e(he,`intersectRanges`);function ge(e,t){return t===`left`||t===`right`?pe(e.top,e.bottom):pe(e.left,e.right)}e(ge,`clearanceRangeForSide`);function _e(e,t,n){let r=e.y>=n.top-K&&e.y<=n.bottom+K,i=e.x>=n.left-K&&e.x<=n.right+K;if(b(e,t,K)&&r){if(Math.abs(e.x-n.left)<K)return`left`;if(Math.abs(e.x-n.right)<K)return`right`}if(y(e,t,K)&&i){if(Math.abs(e.y-n.top)<K)return`top`;if(Math.abs(e.y-n.bottom)<K)return`bottom`}}e(_e,`terminalSideForSegment`);function ve(e){return e===`left`||e===`right`}e(ve,`isHorizontalSide`);function ye(e,t,n,r,i){let a=[],o=n?_e(e,t,n):void 0,s=r?_e(t,e,r):void 0;return n&&o&&ve(o)===i&&a.push(ge(n,o)),r&&s&&ve(s)===i&&a.push(ge(r,s)),a.length>0?he(a):void 0}e(ye,`straightClearanceRange`);function be(e,t,n,r,i){let a=ye(e,t,n,r,i);if(!a)return;let o=i?e.y:e.x,s=Math.min(a.hi,Math.max(a.lo,o));if(!(Math.abs(s-o)<K))return i?[{x:e.x,y:s},{x:t.x,y:s}]:[{x:s,y:e.y},{x:s,y:t.y}]}e(be,`clearStraightEndpointCornerAxis`);function xe(e,t,n){if(e.length!==2)return e;let[r,i]=e;return b(r,i,K)?be(r,i,t,n,!0)??e:y(r,i,K)?be(r,i,t,n,!1)??e:e}e(xe,`clearStraightEndpointCornerConnections`);function Se(e,t,n){return ve(n)?{x:e.x,y:me(e.y,t.top,t.bottom)}:{x:me(e.x,t.left,t.right),y:e.y}}e(Se,`cornerClearedEndpoint`);function Ce(e,t,n,r,i,a){let o=e.map(e=>({...e}));for(let s=t;s>=0&&s<e.length;s+=n){let t=e[s];if(a&&!b(t,r,K)||!a&&!y(t,r,K))break;a?o[s].y=i.y:o[s].x=i.x}return o}e(Ce,`moveCollinearEndpointRun`);function we(e,t,n){if(e.length<2)return e;let r=n?0:e.length-1,i=n?1:-1,a=e[r],o=fe(e,r,i);if(!o)return e;let s=_e(a,o,t);if(!s)return e;let c=ve(s),l=Se(a,t,s);return v(a,l,K)?e:Ce(e,r,i,a,l,c)}e(we,`clearEndpointCornerConnection`);function Te(e,t,n){let r=Math.min(e.x,t.x)>=n.left-K&&Math.max(e.x,t.x)<=n.right+K,i=Math.min(e.y,t.y)>=n.top-K&&Math.max(e.y,t.y)<=n.bottom+K;if(Math.abs(e.y-n.top)<K&&Math.abs(t.y-n.top)<K&&r)return`top`;if(Math.abs(e.y-n.bottom)<K&&Math.abs(t.y-n.bottom)<K&&r)return`bottom`;if(Math.abs(e.x-n.left)<K&&Math.abs(t.x-n.left)<K&&i)return`left`;if(Math.abs(e.x-n.right)<K&&Math.abs(t.x-n.right)<K&&i)return`right`}e(Te,`borderSideForSegment`);function Ee(e,t,n,r){switch(e){case`top`:return y(t,n,K)&&n.y<r.top-K;case`bottom`:return y(t,n,K)&&n.y>r.bottom+K;case`left`:return b(t,n,K)&&n.x<r.left-K;case`right`:return b(t,n,K)&&n.x>r.right+K}}e(Ee,`leavesOutward`);function De(e,t,n){if(e.length<3)return e;if(n){let n=Te(e[0],e[1],t);return n&&Ee(n,e[1],e[2],t)?e.slice(1):e}let r=e.length-1,i=Te(e[r-1],e[r],t);return i&&Ee(i,e[r-1],e[r-2],t)?e.slice(0,r):e}e(De,`collapseOwnBorderStub`);function Oe(e,t,n){let r=e;if(t){let e=fe(r,0,1);if(e){let n=J(e,r[0],t);n!==r[0]&&(r=[n,...r.slice(1)])}r=De(r,t,!0)}if(n){let e=r.length-1,t=fe(r,e,-1);if(t){let i=J(t,r[e],n,!0);i!==r[e]&&(r=[...r.slice(0,e),i])}r=De(r,n,!1)}let i=xe(r,t,n);return i!==r||r.length===2?i:(t&&(r=we(r,t,!0)),n&&(r=we(r,n,!1)),r)}e(Oe,`snapAndCollapseEndpoints`);function ke(e,t){for(let n of e){let e=le(n,t,2);if(!e)continue;let r=Oe(D(e.points,K),e.srcRect,e.dstRect);if(r.length<3){e.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];e.edge.points=i}}e(ke,`prepareEdgeEndpointsForRenderer`);function Ae(e){return new Map(e.map(e=>[e.id,e]))}e(Ae,`buildNodeMap`);function je(e,t){let n=e.parentId,r=null;for(;n;){let e=t.get(n);if(!e?.isGroup)break;r=e.id,n=e.parentId}return r}e(je,`resolveTopLevelGroupId`);function Me(e,t){let n=0,r=e.parentId;for(;r;){let e=t.get(r);if(!e?.isGroup)break;n++,r=e.parentId}return n}e(Me,`groupDepth`);function Ne(e){let t=1/0,n=-1/0,r=1/0,i=-1/0;for(let a of e){let e=a.x,o=a.y;if(typeof e!=`number`||typeof o!=`number`)continue;let s=a.width??0,c=a.height??0;t=Math.min(t,e-s/2),n=Math.max(n,e+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}return t===1/0||r===1/0?null:{minX:t,maxX:n,minY:r,maxY:i}}e(Ne,`boundsForChildren`);function Pe(e,t){let n=e.padding??20;e.x=(t.minX+t.maxX)/2,e.y=(t.minY+t.maxY)/2,e.width=Math.max(0,t.maxX-t.minX)+n,e.height=Math.max(0,t.maxY-t.minY)+n}e(Pe,`applyGroupBounds`);function Fe(e){let t=Ae(e),n=e.filter(e=>e.isGroup&&e.parentId).sort((e,n)=>Me(n,t)-Me(e,t));for(let t of n){let n=Ne(e.filter(e=>e.parentId===t.id));n&&Pe(t,n)}}e(Fe,`recomputeNestedGroupBounds`);function Ie(t,n){let r=t.nodes??[],i=t.edges??[],a=r.filter(e=>!e.isGroup),o=1/0,s=-1/0;for(let e of a){let t=e[n];typeof t==`number`&&(o=Math.min(o,t),s=Math.max(s,t))}if(!Number.isFinite(o)||!Number.isFinite(s))return!1;let c=e(e=>o+s-e,`mirror`);for(let e of r){let t=e[n];typeof t==`number`&&(e[n]=c(t));let r=e.groupTitleRect;r&&(e.groupTitleRect=n===`x`?{...r,left:c(r.right),right:c(r.left)}:{...r,top:c(r.bottom),bottom:c(r.top)})}for(let e of i)for(let t of e.points??[])t[n]=c(t[n]);return!0}e(Ie,`mirrorAxis`);function Le(e){return!(e.nodes??[]).some(e=>!e.isGroup)||Ie(e,`y`)}e(Le,`applyBtDirectionTransform`);function Re(e,t=`LR`){let n=e.nodes??[],r=e.edges??[],i=n.filter(e=>!e.isGroup),a=1/0,o=1/0;for(let e of i){let t=e.x??0,n=e.y??0;t<a&&(a=t),n<o&&(o=n)}if(!Number.isFinite(a)||!Number.isFinite(o))return!1;let s=0,c=0;for(let e of i)s+=e.width??0,c+=e.height??0;let l=s/i.length,u=c/i.length,d=u>0?Math.max(1,l/u):1;for(let e of i){let t=e.x??0,n=((e.y??0)-o)*d+36,r=t-a;e.x=n,e.y=r}for(let e of r)if(e.points)for(let t of e.points){let e=t.x,n=(t.y-o)*d+36,r=e-a;t.x=n,t.y=r}Fe(n);let f=n.filter(e=>e.isGroup&&!e.parentId);if(f.length===0)return t===`RL`&&Ie(e,`x`),!0;let p=Ae(n),m=new Map;for(let e of n){if(e.isGroup)continue;let t=je(e,p);if(!t)continue;let n=m.get(t)??[];n.push(e),m.set(t,n)}let h=0;for(let e of f){let t=e.padding??0;t>h&&(h=t)}let g=[],_=1/0,v=-1/0;for(let e of f){let t=Ne(m.get(e.id)??[]);t&&(_=Math.min(_,t.minX),v=Math.max(v,t.maxX),g.push({lane:e,contentTop:t.minY,contentBottom:t.maxY,centerY:(t.minY+t.maxY)/2}))}if(_===1/0||v===-1/0)return!0;let y=Math.max(0,v-_)+2*Math.max(h,10),b=36+y,x=(_+v)/2-y/2-36,S=x+b/2,C=Math.max(h,36);g.sort((e,t)=>e.centerY-t.centerY);for(let e=0;e<g.length;e++){let t=g[e],n,r;if(n=e===0?t.contentTop-C:(g[e-1].contentBottom+t.contentTop)/2,e===g.length-1)r=t.contentBottom+C;else{let n=g[e+1];r=(t.contentBottom+n.contentTop)/2}let i=Math.max(0,r-n),a=(n+r)/2;t.lane.x=S,t.lane.y=a,t.lane.width=b,t.lane.height=i,t.lane.swimlaneContentTop=t.contentTop,t.lane.groupTitleRect={left:x,right:x+36,top:n,bottom:r}}return t===`RL`&&Ie(e,`x`),!0}e(Re,`applyLrDirectionTransform`);var ze=1e-6,Be=8,Ve=[0,Be,-Be,2*Be,-2*Be];function He(e,t){let{nodeInfoById:n,realNodeRects:r}=R(t);for(let t of e){if(t.isLayoutOnly)continue;let i=t.points;if(!i||i.length<4)continue;let a=O(D(i,ze),ze);if(!a)continue;let{p3:o}=a,s=a.kind===`HVH`,c=ne(t,n,ze);if(!c)continue;let{srcId:l,dstId:u,srcInfo:d,dstInfo:f,collinearX:p,collinearY:m}=c;if(p||m)continue;let h,g=d.rect;for(let n of Ve){let i,a,c;if(s){let e=f.cy>d.cy?g.bottom:g.top,t=d.cx+n;if(t<=g.left+ze||t>=g.right-ze)continue;i={x:t,y:e},a={x:t,y:o.y},c={x:o.x,y:o.y}}else{let e=f.cx>d.cx?g.right:g.left,t=d.cy+n;if(t<=g.top+ze||t>=g.bottom-ze)continue;i={x:e,y:t},a={x:o.x,y:t},c={x:o.x,y:o.y}}let p=v(i,a,ze),m=v(a,c,ze);if(p&&m||!p&&B(i,a,r,[l],1)||!m&&B(a,c,r,[u],1))continue;let _=!p&&ae(i,a,e,t,{epsilon:ze,skipDegenerateOther:!0}),y=!m&&ae(a,c,e,t,{epsilon:ze,skipDegenerateOther:!0});if(!(_||y)){h=p?[a,c]:m?[i,a]:[i,a,c];break}}h&&(t.points=h)}}e(He,`portSwapToLShape`);function Ue(t,n){let r=.001,{realNodeRects:i,labelNodeRects:a}=z(n.values());for(let o of t){if(o.isLayoutOnly)continue;let s=o.points;if(!s||s.length<4)continue;let c=D(s,r);if(c.length<4)continue;let l=c.length-1,u=c[l],d=c[l-1],f=c[l-2],p=u.x-d.x,m=u.y-d.y,h=Math.hypot(p,m);if(h>=10||h<r)continue;let g=d.x-f.x,_=d.y-f.y;if(Math.hypot(g,_)<r)continue;let v=x(d,u,r),C=S(d,u,r),w=x(f,d,r),T=S(f,d,r);if(!(v&&T||C&&w))continue;let E=o.end,O=o.start,k=E?n.get(E):void 0;if(!k)continue;let j=k.x??0,M=k.y??0,N=F(k);if(!N)continue;let P,I;if(T){let e=_<0;P={x:j,y:f.y},I={x:j,y:e?N.bottom:N.top}}else{let e=g>0;P={x:f.x,y:M},I={x:e?N.right:N.left,y:M}}if(B(P,I,i,E?[E]:[],-2)||B(P,I,a,[],-2))continue;if(O){let e=n.get(O),t=e?F(e):void 0;if(t&&A(P,t,2))continue}let ee=e((e,t)=>`${e.x.toFixed(3)},${e.y.toFixed(3)}|${t.x.toFixed(3)},${t.y.toFixed(3)}`,`ownSegmentKey`),L=new Set;for(let e=0;e<c.length-1;e++)L.add(ee(c[e],c[e+1]));let R=e((e,n)=>{for(let i of t){if(i===o||i.isLayoutOnly)continue;let t=i.points;if(!(!t||t.length<2))for(let i=0;i<t.length-1;i++){let a=t[i],o=t[i+1];if(!L.has(ee(a,o))&&V(e,n,a,o,r))return!0}}return!1},`segmentCrossesOtherEdge`);if(R(P,I))continue;if(l-3>=0){let e=c[l-3],t=[O,E].filter(e=>!!e);if(B(e,P,i,t,-2)||R(e,P))continue}let z=[...c.slice(0,l-2),P,I];o.points=z;let te=o.labelNodeId;if(te){let e=n.get(te);if(e){let t=e.width??0,n=e.height??0;if(t>0&&n>0){let i,a,o=-1;for(let e=0;e<z.length-1;e++){let s=z[e],c=z[e+1],l=Math.hypot(c.x-s.x,c.y-s.y),u=b(s,c,r),d=y(s,c,r);(u&&l>=t+2||d&&l>=n+2)&&l>o&&(o=l,i=(s.x+c.x)/2,a=(s.y+c.y)/2)}i!==void 0&&a!==void 0&&(e.x=i,e.y=a)}}}}}e(Ue,`collapseShortTerminalStub`);var Y=.001,X=8,Z=T,We=e((e,t)=>y(e,t,Y)||b(e,t,Y),`orthogonallyAligned`);function Ge(t,n){let r=e((e,t)=>{let n=e.x??0,r=e.y??0,i=t.x-n,a=t.y-r,o=(e.width??0)/2,s=(e.height??0)/2;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),{x:n+(a===0?0:s*i/a),y:r+s}):(i<0&&(o=-o),{x:n+o,y:r+(i===0?0:o*a/i)})},`rectIntersect`),i=e((e,t)=>{let i=D(e.points??[]);if(i.length<2)return;let a=t?e.start:e.end,o=a?n.get(a):void 0,s=o?F(o):void 0;if(!o||!a||!s)return;let c=t?i[0]:i[i.length-1],l=t?i[1]:i[i.length-2],u=r(o,c),d=c;if(We(l,u)&&(d=l),y(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`V`,coord:u.x,min:Math.min(u.y,d.y),max:Math.max(u.y,d.y),boundary:u,railEnd:d,rect:s};if(b(u,d,Y))return{edge:e,edgeId:String(e.id??``),nodeId:a,atStart:t,orientation:`H`,coord:u.y,min:Math.min(u.x,d.x),max:Math.max(u.x,d.x),boundary:u,railEnd:d,rect:s}},`terminalLaneFor`),a=e((e,t)=>Math.max(0,Math.min(e.max,t.max)-Math.max(e.min,t.min)),`projectedOverlapLength`),o=e((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:e.orientation===`H`?(Math.abs(e.boundary.x-e.rect.left)<1||Math.abs(e.boundary.x-e.rect.right)<1)&&y(e.boundary,t.boundary,1):(Math.abs(e.boundary.y-e.rect.top)<1||Math.abs(e.boundary.y-e.rect.bottom)<1)&&b(e.boundary,t.boundary,1),`sameTerminalFace`),s=e((e,t)=>e.nodeId!==t.nodeId||e.orientation!==t.orientation?!1:a(e,t)>=X&&Math.abs(e.coord-t.coord)<.5,`exactTerminalLaneConflict`),c=e((e,t)=>{if(e.nodeId!==t.nodeId||e.orientation!==t.orientation||e.orientation!==`H`||e.atStart===t.atStart)return!1;let n=a(e,t);if(n<X)return!1;let r=e.rect.bottom-e.rect.top;return n<r||n>2*r?!1:o(e,t)&&Math.abs(e.coord-t.coord)<16},`nearTerminalLaneConflict`),l=e((t,n)=>{let r=D(t.edge.points??[]);if(r.length<2)return;let i=t.orientation===`V`?{x:t.boundary.x+n,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+n},a=t.orientation===`V`?{x:t.railEnd.x+n,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+n};if(!e(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?b(i,t.boundary,Y)&&i.x>=t.rect.left+1&&i.x<=t.rect.right-1:Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1?y(i,t.boundary,Y)&&i.y>=t.rect.top+1&&i.y<=t.rect.bottom-1:!1,`boundaryStaysOnSameFace`)())return;if(t.atStart){let e=r.length>1&&v(r[1],t.railEnd,Y),n=r.slice(e?2:1),o=n[0];return o&&!We(o,a)?void 0:[i,a,...n]}let o=r.length>1&&v(r[r.length-2],t.railEnd,Y),s=r.slice(0,o?-2:-1),c=s[s.length-1];if(!c||We(c,a))return[...s,a,i]},`shiftedCandidate`),u=e(e=>{let t=e.edge,r=D(t.points??[]);if(r.length!==2)return!1;let i=t.start,a=t.end,o=i?n.get(i):void 0,s=a?n.get(a):void 0;if(!o||!s)return!1;let c=o.x??0,l=o.y??0,u=s.x??0,d=s.y??0,[f,p]=r;return b(f,p,Y)&&Math.abs(l-d)<1&&Math.abs(c-u)>1||y(f,p,Y)&&Math.abs(c-u)<1&&Math.abs(l-d)>1},`laneIsStraightCollinearConnector`),d=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){let e=t.filter(e=>!e.isLayoutOnly).flatMap(e=>[i(e,!0),i(e,!1)]).filter(e=>!!e),n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){let a=e[t],o=e[r];if(a.edge===o.edge||!(s(a,o)||c(a,o)))continue;let f=!s(a,o),p=[a,o].sort((e,t)=>{let n=u(e),r=u(t);return n===r?Number(!t.atStart)-Number(!e.atStart):Number(n)-Number(r)});for(let t of p){for(let r of d){let a=l(t,r);if(!a)continue;let o=i({...t.edge,points:a},t.atStart);if(o&&!e.some(e=>e.edge!==t.edge&&(s(o,e)||f&&c(o,e)))){t.edge.points=a,n=!0;break}}if(n)break}}if(!n)return}}e(Ge,`separateSharedRenderedTerminalLanes`);function Ke(t,n){let{realNodeRects:r,labelNodeRects:i}=z(n.values()),a=e((e,n)=>{let a=e.start,o=e.end,s=Z(n);if(s.length!==n.length-1)return!1;let c=[a,o].filter(e=>!!e);for(let e of s)if(B(e.a,e.b,r,c,-2)||B(e.a,e.b,i,[],-2))return!1;for(let n of t){if(n===e||n.isLayoutOnly)continue;let t=n.points;if(!(!t||t.length<2)){for(let e of s)for(let n of Z(D(t)))if(w(e,n,.5)>=X||V(e.a,e.b,n.a,n.b,Y))return!1}}return!0},`candidateIsSafe`),o=e((e,t)=>{if(t+4>=e.length)return;let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=e[t+4],s=x(n,r)&&S(r,i)&&x(i,a)&&S(a,o)&&y(n,a,Y)&&y(n,o,Y)&&y(r,i,Y)&&(r.x-n.x)*(a.x-i.x)<0,c=S(n,r)&&x(r,i)&&S(i,a)&&x(a,o)&&b(n,a,Y)&&b(n,o,Y)&&b(r,i,Y)&&(r.y-n.y)*(a.y-i.y)<0;if(s||c)return D([...e.slice(0,t+1),o,...e.slice(t+5)]);if(t+5>=e.length)return;let l=e[t+5],u=S(n,r)&&x(r,i)&&S(i,a)&&x(a,o)&&S(o,l)&&y(n,o,Y)&&y(n,l,Y)&&y(i,a,Y)&&(i.x-r.x)*(o.x-a.x)<0,d=x(n,r)&&S(r,i)&&x(i,a)&&S(a,o)&&x(o,l)&&b(n,o,Y)&&b(n,l,Y)&&b(i,a,Y)&&(i.y-r.y)*(o.y-a.y)<0;if(u||d)return D([...e.slice(0,t+1),l,...e.slice(t+6)])},`withoutDogleg`);for(let e=0;e<8;e++){let e=!1;for(let n of t){if(n.isLayoutOnly)continue;let t=D(n.points??[]);for(let r=0;r<=t.length-5;r++){let i=o(t,r);if(i&&a(n,i)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}e(Ke,`collapseRedundantRectangularDoglegs`);function qe(t,n){let{realNodeRects:r,labelNodeRects:i}=z(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t,n)=>D(e===t?n??[]:e.points??[]),`pointsFor`),s=e((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)V(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),c=e(e=>{let t=Z(e);if(t.length!==3)return;let n=t[1];if(t[0].horizontal!==n.horizontal&&t[2].horizontal!==n.horizontal)return{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}},`middleRail`),l=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);return r.filter(e=>{if(n.includes(e.id))return!1;let r=e.rect;return t.horizontal?C(t.a.x,t.b.x,r.left,r.right)>=X&&t.a.y>=r.top-2&&t.a.y<=r.bottom+2:C(t.a.y,t.b.y,r.top,r.bottom)>=X&&t.a.x>=r.left-2&&t.a.x<=r.right+2})},`blockingRectsFor`),u=e((e,t,n)=>{let r=e.map(e=>({...e}));if(t.horizontal)r[t.index].y=n,r[t.index+1].y=n;else if(t.vertical)r[t.index].x=n,r[t.index+1].x=n;else return;let i=G(D(r));return Z(i).length===i.length-1?i:void 0},`candidateByMovingRail`),d=e((e,t,n)=>{let c=[e.start,e.end].filter(e=>!!e),l=Z(t);if(l.length!==t.length-1)return!1;for(let e of l)if(B(e.a,e.b,r,c,-2)||B(e.a,e.b,i,[],-2))return!1;for(let t of a)if(t!==e){for(let e of l)for(let n of Z(o(t)))if(w(e,n,.5)>=X)return!1}return s(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=s(),t=!1;for(let n of a){let r=o(n),i=c(r);if(!i)continue;let a=l(n,i.segment);if(a.length===0)continue;let s=i.horizontal?[Math.min(...a.map(e=>e.rect.top))-20,Math.max(...a.map(e=>e.rect.bottom))+20]:[Math.min(...a.map(e=>e.rect.left))-20,Math.max(...a.map(e=>e.rect.right))+20];for(let a of s){let o=u(r,i.segment,a);if(o&&d(n,o,e)){n.points=o,t=!0;break}}if(t)break}if(!t)return}}e(qe,`liftObstacleHuggingSameSideRails`);function Je(t,n){let r=e(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=e(e=>{if(!e.isGroup||e.parentId)return;let t=e.direction,n=typeof t==`string`?t.toUpperCase():``;if(n===`LR`||n===`RL`||n===`BT`)return;let i=r(e),a=e.y,o=e.height;if(!i||typeof a!=`number`||typeof o!=`number`||!Number.isFinite(a)||!Number.isFinite(o)||o<=0)return;let s=i.right-i.left,c=i.bottom-i.top;if(!(c<=0||s<c))return{node:e,rect:i}},`topLaneTitleFor`),a=e((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:C(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),o=[...n.values()].map(i).filter(e=>!!e);if(o.length===0)return;let s=0;for(let e of t){if(e.isLayoutOnly)continue;let t=D(e.points??[]);for(let e of Z(t))for(let t of o)a(e,t.rect)&&(s=Math.max(s,t.rect.bottom-e.a.y+4))}if(!(s<=Y))for(let e of o){let t=e.node.y,n=e.node.height;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.y=t-s/2,e.node.height=n+s,e.node.groupTitleRect={...e.rect,top:e.rect.top-s,bottom:e.rect.bottom-s})}}e(Je,`liftTopLaneTitleBandsAboveRails`);function Ye(t,n){let r=e(e=>{let t=e.groupTitleRect;if(!(!t||typeof t.left!=`number`||typeof t.right!=`number`||typeof t.top!=`number`||typeof t.bottom!=`number`||!Number.isFinite(t.left)||!Number.isFinite(t.right)||!Number.isFinite(t.top)||!Number.isFinite(t.bottom)||t.right<=t.left||t.bottom<=t.top))return{left:t.left,right:t.right,top:t.top,bottom:t.bottom}},`validTitleRect`),i=e(e=>{if(!e.isGroup||e.parentId||e.direction!==`LR`)return;let t=r(e),n=e.x,i=e.width;if(!t||typeof n!=`number`||typeof i!=`number`||!Number.isFinite(n)||!Number.isFinite(i)||i<=0)return;let a=t.right-t.left,o=t.bottom-t.top;if(!(a<=0||o<a))return{node:e,rect:t}},`leftLaneTitleFor`),a=e((e,t)=>{if(!e.vertical)return!1;let n=e.a.x;return n<=t.left+Y||n>=t.right-Y?!1:C(e.a.y,e.b.y,t.top,t.bottom)>=X},`verticalSegmentIntersectsTitle`),o=e((e,t)=>{if(!e.horizontal)return!1;let n=e.a.y;return n<=t.top+Y||n>=t.bottom-Y?!1:C(e.a.x,e.b.x,t.left,t.right)>=X},`horizontalSegmentIntersectsTitle`),s=[...n.values()].map(i).filter(e=>!!e);if(s.length===0)return;let c=0;for(let e of t){if(e.isLayoutOnly)continue;let t=D(e.points??[]);for(let e of Z(t))for(let t of s)if(a(e,t.rect))c=Math.max(c,t.rect.right-e.a.x+4);else if(o(e,t.rect)){let n=Math.min(e.a.x,e.b.x);c=Math.max(c,t.rect.right-n+4)}}if(!(c<=Y))for(let e of s){let t=e.node.x,n=e.node.width;typeof t!=`number`||typeof n!=`number`||!Number.isFinite(t)||!Number.isFinite(n)||n<=0||(e.node.x=t-c/2,e.node.width=n+c,e.node.groupTitleRect={...e.rect,left:e.rect.left-c,right:e.rect.right-c})}}e(Ye,`shiftLeftLaneTitleBandsLeftOfRails`);function Xe(t,n){let{realNodeRects:r}=z(n.values()),i=t.filter(e=>!e.isLayoutOnly),a=e((e,t=new Map)=>D(t.get(e)??e.points??[]),`replacementPointsFor`),o=e((e=new Map)=>{let t=0;for(let n=0;n<i.length;n++){let r=Z(a(i[n],e));for(let o=n+1;o<i.length;o++){let n=Z(a(i[o],e));for(let e of r)for(let r of n)V(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`crossingCount`),s=e((e=new Map)=>i.reduce((t,n)=>t+E(a(n,e)),0),`totalBends`),c=e(e=>{let t=a(e);if(t.length<4)return;let n=t[t.length-2],r=t[t.length-1];if(x(n,r,Y)||S(n,r,Y))return{tailStart:n,terminal:r}},`terminalTailFor`),l=e((e,t)=>{let n=a(e);if(n.length<3)return;let r=n[0],i=n[1],o;if(x(r,i,Y))o={x:i.x,y:t.tailStart.y};else if(S(r,i,Y))o={x:t.tailStart.x,y:i.y};else return;let s=G(D([r,i,o,t.tailStart,t.terminal]));return Z(s).length===s.length-1?s:void 0},`candidateWithDestinationTail`),u=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(B(e.a,e.b,r,n,-2))return!0;return!1},`pathHasNodeHit`),d=e((e,t,n)=>{for(let r of i)if(r!==e){for(let e of Z(t))for(let t of Z(a(r,n)))if(w(e,t,.5)>=X)return!0}return!1},`pathHasSharedTrack`),f=e((e,t,n)=>!u(e,t)&&!d(e,t,n),`candidateIsSafe`),p=e(()=>{let e=new Map;for(let t of i){let r=t.end;if(!r||!n.has(r)||a(t).length<4)continue;let i=e.get(r)??[];i.push(t),e.set(r,i)}return e},`edgesByDestination`);for(let e=0;e<4;e++){let e=o();if(e===0)return;let t=s(),n,r=e,i=t;for(let t of p().values())for(let a=0;a<t.length;a++)for(let u=a+1;u<t.length;u++){let d=t[a],p=t[u],m=c(d),h=c(p);if(!m||!h)continue;let g=l(d,h),_=l(p,m);if(!g||!_)continue;let v=new Map([[d,g],[p,_]]);if(!f(d,g,v)||!f(p,_,v))continue;let y=o(v),b=s(v);y>=e||y>r||y===r&&b>=i||(n=v,r=y,i=b)}if(!n)return;for(let[e,t]of n)e.points=t}}e(Xe,`swapDestinationTerminalTailsToReduceCrossings`);function Ze(t,n){let{realNodeRects:r,labelNodeRects:i}=z(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t=new Map)=>D(t.get(e)??e.points??[]),`replacementPointsFor`),s=e((e=new Map)=>{let t=0;for(let n=0;n<a.length;n++){let r=Z(o(a[n],e));for(let i=n+1;i<a.length;i++){let n=Z(o(a[i],e));for(let e of r)for(let r of n)V(e.a,e.b,r.a,r.b,Y)&&t++}}return t},`strictCrossingCount`),c=e((e=new Map)=>a.reduce((t,n)=>t+E(o(n,e)),0),`totalBends`),l=e(e=>{let t=e.start,r=e.end,i=t?n.get(t):void 0,a=r?n.get(r):void 0,o=i?F(i):void 0,s=a?F(a):void 0;return o&&s?{src:o,dst:s}:void 0},`endpointRectsFor`),u=e((e,t,n)=>{if(n.index<=0||n.index+1>=t.length-1)return;let r=l(e);if(r){if(n.vertical){let i=n.a.x,a=Math.min(r.src.left,r.dst.left),o=Math.max(r.src.right,r.dst.right),s=i<a-Y?`left`:i>o+Y?`right`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`vertical`,side:s,coord:i,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}:void 0}if(n.horizontal){let i=n.a.y,a=Math.min(r.src.top,r.dst.top),o=Math.max(r.src.bottom,r.dst.bottom),s=i<a-Y?`top`:i>o+Y?`bottom`:void 0;return s?{edge:e,points:t,segmentIndex:n.index,axis:`horizontal`,side:s,coord:i,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}:void 0}}},`externalRailForSegment`),d=e(()=>{let e=[];for(let t of a){let n=o(t);for(let r of Z(n)){let i=u(t,n,r);i&&e.push(i)}}return e},`collectExternalRails`),f=e((e,t)=>e.edge!==t.edge&&e.axis===t.axis&&e.side===t.side&&C(e.min,e.max,t.min,t.max)>=X,`railsInteract`),p=e(e=>{let t=[],n=new Set;for(let r of e){if(n.has(r))continue;let i=[r],a=[];for(n.add(r);i.length>0;){let t=i.pop();a.push(t);for(let r of e)!n.has(r)&&f(t,r)&&(n.add(r),i.push(r))}a.length>1&&t.push(a)}return t},`connectedComponents`),m=e(e=>{let t=[];for(let n of e)t.some(e=>Math.abs(e-n.coord)<Y)||t.push(n.coord);for(;t.length<e.length;){let n=Math.min(...t),r=Math.max(...t),i=e[0].side;t.push(i===`left`||i===`top`?n-12*(e.length-t.length):r+12*(e.length-t.length))}return t},`uniqueCoordsFor`),h=e(t=>{let n=t.map(e=>e.coord),r=m(t),i=[];if(t.length<=6){let a=Array(r.length).fill(!1),o=[],s=e(()=>{if(o.length===t.length){o.some((e,t)=>Math.abs(e-n[t])>=Y)&&i.push([...o]);return}for(let[e,t]of r.entries())a[e]||(a[e]=!0,o.push(t),s(),o.pop(),a[e]=!1)},`visit`);return s(),i}for(let e=0;e<n.length;e++)for(let t=e+1;t<n.length;t++){let r=[...n];[r[e],r[t]]=[r[t],r[e]],i.push(r)}return i},`coordinateAssignmentsFor`),g=e((e,t)=>{let n=new Map;for(let[r,i]of e.entries()){let e=t[r],a=n.get(i.edge)??i.points.map(e=>({x:e.x,y:e.y}));i.axis===`vertical`?(a[i.segmentIndex].x=e,a[i.segmentIndex+1].x=e):(a[i.segmentIndex].y=e,a[i.segmentIndex+1].y=e),n.set(i.edge,a)}let r=new Map;for(let[e,t]of n){let n=G(D(t));if(Z(n).length!==n.length-1)return;r.set(e,n)}return r},`replacementsForAssignment`),_=e(e=>{for(let[t,n]of e){let e=[t.start,t.end].filter(e=>!!e);for(let t of Z(n))if(B(t.a,t.b,r,e,-2)||B(t.a,t.b,i,[],-2))return!1}for(let t=0;t<a.length;t++){let n=a[t],r=e.has(n),i=Z(o(n,e));for(let n=t+1;n<a.length;n++){let t=a[n];if(!r&&!e.has(t))continue;let s=Z(o(t,e));for(let e of i)for(let t of s)if(w(e,t,.5)>=X)return!1}}return!0},`candidateIsSafe`);for(let e=0;e<4;e++){let e=s();if(e===0)return;let t,n=e,r=c(),i=1/0;for(let a of p(d()))for(let o of h(a)){let l=g(a,o);if(!l||!_(l))continue;let u=s(l);if(u>=e)continue;let d=c(l),f=a.reduce((e,t,n)=>e+Math.abs(o[n]-t.coord),0);u>n||u===n&&(d>r||d===r&&f>=i)||(t=l,n=u,r=d,i=f)}if(!t)return;for(let[e,n]of t)e.points=n}}e(Ze,`reassignCrossingExternalRailChannels`);function Qe(t,n){let{realNodeRects:r,labelNodeRects:i}=z(n.values()),a=t.filter(e=>!e.isLayoutOnly),o=e((e,t,n)=>D(e===t?n??[]:e.points??[]),`pointsFor`),s=e(e=>Z(e).reduce((e,t)=>{let n=t.a.x-t.b.x,r=t.a.y-t.b.y;return e+Math.hypot(n,r)},0),`pathLength`),c=e((e,t)=>{let n=0;for(let r=0;r<a.length;r++){let i=Z(o(a[r],e,t));for(let s=r+1;s<a.length;s++){let r=Z(o(a[s],e,t));for(let e of i)for(let t of r)V(e.a,e.b,t.a,t.b,Y)&&n++}}return n},`strictCrossingCount`),l=e((e,t)=>{if(e.horizontal){let n=e.a.y;return(Math.abs(n-t.top)<1||Math.abs(n-t.bottom)<1)&&C(e.a.x,e.b.x,t.left,t.right)>=X}if(e.vertical){let n=e.a.x;return(Math.abs(n-t.left)<1||Math.abs(n-t.right)<1)&&C(e.a.y,e.b.y,t.top,t.bottom)>=X}return!1},`segmentRunsAlongRectBorder`),u=e(e=>{let t=[e.start,e.end].filter(e=>!!e),r=[];for(let e of t){let t=n.get(e),i=t?F(t):void 0;i&&r.push(i)}return r},`endpointRectsFor`),d=e((e,t)=>{if(t+3>=e.length)return[];let n=e[t],r=e[t+1],i=e[t+2],a=e[t+3],o=x(n,r,Y)&&S(r,i,Y)&&x(i,a,Y),s=S(n,r,Y)&&x(r,i,Y)&&S(i,a,Y);if(!o&&!s||!(o?Math.sign(r.x-n.x)!==Math.sign(a.x-i.x):Math.sign(r.y-n.y)!==Math.sign(a.y-i.y)))return[];let c=y(n,a,Y)||b(n,a,Y)?[]:[{x:n.x,y:a.y},{x:a.x,y:n.y}],l=c.length===0?[[...e.slice(0,t+1),...e.slice(t+3)]]:c.map(n=>[...e.slice(0,t+1),n,...e.slice(t+3)]),u=new Set;return l.map(e=>G(D(e))).filter(e=>{if(Z(e).length!==e.length-1||!e.some(e=>v(e,a,Y)))return!1;let t=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return!u.has(t)&&(u.add(t),!0)})},`shortcutCandidatesAt`),f=e((e,t,n)=>{let s=[e.start,e.end].filter(e=>!!e),d=u(e);for(let e of Z(t))if(B(e.a,e.b,r,s,-2)||B(e.a,e.b,i,[],-2)||d.some(t=>l(e,t)))return!1;for(let n of a)if(n!==e){for(let e of Z(t))for(let t of Z(o(n)))if(w(e,t,.5)>=X)return!1}return c(e,t)<=n},`candidateIsSafe`);for(let e=0;e<8;e++){let e=c(),t,n,r=e,i=1/0,l=1/0;for(let u of a){let a=o(u),p=E(a,Y),m=s(a);for(let o=0;o<=a.length-4;o++)for(let h of d(a,o)){let a=E(h,Y),o=s(h);if(!(a<p||a===p&&o<m-Y)||!f(u,h,e))continue;let d=c(u,h);d>r||d===r&&(a>i||a===i&&o>=l)||(t=u,n=h,r=d,i=a,l=o)}}if(!t||!n)return;t.points=n}}e(Qe,`shortcutRedundantOrthogonalJogs`);function $e(t,n){let r=[];for(let e of n.values()){if(e.isGroup||e.isEdgeLabel)continue;let t=e.x??0,n=e.y??0,i=F(e);i&&r.push({id:String(e.id??``),cx:t,cy:n,rect:i})}if(r.length===0)return;let i=new Map(r.map(e=>[e.id,e])),a=r.map(e=>({id:e.id,rect:e.rect})),o=[`top`,`bottom`,`left`,`right`],s={top:Math.min(...r.map(e=>e.rect.top))-20,bottom:Math.max(...r.map(e=>e.rect.bottom))+20,left:Math.min(...r.map(e=>e.rect.left))-20,right:Math.max(...r.map(e=>e.rect.right))+20},c=t.filter(e=>!e.isLayoutOnly),l=new Map(c.map((e,t)=>[e,t])),u=e(e=>{let t=e===`left`||e===`top`?-1:1,n=[];for(let r=0;r<=2;r++)n.push(s[e]+t*20*r);return n},`outwardTracksForSide`),d=e((e,t=new Map)=>D(t.get(e)??e.points??[]),`replacementPointsFor`),f=e((e,t)=>{let n=0;for(let r of e)for(let e of t)V(r.a,r.b,e.a,e.b,Y)&&n++;return n},`crossingCountBetweenSegments`),p=e((e,t)=>f(Z(e),Z(t)),`crossingCountBetweenPaths`),m=e((t=new Map)=>{let n=0,r=[],i=new Set,a=[],o=e(e=>{i.has(e)||(i.add(e),a.push(e))},`addEdge`);for(let e=0;e<c.length;e++){let i=c[e],a=d(i,t);for(let s=e+1;s<c.length;s++){let e=c[s],l=p(a,d(e,t));l>0&&(n+=l,r.push({first:i,second:e,count:l}),o(i),o(e))}}return a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),{count:n,pairs:r,edgeSet:i,edges:a}},`crossingSnapshot`),h=e((e,t)=>{let n=new Set(t.keys());if(n.size===0)return e.count;let r=0;for(let t of e.pairs)(n.has(t.first)||n.has(t.second))&&(r+=t.count);let i=0;for(let e=0;e<c.length;e++){let r=c[e],a=n.has(r),o=d(r,t);for(let r=e+1;r<c.length;r++){let e=c[r];(a||n.has(e))&&(i+=p(o,d(e,t)))}}return e.count-r+i},`crossingCountWithReplacements`),g=e(e=>{let t=new Map;for(let n of e.pairs){let e=t.get(n.first)??new Set;e.add(n.second),t.set(n.first,e);let r=t.get(n.second)??new Set;r.add(n.first),t.set(n.second,r)}let n=[],r=new Set;for(let i of e.edges){if(r.has(i))continue;let e=[i],a=[];for(r.add(i);e.length>0;){let n=e.pop();a.push(n);for(let i of t.get(n)??[])r.has(i)||(r.add(i),e.push(i))}a.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),a.length>1&&n.push(a)}return n},`crossingComponents`),_=e(e=>[e.start,e.end].filter(e=>!!e),`endpointIdsFor`),v=e(e=>{let t=[];for(let n of g(e)){let e=new Set(n),r=new Set(n.flatMap(e=>_(e))),i=[...n];for(let t of c)e.has(t)||_(t).some(e=>r.has(e))&&i.push(t);i.sort((e,t)=>(l.get(e)??0)-(l.get(t)??0)),t.push(i)}return t},`pairSearchGroups`),y=e((e,t,n)=>h(e,new Map([[t,n]])),`crossingCountWithSingleReplacement`),b=e(e=>{let t=new Map;for(let n of e.pairs)t.set(n.first,(t.get(n.first)??0)+n.count),t.set(n.second,(t.get(n.second)??0)+n.count);return t},`currentCrossingsByEdge`),C=e(e=>e.slice(1).reduce((t,n,r)=>{let i=e[r];return t+Math.abs(n.x-i.x)+Math.abs(n.y-i.y)},0),`pathLength`),T=e((e=new Map)=>c.reduce((t,n)=>t+E(d(n,e)),0),`totalBends`),O=e((e=new Map)=>c.reduce((t,n)=>t+C(d(n,e)),0),`totalLength`),k=e((e,t,n=new Map)=>{let r=Z(t);for(let t of c)if(t!==e){for(let e of r)for(let r of Z(d(t,n)))if(w(e,r,.5)>=X)return!0}return!1},`pathHasSegmentConflict`),A=e((e,t)=>{let n=[e.start,e.end].filter(e=>!!e);for(let e of Z(t))if(B(e.a,e.b,a,n,-2))return!0;return!1},`pathHitsNode`),j=e((e,t)=>{let n=G(D(t));Z(n).length===n.length-1&&e.push(n)},`pushOrthogonalCandidate`),M=e(e=>e===`left`||e===`right`,`sideIsHorizontal`),N=e((e,t,n)=>{switch(t){case`left`:return Math.min(e.x,n.x)-20;case`right`:return Math.max(e.x,n.x)+20;case`top`:return Math.min(e.y,n.y)-20;case`bottom`:return Math.max(e.y,n.y)+20}},`localTrackForSameSide`),P=e((e,t,n,r)=>{let i=n===`left`||n===`top`?-1:1,a=[N(t,n,r),s[n]];for(let o of a)for(let a=0;a<=2;a++)j(e,L(t,n,r,o+i*20*a))},`addSameSideCandidates`),R=e((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))j(e,[t,{x:a,y:t.y},{x:a,y:n},{x:r.x,y:n},r])},`addHorizontalToVerticalCandidates`),z=e((e,t,n,r,i)=>{for(let a of u(n))for(let n of u(i))j(e,[t,{x:t.x,y:a},{x:n,y:a},{x:n,y:r.y},r])},`addVerticalToHorizontalCandidates`),te=e((e,t,n,r,i)=>{let a=[...u(`top`),...u(`bottom`)];for(let o of u(n))for(let n of u(i))for(let i of a)j(e,[t,{x:o,y:t.y},{x:o,y:i},{x:n,y:i},{x:n,y:r.y},r])},`addHorizontalPairCandidates`),ne=e((e,t,n,r,i)=>{let a=[...u(`left`),...u(`right`)];for(let o of u(n))for(let n of u(i))for(let i of a)j(e,[t,{x:t.x,y:o},{x:i,y:o},{x:i,y:n},{x:r.x,y:n},r])},`addVerticalPairCandidates`),re=e(e=>{let t=new Set;return e.map(e=>D(e)).filter(e=>{let n=e.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return t.has(n)||e.length<2?!1:(t.add(n),!0)})},`dedupeCandidatePaths`),ie=e((e,t,n,r)=>{let i=[],a=ee(e,t,n,r,20,Y);a&&j(i,a),t===r&&P(i,e,t,n);let o=M(t),s=M(r);return o&&!s?R(i,e,t,n,r):!o&&s?z(i,e,t,n,r):o?te(i,e,t,n,r):ne(i,e,t,n,r),re(i)},`buildCandidatesForSides`),ae=e((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=I(r,s),c=s===`top`||s===`bottom`?u(s):a;for(let r of i){j(e,[t,n,{x:r,y:n.y},{x:r,y:o.y},o]);for(let i of c)j(e,[t,n,{x:r,y:n.y},{x:r,y:i},{x:o.x,y:i},o])}}},`addVerticalDepartureOuterTrackCandidates`),oe=e((e,t,n,r)=>{let i=[...u(`left`),...u(`right`)],a=[...u(`top`),...u(`bottom`)];for(let s of o){let o=I(r,s),c=s===`left`||s===`right`?u(s):i;for(let r of a){j(e,[t,n,{x:n.x,y:r},{x:o.x,y:r},o]);for(let i of c)j(e,[t,n,{x:n.x,y:r},{x:i,y:r},{x:i,y:o.y},o])}}},`addHorizontalDepartureOuterTrackCandidates`),H=e(e=>{let t=e.start,n=e.end,r=n?i.get(n):void 0;if(!t||!r)return[];let a=D(e.points??[]);if(a.length<4)return[];let o=a[0],s=a[1],c=[];return S(o,s,Y)?ae(c,o,s,r):x(o,s,Y)&&oe(c,o,s,r),c},`terminalPreservingOuterTrackCandidates`),U=e(e=>{let t=e.start,n=e.end,r=t?i.get(t):void 0,a=n?i.get(n):void 0;if(!r||!a)return[];let s=[];for(let e of o){let t=I(r,e);for(let n of o)s.push(...ie(t,e,I(a,n),n))}return s.push(...H(e)),s},`candidatePathsFor`),W=e(()=>new Map(c.map(e=>[e,Z(d(e))])),`currentSegmentsByEdge`),K=e((e,t,n)=>{let r=new Set;for(let i of c){if(i===e)continue;let a=n.get(i)??Z(d(i));t.some(e=>a.some(t=>w(e,t,.5)>=X))&&r.add(i)}return r},`sharedTrackConflictsFor`),se=e((e,t,n,r)=>{let i=new Set;return U(e).map(e=>G(D(e))).filter(t=>{if(A(e,t))return!1;let n=t.map(e=>`${e.x.toFixed(3)},${e.y.toFixed(3)}`).join(`|`);return i.has(n)||t.length<2?!1:(i.add(n),!0)}).map(i=>{let a=Z(i),o=0;for(let t of c)t!==e&&(o+=f(a,n.get(t)??Z(d(t))));return{candidate:i,candidateSegments:a,crossings:t.count-(r.get(e)??0)+o,bends:E(i,Y),totalBends:E(i),length:C(i)}}).filter(({crossings:e})=>e<=t.count).sort((e,t)=>e.crossings-t.crossings||e.bends-t.bends||e.length-t.length).slice(0,48).map(t=>({path:t.candidate,segments:t.candidateSegments,sharedTrackConflicts:K(e,t.candidateSegments,n),totalBends:t.totalBends,length:t.length}))},`pairCandidatesFor`),ce=e((e,t,n,r,i,a)=>{let o=0;for(let n of e.pairs)(n.first===t||n.second===t||n.first===r||n.second===r)&&(o+=n.count);let s=f(n.segments,i.segments);for(let e of c){if(e===t||e===r)continue;let o=a.get(e)??Z(d(e));s+=f(n.segments,o)+f(i.segments,o)}return e.count-o+s},`pairCrossingCount`),le=e((e,t)=>{for(let n of e.sharedTrackConflicts)if(n!==t)return!1;return!0},`conflictsOnlyWith`),ue=e((e,t)=>e.segments.some(e=>t.segments.some(t=>w(e,t,.5)>=X)),`candidatesShareTrack`),de=e((e,t,n,r)=>le(t,n.edge)&&le(r,e.edge)&&!ue(t,r),`pairCandidatesAreCompatible`),q=e((e,t,n,r,i)=>{let a=ce(e.current,t.edge,n,r.edge,i,e.baseSegments);if(!(a>=e.current.count))return{replacements:new Map([[t.edge,n.path],[r.edge,i.path]]),crossings:a,bends:e.currentBends-(e.baseBendsByEdge.get(t.edge)??0)-(e.baseBendsByEdge.get(r.edge)??0)+n.totalBends+i.totalBends,length:e.currentLength-(e.baseLengthByEdge.get(t.edge)??0)-(e.baseLengthByEdge.get(r.edge)??0)+n.length+i.length}},`scorePairReplacement`),J=e((e,t)=>e.crossings<t.crossings||e.crossings===t.crossings&&(e.bends<t.bends||e.bends===t.bends&&e.length<t.length),`pairScoreIsBetter`),fe=e((e,t,n,r)=>{let i=r;for(let r of t.candidates)for(let a of n.candidates){if(!de(t,r,n,a))continue;let o=q(e,t,r,n,a);o&&J(o,i)&&(i=o)}return i},`bestScoreForOptionPair`),pe=e(e=>{let t=T(),n=O(),r=W(),i=b(e),a=new Map(c.map(e=>[e,E(d(e))])),o=new Map(c.map(e=>[e,C(d(e))])),s=new Map,l=v(e);for(let t of l)for(let n of t){if(s.has(n))continue;let t=se(n,e,r,i);t.length>0&&s.set(n,{edge:n,candidates:t})}let u={replacements:new Map,crossings:e.count,bends:t,length:n},f={current:e,currentBends:t,currentLength:n,baseBendsByEdge:a,baseLengthByEdge:o,baseSegments:r};for(let t of l){let n=new Set(t.filter(t=>e.edgeSet.has(t))),r=t.map(e=>s.get(e)).filter(e=>!!e);for(let e=0;e<r.length;e++){let t=r[e];for(let i=e+1;i<r.length;i++){let e=r[i];(n.has(t.edge)||n.has(e.edge))&&(u=fe(f,t,e,u))}}}return u.replacements.size>0?u.replacements:void 0},`bestPairedReplacement`);for(let e=0;e<4;e++){let e=m(),t=e.count;if(t===0)return;let n,r,i=t,a=1/0;for(let o of e.edges){let s=E(d(o),Y);for(let c of U(o)){let l=A(o,c),u=!l&&k(o,c),d=y(e,o,c),f=E(c,Y);l||u||(d<t||d===t&&f<s)&&(d>i||d===i&&f>=a||(n=o,r=c,i=d,a=f))}}if(n&&r){n.points=r;continue}let o=pe(e);if(!o)return;for(let[e,t]of o)e.points=t}}e($e,`resolveRenderedOrthogonalCrossings`);var et=.001,tt=8;function nt(t,n){let{nodeInfoById:r,realNodeRects:i}=R(n),a=[`top`,`bottom`,`left`,`right`],o={top:Math.min(...i.map(e=>e.rect.top))-20,bottom:Math.max(...i.map(e=>e.rect.bottom))+20,left:Math.min(...i.map(e=>e.rect.left))-20,right:Math.max(...i.map(e=>e.rect.right))+20},s=e((e,t,n,r)=>{let i=[],a=ee(e,t,n,r,20,et);return a&&i.push(a),t===r&&i.push(L(e,t,n,o[t])),i},`buildOrthogonalPathCandidates`),c=e((e,t)=>{for(let n=0;n<e.length-1;n++){let r=e[n],a=e[n+1];if(B(r,a,i,t,1))return!0}return!1},`pathHitsNode`),l=e((e,n,r=!1)=>{let i=0,a=T(e,et),o=n.start,s=n.end;for(let e of t){if(e===n||e.isLayoutOnly)continue;let t=e.start,c=e.end;if(!r&&o&&s&&(t===o||t===s||c===o||c===s))continue;let l=e.points;if(!(!l||l.length<2))for(let e of a)for(let t of T(l,et)){if(re(e.a,e.b,t.a,t.b,et,et)){i++;continue}w(e,t,et)>=tt&&i++}}return i},`pathConflictCount`),u=e((e,t)=>{let n=Math.abs(e.y-t.rect.top),r=Math.abs(e.y-t.rect.bottom),i=Math.abs(e.x-t.rect.left),a=Math.abs(e.x-t.rect.right),o=`top`,s=n;return r<s&&(o=`bottom`,s=r),i<s&&(o=`left`,s=i),a<s&&(o=`right`,s=a),o},`nearestSideOfRect`),d=new Map,f=e((e,t,n)=>{let r=d.get(e)??[];r.push({side:t,edgeId:n}),d.set(e,r)},`addFaceClaim`);for(let e of t){if(e.isLayoutOnly)continue;let t=e.points??[];if(t.length<1)continue;let n=e.id??``,i=e.start,a=e.end;if(i){let e=r.get(i);e&&f(i,u(t[0],e),n)}if(a){let e=r.get(a);e&&f(a,u(t[t.length-1],e),n)}}let p=e((e,t,n)=>d.get(e)?.some(e=>e.edgeId!==n&&e.side===t)??!1,`faceIsClaimed`);for(let e of t){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=E(t,et);if(n<4)continue;let i=e.start,o=e.end;if(!i||!o)continue;let m=r.get(i),h=r.get(o);if(!m||!h)continue;let g=e.id??``,_=l(t,e,!0),v=l(t,e),y,b=_,x=n;for(let t of a){if(p(i,t,g))continue;let n=I(m,t);for(let r of a){if(p(o,r,g))continue;let a=I(h,r);for(let u of s(n,t,a,r)){if(c(u,[i,o]))continue;let t=E(u,et);if(_>0){let n=l(u,e,!0);if(n>b||n===b&&t>=x)continue;b=n,x=t,y=u;continue}l(u,e)>v||t<x&&(x=t,y=u)}}}if(y){e.points=y;let t=d.get(i);t&&d.set(i,t.filter(e=>e.edgeId!==g));let n=d.get(o);n&&d.set(o,n.filter(e=>e.edgeId!==g)),f(i,u(y[0],m),g),f(o,u(y[y.length-1],h),g)}}}e(nt,`simplifyDetouredEdges`);var Q=.001,rt=10,it=7;function at(e,t){let n=t?0:e.length-1,r=t?1:-1,i=e[n],a=e[n+r];if(!i||!a)return;let o=a.x-i.x,s=a.y-i.y;if(!(Math.abs(o)+Math.abs(s)<Q)){if(Math.abs(s)<=Q){let e=i.x+Math.sign(o)*rt;return{left:Math.min(i.x,e),right:Math.max(i.x,e),top:i.y-it,bottom:i.y+it}}if(Math.abs(o)<=Q){let e=i.y+Math.sign(s)*rt;return{left:i.x-it,right:i.x+it,top:Math.min(i.y,e),bottom:Math.max(i.y,e)}}return{left:Math.min(i.x,a.x),right:Math.max(i.x,a.x),top:Math.min(i.y,a.y),bottom:Math.max(i.y,a.y)}}}e(at,`markerClearanceRectFor`);function ot(e){return{left:Math.min(e.left,e.right),right:Math.max(e.left,e.right),top:Math.min(e.top,e.bottom),bottom:Math.max(e.top,e.bottom)}}e(ot,`normalizeRect`);function st(e,t){let n=D(t);return[at(n,!0),at(n,!1)].some(t=>t&&M(e,ot(t)))}e(st,`labelOverlapsOwnMarker`);function ct(t,n){let r=[];for(let e of t){if(e.isLayoutOnly)continue;let t=e.points;if(!(!t||t.length<2))for(let n=0;n<t.length-1;n++)r.push({edgeId:e.id,p1:t[n],p2:t[n+1]})}let i=[],a=[];for(let e of n.values()){let t=e.isGroup,n=e.parentId;if(t&&!n){let t=F(e);t&&a.push({id:e.id,rect:t});continue}if(t||e.isEdgeLabel)continue;let r=F(e);r&&i.push({nodeId:e.id,rect:r})}let o=e((e,t)=>{let n=N(t,3);for(let{nodeId:t,rect:r}of i)if(t!==e&&M(n,r))return!0;return!1},`labelOverlapsForeignNode`),s=e((e,t)=>{let n=N(t,3);for(let t of r)if(t.edgeId!==e&&k(t.p1,t.p2,n))return!0;return!1},`labelOverlapsForeignEdge`),c=e((e,t,n)=>o(e,n)||s(t,n),`labelOverlapsAnything`),l=[],u=e(e=>{for(let{id:t,rect:n}of a)if(j(n,e))return t},`findContainingLane`),d=e((e,t)=>l.some(n=>n.labelId!==e&&M(t,n.rect)),`overlapsPlacedLabel`);for(let r of t){if(r.isLayoutOnly)continue;let t=r.labelNodeId;if(!t)continue;let i=n.get(t);if(!i)continue;let f=r.points;if(!f||f.length<2)continue;let p=i.width??0,m=i.height??0;if(p<=0||m<=0)continue;let h=[];for(let e=0;e<f.length-1;e++){let t=f[e],n=f[e+1],r=Math.abs(t.x-n.x),i=Math.abs(t.y-n.y);r<Q&&i<Q||r>=Q&&i>=Q||h.push({idx:e,length:r+i,orientation:r>=Q?`horizontal`:`vertical`,midX:(t.x+n.x)/2,midY:(t.y+n.y)/2})}if(h.length===0)continue;let g=h.length>=3?h.filter(e=>e.idx>0&&e.idx<h.length-1):h,_=g.length>0?g:h,v=p>=m?`horizontal`:`vertical`,y=e(e=>[...e].sort((e,t)=>{let n=e.orientation===v;if(n!==(t.orientation===v))return n?-1:1;let r=e.length>=(e.orientation===`horizontal`?p:m)+2;return r===t.length>=(t.orientation===`horizontal`?p:m)+2?t.length-e.length:r?-1:1}),`rankSegments`),b=h[0],x=h[h.length-1],S=[.5,.25,.75,.05,.95,.15,.85,.1,.9],C=e((e,t)=>{let n=f[e.idx],r=f[e.idx+1];return{midX:n.x+(r.x-n.x)*t,midY:n.y+(r.y-n.y)*t}},`anchorAtT`),w=e((e,t,n)=>Math.min(n,Math.max(t,e)),`clamp`),T=e((e,t)=>e.midX>=t.left-Q&&e.midX<=t.right+Q&&e.midY>=t.top-Q&&e.midY<=t.bottom+Q,`pointInsideRectInclusive`),E=e(e=>{let t=P(e.midX,e.midY,p,m),n=u(t);if(n)return{laneId:n,anchor:e,rect:t};let r=a.find(({rect:t})=>T(e,t));if(!r)return;let i=r.rect.left+p/2+1,o=r.rect.right-p/2-1,s=r.rect.top+m/2+1,c=r.rect.bottom-m/2-1;if(i>o||s>c)return;let l={midX:w(e.midX,i,o),midY:w(e.midY,s,c)},d=P(l.midX,l.midY,p,m);return T(e,d)?{laneId:r.id,anchor:l,rect:d}:void 0},`placementForAnchor`),D=e((e,t,n)=>e.orientation===`horizontal`?Math.abs(t.midX-n.x):Math.abs(t.midY-n.y),`distanceAlongSegment`),O=e((e,t)=>{let n=(e.orientation===`horizontal`?p/2:m/2)+12;if(e===b){let r=f[e.idx];if(D(e,t,r)+Q<n)return!1}if(e===x){let r=f[e.idx+1];if(D(e,t,r)+Q<n)return!1}return!0},`labelClearsTerminalEndpoints`),k=e(e=>{let n=y(e);for(let e of n)for(let n of S){let i=C(e,n);if(!O(e,i))continue;let a=E(i);if(a&&!st(a.rect,f)&&!d(t,a.rect)&&!c(t,r.id,a.rect))return{laneId:a.laneId,anchor:a.anchor}}},`tryPool`),A=e((e,n,i=!1)=>{let a=y(e);for(let e of a){let a={midX:e.midX,midY:e.midY};if(n&&!O(e,a))continue;let c=E(a);if(c&&!st(c.rect,f)&&!d(t,c.rect)&&!o(t,c.rect)&&(i||!s(r.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},`findLaneContainingFallback`),j=k(_)??(_.length<h.length?k(h):void 0)??A(h,!0)??A(h,!1)??A(h,!1,!0);if(j){i.x=j.anchor.midX,i.y=j.anchor.midY,i.parentId=j.laneId;let e=P(j.anchor.midX,j.anchor.midY,p,m),n=l.findIndex(e=>e.labelId===t);n>=0?l[n]={labelId:t,rect:e}:l.push({labelId:t,rect:e})}}}e(ct,`anchorLabelsToPolyline`);var lt=1e-6,ut=4,dt=3;function ft(e,t){return e<t?`${e}::${t}`:`${t}::${e}`}e(ft,`pairKey`);function pt(t,n){let{nodeInfoById:r,realNodeRects:i}=R(n),a=new Map;for(let e of n){let t=e.id;if(!e.isGroup&&e.isEdgeLabel){a.set(t,{w:e.width??0,h:e.height??0});continue}}let o=e((n,r,i,o)=>{let s=ft(r,i),c=0,l=e(e=>{if(!e)return;let t=a.get(e);if(!t)return;let n=o===`x`?t.w/2:t.h/2;n>c&&(c=n)},`consider`);l(n.labelNodeId);for(let e of t){if(e===n||e.isLayoutOnly)continue;let t=e.start,r=e.end;t&&r&&ft(t,r)===s&&l(e.labelNodeId)}return c>0?c+dt:0},`labelClearanceFor`);for(let e of t){if(e.isLayoutOnly)continue;let n=e.points;if(!O(n,lt))continue;let a=ne(e,r,lt);if(!a)continue;let{srcId:s,dstId:c,srcInfo:l,dstInfo:u,collinearX:d,collinearY:f}=a;if(d===f)continue;let p,m;if(d){let e=u.cy>l.cy;p={x:l.cx,y:e?l.rect.bottom:l.rect.top},m={x:u.cx,y:e?u.rect.top:u.rect.bottom}}else{let e=u.cx>l.cx;p={x:e?l.rect.right:l.rect.left,y:l.cy},m={x:e?u.rect.left:u.rect.right,y:u.cy}}if(B(p,m,i,[s,c],1))continue;let h=o(e,s,c,d?`x`:`y`),g=h>ut?h:ut,_=[0,g,-g];for(let n of _){let r={...p},a={...m};if(d){if(r.x+=n,a.x+=n,r.x<=l.rect.left||r.x>=l.rect.right||a.x<=u.rect.left||a.x>=u.rect.right)continue}else if(r.y+=n,a.y+=n,r.y<=l.rect.top||r.y>=l.rect.bottom||a.y<=u.rect.top||a.y>=u.rect.bottom)continue;if(!B(r,a,i,[s,c],1)&&!ae(r,a,t,e,{epsilon:lt})){e.points=[r,a];break}}}}e(pt,`straightenCollinearSiblingDetours`);function mt(t,n){let r=.001,{realNodeRects:i,labelNodeRects:a}=z(n.values()),o=e((e,t)=>T(t,r).map(n=>({...n,edge:e,interior:n.index>=1&&n.index<=t.length-3})),`segmentsFor`),s=e(()=>{let e=[];for(let n of t){if(n.isLayoutOnly)continue;let t=n.points;!t||t.length<2||e.push(...o(n,D(t)))}return e},`allSegments`),c=e((e,t)=>e.horizontal&&t.horizontal?C(e.a.x,e.b.x,t.a.x,t.b.x)>=8&&Math.abs(e.a.y-t.a.y)<7:e.vertical&&t.vertical?C(e.a.y,e.b.y,t.a.y,t.b.y)>=8&&Math.abs(e.a.x-t.a.x)<7:!1,`hasCrowdedParallelTrack`),l=e((e,n)=>{let s=e.start,l=e.end,u=o(e,n);if(u.length!==n.length-1)return!1;let d=[s,l].filter(e=>!!e),f=e.labelNodeId?[e.labelNodeId]:[];for(let e of u)if(B(e.a,e.b,i,d,-2)||B(e.a,e.b,a,f,-2))return!1;for(let n of t){if(n===e||n.isLayoutOnly)continue;let t=n.points;if(!(!t||t.length<2)){for(let e of u)for(let i of o(n,D(t)))if(c(e,i)||V(e.a,e.b,i.a,i.b,r))return!1}}return!0},`candidateIsSafe`),u=e((e,t)=>{let n=D(e.edge.points??[]);if(n.length<4||e.index>=n.length-1)return;let r=n.map(e=>({...e}));if(e.horizontal)r[e.index].y+=t,r[e.index+1].y+=t;else if(e.vertical)r[e.index].x+=t,r[e.index+1].x+=t;else return;return o(e.edge,r).length===r.length-1?r:void 0},`shiftedCandidate`),d=e((e,t)=>({x:e.x??(t.left+t.right)/2,y:e.y??(t.top+t.bottom)/2}),`nodeCenter`),f=e(e=>{let t=e.edge,r=D(t.points??[]);if(r.length!==4||e.index!==1)return;let i=t.start?n.get(t.start):void 0,a=t.end?n.get(t.end):void 0,o=i?F(i):void 0,s=a?F(a):void 0,c=r.slice(e.index+2);if(i&&a&&o&&s&&c.length!==0)return{sourceCenter:d(i,o),targetCenter:d(a,s),sourceRect:o,tail:c}},`sourceDetourContextFor`),p=e((e,t,n,i,a,o)=>{let s=i.y>=n.y,c=s?a.bottom:a.top,l=c+(s?20:-20);if(s&&e.b.y<=l+r||!s&&e.b.y>=l-r)return;let u=e.a.x+t;return D([{x:n.x,y:c},{x:n.x,y:l},{x:u,y:l},{x:u,y:e.b.y},...o],r)},`verticalSourceDetour`),m=e((e,t,n,i,a,o)=>{let s=i.x>=n.x,c=s?a.right:a.left,l=c+(s?20:-20);if(s&&e.b.x<=l+r||!s&&e.b.x>=l-r)return;let u=e.a.y+t;return D([{x:c,y:n.y},{x:l,y:n.y},{x:l,y:u},{x:e.b.x,y:u},...o],r)},`horizontalSourceDetour`),h=e((e,t)=>{let n=f(e);if(n){if(e.vertical)return p(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail);if(e.horizontal)return m(e,t,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail)}},`sourceDetourCandidate`),g=[-7,7,-14,14,-21,21];for(let e=0;e<12;e++){let e=s(),t=!1;for(let n=0;n<e.length&&!t;n++)for(let r=n+1;r<e.length&&!t;r++){let i=e[n],a=e[r];if(i.edge===a.edge||!c(i,a))continue;let o=[i,a].filter(e=>e.interior);for(let e of o){for(let n of g){let r=u(e,n);if(r&&l(e.edge,r)){e.edge.points=r,t=!0;break}let i=h(e,n);if(i&&l(e.edge,i)){e.edge.points=i,t=!0;break}}if(t)break}}if(!t)return}}e(mt,`nudgeSharedInteriorSubpaths`);function ht(e,t,n,r){let i=t.x-e.x,a=t.y-e.y,o=r.x-n.x,s=r.y-n.y,c=i*s-a*o;if(Math.abs(c)<1e-10)return!1;let l=n.x-e.x,u=n.y-e.y,d=(l*s-u*o)/c,f=(l*a-u*i)/c,p=.01;return d>p&&d<.99&&f>p&&f<.99}e(ht,`segmentsIntersect`);function gt(e){let n=e.nodes??[],r=e.edges??[],i=[];if(!r.length||!n.length)return i;let a=te(n),o=[];for(let e of r){if(e.isLayoutOnly)continue;let t=e.points;if(!t||t.length<2)continue;let n=e.start,r=e.end,s=e.labelNodeId,c=e.id??`${n}->${r}`;for(let e of a)if(e.nodeId!==n&&e.nodeId!==r&&!(s&&e.nodeId===s)){for(let n=0;n<t.length-1;n++)if(k(t[n],t[n+1],e,-1)){i.push({type:`edge-node-overlap`,edgeId:c,targetId:e.nodeId,detail:`segment ${n} passes through node "${e.nodeId}"`});break}}for(let e=0;e<t.length-1;e++)o.push({edgeId:c,start:n,end:r,p1:t[e],p2:t[e+1]})}let s=new Set;for(let e=0;e<o.length;e++)for(let t=e+1;t<o.length;t++){let n=o[e],r=o[t];if(n.edgeId!==r.edgeId&&n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&ht(n.p1,n.p2,r.p1,r.p2)){let e=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;s.has(e)||(s.add(e),i.push({type:`edge-edge-crossing`,edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(i.length>0){let e=i.filter(e=>e.type===`edge-node-overlap`).length,n=i.filter(e=>e.type===`edge-edge-crossing`).length;t.warn(`[SWIMLANE_VALIDATE] ${i.length} issue(s) detected: ${e} edge-node overlap(s), ${n} edge crossing(s)`);for(let e of i)t.warn(`[SWIMLANE_VALIDATE] ${e.type}: ${e.detail}`)}return i}e(gt,`validateSwimlanesLayout`);function _t(t,n){let r=t.nodes??[],i=t.edges??[],a=r.filter(e=>!e.isGroup);if((n===`LR`||n===`RL`)&&a.length>0&&!Re(t,n)||n===`BT`&&a.length>0&&!Le(t))return;for(let e of i){if(e.isLayoutOnly)continue;let t=e.points;!t||t.length<2||(e.points=G(W(t)))}nt(i,r),pt(i,r),He(i,r);let o=new Map;for(let e of r)o.set(String(e.id),e);ct(i,o),q(i,o),Ue(i,o),mt(i,o),Ge(i,o),Ke(i,o),qe(i,o),Xe(i,o);let s=e(()=>{$e(i,o),Ze(i,o),Qe(i,o),ct(i,o),ke(i,o),qe(i,o),ct(i,o),ke(i,o)},`finalizeRenderedEdges`);s(),mt(i,o),s(),Je(i,o),Ye(i,o),Je(i,o),Ye(i,o)}e(_t,`postProcessSwimlaneLayout`);function vt(e){let t=new Map(e.nodeById),n=new Set,r=[];for(let i of e.edges){if(!t.has(i.src)||!t.has(i.dst))continue;let e=`${i.id}:${i.src}->${i.dst}`;n.has(e)||(n.add(e),r.push(i))}return{nodes:[...t.keys()],edges:r,layout:e.layout,nodeById:t}}e(vt,`normalizeGraph`);function yt(e,t){return e.edges.filter(e=>e.dst===t)}e(yt,`incoming`);function bt(e){let t=new Map;for(let n of e.nodes)t.set(n,[]);for(let n of e.edges)t.get(n.src).push(n.dst);return t}e(bt,`buildSuccessorMap`);function xt(e){let t=bt(e);for(let e of t.values())e.sort((e,t)=>e.localeCompare(t));return t}e(xt,`buildSortedSuccessorMap`);function St(e){let t=new Map;for(let n of e.nodes)t.set(n,0);for(let n of e.edges)t.set(n.dst,(t.get(n.dst)??0)+1);return t}e(St,`buildInDegreeMap`);function Ct(e){return[...e.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,t)=>e.localeCompare(t))}e(Ct,`sortedZeroInDegreeNodes`);function wt(e,t=()=>!0){let n=new Map,r=new Map;for(let t of e.nodes)n.set(t,[]),r.set(t,[]);for(let i of e.edges)t(i)&&(r.get(i.src).push(i.dst),n.get(i.dst).push(i.src));return{preds:n,succs:r}}e(wt,`buildPredecessorSuccessorMaps`);function Tt(e,t,n,r){let i=0;for(let t of e.nodes)r?.skipGroups&&e.nodeById.get(t)?.isGroup||(i=Math.max(i,n[t]??0));let a=Array.from({length:i+1},()=>[]);for(let i of t)r?.skipGroups&&e.nodeById.get(i)?.isGroup||a[Math.max(0,n[i]??0)].push(i);return a}e(Tt,`buildLayersFromRanks`);function Et(e){let t=St(e),n=Ct(t),r=[],i=xt(e);for(;n.length;){let e=n.shift();r.push(e);for(let r of i.get(e)??[])if(t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0){let e=0;for(;e<n.length&&n[e]<r;)e++;n.splice(e,0,r)}}return r.length===e.nodes.length?r:null}e(Et,`topoSortIfAcyclic`);function Dt(e){let t=new Map,n=0;for(let r of e)t.set(r,n),n++;return t}e(Dt,`buildLayerIndex`);function Ot(t){let n=Array(t.length),r=e((e,i)=>{if(i-e<=1)return 0;let a=e+i>>1,o=r(e,a)+r(a,i),s=e,c=a,l=e;for(;s<a||c<i;)c>=i||s<a&&t[s]<=t[c]?n[l++]=t[s++]:(n[l++]=t[c++],o+=a-s);for(let r=e;r<i;r++)t[r]=n[r];return o},`count`);return r(0,t.length)}e(Ot,`countInversions`);function kt(t){let n=vt(t),r=new Map;for(let e of n.nodes)r.set(e,[]);for(let e of n.edges)r.get(e.src).push(e);for(let e of r.values())e.sort((e,t)=>e.dst===t.dst?e.id.localeCompare(t.id):e.dst.localeCompare(t.dst));let i=Object.create(null);for(let e of n.nodes)i[e]=0;let a=[],o=e(e=>{i[e]=1;for(let t of r.get(e)??[]){let e=t.dst;i[e]===0?o(e):i[e]===1&&a.push(t)}i[e]=2},`dfs`),s=St(n),c=[...n.nodes.filter(e=>(s.get(e)??0)===0),...n.nodes.filter(e=>(s.get(e)??0)!==0)];for(let e of c)i[e]===0&&o(e);let l=new Set(a.map(e=>`${e.id}:${e.src}->${e.dst}`)),u=n.edges.map(e=>l.has(`${e.id}:${e.src}->${e.dst}`)?{id:e.id,src:e.dst,dst:e.src,weight:e.weight,ref:e.ref}:e);return{acyclic:{nodes:[...n.nodes],edges:u,layout:n.layout,nodeById:new Map(n.nodeById)},reversed:a}}e(kt,`removeCycles_DFS`);function At(t){let n=new Map,r=e(e=>{if(n.has(e))return n.get(e);let i=t.nodeById.get(e);if(!i)return n.set(e,null),null;let a=i.parentId;if(!a)return n.set(e,null),null;let o=r(a)??a;return n.set(e,o),o},`resolve`);for(let e of t.nodes)r(e);return n}e(At,`buildTopLaneMap`);function jt(e){let t=At(e);return e=>t.get(e)??null}e(jt,`createTopLaneResolver`);function Mt(e){let t=[];for(let n of e.layout.nodes??[])n.isGroup&&!n.parentId&&t.push(n.id);return[...new Set(t)].reverse()}e(Mt,`buildTopLaneOrder`);function Nt(e,t){let n=Mt(e);if(!t||t.length===0)return n;let r=new Set(n),i=new Set,a=[];for(let e of t)r.has(e)&&!i.has(e)&&(i.add(e),a.push(e));for(let e of n)i.has(e)||a.push(e);return a}e(Nt,`resolveTopLaneOrder`);var Pt={EPSILON:1e-6},Ft={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},It={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Lt(t,n){let r=vt(t),i=n?.laneOf??(()=>null),a=n?.rankHint,{preds:o}=wt(r);for(let e of o.values())e.sort((e,t)=>e.localeCompare(t));let s=Et(r)??[...r.nodes].sort((e,t)=>e.localeCompare(t)),c=new Map;for(let[e,t]of s.entries())c.set(t,e);let l=new Map,u=new Map;for(let e of r.nodes)u.set(e,[]);for(let e of s){let t=(o.get(e)??[]).filter(e=>l.has(e));if(t.length>0){let n=Rt(e,t,{laneOf:i,rankHint:a,topoIndex:c});l.set(e,n),u.get(n).push(e)}else l.has(e)||l.set(e,null)}for(let e of r.nodes)l.has(e)||l.set(e,null);let d=new Set;for(let e of r.nodes)(l.get(e)??null)===null&&d.add(e);let f=[...d].sort((e,t)=>{let n=c.get(e)??0,r=c.get(t)??0;return n===r?e.localeCompare(t):n-r}),p=zt(r),m=new Map;for(let[e,t]of p.entries())m.set(e,[...t].sort((e,t)=>e.localeCompare(t)));let h=Bt(m),g=Vt(m),_=new Map;for(let e of r.nodes)_.set(e,[]);for(let e of g)for(let t of e.nodes){let n=_.get(t);n?n.push(e.id):_.set(t,[e.id])}let v=[],y=[],b=new Set,x=e(e=>{if(!b.has(e)){b.add(e),v.push(e);for(let t of u.get(e)??[])x(t);y.push(e)}},`walk`);for(let e of f)x(e);for(let e of s)x(e);return{parent:l,children:u,roots:f,componentOf:h,blocks:g,nodeBlocks:_,adjacency:m,preorder:v,postorder:y,topologicalOrder:s}}e(Lt,`buildDrivingTree`);function Rt(e,t,n){let r=n.laneOf(e);return[...t].sort((e,t)=>{let i=n.laneOf(e),a=n.laneOf(t),o=i!=null&&i===r;if(o!==(a!=null&&a===r))return o?-1:1;let s=n.rankHint?.[e],c=n.rankHint?.[t];if(s!=null&&c!=null&&s!==c)return c-s;let l=n.topoIndex.get(e)??0,u=n.topoIndex.get(t)??0;return l===u?e.localeCompare(t):l-u})[0]}e(Rt,`chooseParent`);function zt(e){let t=new Map;for(let n of e.nodes)t.set(n,new Set);for(let n of e.edges)t.get(n.src).add(n.dst),t.get(n.dst).add(n.src);return t}e(zt,`buildAdjacency`);function Bt(e){let t=new Map,n=0;for(let r of e.keys()){if(t.has(r))continue;let i=[r];for(;i.length>0;){let r=i.pop();if(!t.has(r)){t.set(r,n);for(let n of e.get(r)??[])t.has(n)||i.push(n)}}n++}return t}e(Bt,`assignComponents`);function Vt(t){let n=new Map,r=new Map,i=[],a=[],o=0,s=e((e,c)=>{n.set(e,++o),r.set(e,o);for(let l of t.get(e)??[])l!==c&&(n.has(l)?(n.get(l)??0)<(n.get(e)??0)&&(i.push([e,l]),r.set(e,Math.min(r.get(e)??o,n.get(l)??o))):(i.push([e,l]),s(l,e),r.set(e,Math.min(r.get(e)??o,r.get(l)??o)),(r.get(l)??0)>=(n.get(e)??0)&&a.push(Ht(e,l,i,a.length))))},`visit`);for(let e of t.keys())n.has(e)||s(e,null);return a}e(Vt,`computeBlocks`);function Ht(e,t,n,r){let i=[],a=new Set;for(;n.length>0;){let r=n.pop();if(i.push(r),a.add(r[0]),a.add(r[1]),r[0]===e&&r[1]===t||r[0]===t&&r[1]===e)break}return{id:r,edges:i,nodes:[...a]}}e(Ht,`popBlock`);function Ut(t,n,r){let i=[...t.nodes],a=new Map;for(let[e,t]of i.entries())a.set(t,e);let o=i.length,s=Array(o).fill(-1),c=Array(o).fill(0),l=[],u=new Set;for(let e of i){let t=r.parent.get(e)??null,n=a.get(e);n!=null&&(t??(s[n]=-1,c[n]=0,u.has(e)||(u.add(e),l.push(e))))}for(;l.length>0;){let e=l.shift(),t=a.get(e);if(t==null)continue;let n=r.children.get(e)??[];for(let e of n){if(u.has(e))continue;let n=a.get(e);n!=null&&(s[n]=t,c[n]=c[t]+1,u.add(e),l.push(e))}}for(let e of i){if(u.has(e))continue;let t=a.get(e);t!=null&&(s[t]=-1,c[t]=0,u.add(e))}let d=Math.max(1,Math.ceil(Math.log2(Math.max(1,o)))+1),f=Array.from({length:d},()=>Array(o).fill(-1));for(let e=0;e<o;e++)f[0][e]=s[e];for(let e=1;e<d;e++)for(let t=0;t<o;t++){let n=f[e-1][t];f[e][t]=n===-1?-1:f[e-1][n]}let p=e((e,t)=>{if(e===-1||t===-1)return-1;c[e]<c[t]&&([e,t]=[t,e]);let n=c[e]-c[t];for(let t=0;t<d;t++)if(n>>t&1&&(e=f[t][e],e===-1))return-1;if(e===t)return e;for(let n=d-1;n>=0;n--){let r=f[n][e],i=f[n][t];r!==-1&&i!==-1&&r!==i&&(e=r,t=i)}return f[0][e]},`lcaIndex`),m=Array.from({length:o},()=>new Map);for(let e of t.edges){let t=e.src,r=e.dst,i=n[t],o=n[r];if(i==null||o==null||(i>o&&([t,r]=[r,t],[i,o]=[o,i]),i==null||o==null||i===o))continue;let s=a.get(t),c=a.get(r);if(s==null||c==null)continue;let l=p(s,c);if(l===-1)continue;let u=m[l];for(let e=i;e<o;e++)u.set(e,(u.get(e)??0)+1)}let h=new Map,g=e((e,t)=>{if(t.size!==0)for(let[n,r]of t)e.set(n,(e.get(n)??0)+r)},`mergeInto`),_=new Set,v=e(e=>{let t=a.get(e);_.add(e);let i=t==null?void 0:m[t],o=i?new Map(i):new Map,s=r.children.get(e)??[];for(let t of s){let r=v(t),i=n[e];if(i!=null){let a=h.get(e);a||(a=new Map,h.set(e,a));let o=r.get(i)??0,s=n[t];s!=null&&s>i&&(o+=1),a.set(t,o)}g(o,r)}return o},`dfs`);for(let e of r.roots)_.has(e)||v(e);for(let e of i)_.has(e)||v(e);return h}e(Ut,`computeSubtreeCrossCounts`);function Wt(t,n,r){let i=new Map,a=e(e=>{let t=r[e]??0,o=[...n.get(e)??[]];o.sort(Gt(r));for(let e of o){a(e);let n=i.get(e);n!=null&&(t=Math.min(t,n))}i.set(e,t)},`annotate`);for(let e of t)a(e);return i}e(Wt,`annotateMinimumLayers`);function Gt(e){return(t,n)=>{let r=e[t]??0,i=e[n]??0;return r===i?t.localeCompare(n):r-i}}e(Gt,`compareByRankThenId`);function Kt(t,n,r,i){let a=0;for(let e of n){let t=r[e]??0;t>a&&(a=t)}let o=Array.from({length:a+1},()=>[]),s=new Set,c=e(e=>{if(s.has(e))return;s.add(e);let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e);for(let t of i(e))c(t)},`emit`);for(let e of t)c(e);for(let e of n)if(!s.has(e)){let t=r[e]??0;o[t]||(o[t]=[]),o[t].push(e),s.add(e)}return o}e(Kt,`emitNodesInTreeOrder`);function qt(e){let t=[];for(let n of e){let e=new Set,r=[];for(let t of n)e.has(t)||(e.add(t),r.push(t));t.push(r)}return t}e(qt,`deduplicateLayers`);function Jt(e,t,n,r){return i=>{let a=e.get(i)??[];if(a.length===0)return[];let o=t[i]??0,s=[],c=[],l=n.get(i);for(let e of a){let t=r.get(e)??o;t>o?s.push({child:e,min:t}):c.push(e)}return s.sort((e,t)=>e.min===t.min?e.child.localeCompare(t.child):e.min-t.min),c.sort((e,t)=>{let n=l?.get(e)??0,i=l?.get(t)??0;if(n!==i)return n-i;let a=r.get(e)??o,s=r.get(t)??o;return a===s?e.localeCompare(t):a-s}),[...s.map(e=>e.child),...c]}}e(Jt,`createChildOrderer`);function Yt(e,t,n){let r=Lt(e,{rankHint:t,laneOf:n}),{children:i,roots:a}=r;for(let t of e.nodes)i.has(t)||i.set(t,[]);let o=Ut(e,t,r),s=[...a].sort(Gt(t)),c=Jt(i,t,o,Wt(s,i,t)),l=Kt(s,e.nodes,t,c);return l=qt(l),l}e(Yt,`buildMultitreeLayerOrder`);function Xt(e,t,n){let r=new Set(e),i=new Set(t),a=Dt(t),o=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&o.push(a.get(e.dst));return Ot(o)}e(Xt,`countCrossingsBetweenAdjacent`);function Zt(e,t,n){let r=[];for(let e of t){let t=n[e.src],i=n[e.dst];if(t==null||i==null||t===i)continue;let a=e.src,o=e.dst,s=t,c=i;t>i&&(a=e.dst,o=e.src,s=i,c=t);for(let t=s;t<c;t++)r.push({id:`${e.id}@${t}`,src:a,dst:o,ref:e.ref})}let i=0;for(let t=0;t+1<e.length;t++)i+=Xt(e[t],e[t+1],r);return i}e(Zt,`totalCrossings`);function Qt(e,t){let n={...t},{preds:r}=wt(e),i=jt(e),a=Zt(Yt(e,n,i),e.edges,n),o=Ft.MAX_CROSSING_OPTIMIZATION_PASSES;for(let t=0;t<o;t++){let t=!1,o=[...e.nodes].sort((e,t)=>(n[t]??0)-(n[e]??0));for(let s of o){let o=n[s]??0;if(o===0)continue;let c=0;for(let e of r.get(s)??[])c=Math.max(c,(n[e]??0)+1);if(c>=o)continue;let l=o;n[s]=c;let u=Zt(Yt(e,n,i),e.edges,n);u<a?(a=u,t=!0):n[s]=l}if(!t)break}return n}e(Qt,`optimizeRanksByCrossings`);function $t(e,t){let n=jt(e),r=[...e.nodes].sort((e,n)=>(t[e]??0)-(t[n]??0)||e.localeCompare(n));for(let i of r){let r=n(i);if(!r)continue;let a=e.edges.filter(e=>e.src===i);if(a.length===0)continue;let o=!1,s=0;for(let e of a){let t=n(e.dst);t==null||t===r?o=!0:s++}if(s===0||o)continue;let c=0,l=!1;for(let t of e.edges){if(t.dst!==i)continue;let e=n(t.src);e&&(e===r?l=!0:c++)}if(c>0||!l)continue;let u=t[i]??0,d=u+s,f=0;for(let n of e.edges)n.dst===i&&(f=Math.max(f,(t[n.src]??0)+1));let p=Math.max(u,f,d);p!==u&&(t[i]=p)}}e($t,`adjustCrossLaneSources`);function en(e,t){let n=vt(e),r=Et(n)??[...n.nodes].sort(),i=t?.compactSingleInput??!1,a=jt(n),o=Object.create(null);for(let e of r){let r=yt(n,e),s=t?.ignoreCrossLaneEdges?r.filter(t=>{let n=a(t.src),r=a(e);return!n||!r||n===r}):r;if(s.length===0)o[e]=0;else if(i&&s.length===1){let t=s[0].src;a(t)===a(e)?o[e]=(o[t]??0)+1:o[e]=o[t]??0}else{let t=-1/0;for(let e of s)t=Math.max(t,(o[e.src]??0)+1);o[e]=t===-1/0?0:t}}return(t?.optimizeRanksByCrossings??!1)&&(o=Qt(n,o)),t?.ignoreCrossLaneEdges&&$t(n,o),{layers:Yt(n,o,a),rankOf:o,dummy:new Set}}e(en,`assignLayers_LongestPath`);function tn(t,n){let r=vt(t),i={...en(r,{compactSingleInput:n?.compactSingleInput,ignoreCrossLaneEdges:n?.ignoreCrossLaneEdges,optimizeRanksByCrossings:n?.optimizeRanksByCrossings}).rankOf},a=jt(r),{preds:o,succs:s}=wt(r,e=>{if(n?.ignoreCrossLaneEdges){let t=a(e.src),n=a(e.dst);if(t&&n&&t!==n)return!1}return!0}),c=Et(r)??[...r.nodes],l=[...c].reverse(),u=e((e,t)=>{let n=0;for(let t of o.get(e)??[])n=Math.max(n,(i[t]??0)+1);let r=1/0,a=s.get(e)??[];return a.length>0&&(r=Math.min(...a.map(e=>(i[e]??0)-1))),Number.isFinite(r)||(r=Math.max(n,t)),Math.min(Math.max(t,n),r)},`clampFeasible`),d=Ft.GRAVITY_ITERATIONS,f=e(e=>{let t=!1;for(let n of e){let e=o.get(n)??[],r=s.get(n)??[];if(e.length===0&&r.length===0)continue;let a=e.length>0?e.reduce((e,t)=>e+(i[t]??0)+1,0)/e.length:i[n]??0,c=r.length>0?r.reduce((e,t)=>e+(i[t]??0)-1,0)/r.length:i[n]??0,l=Math.round((a+c)/2),d=u(n,l);d!==i[n]&&(i[n]=d,t=!0)}return t},`relaxOrder`);for(let e=0;e<d;e++){let e=f(c),t=f(l);if(!e&&!t)break}for(let e of c){let t=0;for(let n of o.get(e)??[])t=Math.max(t,(i[n]??0)+1);(i[e]??0)<t&&(i[e]=t)}for(let e of l){let t=s.get(e)??[];if(t.length>0){let n=Math.min(...t.map(e=>(i[e]??0)-1));(i[e]??0)>n&&(i[e]=n)}}return{layers:Tt(r,c,i),rankOf:i,dummy:new Set}}e(tn,`assignLayers_Gravity`);function nn(e){let t=St(e),n=xt(e),r=Ct(t),i=[];for(;r.length>0;){let e=[];for(let a of r){i.push(a);for(let r of n.get(a)??[])t.set(r,(t.get(r)??0)-1),(t.get(r)??0)===0&&e.push(r)}r=e.sort((e,t)=>e.localeCompare(t))}return i.length===e.nodes.length?i:null}e(nn,`topoSortByGenerationIfAcyclic`);function rn(t,n){let r=vt(t),i=n?.direction===`LR`?nn(r)??[...r.nodes].sort():Et(r)??[...r.nodes].sort(),a=jt(r),o=e(e=>a(e)??e,`laneOf`),s=Object.create(null),c=new Map,l=e((e,t)=>n?.ignoreCrossLaneEdges??!0?+(o(e)===o(t)):1,`edgeWeight`);for(let e of i){if(r.nodeById.get(e)?.isGroup)continue;let t=yt(r,e),n=0;if(t.length>0)for(let r of t){let t=r.src,i=s[t]??0;n=Math.max(n,i+l(t,e))}let i=o(e),a=c.get(i)??0,u=Math.max(n,a);s[e]=u,c.set(i,u+1)}return{layers:Tt(r,i,s,{skipGroups:!0}),rankOf:s,dummy:new Set}}e(rn,`assignLayers_LaneAwareCompact`);function an(t,n){let r=vt(n),{rankOf:i}=t,a=t.layers.map(e=>[...e]),o=new Set(t.dummy?[...t.dummy]:[]),s=0,c=new Map(r.nodeById),l=e(e=>{let t=`placeholder-${s++}`,n={id:t,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(t,n),o.add(t);a.length<=e;)a.push([]);return a[e].push(t),i[t]=e,t},`addDummyAt`),u=[...r.edges].sort((e,t)=>e.id===t.id?e.src===t.src?e.dst.localeCompare(t.dst):e.src.localeCompare(t.src):e.id.localeCompare(t.id)),d=[];for(let e of u){let t=i[e.src]??0,n=i[e.dst]??0;if(n-t<=1){d.push(e);continue}let r=e.src;for(let i=t+1,a=0;i<n;i++,a++){let t=l(i);d.push({id:`${e.id}#${a}`,src:r,dst:t,weight:e.weight,ref:e.ref}),r=t}let a=n-t-2;d.push({id:`${e.id}#${Math.max(a+1,0)}`,src:r,dst:e.dst,weight:e.weight,ref:e.ref})}let f={nodes:[...r.nodes,...[...o].filter(e=>!r.nodes.includes(e))],edges:d,layout:r.layout,nodeById:c};return{layering:{layers:a,rankOf:i,dummy:o},graphWithDummies:f}}e(an,`makeProperLayering`);function on(e){let t=e.length;if(t===0)return 1/0;let n=[...e].sort((e,t)=>e-t);return t%2==1?n[(t-1)/2]:.5*(n[t/2-1]+n[t/2])}e(on,`median`);function sn(e){return e.length===0?1/0:e.reduce((e,t)=>e+t,0)/e.length}e(sn,`barycenter`);function cn(e,t,n,r){let i=new Map;for(let t of e)i.set(t,[]);for(let e of n)r===`down`?t.has(e.src)&&i.has(e.dst)&&i.get(e.dst).push(t.get(e.src)):t.has(e.dst)&&i.has(e.src)&&i.get(e.src).push(t.get(e.dst));return i}e(cn,`neighborPositionsFor`);function ln(e,t,n){let r=n.get(e)??0,i=n.get(t)??0;return r===i?e.localeCompare(t):r-i}e(ln,`currentOrderTieBreak`);function un(e,t,n){let r=new Set(e),i=new Set(t),a=Dt(e),o=Dt(t),s=[];for(let e of n)r.has(e.src)&&i.has(e.dst)&&s.push({u:a.get(e.src),v:o.get(e.dst)});return s.sort((e,t)=>e.u===t.u?e.v-t.v:e.u-t.u),Ot(s.map(e=>e.v))}e(un,`countCrossingsBetweenAdjacent`);function dn(e,t,n){return[...e].sort((e,r)=>{let i=on(t.get(e)??[]),a=on(t.get(r)??[]);return i===a?ln(e,r,n):isFinite(i)?isFinite(a)?i-a:-1:1})}e(dn,`sortByHeuristic`);function fn(e,t,n,r,i,a){let o=Dt(e),s=Dt(t),c=cn(t,o,n,r);if(!i||!a||a.length===0)return dn(t,c,s);let l=new Map;for(let e of t){let t=i(e),n=l.get(t)??[];n.push(e),l.set(t,n)}let u=[];for(let e of a){let t=l.get(e);if(!t||t.length===0)continue;let n=dn(t,c,s);u.push(...n)}let d=l.get(null);if(d&&d.length>0){let e=dn(d,c,s);for(let t of e){let e=sn(c.get(t)??[]),n=u.length;if(isFinite(e)){for(let[t,r]of u.entries())if(e<sn(c.get(r)??[])){n=t;break}}u.splice(n,0,t)}}return u}e(fn,`reorderLayer`);function pn(t,n,r,i,a){let o=[...n],s=new Set(t),c=new Set(n),l=i?new Set(i):null,u=r.filter(e=>s.has(e.src)&&c.has(e.dst)),d=l?r.filter(e=>c.has(e.src)&&l.has(e.dst)):void 0,f=e(e=>{let n=un(t,e,u);return d&&i&&(n+=un(e,i,d)),n},`crossingScore`),p=a?new Map:null;if(a&&p)for(let e of n)p.set(e,a(e));let m=!0,h=f(o);for(;m;){m=!1;for(let e=0;e+1<o.length;e++){if(p&&p.get(o[e])!==p.get(o[e+1]))continue;let t=h;[o[e],o[e+1]]=[o[e+1],o[e]];let n=f(o);n<t?(h=n,m=!0):[o[e],o[e+1]]=[o[e+1],o[e]]}}return o}e(pn,`transposeImprove`);function mn(e,t,n){let r=e.layers.map(e=>[...e]),i=t.edges,a=jt(t),o=Nt(t,n?.laneOrder);for(let e=0;e<3;e++){for(let e=1;e<r.length;e++)r[e]=fn(r[e-1],r[e],i,`down`,a,o),r[e]=pn(r[e-1],r[e],i,r[e+1],a);for(let e=r.length-2;e>=0;e--)r[e]=fn(r[e+1],r[e],i,`up`,a,o),r[e]=pn(r[e+1],r[e],i,r[e-1],a)}return{layers:r}}e(mn,`orderLayers`);function hn(t,n,r){let i=r?.layerGap??It.DEFAULT_LAYER_GAP,a=r?.nodeGap??It.DEFAULT_NODE_GAP,o=r?.laneGap??a*2,s=r?.direction??`TB`,c=s===`LR`||s===`RL`,l=t.layers,u=Object.create(null),d=Object.create(null),f=e(e=>n.nodeById.get(e),`getNode`),p=e(e=>f(e)?.width??0,`getWidth`),m=e(e=>f(e)?.height??0,`getHeight`),h=jt(n),g=Nt(n,r?.laneOrder),_=l.map(e=>e.reduce((e,t)=>Math.max(e,m(t)),0)),v=[];if(c)for(let e=0;e+1<l.length;e++){let t=l[e].reduce((e,t)=>Math.max(e,p(t)),0),n=l[e+1].reduce((e,t)=>Math.max(e,p(t)),0),r=_[e],a=_[e+1],o=r/2+a/2,s=(t+n)/2,c=Math.max(0,s-o-i);v.push(c)}let y=new Set;for(let e of l)for(let t of e)y.add(h(t));let b=y.has(null),x=g.filter(e=>y.has(e)),S=[...b?[null]:[],...x],C=Object.create(null);for(let e of x)C[e]=0;b&&(C.null=0);for(let e of l){let t=Object.create(null),n=[];for(let r of e){let e=h(r);e===null?n.push(r):(t[e]||=[]).push(r)}for(let[e,n]of Object.entries(t)){let t=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C[e]=Math.max(C[e]??0,t)}if(b&&n.length){let e=n.reduce((e,t)=>e+p(t),0)+a*Math.max(0,n.length-1);C.null=Math.max(C.null??0,e)}}let w=new Map;{let e=S.map(e=>(e===null?C.null:C[e])??0),t=-(e.reduce((e,t)=>e+t,0)+o*Math.max(0,S.length-1))/2;for(let n=0;n<S.length;n++){let r=S[n],i=e[n]??0,a=t+i/2;w.set(r,a),t+=i,n<S.length-1&&(t+=o)}}let T=0;for(let[e,t]of l.entries()){let n=_[e]??0,r=new Map;for(let e of t){let t=h(e),n=r.get(t)??[];n.push(e),r.set(t,n)}for(let e of S){let t=r.get(e)??[];if(t.length===0)continue;let i=w.get(e);if(t.length===1){let e=t[0];u[e]=i,d[e]=T+n/2}else{let e=t.map(e=>p(e)),r=i-(e.reduce((e,t)=>e+t,0)+a*(t.length-1))/2;for(let[i,o]of t.entries()){let t=e[i];u[o]=r+t/2,d[o]=T+n/2,r+=t+a}}}let o=v[e]??0;T+=n+i+o}let E=new Map;for(let e of n.edges){let t=e.ref.id;E.has(t)||E.set(t,[]),E.get(t).push(e)}for(let[,e]of E){if(e.length===0)continue;let t=e[0].ref,r=t.start,i=t.end;if(r==null||i==null)continue;let a=Math.round(((u[r]??0)+(u[i]??0))/2),o=new Set;for(let t of e)o.add(t.src),o.add(t.dst);for(let e of o)e!==r&&e!==i&&n.nodeById.get(e)?.isDummy&&(u[e]=a)}return{x:u,y:d}}e(hn,`assignCoordinates`);var gn=8;function _n(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}e(_n,`hashString`);function vn(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}}e(vn,`mulberry32`);function yn(e,t){let n=[...e],r=vn(t);for(let e=n.length-1;e>0;e--){let t=Math.floor(r()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}e(yn,`deterministicShuffle`);function bn(e,t){let n=0;for(let[r,i]of e.entries())n+=Math.abs(r-(t.get(i)??r));return n}e(bn,`sourceDistance`);function xn(e,t){let n=new Map;for(let[t,r]of e.entries())n.set(r,t);let r=0;for(let{a:e,b:i,weight:a}of t){let t=n.get(e),o=n.get(i);t!=null&&o!=null&&(r+=a*Math.abs(t-o))}return r}e(xn,`laneArrangementCost`);function Sn(e){let t=Mt(e);if(t.length<2)return[];let n=new Map(t.map((e,t)=>[e,t])),r=jt(e),i=new Map;for(let t of e.layout.edges??[]){if(t.isLayoutOnly)continue;let a=typeof t.start==`string`?t.start:void 0,o=typeof t.end==`string`?t.end:void 0;if(!a||!o||!e.nodeById.has(a)||!e.nodeById.has(o))continue;let s=r(a),c=r(o);if(!s||!c||s===c)continue;let l=n.get(s),u=n.get(c);if(l==null||u==null)continue;let[d,f]=l<=u?[s,c]:[c,s],p=`${d}\0${f}`,m=i.get(p);m?m.weight++:i.set(p,{a:d,b:f,weight:1})}return[...i.values()]}e(Sn,`buildWeightedLaneEdges`);function Cn(e,t,n){let r=[...e],i=xn(r,t),a=!0,o=0,s=Math.max(1,r.length);for(;a&&o<s;){a=!1,o++;for(let e=0;e+1<r.length;e++){[r[e],r[e+1]]=[r[e+1],r[e]];let n=xn(r,t);n<i?(i=n,a=!0):[r[e],r[e+1]]=[r[e+1],r[e]]}}return{order:r,cost:i,sourceDistance:bn(r,n)}}e(Cn,`greedySwitch`);function wn(e,t){return e.cost===t.cost?e.sourceDistance<t.sourceDistance:e.cost<t.cost}e(wn,`isBetterCandidate`);function Tn(e,t,n){let r=[...t].sort((e,t)=>e.a===t.a?e.b.localeCompare(t.b):e.a.localeCompare(t.a)).map(({a:e,b:t,weight:n})=>`${e}:${t}:${n}`).join(`|`);return _n(`${e.join(`|`)}#${r}#${n}`)}e(Tn,`seedForRestart`);function En(e,t={}){let n=Mt(e);if(n.length<2)return n;let r=Sn(e);if(r.length===0)return n;let i=new Map(n.map((e,t)=>[e,t])),a=Cn(n,r,i),o=Math.max(0,t.restarts??gn);for(let e=0;e<o;e++){let t=Cn(yn(n,Tn(n,r,e)),r,i);wn(t,a)&&(a=t)}return a.order}e(En,`optimizeTopLaneOrder`);function Dn(e,t){let n=t?.ignoreCrossLaneEdges??!0,r=t?.optimizeRanksByCrossings??!0,i=vt(e),a=t?.automaticLaneOrdering?En(i,{restarts:gn}):void 0,o=kt(i),s=o.acyclic,{layering:c,graphWithDummies:l}=an(n?rn(s,{compactSingleInput:t?.compactSingleInput??Ft.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:t?.direction}):tn(s,{compactSingleInput:t?.compactSingleInput??Ft.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:r}),s),u=mn(c,l,{laneOrder:a}),d=hn(u,l,{layerGap:t?.layerGap,nodeGap:t?.nodeGap,direction:t?.direction,laneOrder:a});return{acyclic:s,reversed:o.reversed,layering:c,ordered:u,coordinates:d}}e(Dn,`sugiyamaLayout`);var $=Pt.EPSILON,On=8,kn=15,An=15,jn=25,Mn=20,Nn=10;function Pn(e,t,n){let r=e.x??0,i=e.y??0,a=t.x-r,o=t.y-i,s=Math.abs(a),c=Math.abs(o);return s<$&&c<$?n:c>$&&c*3>=s?o>0?`bottom`:`top`:s>$?a>0?`right`:`left`:n}e(Pn,`chooseOrthogonalSide`);function Fn(e,t){return Math.abs(e.to-t.from)<$||Math.abs(e.to-t.to)<$?e.to:e.from}e(Fn,`sharedLineEndpointCoord`);function In(e,t){return e.orient===`vertical`?{x:e.coord,y:t}:{x:t,y:e.coord}}e(In,`pointOnLine`);function Ln(t,n){let r=t.nodes??[],i=t.edges??[],a=[];for(let e of i)e.isLayoutOnly||a.push({...e,__originalEdge:e});let o=new Map,s=new Map,c=[],l=n===`LR`;for(let e of r)o.set(e.id,e);let u=r.filter(e=>e.isGroup&&!e.parentId);for(let t of u){let n={id:t.id},i=e(e=>{s.set(e.id,n),r.filter(t=>t.parentId===e.id).forEach(i)},`assignLane`);i(t)}let d=r.filter(e=>!e.isGroup&&!e.isEdgeLabel).map(e=>{let t=e.width??10,n=e.height??10,r=e.x??0,i=e.y??0,a=On;return{nodeId:e.id,minX:r-t/2-a,maxX:r+t/2+a,minY:i-n/2-a,maxY:i+n/2+a,visualXHalfExtent:l?n/2+a:t/2+a}}),f=e((e,t,n,r)=>{let i=c.find(n=>n.orientation===e&&Math.abs(n.coord-t)<1);return i||(i={id:`pipe-${e}-${t.toFixed(0)}`,orientation:e,coord:t,spanMin:n,spanMax:r,tracks:[]},c.push(i)),i.spanMin=Math.min(i.spanMin,n),i.spanMax=Math.max(i.spanMax,r),i},`getOrAddPipe`),p=e((e,t)=>{let n=e.width??10,r=e.height??10,i=e.x??0,a=e.y??0;switch(t){case`top`:return{x:i,y:a-r/2};case`bottom`:return{x:i,y:a+r/2};case`left`:return{x:i-n/2,y:a};case`right`:return{x:i+n/2,y:a}}},`portForSide`),m=e((e,t,n)=>p(e,Pn(e,t,n?`bottom`:`top`)),`getOrthogonalPort`),h=[],g=[],_=new Set,v=1e3,y=e((e,t,n)=>{if(h.length===0)return 0;let r=Math.abs(t.y-n.y)<$,i=Math.abs(t.x-n.x)<$;if(!r&&!i)return 0;let a=0;if(r){let r=t.y,i=Math.min(t.x,n.x)-$,o=Math.max(t.x,n.x)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex!==e&&t.orientation===`vertical`&&(t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v))}else if(i){let r=t.x,i=Math.min(t.y,n.y)-$,o=Math.max(t.y,n.y)+$;if(o<=i)return 0;for(let t of h)t.edgeIndex!==e&&t.orientation===`horizontal`&&(t.pipe.coord<i||t.pipe.coord>o||t.from-$<=r&&t.to+$>=r&&(a+=v))}return a},`crossingPenalty`),b=a.map((e,t)=>{if(!e.start||!e.end)return{idx:t,crossLane:0,dx:0,dy:0};let n=o.get(e.start),r=o.get(e.end),i=s.get(e.start),a=s.get(e.end);return{idx:t,crossLane:i&&a&&i.id!==a.id?1:0,dx:n&&r?Math.abs((r.x??0)-(n.x??0)):0,dy:n&&r?Math.abs((r.y??0)-(n.y??0)):0}}).sort((e,t)=>{if(e.crossLane!==t.crossLane)return t.crossLane-e.crossLane;let n=e.dx+e.dy,r=t.dx+t.dy;return Math.abs(n-r)>1?n-r:e.idx-t.idx}).map(e=>e.idx),x=e((e,t,n,r)=>{let i=Math.min(e.x,t.x),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y),s=Math.max(e.y,t.y);return!!d.find(c=>n&&c.nodeId===n||r&&c.nodeId===r?!1:Math.abs(e.x-t.x)>$?c.minY<e.y&&c.maxY>e.y&&c.maxX>i&&c.minX<a:c.minX<e.x&&c.maxX>e.x&&c.maxY>o&&c.minY<s)},`isSegmentBlocked`),S=new Map,C=new Map;for(let e of a)e.start&&e.end&&e.start!==e.end&&(C.set(e.start,(C.get(e.start)??0)+1),C.set(e.end,(C.get(e.end)??0)+1));let w=e((e,t)=>Pn(e,t,`bottom`),`determineSide`),T=new Map;for(let[e,t]of a.entries()){if(!t.start||!t.end||t.start===t.end||t.points&&t.points.length>0)continue;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)continue;let i=(r.x??0)-(n.x??0),a=(r.y??0)-(n.y??0);T.set(e,{edgeIdx:e,srcId:t.start,dstId:t.end,srcSide:w(n,{x:r.x??0,y:r.y??0}),dstSide:w(r,{x:n.x??0,y:n.y??0}),absDx:Math.abs(i),absDy:Math.abs(a),dxSign:Math.sign(i),dySign:Math.sign(a)})}let E=e(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.absDx===0?1/0:e.absDy/e.absDx:e.absDy===0?1/0:e.absDx/e.absDy,`preferenceStrength`),D=e(e=>e.srcSide===`top`||e.srcSide===`bottom`?e.dxSign>=0?`right`:`left`:e.dySign>=0?`bottom`:`top`,`secondarySide`),O=new Map;for(let e of T.values()){let t=`${e.srcId}:${e.srcSide}`;O.has(t)||O.set(t,[]),O.get(t).push(e)}let k=new Map,A=e((e,t)=>`${e}:${t}`,`loadKey`);for(let e of T.values())k.set(A(e.srcId,e.srcSide),(k.get(A(e.srcId,e.srcSide))??0)+1),k.set(A(e.dstId,e.dstSide),(k.get(A(e.dstId,e.dstSide))??0)+1);for(let e of O.values())if(!(e.length<2)){e.sort((e,t)=>{let n=E(e),r=E(t);return Math.abs(n-r)>1e-9?r-n:e.edgeIdx-t.edgeIdx});for(let t=1;t<e.length;t++){let n=e[t],r=D(n),i=k.get(A(n.srcId,n.srcSide))??0,a=k.get(A(n.srcId,r))??0;a>=i||(k.set(A(n.srcId,n.srcSide),i-1),k.set(A(n.srcId,r),a+1),n.srcSide=r)}}let j=e(e=>{let t=e?.shape;return t===`question`||t===`diamond`},`isDiamondNode`),M=new Map;for(let e of T.values())M.has(e.dstId)||M.set(e.dstId,new Set),M.get(e.dstId).add(e.dstSide);for(let e of T.values()){if(!j(o.get(e.srcId)))continue;let t=M.get(e.srcId);if(!t?.has(e.srcSide))continue;let n=D(e);if(t.has(n)||(k.get(A(e.srcId,n))??0)>0)continue;let r=k.get(A(e.srcId,e.srcSide))??0;k.set(A(e.srcId,e.srcSide),Math.max(0,r-1)),k.set(A(e.srcId,n),1),e.srcSide=n}for(let e of T.values()){let{edgeIdx:t,srcId:n,dstId:r,srcSide:i,dstSide:a}=e,s=o.get(n),c=o.get(r),l=`${n}:${i}:src`,u=i===`top`||i===`bottom`?c.x??0:c.y??0;S.has(l)||S.set(l,[]),S.get(l).push({edgeIdx:t,oppositeCoord:u});let d=`${r}:${a}:dst`,f=a===`top`||a===`bottom`?s.x??0:s.y??0;S.has(d)||S.set(d,[]),S.get(d).push({edgeIdx:t,oppositeCoord:f})}let N=new Map;for(let[e,t]of S){if(t.length<2)continue;t.sort((e,t)=>e.oppositeCoord-t.oppositeCoord);let n=e.split(`:`),r=n.slice(0,-2).join(`:`),i=n[n.length-2],a=n[n.length-1],s=o.get(r);if(!s)continue;let c=i===`left`||i===`right`?s.height??10:s.width??10,l=s.shape,u=l===`question`||l===`diamond`?c*.3:c,d=Math.min(20,Math.max(8,u/(t.length+1))),f=-(d*(t.length-1))/2;for(let[e,n]of t.entries()){let t=f+e*d,r=`${n.edgeIdx}:${a}`;N.set(r,t)}}let P=e(e=>!!a[e]?.labelNodeId,`edgeHasLabelNode`),F=e((e,t)=>e?(S.get(`${e}:${t}:src`)??[]).some(({edgeIdx:e})=>P(e))||(S.get(`${e}:${t}:dst`)??[]).some(({edgeIdx:e})=>P(e)):!1,`faceHasLabelNode`),I=e((e,t,n)=>t===`top`||t===`bottom`?{x:e.x+n,y:e.y}:{x:e.x,y:e.y+n},`applyPortOffset`),ee=e((e,t,n)=>{let r=T.get(e),i={x:n.x??0,y:n.y??0},a={x:t.x??0,y:t.y??0},o=r?.srcSide??w(t,i),s=r?.dstSide??w(n,a),c=r?p(t,r.srcSide):m(t,i,!0),l=r?p(n,r.dstSide):m(n,a,!1),u=N.get(`${e}:src`),d=N.get(`${e}:dst`);return u!==void 0&&(c=I(c,o,u)),d!==void 0&&(l=I(l,s,d)),{pSrcPort:c,pDstPort:l,srcSide:o,dstSide:s}},`portsForEdge`);for(let t of b){let n=a[t];if(g[t]=[],!n.start||!n.end||n.points&&n.points.length>0||n.start===n.end)continue;let r=o.get(n.start),i=o.get(n.end);if(!r||!i)continue;let{pSrcPort:s,pDstPort:u,srcSide:p,dstSide:m}=ee(t,r,i),v={...s},b={...u},w=p===`top`||p===`bottom`,T=m===`top`||m===`bottom`;w?v.y=s.y>(r.y??0)?s.y+Mn:s.y-Mn:v.x=s.x>(r.x??0)?s.x+Mn:s.x-Mn,T?b.y=u.y>(i.y??0)?u.y+Mn:u.y-Mn:b.x=u.x>(i.x??0)?u.x+Mn:u.x-Mn;let E=e((e,t)=>{for(let n of d)if(!t.includes(n.nodeId)&&e.x>n.minX&&e.x<n.maxX&&e.y>n.minY&&e.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},`isPointInObstacle`),D=e((e,t,n,r,i)=>{if(i){let i=e.y>(t.y??0);return{x:(n.x??0)>=e.x?r.maxX+kn:r.minX-kn,y:i?r.maxY+An:r.minY-An,leavesPositiveSide:i}}let a=e.x>(t.x??0),o=(n.y??0)>=e.y;return{x:a?r.maxX+kn:r.minX-kn,y:o?r.maxY+An:r.minY-An,leavesPositiveSide:a}},`obstacleDetour`),O=[],k=[n.start,n.end],A=E(v,k);if(A.inside&&A.obstacle){let e=A.obstacle;if(w){let t=D(s,r,i,e,!0);v.x=t.x,v.y=t.y;let n=t.leavesPositiveSide?Math.min(e.minY-2,s.y+Mn):Math.max(e.maxY+2,s.y-Mn);O=[{x:s.x,y:n},{x:t.x,y:n},{x:t.x,y:t.y}]}else{let t=D(s,r,i,e,!1),n=t.leavesPositiveSide?Math.min(e.minX-2,s.x+Mn):Math.max(e.maxX+2,s.x-Mn);v.x=t.x,v.y=t.y,O=[{x:n,y:s.y},{x:n,y:t.y},{x:t.x,y:t.y}]}}let j=[],M=E(b,k);if(M.inside&&M.obstacle){let e=M.obstacle;if(T){let t=D(u,i,r,e,!0);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:u.x,y:t.y}]}else{let t=D(u,i,r,e,!1);b.x=t.x,b.y=t.y,j=[{x:t.x,y:t.y},{x:t.x,y:u.y}]}}if(O.length===0&&j.length===0){let e=kn,r=Math.abs(v.x-b.x)<e,i=Math.abs(v.y-b.y)<e,a=N.get(`${t}:src`)!==void 0||N.get(`${t}:dst`)!==void 0,o=(S.get(`${n.start??``}:${p}:src`)?.length??0)+(S.get(`${n.start??``}:${p}:dst`)?.length??0),c=(S.get(`${n.end??``}:${m}:src`)?.length??0)+(S.get(`${n.end??``}:${m}:dst`)?.length??0),l=o>1||c>1,d=C.get(n.start??``)??0,f=C.get(n.end??``)??0,g=o>1&&F(n.start,p)||c>1&&F(n.end,m);if((r||i)&&!a&&(!l||l&&!g&&(o<=1||d<=2)&&(c<=1||f<=2))&&!x(s,u,n.start,n.end)){n.points=[{...s},{...v},{...b},{...u}],_.add(t);let e=i?`horizontal`:`vertical`,r=i?s.y:s.x,a=i?Math.min(s.x,u.x):Math.min(s.y,u.y),o=i?Math.max(s.x,u.x):Math.max(s.y,u.y),c={id:`fast-path-${e}-${r.toFixed(0)}-${t}`,orientation:e,coord:r,spanMin:a,spanMax:o,tracks:[]};h.push({edgeIndex:t,segmentIndex:0,orientation:e,pipe:c,trackIndex:0,from:a,to:o});continue}}v.x=f(`vertical`,v.x,v.y,v.y).coord,b.x=f(`vertical`,b.x,b.y,b.y).coord;let P=Math.min(v.x,b.x)-50,I=Math.max(v.x,b.x)+50,L=Math.min(v.y,b.y)-50,R=Math.max(v.y,b.y)+50;for(let e of d){let t=Math.min(v.x,b.x),n=Math.max(v.x,b.x),r=Math.min(v.y,b.y),i=Math.max(v.y,b.y);e.minX<n&&e.maxX>t&&e.minY<i&&e.maxY>r&&(P=Math.min(P,e.minX-jn),I=Math.max(I,e.maxX+jn),L=Math.min(L,e.minY-jn),R=Math.max(R,e.maxY+jn))}for(let e of d){if(e.maxX<P||e.minX>I||e.maxY<L||e.minY>R)continue;let t=kn;f(`horizontal`,e.minY-t,P,I),f(`horizontal`,e.maxY+t,P,I);let n=An;f(`vertical`,e.minX-n,L,R),f(`vertical`,e.maxX+n,L,R)}f(`horizontal`,v.y,P,I),f(`horizontal`,b.y,P,I);let z=c.filter(e=>e.orientation===`horizontal`&&e.coord>=L&&e.coord<=R),te=c.filter(e=>e.orientation===`vertical`&&e.coord>=P&&e.coord<=I),ne=e((e,t)=>`${e.toFixed(1)},${t.toFixed(1)}`,`getKey`),B=ne(v.x,v.y),re=ne(b.x,b.y),ie=new Map,ae=new Map,V=new Map,oe=new Set,H=[];ie.set(B,0),V.set(B,`n`),H.push({key:B,f:Math.hypot(b.x-v.x,b.y-v.y),pt:v}),oe.add(B);let U=[],W=e((e,t)=>x(e,t,n.start,n.end),`checkSegmentBlocked`),G={x:b.x,y:v.y},K=W(v,G),se=W(G,b),ce=K||se,le={x:v.x,y:b.y},ue=W(v,le),de=W(le,b);if(ce?ue||de||(U=Math.abs(v.x-b.x)<$?[v,b]:[v,le,b]):U=Math.abs(v.y-b.y)<$||Math.abs(v.x-b.x)<$?[v,b]:[v,G,b],U.length===0)for(;H.length>0;){H.sort((e,t)=>e.f-t.f);let e=H.shift();if(oe.delete(e.key),e.key===re){let e=re,t=b;for(U=[t];ae.has(e);){let n=ae.get(e);U.unshift(n),t=n,e=ne(n.x,n.y)}break}let r=e.pt.x,i=e.pt.y,a=te.sort((e,t)=>e.coord-t.coord),o=a.findIndex(e=>Math.abs(e.coord-r)<1),s=z.sort((e,t)=>e.coord-t.coord),c=s.findIndex(e=>Math.abs(e.coord-i)<1),l=[];o>0&&l.push({x:a[o-1].coord,y:i}),o>=0&&o<a.length-1&&l.push({x:a[o+1].coord,y:i}),c>0&&l.push({x:r,y:s[c-1].coord}),c>=0&&c<s.length-1&&l.push({x:r,y:s[c+1].coord});for(let a of l){let o=Math.min(r,a.x),s=Math.max(r,a.x),c=Math.min(i,a.y),l=Math.max(i,a.y);if(d.some(e=>e.nodeId===n.start||e.nodeId===n.end?!1:o===s?e.minX<r&&e.maxX>r&&e.maxY>c&&e.minY<l:e.minY<i&&e.maxY>i&&e.maxX>o&&e.minX<s))continue;let u=ne(a.x,a.y),f=Math.abs(a.x-r)+Math.abs(a.y-i),p=y(t,e.pt,a),m=0,h=b.x-v.x,g=b.y-v.y,_=a.x-r,x=a.y-i;(g>10&&x<-5||g<-10&&x>5)&&(m=Math.abs(x)*100),(h>10&&_<-5||h<-10&&_>5)&&(m+=Math.abs(_)*50);let S=0,C=V.get(e.key)??`n`,w=Math.abs(_)>$?`h`:`v`;C!==`n`&&C!==w&&(S=50);let T=f+p+m+S,E=(ie.get(e.key)??1/0)+T,D=Math.abs(b.x-a.x)+Math.abs(b.y-a.y);if(E<(ie.get(u)??1/0)){if(ae.set(u,e.pt),ie.set(u,E),V.set(u,w),!oe.has(u))H.push({key:u,f:E+D,pt:a}),oe.add(u);else{let e=H.findIndex(e=>e.key===u);e!==-1&&(H[e].f=E+D)}}}}if(U.length===0&&(U=[v,{x:v.x,y:b.y},b]),U.length>4){let t=U[0],n=U[U.length-1],r=Math.min(t.x,n.x),i=Math.max(t.x,n.x),a=Math.min(t.y,n.y),o=Math.max(t.y,n.y);for(let e of U)r=Math.min(r,e.x),i=Math.max(i,e.x),a=Math.min(a,e.y),o=Math.max(o,e.y);let s=i>Math.max(t.x,n.x),c=r<Math.min(t.x,n.x);if(l){let e=An;if(s){let r=Math.max(t.x,n.x),a=Math.min(t.y,n.y),o=Math.max(t.y,n.y),s=d.filter(e=>e.minX<r&&e.maxX>r&&e.minY<o&&e.maxY>a);if(s.length>0){let r=Math.max(t.x,n.x);for(let t of s){let n=(t.minX+t.maxX)/2;if(t.visualXHalfExtent===void 0||isNaN(t.visualXHalfExtent))continue;let i=n+t.visualXHalfExtent+e;r=Math.max(r,i)}isNaN(r)||(i=r)}}if(c){let i=d.filter(r=>r.minX<Math.min(t.x,n.x)+e&&r.minY<Math.max(t.y,n.y)&&r.maxY>Math.min(t.y,n.y));if(i.length>0){let a=Math.min(t.x,n.x);for(let t of i){let n=(t.minX+t.maxX)/2-t.visualXHalfExtent-e;a=Math.min(a,n)}r=a}}}let u=e(e=>{let r=n.y>t.y,i=d.filter(e=>{let r=Math.min(t.x,n.x)<e.maxX&&Math.max(t.x,n.x)>e.minX,i=Math.min(t.y,n.y)<e.maxY&&Math.max(t.y,n.y)>e.minY;return r&&i}),a=i;if(l&&i.length>0){let t=i.filter(t=>t.minX<e&&t.maxX>e);t.length>0&&(a=t)}if(a.length===0)return n.y;let o=kn;if(r){let e=Math.max(...a.map(e=>e.maxY))+o;if(e<n.y-$)return e}else{let e=Math.min(...a.map(e=>e.minY))-o;if(e>n.y+$)return e}return n.y},`findBestReturnY`),f=e(e=>{let r=u(e),i={x:e,y:t.y},a={x:e,y:r},o={x:n.x,y:r},s=W(t,i),c=W(i,a),l=W(a,o),d=r!==n.y&&W(o,n);return!s&&!c&&!l&&!d?Math.abs(r-n.y)<$?[t,i,a,n]:[t,i,a,o,n]:null},`trySimplifyWithDetourX`),p=s&&!c?f(i):c&&!s?f(r):null;p&&(U=p)}let q=[s,...O,...U,...j.reverse(),u];if(q.length>=3){let e=q[q.length-1],t=q[q.length-2],n=q[q.length-3],r=Math.abs(n.y-t.y)<$&&Math.abs(t.y-e.y)<$,i=Math.abs(n.x-t.x)<$&&Math.abs(t.x-e.x)<$;if(r){let r=Math.sign(t.x-n.x),i=Math.sign(e.x-n.x);r!==0&&r===i&&Math.abs(t.x-n.x)>Math.abs(e.x-n.x)&&q.splice(-2,1)}else if(i){let r=Math.sign(t.y-n.y),i=Math.sign(e.y-n.y);r!==0&&r===i&&Math.abs(t.y-n.y)>Math.abs(e.y-n.y)&&q.splice(-2,1)}}let J=[q[0]];for(let e=1;e<q.length-1;e++){if(e===1){J.push(q[e]);continue}let t=J[J.length-1],n=q[e],r=q[e+1];if(Math.abs(t.y-n.y)<$&&Math.abs(n.y-r.y)<$){if(n.x>t.x!=r.x>n.x){J.push(n);continue}continue}if(Math.abs(t.x-n.x)<$&&Math.abs(n.x-r.x)<$){if(n.y>t.y!=r.y>n.y){J.push(n);continue}continue}J.push(n)}J.push(q[q.length-1]);for(let e=0;e<J.length-1;e++){let n=J[e],r=J[e+1],i=Math.abs(n.x-r.x)<$?`vertical`:`horizontal`,a=i===`vertical`?n.x:n.y,o=i===`vertical`?Math.min(n.y,r.y):Math.min(n.x,r.x),s=i===`vertical`?Math.max(n.y,r.y):Math.max(n.x,r.x),c=f(i,a,o,s),l={edgeIndex:t,segmentIndex:e,orientation:i,pipe:c,trackIndex:0,from:o,to:s};h.push(l),g[t].push(h.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:o,to:s})}}let L=e((e,t)=>e.from<t.to&&t.from<e.to,`segmentsOverlap`),R=e((e,t,n,r)=>{let i=!r.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&L(n,e)),a=!n.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&L(n,t));return i&&a?(e.trackIndex=r.index,t.trackIndex=n.index,n.segments=[...n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],r.segments=[...r.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],!0):!1},`trySwapSegmentsAcrossTracks`),z=e(e=>{let t=e.tracks.length;return e.tracks[t]={index:t,coord:e.coord,segments:[]},t},`createNewTrack`),te=e((e,t)=>{let n=e.pipe.tracks[e.trackIndex];n.segments=n.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),e.trackIndex=t,e.pipe.tracks[t].segments.push({edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to})},`moveSegmentToTrack`),ne=e((e,t)=>{let n=g[e.edgeIndex];for(let r of n){let n=h[r];n.pipe===e.pipe&&te(n,t)}},`moveSegmentChainToTrack`),B=e(e=>{let t=g[e.edgeIndex],n=t.indexOf(h.indexOf(e)),r=[];return n>0&&r.push(h[t[n-1]]),n<t.length-1&&r.push(h[t[n+1]]),r},`getAdjacentSegmentsAlongEdge`),re=e((e,t)=>{if(e.orientation===t.orientation)return!1;let n=e.orientation===`horizontal`?e:t,r=e.orientation===`horizontal`?t:e;return r.pipe.coord>n.from&&r.pipe.coord<n.to&&n.pipe.coord>r.from&&n.pipe.coord<r.to},`haveAnyCrossing`),ie=e((e,t)=>{for(let n of e.tracks)if(!n.segments.some(e=>(e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex)&&L(e,t)))return n.index;return-1},`findAvailableTrack`),ae=e((e,t)=>{if(e.trackIndex===t.trackIndex)return L(e,t);let n=B(e),r=B(t);return n.some(e=>r.some(t=>re(e,t)))},`segmentsConflict`),V=e((e,t,n)=>{if(R(e,t,e.pipe.tracks[e.trackIndex],t.pipe.tracks[t.trackIndex]))return;let r=ie(e.pipe,t);n(t,r===-1?z(e.pipe):r)},`resolveTrackConflict`),oe=e(e=>{let t=0;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){let i=e[n],a=e[r];i.pipe===a.pipe&&ae(i,a)&&(t++,V(i,a,ne))}return t},`resolveHandleConflicts`),H=new Map,U=e(e=>{if(H.has(e))return H.get(e);let t=g[e];if(t.length===0){let t={dest:0,deviation:0,base:0,delta:0};return H.set(e,t),t}let n=h[t[0]].pipe.coord,r=n;for(let e=1;e<t.length;e++){let i=h[t[e]];if(i.orientation===`horizontal`){let e=i.from,t=i.to;r=Math.abs(e-n)>Math.abs(t-n)?e:t;break}}let i=Math.abs(r-n),a={dest:r,deviation:i,base:n,delta:r-n};return H.set(e,a),a},`getDestInfo`),W=e(()=>{let t=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.start&&(n.has(t.start)||n.set(t.start,[]),n.get(t.start).push(e));let r=e(e=>{let t=a[e];if(!t.start||!t.end)return 0;let n=o.get(t.start),r=o.get(t.end);if(!n||!r)return 0;let i=(r.x??0)-(n.x??0),s=(r.y??0)-(n.y??0);return Math.abs(i)+Math.abs(s)},`getEdgeDistance`);for(let e of n.values()){e.sort((e,t)=>{let n=U(e),i=U(t);if(Math.abs(n.deviation-i.deviation)>1)return n.deviation-i.deviation;if(Math.abs(n.dest-i.dest)>1)return n.dest-i.dest;let a=r(e),o=r(t);if(Math.abs(a-o)>1)return o-a;let s=g[e].length,c=g[t].length;if(s!==c)return s-c;if(s===1){let n=g[e][0],r=g[t][0];if(h[n]&&h[r]){let e=h[n],t=h[r],i=Math.abs(e.to-e.from),a=Math.abs(t.to-t.from);if(Math.abs(i-a)>1)return i-a}}return 0});let n=e.map(e=>h[g[e][0]]);t+=oe(n)}return t},`fixSourceHandleCrossings`),G=e(()=>{let t=0,n=new Map;for(let[e,t]of a.entries())g[e].length!==0&&t.end&&(n.has(t.end)||n.set(t.end,[]),n.get(t.end).push(e));for(let r of n.values()){r.sort((t,n)=>{let r=e(e=>{let t=g[e];if(t.length<2)return 0;let n=h[t[t.length-2]];return Math.abs(n.to-n.from)},`getDist`),i=r(t),a=r(n);return Math.abs(i-a)>.1?i-a:t-n});let n=r.map(e=>h[g[e][g[e].length-1]]);t+=oe(n)}return t},`fixTargetHandleCrossings`),K=e(()=>{let e=0;for(let t of c){let n=[];for(let e of t.tracks)for(let t of e.segments){let e=g[t.edgeIndex].find(e=>h[e].segmentIndex===t.segmentIndex);e!==void 0&&n.push(h[e])}n.sort((e,t)=>e.edgeIndex-t.edgeIndex||e.segmentIndex-t.segmentIndex);for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let i=n[t],a=n[r];ae(i,a)&&(e++,V(i,a,te))}}return e},`fixPipeCrossings`),se=0;for(;se<10;){let e=0;if(e+=W(),e+=G(),e+=K(),e===0)break;se++}let ce=new Map;for(let t of c){let n=[];t.tracks.forEach(e=>{e.segments.forEach(t=>{n.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,trackIndex:e.index,from:t.from,to:t.to})})}),n.sort((e,t)=>e.from-t.from);let r=[];if(n.length>0){let e=[n[0]],t=n[0].to;for(let i=1;i<n.length;i++){let a=n[i];a.from<t?(e.push(a),t=Math.max(t,a.to)):(r.push(e),e=[a],t=a.to)}r.push(e)}for(let n of r){let r=new Set;n.forEach(e=>r.add(e.trackIndex));let i=new Map;n.forEach(e=>{let t=U(e.edgeIndex);i.set(e.trackIndex,(i.get(e.trackIndex)??0)+t.delta)});let a=[...r].filter(e=>(i.get(e)??0)<-1),o=[...r].filter(e=>(i.get(e)??0)>1),s=[...r].filter(e=>Math.abs(i.get(e)??0)<=1);a.sort((e,t)=>(i.get(t)??0)-(i.get(e)??0)),o.sort((e,t)=>(i.get(e)??0)-(i.get(t)??0));let c=e((e,r)=>{n.filter(t=>t.trackIndex===e).forEach(e=>{let n=_.has(e.edgeIndex)?t.coord:r;ce.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},`assignCoord`),l=0;for(let e of a)l++,c(e,t.coord-l*Nn);if(s.length===0&&r.size>0){let e=[...r].sort((e,t)=>Math.abs(i.get(e)??0)-Math.abs(i.get(t)??0))[0],t=a.indexOf(e);t!==-1&&a.splice(t,1);let n=o.indexOf(e);n!==-1&&o.splice(n,1),s.push(e)}let u=0;for(let e of s){if(u===0)c(e,t.coord);else{let n=u%2==1?1:-1,r=Math.ceil(u/2);c(e,t.coord+n*r*Nn*.5)}u++}let d=0;for(let e of o)d++,c(e,t.coord+d*Nn)}}for(let[e,t]of a.entries()){let n=g[e]??[];if(n.length===0)continue;let r=[],{pSrcPort:i,pDstPort:a}=ee(e,o.get(t.start),o.get(t.end)),s=n.map(e=>{let t=h[e],n=ce.get(`${t.edgeIndex}-${t.segmentIndex}`)??t.pipe.coord;return{orient:t.orientation,coord:n,from:t.from,to:t.to}});r.push(i);for(let e=0;e<s.length;e++){let t=s[e],n=r[r.length-1],i=t.orient===`vertical`?n.y:n.x,a=t.orient===`vertical`?n.x:n.y,o=s[e+1],c=e<s.length-1;if(Math.abs(a-t.coord)>$&&r.push(In(t,i)),c&&o.orient===t.orient){if(Math.abs(t.coord-o.coord)>$){let e=t.orient===`vertical`?(i+o.from)/2:Fn(t,o);r.push(In(t,e),In(o,e))}else(e===0||e===s.length-2)&&r.push(In(t,Fn(t,o)))}else if(c)r.push(In(t,o.coord));else{let e=Math.abs(t.from-i)<Math.abs(t.to-i)?t.to:t.from;r.push(In(t,e))}}let c=r[r.length-1];(Math.abs(c.x-a.x)>$||Math.abs(c.y-a.y)>$)&&r.push(a);let l=[];r.length>0&&l.push(r[0]);for(let e=1;e<r.length;e++){let t=r[e],n=l[l.length-1];(Math.abs(t.x-n.x)>$||Math.abs(t.y-n.y)>$)&&l.push(t)}t.points=l}for(let e of a){let t=e.__originalEdge;t&&e.points&&(t.points=e.points)}t.edges=(t.edges??[]).filter(e=>!e.isLayoutOnly);let le=e((e,t)=>{let n=t.x??0,r=t.y??0,i=t.width??0,a=t.height??0;if(i<=0||a<=0)return e;let o=n-i/2,s=n+i/2,c=r-a/2,l=r+a/2;if(e.x<o||e.x>s||e.y<c||e.y>l)return e;let u=e.x-o,d=s-e.x,f=e.y-c,p=l-e.y,m=Math.min(u,d,f,p);return m===u?{x:o,y:e.y}:m===d?{x:s,y:e.y}:m===f?{x:e.x,y:c}:{x:e.x,y:l}},`nodeBoundaryClamp`);for(let e of t.edges){let t=e.points;if(!t||t.length<2)continue;let n=e.start,r=e.end,i=n?o.get(n):void 0,a=r?o.get(r):void 0;i&&(t[0]=le(t[0],i)),a&&(t[t.length-1]=le(t[t.length-1],a))}return t}e(Ln,`routeEdgesOrthogonal`);function Rn(e){return e.direction??`TB`}e(Rn,`getSwimlaneDirection`);function zn(e){let t=d(e),n=e.config.flowchart?.nodeSpacing??40,r=e.config.flowchart?.rankSpacing??100,i=e.config.swimlane?.ignoreCrossLaneEdges??!0,a=e.config.swimlane?.optimizeRanksByCrossings??!0,o=e.config.swimlane?.automaticLaneOrdering??!1,s=Rn(e),{ordered:c,coordinates:l}=Dn(t,{nodeGap:n,layerGap:r,ignoreCrossLaneEdges:i,optimizeRanksByCrossings:a,automaticLaneOrdering:o,direction:s});f(t,c,l,{nodeGap:n,layerGap:r});for(let t of e.edges??[])delete t.points;Ln(e,s);for(let t of e.edges??[])(!t.curve||t.curve===`basis`)&&(t.curve=`rounded`);return _t(e,s),gt(e),s}e(zn,`runSwimlaneLayoutCore`);function Bn(e){u(e);let t=m(e);e.nodes=t.nodes,e.edges=t.edges}e(Bn,`prepareSwimlaneLayout`);var Vn=n({prepareLayout:Bn,runLayoutCore:zn,afterPaint:i});export{Vn as render};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-oBChb5qS.js";import"./chunk-O7XYJQB3-CjZQSnt8.js";import"./chunk-ZIGJFQKS-C6SOqBs6.js";import"./chunk-742MDFTN-DTR6iTOw.js";import"./chunk-MBY4JIJT-9uaOqseW.js";import"./chunk-7PRAP22T-CPe5zfLc.js";import"./chunk-7INBJB4K-XeJOzIDQ.js";import"./chunk-5DYCD2WN-DH_dVKgx.js";import"./chunk-Z7XXMR3K-CHWuLoFG.js";import"./chunk-GWA4HPMP-DE4DJkth.js";import"./chunk-XXDRQBXY-BvKO0v-W.js";import"./chunk-WEXAMYUT-CT8bG5L7.js";import"./chunk-UA2S7LBM-BfYbPxwY.js";import{r as t,t as n}from"./chunk-7M6MHVWA-Bn-cXg0l.js";import"./mermaid.core-B4zgSyXF.js";var r=n({styles:e(e=>`${t(e)}
|
|
2
|
+
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
+
stroke: ${e.clusterBorder} !important;
|
|
4
|
+
}
|
|
5
|
+
[data-look="neo"].cluster rect {
|
|
6
|
+
filter: none;
|
|
7
|
+
}
|
|
8
|
+
`,`getStyles`)});export{r as diagram};
|