@intent-hq/web 2.310.0 → 2.310.2
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/package.json +1 -1
- package/web/app/immutable/assets/{DiagramPresentation.fimBl1wP.css → DiagramPresentation.Bfi3xHm0.css} +1 -1
- package/web/app/immutable/chunks/-xK_vQQs.js +1 -0
- package/web/app/immutable/chunks/{DXIbhld5.js → 189zCzpy.js} +1 -1
- package/web/app/immutable/chunks/6XLvYn_R.js +4 -0
- package/web/app/immutable/chunks/{DE2cS7Gk.js → 7LPFBi2V.js} +2 -2
- package/web/app/immutable/chunks/{DvPohY9Y.js → 9Al7uANH.js} +1 -1
- package/web/app/immutable/chunks/{CCiSNRYo.js → 9Ax53qRD.js} +2 -2
- package/web/app/immutable/chunks/{B2RUMnVi.js → 9U2m-KE4.js} +1 -1
- package/web/app/immutable/chunks/{DEg_be2d.js → B08PB3d6.js} +1 -1
- package/web/app/immutable/chunks/B1wLVJWc.js +7 -0
- package/web/app/immutable/chunks/B1zCpBoo.js +217 -0
- package/web/app/immutable/chunks/{D4n7ImP1.js → B2-LFLJm.js} +1 -1
- package/web/app/immutable/chunks/{BhPGdKCS.js → B3NZDdp-.js} +1 -1
- package/web/app/immutable/chunks/{B6F4Lh4e.js → B3u9yhMd.js} +1 -1
- package/web/app/immutable/chunks/{BCWCSGn-.js → B6ACa1PM.js} +1 -1
- package/web/app/immutable/chunks/{DfEETRjs.js → B7VxeONz.js} +1 -1
- package/web/app/immutable/chunks/{2t50lsua.js → BGOzArFr.js} +6 -6
- package/web/app/immutable/chunks/{9jrhCQLH.js → BGSgFd0R.js} +1 -1
- package/web/app/immutable/chunks/{CaSAI0VT.js → BHMk19Fd.js} +1 -1
- package/web/app/immutable/chunks/{BZJTxW0W.js → BRp0P9cF.js} +1 -1
- package/web/app/immutable/chunks/{DRr3RJL8.js → BS3KKa6i.js} +5 -5
- package/web/app/immutable/chunks/{dxICYcDB.js → BSN7-Qxa.js} +4 -4
- package/web/app/immutable/chunks/{BpsqLTOp.js → BU1SD4F5.js} +2 -2
- package/web/app/immutable/chunks/BUvLOETw.js +8 -0
- package/web/app/immutable/chunks/{CZZvWnXg.js → B_CxKeY9.js} +1 -1
- package/web/app/immutable/chunks/{BibcbnTP.js → B_F8B07u.js} +5 -5
- package/web/app/immutable/chunks/{DFCDnAax.js → B_u6ph9g.js} +1 -1
- package/web/app/immutable/chunks/{Cg-2uoaY.js → BbajLcMi.js} +1 -1
- package/web/app/immutable/chunks/{tBYaHQw_.js → BcGA_XKM.js} +79 -79
- package/web/app/immutable/chunks/Bdj20t_M.js +200 -0
- package/web/app/immutable/chunks/{SJdoTqK2.js → BfVF2I5Q.js} +3 -3
- package/web/app/immutable/chunks/{B-AmXRdp.js → BgjzIHmr.js} +2 -2
- package/web/app/immutable/chunks/BhFdeIZl.js +1 -0
- package/web/app/immutable/chunks/{CMcFXsiy.js → BjS3bCVA.js} +1 -1
- package/web/app/immutable/chunks/Bl1SUWQK.js +1 -0
- package/web/app/immutable/chunks/BtFywNMt.js +40 -0
- package/web/app/immutable/chunks/{CCJs9cZU.js → BwThkZnv.js} +1 -1
- package/web/app/immutable/chunks/ByGoYv9M.js +1 -0
- package/web/app/immutable/chunks/Bz2AaX7v.js +38 -0
- package/web/app/immutable/chunks/{CjKEz27r.js → BzqKIdEP.js} +1 -1
- package/web/app/immutable/chunks/{gMys6NxR.js → C-27EQSK.js} +6 -6
- package/web/app/immutable/chunks/C2FKcF8a.js +99 -0
- package/web/app/immutable/chunks/{kOoRis7L.js → C2ypXh8V.js} +4 -4
- package/web/app/immutable/chunks/{Bbi-Ieb_.js → C5bjHjx4.js} +1 -1
- package/web/app/immutable/chunks/{CS85fbWZ.js → C64YVcCh.js} +1 -1
- package/web/app/immutable/chunks/{xq16NT3q.js → C7-VQsLR.js} +1 -1
- package/web/app/immutable/chunks/C7ldC6zu.js +41 -0
- package/web/app/immutable/chunks/{Z1IVvFmx.js → C7xfOFNZ.js} +4 -4
- package/web/app/immutable/chunks/{CBvSxWdG.js → CAt8c0ls.js} +1 -1
- package/web/app/immutable/chunks/CC-vc0Sh.js +2 -0
- package/web/app/immutable/chunks/{D2b3DtCR.js → CDmxeAFz.js} +1 -1
- package/web/app/immutable/chunks/{BeFewn7K.js → CLUug_7o.js} +1 -1
- package/web/app/immutable/chunks/{CDACoTI2.js → CLyqqizl.js} +11 -11
- package/web/app/immutable/chunks/{B_EqlvEE.js → CO5Qz17e.js} +1 -1
- package/web/app/immutable/chunks/{DDfFKaoN.js → COBtdbv4.js} +1 -1
- package/web/app/immutable/chunks/COZ8XMYr.js +2 -0
- package/web/app/immutable/chunks/{BVxirgV2.js → CQK97B3l.js} +1 -1
- package/web/app/immutable/chunks/{50gvEURs.js → CYTBw0CY.js} +1 -1
- package/web/app/immutable/chunks/{CGizsEXq.js → CZLMJ41d.js} +3 -3
- package/web/app/immutable/chunks/{CjdtUG_a.js → CZqaUHhn.js} +1 -1
- package/web/app/immutable/chunks/CeVWos-t.js +1 -0
- package/web/app/immutable/chunks/CepoDpYW.js +1 -0
- package/web/app/immutable/chunks/{xFj9RuQx.js → CiBABzvX.js} +1 -1
- package/web/app/immutable/chunks/{D8SVxzqF.js → CjcP6chv.js} +1 -1
- package/web/app/immutable/chunks/{DUVw4Tv2.js → CkactGV1.js} +30 -30
- package/web/app/immutable/chunks/ClebXGIM.js +141 -0
- package/web/app/immutable/chunks/{DO_qdDGF.js → CnfDI0G9.js} +1 -1
- package/web/app/immutable/chunks/{CQSBplf3.js → CoiqgZqV.js} +1 -1
- package/web/app/immutable/chunks/{CGMhstmi.js → CpQksukT.js} +1 -1
- package/web/app/immutable/chunks/CrX2GQl1.js +1 -0
- package/web/app/immutable/chunks/{BKTwjZpB.js → CtDXgUYh.js} +2 -2
- package/web/app/immutable/chunks/CvEzUeZj.js +39 -0
- package/web/app/immutable/chunks/{C_YR_yV-.js → CxP8jrn2.js} +1 -1
- package/web/app/immutable/chunks/{BPG20H4B.js → D2XAsGw-.js} +1 -1
- package/web/app/immutable/chunks/D3in5AGo.js +34 -0
- package/web/app/immutable/chunks/D3ma4MWK.js +84 -0
- package/web/app/immutable/chunks/{DqvIKmgg.js → D3p4HGPq.js} +1 -1
- package/web/app/immutable/chunks/D57k4GEE.js +344 -0
- package/web/app/immutable/chunks/{_otPiQOz.js → D5mZ2XGM.js} +1 -1
- package/web/app/immutable/chunks/{swAYnpK6.js → DE1vhlzN.js} +1 -1
- package/web/app/immutable/chunks/{NdkVneBF.js → DI-WSiIl.js} +1 -1
- package/web/app/immutable/chunks/DMfS3QUv.js +213 -0
- package/web/app/immutable/chunks/DMmGJ3th.js +140 -0
- package/web/app/immutable/chunks/DPADHNob.js +3 -0
- package/web/app/immutable/chunks/DPcySxOl.js +24 -0
- package/web/app/immutable/chunks/{BMvGDYIO.js → DQNwUygY.js} +3 -3
- package/web/app/immutable/chunks/{Bj5SHeCl.js → DR3ukAe9.js} +2 -2
- package/web/app/immutable/chunks/{DZpxiGBS.js → DRKyy5zo.js} +1 -1
- package/web/app/immutable/chunks/DTpCNXVX.js +62 -0
- package/web/app/immutable/chunks/DW02E8JU.js +291 -0
- package/web/app/immutable/chunks/{DyHBOL0Q.js → DbnaPZDp.js} +2 -2
- package/web/app/immutable/chunks/Dhhgf7-r.js +36 -0
- package/web/app/immutable/chunks/{Cbh5ofn-.js → DjaKy3j_.js} +1 -1
- package/web/app/immutable/chunks/{KljALMT3.js → Dk4znOdW.js} +1 -1
- package/web/app/immutable/chunks/{BANQT5xk.js → Dl1xcl6N.js} +1 -1
- package/web/app/immutable/chunks/Dmv_LV6R.js +106 -0
- package/web/app/immutable/chunks/{BreeoU2c.js → Dr28se2A.js} +2 -2
- package/web/app/immutable/chunks/Dr_BXnmT.js +169 -0
- package/web/app/immutable/chunks/{CoIY5b-q.js → Dvt2xumc.js} +1 -1
- package/web/app/immutable/chunks/DxHqMweQ.js +27 -0
- package/web/app/immutable/chunks/Dyv7eW7r.js +1 -0
- package/web/app/immutable/chunks/{W2kuqRhi.js → DzDnAGVP.js} +1 -1
- package/web/app/immutable/chunks/{CJNlKuUY.js → IIWxUL8F.js} +1 -1
- package/web/app/immutable/chunks/IjQ_akx8.js +24 -0
- package/web/app/immutable/chunks/{wihFHGRA.js → JFNcUgqI.js} +3 -3
- package/web/app/immutable/chunks/{BoTxE-Dg.js → JvGvDA7z.js} +1 -1
- package/web/app/immutable/chunks/{3xT4xHCc.js → LXPDKlyI.js} +1 -1
- package/web/app/immutable/chunks/{BPlpnhzH.js → M5rEGvXZ.js} +1 -1
- package/web/app/immutable/chunks/{C_sPSbma.js → O55LMojB.js} +1 -1
- package/web/app/immutable/chunks/{BmhnS69e.js → O86272iX.js} +2 -2
- package/web/app/immutable/chunks/{CZT_wjvA.js → PW60rHG1.js} +2 -2
- package/web/app/immutable/chunks/{D8xJeFNR.js → UzQ5fjmd.js} +7 -7
- package/web/app/immutable/chunks/VmPClZ6P.js +98 -0
- package/web/app/immutable/chunks/WKN7DEK1.js +292 -0
- package/web/app/immutable/chunks/{B7YFRmY9.js → YuniekLU.js} +2 -2
- package/web/app/immutable/chunks/{DWztuYd2.js → _Q4NEhG2.js} +1 -1
- package/web/app/immutable/chunks/{DyPRCICU.js → _sFm91KN.js} +4 -4
- package/web/app/immutable/chunks/{NChdTnqQ.js → cF0DaKkd.js} +1 -1
- package/web/app/immutable/chunks/{B2O-zJJK.js → d9OF_ecy.js} +1 -1
- package/web/app/immutable/chunks/eHLf0w_s.js +1 -0
- package/web/app/immutable/chunks/ey5Fwige.js +1 -0
- package/web/app/immutable/chunks/gq2RHuUM.js +120 -0
- package/web/app/immutable/chunks/{C0oSivDJ.js → hJG5qV93.js} +1 -1
- package/web/app/immutable/chunks/jfltPaLX.js +370 -0
- package/web/app/immutable/chunks/{CjUOGaIe.js → l0v05b1J.js} +3 -3
- package/web/app/immutable/chunks/{zeRt85dY.js → le8iLKoG.js} +1 -1
- package/web/app/immutable/chunks/{C0f7EiIR.js → mCGfnSaU.js} +1 -1
- package/web/app/immutable/chunks/{u7rudBWt.js → mNrkfPcL.js} +1 -1
- package/web/app/immutable/chunks/{Da48jYxu.js → tzNFwvLY.js} +1 -1
- package/web/app/immutable/chunks/{C1rjgyNe.js → xL2Hl8pt.js} +1 -1
- package/web/app/immutable/chunks/{D6QUdzQ1.js → yEkT96At.js} +1 -1
- package/web/app/immutable/chunks/{DhbOsIE5.js → yGxUPrAb.js} +14 -14
- package/web/app/immutable/entry/{app.CYN435_6.js → app.CWgSMPHo.js} +2 -2
- package/web/app/immutable/entry/start.DRM4Ek1S.js +1 -0
- package/web/app/immutable/nodes/{0.Dns3lFCs.js → 0.DsHcmAxw.js} +1 -1
- package/web/app/immutable/nodes/{1.Cd7O-58t.js → 1.CkY-7ake.js} +1 -1
- package/web/app/immutable/nodes/{10.BhPCwuSS.js → 10.CdTsXOpX.js} +1 -1
- package/web/app/immutable/nodes/{14.CbX9Og6B.js → 14.juvATfIp.js} +1 -1
- package/web/app/immutable/nodes/{16.DYSTj8m0.js → 16.DuXLhJX1.js} +2 -2
- package/web/app/immutable/nodes/{2.n7fSSeCW.js → 2.DL0H4Ehj.js} +8 -8
- package/web/app/immutable/nodes/{3.CfhffOh-.js → 3.CsarMzm8.js} +1 -1
- package/web/app/immutable/nodes/{4.DNZDs0vZ.js → 4.DOKXGcKD.js} +1 -1
- package/web/app/immutable/nodes/{5.DooL0KdY.js → 5.5nmYhZgy.js} +1 -1
- package/web/app/immutable/nodes/{6.pzplS1TY.js → 6.BMO8vjvw.js} +1 -1
- package/web/app/immutable/nodes/{7.CRhweboS.js → 7.Rmoc-ypk.js} +1 -1
- package/web/app/immutable/nodes/{8.CuuXIPiR.js → 8.Dy5AT1iw.js} +2 -2
- package/web/app/immutable/nodes/{9.hhdT3UPw.js → 9.Dtv2dSUT.js} +18 -18
- package/web/app/version.json +1 -1
- package/web/index.html +9 -9
- package/web/app/immutable/chunks/41W03kYB.js +0 -96
- package/web/app/immutable/chunks/4jLfrK-n.js +0 -84
- package/web/app/immutable/chunks/70PyZUYg.js +0 -70
- package/web/app/immutable/chunks/9H8XjRUA.js +0 -106
- package/web/app/immutable/chunks/B-2EcDun.js +0 -78
- package/web/app/immutable/chunks/B6EdH0gk.js +0 -120
- package/web/app/immutable/chunks/B7d6B8i2.js +0 -1
- package/web/app/immutable/chunks/BCaDoF8Y.js +0 -1
- package/web/app/immutable/chunks/BCfzoYfU.js +0 -1
- package/web/app/immutable/chunks/BDEqpi1y.js +0 -106
- package/web/app/immutable/chunks/BDchM60p.js +0 -178
- package/web/app/immutable/chunks/BDuevalq.js +0 -1
- package/web/app/immutable/chunks/BFcpLy2V.js +0 -24
- package/web/app/immutable/chunks/BGS2SWF9.js +0 -40
- package/web/app/immutable/chunks/BKpC4hzB.js +0 -1
- package/web/app/immutable/chunks/BLOlf2p9.js +0 -39
- package/web/app/immutable/chunks/BN912nIE.js +0 -1
- package/web/app/immutable/chunks/BQqlXz7Q.js +0 -24
- package/web/app/immutable/chunks/BZmA3QXk.js +0 -24
- package/web/app/immutable/chunks/BdluP0Re.js +0 -120
- package/web/app/immutable/chunks/BgmOiuVG.js +0 -342
- package/web/app/immutable/chunks/BmKF0wck.js +0 -1
- package/web/app/immutable/chunks/BpJz1MvJ.js +0 -7
- package/web/app/immutable/chunks/Br2I_00T.js +0 -7
- package/web/app/immutable/chunks/Br8EhifD.js +0 -89
- package/web/app/immutable/chunks/BriIY-V6.js +0 -2
- package/web/app/immutable/chunks/Bs-gIQLt.js +0 -4
- package/web/app/immutable/chunks/BwBhkp82.js +0 -292
- package/web/app/immutable/chunks/Bz-Yc7Wl.js +0 -34
- package/web/app/immutable/chunks/BzAchneh.js +0 -1
- package/web/app/immutable/chunks/C10ooCp1.js +0 -24
- package/web/app/immutable/chunks/C3OhkOVO.js +0 -1
- package/web/app/immutable/chunks/C519ihU9.js +0 -231
- package/web/app/immutable/chunks/C7T4LQE1.js +0 -257
- package/web/app/immutable/chunks/C7_3LSl8.js +0 -162
- package/web/app/immutable/chunks/CAM1CwRY.js +0 -1
- package/web/app/immutable/chunks/CHx78N0-.js +0 -1
- package/web/app/immutable/chunks/CJRXWUIB.js +0 -36
- package/web/app/immutable/chunks/CKRb139P.js +0 -1
- package/web/app/immutable/chunks/COamqMg3.js +0 -1
- package/web/app/immutable/chunks/CPm7NntQ.js +0 -38
- package/web/app/immutable/chunks/CSNcNZAr.js +0 -1
- package/web/app/immutable/chunks/CTI6K_Uf.js +0 -1
- package/web/app/immutable/chunks/CUuCn5ps.js +0 -1
- package/web/app/immutable/chunks/CXVxtSkJ.js +0 -38
- package/web/app/immutable/chunks/CYhtIPW_.js +0 -62
- package/web/app/immutable/chunks/CaNdc6nO.js +0 -292
- package/web/app/immutable/chunks/CbMdHBoe.js +0 -1
- package/web/app/immutable/chunks/Citosjx7.js +0 -41
- package/web/app/immutable/chunks/Cj_j-lXn.js +0 -206
- package/web/app/immutable/chunks/CnCQnNEp.js +0 -354
- package/web/app/immutable/chunks/CnsnqDQd.js +0 -1
- package/web/app/immutable/chunks/CqBIsc3j.js +0 -99
- package/web/app/immutable/chunks/CqslOMwD.js +0 -96
- package/web/app/immutable/chunks/CvOaoHrI.js +0 -1
- package/web/app/immutable/chunks/CvYzv8kf.js +0 -1
- package/web/app/immutable/chunks/CwpRQv-w.js +0 -8
- package/web/app/immutable/chunks/CyfBUrNA.js +0 -1
- package/web/app/immutable/chunks/Cyhorubq.js +0 -231
- package/web/app/immutable/chunks/D1SkvgLK.js +0 -1
- package/web/app/immutable/chunks/D6XiPT-X.js +0 -1
- package/web/app/immutable/chunks/D7jRh74W.js +0 -1
- package/web/app/immutable/chunks/D9ytGf5e.js +0 -1
- package/web/app/immutable/chunks/DF1EzKEK.js +0 -41
- package/web/app/immutable/chunks/DGaGjBKU.js +0 -168
- package/web/app/immutable/chunks/DKQ9ngHk.js +0 -99
- package/web/app/immutable/chunks/DNmtQDpd.js +0 -8
- package/web/app/immutable/chunks/DOXLMb3q.js +0 -129
- package/web/app/immutable/chunks/DPpctSbu.js +0 -84
- package/web/app/immutable/chunks/DR8edmqz.js +0 -139
- package/web/app/immutable/chunks/DUYSWpmE.js +0 -1
- package/web/app/immutable/chunks/DXaxEP8U.js +0 -1
- package/web/app/immutable/chunks/DYy64AXn.js +0 -338
- package/web/app/immutable/chunks/DcI5wCZ5.js +0 -1
- package/web/app/immutable/chunks/DdRfFUWu.js +0 -1
- package/web/app/immutable/chunks/DfF0sVRg.js +0 -3
- package/web/app/immutable/chunks/Divbj3b8.js +0 -40
- package/web/app/immutable/chunks/DmUq9QE3.js +0 -162
- package/web/app/immutable/chunks/Dqn0Ivcg.js +0 -39
- package/web/app/immutable/chunks/DsJW9cbJ.js +0 -88
- package/web/app/immutable/chunks/DtFtH7jZ.js +0 -4
- package/web/app/immutable/chunks/DvZBb8H_.js +0 -168
- package/web/app/immutable/chunks/GX9YV5ly.js +0 -129
- package/web/app/immutable/chunks/HP8lGamR.js +0 -257
- package/web/app/immutable/chunks/I1Pwq7BS.js +0 -15
- package/web/app/immutable/chunks/Jj6giUQG.js +0 -7
- package/web/app/immutable/chunks/K10ifhfc.js +0 -1
- package/web/app/immutable/chunks/PDuKM1t5.js +0 -1
- package/web/app/immutable/chunks/PUlhNAJH.js +0 -1
- package/web/app/immutable/chunks/VtMTQAXA.js +0 -30
- package/web/app/immutable/chunks/YqyEOqRv.js +0 -178
- package/web/app/immutable/chunks/b7kGm9Ly.js +0 -36
- package/web/app/immutable/chunks/d1jIpATl.js +0 -62
- package/web/app/immutable/chunks/eCj-hB88.js +0 -3
- package/web/app/immutable/chunks/g3iFlZMW.js +0 -1
- package/web/app/immutable/chunks/iYpMWPUv.js +0 -206
- package/web/app/immutable/chunks/kqGPx169.js +0 -2
- package/web/app/immutable/chunks/ojOCNOao.js +0 -1
- package/web/app/immutable/chunks/v70CwcHz.js +0 -34
- package/web/app/immutable/chunks/zkqMQ7Ph.js +0 -1
- package/web/app/immutable/entry/start.Cuiv1qlw.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ab as Cr,bC as In,f as d,bE as To}from"./BgmOiuVG.js";var Ao=5,Xe=1e-5,Ye=1e-6;function Ue(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}d(Ue,"buildSegmentList");function Bo(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,a=o.x-n.x,l=o.y-n.y,f=s*l-r*a;if(f===0)return null;const i=n.x-t.x,g=n.y-t.y,x=(i*l-g*a)/f,C=(i*r-g*s)/f;return x<=Ye||x>=1-Ye||C<=Ye||C>=1-Ye?null:{point:{x:t.x+x*s,y:t.y+x*r},tA:x,tB:C}}d(Bo,"segmentIntersection");function Sn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(Sn,"isHorizontalSeg");function ko(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],s=Ue(o.points);for(let r=n+1;r<t.length;r++){const a=t[r],l=Ue(a.points);for(const[f,i]of s.entries())for(const[g,x]of l.entries()){const C=Bo(i.a,i.b,x.a,x.b);if(!C)continue;const h=Sn(i),p=Sn(x);(h!==p?h:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:a.id,segIndex:f,t:C.tA,point:C.point}):e.push({jumpEdgeId:a.id,otherEdgeId:o.id,segIndex:g,t:C.tB,point:C.point})}}}return e}d(ko,"findEdgeIntersections");function re(t){const e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}d(re,"fmt");function Ae(t){return`${re(t.x)},${re(t.y)}`}d(Ae,"pointToString");function Fo(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Fo,"getArcSweepFlag");var vr=.001;function _o(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&To[e.arrowTypeStart];if(o){const r=t[0],a=t[1],l=Math.atan2(a.y-r.y,a.x-r.x);n[0].x=r.x+o*Math.cos(l),n[0].y=r.y+o*Math.sin(l)}const s=e.arrowTypeEnd&&To[e.arrowTypeEnd];if(s){const r=t.length,a=t[r-2],l=t[r-1],f=Math.atan2(l.y-a.y,l.x-a.x);n[r-1].x=l.x-s*Math.cos(f),n[r-1].y=l.y-s*Math.sin(f)}return n}d(_o,"applyMarkerOffsets");function Do(t,e,n,o,s){const r=t.point.x,a=t.point.y,l={x:r-e*t.r,y:a-n*t.r},f={x:r+e*t.r,y:a+n*t.r},i=[`L${Ae(l)}`];return s==="arc"?i.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${Ae(f)}`):i.push(`M${Ae(f)}`),i}d(Do,"emitJump");function Cn(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,a=n.x-e.x,l=n.y-e.y,f=Math.hypot(s,r),i=Math.hypot(a,l);if(f<Xe||i<Xe)return null;const g=s/f,x=r/f,C=a/i,h=l/i,p=g*C+x*h,c=Math.max(-1,Math.min(1,p)),y=Math.acos(c);if(y<Xe||Math.abs(Math.PI-y)<Xe)return null;const v=Math.min(o/Math.sin(y/2),f/2,i/2);return{startX:e.x-g*v,startY:e.y-x*v,endX:e.x+C*v,endY:e.y+h*v,ctrlX:e.x,ctrlY:e.y,cutLen:v}}d(Cn,"computeRoundedCorner");function Ho(t,e,n){const o=t.points;if(o.length<2)return"";const s=_o(o,t),r=t.curve==="rounded",a=Ue(s),l=new Map;for(const i of e){const g=a[i.segIndex];if(!g)continue;const x=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),C=l.get(i.segIndex)??[];C.push({t:i.t,point:i.point,d:i.t*x,r:n.jumpRadius}),l.set(i.segIndex,C)}const f=[`M${Ae(s[0])}`];for(let i=0;i<a.length;i++){const g=a[i],x=Math.hypot(g.b.x-g.a.x,g.b.y-g.a.y),C=x===0?0:(g.b.x-g.a.x)/x,h=x===0?0:(g.b.y-g.a.y)/x,p=Fo(g);let c=0;if(r&&i>0){const E=Cn(s[i-1],s[i],s[i+1]??s[i],Ao);E&&(c=E.cutLen)}let y=x,v=null;r&&i<a.length-1&&(v=Cn(s[i],s[i+1],s[i+2]??s[i+1],Ao),v&&(y=x-v.cutLen));const M=[...l.get(i)??[]].sort((E,T)=>E.t-T.t);for(const E of M)E.r=Math.min(E.r,E.d-c,y-E.d);for(let E=0;E<M.length-1;E++){const T=M[E+1].d-M[E].d;if(M[E].r+M[E+1].r>T){const m=T/2;M[E].r=Math.min(M[E].r,m),M[E+1].r=Math.min(M[E+1].r,m)}}for(const E of M)E.r<vr||f.push(...Do(E,C,h,p,n.jumpStyle));r&&v?(f.push(`L${re(v.startX)},${re(v.startY)}`),f.push(`Q${re(v.ctrlX)},${re(v.ctrlY)} ${re(v.endX)},${re(v.endY)}`)):f.push(`L${Ae(g.b)}`)}return f.join(" ")}d(Ho,"rewriteEdgePath");function Xo(t){return/^[\d\s+,.LMelm-]*$/.test(t)}d(Xo,"isStraightPath");function Yo(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}d(Yo,"curveSupportsLineHops");function Go(t){if(!t)return null;try{const e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const s of n)s&&typeof s.x=="number"&&typeof s.y=="number"&&o.push({x:s.x,y:s.y});return o.length>=2?o:null}catch{return null}}d(Go,"decodeDataPoints");function $o(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const i of e)s.set(i.id,i);const r=[],a=new Map;for(const i of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(i.id):i.id,x=o.querySelector(`path[data-id="${g}"]`);if(!x)continue;a.set(i.id,x);const h=Go(x.getAttribute("data-points"))??i.points;r.push({...i,points:h})}const l=ko(r);if(l.length===0)return;const f=new Map;for(const i of l){const g=f.get(i.jumpEdgeId)??[];g.push(i),f.set(i.jumpEdgeId,g)}for(const i of r){const g=f.get(i.id);if(!g||g.length===0)continue;const C=s.get(i.id)?.curve;if(C!==void 0&&!Yo(C))continue;const h=a.get(i.id);if(!h)continue;if(C===void 0){const E=h.getAttribute("d")??"";if(!Xo(E))continue}const p=h.getAttribute("style")??"",c=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),y=c?Number.parseFloat(c[1]):null,v=c?Number.parseFloat(c[2]):null,M=Ho(i,g,n);if(h.setAttribute("d",M),y!==null&&v!==null&&typeof h.getTotalLength=="function"){const E=h.getTotalLength(),T=Math.max(0,E-y-v),m=`0 ${y} ${T} ${v}`,I=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${m};`).replace(/;\s*;+/g,";");h.setAttribute("style",I)}}}d($o,"applyLineJumpsToSvg");function zo(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));$o(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}d(zo,"applySwimlaneLineJumps");var yn="__swimlane_default__",Lr=21,wo=20;function vn(t){return Math.max(t.padding??wo,wo)}d(vn,"topLaneHorizontalPadding");function Vo(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const a=n-s/2,l=Math.min(r,n+s/2),f=Math.min(Lr,Math.max(0,l-a)),i=a+f;if(i<=a){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:a,bottom:i}}d(Vo,"assignTopLaneTitleRect");function jo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===yn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:yn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=yn}d(jo,"prepareLayoutForSwimlanes");function Uo(t){const e=new Map;for(const f of t.nodes??[])e.set(f.id,f);const n=[];for(const f of t.edges??[]){const i=typeof f.start=="string"?f.start:void 0,g=typeof f.end=="string"?f.end:void 0;!i||!g||f.labelNodeId||n.push({id:f.id,src:i,dst:g,ref:f})}const o=t.nodes??[],s=o.filter(f=>f.isGroup),r=o.filter(f=>!f.isGroup);return{nodes:[...[...s].reverse(),...r].map(f=>f.id),edges:n,layout:t,nodeById:e}}d(Uo,"toGraphView");function Wo(t,e,n,o){const{layout:s}=t,r=t.nodeById,a=o?.layerGap??100,l=o?.nodeGap??40;let f=0;for(const C of e.layers){let h=0;for(const p of C){const c=r.get(p);if(!c){h++;continue}c.layer=f,c.order=h;const y=n.x[p]??h*l,v=n.y[p]??f*a;c.x=y,c.y=v,h++}f++}const i=s.nodes??[],g=new Map,x=[];for(const C of i){if(!C?.isGroup)continue;C.parentId||x.push(C);const h=i.filter(M=>M.parentId===C.id);let p=1/0,c=-1/0,y=1/0,v=-1/0;for(const M of h){const E=M.x??n.x[M.id],T=M.y??n.y[M.id],m=M.width??0,I=M.height??0;E!=null&&T!=null&&(p=Math.min(p,E-m/2),c=Math.max(c,E+m/2),y=Math.min(y,T-I/2),v=Math.max(v,T+I/2))}if(p===1/0||y===1/0)C.x=C.x??0,C.y=C.y??0,C.width=C.width??0,C.height=C.height??0;else{const M=C.padding??20,E=C.parentId?M:2*vn(C),T=M,m=Math.max(0,c-p)+E,I=Math.max(0,v-y)+T,w=(p+c)/2,R=(y+v)/2;C.x=w,C.y=R,C.width=m,C.height=I,g.set(C.id,{minX:p,maxX:c,minY:y,maxY:v})}}if(x.length>0&&g.size>0){let C=1/0,h=-1/0,p=0;for(const c of x){const y=c.padding??20;y>p&&(p=y);const v=g.get(c.id);v&&(C=Math.min(C,v.minY),h=Math.max(h,v.maxY))}if(C!==1/0&&h!==-1/0){const c=Math.max(0,h-C),v=Math.max(p,36),M=c+2*v,E=(C+h)/2;for(const k of x)k.y=E,k.height=M,k.swimlaneContentTop=C;const T=[...x].sort((k,O)=>{const F=k.x??0,H=O.x??0;return F-H}),m=[],I=[],w=[];for(const k of T){const O=g.get(k.id);if(!O)continue;const F=Math.max(0,O.maxX-O.minX)+2*vn(k),H=(O.minX+O.maxX)/2;m.push(k.id),I.push(H),w.push(F)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],w[0]);else{const O=[];for(let j=0;j<R-1;j++)O.push(I[j+1]-I[j]);const F=new Array(R);F[0]=0;for(let j=0;j<R-1;j++)F[j+1]=2*O[j]-F[j];let H=0,P=Number.POSITIVE_INFINITY;for(let j=0;j<R;j++){const J=w[j];j%2===0?H=Math.max(H,J-F[j]):P=Math.min(P,F[j]-J)}let G=H;H<=P?G=(H+P)/2:G=H;for(let j=0;j<R;j++){const J=F[j]+(j%2===0?G:-G),dt=Math.max(w[j],J);k.set(m[j],dt)}}for(const O of x){const F=k.get(O.id);F!=null&&(O.width=F),Vo(O)}}}}}d(Wo,"writeBackToLayoutData");var Er="[EdgeLabelNodes]";function Ko(t){const e=[],n=[],o=new Map;for(const a of t.nodes)o.set(a.id,a);for(const a of t.edges){if(!a.label||a.label.length===0||a.isLayoutOnly||a.labelNodeId)continue;const l=a.start?o.get(a.start):void 0,f=a.end?o.get(a.end):void 0;if(!l||!f){In.warn(Er,`Edge ${a.id} has missing source or target node`);continue}const i=`edge-label-${a.start}-${a.end}-${a.id}`,x=l.parentId!==f.parentId?f.parentId:l.parentId,C={id:i,label:a.label,edgeStart:a.start??"",edgeEnd:a.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:x,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??"",...l.dir?{dir:l.dir}:{}};e.push(C),a.labelNodeId=i,a.label=void 0,a.text=void 0;const h={id:`${a.id}-to-label`,start:a.start,end:i,type:"normal",isLayoutOnly:!0},p={id:`${a.id}-from-label`,start:i,end:a.end,type:"normal",isLayoutOnly:!0};n.push(h,p)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}d(Ko,"createEdgeLabelNodes");var _t=.001;function eo(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:we(e,n,o,s)}:void 0}d(eo,"measuredNodeRect");function no(t){if(t.isGroup)return;const e=eo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(no,"nodeBoundsInfoFor");function oe(t,e,n=_t){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}d(oe,"samePoint");function ft(t,e,n=_t){return Math.abs(t.x-e.x)<n}d(ft,"sameX");function ht(t,e,n=_t){return Math.abs(t.y-e.y)<n}d(ht,"sameY");function Tt(t,e,n=_t){return ht(t,e,n)&&Math.abs(t.x-e.x)>n}d(Tt,"isHorizontalSegment");function At(t,e,n=_t){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}d(At,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(zt,"overlapLength");function ce(t,e,n=_t){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(ce,"sameAxisSegmentOverlapLength");function Re(t,e=_t){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],a=Tt(s,r,e),l=At(s,r,e);(a||l)&&n.push({index:o,a:s,b:r,horizontal:a,vertical:l})}return n}d(Re,"orthogonalSegmentsForPoints");function Qt(t,e=_t){const n=Re(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}d(Qt,"countOrthogonalBends");function pt(t,e=_t){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(pt,"dedupeConsecutivePoints");function oo(t,e=_t){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Tt(n,o,e)&&At(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:At(n,o,e)&&Tt(o,s,e)&&At(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(oo,"classifyThreeSegmentRoute");function on(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),a=Math.min(t.y,e.y),l=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&l>n.top-o&&a<n.bottom+o}d(on,"segmentBoundsOverlapRect");function so(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}d(so,"pointInsideRect");function qo(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(qo,"rectContainsRect");function We(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}d(We,"rectsOverlap");function Ln(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Ln,"inflateRect");function we(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(we,"rectFromCenterSize");function qt(t){return eo(t)?.rect}d(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Ie,"portForRectSide");function ro(t,e,n,o,s,r=_t){const a=e==="left"||e==="right",l=o==="left"||o==="right";if(a&&l){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(ht(t,n,r))return[t,n];const x=(t.x+n.x)/2;return[t,{x,y:t.y},{x,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const x=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x,y:t.y},{x,y:n.y},n]}return}if(!a&&!l){if(e===o){if(ft(t,n,r))return;const C=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:C},{x:n.x,y:C},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(ft(t,n,r))return[t,n];const x=(t.y+n.y)/2;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(a&&!l){const g=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,x=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return g&&x?[t,{x:n.x,y:t.y},n]:void 0}const f=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,i=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return f&&i?[t,{x:t.x,y:n.y},n]:void 0}d(ro,"buildOrthogonalPortPath");function io(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(io,"buildSameSideTrackPath");function sn(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=no(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(sn,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=no(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(me,"collectNodeRectEntries");function Jo(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,a=o.width??0,l=o.height??0;n.push({nodeId:o.id,...we(s,r,a,l)})}return n}d(Jo,"collectLayoutNodeRects");function co(t,e,n=_t){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),a=e.get(s);if(!(!r||!a))return{srcId:o,dstId:s,srcInfo:r,dstInfo:a,collinearX:Math.abs(r.cx-a.cx)<n,collinearY:Math.abs(r.cy-a.cy)<n}}d(co,"getNodePairGeometry");function wt(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&on(t,e,r.rect,-s))return!0;return!1}d(wt,"segmentHitsAnyRect");function ao(t,e,n,o,s=_t,r=1e-6){const a=ht(t,e,s),l=ft(t,e,s),f=ht(n,o,s),i=ft(n,o,s);if(a&&f||l&&i||!(a||l)||!(f||i))return!1;const g=a?{a:t,b:e}:{a:n,b:o},x=l?{a:t,b:e}:{a:n,b:o},C=g.a.y,h=Math.min(g.a.x,g.b.x),p=Math.max(g.a.x,g.b.x),c=x.a.x,y=Math.min(x.a.y,x.b.y),v=Math.max(x.a.y,x.b.y);if(c<h||c>p||C<y||C>v)return!1;const M=Math.abs(c-g.a.x)<r&&Math.abs(C-g.a.y)<r||Math.abs(c-g.b.x)<r&&Math.abs(C-g.b.y)<r,E=Math.abs(c-x.a.x)<r&&Math.abs(C-x.a.y)<r||Math.abs(c-x.b.x)<r&&Math.abs(C-x.b.y)<r;return!(M&&E)}d(ao,"orthogonalSegmentsCross");function Zo(t,e,n,o,s=_t){const r=ht(t,e,s),a=ft(t,e,s),l=ht(n,o,s),f=ft(n,o,s);return a&&f&&ft(t,n,s)?zt(t.y,e.y,n.y,o.y)>s:r&&l&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}d(Zo,"sameAxisSegmentsOverlap");function Ke(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(const a of n){if(a===o||a.isLayoutOnly)continue;const l=a.points;if(!(!l||l.length<2))for(let f=0;f<l.length-1;f++){const i=l[f],g=l[f+1];if(!(r&&oe(i,g,s))&&(ao(t,e,i,g,s)||Zo(t,e,i,g,s)))return!0}}return!1}d(Ke,"segmentConflictsWithAnyEdge");function le(t,e,n,o,s=_t){const r=ht(t,e,s),a=ft(t,e,s),l=ht(n,o,s),f=ft(n,o,s);if(!(r&&f||a&&l))return!1;const i=r?{a:t,b:e}:{a:n,b:o},g=r?{a:n,b:o}:{a:t,b:e},x=i.a.y,C=Math.min(i.a.x,i.b.x),h=Math.max(i.a.x,i.b.x),p=g.a.x,c=Math.min(g.a.y,g.b.y),y=Math.max(g.a.y,g.b.y);return p>C+s&&p<h-s&&x>c+s&&x<y-s}d(le,"orthogonalSegmentsStrictlyCross");function En(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}d(En,"strictlyBetween");function Qo(t,e,n){return ft(t,e)&&ft(e,n)?En(e.y,t.y,n.y):ht(t,e)&&ht(e,n)?En(e.x,t.x,n.x):!1}d(Qo,"isCollinearIntermediate");function ts(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],a=o+1<t.length?t[o+1]:void 0;if(s&&a){if(oe(s,a)){o++,e=!0;continue}if(Qo(s,r,a)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}d(ts,"simplifyPolylineOnce");function qe(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!ft(s,r)&&!ht(s,r)){const a=e.length>=2?e[e.length-2]:void 0,f=(a?ft(a,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(f)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}d(qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ts(e);if(e=o.points,!o.changed)break}return e}d(ae,"simplifyPolyline");var nt=.001,Tr=.5,Ro=4;function lo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?qt(s):void 0,dstRect:r?qt(r):void 0}}d(lo,"endpointContextFor");function es(t,e,n){if(ht(t,e,nt))return{x:t.x<n.left?n.left:n.right,y:t.y};if(ft(t,e,nt)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}d(es,"segmentEnterPoint");function Tn(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&so(t[s],e,Tr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const a=es(t[s],t[r],e);return n?[a,...t.slice(s)]:[...t.slice(0,s+1),a]}d(Tn,"clipEndpoint");function ns(t,e){for(const n of t){const o=lo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Tn(s,o.srcRect,!0)),o.dstRect&&(s=Tn(s,o.dstRect,!1)),s=ae(qe(s)),s=fo(s,o.srcRect,o.dstRect),o.edge.points=ae(qe(s))}}d(ns,"clipEdgeEndpointsToNodeBoundaries");function An(t,e,n,o=!1){if(ht(t,e,nt)){if(e.y<n.top-nt||e.y>n.bottom+nt)return e;if(o){if(t.x<n.left-nt)return{x:n.left,y:t.y};if(t.x>n.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.x<n.left-nt||e.x>n.right+nt)return e;if(o){if(t.y<n.top-nt)return{x:t.x,y:n.top};if(t.y>n.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(An,"snapEndpointToBoundary");function Je(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!oe(r,o,nt))return r}return t[e+n]}d(Je,"firstDistinctAdjacent");function Ze(t,e){const n=t+Ro,o=e-Ro;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}d(Ze,"cornerClearanceRange");function wn(t,e,n){const{lo:o,hi:s}=Ze(e,n);return Math.min(s,Math.max(o,t))}d(wn,"clampToCornerClearance");function os(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(os,"intersectRanges");function Rn(t,e){return e==="left"||e==="right"?Ze(t.top,t.bottom):Ze(t.left,t.right)}d(Rn,"clearanceRangeForSide");function Qe(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)<nt)return"left";if(Math.abs(t.x-n.right)<nt)return"right"}if(ft(t,e,nt)&&s){if(Math.abs(t.y-n.top)<nt)return"top";if(Math.abs(t.y-n.bottom)<nt)return"bottom"}}d(Qe,"terminalSideForSegment");function Oe(t){return t==="left"||t==="right"}d(Oe,"isHorizontalSide");function ss(t,e,n,o,s){const r=[],a=n?Qe(t,e,n):void 0,l=o?Qe(e,t,o):void 0;return n&&a&&Oe(a)===s&&r.push(Rn(n,a)),o&&l&&Oe(l)===s&&r.push(Rn(o,l)),r.length>0?os(r):void 0}d(ss,"straightClearanceRange");function Nn(t,e,n,o,s){const r=ss(t,e,n,o,s);if(!r)return;const a=s?t.y:t.x,l=Math.min(r.hi,Math.max(r.lo,a));if(!(Math.abs(l-a)<nt))return s?[{x:t.x,y:l},{x:e.x,y:l}]:[{x:l,y:t.y},{x:l,y:e.y}]}d(Nn,"clearStraightEndpointCornerAxis");function fo(t,e,n){if(t.length!==2)return t;const[o,s]=t;return ht(o,s,nt)?Nn(o,s,e,n,!0)??t:ft(o,s,nt)?Nn(o,s,e,n,!1)??t:t}d(fo,"clearStraightEndpointCornerConnections");function rs(t,e,n){return Oe(n)?{x:t.x,y:wn(t.y,e.top,e.bottom)}:{x:wn(t.x,e.left,e.right),y:t.y}}d(rs,"cornerClearedEndpoint");function is(t,e,n,o,s,r){const a=t.map(l=>({...l}));for(let l=e;l>=0&&l<t.length;l+=n){const f=t[l];if(r&&!ht(f,o,nt)||!r&&!ft(f,o,nt))break;r?a[l].y=s.y:a[l].x=s.x}return a}d(is,"moveCollinearEndpointRun");function On(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],a=Je(t,o,s);if(!a)return t;const l=Qe(r,a,e);if(!l)return t;const f=Oe(l),i=rs(r,e,l);return oe(r,i,nt)?t:is(t,o,s,r,i,f)}d(On,"clearEndpointCornerConnection");function Pn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)<nt&&Math.abs(e.y-n.top)<nt&&o)return"top";if(Math.abs(t.y-n.bottom)<nt&&Math.abs(e.y-n.bottom)<nt&&o)return"bottom";if(Math.abs(t.x-n.left)<nt&&Math.abs(e.x-n.left)<nt&&s)return"left";if(Math.abs(t.x-n.right)<nt&&Math.abs(e.x-n.right)<nt&&s)return"right"}d(Pn,"borderSideForSegment");function Bn(t,e,n,o){switch(t){case"top":return ft(e,n,nt)&&n.y<o.top-nt;case"bottom":return ft(e,n,nt)&&n.y>o.bottom+nt;case"left":return ht(e,n,nt)&&n.x<o.left-nt;case"right":return ht(e,n,nt)&&n.x>o.right+nt}}d(Bn,"leavesOutward");function kn(t,e,n){if(t.length<3)return t;if(n){const r=Pn(t[0],t[1],e);return r&&Bn(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=Pn(t[o-1],t[o],e);return s&&Bn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(kn,"collapseOwnBorderStub");function cs(t,e,n){let o=t;if(e){const r=Je(o,0,1);if(r){const a=An(r,o[0],e);a!==o[0]&&(o=[a,...o.slice(1)])}o=kn(o,e,!0)}if(n){const r=o.length-1,a=Je(o,r,-1);if(a){const l=An(a,o[r],n,!0);l!==o[r]&&(o=[...o.slice(0,r),l])}o=kn(o,n,!1)}const s=fo(o,e,n);return s!==o||o.length===2?s:(e&&(o=On(o,e,!0)),n&&(o=On(o,n,!1)),o)}d(cs,"snapAndCollapseEndpoints");function Fn(t,e){for(const n of t){const o=lo(n,e,2);if(!o)continue;const s=pt(o.points,nt),r=cs(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const a=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=a}}d(Fn,"prepareEdgeEndpointsForRenderer");function uo(t){return new Map(t.map(e=>[e.id,e]))}d(uo,"buildNodeMap");function as(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}d(as,"resolveTopLevelGroupId");function _n(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}d(_n,"groupDepth");function ho(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const a=r.x,l=r.y;if(typeof a!="number"||typeof l!="number")continue;const f=r.width??0,i=r.height??0;e=Math.min(e,a-f/2),n=Math.max(n,a+f/2),o=Math.min(o,l-i/2),s=Math.max(s,l+i/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(ho,"boundsForChildren");function ls(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(ls,"applyGroupBounds");function fs(t){const e=uo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>_n(s,e)-_n(o,e));for(const o of n){const s=t.filter(a=>a.parentId===o.id),r=ho(s);r&&ls(o,r)}}d(fs,"recomputeNestedGroupBounds");function tn(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(f=>!f.isGroup);let r=1/0,a=-1/0;for(const f of s){const i=f[e];typeof i=="number"&&(r=Math.min(r,i),a=Math.max(a,i))}if(!Number.isFinite(r)||!Number.isFinite(a))return!1;const l=d(f=>r+a-f,"mirror");for(const f of n){const i=f[e];typeof i=="number"&&(f[e]=l(i));const g=f.groupTitleRect;g&&(f.groupTitleRect=e==="x"?{...g,left:l(g.right),right:l(g.left)}:{...g,top:l(g.bottom),bottom:l(g.top)})}for(const f of o)for(const i of f.points??[])i[e]=l(i[e]);return!0}d(tn,"mirrorAxis");function ds(t){return(t.nodes??[]).some(n=>!n.isGroup)?tn(t,"y"):!0}d(ds,"applyBtDirectionTransform");function us(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,a=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G<r&&(r=G),j<a&&(a=j)}if(!Number.isFinite(r)||!Number.isFinite(a))return!1;const l=36;let f=0,i=0;for(const P of s)f+=P.width??0,i+=P.height??0;const g=f/s.length,x=i/s.length,C=x>0?Math.max(1,g/x):1;for(const P of s){const G=P.x??0,J=((P.y??0)-a)*C+l,dt=G-r;P.x=J,P.y=dt}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,dt=(G.y-a)*C+l,mt=j-r;G.x=dt,G.y=mt}fs(n);const h=n.filter(P=>P.isGroup&&!P.parentId);if(h.length===0)return e==="RL"&&tn(t,"x"),!0;const p=uo(n),c=new Map;for(const P of n){if(P.isGroup)continue;const G=as(P,p);if(!G)continue;const j=c.get(G)??[];j.push(P),c.set(G,j)}let y=0;for(const P of h){const G=P.padding??0;G>y&&(y=G)}const v=[];let M=1/0,E=-1/0;for(const P of h){const G=c.get(P.id)??[],j=ho(G);j&&(M=Math.min(M,j.minX),E=Math.max(E,j.maxX),v.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(M===1/0||E===-1/0)return!0;const T=Math.max(0,E-M),m=Math.max(y,10),I=T+2*m,w=l+I,O=(M+E)/2-I/2-l,F=O+w/2,H=Math.max(y,l);v.sort((P,G)=>P.centerY-G.centerY);for(let P=0;P<v.length;P++){const G=v[P];let j,J;if(P===0?j=G.contentTop-H:j=(v[P-1].contentBottom+G.contentTop)/2,P===v.length-1)J=G.contentBottom+H;else{const kt=v[P+1];J=(G.contentBottom+kt.contentTop)/2}const dt=Math.max(0,J-j),mt=(j+J)/2;G.lane.x=F,G.lane.y=mt,G.lane.width=w,G.lane.height=dt,G.lane.swimlaneContentTop=G.contentTop,G.lane.groupTitleRect={left:O,right:O+l,top:j,bottom:J}}return e==="RL"&&tn(t,"x"),!0}d(us,"applyLrDirectionTransform");var se=1e-6,Ar=8,Ge=Ar,wr=[0,Ge,-Ge,2*Ge,-2*Ge];function hs(t,e){const{nodeInfoById:n,realNodeRects:o}=sn(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const a=oo(pt(r,se),se);if(!a)continue;const{p3:l}=a,f=a.kind==="HVH",i=co(s,n,se);if(!i)continue;const{srcId:g,dstId:x,srcInfo:C,dstInfo:h,collinearX:p,collinearY:c}=i;if(p||c)continue;let y;const v=C.rect;for(const M of wr){let E,T,m;if(f){const F=h.cy>C.cy?v.bottom:v.top,H=C.cx+M;if(H<=v.left+se||H>=v.right-se)continue;E={x:H,y:F},T={x:H,y:l.y},m={x:l.x,y:l.y}}else{const F=h.cx>C.cx?v.right:v.left,H=C.cy+M;if(H<=v.top+se||H>=v.bottom-se)continue;E={x:F,y:H},T={x:l.x,y:H},m={x:l.x,y:l.y}}const I=oe(E,T,se),w=oe(T,m,se);if(I&&w||!I&&wt(E,T,o,[g],1)||!w&&wt(T,m,o,[x],1))continue;const R=!I&&Ke(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!w&&Ke(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){I?y=[T,m]:w?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}d(hs,"portSwapToLShape");function gs(t,e){const{realNodeRects:r,labelNodeRects:a}=me(e.values());for(const l of t){if(l.isLayoutOnly)continue;const f=l.points;if(!f||f.length<4)continue;const i=pt(f,.001);if(i.length<4)continue;const g=i.length-1,x=i[g],C=i[g-1],h=i[g-2],p=x.x-C.x,c=x.y-C.y,y=Math.hypot(p,c);if(y>=10||y<.001)continue;const v=C.x-h.x,M=C.y-h.y;if(Math.hypot(v,M)<.001)continue;const T=Tt(C,x,.001),m=At(C,x,.001),I=Tt(h,C,.001),w=At(h,C,.001);if(!(T&&w||m&&I))continue;const R=l.end,k=l.start,O=R?e.get(R):void 0;if(!O)continue;const F=O.x??0,H=O.y??0,P=qt(O);if(!P)continue;let G,j;if(w){const W=M<0;G={x:F,y:h.y},j={x:F,y:W?P.bottom:P.top}}else{const W=v>0;G={x:h.x,y:H},j={x:W?P.right:P.left,y:H}}if(wt(G,j,r,R?[R]:[],-2)||wt(G,j,a,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&so(G,et,2))continue}const J=d((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W<i.length-1;W++)dt.add(J(i[W],i[W+1]));const mt=d((W,et)=>{for(const at of t){if(at===l||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt<gt.length-1;xt++){const vt=gt[xt],Vt=gt[xt+1];if(!dt.has(J(vt,Vt))&&le(W,et,vt,Vt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(mt(G,j))continue;if(g-3>=0){const W=i[g-3],et=[k,R].filter(at=>!!at);if(wt(W,G,r,et,-2)||mt(W,G))continue}const Pt=[...i.slice(0,g-2),G,j];l.points=Pt;const Q=l.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt<Pt.length-1;Vt++){const jt=Pt[Vt],Ut=Pt[Vt+1],te=Math.hypot(Ut.x-jt.x,Ut.y-jt.y),Se=ht(jt,Ut,.001),de=ft(jt,Ut,.001);(Se&&te>=et+2||de&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}d(gs,"collapseShortTerminalStub");var Z=.001,Ft=8,it=Re,xn=d((t,e)=>ft(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function ps(t,e){const s=d((h,p)=>{const c=h.x??0,y=h.y??0,v=p.x-c,M=p.y-y;let E=(h.width??0)/2,T=(h.height??0)/2;return Math.abs(M)*E>Math.abs(v)*T?(M<0&&(T=-T),{x:c+(M===0?0:T*v/M),y:y+T}):(v<0&&(E=-E),{x:c+E,y:y+(v===0?0:E*M/v)})},"rectIntersect"),r=d((h,p)=>{const c=pt(h.points??[]);if(c.length<2)return;const y=p?h.start:h.end,v=y?e.get(y):void 0,M=v?qt(v):void 0;if(!v||!y||!M)return;const E=p?c[0]:c[c.length-1],T=p?c[1]:c[c.length-2],m=s(v,E);let I=E;if(xn(T,m)&&(I=T),ft(m,I,Z))return{edge:h,edgeId:String(h.id??""),nodeId:y,atStart:p,orientation:"V",coord:m.x,min:Math.min(m.y,I.y),max:Math.max(m.y,I.y),boundary:m,railEnd:I,rect:M};if(ht(m,I,Z))return{edge:h,edgeId:String(h.id??""),nodeId:y,atStart:p,orientation:"H",coord:m.y,min:Math.min(m.x,I.x),max:Math.max(m.x,I.x),boundary:m,railEnd:I,rect:M}},"terminalLaneFor"),a=d((h,p)=>Math.max(0,Math.min(h.max,p.max)-Math.max(h.min,p.min)),"projectedOverlapLength"),l=d((h,p)=>h.nodeId!==p.nodeId||h.orientation!==p.orientation?!1:h.orientation==="H"?(Math.abs(h.boundary.x-h.rect.left)<1||Math.abs(h.boundary.x-h.rect.right)<1)&&ft(h.boundary,p.boundary,1):(Math.abs(h.boundary.y-h.rect.top)<1||Math.abs(h.boundary.y-h.rect.bottom)<1)&&ht(h.boundary,p.boundary,1),"sameTerminalFace"),f=d((h,p)=>h.nodeId!==p.nodeId||h.orientation!==p.orientation?!1:a(h,p)>=Ft&&Math.abs(h.coord-p.coord)<.5,"exactTerminalLaneConflict"),i=d((h,p)=>{if(h.nodeId!==p.nodeId||h.orientation!==p.orientation||h.orientation!=="H"||h.atStart===p.atStart)return!1;const c=a(h,p);if(c<Ft)return!1;const y=h.rect.bottom-h.rect.top;return c<y||c>2*y?!1:l(h,p)&&Math.abs(h.coord-p.coord)<16},"nearTerminalLaneConflict"),g=d((h,p)=>{const c=pt(h.edge.points??[]);if(c.length<2)return;const y=h.orientation==="V"?{x:h.boundary.x+p,y:h.boundary.y}:{x:h.boundary.x,y:h.boundary.y+p},v=h.orientation==="V"?{x:h.railEnd.x+p,y:h.railEnd.y}:{x:h.railEnd.x,y:h.railEnd.y+p};if(!d(()=>Math.abs(h.boundary.y-h.rect.top)<1||Math.abs(h.boundary.y-h.rect.bottom)<1?ht(y,h.boundary,Z)&&y.x>=h.rect.left+1&&y.x<=h.rect.right-1:Math.abs(h.boundary.x-h.rect.left)<1||Math.abs(h.boundary.x-h.rect.right)<1?ft(y,h.boundary,Z)&&y.y>=h.rect.top+1&&y.y<=h.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(h.atStart){const I=c.length>1&&oe(c[1],h.railEnd,Z),w=c.slice(I?2:1),R=w[0];return R&&!xn(R,v)?void 0:[y,v,...w]}const E=c.length>1&&oe(c[c.length-2],h.railEnd,Z),T=c.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!xn(m,v)))return[...T,v,y]},"shiftedCandidate"),x=d(h=>{const p=h.edge,c=pt(p.points??[]);if(c.length!==2)return!1;const y=p.start,v=p.end,M=y?e.get(y):void 0,E=v?e.get(v):void 0;if(!M||!E)return!1;const T=M.x??0,m=M.y??0,I=E.x??0,w=E.y??0,[R,k]=c;return ht(R,k,Z)&&Math.abs(m-w)<1&&Math.abs(T-I)>1||ft(R,k,Z)&&Math.abs(T-I)<1&&Math.abs(m-w)>1},"laneIsStraightCollinearConnector"),C=[-7,7,-14,14,-21,21];for(let h=0;h<8;h++){const p=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let c=!1;for(let y=0;y<p.length&&!c;y++)for(let v=y+1;v<p.length&&!c;v++){const M=p[y],E=p[v];if(M.edge===E.edge||!(f(M,E)||i(M,E)))continue;const T=!f(M,E),m=[M,E].sort((I,w)=>{const R=x(I),k=x(w);return R!==k?Number(R)-Number(k):+!w.atStart-+!I.atStart});for(const I of m){for(const w of C){const R=g(I,w);if(!R)continue;const k=r({...I.edge,points:R},I.atStart);if(!(!k||p.some(O=>O.edge!==I.edge&&(f(k,O)||T&&i(k,O))))){I.edge.points=R,c=!0;break}}if(c)break}}if(!c)return}}d(ps,"separateSharedRenderedTerminalLanes");function ms(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=d((l,f)=>{const i=l.start,g=l.end,x=it(f);if(x.length!==f.length-1)return!1;const C=[i,g].filter(h=>!!h);for(const h of x)if(wt(h.a,h.b,o,C,-2)||wt(h.a,h.b,s,[],-2))return!1;for(const h of t){if(h===l||h.isLayoutOnly)continue;const p=h.points;if(!(!p||p.length<2)){for(const c of x)for(const y of it(pt(p)))if(ce(c,y,.5)>=Ft||le(c.a,c.b,y.a,y.b,Z))return!1}}return!0},"candidateIsSafe"),a=d((l,f)=>{if(f+4>=l.length)return;const i=l[f],g=l[f+1],x=l[f+2],C=l[f+3],h=l[f+4],p=Tt(i,g)&&At(g,x)&&Tt(x,C)&&At(C,h)&&ft(i,C,Z)&&ft(i,h,Z)&&ft(g,x,Z)&&(g.x-i.x)*(C.x-x.x)<0,c=At(i,g)&&Tt(g,x)&&At(x,C)&&Tt(C,h)&&ht(i,C,Z)&&ht(i,h,Z)&&ht(g,x,Z)&&(g.y-i.y)*(C.y-x.y)<0;if(p||c)return pt([...l.slice(0,f+1),h,...l.slice(f+5)]);if(f+5>=l.length)return;const y=l[f+5],v=At(i,g)&&Tt(g,x)&&At(x,C)&&Tt(C,h)&&At(h,y)&&ft(i,h,Z)&&ft(i,y,Z)&&ft(x,C,Z)&&(x.x-g.x)*(h.x-C.x)<0,M=Tt(i,g)&&At(g,x)&&Tt(x,C)&&At(C,h)&&Tt(h,y)&&ht(i,h,Z)&&ht(i,y,Z)&&ht(x,C,Z)&&(x.y-g.y)*(h.y-C.y)<0;if(!(!v&&!M))return pt([...l.slice(0,f+1),y,...l.slice(f+6)])},"withoutDogleg");for(let l=0;l<8;l++){let f=!1;for(const i of t){if(i.isLayoutOnly)continue;const g=pt(i.points??[]);for(let x=0;x<=g.length-5;x++){const C=a(g,x);if(!(!C||!r(i,C))){i.points=C,f=!0;break}}if(f)break}if(!f)return}}d(ms,"collapseRedundantRectangularDoglegs");function Dn(t,e){const{realNodeRects:r,labelNodeRects:a}=me(e.values()),l=t.filter(p=>!p.isLayoutOnly),f=d((p,c,y)=>pt(p===c?y??[]:p.points??[]),"pointsFor"),i=d((p,c)=>{let y=0;for(let v=0;v<l.length;v++){const M=it(f(l[v],p,c));for(let E=v+1;E<l.length;E++){const T=it(f(l[E],p,c));for(const m of M)for(const I of T)le(m.a,m.b,I.a,I.b,Z)&&y++}}return y},"strictCrossingCount"),g=d(p=>{const c=it(p);if(c.length!==3)return;const y=c[1];if(!(c[0].horizontal===y.horizontal||c[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),x=d((p,c)=>{const y=[p.start,p.end].filter(v=>!!v);return r.filter(v=>{if(y.includes(v.id))return!1;const M=v.rect;return c.horizontal?zt(c.a.x,c.b.x,M.left,M.right)>=Ft&&c.a.y>=M.top-2&&c.a.y<=M.bottom+2:zt(c.a.y,c.b.y,M.top,M.bottom)>=Ft&&c.a.x>=M.left-2&&c.a.x<=M.right+2})},"blockingRectsFor"),C=d((p,c,y)=>{const v=p.map(E=>({...E}));if(c.horizontal)v[c.index].y=y,v[c.index+1].y=y;else if(c.vertical)v[c.index].x=y,v[c.index+1].x=y;else return;const M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),h=d((p,c,y)=>{const v=[p.start,p.end].filter(E=>!!E),M=it(c);if(M.length!==c.length-1)return!1;for(const E of M)if(wt(E.a,E.b,r,v,-2)||wt(E.a,E.b,a,[],-2))return!1;for(const E of l)if(E!==p){for(const T of M)for(const m of it(f(E)))if(ce(T,m,.5)>=Ft)return!1}return i(p,c)<=y},"candidateIsSafe");for(let p=0;p<8;p++){const c=i();let y=!1;for(const v of l){const M=f(v),E=g(M);if(!E)continue;const T=x(v,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(I=>I.rect.top))-20,Math.max(...T.map(I=>I.rect.bottom))+20]:[Math.min(...T.map(I=>I.rect.left))-20,Math.max(...T.map(I=>I.rect.right))+20];for(const I of m){const w=C(M,E.segment,I);if(!(!w||!h(v,w,c))){v.points=w,y=!0;break}}if(y)break}if(!y)return}}d(Dn,"liftObstacleHuggingSameSideRails");function Hn(t,e){const o=d(f=>{const i=f.groupTitleRect;if(!(!i||typeof i.left!="number"||typeof i.right!="number"||typeof i.top!="number"||typeof i.bottom!="number"||!Number.isFinite(i.left)||!Number.isFinite(i.right)||!Number.isFinite(i.top)||!Number.isFinite(i.bottom)||i.right<=i.left||i.bottom<=i.top))return{left:i.left,right:i.right,top:i.top,bottom:i.bottom}},"validTitleRect"),s=d(f=>{if(!f.isGroup||f.parentId)return;const i=f.direction,g=typeof i=="string"?i.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const x=o(f),C=f.y,h=f.height;if(!x||typeof C!="number"||typeof h!="number"||!Number.isFinite(C)||!Number.isFinite(h)||h<=0)return;const p=x.right-x.left,c=x.bottom-x.top;if(!(c<=0||p<c))return{node:f,rect:x}},"topLaneTitleFor"),r=d((f,i)=>{if(!f.horizontal)return!1;const g=f.a.y;return g<=i.top+Z||g>=i.bottom-Z?!1:zt(f.a.x,f.b.x,i.left,i.right)>=Ft},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(f=>!!f);if(a.length===0)return;let l=0;for(const f of t){if(f.isLayoutOnly)continue;const i=pt(f.points??[]);for(const g of it(i))for(const x of a)r(g,x.rect)&&(l=Math.max(l,x.rect.bottom-g.a.y+4))}if(!(l<=Z))for(const f of a){const i=f.node.y,g=f.node.height;typeof i!="number"||typeof g!="number"||!Number.isFinite(i)||!Number.isFinite(g)||g<=0||(f.node.y=i-l/2,f.node.height=g+l,f.node.groupTitleRect={...f.rect,top:f.rect.top-l,bottom:f.rect.bottom-l})}}d(Hn,"liftTopLaneTitleBandsAboveRails");function Xn(t,e){const o=d(i=>{const g=i.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(i=>{if(!i.isGroup||i.parentId||i.direction!=="LR")return;const x=o(i),C=i.x,h=i.width;if(!x||typeof C!="number"||typeof h!="number"||!Number.isFinite(C)||!Number.isFinite(h)||h<=0)return;const p=x.right-x.left,c=x.bottom-x.top;if(!(p<=0||c<p))return{node:i,rect:x}},"leftLaneTitleFor"),r=d((i,g)=>{if(!i.vertical)return!1;const x=i.a.x;return x<=g.left+Z||x>=g.right-Z?!1:zt(i.a.y,i.b.y,g.top,g.bottom)>=Ft},"verticalSegmentIntersectsTitle"),a=d((i,g)=>{if(!i.horizontal)return!1;const x=i.a.y;return x<=g.top+Z||x>=g.bottom-Z?!1:zt(i.a.x,i.b.x,g.left,g.right)>=Ft},"horizontalSegmentIntersectsTitle"),l=[...e.values()].map(s).filter(i=>!!i);if(l.length===0)return;let f=0;for(const i of t){if(i.isLayoutOnly)continue;const g=pt(i.points??[]);for(const x of it(g))for(const C of l)if(r(x,C.rect))f=Math.max(f,C.rect.right-x.a.x+4);else if(a(x,C.rect)){const h=Math.min(x.a.x,x.b.x);f=Math.max(f,C.rect.right-h+4)}}if(!(f<=Z))for(const i of l){const g=i.node.x,x=i.node.width;typeof g!="number"||typeof x!="number"||!Number.isFinite(g)||!Number.isFinite(x)||x<=0||(i.node.x=g-f/2,i.node.width=x+f,i.node.groupTitleRect={...i.rect,left:i.rect.left-f,right:i.rect.right-f})}}d(Xn,"shiftLeftLaneTitleBandsLeftOfRails");function ys(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(p=>!p.isLayoutOnly),r=d((p,c=new Map)=>pt(c.get(p)??p.points??[]),"replacementPointsFor"),a=d((p=new Map)=>{let c=0;for(let y=0;y<s.length;y++){const v=it(r(s[y],p));for(let M=y+1;M<s.length;M++){const E=it(r(s[M],p));for(const T of v)for(const m of E)le(T.a,T.b,m.a,m.b,Z)&&c++}}return c},"crossingCount"),l=d((p=new Map)=>s.reduce((c,y)=>c+Qt(r(y,p)),0),"totalBends"),f=d(p=>{const c=r(p);if(c.length<4)return;const y=c[c.length-2],v=c[c.length-1];if(!(!Tt(y,v,Z)&&!At(y,v,Z)))return{tailStart:y,terminal:v}},"terminalTailFor"),i=d((p,c)=>{const y=r(p);if(y.length<3)return;const v=y[0],M=y[1];let E;if(Tt(v,M,Z))E={x:M.x,y:c.tailStart.y};else if(At(v,M,Z))E={x:c.tailStart.x,y:M.y};else return;const T=ae(pt([v,M,E,c.tailStart,c.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),g=d((p,c)=>{const y=[p.start,p.end].filter(v=>!!v);for(const v of it(c))if(wt(v.a,v.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),x=d((p,c,y)=>{for(const v of s)if(v!==p){for(const M of it(c))for(const E of it(r(v,y)))if(ce(M,E,.5)>=Ft)return!0}return!1},"pathHasSharedTrack"),C=d((p,c,y)=>!g(p,c)&&!x(p,c,y),"candidateIsSafe"),h=d(()=>{const p=new Map;for(const c of s){const y=c.end;if(!y||!e.has(y)||r(c).length<4)continue;const M=p.get(y)??[];M.push(c),p.set(y,M)}return p},"edgesByDestination");for(let p=0;p<4;p++){const c=a();if(c===0)return;const y=l();let v,M=c,E=y;for(const T of h().values())for(let m=0;m<T.length;m++)for(let I=m+1;I<T.length;I++){const w=T[m],R=T[I],k=f(w),O=f(R);if(!k||!O)continue;const F=i(w,O),H=i(R,k);if(!F||!H)continue;const P=new Map([[w,F],[R,H]]);if(!C(w,F,P)||!C(R,H,P))continue;const G=a(P),j=l(P);G>=c||G>M||G===M&&j>=E||(v=P,M=G,E=j)}if(!v)return;for(const[T,m]of v)T.points=m}}d(ys,"swapDestinationTerminalTailsToReduceCrossings");function xs(t,e){const{realNodeRects:r,labelNodeRects:a}=me(e.values()),l=t.filter(T=>!T.isLayoutOnly),f=d((T,m=new Map)=>pt(m.get(T)??T.points??[]),"replacementPointsFor"),i=d((T=new Map)=>{let m=0;for(let I=0;I<l.length;I++){const w=it(f(l[I],T));for(let R=I+1;R<l.length;R++){const k=it(f(l[R],T));for(const O of w)for(const F of k)le(O.a,O.b,F.a,F.b,Z)&&m++}}return m},"strictCrossingCount"),g=d((T=new Map)=>l.reduce((m,I)=>m+Qt(f(I,T)),0),"totalBends"),x=d(T=>{const m=T.start,I=T.end,w=m?e.get(m):void 0,R=I?e.get(I):void 0,k=w?qt(w):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),C=d((T,m,I)=>{if(I.index<=0||I.index+1>=m.length-1)return;const w=x(T);if(w){if(I.vertical){const R=I.a.x,k=Math.min(w.src.left,w.dst.left),O=Math.max(w.src.right,w.dst.right),F=R<k-Z?"left":R>O+Z?"right":void 0;return F?{edge:T,points:m,segmentIndex:I.index,axis:"vertical",side:F,coord:R,min:Math.min(I.a.y,I.b.y),max:Math.max(I.a.y,I.b.y)}:void 0}if(I.horizontal){const R=I.a.y,k=Math.min(w.src.top,w.dst.top),O=Math.max(w.src.bottom,w.dst.bottom),F=R<k-Z?"top":R>O+Z?"bottom":void 0;return F?{edge:T,points:m,segmentIndex:I.index,axis:"horizontal",side:F,coord:R,min:Math.min(I.a.x,I.b.x),max:Math.max(I.a.x,I.b.x)}:void 0}}},"externalRailForSegment"),h=d(()=>{const T=[];for(const m of l){const I=f(m);for(const w of it(I)){const R=C(m,I,w);R&&T.push(R)}}return T},"collectExternalRails"),p=d((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&zt(T.min,T.max,m.min,m.max)>=Ft,"railsInteract"),c=d(T=>{const m=[],I=new Set;for(const w of T){if(I.has(w))continue;const R=[w],k=[];for(I.add(w);R.length>0;){const O=R.pop();k.push(O);for(const F of T)!I.has(F)&&p(O,F)&&(I.add(F),R.push(F))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=d(T=>{const m=[];for(const I of T)m.some(w=>Math.abs(w-I.coord)<Z)||m.push(I.coord);for(;m.length<T.length;){const I=Math.min(...m),w=Math.max(...m),R=T[0].side;m.push(R==="left"||R==="top"?I-12*(T.length-m.length):w+12*(T.length-m.length))}return m},"uniqueCoordsFor"),v=d(T=>{const m=T.map(R=>R.coord),I=y(T),w=[];if(T.length<=6){const R=new Array(I.length).fill(!1),k=[],O=d(()=>{if(k.length===T.length){k.some((F,H)=>Math.abs(F-m[H])>=Z)&&w.push([...k]);return}for(const[F,H]of I.entries())R[F]||(R[F]=!0,k.push(H),O(),k.pop(),R[F]=!1)},"visit");return O(),w}for(let R=0;R<m.length;R++)for(let k=R+1;k<m.length;k++){const O=[...m];[O[R],O[k]]=[O[k],O[R]],w.push(O)}return w},"coordinateAssignmentsFor"),M=d((T,m)=>{const I=new Map;for(const[R,k]of T.entries()){const O=m[R],F=I.get(k.edge)??k.points.map(H=>({x:H.x,y:H.y}));k.axis==="vertical"?(F[k.segmentIndex].x=O,F[k.segmentIndex+1].x=O):(F[k.segmentIndex].y=O,F[k.segmentIndex+1].y=O),I.set(k.edge,F)}const w=new Map;for(const[R,k]of I){const O=ae(pt(k));if(it(O).length!==O.length-1)return;w.set(R,O)}return w},"replacementsForAssignment"),E=d(T=>{for(const[m,I]of T){const w=[m.start,m.end].filter(R=>!!R);for(const R of it(I))if(wt(R.a,R.b,r,w,-2)||wt(R.a,R.b,a,[],-2))return!1}for(let m=0;m<l.length;m++){const I=l[m],w=T.has(I),R=it(f(I,T));for(let k=m+1;k<l.length;k++){const O=l[k];if(!w&&!T.has(O))continue;const F=it(f(O,T));for(const H of R)for(const P of F)if(ce(H,P,.5)>=Ft)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=i();if(m===0)return;let I,w=m,R=g(),k=Number.POSITIVE_INFINITY;for(const O of c(h()))for(const F of v(O)){const H=M(O,F);if(!H||!E(H))continue;const P=i(H);if(P>=m)continue;const G=g(H),j=O.reduce((J,dt,mt)=>J+Math.abs(F[mt]-dt.coord),0);P>w||P===w&&(G>R||G===R&&j>=k)||(I=H,w=P,R=G,k=j)}if(!I)return;for(const[O,F]of I)O.points=F}}d(xs,"reassignCrossingExternalRailChannels");function bs(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(h=>!h.isLayoutOnly),a=d((h,p,c)=>pt(h===p?c??[]:h.points??[]),"pointsFor"),l=d(h=>it(h).reduce((p,c)=>{const y=c.a.x-c.b.x,v=c.a.y-c.b.y;return p+Math.hypot(y,v)},0),"pathLength"),f=d((h,p)=>{let c=0;for(let y=0;y<r.length;y++){const v=it(a(r[y],h,p));for(let M=y+1;M<r.length;M++){const E=it(a(r[M],h,p));for(const T of v)for(const m of E)le(T.a,T.b,m.a,m.b,Z)&&c++}}return c},"strictCrossingCount"),i=d((h,p)=>{if(h.horizontal){const c=h.a.y;return(Math.abs(c-p.top)<1||Math.abs(c-p.bottom)<1)&&zt(h.a.x,h.b.x,p.left,p.right)>=Ft}if(h.vertical){const c=h.a.x;return(Math.abs(c-p.left)<1||Math.abs(c-p.right)<1)&&zt(h.a.y,h.b.y,p.top,p.bottom)>=Ft}return!1},"segmentRunsAlongRectBorder"),g=d(h=>{const p=[h.start,h.end].filter(y=>!!y),c=[];for(const y of p){const v=e.get(y),M=v?qt(v):void 0;M&&c.push(M)}return c},"endpointRectsFor"),x=d((h,p)=>{if(p+3>=h.length)return[];const c=h[p],y=h[p+1],v=h[p+2],M=h[p+3],E=Tt(c,y,Z)&&At(y,v,Z)&&Tt(v,M,Z),T=At(c,y,Z)&&Tt(y,v,Z)&&At(v,M,Z);if(!E&&!T)return[];if(!(E?Math.sign(y.x-c.x)!==Math.sign(M.x-v.x):Math.sign(y.y-c.y)!==Math.sign(M.y-v.y)))return[];const I=ft(c,M,Z)||ht(c,M,Z)?[]:[{x:c.x,y:M.y},{x:M.x,y:c.y}],w=I.length===0?[[...h.slice(0,p+1),...h.slice(p+3)]]:I.map(k=>[...h.slice(0,p+1),k,...h.slice(p+3)]),R=new Set;return w.map(k=>ae(pt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(F=>oe(F,M,Z)))return!1;const O=k.map(F=>`${F.x.toFixed(3)},${F.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),C=d((h,p,c)=>{const y=[h.start,h.end].filter(M=>!!M),v=g(h);for(const M of it(p))if(wt(M.a,M.b,o,y,-2)||wt(M.a,M.b,s,[],-2)||v.some(E=>i(M,E)))return!1;for(const M of r)if(M!==h){for(const E of it(p))for(const T of it(a(M)))if(ce(E,T,.5)>=Ft)return!1}return f(h,p)<=c},"candidateIsSafe");for(let h=0;h<8;h++){const p=f();let c,y,v=p,M=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=a(T),I=Qt(m,Z),w=l(m);for(let R=0;R<=m.length-4;R++)for(const k of x(m,R)){const O=Qt(k,Z),F=l(k);if(!(O<I||O===I&&F<w-Z)||!C(T,k,p))continue;const P=f(T,k);P>v||P===v&&(O>M||O===M&&F>=E)||(c=T,y=k,v=P,M=O,E=F)}}if(!c||!y)return;c.points=y}}d(bs,"shortcutRedundantOrthogonalJogs");function Ms(t,e){const a=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const _=N.x??0,D=N.y??0,V=qt(N);V&&a.push({id:String(N.id??""),cx:_,cy:D,rect:V})}if(a.length===0)return;const l=new Map(a.map(N=>[N.id,N])),f=a.map(N=>({id:N.id,rect:N.rect})),i=["top","bottom","left","right"],g={top:Math.min(...a.map(N=>N.rect.top))-20,bottom:Math.max(...a.map(N=>N.rect.bottom))+20,left:Math.min(...a.map(N=>N.rect.left))-20,right:Math.max(...a.map(N=>N.rect.right))+20},x=t.filter(N=>!N.isLayoutOnly),C=new Map(x.map((N,_)=>[N,_])),h=d(N=>{const _=N==="left"||N==="top"?-1:1,D=[];for(let V=0;V<=2;V++)D.push(g[N]+_*20*V);return D},"outwardTracksForSide"),p=d((N,_=new Map)=>pt(_.get(N)??N.points??[]),"replacementPointsFor"),c=d((N,_)=>{let D=0;for(const V of N)for(const u of _)le(V.a,V.b,u.a,u.b,Z)&&D++;return D},"crossingCountBetweenSegments"),y=d((N,_)=>c(it(N),it(_)),"crossingCountBetweenPaths"),v=d((N=new Map)=>{let _=0;const D=[],V=new Set,u=[],b=d(S=>{V.has(S)||(V.add(S),u.push(S))},"addEdge");for(let S=0;S<x.length;S++){const L=x[S],A=p(L,N);for(let B=S+1;B<x.length;B++){const U=x[B],q=y(A,p(U,N));q>0&&(_+=q,D.push({first:L,second:U,count:q}),b(L),b(U))}}return u.sort((S,L)=>(C.get(S)??0)-(C.get(L)??0)),{count:_,pairs:D,edgeSet:V,edges:u}},"crossingSnapshot"),M=d((N,_)=>{const D=new Set(_.keys());if(D.size===0)return N.count;let V=0;for(const b of N.pairs)(D.has(b.first)||D.has(b.second))&&(V+=b.count);let u=0;for(let b=0;b<x.length;b++){const S=x[b],L=D.has(S),A=p(S,_);for(let B=b+1;B<x.length;B++){const U=x[B];!L&&!D.has(U)||(u+=y(A,p(U,_)))}}return N.count-V+u},"crossingCountWithReplacements"),E=d(N=>{const _=new Map;for(const u of N.pairs){const b=_.get(u.first)??new Set;b.add(u.second),_.set(u.first,b);const S=_.get(u.second)??new Set;S.add(u.first),_.set(u.second,S)}const D=[],V=new Set;for(const u of N.edges){if(V.has(u))continue;const b=[u],S=[];for(V.add(u);b.length>0;){const L=b.pop();S.push(L);for(const A of _.get(L)??[])V.has(A)||(V.add(A),b.push(A))}S.sort((L,A)=>(C.get(L)??0)-(C.get(A)??0)),S.length>1&&D.push(S)}return D},"crossingComponents"),T=d(N=>[N.start,N.end].filter(_=>!!_),"endpointIdsFor"),m=d(N=>{const _=[];for(const D of E(N)){const V=new Set(D),u=new Set(D.flatMap(S=>T(S))),b=[...D];for(const S of x)V.has(S)||T(S).some(L=>u.has(L))&&b.push(S);b.sort((S,L)=>(C.get(S)??0)-(C.get(L)??0)),_.push(b)}return _},"pairSearchGroups"),I=d((N,_,D)=>M(N,new Map([[_,D]])),"crossingCountWithSingleReplacement"),w=d(N=>{const _=new Map;for(const D of N.pairs)_.set(D.first,(_.get(D.first)??0)+D.count),_.set(D.second,(_.get(D.second)??0)+D.count);return _},"currentCrossingsByEdge"),R=d(N=>N.slice(1).reduce((_,D,V)=>{const u=N[V];return _+Math.abs(D.x-u.x)+Math.abs(D.y-u.y)},0),"pathLength"),k=d((N=new Map)=>x.reduce((_,D)=>_+Qt(p(D,N)),0),"totalBends"),O=d((N=new Map)=>x.reduce((_,D)=>_+R(p(D,N)),0),"totalLength"),F=d((N,_,D=new Map)=>{const V=it(_);for(const u of x)if(u!==N){for(const b of V)for(const S of it(p(u,D)))if(ce(b,S,.5)>=Ft)return!0}return!1},"pathHasSegmentConflict"),H=d((N,_)=>{const D=[N.start,N.end].filter(V=>!!V);for(const V of it(_))if(wt(V.a,V.b,f,D,-2))return!0;return!1},"pathHitsNode"),P=d((N,_)=>{const D=ae(pt(_));it(D).length===D.length-1&&N.push(D)},"pushOrthogonalCandidate"),G=d(N=>N==="left"||N==="right","sideIsHorizontal"),j=d((N,_,D)=>{switch(_){case"left":return Math.min(N.x,D.x)-20;case"right":return Math.max(N.x,D.x)+20;case"top":return Math.min(N.y,D.y)-20;case"bottom":return Math.max(N.y,D.y)+20}},"localTrackForSameSide"),J=d((N,_,D,V)=>{const u=D==="left"||D==="top"?-1:1,b=[j(_,D,V),g[D]];for(const S of b)for(let L=0;L<=2;L++)P(N,io(_,D,V,S+u*20*L))},"addSameSideCandidates"),dt=d((N,_,D,V,u)=>{for(const b of h(D))for(const S of h(u))P(N,[_,{x:b,y:_.y},{x:b,y:S},{x:V.x,y:S},V])},"addHorizontalToVerticalCandidates"),mt=d((N,_,D,V,u)=>{for(const b of h(D))for(const S of h(u))P(N,[_,{x:_.x,y:b},{x:S,y:b},{x:S,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=d((N,_,D,V,u)=>{const b=[...h("top"),...h("bottom")];for(const S of h(D))for(const L of h(u))for(const A of b)P(N,[_,{x:S,y:_.y},{x:S,y:A},{x:L,y:A},{x:L,y:V.y},V])},"addHorizontalPairCandidates"),Pt=d((N,_,D,V,u)=>{const b=[...h("left"),...h("right")];for(const S of h(D))for(const L of h(u))for(const A of b)P(N,[_,{x:_.x,y:S},{x:A,y:S},{x:A,y:L},{x:V.x,y:L},V])},"addVerticalPairCandidates"),Q=d(N=>{const _=new Set;return N.map(D=>pt(D)).filter(D=>{const V=D.map(u=>`${u.x.toFixed(3)},${u.y.toFixed(3)}`).join("|");return _.has(V)||D.length<2?!1:(_.add(V),!0)})},"dedupeCandidatePaths"),W=d((N,_,D,V)=>{const u=[],b=ro(N,_,D,V,20,Z);b&&P(u,b),_===V&&J(u,N,_,D);const S=G(_),L=G(V);return S&&!L?dt(u,N,_,D,V):!S&&L?mt(u,N,_,D,V):S?kt(u,N,_,D,V):Pt(u,N,_,D,V),Q(u)},"buildCandidatesForSides"),et=d((N,_,D,V)=>{const u=[...h("left"),...h("right")],b=[...h("top"),...h("bottom")];for(const S of i){const L=Ie(V,S),A=S==="top"||S==="bottom"?h(S):b;for(const B of u){P(N,[_,D,{x:B,y:D.y},{x:B,y:L.y},L]);for(const U of A)P(N,[_,D,{x:B,y:D.y},{x:B,y:U},{x:L.x,y:U},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=d((N,_,D,V)=>{const u=[...h("left"),...h("right")],b=[...h("top"),...h("bottom")];for(const S of i){const L=Ie(V,S),A=S==="left"||S==="right"?h(S):u;for(const B of b){P(N,[_,D,{x:D.x,y:B},{x:L.x,y:B},L]);for(const U of A)P(N,[_,D,{x:D.x,y:B},{x:U,y:B},{x:U,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=d(N=>{const _=N.start,D=N.end,V=D?l.get(D):void 0;if(!_||!V)return[];const u=pt(N.points??[]);if(u.length<4)return[];const b=u[0],S=u[1],L=[];return At(b,S,Z)?et(L,b,S,V):Tt(b,S,Z)&&at(L,b,S,V),L},"terminalPreservingOuterTrackCandidates"),xt=d(N=>{const _=N.start,D=N.end,V=_?l.get(_):void 0,u=D?l.get(D):void 0;if(!V||!u)return[];const b=[];for(const S of i){const L=Ie(V,S);for(const A of i)b.push(...W(L,S,Ie(u,A),A))}return b.push(...gt(N)),b},"candidatePathsFor"),vt=d(()=>new Map(x.map(N=>[N,it(p(N))])),"currentSegmentsByEdge"),Vt=d((N,_,D)=>{const V=new Set;for(const u of x){if(u===N)continue;const b=D.get(u)??it(p(u));_.some(S=>b.some(L=>ce(S,L,.5)>=Ft))&&V.add(u)}return V},"sharedTrackConflictsFor"),jt=d((N,_,D,V)=>{const u=new Set;return xt(N).map(S=>ae(pt(S))).filter(S=>{if(H(N,S))return!1;const L=S.map(A=>`${A.x.toFixed(3)},${A.y.toFixed(3)}`).join("|");return u.has(L)||S.length<2?!1:(u.add(L),!0)}).map(S=>{const L=it(S);let A=0;for(const B of x)B!==N&&(A+=c(L,D.get(B)??it(p(B))));return{candidate:S,candidateSegments:L,crossings:_.count-(V.get(N)??0)+A,bends:Qt(S,Z),totalBends:Qt(S),length:R(S)}}).filter(({crossings:S})=>S<=_.count).sort((S,L)=>S.crossings-L.crossings||S.bends-L.bends||S.length-L.length).slice(0,48).map(S=>({path:S.candidate,segments:S.candidateSegments,sharedTrackConflicts:Vt(N,S.candidateSegments,D),totalBends:S.totalBends,length:S.length}))},"pairCandidatesFor"),Ut=d((N,_,D,V,u,b)=>{let S=0;for(const A of N.pairs)(A.first===_||A.second===_||A.first===V||A.second===V)&&(S+=A.count);let L=c(D.segments,u.segments);for(const A of x){if(A===_||A===V)continue;const B=b.get(A)??it(p(A));L+=c(D.segments,B)+c(u.segments,B)}return N.count-S+L},"pairCrossingCount"),te=d((N,_)=>{for(const D of N.sharedTrackConflicts)if(D!==_)return!1;return!0},"conflictsOnlyWith"),Se=d((N,_)=>N.segments.some(D=>_.segments.some(V=>ce(D,V,.5)>=Ft)),"candidatesShareTrack"),de=d((N,_,D,V)=>te(_,D.edge)&&te(V,N.edge)&&!Se(_,V),"pairCandidatesAreCompatible"),Ce=d((N,_,D,V,u)=>{const b=Ut(N.current,_.edge,D,V.edge,u,N.baseSegments);if(!(b>=N.current.count))return{replacements:new Map([[_.edge,D.path],[V.edge,u.path]]),crossings:b,bends:N.currentBends-(N.baseBendsByEdge.get(_.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+D.totalBends+u.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(_.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+D.length+u.length}},"scorePairReplacement"),an=d((N,_)=>N.crossings<_.crossings||N.crossings===_.crossings&&(N.bends<_.bends||N.bends===_.bends&&N.length<_.length),"pairScoreIsBetter"),ln=d((N,_,D,V)=>{let u=V;for(const b of _.candidates)for(const S of D.candidates){if(!de(_,b,D,S))continue;const L=Ce(N,_,b,D,S);L&&an(L,u)&&(u=L)}return u},"bestScoreForOptionPair"),fn=d(N=>{const _=k(),D=O(),V=vt(),u=w(N),b=new Map(x.map(q=>[q,Qt(p(q))])),S=new Map(x.map(q=>[q,R(p(q))])),L=new Map,A=m(N);for(const q of A)for(const z of q){if(L.has(z))continue;const Y=jt(z,N,V,u);Y.length>0&&L.set(z,{edge:z,candidates:Y})}let B={replacements:new Map,crossings:N.count,bends:_,length:D};const U={current:N,currentBends:_,currentLength:D,baseBendsByEdge:b,baseLengthByEdge:S,baseSegments:V};for(const q of A){const z=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>L.get(ot)).filter(ot=>!!ot);for(let ot=0;ot<Y.length;ot++){const rt=Y[ot];for(let st=ot+1;st<Y.length;st++){const tt=Y[st];!z.has(rt.edge)&&!z.has(tt.edge)||(B=ln(U,rt,tt,B))}}}return B.replacements.size>0?B.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const _=v(),D=_.count;if(D===0)return;let V,u,b=D,S=Number.POSITIVE_INFINITY;for(const A of _.edges){const B=Qt(p(A),Z);for(const U of xt(A)){const q=H(A,U),z=!q&&F(A,U),Y=I(_,A,U),ot=Qt(U,Z);q||z||!(Y<D||Y===D&&ot<B)||Y>b||Y===b&&ot>=S||(V=A,u=U,b=Y,S=ot)}}if(V&&u){V.points=u;continue}const L=fn(_);if(!L)return;for(const[A,B]of L)A.points=B}}d(Ms,"resolveRenderedOrthogonalCrossings");var pe=.001,Rr=8;function Is(t,e){const{nodeInfoById:n,realNodeRects:o}=sn(e),s=["top","bottom","left","right"],r=20,a={top:Math.min(...o.map(c=>c.rect.top))-r,bottom:Math.max(...o.map(c=>c.rect.bottom))+r,left:Math.min(...o.map(c=>c.rect.left))-r,right:Math.max(...o.map(c=>c.rect.right))+r},l=d((c,y,v,M)=>{const E=[],T=ro(c,y,v,M,r,pe);return T&&E.push(T),y===M&&E.push(io(c,y,v,a[y])),E},"buildOrthogonalPathCandidates"),f=d((c,y)=>{for(let v=0;v<c.length-1;v++){const M=c[v],E=c[v+1];if(wt(M,E,o,y,1))return!0}return!1},"pathHitsNode"),i=d((c,y,v=!1)=>{let M=0;const E=Re(c,pe),T=y.start,m=y.end;for(const I of t){if(I===y||I.isLayoutOnly)continue;const w=I.start,R=I.end;if(!v&&T&&m&&(w===T||w===m||R===T||R===m))continue;const k=I.points;if(!(!k||k.length<2))for(const O of E)for(const F of Re(k,pe)){if(ao(O.a,O.b,F.a,F.b,pe,pe)){M++;continue}ce(O,F,pe)>=Rr&&M++}}return M},"pathConflictCount"),g=4,x=d((c,y)=>{const v=Math.abs(c.y-y.rect.top),M=Math.abs(c.y-y.rect.bottom),E=Math.abs(c.x-y.rect.left),T=Math.abs(c.x-y.rect.right);let m="top",I=v;return M<I&&(m="bottom",I=M),E<I&&(m="left",I=E),T<I&&(m="right",I=T),m},"nearestSideOfRect"),C=new Map,h=d((c,y,v)=>{const M=C.get(c)??[];M.push({side:y,edgeId:v}),C.set(c,M)},"addFaceClaim");for(const c of t){if(c.isLayoutOnly)continue;const y=c.points??[];if(y.length<1)continue;const v=c.id??"",M=c.start,E=c.end;if(M){const T=n.get(M);T&&h(M,x(y[0],T),v)}if(E){const T=n.get(E);T&&h(E,x(y[y.length-1],T),v)}}const p=d((c,y,v)=>C.get(c)?.some(M=>M.edgeId!==v&&M.side===y)??!1,"faceIsClaimed");for(const c of t){if(c.isLayoutOnly)continue;const y=c.points;if(!y||y.length<2)continue;const v=Qt(y,pe);if(v<g)continue;const M=c.start,E=c.end;if(!M||!E)continue;const T=n.get(M),m=n.get(E);if(!T||!m)continue;const I=c.id??"",w=i(y,c,!0),R=i(y,c);let k,O=w,F=v;for(const H of s){if(p(M,H,I))continue;const P=Ie(T,H);for(const G of s){if(p(E,G,I))continue;const j=Ie(m,G);for(const J of l(P,H,j,G)){if(f(J,[M,E]))continue;const dt=Qt(J,pe);if(w>0){const mt=i(J,c,!0);if(mt>O||mt===O&&dt>=F)continue;O=mt,F=dt,k=J;continue}i(J,c)>R||dt<F&&(F=dt,k=J)}}}if(k){c.points=k;const H=C.get(M);H&&C.set(M,H.filter(G=>G.edgeId!==I));const P=C.get(E);P&&C.set(E,P.filter(G=>G.edgeId!==I)),h(M,x(k[0],T),I),h(E,x(k[k.length-1],m),I)}}}d(Is,"simplifyDetouredEdges");var Kt=.001,No=10,$e=7;function Yn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const a=r.x-s.x,l=r.y-s.y;if(!(Math.abs(a)+Math.abs(l)<Kt)){if(Math.abs(l)<=Kt){const i=s.x+Math.sign(a)*No;return{left:Math.min(s.x,i),right:Math.max(s.x,i),top:s.y-$e,bottom:s.y+$e}}if(Math.abs(a)<=Kt){const i=s.y+Math.sign(l)*No;return{left:s.x-$e,right:s.x+$e,top:Math.min(s.y,i),bottom:Math.max(s.y,i)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}d(Yn,"markerClearanceRectFor");function Ss(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}d(Ss,"normalizeRect");function Gn(t,e){const n=pt(e),o=Yn(n,!0),s=Yn(n,!1);return[o,s].some(r=>r&&We(t,Ss(r)))}d(Gn,"labelOverlapsOwnMarker");function Ve(t,e){const n=[];for(const p of t){if(p.isLayoutOnly)continue;const c=p.points;if(!(!c||c.length<2))for(let y=0;y<c.length-1;y++)n.push({edgeId:p.id,p1:c[y],p2:c[y+1]})}const o=[],s=[];for(const p of e.values()){const c=p.isGroup,y=p.parentId;if(c&&!y){const M=qt(p);M&&s.push({id:p.id,rect:M});continue}if(c||p.isEdgeLabel)continue;const v=qt(p);v&&o.push({nodeId:p.id,rect:v})}const r=3,a=1,l=12,f=d((p,c)=>{const y=Ln(c,r);for(const{nodeId:v,rect:M}of o)if(v!==p&&We(y,M))return!0;return!1},"labelOverlapsForeignNode"),i=d((p,c)=>{const y=Ln(c,r);for(const v of n)if(v.edgeId!==p&&on(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),g=d((p,c,y)=>f(p,y)||i(c,y),"labelOverlapsAnything"),x=[],C=d(p=>{for(const{id:c,rect:y}of s)if(qo(y,p))return c},"findContainingLane"),h=d((p,c)=>x.some(y=>y.labelId!==p&&We(c,y.rect)),"overlapsPlacedLabel");for(const p of t){if(p.isLayoutOnly)continue;const c=p.labelNodeId;if(!c)continue;const y=e.get(c);if(!y)continue;const v=p.points;if(!v||v.length<2)continue;const M=y.width??0,E=y.height??0;if(M<=0||E<=0)continue;const T=[];for(let Q=0;Q<v.length-1;Q++){const W=v[Q],et=v[Q+1],at=Math.abs(W.x-et.x),gt=Math.abs(W.y-et.y);at<Kt&><Kt||at>=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx<T.length-1):T,I=m.length>0?m:T,w=M>=E?"horizontal":"vertical",R=d(Q=>[...Q].sort((W,et)=>{const at=W.orientation===w,gt=et.orientation===w;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?M:E)+2,vt=et.length>=(et.orientation==="horizontal"?M:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],F=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((Q,W)=>{const et=v[Q.idx],at=v[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),P=d((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=d((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=d(Q=>{const W=we(Q.midX,Q.midY,M,E),et=C(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+M/2+a,xt=at.rect.right-M/2-a,vt=at.rect.top+E/2+a,Vt=at.rect.bottom-E/2-a;if(gt>xt||vt>Vt)return;const jt={midX:P(Q.midX,gt,xt),midY:P(Q.midY,vt,Vt)},Ut=we(jt.midX,jt.midY,M,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),J=d((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=d((Q,W)=>{const at=(Q.orientation==="horizontal"?M/2:E/2)+l;if(Q===k){const gt=v[Q.idx];if(J(Q,W,gt)+Kt<at)return!1}if(Q===O){const gt=v[Q.idx+1];if(J(Q,W,gt)+Kt<at)return!1}return!0},"labelClearsTerminalEndpoints"),mt=d(Q=>{const W=R(Q);for(const et of W)for(const at of F){const gt=H(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!Gn(xt.rect,v)&&!h(c,xt.rect)&&!g(c,p.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=d((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!Gn(vt.rect,v)&&!h(c,vt.rect)&&!f(c,vt.rect)&&(et||!i(p.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(I)??(I.length<T.length?mt(T):void 0)??kt(T,!0)??kt(T,!1)??kt(T,!1,!0);if(Pt){y.x=Pt.anchor.midX,y.y=Pt.anchor.midY,y.parentId=Pt.laneId;const Q=we(Pt.anchor.midX,Pt.anchor.midY,M,E),W=x.findIndex(et=>et.labelId===c);W>=0?x[W]={labelId:c,rect:Q}:x.push({labelId:c,rect:Q})}}}d(Ve,"anchorLabelsToPolyline");var bn=1e-6,Nr=8,Oo=Nr/2,Or=3;function $n(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}d($n,"pairKey");function Cs(t,e){const{nodeInfoById:n,realNodeRects:o}=sn(e),s=new Map;for(const a of e){const l=a.id;if(!a.isGroup&&a.isEdgeLabel){s.set(l,{w:a.width??0,h:a.height??0});continue}}const r=d((a,l,f,i)=>{const g=$n(l,f);let x=0;const C=d(h=>{if(!h)return;const p=s.get(h);if(!p)return;const c=i==="x"?p.w/2:p.h/2;c>x&&(x=c)},"consider");C(a.labelNodeId);for(const h of t){if(h===a||h.isLayoutOnly)continue;const p=h.start,c=h.end;!p||!c||$n(p,c)===g&&C(h.labelNodeId)}return x>0?x+Or:0},"labelClearanceFor");for(const a of t){if(a.isLayoutOnly)continue;const l=a.points;if(!oo(l,bn))continue;const f=co(a,n,bn);if(!f)continue;const{srcId:i,dstId:g,srcInfo:x,dstInfo:C,collinearX:h,collinearY:p}=f;if(h===p)continue;let c,y;if(h){const m=C.cy>x.cy;c={x:x.cx,y:m?x.rect.bottom:x.rect.top},y={x:C.cx,y:m?C.rect.top:C.rect.bottom}}else{const m=C.cx>x.cx;c={x:m?x.rect.right:x.rect.left,y:x.cy},y={x:m?C.rect.left:C.rect.right,y:C.cy}}if(wt(c,y,o,[i,g],1))continue;const M=r(a,i,g,h?"x":"y"),E=M>Oo?M:Oo,T=[0,E,-E];for(const m of T){const I={...c},w={...y};if(h){if(I.x+=m,w.x+=m,I.x<=x.rect.left||I.x>=x.rect.right||w.x<=C.rect.left||w.x>=C.rect.right)continue}else if(I.y+=m,w.y+=m,I.y<=x.rect.top||I.y>=x.rect.bottom||w.y<=C.rect.top||w.y>=C.rect.bottom)continue;if(!wt(I,w,o,[i,g],1)&&!Ke(I,w,t,a,{epsilon:bn})){a.points=[I,w];break}}}}d(Cs,"straightenCollinearSiblingDetours");function zn(t,e){const{realNodeRects:f,labelNodeRects:i}=me(e.values()),g=d((m,I)=>Re(I,.001).map(w=>({...w,edge:m,interior:w.index>=1&&w.index<=I.length-3})),"segmentsFor"),x=d(()=>{const m=[];for(const I of t){if(I.isLayoutOnly)continue;const w=I.points;!w||w.length<2||m.push(...g(I,pt(w)))}return m},"allSegments"),C=d((m,I)=>m.horizontal&&I.horizontal?zt(m.a.x,m.b.x,I.a.x,I.b.x)>=8&&Math.abs(m.a.y-I.a.y)<7:m.vertical&&I.vertical?zt(m.a.y,m.b.y,I.a.y,I.b.y)>=8&&Math.abs(m.a.x-I.a.x)<7:!1,"hasCrowdedParallelTrack"),h=d((m,I)=>{const w=m.start,R=m.end,k=g(m,I);if(k.length!==I.length-1)return!1;const O=[w,R].filter(H=>!!H),F=m.labelNodeId?[m.labelNodeId]:[];for(const H of k)if(wt(H.a,H.b,f,O,-2)||wt(H.a,H.b,i,F,-2))return!1;for(const H of t){if(H===m||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of k)for(const j of g(H,pt(P)))if(C(G,j)||le(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),p=d((m,I)=>{const w=pt(m.edge.points??[]);if(w.length<4||m.index>=w.length-1)return;const R=w.map(k=>({...k}));if(m.horizontal)R[m.index].y+=I,R[m.index+1].y+=I;else if(m.vertical)R[m.index].x+=I,R[m.index+1].x+=I;else return;return g(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),c=d((m,I)=>({x:m.x??(I.left+I.right)/2,y:m.y??(I.top+I.bottom)/2}),"nodeCenter"),y=d(m=>{const I=m.edge,w=pt(I.points??[]);if(w.length!==4||m.index!==1)return;const R=I.start?e.get(I.start):void 0,k=I.end?e.get(I.end):void 0,O=R?qt(R):void 0,F=k?qt(k):void 0,H=w.slice(m.index+2);if(!(!R||!k||!O||!F||H.length===0))return{sourceCenter:c(R,O),targetCenter:c(k,F),sourceRect:O,tail:H}},"sourceDetourContextFor"),v=d((m,I,w,R,k,O)=>{const F=R.y>=w.y,H=F?k.bottom:k.top,P=H+(F?20:-20);if(F&&m.b.y<=P+.001||!F&&m.b.y>=P-.001)return;const G=m.a.x+I;return pt([{x:w.x,y:H},{x:w.x,y:P},{x:G,y:P},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),M=d((m,I,w,R,k,O)=>{const F=R.x>=w.x,H=F?k.right:k.left,P=H+(F?20:-20);if(F&&m.b.x<=P+.001||!F&&m.b.x>=P-.001)return;const G=m.a.y+I;return pt([{x:H,y:w.y},{x:P,y:w.y},{x:P,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=d((m,I)=>{const w=y(m);if(w){if(m.vertical)return v(m,I,w.sourceCenter,w.targetCenter,w.sourceRect,w.tail);if(m.horizontal)return M(m,I,w.sourceCenter,w.targetCenter,w.sourceRect,w.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const I=x();let w=!1;for(let R=0;R<I.length&&!w;R++)for(let k=R+1;k<I.length&&!w;k++){const O=I[R],F=I[k];if(O.edge===F.edge||!C(O,F))continue;const H=[O,F].filter(P=>P.interior);for(const P of H){for(const G of T){const j=p(P,G);if(j&&h(P.edge,j)){P.edge.points=j,w=!0;break}const J=E(P,G);if(J&&h(P.edge,J)){P.edge.points=J,w=!0;break}}if(w)break}}if(!w)return}}d(zn,"nudgeSharedInteriorSubpaths");function vs(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,a=o.x-n.x,l=o.y-n.y,f=s*l-r*a;if(Math.abs(f)<1e-10)return!1;const i=n.x-t.x,g=n.y-t.y,x=(i*l-g*a)/f,C=(i*r-g*s)/f,h=.01;return x>h&&x<1-h&&C>h&&C<1-h}d(vs,"segmentsIntersect");function Ls(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=Jo(e),r=[];for(const l of n){if(l.isLayoutOnly)continue;const f=l.points;if(!f||f.length<2)continue;const i=l.start,g=l.end,x=l.labelNodeId,C=l.id??`${i}->${g}`;for(const h of s)if(!(h.nodeId===i||h.nodeId===g)&&!(x&&h.nodeId===x)){for(let p=0;p<f.length-1;p++)if(on(f[p],f[p+1],h,-1)){o.push({type:"edge-node-overlap",edgeId:C,targetId:h.nodeId,detail:`segment ${p} passes through node "${h.nodeId}"`});break}}for(let h=0;h<f.length-1;h++)r.push({edgeId:C,start:i,end:g,p1:f[h],p2:f[h+1]})}const a=new Set;for(let l=0;l<r.length;l++)for(let f=l+1;f<r.length;f++){const i=r[l],g=r[f];if(i.edgeId!==g.edgeId&&!(i.start===g.start||i.start===g.end||i.end===g.start||i.end===g.end)&&vs(i.p1,i.p2,g.p1,g.p2)){const x=i.edgeId<g.edgeId?`${i.edgeId}|${g.edgeId}`:`${g.edgeId}|${i.edgeId}`;a.has(x)||(a.add(x),o.push({type:"edge-edge-crossing",edgeId:i.edgeId,targetId:g.edgeId,detail:`edges "${i.edgeId}" and "${g.edgeId}" cross`}))}}if(o.length>0){const l=o.filter(i=>i.type==="edge-node-overlap").length,f=o.filter(i=>i.type==="edge-edge-crossing").length;In.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${l} edge-node overlap(s), ${f} edge crossing(s)`);for(const i of o)In.warn(`[SWIMLANE_VALIDATE] ${i.type}: ${i.detail}`)}return o}d(Ls,"validateSwimlanesLayout");function Es(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!us(t,e)||e==="BT"&&s.length>0&&!ds(t))return;for(const l of o){if(l.isLayoutOnly)continue;const f=l.points;!f||f.length<2||(l.points=ae(qe(f)))}Is(o,n),Cs(o,n),hs(o,n);const r=new Map;for(const l of n)r.set(String(l.id),l);Ve(o,r),ns(o,r),gs(o,r),zn(o,r),ps(o,r),ms(o,r),Dn(o,r),ys(o,r);const a=d(()=>{Ms(o,r),xs(o,r),bs(o,r),Ve(o,r),Fn(o,r),Dn(o,r),Ve(o,r),Fn(o,r)},"finalizeRenderedEdges");a(),zn(o,r),a(),Hn(o,r),Xn(o,r),Hn(o,r),Xn(o,r)}d(Es,"postProcessSwimlaneLayout");function ye(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const a=`${r.id}:${r.src}->${r.dst}`;n.has(a)||(n.add(a),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(ye,"normalizeGraph");function go(t,e){return t.edges.filter(n=>n.dst===e)}d(go,"incoming");function Ts(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ts,"buildSuccessorMap");function po(t){const e=Ts(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(po,"buildSortedSuccessorMap");function mo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(mo,"buildInDegreeMap");function yo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(yo,"sortedZeroInDegreeNodes");function rn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(rn,"buildPredecessorSuccessorMaps");function xo(t,e,n,o){let s=0;for(const a of t.nodes)o?.skipGroups&&t.nodeById.get(a)?.isGroup||(s=Math.max(s,n[a]??0));const r=Array.from({length:s+1},()=>[]);for(const a of e)o?.skipGroups&&t.nodeById.get(a)?.isGroup||r[Math.max(0,n[a]??0)].push(a);return r}d(xo,"buildLayersFromRanks");function Pe(t){const e=mo(t),n=yo(e),o=[],s=po(t);for(;n.length;){const r=n.shift();o.push(r);for(const a of s.get(r)??[])if(e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0){let l=0;for(;l<n.length&&n[l]<a;)l++;n.splice(l,0,a)}}return o.length===t.nodes.length?o:null}d(Pe,"topoSortIfAcyclic");function Ne(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}d(Ne,"buildLayerIndex");function bo(t){const e=new Array(t.length),n=d((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let a=n(o,r)+n(r,s),l=o,f=r,i=o;for(;l<r||f<s;)f>=s||l<r&&t[l]<=t[f]?e[i++]=t[l++]:(e[i++]=t[f++],a+=r-l);for(let g=o;g<s;g++)t[g]=e[g];return a},"count");return n(0,t.length)}d(bo,"countInversions");function As(t){const e=ye(t),n=new Map;for(const g of e.nodes)n.set(g,[]);for(const g of e.edges)n.get(g.src).push(g);for(const g of n.values())g.sort((x,C)=>x.dst===C.dst?x.id.localeCompare(C.id):x.dst.localeCompare(C.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const x of n.get(g)??[]){const C=x.dst;o[C]===0?r(C):o[C]===1&&s.push(x)}o[g]=2},"dfs"),a=[...e.nodes].sort((g,x)=>g.localeCompare(x));for(const g of a)o[g]===0&&r(g);const l=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),f=e.edges.map(g=>l.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:f,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(As,"removeCycles_DFS");function ws(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const l=n(r)??r;return e.set(o,l),l},"resolve");for(const o of t.nodes)n(o);return e}d(ws,"buildTopLaneMap");function fe(t){const e=ws(t);return n=>e.get(n)??null}d(fe,"createTopLaneResolver");function cn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(cn,"buildTopLaneOrder");function Mo(t,e){const n=cn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const a of e)!o.has(a)||s.has(a)||(s.add(a),r.push(a));for(const a of n)s.has(a)||r.push(a);return r}d(Mo,"resolveTopLaneOrder");var Pr={EPSILON:1e-6},en={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Po={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Rs(t,e){const n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=rn(n);for(const m of r.values())m.sort((I,w)=>I.localeCompare(w));const a=Pe(n)??[...n.nodes].sort((m,I)=>m.localeCompare(I)),l=new Map;for(const[m,I]of a.entries())l.set(I,m);const f=new Map,i=new Map;for(const m of n.nodes)i.set(m,[]);for(const m of a){const I=(r.get(m)??[]).filter(w=>f.has(w));if(I.length>0){const w=Ns(m,I,{laneOf:o,rankHint:s,topoIndex:l});f.set(m,w),i.get(w).push(m)}else f.has(m)||f.set(m,null)}for(const m of n.nodes)f.has(m)||f.set(m,null);const g=new Set;for(const m of n.nodes)(f.get(m)??null)===null&&g.add(m);const x=[...g].sort((m,I)=>{const w=l.get(m)??0,R=l.get(I)??0;return w===R?m.localeCompare(I):w-R}),C=Os(n),h=new Map;for(const[m,I]of C.entries())h.set(m,[...I].sort((w,R)=>w.localeCompare(R)));const p=Ps(h),c=Bs(h),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of c)for(const I of m.nodes){const w=y.get(I);w?w.push(m.id):y.set(I,[m.id])}const v=[],M=[],E=new Set,T=d(m=>{if(!E.has(m)){E.add(m),v.push(m);for(const I of i.get(m)??[])T(I);M.push(m)}},"walk");for(const m of x)T(m);for(const m of a)T(m);return{parent:f,children:i,roots:x,componentOf:p,blocks:c,nodeBlocks:y,adjacency:h,preorder:v,postorder:M,topologicalOrder:a}}d(Rs,"buildDrivingTree");function Ns(t,e,n){const o=n.laneOf(t);return[...e].sort((r,a)=>{const l=n.laneOf(r),f=n.laneOf(a),i=l!=null&&l===o,g=f!=null&&f===o;if(i!==g)return i?-1:1;const x=n.rankHint?.[r],C=n.rankHint?.[a];if(x!=null&&C!=null&&x!==C)return C-x;const h=n.topoIndex.get(r)??0,p=n.topoIndex.get(a)??0;return h!==p?h-p:r.localeCompare(a)})[0]}d(Ns,"chooseParent");function Os(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(Os,"buildAdjacency");function Ps(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const a of t.get(r)??[])e.has(a)||s.push(a)}}n++}return e}d(Ps,"assignComponents");function Bs(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const a=d((l,f)=>{e.set(l,++r),n.set(l,r);for(const i of t.get(l)??[])i!==f&&(e.has(i)?(e.get(i)??0)<(e.get(l)??0)&&(o.push([l,i]),n.set(l,Math.min(n.get(l)??r,e.get(i)??r))):(o.push([l,i]),a(i,l),n.set(l,Math.min(n.get(l)??r,n.get(i)??r)),(n.get(i)??0)>=(e.get(l)??0)&&s.push(ks(l,i,o,s.length))))},"visit");for(const l of t.keys())e.has(l)||a(l,null);return s}d(Bs,"computeBlocks");function ks(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const a=n.pop();if(s.push(a),r.add(a[0]),r.add(a[1]),a[0]===t&&a[1]===e||a[0]===e&&a[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(ks,"popBlock");function Fs(t,e,n){const o=[...t.nodes],s=new Map;for(const[M,E]of o.entries())s.set(E,M);const r=o.length,a=new Array(r).fill(-1),l=new Array(r).fill(0),f=[],i=new Set;for(const M of o){const E=n.parent.get(M)??null,T=s.get(M);T!=null&&E==null&&(a[T]=-1,l[T]=0,i.has(M)||(i.add(M),f.push(M)))}for(;f.length>0;){const M=f.shift(),E=s.get(M);if(E==null)continue;const T=n.children.get(M)??[];for(const m of T){if(i.has(m))continue;const I=s.get(m);I!=null&&(a[I]=E,l[I]=l[E]+1,i.add(m),f.push(m))}}for(const M of o){if(i.has(M))continue;const E=s.get(M);E!=null&&(a[E]=-1,l[E]=0,i.add(M))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),x=Array.from({length:g},()=>new Array(r).fill(-1));for(let M=0;M<r;M++)x[0][M]=a[M];for(let M=1;M<g;M++)for(let E=0;E<r;E++){const T=x[M-1][E];x[M][E]=T===-1?-1:x[M-1][T]}const C=d((M,E)=>{if(M===-1||E===-1)return-1;l[M]<l[E]&&([M,E]=[E,M]);const T=l[M]-l[E];for(let m=0;m<g;m++)if(T>>m&1&&(M=x[m][M],M===-1))return-1;if(M===E)return M;for(let m=g-1;m>=0;m--){const I=x[m][M],w=x[m][E];I===-1||w===-1||I!==w&&(M=I,E=w)}return x[0][M]},"lcaIndex"),h=Array.from({length:r},()=>new Map);for(const M of t.edges){let E=M.src,T=M.dst,m=e[E],I=e[T];if(m==null||I==null||(m>I&&([E,T]=[T,E],[m,I]=[I,m]),m==null||I==null||m===I))continue;const w=s.get(E),R=s.get(T);if(w==null||R==null)continue;const k=C(w,R);if(k===-1)continue;const O=h[k];for(let F=m;F<I;F++)O.set(F,(O.get(F)??0)+1)}const p=new Map,c=d((M,E)=>{if(E.size!==0)for(const[T,m]of E)M.set(T,(M.get(T)??0)+m)},"mergeInto"),y=new Set,v=d(M=>{const E=s.get(M);y.add(M);const T=E==null?void 0:h[E],m=T?new Map(T):new Map,I=n.children.get(M)??[];for(const w of I){const R=v(w),k=e[M];if(k!=null){let O=p.get(M);O||(O=new Map,p.set(M,O));let F=R.get(k)??0;const H=e[w];H!=null&&H>k&&(F+=1),O.set(w,F)}c(m,R)}return m},"dfs");for(const M of n.roots)y.has(M)||v(M);for(const M of o)y.has(M)||v(M);return p}d(Fs,"computeSubtreeCrossCounts");function _s(t,e,n){const o=new Map,s=d(r=>{let a=n[r]??0;const l=[...e.get(r)??[]];l.sort(Io(n));for(const f of l){s(f);const i=o.get(f);i!=null&&(a=Math.min(a,i))}o.set(r,a)},"annotate");for(const r of t)s(r);return o}d(_s,"annotateMinimumLayers");function Io(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Io,"compareByRankThenId");function Ds(t,e,n,o){let s=0;for(const f of e){const i=n[f]??0;i>s&&(s=i)}const r=Array.from({length:s+1},()=>[]),a=new Set,l=d(f=>{if(a.has(f))return;a.add(f);const i=n[f]??0;r[i]||(r[i]=[]),r[i].push(f);for(const g of o(f))l(g)},"emit");for(const f of t)l(f);for(const f of e)if(!a.has(f)){const i=n[f]??0;r[i]||(r[i]=[]),r[i].push(f),a.add(f)}return r}d(Ds,"emitNodesInTreeOrder");function Hs(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d(Hs,"deduplicateLayers");function Xs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const a=e[s]??0,l=[],f=[],i=n.get(s);for(const g of r){const x=o.get(g)??a;x>a?l.push({child:g,min:x}):f.push(g)}return l.sort((g,x)=>g.min===x.min?g.child.localeCompare(x.child):g.min-x.min),f.sort((g,x)=>{const C=i?.get(g)??0,h=i?.get(x)??0;if(C!==h)return C-h;const p=o.get(g)??a,c=o.get(x)??a;return p!==c?p-c:g.localeCompare(x)}),[...l.map(g=>g.child),...f]}}d(Xs,"createChildOrderer");function nn(t,e,n){const o=Rs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const x of t.nodes)s.has(x)||s.set(x,[]);const a=Fs(t,e,o),l=[...r].sort(Io(e)),f=_s(l,s,e),i=Xs(s,e,a,f);let g=Ds(l,t.nodes,e,i);return g=Hs(g),g}d(nn,"buildMultitreeLayerOrder");function Ys(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(e),a=[];for(const l of n)o.has(l.src)&&s.has(l.dst)&&a.push(r.get(l.dst));return bo(a)}d(Ys,"countCrossingsBetweenAdjacent");function Vn(t,e,n){const o=[];for(const r of e){const a=n[r.src],l=n[r.dst];if(a==null||l==null||a===l)continue;let f=r.src,i=r.dst,g=a,x=l;a>l&&(f=r.dst,i=r.src,g=l,x=a);for(let C=g;C<x;C++)o.push({id:`${r.id}@${C}`,src:f,dst:i,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Ys(t[r],t[r+1],o);return s}d(Vn,"totalCrossings");function Gs(t,e){const n={...e},{preds:o}=rn(t),s=fe(t),r=nn(t,n,s);let a=Vn(r,t.edges,n);const l=en.MAX_CROSSING_OPTIMIZATION_PASSES;for(let f=0;f<l;f++){let i=!1;const g=[...t.nodes].sort((x,C)=>(n[C]??0)-(n[x]??0));for(const x of g){const C=n[x]??0;if(C===0)continue;let h=0;for(const v of o.get(x)??[])h=Math.max(h,(n[v]??0)+1);if(h>=C)continue;const p=C;n[x]=h;const c=nn(t,n,s),y=Vn(c,t.edges,n);y<a?(a=y,i=!0):n[x]=p}if(!i)break}return n}d(Gs,"optimizeRanksByCrossings");function $s(t,e){const n=fe(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const a=t.edges.filter(c=>c.src===s);if(a.length===0)continue;let l=!1,f=0;for(const c of a){const y=n(c.dst);y==null||y===r?l=!0:f++}if(f===0||l)continue;let i=0,g=!1;for(const c of t.edges){if(c.dst!==s)continue;const y=n(c.src);y&&(y===r?g=!0:i++)}if(i>0||!g)continue;const x=e[s]??0,C=x+f;let h=0;for(const c of t.edges)c.dst===s&&(h=Math.max(h,(e[c.src]??0)+1));const p=Math.max(x,h,C);p!==x&&(e[s]=p)}}d($s,"adjustCrossLaneSources");function zs(t,e){const n=ye(t),o=Pe(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n);let a=Object.create(null);for(const f of o){const i=go(n,f),g=e?.ignoreCrossLaneEdges?i.filter(x=>{const C=r(x.src),h=r(f);return!C||!h?!0:C===h}):i;if(g.length===0)a[f]=0;else if(s&&g.length===1){const x=g[0].src,C=r(x),h=r(f);C!==h?a[f]=a[x]??0:a[f]=(a[x]??0)+1}else{let x=-1/0;for(const C of g)x=Math.max(x,(a[C.src]??0)+1);a[f]=x===-1/0?0:x}}return(e?.optimizeRanksByCrossings??!1)&&(a=Gs(n,a)),e?.ignoreCrossLaneEdges&&$s(n,a),{layers:nn(n,a,r),rankOf:a,dummy:new Set}}d(zs,"assignLayers_LongestPath");function Vs(t,e){const n=ye(t),s={...zs(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:a,succs:l}=rn(n,p=>{if(e?.ignoreCrossLaneEdges){const c=r(p.src),y=r(p.dst);if(c&&y&&c!==y)return!1}return!0}),f=Pe(n)??[...n.nodes],i=[...f].reverse(),g=d((p,c)=>{let y=0;for(const E of a.get(p)??[])y=Math.max(y,(s[E]??0)+1);let v=Number.POSITIVE_INFINITY;const M=l.get(p)??[];return M.length>0&&(v=Math.min(...M.map(E=>(s[E]??0)-1))),Number.isFinite(v)||(v=Math.max(y,c)),Math.min(Math.max(c,y),v)},"clampFeasible"),x=en.GRAVITY_ITERATIONS,C=d(p=>{let c=!1;for(const y of p){const v=a.get(y)??[],M=l.get(y)??[];if(v.length===0&&M.length===0)continue;const E=v.length>0?v.reduce((w,R)=>w+(s[R]??0)+1,0)/v.length:s[y]??0,T=M.length>0?M.reduce((w,R)=>w+(s[R]??0)-1,0)/M.length:s[y]??0,m=Math.round((E+T)/2),I=g(y,m);I!==s[y]&&(s[y]=I,c=!0)}return c},"relaxOrder");for(let p=0;p<x;p++){const c=C(f),y=C(i);if(!c&&!y)break}for(const p of f){let c=0;for(const y of a.get(p)??[])c=Math.max(c,(s[y]??0)+1);(s[p]??0)<c&&(s[p]=c)}for(const p of i){const c=l.get(p)??[];if(c.length>0){const y=Math.min(...c.map(v=>(s[v]??0)-1));(s[p]??0)>y&&(s[p]=y)}}return{layers:xo(n,f,s),rankOf:s,dummy:new Set}}d(Vs,"assignLayers_Gravity");function js(t){const e=mo(t),n=po(t);let o=yo(e);const s=[];for(;o.length>0;){const r=[];for(const a of o){s.push(a);for(const l of n.get(a)??[])e.set(l,(e.get(l)??0)-1),(e.get(l)??0)===0&&r.push(l)}o=r.sort((a,l)=>a.localeCompare(l))}return s.length===t.nodes.length?s:null}d(js,"topoSortByGenerationIfAcyclic");function Us(t,e){const n=ye(t),o=e?.direction==="LR"?js(n)??[...n.nodes].sort():Pe(n)??[...n.nodes].sort(),s=fe(n),r=d(g=>s(g)??g,"laneOf"),a=Object.create(null),l=new Map,f=d((g,x)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(x)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const C=go(n,g);let h=0;if(C.length>0)for(const v of C){const M=v.src,E=a[M]??0;h=Math.max(h,E+f(M,g))}const p=r(g),c=l.get(p)??0,y=Math.max(h,c);a[g]=y,l.set(p,y+1)}return{layers:xo(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}d(Us,"assignLayers_LaneAwareCompact");function Ws(t,e){const n=ye(e),{rankOf:o}=t,s=t.layers.map(h=>[...h]),r=new Set(t.dummy?[...t.dummy]:[]);let a=0;const l=new Map(n.nodeById),f=d(h=>{const p=`placeholder-${a++}`,c={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(l.set(p,c),r.add(p);s.length<=h;)s.push([]);return s[h].push(p),o[p]=h,p},"addDummyAt"),i=[...n.edges].sort((h,p)=>h.id===p.id?h.src===p.src?h.dst.localeCompare(p.dst):h.src.localeCompare(p.src):h.id.localeCompare(p.id)),g=[];for(const h of i){const p=o[h.src]??0,c=o[h.dst]??0;if(c-p<=1){g.push(h);continue}let y=h.src;for(let M=p+1,E=0;M<c;M++,E++){const T=f(M);g.push({id:`${h.id}#${E}`,src:y,dst:T,weight:h.weight,ref:h.ref}),y=T}const v=c-p-2;g.push({id:`${h.id}#${Math.max(v+1,0)}`,src:y,dst:h.dst,weight:h.weight,ref:h.ref})}const C={nodes:[...n.nodes,...[...r].filter(h=>!n.nodes.includes(h))],edges:g,layout:n.layout,nodeById:l};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:C}}d(Ws,"makeProperLayering");function jn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(jn,"median");function Un(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Un,"barycenter");function Ks(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Ks,"neighborPositionsFor");function qs(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(qs,"currentOrderTieBreak");function Wn(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(t),a=Ne(e),l=[];for(const i of n)o.has(i.src)&&s.has(i.dst)&&l.push({u:r.get(i.src),v:a.get(i.dst)});l.sort((i,g)=>i.u===g.u?i.v-g.v:i.u-g.u);const f=l.map(i=>i.v);return bo(f)}d(Wn,"countCrossingsBetweenAdjacent");function je(t,e,n){return[...t].sort((o,s)=>{const r=jn(e.get(o)??[]),a=jn(e.get(s)??[]);return r===a?qs(o,s,n):isFinite(r)?isFinite(a)?r-a:-1:1})}d(je,"sortByHeuristic");function Kn(t,e,n,o,s,r){const a=Ne(t),l=Ne(e),f=Ks(e,a,n,o);if(!s||!r||r.length===0)return je(e,f,l);const i=new Map;for(const C of e){const h=s(C),p=i.get(h)??[];p.push(C),i.set(h,p)}const g=[];for(const C of r){const h=i.get(C);if(!h||h.length===0)continue;const p=je(h,f,l);g.push(...p)}const x=i.get(null);if(x&&x.length>0){const C=je(x,f,l);for(const h of C){const p=Un(f.get(h)??[]);let c=g.length;if(isFinite(p))for(const[y,v]of g.entries()){const M=Un(f.get(v)??[]);if(p<M){c=y;break}}g.splice(c,0,h)}}return g}d(Kn,"reorderLayer");function qn(t,e,n,o,s){const r=[...e],a=new Set(t),l=new Set(e),f=o?new Set(o):null,i=n.filter(c=>a.has(c.src)&&l.has(c.dst)),g=f?n.filter(c=>l.has(c.src)&&f.has(c.dst)):void 0,x=d(c=>{let y=Wn(t,c,i);return g&&o&&(y+=Wn(c,o,g)),y},"crossingScore"),C=s?new Map:null;if(s&&C)for(const c of e)C.set(c,s(c));let h=!0,p=x(r);for(;h;){h=!1;for(let c=0;c+1<r.length;c++){if(C){const M=C.get(r[c]),E=C.get(r[c+1]);if(M!==E)continue}const y=p;[r[c],r[c+1]]=[r[c+1],r[c]];const v=x(r);v<y?(p=v,h=!0):[r[c],r[c+1]]=[r[c+1],r[c]]}}return r}d(qn,"transposeImprove");function Js(t,e,n){const o=t.layers.map(l=>[...l]),s=e.edges,r=fe(e),a=Mo(e,n?.laneOrder);for(let l=0;l<3;l++){for(let f=1;f<o.length;f++)o[f]=Kn(o[f-1],o[f],s,"down",r,a),o[f]=qn(o[f-1],o[f],s,o[f+1],r);for(let f=o.length-2;f>=0;f--)o[f]=Kn(o[f+1],o[f],s,"up",r,a),o[f]=qn(o[f+1],o[f],s,o[f-1],r)}return{layers:o}}d(Js,"orderLayers");function Zs(t,e,n){const o=n?.layerGap??Po.DEFAULT_LAYER_GAP,s=n?.nodeGap??Po.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,a=n?.direction??"TB",l=a==="LR"||a==="RL",f=t.layers,i=Object.create(null),g=Object.create(null),x=d(O=>e.nodeById.get(O),"getNode"),C=d(O=>x(O)?.width??0,"getWidth"),h=d(O=>x(O)?.height??0,"getHeight"),p=fe(e),c=Mo(e,n?.laneOrder),y=f.map(O=>O.reduce((F,H)=>Math.max(F,h(H)),0)),v=[];if(l)for(let O=0;O+1<f.length;O++){const F=f[O].reduce((mt,kt)=>Math.max(mt,C(kt)),0),H=f[O+1].reduce((mt,kt)=>Math.max(mt,C(kt)),0),P=y[O],G=y[O+1],j=P/2+G/2,J=(F+H)/2,dt=Math.max(0,J-j-o);v.push(dt)}const M=new Set;for(const O of f)for(const F of O)M.add(p(F));const E=M.has(null),T=c.filter(O=>M.has(O)),m=[...E?[null]:[],...T],I=Object.create(null);for(const O of T)I[O]=0;E&&(I.null=0);for(const O of f){const F=Object.create(null),H=[];for(const P of O){const G=p(P);G===null?H.push(P):(F[G]||=[]).push(P)}for(const[P,G]of Object.entries(F)){const j=G.reduce((J,dt)=>J+C(dt),0)+s*Math.max(0,G.length-1);I[P]=Math.max(I[P]??0,j)}if(E&&H.length){const P=H.reduce((G,j)=>G+C(j),0)+s*Math.max(0,H.length-1);I.null=Math.max(I.null??0,P)}}const w=new Map;{const O=m.map(P=>(P===null?I.null:I[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,m.length-1))/2;for(let P=0;P<m.length;P++){const G=m[P],j=O[P]??0,J=H+j/2;w.set(G,J),H+=j,P<m.length-1&&(H+=r)}}let R=0;for(const[O,F]of f.entries()){const H=y[O]??0,P=new Map;for(const j of F){const J=p(j),dt=P.get(J)??[];dt.push(j),P.set(J,dt)}for(const j of m){const J=P.get(j)??[];if(J.length===0)continue;const dt=w.get(j);if(J.length===1){const mt=J[0];i[mt]=dt,g[mt]=R+H/2}else{const mt=J.map(Q=>C(Q)),kt=mt.reduce((Q,W)=>Q+W,0)+s*(J.length-1);let Pt=dt-kt/2;for(const[Q,W]of J.entries()){const et=mt[Q];i[W]=Pt+et/2,g[W]=R+H/2,Pt+=et+s}}}const G=v[O]??0;R+=H+o+G}const k=new Map;for(const O of e.edges){const F=O.ref.id;k.has(F)||k.set(F,[]),k.get(F).push(O)}for(const[,O]of k){if(O.length===0)continue;const F=O[0].ref,H=F.start,P=F.end;if(H==null||P==null)continue;const G=Math.round(((i[H]??0)+(i[P]??0))/2),j=new Set;for(const J of O)j.add(J.src),j.add(J.dst);for(const J of j){if(J===H||J===P)continue;e.nodeById.get(J)?.isDummy&&(i[J]=G)}}return{x:i,y:g}}d(Zs,"assignCoordinates");var Qs=8;function tr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}d(tr,"hashString");function er(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(er,"mulberry32");function nr(t,e){const n=[...t],o=er(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(nr,"deterministicShuffle");function or(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(or,"sourceDistance");function Jn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:a}of e){const l=n.get(s),f=n.get(r);l==null||f==null||(o+=a*Math.abs(l-f))}return o}d(Jn,"laneArrangementCost");function sr(t){const e=cn(t);if(e.length<2)return[];const n=new Map(e.map((r,a)=>[r,a])),o=fe(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const a=typeof r.start=="string"?r.start:void 0,l=typeof r.end=="string"?r.end:void 0;if(!a||!l||!t.nodeById.has(a)||!t.nodeById.has(l))continue;const f=o(a),i=o(l);if(!f||!i||f===i)continue;const g=n.get(f),x=n.get(i);if(g==null||x==null)continue;const[C,h]=g<=x?[f,i]:[i,f],p=`${C}\0${h}`,c=s.get(p);c?c.weight++:s.set(p,{a:C,b:h,weight:1})}return[...s.values()]}d(sr,"buildWeightedLaneEdges");function Zn(t,e,n){const o=[...t];let s=Jn(o,e),r=!0,a=0;const l=Math.max(1,o.length);for(;r&&a<l;){r=!1,a++;for(let f=0;f+1<o.length;f++){[o[f],o[f+1]]=[o[f+1],o[f]];const i=Jn(o,e);i<s?(s=i,r=!0):[o[f],o[f+1]]=[o[f+1],o[f]]}}return{order:o,cost:s,sourceDistance:or(o,n)}}d(Zn,"greedySwitch");function rr(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}d(rr,"isBetterCandidate");function ir(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:a})=>`${s}:${r}:${a}`).join("|");return tr(`${t.join("|")}#${o}#${n}`)}d(ir,"seedForRestart");function cr(t,e={}){const n=cn(t);if(n.length<2)return n;const o=sr(t);if(o.length===0)return n;const s=new Map(n.map((l,f)=>[l,f]));let r=Zn(n,o,s);const a=Math.max(0,e.restarts??Qs);for(let l=0;l<a;l++){const f=ir(n,o,l),i=nr(n,f),g=Zn(i,o,s);rr(g,r)&&(r=g)}return r.order}d(cr,"optimizeTopLaneOrder");function ar(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=ye(t),r=e?.automaticLaneOrdering?cr(s,{restarts:Qs}):void 0,a=As(s),l=a.acyclic,f=n?Us(l,{compactSingleInput:e?.compactSingleInput??en.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Vs(l,{compactSingleInput:e?.compactSingleInput??en.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:i,graphWithDummies:g}=Ws(f,l),x=Js(i,g,{laneOrder:r}),C=Zs(x,g,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:l,reversed:a.reversed,layering:i,ordered:x,coordinates:C}}d(ar,"sugiyamaLayout");var ct=Pr.EPSILON,Br=8,be=15,Te=15,ze=25,ne=20,Mn=10;function Qn(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,a=e.y-s,l=Math.abs(r),f=Math.abs(a);return l<ct&&f<ct?n:f>ct&&f*3>=l?a>0?"bottom":"top":l>ct?r>0?"right":"left":n}d(Qn,"chooseOrthogonalSide");function to(t,e){return Math.abs(t.to-e.from)<ct||Math.abs(t.to-e.to)<ct?t.to:t.from}d(to,"sharedLineEndpointCoord");function Me(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}d(Me,"pointOnLine");function lr(t,e){const n=t.nodes??[],o=t.edges??[],s=[];for(const u of o)u.isLayoutOnly||s.push({...u,__originalEdge:u});const r=new Map,a=new Map,l=[],f=e==="LR";for(const u of n)r.set(u.id,u);const i=n.filter(u=>u.isGroup&&!u.parentId);for(const u of i){const b={id:u.id},S=d(L=>{a.set(L.id,b),n.filter(A=>A.parentId===L.id).forEach(S)},"assignLane");S(u)}const g=n.filter(u=>!u.isGroup&&!u.isEdgeLabel).map(u=>{const b=u.width??10,S=u.height??10,L=u.x??0,A=u.y??0,B=Br;return{nodeId:u.id,minX:L-b/2-B,maxX:L+b/2+B,minY:A-S/2-B,maxY:A+S/2+B,visualXHalfExtent:f?S/2+B:b/2+B}}),x=d((u,b,S,L)=>{let A=l.find(B=>B.orientation===u&&Math.abs(B.coord-b)<1);return A||(A={id:`pipe-${u}-${b.toFixed(0)}`,orientation:u,coord:b,spanMin:S,spanMax:L,tracks:[]},l.push(A)),A.spanMin=Math.min(A.spanMin,S),A.spanMax=Math.max(A.spanMax,L),A},"getOrAddPipe"),C=d((u,b)=>{const S=u.width??10,L=u.height??10,A=u.x??0,B=u.y??0;switch(b){case"top":return{x:A,y:B-L/2};case"bottom":return{x:A,y:B+L/2};case"left":return{x:A-S/2,y:B};case"right":return{x:A+S/2,y:B}}},"portForSide"),h=d((u,b,S)=>C(u,Qn(u,b,S?"bottom":"top")),"getOrthogonalPort"),p=[],c=[],y=new Set,v=1e3,M=d((u,b,S)=>{if(p.length===0)return 0;const L=Math.abs(b.y-S.y)<ct,A=Math.abs(b.x-S.x)<ct;if(!L&&!A)return 0;let B=0;if(L){const U=b.y,q=Math.min(b.x,S.x)-ct,z=Math.max(b.x,S.x)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===u||Y.orientation!=="vertical"||Y.pipe.coord<q||Y.pipe.coord>z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}else if(A){const U=b.x,q=Math.min(b.y,S.y)-ct,z=Math.max(b.y,S.y)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===u||Y.orientation!=="horizontal"||Y.pipe.coord<q||Y.pipe.coord>z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}return B},"crossingPenalty"),E=s.map((u,b)=>{if(!u.start||!u.end)return{idx:b,crossLane:0,dx:0,dy:0};const S=r.get(u.start),L=r.get(u.end),A=a.get(u.start),B=a.get(u.end),U=A&&B&&A.id!==B.id?1:0,q=S&&L?Math.abs((L.x??0)-(S.x??0)):0,z=S&&L?Math.abs((L.y??0)-(S.y??0)):0;return{idx:b,crossLane:U,dx:q,dy:z}}).sort((u,b)=>{if(u.crossLane!==b.crossLane)return b.crossLane-u.crossLane;const S=u.dx+u.dy,L=b.dx+b.dy;return Math.abs(S-L)>1?S-L:u.idx-b.idx}).map(u=>u.idx),T=d((u,b,S,L)=>{const A=Math.min(u.x,b.x),B=Math.max(u.x,b.x),U=Math.min(u.y,b.y),q=Math.max(u.y,b.y);return!!g.find(Y=>S&&Y.nodeId===S||L&&Y.nodeId===L?!1:Math.abs(u.x-b.x)>ct?Y.minY<u.y&&Y.maxY>u.y&&Y.maxX>A&&Y.minX<B:Y.minX<u.x&&Y.maxX>u.x&&Y.maxY>U&&Y.minY<q)},"isSegmentBlocked"),m=new Map,I=new Map;for(const u of s)!u.start||!u.end||u.start===u.end||(I.set(u.start,(I.get(u.start)??0)+1),I.set(u.end,(I.get(u.end)??0)+1));const w=d((u,b)=>Qn(u,b,"bottom"),"determineSide"),R=new Map;for(const[u,b]of s.entries()){if(!b.start||!b.end||b.start===b.end||b.points&&b.points.length>0)continue;const S=r.get(b.start),L=r.get(b.end);if(!S||!L)continue;const A=(L.x??0)-(S.x??0),B=(L.y??0)-(S.y??0);R.set(u,{edgeIdx:u,srcId:b.start,dstId:b.end,srcSide:w(S,{x:L.x??0,y:L.y??0}),dstSide:w(L,{x:S.x??0,y:S.y??0}),absDx:Math.abs(A),absDy:Math.abs(B),dxSign:Math.sign(A),dySign:Math.sign(B)})}const k=d(u=>u.srcSide==="top"||u.srcSide==="bottom"?u.absDx===0?1/0:u.absDy/u.absDx:u.absDy===0?1/0:u.absDx/u.absDy,"preferenceStrength"),O=d(u=>u.srcSide==="top"||u.srcSide==="bottom"?u.dxSign>=0?"right":"left":u.dySign>=0?"bottom":"top","secondarySide"),F=new Map;for(const u of R.values()){const b=`${u.srcId}:${u.srcSide}`;F.has(b)||F.set(b,[]),F.get(b).push(u)}const H=new Map,P=d((u,b)=>`${u}:${b}`,"loadKey");for(const u of R.values())H.set(P(u.srcId,u.srcSide),(H.get(P(u.srcId,u.srcSide))??0)+1),H.set(P(u.dstId,u.dstSide),(H.get(P(u.dstId,u.dstSide))??0)+1);for(const u of F.values())if(!(u.length<2)){u.sort((b,S)=>{const L=k(b),A=k(S);return Math.abs(L-A)>1e-9?A-L:b.edgeIdx-S.edgeIdx});for(let b=1;b<u.length;b++){const S=u[b],L=O(S),A=H.get(P(S.srcId,S.srcSide))??0,B=H.get(P(S.srcId,L))??0;B>=A||(H.set(P(S.srcId,S.srcSide),A-1),H.set(P(S.srcId,L),B+1),S.srcSide=L)}}const G=d(u=>{const b=u?.shape;return b==="question"||b==="diamond"},"isDiamondNode"),j=new Map;for(const u of R.values())j.has(u.dstId)||j.set(u.dstId,new Set),j.get(u.dstId).add(u.dstSide);for(const u of R.values()){if(!G(r.get(u.srcId)))continue;const b=j.get(u.srcId);if(!b?.has(u.srcSide))continue;const S=O(u);if(b.has(S)||(H.get(P(u.srcId,S))??0)>0)continue;const L=H.get(P(u.srcId,u.srcSide))??0;H.set(P(u.srcId,u.srcSide),Math.max(0,L-1)),H.set(P(u.srcId,S),1),u.srcSide=S}for(const u of R.values()){const{edgeIdx:b,srcId:S,dstId:L,srcSide:A,dstSide:B}=u,U=r.get(S),q=r.get(L),z=`${S}:${A}:src`,Y=A==="top"||A==="bottom"?q.x??0:q.y??0;m.has(z)||m.set(z,[]),m.get(z).push({edgeIdx:b,oppositeCoord:Y});const ot=`${L}:${B}:dst`,rt=B==="top"||B==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:b,oppositeCoord:rt})}const J=new Map,dt=8;for(const[u,b]of m){if(b.length<2)continue;b.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);const S=u.split(":"),L=S.slice(0,-2).join(":"),A=S[S.length-2],B=S[S.length-1],U=r.get(L);if(!U)continue;const z=A==="left"||A==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?z*.3:z,tt=Math.min(20,Math.max(dt,rt/(b.length+1))),Rt=-(tt*(b.length-1))/2;for(const[Lt,Dt]of b.entries()){const Jt=Rt+Lt*tt,dn=`${Dt.edgeIdx}:${B}`;J.set(dn,Jt)}}const mt=d(u=>!!s[u]?.labelNodeId,"edgeHasLabelNode"),kt=d((u,b)=>u?(m.get(`${u}:${b}:src`)??[]).some(({edgeIdx:S})=>mt(S))||(m.get(`${u}:${b}:dst`)??[]).some(({edgeIdx:S})=>mt(S)):!1,"faceHasLabelNode"),Pt=d((u,b,S)=>b==="top"||b==="bottom"?{x:u.x+S,y:u.y}:{x:u.x,y:u.y+S},"applyPortOffset"),Q=d((u,b,S)=>{const L=R.get(u),A={x:S.x??0,y:S.y??0},B={x:b.x??0,y:b.y??0},U=L?.srcSide??w(b,A),q=L?.dstSide??w(S,B);let z=L?C(b,L.srcSide):h(b,A,!0),Y=L?C(S,L.dstSide):h(S,B,!1);const ot=J.get(`${u}:src`),rt=J.get(`${u}:dst`);return ot!==void 0&&(z=Pt(z,U,ot)),rt!==void 0&&(Y=Pt(Y,q,rt)),{pSrcPort:z,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const u of E){const b=s[u];if(c[u]=[],!b.start||!b.end||b.points&&b.points.length>0||b.start===b.end)continue;const S=r.get(b.start),L=r.get(b.end);if(!S||!L)continue;const{pSrcPort:A,pDstPort:B,srcSide:U,dstSide:q}=Q(u,S,L),z={...A},Y={...B},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=A.y>(S.y??0);z.y=X?A.y+ne:A.y-ne}else{const X=A.x>(S.x??0);z.x=X?A.x+ne:A.x-ne}if(rt){const X=B.y>(L.y??0);Y.y=X?B.y+ne:B.y-ne}else{const X=B.x>(L.x??0);Y.x=X?B.x+ne:B.x-ne}const st=d((X,$)=>{for(const K of g)if(!$.includes(K.nodeId)&&X.x>K.minX&&X.x<K.maxX&&X.y>K.minY&&X.y<K.maxY)return{inside:!0,obstacle:K};return{inside:!1}},"isPointInObstacle"),tt=d((X,$,K,lt,Ct)=>{if(Ct){const Nt=X.y>($.y??0);return{x:(K.x??0)>=X.x?lt.maxX+be:lt.minX-be,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>($.x??0),Et=(K.y??0)>=X.y;return{x:bt?lt.maxX+be:lt.minX-be,y:Et?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[b.start,b.end],Lt=st(z,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const $=tt(A,S,L,X,!0);z.x=$.x,z.y=$.y;const K=$.leavesPositiveSide?Math.min(X.minY-2,A.y+ne):Math.max(X.maxY+2,A.y-ne);yt=[{x:A.x,y:K},{x:$.x,y:K},{x:$.x,y:$.y}]}else{const $=tt(A,S,L,X,!1),K=$.leavesPositiveSide?Math.min(X.minX-2,A.x+ne):Math.max(X.maxX+2,A.x-ne);z.x=$.x,z.y=$.y,yt=[{x:K,y:A.y},{x:K,y:$.y},{x:$.x,y:$.y}]}}let Dt=[];const Jt=st(Y,Rt);if(Jt.inside&&Jt.obstacle){const X=Jt.obstacle;if(rt){const $=tt(B,L,S,X,!0);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:B.x,y:$.y}]}else{const $=tt(B,L,S,X,!1);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:$.x,y:B.y}]}}if(yt.length===0&&Dt.length===0){const X=be,$=Math.abs(z.x-Y.x)<X,K=Math.abs(z.y-Y.y)<X,lt=J.get(`${u}:src`)!==void 0||J.get(`${u}:dst`)!==void 0,Ct=(m.get(`${b.start??""}:${U}:src`)?.length??0)+(m.get(`${b.start??""}:${U}:dst`)?.length??0),bt=(m.get(`${b.end??""}:${q}:src`)?.length??0)+(m.get(`${b.end??""}:${q}:dst`)?.length??0),Et=Ct>1||bt>1,Nt=I.get(b.start??"")??0,ut=I.get(b.end??"")??0,Yt=Ct>1&&kt(b.start,U)||bt>1&&kt(b.end,q),ee=Ct<=1||Nt<=2,Bt=bt<=1||ut<=2;if(($||K)&&!lt&&(!Et||Et&&!Yt&&ee&&Bt)&&!T(A,B,b.start,b.end)){b.points=[{...A},{...z},{...Y},{...B}],y.add(u);const Mt=K?"horizontal":"vertical",$t=K?A.y:A.x,It=K?Math.min(A.x,B.x):Math.min(A.y,B.y),St=K?Math.max(A.x,B.x):Math.max(A.y,B.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${u}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};p.push({edgeIndex:u,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}const dn=x("vertical",z.x,z.y,z.y);z.x=dn.coord;const hr=x("vertical",Y.x,Y.y,Y.y);Y.x=hr.coord;let ue=Math.min(z.x,Y.x)-50,he=Math.max(z.x,Y.x)+50,ve=Math.min(z.y,Y.y)-50,Le=Math.max(z.y,Y.y)+50;for(const X of g){const $=Math.min(z.x,Y.x),K=Math.max(z.x,Y.x),lt=Math.min(z.y,Y.y),Ct=Math.max(z.y,Y.y);X.minX<K&&X.maxX>$&&X.minY<Ct&&X.maxY>lt&&(ue=Math.min(ue,X.minX-ze),he=Math.max(he,X.maxX+ze),ve=Math.min(ve,X.minY-ze),Le=Math.max(Le,X.maxY+ze))}for(const X of g){if(X.maxX<ue||X.minX>he||X.maxY<ve||X.minY>Le)continue;const $=be;x("horizontal",X.minY-$,ue,he),x("horizontal",X.maxY+$,ue,he);const K=Te;x("vertical",X.minX-K,ve,Le),x("vertical",X.maxX+K,ve,Le)}x("horizontal",z.y,ue,he),x("horizontal",Y.y,ue,he);const gr=l.filter(X=>X.orientation==="horizontal"&&X.coord>=ve&&X.coord<=Le),pr=l.filter(X=>X.orientation==="vertical"&&X.coord>=ue&&X.coord<=he),Be=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),ke=Be(z.x,z.y),So=Be(Y.x,Y.y),Fe=new Map,un=new Map,hn=new Map,_e=new Set,xe=[];Fe.set(ke,0),hn.set(ke,"n"),xe.push({key:ke,f:Math.hypot(Y.x-z.x,Y.y-z.y),pt:z}),_e.add(ke);let Ht=[];const ge=d((X,$)=>T(X,$,b.start,b.end),"checkSegmentBlocked"),gn={x:Y.x,y:z.y},mr=ge(z,gn),yr=ge(gn,Y),xr=mr||yr,pn={x:z.x,y:Y.y},br=ge(z,pn),Mr=ge(pn,Y);if(xr?br||Mr||(Math.abs(z.x-Y.x)<ct?Ht=[z,Y]:Ht=[z,pn,Y]):Math.abs(z.y-Y.y)<ct||Math.abs(z.x-Y.x)<ct?Ht=[z,Y]:Ht=[z,gn,Y],Ht.length===0)for(;xe.length>0;){xe.sort((ut,Yt)=>ut.f-Yt.f);const X=xe.shift();if(_e.delete(X.key),X.key===So){let ut=So,Yt=Y;for(Ht=[Yt];un.has(ut);){const ee=un.get(ut);Ht.unshift(ee),Yt=ee,ut=Be(ee.x,ee.y)}break}const $=X.pt.x,K=X.pt.y,lt=pr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-$)<1),bt=gr.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct<lt.length-1&&Nt.push({x:lt[Ct+1].coord,y:K}),Et>0&&Nt.push({x:$,y:bt[Et-1].coord}),Et>=0&&Et<bt.length-1&&Nt.push({x:$,y:bt[Et+1].coord});for(const ut of Nt){const Yt=Math.min($,ut.x),ee=Math.max($,ut.x),Bt=Math.min(K,ut.y),Gt=Math.max(K,ut.y);if(g.some(Zt=>Zt.nodeId===b.start||Zt.nodeId===b.end?!1:Yt!==ee?Zt.minY<K&&Zt.maxY>K&&Zt.maxX>Yt&&Zt.minX<ee:Zt.minX<$&&Zt.maxX>$&&Zt.maxY>Bt&&Zt.minY<Gt))continue;const Mt=Be(ut.x,ut.y),$t=Math.abs(ut.x-$)+Math.abs(ut.y-K),It=M(u,X.pt,ut);let St=0;const Wt=Y.x-z.x,Ee=Y.y-z.y,De=ut.x-$,mn=ut.y-K;(Ee>10&&mn<-5||Ee<-10&&mn>5)&&(St=Math.abs(mn)*100),(Wt>10&&De<-5||Wt<-10&&De>5)&&(St+=Math.abs(De)*50);let Co=0;const vo=hn.get(X.key)??"n",Lo=Math.abs(De)>ct?"h":"v";vo!=="n"&&vo!==Lo&&(Co=50);const Ir=$t+It+St+Co,He=(Fe.get(X.key)??1/0)+Ir,Eo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(He<(Fe.get(Mt)??1/0))if(un.set(Mt,X.pt),Fe.set(Mt,He),hn.set(Mt,Lo),!_e.has(Mt))xe.push({key:Mt,f:He+Eo,pt:ut}),_e.add(Mt);else{const Zt=xe.findIndex(Sr=>Sr.key===Mt);Zt!==-1&&(xe[Zt].f=He+Eo)}}}if(Ht.length===0&&(Ht=[z,{x:z.x,y:Y.y},Y]),Ht.length>4){const X=Ht[0],$=Ht[Ht.length-1];let K=Math.min(X.x,$.x),lt=Math.max(X.x,$.x),Ct=Math.min(X.y,$.y),bt=Math.max(X.y,$.y);for(const Bt of Ht)K=Math.min(K,Bt.x),lt=Math.max(lt,Bt.x),Ct=Math.min(Ct,Bt.y),bt=Math.max(bt,Bt.y);const Et=lt>Math.max(X.x,$.x),Nt=K<Math.min(X.x,$.x);if(f){const Bt=Te;if(Et){const Gt=Math.max(X.x,$.x),Ot=Math.min(X.y,$.y),Mt=Math.max(X.y,$.y),$t=g.filter(It=>It.minX<Gt&&It.maxX>Gt&&It.minY<Mt&&It.maxY>Ot);if($t.length>0){let It=Math.max(X.x,$.x);for(const St of $t){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Ee=Wt+St.visualXHalfExtent+Bt;It=Math.max(It,Ee)}isNaN(It)||(lt=It)}}if(Nt){const Gt=g.filter(Ot=>Ot.minX<Math.min(X.x,$.x)+Bt&&Ot.minY<Math.max(X.y,$.y)&&Ot.maxY>Math.min(X.y,$.y));if(Gt.length>0){let Ot=Math.min(X.x,$.x);for(const Mt of Gt){const It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Bt;Ot=Math.min(Ot,It)}K=Ot}}}const ut=d(Bt=>{const Gt=$.y>X.y,Ot=g.filter(It=>{const St=Math.min(X.x,$.x)<It.maxX&&Math.max(X.x,$.x)>It.minX,Wt=Math.min(X.y,$.y)<It.maxY&&Math.max(X.y,$.y)>It.minY;return St&&Wt});let Mt=Ot;if(f&&Ot.length>0){const It=Ot.filter(St=>St.minX<Bt&&St.maxX>Bt);It.length>0&&(Mt=It)}if(Mt.length===0)return $.y;const $t=be;if(Gt){const St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<$.y-ct)return St}else{const St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>$.y+ct)return St}return $.y},"findBestReturnY"),Yt=d(Bt=>{const Gt=ut(Bt),Ot={x:Bt,y:X.y},Mt={x:Bt,y:Gt},$t={x:$.x,y:Gt},It=ge(X,Ot),St=ge(Ot,Mt),Wt=ge(Mt,$t),Ee=Gt!==$.y?ge($t,$):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-$.y)<ct?[X,Ot,Mt,$]:[X,Ot,Mt,$t,$]:null},"trySimplifyWithDetourX"),ee=Et&&!Nt?Yt(lt):Nt&&!Et?Yt(K):null;ee&&(Ht=ee)}const Xt=[A,...yt,...Ht,...Dt.reverse(),B];if(Xt.length>=3){const X=Xt[Xt.length-1],$=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-$.y)<ct&&Math.abs($.y-X.y)<ct,Ct=Math.abs(K.x-$.x)<ct&&Math.abs($.x-X.x)<ct;if(lt){const bt=Math.sign($.x-K.x),Et=Math.sign(X.x-K.x);bt!==0&&bt===Et&&Math.abs($.x-K.x)>Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign($.y-K.y),Et=Math.sign(X.y-K.y);bt!==0&&bt===Et&&Math.abs($.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const ie=[Xt[0]];for(let X=1;X<Xt.length-1;X++){if(X===1){ie.push(Xt[X]);continue}const $=ie[ie.length-1],K=Xt[X],lt=Xt[X+1];if(Math.abs($.y-K.y)<ct&&Math.abs(K.y-lt.y)<ct){const Ct=K.x>$.x,bt=lt.x>K.x;if(Ct!==bt){ie.push(K);continue}continue}if(Math.abs($.x-K.x)<ct&&Math.abs(K.x-lt.x)<ct){const Ct=K.y>$.y,bt=lt.y>K.y;if(Ct!==bt){ie.push(K);continue}continue}ie.push(K)}ie.push(Xt[Xt.length-1]);for(let X=0;X<ie.length-1;X++){const $=ie[X],K=ie[X+1],lt=Math.abs($.x-K.x)<ct?"vertical":"horizontal",Ct=lt==="vertical"?$.x:$.y,bt=lt==="vertical"?Math.min($.y,K.y):Math.min($.x,K.x),Et=lt==="vertical"?Math.max($.y,K.y):Math.max($.x,K.x),Nt=x(lt,Ct,bt,Et),ut={edgeIndex:u,segmentIndex:X,orientation:lt,pipe:Nt,trackIndex:0,from:bt,to:Et};p.push(ut),c[u].push(p.length-1),Nt.tracks[0]||(Nt.tracks[0]={index:0,coord:Nt.coord,segments:[]}),Nt.tracks[0].segments.push({edgeIndex:u,segmentIndex:X,from:bt,to:Et})}}const W=d((u,b)=>u.from<b.to&&b.from<u.to,"segmentsOverlap"),et=d((u,b,S,L)=>{const A=!L.segments.some(U=>(U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex)&&W(U,u)),B=!S.segments.some(U=>(U.edgeIndex!==u.edgeIndex||U.segmentIndex!==u.segmentIndex)&&W(U,b));return A&&B?(u.trackIndex=L.index,b.trackIndex=S.index,S.segments=[...S.segments.filter(U=>U.edgeIndex!==u.edgeIndex||U.segmentIndex!==u.segmentIndex),{edgeIndex:b.edgeIndex,segmentIndex:b.segmentIndex,from:b.from,to:b.to}],L.segments=[...L.segments.filter(U=>U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex),{edgeIndex:u.edgeIndex,segmentIndex:u.segmentIndex,from:u.from,to:u.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=d(u=>{const b=u.tracks.length;return u.tracks[b]={index:b,coord:u.coord,segments:[]},b},"createNewTrack"),gt=d((u,b)=>{const S=u.pipe.tracks[u.trackIndex];S.segments=S.segments.filter(A=>A.edgeIndex!==u.edgeIndex||A.segmentIndex!==u.segmentIndex),u.trackIndex=b,u.pipe.tracks[b].segments.push({edgeIndex:u.edgeIndex,segmentIndex:u.segmentIndex,from:u.from,to:u.to})},"moveSegmentToTrack"),xt=d((u,b)=>{const S=c[u.edgeIndex];for(const L of S){const A=p[L];A.pipe===u.pipe&>(A,b)}},"moveSegmentChainToTrack"),vt=d(u=>{const b=c[u.edgeIndex],S=b.indexOf(p.indexOf(u)),L=[];return S>0&&L.push(p[b[S-1]]),S<b.length-1&&L.push(p[b[S+1]]),L},"getAdjacentSegmentsAlongEdge"),Vt=d((u,b)=>{if(u.orientation===b.orientation)return!1;const S=u.orientation==="horizontal"?u:b,L=u.orientation==="horizontal"?b:u;return L.pipe.coord>S.from&&L.pipe.coord<S.to&&S.pipe.coord>L.from&&S.pipe.coord<L.to},"haveAnyCrossing"),jt=d((u,b)=>{for(const S of u.tracks)if(!S.segments.some(A=>(A.edgeIndex!==b.edgeIndex||A.segmentIndex!==b.segmentIndex)&&W(A,b)))return S.index;return-1},"findAvailableTrack"),Ut=d((u,b)=>{if(u.trackIndex===b.trackIndex)return W(u,b);const S=vt(u),L=vt(b);return S.some(A=>L.some(B=>Vt(A,B)))},"segmentsConflict"),te=d((u,b,S)=>{if(et(u,b,u.pipe.tracks[u.trackIndex],b.pipe.tracks[b.trackIndex]))return;const L=jt(u.pipe,b);S(b,L!==-1?L:at(u.pipe))},"resolveTrackConflict"),Se=d(u=>{let b=0;for(let S=0;S<u.length;S++)for(let L=S+1;L<u.length;L++){const A=u[S],B=u[L];A.pipe===B.pipe&&Ut(A,B)&&(b++,te(A,B,xt))}return b},"resolveHandleConflicts"),de=new Map,Ce=d(u=>{if(de.has(u))return de.get(u);const b=c[u];if(b.length===0){const q={dest:0,deviation:0,base:0,delta:0};return de.set(u,q),q}const L=p[b[0]].pipe.coord;let A=L;for(let q=1;q<b.length;q++){const z=p[b[q]];if(z.orientation==="horizontal"){const Y=z.from,ot=z.to;A=Math.abs(Y-L)>Math.abs(ot-L)?Y:ot;break}}const B=Math.abs(A-L),U={dest:A,deviation:B,base:L,delta:A-L};return de.set(u,U),U},"getDestInfo"),an=d(()=>{let u=0;const b=new Map;for(const[L,A]of s.entries())c[L].length!==0&&A.start&&(b.has(A.start)||b.set(A.start,[]),b.get(A.start).push(L));const S=d(L=>{const A=s[L];if(!A.start||!A.end)return 0;const B=r.get(A.start),U=r.get(A.end);if(!B||!U)return 0;const q=(U.x??0)-(B.x??0),z=(U.y??0)-(B.y??0);return Math.abs(q)+Math.abs(z)},"getEdgeDistance");for(const L of b.values()){L.sort((B,U)=>{const q=Ce(B),z=Ce(U);if(Math.abs(q.deviation-z.deviation)>1)return q.deviation-z.deviation;if(Math.abs(q.dest-z.dest)>1)return q.dest-z.dest;const Y=S(B),ot=S(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=c[B].length,st=c[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=c[B][0],yt=c[U][0];if(p[tt]&&p[yt]){const Rt=p[tt],Lt=p[yt],Dt=Math.abs(Rt.to-Rt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});const A=L.map(B=>p[c[B][0]]);u+=Se(A)}return u},"fixSourceHandleCrossings"),ln=d(()=>{let u=0;const b=new Map;for(const[S,L]of s.entries())c[S].length!==0&&L.end&&(b.has(L.end)||b.set(L.end,[]),b.get(L.end).push(S));for(const S of b.values()){S.sort((A,B)=>{const U=d(Y=>{const ot=c[Y];if(ot.length<2)return 0;const rt=p[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(A),z=U(B);return Math.abs(q-z)>.1?q-z:A-B});const L=S.map(A=>p[c[A][c[A].length-1]]);u+=Se(L)}return u},"fixTargetHandleCrossings"),fn=d(()=>{let u=0;for(const b of l){const S=[];for(const L of b.tracks)for(const A of L.segments){const B=c[A.edgeIndex].find(U=>p[U].segmentIndex===A.segmentIndex);B!==void 0&&S.push(p[B])}S.sort((L,A)=>L.edgeIndex-A.edgeIndex||L.segmentIndex-A.segmentIndex);for(let L=0;L<S.length;L++)for(let A=L+1;A<S.length;A++){const B=S[L],U=S[A];Ut(B,U)&&(u++,te(B,U,gt))}}return u},"fixPipeCrossings");let N=0;const _=10;for(;N<_;){let u=0;if(u+=an(),u+=ln(),u+=fn(),u===0)break;N++}const D=new Map;for(const u of l){const b=[];u.tracks.forEach(L=>{L.segments.forEach(A=>{b.push({edgeIndex:A.edgeIndex,segmentIndex:A.segmentIndex,trackIndex:L.index,from:A.from,to:A.to})})}),b.sort((L,A)=>L.from-A.from);const S=[];if(b.length>0){let L=[b[0]],A=b[0].to;for(let B=1;B<b.length;B++){const U=b[B];U.from<A?(L.push(U),A=Math.max(A,U.to)):(S.push(L),L=[U],A=U.to)}S.push(L)}for(const L of S){const A=new Set;L.forEach(tt=>A.add(tt.trackIndex));const B=new Map;L.forEach(tt=>{const yt=Ce(tt.edgeIndex);B.set(tt.trackIndex,(B.get(tt.trackIndex)??0)+yt.delta)});const U=[...A].filter(tt=>(B.get(tt)??0)<-1),q=[...A].filter(tt=>(B.get(tt)??0)>1),z=[...A].filter(tt=>Math.abs(B.get(tt)??0)<=1);U.sort((tt,yt)=>(B.get(yt)??0)-(B.get(tt)??0)),q.sort((tt,yt)=>(B.get(tt)??0)-(B.get(yt)??0));const Y=d((tt,yt)=>{L.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?u.coord:yt;D.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,u.coord-ot*Mn);if(z.length===0&&A.size>0){const tt=[...A].sort((Lt,Dt)=>Math.abs(B.get(Lt)??0)-Math.abs(B.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),z.push(tt)}let rt=0;for(const tt of z){if(rt===0)Y(tt,u.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,u.coord+yt*Rt*Mn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,u.coord+st*Mn)}}for(const[u,b]of s.entries()){const S=c[u]??[];if(S.length===0)continue;const L=[],A=r.get(b.start),B=r.get(b.end),{pSrcPort:U,pDstPort:q}=Q(u,A,B),z=S.map(rt=>{const st=p[rt],tt=D.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});L.push(U);for(let rt=0;rt<z.length;rt++){const st=z[rt],tt=L[L.length-1],yt=st.orient==="vertical"?tt.y:tt.x,Rt=st.orient==="vertical"?tt.x:tt.y,Lt=z[rt+1],Dt=rt<z.length-1;if(Math.abs(Rt-st.coord)>ct&&L.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Jt=st.orient==="vertical"?(yt+Lt.from)/2:to(st,Lt);L.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===z.length-2)&&L.push(Me(st,to(st,Lt)));else if(Dt)L.push(Me(st,Lt.coord));else{const Jt=Math.abs(st.from-yt)<Math.abs(st.to-yt)?st.to:st.from;L.push(Me(st,Jt))}}const Y=L[L.length-1];(Math.abs(Y.x-q.x)>ct||Math.abs(Y.y-q.y)>ct)&&L.push(q);const ot=[];L.length>0&&ot.push(L[0]);for(let rt=1;rt<L.length;rt++){const st=L[rt],tt=ot[ot.length-1];(Math.abs(st.x-tt.x)>ct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}b.points=ot}for(const u of s){const b=u.__originalEdge;b&&u.points&&(b.points=u.points)}t.edges=(t.edges??[]).filter(u=>!u.isLayoutOnly);const V=d((u,b)=>{const S=b.x??0,L=b.y??0,A=b.width??0,B=b.height??0;if(A<=0||B<=0)return u;const U=S-A/2,q=S+A/2,z=L-B/2,Y=L+B/2;if(u.x<U||u.x>q||u.y<z||u.y>Y)return u;const ot=u.x-U,rt=q-u.x,st=u.y-z,tt=Y-u.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:u.y}:yt===rt?{x:q,y:u.y}:yt===st?{x:u.x,y:z}:{x:u.x,y:Y}},"nodeBoundaryClamp");for(const u of t.edges){const b=u.points;if(!b||b.length<2)continue;const S=u.start,L=u.end,A=S?r.get(S):void 0,B=L?r.get(L):void 0;A&&(b[0]=V(b[0],A)),B&&(b[b.length-1]=V(b[b.length-1],B))}return t}d(lr,"routeEdgesOrthogonal");function fr(t){return t.direction??"TB"}d(fr,"getSwimlaneDirection");function dr(t){const e=Uo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,a=t.config.swimlane?.automaticLaneOrdering??!1,l=fr(t),{ordered:f,coordinates:i}=ar(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:a,direction:l});Wo(e,f,i,{nodeGap:n,layerGap:o});for(const g of t.edges??[])delete g.points;lr(t,l);for(const g of t.edges??[])(!g.curve||g.curve==="basis")&&(g.curve="rounded");return Es(t,l),Ls(t),l}d(dr,"runSwimlaneLayoutCore");function ur(t){jo(t);const e=Ko(t);t.nodes=e.nodes,t.edges=e.edges}d(ur,"prepareSwimlaneLayout");var _r=Cr({prepareLayout:ur,runLayoutCore:dr,afterPaint:zo});export{_r as render};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{e as Ie}from"./CTI6K_Uf.js";import{aF as Me,K as Be,L as Ve,aG as Fe,a as d,N as Ot,ad as pe,r as Ye,c as Ue,h as At,aD as ge,aX as je,p as ne,g as fe,aM as ze}from"./CnCQnNEp.js";import{g as N,c3 as te}from"./BgmOiuVG.js";var jt=(function(){var t=d(function(bt,m,x,E){for(x=x||{},E=bt.length;E--;x[bt[E]]=m);return x},"o"),e=[1,24],s=[1,25],r=[1,26],u=[1,27],i=[1,28],n=[1,63],l=[1,64],a=[1,65],h=[1,66],y=[1,67],f=[1,68],b=[1,69],v=[1,29],w=[1,30],A=[1,31],O=[1,32],P=[1,33],M=[1,34],q=[1,35],H=[1,36],Q=[1,37],K=[1,38],G=[1,39],J=[1,40],Z=[1,41],$=[1,42],tt=[1,43],et=[1,44],nt=[1,45],st=[1,46],at=[1,47],rt=[1,48],it=[1,50],ot=[1,51],lt=[1,52],ct=[1,53],ut=[1,54],ht=[1,55],dt=[1,56],pt=[1,57],ft=[1,58],yt=[1,59],_t=[1,60],Rt=[14,42],qt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Pt=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],S=[1,82],T=[1,83],k=[1,84],C=[1,85],R=[12,14,42],le=[12,14,33,42],Vt=[12,14,33,42,76,77,79,80],xt=[12,33],Ht=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:d(N(function(){},"trace"),"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:d(N(function(m,x,E,_,D,o,Nt){var p=o.length-1;switch(D){case 3:_.setDirection("TB");break;case 4:_.setDirection("BT");break;case 5:_.setDirection("RL");break;case 6:_.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:_.setC4Type(o[p-3]);break;case 19:_.setTitle(o[p].substring(6)),this.$=o[p].substring(6);break;case 20:_.setAccDescription(o[p].substring(15)),this.$=o[p].substring(15);break;case 21:this.$=o[p].trim(),_.setTitle(this.$);break;case 22:case 23:this.$=o[p].trim(),_.setAccDescription(this.$);break;case 28:o[p].splice(2,0,"ENTERPRISE"),_.addPersonOrSystemBoundary(...o[p]),this.$=o[p];break;case 29:o[p].splice(2,0,"SYSTEM"),_.addPersonOrSystemBoundary(...o[p]),this.$=o[p];break;case 30:_.addPersonOrSystemBoundary(...o[p]),this.$=o[p];break;case 31:o[p].splice(2,0,"CONTAINER"),_.addContainerBoundary(...o[p]),this.$=o[p];break;case 32:_.addDeploymentNode("node",...o[p]),this.$=o[p];break;case 33:_.addDeploymentNode("nodeL",...o[p]),this.$=o[p];break;case 34:_.addDeploymentNode("nodeR",...o[p]),this.$=o[p];break;case 35:_.popBoundaryParseStack();break;case 39:_.addPersonOrSystem("person",...o[p]),this.$=o[p];break;case 40:_.addPersonOrSystem("external_person",...o[p]),this.$=o[p];break;case 41:_.addPersonOrSystem("system",...o[p]),this.$=o[p];break;case 42:_.addPersonOrSystem("system_db",...o[p]),this.$=o[p];break;case 43:_.addPersonOrSystem("system_queue",...o[p]),this.$=o[p];break;case 44:_.addPersonOrSystem("external_system",...o[p]),this.$=o[p];break;case 45:_.addPersonOrSystem("external_system_db",...o[p]),this.$=o[p];break;case 46:_.addPersonOrSystem("external_system_queue",...o[p]),this.$=o[p];break;case 47:_.addContainer("container",...o[p]),this.$=o[p];break;case 48:_.addContainer("container_db",...o[p]),this.$=o[p];break;case 49:_.addContainer("container_queue",...o[p]),this.$=o[p];break;case 50:_.addContainer("external_container",...o[p]),this.$=o[p];break;case 51:_.addContainer("external_container_db",...o[p]),this.$=o[p];break;case 52:_.addContainer("external_container_queue",...o[p]),this.$=o[p];break;case 53:_.addComponent("component",...o[p]),this.$=o[p];break;case 54:_.addComponent("component_db",...o[p]),this.$=o[p];break;case 55:_.addComponent("component_queue",...o[p]),this.$=o[p];break;case 56:_.addComponent("external_component",...o[p]),this.$=o[p];break;case 57:_.addComponent("external_component_db",...o[p]),this.$=o[p];break;case 58:_.addComponent("external_component_queue",...o[p]),this.$=o[p];break;case 60:_.addRel("rel",...o[p]),this.$=o[p];break;case 61:_.addRel("birel",...o[p]),this.$=o[p];break;case 62:_.addRel("rel_u",...o[p]),this.$=o[p];break;case 63:_.addRel("rel_d",...o[p]),this.$=o[p];break;case 64:_.addRel("rel_l",...o[p]),this.$=o[p];break;case 65:_.addRel("rel_r",...o[p]),this.$=o[p];break;case 66:_.addRel("rel_b",...o[p]),this.$=o[p];break;case 67:o[p].splice(0,1),_.addRel("rel",...o[p]),this.$=o[p];break;case 68:_.updateElStyle("update_el_style",...o[p]),this.$=o[p];break;case 69:_.updateRelStyle("update_rel_style",...o[p]),this.$=o[p];break;case 70:_.updateLayoutConfig("update_layout_config",...o[p]),this.$=o[p];break;case 71:this.$=[o[p]];break;case 72:o[p].unshift(o[p-1]),this.$=o[p];break;case 73:case 75:this.$=o[p].trim();break;case 74:let vt={};vt[o[p-1].trim()]=o[p].trim(),this.$=vt;break;case 76:this.$="";break}},"anonymous"),"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:s,24:r,26:u,28:i,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{13:70,19:20,20:21,21:22,22:e,23:s,24:r,26:u,28:i,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{13:71,19:20,20:21,21:22,22:e,23:s,24:r,26:u,28:i,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{13:72,19:20,20:21,21:22,22:e,23:s,24:r,26:u,28:i,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{13:73,19:20,20:21,21:22,22:e,23:s,24:r,26:u,28:i,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{14:[1,74]},t(Rt,[2,13],{43:23,29:49,30:61,32:62,20:75,34:n,36:l,37:a,38:h,39:y,40:f,41:b,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t}),t(Rt,[2,14]),t(qt,[2,16],{12:[1,76]}),t(Rt,[2,36],{12:[1,77]}),t(Pt,[2,19]),t(Pt,[2,20]),{25:[1,78]},{27:[1,79]},t(Pt,[2,23]),{35:80,75:81,76:S,77:T,79:k,80:C},{35:86,75:81,76:S,77:T,79:k,80:C},{35:87,75:81,76:S,77:T,79:k,80:C},{35:88,75:81,76:S,77:T,79:k,80:C},{35:89,75:81,76:S,77:T,79:k,80:C},{35:90,75:81,76:S,77:T,79:k,80:C},{35:91,75:81,76:S,77:T,79:k,80:C},{35:92,75:81,76:S,77:T,79:k,80:C},{35:93,75:81,76:S,77:T,79:k,80:C},{35:94,75:81,76:S,77:T,79:k,80:C},{35:95,75:81,76:S,77:T,79:k,80:C},{35:96,75:81,76:S,77:T,79:k,80:C},{35:97,75:81,76:S,77:T,79:k,80:C},{35:98,75:81,76:S,77:T,79:k,80:C},{35:99,75:81,76:S,77:T,79:k,80:C},{35:100,75:81,76:S,77:T,79:k,80:C},{35:101,75:81,76:S,77:T,79:k,80:C},{35:102,75:81,76:S,77:T,79:k,80:C},{35:103,75:81,76:S,77:T,79:k,80:C},{35:104,75:81,76:S,77:T,79:k,80:C},t(R,[2,59]),{35:105,75:81,76:S,77:T,79:k,80:C},{35:106,75:81,76:S,77:T,79:k,80:C},{35:107,75:81,76:S,77:T,79:k,80:C},{35:108,75:81,76:S,77:T,79:k,80:C},{35:109,75:81,76:S,77:T,79:k,80:C},{35:110,75:81,76:S,77:T,79:k,80:C},{35:111,75:81,76:S,77:T,79:k,80:C},{35:112,75:81,76:S,77:T,79:k,80:C},{35:113,75:81,76:S,77:T,79:k,80:C},{35:114,75:81,76:S,77:T,79:k,80:C},{35:115,75:81,76:S,77:T,79:k,80:C},{20:116,29:49,30:61,32:62,34:n,36:l,37:a,38:h,39:y,40:f,41:b,43:23,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t},{12:[1,118],33:[1,117]},{35:119,75:81,76:S,77:T,79:k,80:C},{35:120,75:81,76:S,77:T,79:k,80:C},{35:121,75:81,76:S,77:T,79:k,80:C},{35:122,75:81,76:S,77:T,79:k,80:C},{35:123,75:81,76:S,77:T,79:k,80:C},{35:124,75:81,76:S,77:T,79:k,80:C},{35:125,75:81,76:S,77:T,79:k,80:C},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(Rt,[2,15]),t(qt,[2,17],{21:22,19:130,22:e,23:s,24:r,26:u,28:i}),t(Rt,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:s,24:r,26:u,28:i,34:n,36:l,37:a,38:h,39:y,40:f,41:b,44:v,45:w,46:A,47:O,48:P,49:M,50:q,51:H,52:Q,53:K,54:G,55:J,56:Z,57:$,58:tt,59:et,60:nt,61:st,62:at,63:rt,64:it,65:ot,66:lt,67:ct,68:ut,69:ht,70:dt,71:pt,72:ft,73:yt,74:_t}),t(Pt,[2,21]),t(Pt,[2,22]),t(R,[2,39]),t(le,[2,71],{75:81,35:132,76:S,77:T,79:k,80:C}),t(Vt,[2,73]),{78:[1,133]},t(Vt,[2,75]),t(Vt,[2,76]),t(R,[2,40]),t(R,[2,41]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(R,[2,52]),t(R,[2,53]),t(R,[2,54]),t(R,[2,55]),t(R,[2,56]),t(R,[2,57]),t(R,[2,58]),t(R,[2,60]),t(R,[2,61]),t(R,[2,62]),t(R,[2,63]),t(R,[2,64]),t(R,[2,65]),t(R,[2,66]),t(R,[2,67]),t(R,[2,68]),t(R,[2,69]),t(R,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(xt,[2,28]),t(xt,[2,29]),t(xt,[2,30]),t(xt,[2,31]),t(xt,[2,32]),t(xt,[2,33]),t(xt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(qt,[2,18]),t(Rt,[2,38]),t(le,[2,72]),t(Vt,[2,74]),t(R,[2,24]),t(R,[2,35]),t(Ht,[2,25]),t(Ht,[2,26],{12:[1,138]}),t(Ht,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:d(N(function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},"parseError"),"parseError"),parse:d(N(function(m){var x=this,E=[0],_=[],D=[null],o=[],Nt=this.table,p="",vt=0,ce=0,Ne=2,ue=1,Ae=o.slice.call(arguments,1),L=Object.create(this.lexer),Et={yy:{}};for(var Kt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Kt)&&(Et.yy[Kt]=this.yy[Kt]);L.setInput(m,Et.yy),Et.yy.lexer=L,Et.yy.parser=this,typeof L.yylloc>"u"&&(L.yylloc={});var Gt=L.yylloc;o.push(Gt);var Le=L.options&&L.options.ranges;typeof Et.yy.parseError=="function"?this.parseError=Et.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function he(V){E.length=E.length-2*V,D.length=D.length-V,o.length=o.length-V}N(he,"popStack"),d(he,"popStack");function Jt(){var V;return V=_.pop()||L.lex()||ue,typeof V!="number"&&(V instanceof Array&&(_=V,V=_.pop()),V=x.symbols_[V]||V),V}N(Jt,"lex"),d(Jt,"lex");for(var B,St,F,Zt,wt={},Ft,z,de,Yt;;){if(St=E[E.length-1],this.defaultActions[St]?F=this.defaultActions[St]:((B===null||typeof B>"u")&&(B=Jt()),F=Nt[St]&&Nt[St][B]),typeof F>"u"||!F.length||!F[0]){var $t="";Yt=[];for(Ft in Nt[St])this.terminals_[Ft]&&Ft>Ne&&Yt.push("'"+this.terminals_[Ft]+"'");L.showPosition?$t="Parse error on line "+(vt+1)+`:
|
|
2
|
-
`+L.showPosition()+`
|
|
3
|
-
Expecting `+Yt.join(", ")+", got '"+(this.terminals_[B]||B)+"'":$t="Parse error on line "+(vt+1)+": Unexpected "+(B==ue?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError($t,{text:L.match,token:this.terminals_[B]||B,line:L.yylineno,loc:Gt,expected:Yt})}if(F[0]instanceof Array&&F.length>1)throw new Error("Parse Error: multiple actions possible at state: "+St+", token: "+B);switch(F[0]){case 1:E.push(B),D.push(L.yytext),o.push(L.yylloc),E.push(F[1]),B=null,ce=L.yyleng,p=L.yytext,vt=L.yylineno,Gt=L.yylloc;break;case 2:if(z=this.productions_[F[1]][1],wt.$=D[D.length-z],wt._$={first_line:o[o.length-(z||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(z||1)].first_column,last_column:o[o.length-1].last_column},Le&&(wt._$.range=[o[o.length-(z||1)].range[0],o[o.length-1].range[1]]),Zt=this.performAction.apply(wt,[p,ce,vt,Et.yy,F[1],D,o].concat(Ae)),typeof Zt<"u")return Zt;z&&(E=E.slice(0,-1*z*2),D=D.slice(0,-1*z),o=o.slice(0,-1*z)),E.push(this.productions_[F[1]][0]),D.push(wt.$),o.push(wt._$),de=Nt[E[E.length-2]][E[E.length-1]],E.push(de);break;case 3:return!0}}return!0},"parse"),"parse")},De=(function(){var bt={EOF:1,parseError:d(N(function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},"parseError"),"parseError"),setInput:d(function(m,x){return this.yy=x||this.yy||{},this._input=m,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:d(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var x=m.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:d(function(m){var x=m.length,E=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var _=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),E.length-1&&(this.yylineno-=E.length-1);var D=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:E?(E.length===_.length?this.yylloc.first_column:0)+_[_.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[D[0],D[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(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:d(function(m){this.unput(this.match.slice(m))},"less"),pastInput:d(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var m=this.pastInput(),x=new Array(m.length+1).join("-");return m+this.upcomingInput()+`
|
|
5
|
-
`+x+"^"},"showPosition"),test_match:d(function(m,x){var E,_,D;if(this.options.backtrack_lexer&&(D={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&&(D.yylloc.range=this.yylloc.range.slice(0))),_=m[0].match(/(?:\r\n?|\n).*/g),_&&(this.yylineno+=_.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:_?_[_.length-1].length-_[_.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,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(m[0].length),this.matched+=m[0],E=this.performAction.call(this,this.yy,this,x,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var o in D)this[o]=D[o];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,x,E,_;this._more||(this.yytext="",this.match="");for(var D=this._currentRules(),o=0;o<D.length;o++)if(E=this._input.match(this.rules[D[o]]),E&&(!x||E[0].length>x[0].length)){if(x=E,_=o,this.options.backtrack_lexer){if(m=this.test_match(E,D[o]),m!==!1)return m;if(this._backtrack){x=!1;continue}else return!1}else if(!this.options.flex)break}return x?(m=this.test_match(x,D[_]),m!==!1?m:!1):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:d(N(function(){var x=this.next();return x||this.lex()},"lex"),"lex"),begin:d(N(function(x){this.conditionStack.push(x)},"begin"),"begin"),popState:d(N(function(){var x=this.conditionStack.length-1;return x>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),"popState"),_currentRules:d(N(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"),"_currentRules"),topState:d(N(function(x){return x=this.conditionStack.length-1-Math.abs(x||0),x>=0?this.conditionStack[x]:"INITIAL"},"topState"),"topState"),pushState:d(N(function(x){this.begin(x)},"pushState"),"pushState"),stateStackSize:d(N(function(){return this.conditionStack.length},"stateStackSize"),"stateStackSize"),options:{},performAction:d(N(function(x,E,_,D){switch(_){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:break;case 14:c;break;case 15:return 12;case 16:break;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:return this.begin("node"),39;case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:return this.begin("rel_u"),66;case 53:return this.begin("rel_u"),66;case 54:return this.begin("rel_d"),67;case 55:return this.begin("rel_d"),67;case 56:return this.begin("rel_l"),68;case 57:return this.begin("rel_l"),68;case 58:return this.begin("rel_r"),69;case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:this.popState(),this.popState();break;case 69:return 80;case 70:break;case 71:return 80;case 72:this.begin("string");break;case 73:this.popState();break;case 74:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 79:this.popState(),this.popState();break;case 80:return"STR";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}};return bt})();Qt.lexer=De;function Dt(){this.yy={}}return N(Dt,"Parser"),d(Dt,"Parser"),Dt.prototype=Qt,Qt.Parser=Dt,new Dt})();jt.parser=jt;var We=jt,xe=d(t=>Ot()[t],"getRequiredConfig"),Ct=d((t,e)=>{for(const[s,r]of Object.entries(e))if(r!==void 0)if(typeof r=="object"){const[u,i]=Object.entries(r)[0];t[u]=i}else t[s]=r},"assignAttributes"),ve=d(()=>({alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}),"createGlobalBoundary"),U=[],mt=[""],I="global",Y="",j=[ve()],Bt=[],ie="",oe=!1,zt=4,Wt=2,Ee,Xe=d(function(){return Ee},"getC4Type"),qe=d(function(t){Ee=ge(t,Ot())},"setC4Type"),He=d(function(t,e,s,r,u,i,n,l,a){if(t==null||e===void 0||e===null||s===void 0||s===null||r===void 0||r===null)return;let h={};const y=Bt.find(f=>f.from===e&&f.to===s);if(y?h=y:Bt.push(h),h.type=t,h.from=e,h.to=s,h.label={text:r},u==null)h.techn={text:""};else if(typeof u=="object"){const[f,b]=Object.entries(u)[0];h[f]={text:b}}else h.techn={text:u};if(i==null)h.descr={text:""};else if(typeof i=="object"){const[f,b]=Object.entries(i)[0];h[f]={text:b}}else h.descr={text:i};Ct(h,{sprite:n,tags:l,link:a}),h.wrap=gt()},"addRel"),Qe=d(function(t,e,s,r,u,i,n){if(e===null||s===null)return;let l={};const a=U.find(h=>h.alias===e);if(a&&e===a.alias?l=a:(l.alias=e,U.push(l)),s==null?l.label={text:""}:l.label={text:s},r==null)l.descr={text:""};else if(typeof r=="object"){const[h,y]=Object.entries(r)[0];l[h]={text:y}}else l.descr={text:r};Ct(l,{sprite:u,tags:i,link:n}),l.typeC4Shape={text:t},l.parentBoundary=I,l.wrap=gt()},"addPersonOrSystem"),Ke=d(function(t,e,s,r,u,i,n,l){if(e===null||s===null)return;let a={};const h=U.find(y=>y.alias===e);if(h&&e===h.alias?a=h:(a.alias=e,U.push(a)),s==null?a.label={text:""}:a.label={text:s},r==null)a.techn={text:""};else if(typeof r=="object"){const[y,f]=Object.entries(r)[0];a[y]={text:f}}else a.techn={text:r};if(u==null)a.descr={text:""};else if(typeof u=="object"){const[y,f]=Object.entries(u)[0];a[y]={text:f}}else a.descr={text:u};Ct(a,{sprite:i,tags:n,link:l}),a.wrap=gt(),a.typeC4Shape={text:t},a.parentBoundary=I},"addContainer"),Ge=d(function(t,e,s,r,u,i,n,l){if(e===null||s===null)return;let a={};const h=U.find(y=>y.alias===e);if(h&&e===h.alias?a=h:(a.alias=e,U.push(a)),s==null?a.label={text:""}:a.label={text:s},r==null)a.techn={text:""};else if(typeof r=="object"){const[y,f]=Object.entries(r)[0];a[y]={text:f}}else a.techn={text:r};if(u==null)a.descr={text:""};else if(typeof u=="object"){const[y,f]=Object.entries(u)[0];a[y]={text:f}}else a.descr={text:u};Ct(a,{sprite:i,tags:n,link:l}),a.wrap=gt(),a.typeC4Shape={text:t},a.parentBoundary=I},"addComponent"),Je=d(function(t,e,s,r,u){if(t===null||e===null)return;let i={};const n=j.find(l=>l.alias===t);if(n&&t===n.alias?i=n:(i.alias=t,j.push(i)),e==null?i.label={text:""}:i.label={text:e},s==null)i.type={text:"system"};else if(typeof s=="object"){const[l,a]=Object.entries(s)[0];i[l]={text:a}}else i.type={text:s};Ct(i,{tags:r,link:u}),i.parentBoundary=I,i.wrap=gt(),Y=I,I=t,mt.push(Y)},"addPersonOrSystemBoundary"),Ze=d(function(t,e,s,r,u){if(t===null||e===null)return;let i={};const n=j.find(l=>l.alias===t);if(n&&t===n.alias?i=n:(i.alias=t,j.push(i)),e==null?i.label={text:""}:i.label={text:e},s==null)i.type={text:"container"};else if(typeof s=="object"){const[l,a]=Object.entries(s)[0];i[l]={text:a}}else i.type={text:s};Ct(i,{tags:r,link:u}),i.parentBoundary=I,i.wrap=gt(),Y=I,I=t,mt.push(Y)},"addContainerBoundary"),$e=d(function(t,e,s,r,u,i,n,l){if(e===null||s===null)return;let a={};const h=j.find(y=>y.alias===e);if(h&&e===h.alias?a=h:(a.alias=e,j.push(a)),s==null?a.label={text:""}:a.label={text:s},r==null)a.type={text:"node"};else if(typeof r=="object"){const[y,f]=Object.entries(r)[0];a[y]={text:f}}else a.type={text:r};if(u==null)a.descr={text:""};else if(typeof u=="object"){const[y,f]=Object.entries(u)[0];a[y]={text:f}}else a.descr={text:u};Ct(a,{tags:n,link:l}),a.nodeType=t,a.parentBoundary=I,a.wrap=gt(),Y=I,I=e,mt.push(Y)},"addDeploymentNode"),t0=d(function(){I=Y,mt.pop(),Y=mt.pop(),mt.push(Y)},"popBoundaryParseStack"),e0=d(function(t,e,s,r,u,i,n,l,a,h,y){let f=U.find(b=>b.alias===e);if(!(f===void 0&&(f=j.find(b=>b.alias===e),f===void 0))){if(s!=null)if(typeof s=="object"){const[b,v]=Object.entries(s)[0];f[b]=v}else f.bgColor=s;if(r!=null)if(typeof r=="object"){const[b,v]=Object.entries(r)[0];f[b]=v}else f.fontColor=r;if(u!=null)if(typeof u=="object"){const[b,v]=Object.entries(u)[0];f[b]=v}else f.borderColor=u;if(i!=null)if(typeof i=="object"){const[b,v]=Object.entries(i)[0];f[b]=v}else f.shadowing=i;if(n!=null)if(typeof n=="object"){const[b,v]=Object.entries(n)[0];f[b]=v}else f.shape=n;if(l!=null)if(typeof l=="object"){const[b,v]=Object.entries(l)[0];f[b]=v}else f.sprite=l;if(a!=null)if(typeof a=="object"){const[b,v]=Object.entries(a)[0];f[b]=v}else f.techn=a;if(h!=null)if(typeof h=="object"){const[b,v]=Object.entries(h)[0];f[b]=v}else f.legendText=h;if(y!=null)if(typeof y=="object"){const[b,v]=Object.entries(y)[0];f[b]=v}else f.legendSprite=y}},"updateElStyle"),n0=d(function(t,e,s,r,u,i,n){const l=Bt.find(a=>a.from===e&&a.to===s);if(l!==void 0){if(r!=null)if(typeof r=="object"){const[a,h]=Object.entries(r)[0];l[a]=h}else l.textColor=r;if(u!=null)if(typeof u=="object"){const[a,h]=Object.entries(u)[0];l[a]=h}else l.lineColor=u;if(i!=null)if(typeof i=="object"){const[a,h]=Object.entries(i)[0];l[a]=parseInt(h)}else l.offsetX=parseInt(i);if(n!=null)if(typeof n=="object"){const[a,h]=Object.entries(n)[0];l[a]=parseInt(h)}else l.offsetY=parseInt(n)}},"updateRelStyle"),s0=d(function(t,e,s){let r=zt,u=Wt;if(typeof e=="object"){const i=Object.values(e)[0];r=parseInt(i)}else r=parseInt(e);if(typeof s=="object"){const i=Object.values(s)[0];u=parseInt(i)}else u=parseInt(s);r>=1&&(zt=r),u>=1&&(Wt=u)},"updateLayoutConfig"),a0=d(function(){return zt},"getC4ShapeInRow"),r0=d(function(){return Wt},"getC4BoundaryInRow"),i0=d(function(){return I},"getCurrentBoundaryParse"),o0=d(function(){return Y},"getParentBoundaryParse"),Se=d(function(t){return t==null?U:U.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),l0=d(function(t){return U.find(e=>e.alias===t)},"getC4Shape"),c0=d(function(t){return Object.keys(Se(t))},"getC4ShapeKeys"),Te=d(function(t){return t==null?j:j.filter(e=>e.parentBoundary===t)},"getBoundaries"),u0=Te,h0=d(function(){return Bt},"getRels"),d0=d(function(){return ie},"getTitle"),p0=d(function(t){oe=t},"setWrap"),gt=d(function(){return oe},"autoWrap"),f0=d(function(){U=[],j=[ve()],Y="",I="global",mt=[""],Bt=[],mt=[""],ie="",oe=!1,zt=4,Wt=2},"clear"),y0={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},_0={FILLED:0,OPEN:1},b0={LEFTOF:0,RIGHTOF:1,OVER:2},m0=d(function(t){ie=ge(t,Ot())},"setTitle"),se={addPersonOrSystem:Qe,addPersonOrSystemBoundary:Je,addContainer:Ke,addContainerBoundary:Ze,addComponent:Ge,addDeploymentNode:$e,popBoundaryParseStack:t0,addRel:He,updateElStyle:e0,updateRelStyle:n0,updateLayoutConfig:s0,autoWrap:gt,setWrap:p0,getC4ShapeArray:Se,getC4Shape:l0,getC4ShapeKeys:c0,getBoundaries:Te,getBoundarys:u0,getCurrentBoundaryParse:i0,getParentBoundaryParse:o0,getRels:h0,getTitle:d0,getC4Type:Xe,getC4ShapeInRow:a0,getC4BoundaryInRow:r0,setAccTitle:Fe,getAccTitle:Ve,getAccDescription:Be,setAccDescription:Me,getConfig:d(()=>xe("c4"),"getConfig"),clear:f0,LINETYPE:y0,ARROWTYPE:_0,PLACEMENT:b0,setTitle:m0,setC4Type:qe},ke=d(function(t,e){return Ie(t,e)},"drawRect"),g0=d((t,e,s,r)=>{const u=t.append("g");let i=0;for(const n of e){const l=n.textColor?n.textColor:"#444444",a=n.lineColor?n.lineColor:"#444444",h=n.offsetX?parseInt(String(n.offsetX)):0,y=n.offsetY?parseInt(String(n.offsetY)):0,f="";if(i===0){const w=u.append("line");w.attr("x1",n.startPoint.x),w.attr("y1",n.startPoint.y),w.attr("x2",n.endPoint.x),w.attr("y2",n.endPoint.y),w.attr("stroke-width","1"),w.attr("stroke",a),w.style("fill","none"),n.type!=="rel_b"&&w.attr("marker-end","url("+f+"#"+r+"-arrowhead)"),(n.type==="birel"||n.type==="rel_b")&&w.attr("marker-start","url("+f+"#"+r+"-arrowend)"),i=-1}else{const w=u.append("path");w.attr("fill","none").attr("stroke-width","1").attr("stroke",a).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",n.startPoint.x).replaceAll("starty",n.startPoint.y).replaceAll("controlx",n.startPoint.x+(n.endPoint.x-n.startPoint.x)/2-(n.endPoint.x-n.startPoint.x)/4).replaceAll("controly",n.startPoint.y+(n.endPoint.y-n.startPoint.y)/2).replaceAll("stopx",n.endPoint.x).replaceAll("stopy",n.endPoint.y)),n.type!=="rel_b"&&w.attr("marker-end","url("+f+"#"+r+"-arrowhead)"),(n.type==="birel"||n.type==="rel_b")&&w.attr("marker-start","url("+f+"#"+r+"-arrowend)")}const b=n.label.width;let v=s.messageFont();Lt(s)(n.label.text,u,Math.min(n.startPoint.x,n.endPoint.x)+Math.abs(n.endPoint.x-n.startPoint.x)/2+h,Math.min(n.startPoint.y,n.endPoint.y)+Math.abs(n.endPoint.y-n.startPoint.y)/2+y,b,n.label.height,{fill:l},v),n.techn&&n.techn.text!==""&&(v=s.messageFont(),Lt(s)("["+n.techn.text+"]",u,Math.min(n.startPoint.x,n.endPoint.x)+Math.abs(n.endPoint.x-n.startPoint.x)/2+h,Math.min(n.startPoint.y,n.endPoint.y)+Math.abs(n.endPoint.y-n.startPoint.y)/2+s.messageFontSize+5+y,Math.max(b,n.techn.width),n.techn.height,{fill:l,"font-style":"italic"},v))}},"drawRels"),x0=d(function(t,e,s){const r=t.append("g"),u=e.bgColor?e.bgColor:"none",i=e.borderColor?e.borderColor:"#444444",n=e.fontColor?e.fontColor:"black";let l={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(l={"stroke-width":1});const a={x:e.x,y:e.y,fill:u,stroke:i,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:l};ke(r,a);let h=s.boundaryFont();h.fontWeight="bold",h.fontSize=h.fontSize+2,h.fontColor=n,Lt(s)(e.label.text,r,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},h),e.type&&e.type.text!==""&&(h=s.boundaryFont(),h.fontColor=n,Lt(s)(e.type.text,r,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},h)),e.descr&&e.descr.text!==""&&(h=s.boundaryFont(),h.fontSize=h.fontSize-2,h.fontColor=n,Lt(s)(e.descr.text,r,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},h))},"drawBoundary"),v0=d(function(t,e){t.append("defs").append("symbol").attr("id",e+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),E0=d(function(t,e){t.append("defs").append("symbol").attr("id",e+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),S0=d(function(t,e){t.append("defs").append("symbol").attr("id",e+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),T0=d(function(t,e){t.append("defs").append("marker").attr("id",e+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),k0=d(function(t,e){t.append("defs").append("marker").attr("id",e+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),C0=d(function(t,e){t.append("defs").append("marker").attr("id",e+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),R0=d(function(t,e){const r=t.append("defs").append("marker").attr("id",e+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);r.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),r.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),Lt=(function(){function t(u,i,n,l,a,h,y){const f=i.append("text").attr("x",n+a/2).attr("y",l+h/2+5).style("text-anchor","middle").text(u);r(f,y)}N(t,"byText"),d(t,"byText");function e(u,i,n,l,a,h,y,f){const{fontSize:b,fontFamily:v,fontWeight:w}=f,A=u.split(ne.lineBreakRegex);for(let O=0;O<A.length;O++){const P=O*b-b*(A.length-1)/2,M=i.append("text").attr("x",n+a/2).attr("y",l).style("text-anchor","middle").attr("dominant-baseline","middle").style("font-size",b).style("font-weight",w).style("font-family",v);M.append("tspan").attr("dy",P).text(A[O]).attr("alignment-baseline","mathematical"),r(M,y)}}N(e,"byTspan"),d(e,"byTspan");function s(u,i,n,l,a,h,y,f){const b=i.append("switch"),w=b.append("foreignObject").attr("x",n).attr("y",l).attr("width",a).attr("height",h).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");w.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(u),e(u,b,n,l,a,h,y,f),r(w,y)}N(s,"byFo"),d(s,"byFo");function r(u,i){for(const n in i)i.hasOwnProperty(n)&&u.attr(n,i[n])}return N(r,"_setTextAttrs"),d(r,"_setTextAttrs"),function(u){return u.textPlacement==="fo"?s:u.textPlacement==="old"?t:e}})(),W={drawRect:ke,drawBoundary:x0,drawRels:g0,insertArrowHead:T0,insertArrowEnd:k0,insertArrowFilledHead:C0,insertArrowCrossHead:R0,insertDatabaseIcon:v0,insertComputerIcon:E0,insertClockIcon:S0},w0=d((t,e)=>{if(e==="sandbox"){const r=te("#i"+t).node()?.contentDocument;if(!r)throw new Error(`Sandbox iframe #i${t} is missing its content document`);return{root:te(r.body),doc:r}}return{root:te("body"),doc:document}},"getDiagramRoot"),O0=new Set(["system_queue","external_system_queue","container_queue","external_container_queue","component_queue","external_component_queue"]),P0=new Set(["system_db","external_system_db","container_db","external_container_db","component_db","external_component_db"]),D0={person:"person",box:"rounded",rounded:"rounded",cylinder:"cylinder",database:"cylinder",db:"cylinder",queue:"h-cyl",pipe:"h-cyl",component:"fr-rect"},ee=d(t=>t?D0[t.toLowerCase()]:void 0,"keywordShape"),N0=d(t=>{const e=ee(t.shape)??ee(t.sprite);if(e)return e;if(t.tags)for(const r of t.tags.split(",")){const u=ee(r.trim());if(u)return u}const s=t.typeC4Shape.text;return s==="person"||s==="external_person"?"person":P0.has(s)?"cylinder":O0.has(s)?"h-cyl":"rounded"},"resolveNodeShape"),A0={person:"Person",system:"Software System",container:"Container",component:"Component"},L0=d(t=>{const e=t.replace(/^external_/,"").replace(/_(db|queue)$/,"");return A0[e]??e.replace(/_/g," ")},"stereotypeLabel"),I0=d(t=>t.startsWith("external_"),"isExternal"),M0=d(t=>{const e=L0(t.typeC4Shape.text);return t.techn?.text?`[${e}: ${t.techn.text}]`:`[${e}]`},"stereotypeText"),Ce=["person","system","system_db","system_queue","container","container_db","container_queue","component","component_db","component_queue"].flatMap(t=>[t,`external_${t}`]),B0=new Set(Ce),ye=d(t=>B0.has(t),"isC4ElementType"),V0=d((t,e)=>{const s=t.typeC4Shape.text,r=t.bgColor??(ye(s)&&e[`${s}_bg_color`]),u=t.borderColor??(ye(s)&&e[`${s}_border_color`]),i=[];return r&&i.push(`fill:${r}`),u&&i.push(`stroke:${u}`),i.push(`color:${t.fontColor??"#FFFFFF"}`),i},"elementCssStyles"),_e=d((t,e,s,r,u)=>{const i=t.typeC4Shape.text,n=["c4-shape",`c4-${i}`];I0(i)&&n.push("c4-external");const l=N0(t),a=V0(t,e);return(l==="rounded"||l==="fr-rect")&&a.push("rx:12px","ry:12px"),{id:t.alias,label:t.label.text,stereotype:M0(t),description:t.descr?.text?[t.descr.text]:void 0,labelType:"string",isGroup:!1,shape:l,cssClasses:n.join(" "),cssStyles:a,padding:s,look:r,useHtmlLabels:!1,width:u}},"buildC4Node"),It=0,Mt=0,Re=4,ae=2;jt.yy=se;var g={},Tt,we=(Tt=class{constructor(e){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,re(e.db.getConfig())}setData(e,s,r,u){this.nextData.startx=this.data.startx=e,this.nextData.stopx=this.data.stopx=s,this.nextData.starty=this.data.starty=r,this.nextData.stopy=this.data.stopy=u}updateVal(e,s,r,u){e[s]===void 0?e[s]=r:e[s]=u(r,e[s])}insert(e){this.nextData.cnt=this.nextData.cnt+1;const s=this.nextData.stopx,r=this.data.widthLimit;let u=this.nextData.startx===this.nextData.stopx?s+e.margin:s+e.margin*2,i=u+e.width,n=this.nextData.starty+e.margin*2,l=n+e.height;(u>=r||i>=r||this.nextData.cnt>Re)&&(u=this.nextData.startx+e.margin+g.nextLinePaddingX,n=this.nextData.stopy+e.margin*2,this.nextData.stopx=i=u+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=l=n+e.height,this.nextData.cnt=1),e.x=u,e.y=n,this.updateVal(this.data,"startx",u,Math.min),this.updateVal(this.data,"starty",n,Math.min),this.updateVal(this.data,"stopx",i,Math.max),this.updateVal(this.data,"stopy",l,Math.max),this.updateVal(this.nextData,"startx",u,Math.min),this.updateVal(this.nextData,"starty",n,Math.min),this.updateVal(this.nextData,"stopx",i,Math.max),this.updateVal(this.nextData,"stopy",l,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},re(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},N(Tt,"Bounds"),d(Tt,"Bounds"),Tt),re=d(function(t){Ue(g,t),t?.fontFamily&&(g.personFontFamily=g.systemFontFamily=g.messageFontFamily=t.fontFamily),t?.fontSize&&(g.personFontSize=g.systemFontSize=g.messageFontSize=t.fontSize),t?.fontWeight&&(g.personFontWeight=g.systemFontWeight=g.messageFontWeight=t.fontWeight)},"setConf"),Ut=d(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),F0=d(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");function X(t,e,s,r,u){const i=e[t];if(!i.width)if(s)i.text=je(i.text,u,r),i.textLines=i.text.split(ne.lineBreakRegex).length,i.width=u,i.height=fe(i.text,r);else{const n=i.text.split(ne.lineBreakRegex);i.textLines=n.length;let l=0;i.height=0,i.width=0;for(const a of n)i.width=Math.max(At(a,r),i.width),l=fe(a,r),i.height=i.height+l}return i}N(X,"calcC4ShapeTextWH");d(X,"calcC4ShapeTextWH");var Oe=d(function(t,e,s){const r=s.data.startx,u=s.data.starty;e.x=r,e.y=u,e.width=s.data.stopx-r,e.height=s.data.stopy-u,e.label.y=g.c4ShapeMargin-35;const i=e.wrap&&g.wrap,n=Ut(g);n.fontSize=n.fontSize+2,n.fontWeight="bold";const l=At(e.label.text,n);X("label",e,i,n,l),W.drawBoundary(t,e,g)},"drawBoundary"),Pe=d(async function(t,e,s,r){const u=Ot(),i=u.look??"classic",n={config:u},l=e.attr("id")??"",a=r.map(y=>s[Number(y)]),h=d(y=>{const f=y.shape?ze[y.shape]:void 0;if(!f)throw new Error(`C4: no shape handler for "${y.shape}"`);return f},"shapeHandlerFor");await Promise.all(a.map(async y=>{const f=_e(y,g,g.c4ShapePadding,i,g.width);f.domId=`${l}-${f.id}`;const b=await h(f)(e,f,n);y.width=f.width??g.width,y.height=f.height??g.height,y.margin=g.c4ShapeMargin,b.remove()}));for(const y of a)t.insert(y);await Promise.all(a.map(async y=>{const f=_e(y,g,g.c4ShapePadding,i,g.width);f.domId=`${l}-${f.id}`,f.x=y.x+y.width/2,f.y=y.y+y.height/2;const b=e.append("g").attr("transform",`translate(${y.x+y.width/2}, ${y.y+y.height/2})`);await h(f)(b,f,n),y.intersect=f.intersect})),t.bumpLastMargin(g.c4ShapeMargin)},"drawC4ShapeArray"),kt,Y0=(kt=class{constructor(e,s){this.x=e,this.y=s}},N(kt,"Point"),d(kt,"Point"),kt),be=d(function(t,e){if(!t.intersect)throw new Error(`C4 shape "${t.alias}" has no intersect function. Please report this to https://github.com/mermaid-js/mermaid/issues`);const{x:s,y:r}=t.intersect(e);return new Y0(s,r)},"getIntersectPoint"),U0=d(function(t,e){const s={x:0,y:0};s.x=e.x+e.width/2,s.y=e.y+e.height/2;const r=be(t,s);s.x=t.x+t.width/2,s.y=t.y+t.height/2;const u=be(e,s);return{startPoint:r,endPoint:u}},"getIntersectPoints"),j0=d(function(t,e,s,r,u){const i=r.db.getC4Type();let n=0;for(const l of e){n=n+1;const a=l.wrap&&g.wrap,h=F0(g);i==="C4Dynamic"&&(l.label.text=n+": "+l.label.text);let y=At(l.label.text,h);X("label",l,a,h,y),l.techn&&l.techn.text!==""&&(y=At(l.techn.text,h),X("techn",l,a,h,y)),l.descr&&l.descr.text!==""&&(y=At(l.descr.text,h),X("descr",l,a,h,y));const f=s(l.from),b=s(l.to);if(!f||!b)throw new Error(`C4 rel "${l.from}" -> "${l.to}" references an unknown shape`);const v=U0(f,b);if(!v.startPoint||!v.endPoint)throw new Error(`Could not calculate intersection points for rel "${l.from}" -> "${l.to}"`);l.startPoint=v.startPoint,l.endPoint=v.endPoint}W.drawRels(t,e,g,u)},"drawRels");async function Xt(t,e,s,r,u){const i=u.db,n=new we(u);n.data.widthLimit=s.data.widthLimit/Math.min(ae,r.length);for(const[l,a]of r.entries()){let h=0;a.image={width:0,height:0,Y:0},a.sprite&&(a.image.width=48,a.image.height=48,a.image.Y=h,h=a.image.Y+a.image.height);const y=a.wrap&&g.wrap,f=Ut(g);f.fontSize=f.fontSize+2,f.fontWeight="bold";const b=X("label",a,y,f,n.data.widthLimit);if(b.Y=h+8,h=b.Y+b.height,a.type&&a.type.text!==""){a.type.text="["+a.type.text+"]";const O=Ut(g),P=X("type",a,y,O,n.data.widthLimit);P.Y=h+5,h=P.Y+P.height}if(a.descr&&a.descr.text!==""){const O=Ut(g);O.fontSize=O.fontSize-2;const P=X("descr",a,y,O,n.data.widthLimit);P.Y=h+20,h=P.Y+P.height}if(l==0||l%ae===0){const O=s.data.startx+g.diagramMarginX,P=s.data.stopy+g.diagramMarginY+h;n.setData(O,O,P,P)}else{const O=n.data.stopx!==n.data.startx?n.data.stopx+g.diagramMarginX:n.data.startx,P=n.data.starty;n.setData(O,O,P,P)}n.name=a.alias;const v=i.getC4ShapeArray(a.alias),w=i.getC4ShapeKeys(a.alias);w.length>0&&await Pe(n,t,v,w),e=a.alias;const A=i.getBoundaries(e);A.length>0&&await Xt(t,e,n,A,u),a.alias!=="global"&&Oe(t,a,n),s.data.stopy=Math.max(n.data.stopy+g.c4ShapeMargin,s.data.stopy),s.data.stopx=Math.max(n.data.stopx+g.c4ShapeMargin,s.data.stopx),It=Math.max(It,s.data.stopx),Mt=Math.max(Mt,s.data.stopy)}}N(Xt,"drawInsideBoundary");d(Xt,"drawInsideBoundary");var z0=d(async function(t,e,s,r){g=xe("c4");const u=Ot().securityLevel,{root:i}=w0(e,u),n=r.db;n.setWrap(g.wrap),Re=n.getC4ShapeInRow(),ae=n.getC4BoundaryInRow(),pe.debug(`C:${JSON.stringify(g,null,2)}`);const l=i.select(`[id="${e}"]`);W.insertComputerIcon(l,e),W.insertDatabaseIcon(l,e),W.insertClockIcon(l,e);const a=new we(r);a.setData(g.diagramMarginX,g.diagramMarginX,g.diagramMarginY,g.diagramMarginY),a.data.widthLimit=screen.availWidth,It=g.diagramMarginX,Mt=g.diagramMarginY;const h=n.getTitle(),y=n.getBoundaries("");await Xt(l,"",a,y,r),W.insertArrowHead(l,e),W.insertArrowEnd(l,e),W.insertArrowCrossHead(l,e),W.insertArrowFilledHead(l,e),j0(l,n.getRels(),n.getC4Shape,r,e),a.data.stopx=It,a.data.stopy=Mt;const f=a.data,b=f.startx,v=f.starty,A=Mt-v+2*g.diagramMarginY,O=It-b,P=O+2*g.diagramMarginX;h&&l.append("text").text(h).attr("x",O/2-4*g.diagramMarginX).attr("y",v+g.diagramMarginY),Ye(l,A,P,g.useMaxWidth);const M=h?60:0;l.attr("viewBox",b-g.diagramMarginX+" -"+(g.diagramMarginY+M)+" "+P+" "+(A+M)),pe.debug("models:",f)},"draw"),me={drawPersonOrSystemArray:Pe,drawBoundary:Oe,setConf:re,draw:z0},W0=d(()=>{const t=Ot().c4??{},e=new CSSStyleSheet;for(const s of Ce){const r=e.cssRules[e.insertRule(`.c4-shape.c4-${s} .label {}`,e.cssRules.length)],u=t[`${s}FontFamily`],i=t[`${s}FontSize`],n=t[`${s}FontWeight`];u&&r.style.setProperty("font-family",u),i&&r.style.setProperty("font-size",typeof i=="number"?`${i}px`:i),n&&r.style.setProperty("font-weight",String(n))}return[...e.cssRules].filter(s=>s.style.length>0).map(s=>` ${s.cssText}`).join(`
|
|
7
|
-
`)},"elementFontStyles"),X0=d(t=>`.person {
|
|
8
|
-
stroke: ${t.personBorder};
|
|
9
|
-
fill: ${t.personBkg};
|
|
10
|
-
}
|
|
11
|
-
${W0()}
|
|
12
|
-
|
|
13
|
-
/* The element font colour is set inline per element (default white); the
|
|
14
|
-
label text takes it via currentColor. */
|
|
15
|
-
.c4-shape .label,
|
|
16
|
-
.c4-shape .label text {
|
|
17
|
-
color: inherit;
|
|
18
|
-
fill: currentColor;
|
|
19
|
-
}
|
|
20
|
-
/* Structurizr typography: bold name, smaller stereotype/type and description lines. */
|
|
21
|
-
.c4-shape .label .c4-name {
|
|
22
|
-
font-weight: bold;
|
|
23
|
-
}
|
|
24
|
-
.c4-shape .label .c4-type {
|
|
25
|
-
font-size: 0.75em;
|
|
26
|
-
}
|
|
27
|
-
.c4-shape .label .c4-descr {
|
|
28
|
-
font-size: 0.82em;
|
|
29
|
-
}
|
|
30
|
-
.c4-shape .basic,
|
|
31
|
-
.c4-shape rect,
|
|
32
|
-
.c4-shape path,
|
|
33
|
-
.c4-shape circle,
|
|
34
|
-
.c4-shape ellipse,
|
|
35
|
-
.c4-shape line {
|
|
36
|
-
stroke-width: 2px;
|
|
37
|
-
}
|
|
38
|
-
`,"getStyles"),q0=X0,G0={parser:We,db:se,renderer:me,styles:q0,init:d(({c4:t,wrap:e})=>{me.setConf(t),se.setWrap(e)},"init")};export{G0 as diagram};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import{p as ht}from"./CQSBplf3.js";import{c6 as gt,aK as $t,aP as bt,c9 as Ct,aL as wt,c7 as vt,f as s,bC as Y,c4 as Dt,a6 as kt,a0 as Tt,$ as U,aN as K,ax as At,aX as ot}from"./BgmOiuVG.js";import{p as Bt}from"./YqyEOqRv.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),Lt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),zt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(Y.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...K().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),X={getDomains:St,getTransitions:Mt,setDomains:Lt,setTransitions:zt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:wt,setDiagramTitle:Ct,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{ht(t,X),X.setDomains(t.domains),X.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);Y.debug(e),It(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,W=e/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*17)*m*2-m;d.push({x:c+p,y:o*W})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,x=m*1.5*b*E(n+o*31+7),R=p.x+x,F=f,V=i.x-x;D+=` C${R},${F} ${V},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,W=t/v,d=[];for(let o=0;o<=v;o++){const p=E(n+o*23)*m*2-m;d.push({x:o*W,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,x=m*1.5*b*E(n+o*37+11),R=f,F=p.y+x,V=f,L=i.y-x;D+=` C${R},${F} ${V},${L} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Ft=s(()=>{const t=ot(),e=K();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Vt=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Ft();Y.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,x=o.showDomainDescriptions,R=o.boundaryAmplitude,F=i+b*2,V=f+b*2,L={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,V,F,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${F} ${V}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),_=Rt(i,f),Q=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),O=["complex","complicated","chaotic","clear"];for(const l of O){const r=_[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",L[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Q,R)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Q+100,R)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",L.confusion).attr("fill-opacity",.5);const Z=T.append("g").attr("class","cynefin-labels");for(const l of O){const r=_[l];Z.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",x?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(Z.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",x?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),x){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of O){const u=_[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const J=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=_[l],y=l==="confusion";let z=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,z=r.items.slice(0,q));let B;if(y){const g=x?22:14;B=u.cy+g}else B=u.cy+(x?25:15);if([...z].forEach((g,S)=>{const C=B+S*(A+4),M=J.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const h=P.node();if(h&&typeof h.getBBox=="function"){const G=h.getBBox();G.width>0&&($=G.width)}const w=$+tt*2,I=u.cx-w/2;M.attr("transform",`translate(${I}, ${C})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",w).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",L[l]).attr("fill-opacity",.95),P.attr("x",w/2).attr("y",A/2)}),N>0){const g=B+z.length*(A+4),S=`+${N} more`,C=J.append("g"),M=C.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const h=P+tt*2,w=u.cx-h/2;C.attr("transform",`translate(${w}, ${g})`),C.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",h).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",L[l]).attr("fill-opacity",.6),M.attr("x",h/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const z=_[y.from],N=_[y.to];if(!z||!N)return;if(y.from===y.to){Y.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=z.cx,g=z.cy,S=N.cx,C=N.cy,M=(B+S)/2,P=(g+C)/2,$=S-B,h=C-g,w=Math.sqrt($*$+h*h),I=w*.15,G=-h/w,xt=$/w,et=M+G*I,nt=P+xt*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${C}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),_t={draw:Vt},Et=s(()=>{const t=ot(),e=K();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
|
|
2
|
-
.cynefinDomain {
|
|
3
|
-
stroke: none;
|
|
4
|
-
}
|
|
5
|
-
.cynefinDomainLabel {
|
|
6
|
-
font-size: ${t.domainFontSize}px;
|
|
7
|
-
font-weight: bold;
|
|
8
|
-
fill: ${t.labelColor};
|
|
9
|
-
}
|
|
10
|
-
.cynefinSubtitle {
|
|
11
|
-
font-size: ${t.itemFontSize-1}px;
|
|
12
|
-
fill: ${t.textColor};
|
|
13
|
-
font-style: italic;
|
|
14
|
-
}
|
|
15
|
-
.cynefinItem {
|
|
16
|
-
fill-opacity: 0.95;
|
|
17
|
-
stroke: ${t.boundaryColor};
|
|
18
|
-
stroke-width: 1;
|
|
19
|
-
}
|
|
20
|
-
.cynefinItemText {
|
|
21
|
-
font-size: ${t.itemFontSize}px;
|
|
22
|
-
fill: ${t.textColor};
|
|
23
|
-
}
|
|
24
|
-
.cynefinItemOverflow {
|
|
25
|
-
fill-opacity: 0.6;
|
|
26
|
-
stroke: ${t.boundaryColor};
|
|
27
|
-
stroke-width: 1;
|
|
28
|
-
stroke-dasharray: 3 2;
|
|
29
|
-
}
|
|
30
|
-
.cynefinBoundary {
|
|
31
|
-
stroke: ${t.boundaryColor};
|
|
32
|
-
stroke-width: ${t.boundaryWidth};
|
|
33
|
-
stroke-dasharray: 6 3;
|
|
34
|
-
}
|
|
35
|
-
.cynefinCliff {
|
|
36
|
-
stroke: ${t.cliffColor};
|
|
37
|
-
stroke-width: ${t.cliffWidth};
|
|
38
|
-
}
|
|
39
|
-
.cynefinConfusion {
|
|
40
|
-
stroke: ${t.boundaryColor};
|
|
41
|
-
stroke-width: 1.5;
|
|
42
|
-
stroke-dasharray: 4 2;
|
|
43
|
-
}
|
|
44
|
-
.cynefinArrowLine {
|
|
45
|
-
stroke: ${t.arrowColor};
|
|
46
|
-
stroke-width: ${t.arrowWidth};
|
|
47
|
-
fill: none;
|
|
48
|
-
}
|
|
49
|
-
.cynefinArrowHead {
|
|
50
|
-
fill: ${t.arrowColor};
|
|
51
|
-
stroke: none;
|
|
52
|
-
}
|
|
53
|
-
.cynefinArrowLabel {
|
|
54
|
-
font-size: ${t.itemFontSize-1}px;
|
|
55
|
-
fill: ${t.textColor};
|
|
56
|
-
}
|
|
57
|
-
.cynefinTitle {
|
|
58
|
-
font-size: ${t.domainFontSize+2}px;
|
|
59
|
-
font-weight: bold;
|
|
60
|
-
fill: ${t.labelColor};
|
|
61
|
-
}
|
|
62
|
-
`},"styles"),Gt=Ht,jt={parser:Wt,db:X,renderer:_t,styles:Gt};export{jt as diagram};
|