@juki-team/base-ui 1.5.14 → 1.5.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/ArrowForwardIcon-BIC54sbk.js +1 -0
- package/dist/esm/BarChart-54h6GU3p.js +1 -0
- package/dist/esm/{CartesianChart-DCv2SXML.js → CartesianChart-cNl_tqN9.js} +1 -1
- package/dist/esm/ChangePasswordModal-DGIG264-.js +1 -0
- package/dist/esm/CodeEditor-C5-1AgZR.js +1 -0
- package/dist/esm/CodeViewer-CQrzGpJT.js +1 -0
- package/dist/esm/Collapse-Cx9QTKZD.js +1 -0
- package/dist/esm/{DataGrid-1GBbtJPo.js → DataGrid-Bu-7Atkf.js} +1 -1
- package/dist/esm/DataViewer-Cv0iOPJ_.js +1 -0
- package/dist/esm/DrawerView-Cbw3l2O7.js +1 -0
- package/dist/esm/ExcalidrawButton-zJFah1nC.js +1 -0
- package/dist/esm/GraphvizViewer-DsTGulG0.js +1 -0
- package/dist/esm/ImageLoaderCropper-Bk1LxSbD.js +1 -0
- package/dist/esm/InputCellPhoneNumber-BaFBGcAe.js +1 -0
- package/dist/esm/{InputColor-UJ28fLOn.js → InputColor-DhUlWGSD.js} +1 -1
- package/dist/esm/LineChart-BQ1UY4l8.js +1 -0
- package/dist/esm/{LoaderLayer-CyitSTCe.js → LoaderLayer-aKmuHFys.js} +1 -1
- package/dist/esm/MdMath-DvH_O_A3.js +1 -0
- package/dist/esm/{MdMathEditor-DWwwX_SO.js → MdMathEditor-4-bjr11C.js} +1 -1
- package/dist/esm/{Popover-CmhtPayh.js → Popover-C0pozkRR.js} +1 -1
- package/dist/esm/ReplyIcon-DFPc1kie.js +1 -0
- package/dist/esm/{SettingsIcon-CegP07CF.js → SettingsIcon-P_1rE3U0.js} +1 -1
- package/dist/esm/SlideDeck-0cxhxG3b.js +1 -0
- package/dist/esm/{TableEyeIcon-C4nuk_xp.js → TableEyeIcon-5qDbI7lU.js} +1 -1
- package/dist/esm/{TableOfContents-B7API9_v.js → TableOfContents-DG7lfEl8.js} +1 -1
- package/dist/esm/Tooltip-OI-qyixa.js +1 -0
- package/dist/esm/UserCodeEditor-XI5CMxYI.js +61 -0
- package/dist/esm/VirtualizedRowsFixed-DH6WrMq1.js +1 -0
- package/dist/esm/WorksheetAsSlides-vK1Nqrlr.js +1 -0
- package/dist/esm/{WorksheetBodies-dstnMykc.js → WorksheetBodies-AupmhX--.js} +1 -1
- package/dist/esm/WorksheetContents-RcU2Wigz.js +1 -0
- package/dist/esm/WorksheetEditor-BExsBWi8.js +1 -0
- package/dist/esm/WorksheetNode-BTU0R61c.js +1 -0
- package/dist/esm/WorksheetViewer-Bn_SoOic.js +1 -0
- package/dist/esm/abnfDiagram-WEYOIA3C-Dpw6XMB5.js +1 -0
- package/dist/esm/{arc-DomqdCJb.js → arc-CVDK40Ip.js} +1 -1
- package/dist/esm/architectureDiagram-ZHVYKT53-CwRCJS-f.js +1 -0
- package/dist/esm/blockDiagram-RJAE7QA3-BsveJL2h.js +1 -0
- package/dist/esm/c4Diagram-XDPPPE54-DT_YwSdM.js +1 -0
- package/dist/esm/channel-DfU2WyO4.js +1 -0
- package/dist/esm/{chunk-2E7WHVMD-Beocb-Jh.js → chunk-2E7WHVMD-CDFgC3vV.js} +1 -1
- package/dist/esm/{chunk-2Q5K7J3B-BvYoUWYj.js → chunk-2Q5K7J3B-kc9wbXRi.js} +1 -1
- package/dist/esm/{chunk-4EMNKR2T-CwTwaoZv.js → chunk-4EMNKR2T-BOCYiV20.js} +1 -1
- package/dist/esm/{chunk-55XCU76K-Bm2vEyhO.js → chunk-55XCU76K-B9fq0Aas.js} +1 -1
- package/dist/esm/{chunk-5VM5RSS4-bDfGkvI-.js → chunk-5VM5RSS4-BiSpRiw9.js} +1 -1
- package/dist/esm/{chunk-JWPE2WC7-WoJ0Gwzc.js → chunk-JWPE2WC7-fUi3mFpq.js} +1 -1
- package/dist/esm/{chunk-NQOKRVIF-BsYoUZL4.js → chunk-NQOKRVIF-9yhnn9l0.js} +1 -1
- package/dist/esm/{chunk-VQ5W62QI-BTvKzH75.js → chunk-VQ5W62QI-k74sEYFL.js} +1 -1
- package/dist/esm/{chunk-XXDRQBXY-ClHdtw3t.js → chunk-XXDRQBXY-DJJHL2aw.js} +1 -1
- package/dist/esm/{chunk-ZCHMQSOR-BuzD1sYe.js → chunk-ZCHMQSOR-DZxET8Hs.js} +1 -1
- package/dist/esm/classDiagram-v2-4MYWR3UA-Ccw8sMnD.js +1 -0
- package/dist/esm/{commons-CmbPiYDE.js → commons-Bam9oxAR.js} +1 -1
- package/dist/esm/constants.js +1 -1
- package/dist/esm/cose-bilkent-JH36ORCC-iT9n9qMD.js +1 -0
- package/dist/esm/cynefinDiagram-WF24UDRP-COkkadSX.js +1 -0
- package/dist/esm/dagre-NK4GIZVX-B2jYnU0Q.js +1 -0
- package/dist/esm/diagram-CBK3MWTC-DzCzOobH.js +1 -0
- package/dist/esm/diagram-I5XIIV2D-ChGPyzwT.js +1 -0
- package/dist/esm/diagram-ODIL2UCW-_jTs4ZGf.js +1 -0
- package/dist/esm/diagram-PFBEJUXE-C66lVsSz.js +1 -0
- package/dist/esm/diagram-RJA3I4VV-QELSA6fF.js +1 -0
- package/dist/esm/diagram-TYUNFSNR-Be-cdxPq.js +1 -0
- package/dist/esm/ebnfDiagram-V4P3TTPT-Cr1EANnv.js +1 -0
- package/dist/esm/elk-QONTBCTQ-CqfCbAWo.js +1 -0
- package/dist/esm/enums.js +1 -1
- package/dist/esm/erDiagram-KYQIGQAA-DMgweTFG.js +1 -0
- package/dist/esm/flowDiagram-IUGLLWBU-B4pY13UK.js +1 -0
- package/dist/esm/ganttDiagram-R7GPNTJY-YkRR1QZl.js +1 -0
- package/dist/esm/gitGraphDiagram-PDYL7XHY-BuhZy85T.js +1 -0
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/{index-DBVTTZ07.js → index-CTKRTL8i.js} +1 -1
- package/dist/esm/{index-P2yxumel.js → index-DU7OAICx.js} +1 -1
- package/dist/esm/{index-D9j3iMPO.js → index-DWLuqDsD.js} +1 -1
- package/dist/esm/index-c3o5xJQl.js +1 -0
- package/dist/esm/index-w_leOmyv.js +1 -0
- package/dist/esm/infoDiagram-MVDRKAX5-CfqZ5lu9.js +1 -0
- package/dist/esm/ishikawaDiagram-HPEHV2GE-fwZw1vDt.js +1 -0
- package/dist/esm/journeyDiagram-BOSHW7O7-CJ0qr25S.js +1 -0
- package/dist/esm/kanban-definition-FNSA4HC5-D467uQkY.js +1 -0
- package/dist/esm/main.js +1 -1
- package/dist/esm/{mermaid.core-GJX79pQL.js → mermaid.core-QEjDbduh.js} +2 -2
- package/dist/esm/mindmap-definition-6OY57UG3-BLQmSwVy.js +1 -0
- package/dist/esm/pegDiagram-ECIUJNBX-BD9B5ipu.js +1 -0
- package/dist/esm/pieDiagram-GNMPY74T-ALgTthPz.js +1 -0
- package/dist/esm/quadrantDiagram-D57K4MC3-DvM56mui.js +1 -0
- package/dist/esm/railroadDiagram-Y72NRBL7-Bbmv8kBV.js +1 -0
- package/dist/esm/requirementDiagram-EQYSW5RA-B2-FtMv8.js +1 -0
- package/dist/esm/sankeyDiagram-SY24JHO5-a4Tjq4bh.js +1 -0
- package/dist/esm/sequenceDiagram-BLEHNHQU-D51n1e3_.js +1 -0
- package/dist/esm/server.js +1 -1
- package/dist/esm/settings-Cd8fftVp.js +1 -0
- package/dist/esm/settings.js +1 -1
- package/dist/esm/sizeCapture-INFHLROL-EvtR_ZF3.js +1 -0
- package/dist/esm/stateDiagram-v2-A6IESKWZ-Dy_vLRVL.js +1 -0
- package/dist/esm/swimlanes-B3ENRKFQ-0pqT2-Jw.js +1 -0
- package/dist/esm/swimlanesDiagram-AYQRV4AK-COayinaD.js +1 -0
- package/dist/esm/timeline-definition-JXYKGLGB-DFhOynr-.js +1 -0
- package/dist/esm/{types-DS5jBUtV.js → types-C6dLWyzP.js} +1 -1
- package/dist/esm/usecaseDiagram-WPOLBNNX-MTVBbHK8.js +1 -0
- package/dist/esm/vennDiagram-Q3Y3IDCW-CgaIfPfv.js +1 -0
- package/dist/esm/wardleyDiagram-IVAIDKWA-CEQzSAI4.js +1 -0
- package/dist/esm/websocket-BppBoZUJ.js +1 -0
- package/dist/esm/xychartDiagram-4URNHDU4-BQJJ7mH2.js +1 -0
- package/dist/module-types/src/components/helpers/problem.d.ts +1 -1
- package/dist/module-types/src/components/helpers/websocket.d.ts +5 -11
- package/dist/module-types/src/components/hooks/useInjectOrganizationStyles.d.ts +1 -0
- package/dist/module-types/src/components/hooks/useJudge.d.ts +2 -2
- package/dist/module-types/src/components/hooks/useJukiUser.d.ts +17 -17
- package/dist/module-types/src/components/hooks/{useCompanyPresence.d.ts → useOrganizationPresence.d.ts} +3 -3
- package/dist/module-types/src/components/hooks/useOwnPresence.d.ts +1 -1
- package/dist/module-types/src/components/hooks/useSubmissionsJudging.d.ts +12 -0
- package/dist/module-types/src/components/hooks/useSubscribe.d.ts +2 -2
- package/dist/module-types/src/components/molecules/LinkLastPath/types.d.ts +1 -1
- package/dist/module-types/src/components/organisms/HorizontalMenu/MenuParts.d.ts +19 -0
- package/dist/module-types/src/components/organisms/LoginUser/LoginUser.d.ts +3 -1
- package/dist/module-types/src/components/organisms/ProblemSelector/ProblemSelector.d.ts +1 -1
- package/dist/module-types/src/components/organisms/ProblemSelector/types.d.ts +4 -4
- package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionListenerVerdict.d.ts +8 -3
- package/dist/module-types/src/components/organisms/SubmitView/commons/SubmissionVerdict.d.ts +5 -4
- package/dist/module-types/src/components/organisms/SubmitView/commons/SubmitViewContent.d.ts +2 -2
- package/dist/module-types/src/components/organisms/UserChip/types.d.ts +2 -2
- package/dist/module-types/src/components/organisms/UserNicknameLink/UserNicknameLink.d.ts +1 -1
- package/dist/module-types/src/components/organisms/UsersSelector/types.d.ts +3 -3
- package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkContestTableTest/MockJkContestTable.d.ts +2 -2
- package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkProblemTableTest/MockJkProblemTable.d.ts +2 -2
- package/dist/module-types/src/components/organisms/_layz_/DataViewer/JkSubmissionsTableTest/MockJkSubmissionTable.d.ts +2 -2
- package/dist/module-types/src/components/organisms/_layz_/WorksheetAsSlides/types.d.ts +2 -2
- package/dist/module-types/src/components/organisms/_layz_/WorksheetEditor/sheets/ResultHeader.d.ts +2 -2
- package/dist/module-types/src/components/organisms/_layz_/WorksheetViewer/types.d.ts +2 -2
- package/dist/module-types/src/components/organisms/modals/ImageUploaderModal/PublicImagesTab/PublicImages.d.ts +2 -2
- package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModal.d.ts +1 -1
- package/dist/module-types/src/components/organisms/modals/LoginModal/LoginModalTemplate/types.d.ts +2 -2
- package/dist/module-types/src/components/organisms/modals/LoginModal/types.d.ts +1 -1
- package/dist/module-types/src/components/organisms/modals/UserPreviewModal/UserPreviewContentModal.d.ts +4 -4
- package/dist/module-types/src/components/providers/JukiAblyInitializer/JukiAblyInitializer.d.ts +1 -1
- package/dist/module-types/src/components/providers/JukiUIProvider/JukiUIProvider.d.ts +1 -1
- package/dist/module-types/src/components/providers/JukiUIProvider/types.d.ts +2 -2
- package/dist/module-types/src/components/providers/JukiUserProvider/types.d.ts +4 -4
- package/dist/module-types/src/components/templates/ContestNameLinkField/types.d.ts +3 -3
- package/dist/module-types/src/components/templates/EditProfileModal/ImageProfileModal.d.ts +1 -1
- package/dist/module-types/src/components/templates/EditProfileModal/types.d.ts +5 -5
- package/dist/module-types/src/components/templates/MainMenu/SettingsSection/index.d.ts +1 -1
- package/dist/module-types/src/components/templates/MainMenu/types.d.ts +1 -1
- package/dist/module-types/src/components/templates/ProblemView/commons/ProblemCodeEditor.d.ts +2 -2
- package/dist/module-types/src/components/templates/ProblemView/types.d.ts +3 -3
- package/dist/module-types/src/components/templates/ResetPasswordModal/ResetPasswordModal.d.ts +1 -1
- package/dist/module-types/src/components/templates/ResetPasswordModal/types.d.ts +1 -1
- package/dist/module-types/src/components/templates/UserProfile/types.d.ts +3 -3
- package/dist/module-types/src/components/templates/UserProfileSettings/types.d.ts +2 -2
- package/dist/module-types/src/components/templates/UserViewLayout/types.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/contest-columns/getContestContestantsHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/contest-columns/getContestDateHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/contest-columns/getContestNameHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/contest-columns/getContestStatusHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/contest-columns/getContestTagsHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemAdminActionsHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemKeyHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemModeHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemNameHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemOwnerHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTagsHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/problem-columns/getProblemTypeHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionContestProblemHeader.d.ts +3 -3
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionDateHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionLanguageHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionMemoryHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionNicknameHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionProblemHeader.d.ts +3 -3
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionRejudgeHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionTimeHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/columns/submission-columns/getSubmissionVerdictHeader.d.ts +2 -2
- package/dist/module-types/src/components/templates/members/DocumentMembersModal/DocumentMembersModal.d.ts +2 -2
- package/dist/module-types/src/components/templates/members/types.d.ts +6 -6
- package/dist/module-types/src/components/templates/problem/ProblemCrawlerField.d.ts +1 -1
- package/dist/module-types/src/components/templates/problem/ProblemOwnerField.d.ts +1 -1
- package/dist/module-types/src/components/templates/problem/types.d.ts +10 -10
- package/dist/module-types/src/components/templates/submission/SubmissionNicknameField.d.ts +1 -1
- package/dist/module-types/src/components/templates/submission/types.d.ts +9 -9
- package/dist/module-types/src/components/types/index.d.ts +6 -6
- package/dist/module-types/src/constants/index.d.ts +2 -2
- package/dist/module-types/src/enums/index.d.ts +1 -1
- package/dist/module-types/src/hooks/index.d.ts +2 -1
- package/dist/module-types/src/settings/ApiManager.d.ts +77 -93
- package/dist/module-types/src/settings/AppRoutes.d.ts +2 -2
- package/dist/module-types/src/stores/submissionsLive/useSubmissionsLiveStore.d.ts +26 -0
- package/dist/module-types/src/stores/websocket/topicChannels.d.ts +11 -10
- package/dist/module-types/src/stores/websocket/types.d.ts +4 -7
- package/package.json +2 -2
- package/dist/esm/ArrowForwardIcon-C9lEPgxF.js +0 -1
- package/dist/esm/BarChart-CmUpEfgx.js +0 -1
- package/dist/esm/ChangePasswordModal-CLhaqd0t.js +0 -1
- package/dist/esm/CodeEditor-BCPgv2Cb.js +0 -1
- package/dist/esm/CodeViewer-BRpMXuea.js +0 -1
- package/dist/esm/Collapse-afKIPlSN.js +0 -1
- package/dist/esm/DataViewer-sY3-mm2f.js +0 -1
- package/dist/esm/DrawerView-CDVcbXRh.js +0 -1
- package/dist/esm/ExcalidrawButton-DpC-H9ia.js +0 -1
- package/dist/esm/GraphvizViewer-BVrLuU49.js +0 -1
- package/dist/esm/ImageLoaderCropper-qgwMwAGw.js +0 -1
- package/dist/esm/InputCellPhoneNumber-EJdJwdOU.js +0 -1
- package/dist/esm/LineChart-CK_uehIw.js +0 -1
- package/dist/esm/MdMath-DdXwM7hb.js +0 -1
- package/dist/esm/ReplyIcon-CxQ2sdad.js +0 -1
- package/dist/esm/SlideDeck-BCpZmg4u.js +0 -1
- package/dist/esm/Tooltip-C_PscPTv.js +0 -1
- package/dist/esm/UserCodeEditor-DqHZdH0s.js +0 -61
- package/dist/esm/VirtualizedRowsFixed-ExvaHy3O.js +0 -1
- package/dist/esm/WorksheetAsSlides-Bf0TBaKQ.js +0 -1
- package/dist/esm/WorksheetContents-DSLbRrOR.js +0 -1
- package/dist/esm/WorksheetEditor-DHgjrze5.js +0 -1
- package/dist/esm/WorksheetNode-BWrXWPtD.js +0 -1
- package/dist/esm/WorksheetViewer-BtWO3C0N.js +0 -1
- package/dist/esm/abnfDiagram-WEYOIA3C-Hw5eOSwT.js +0 -1
- package/dist/esm/architectureDiagram-ZHVYKT53-BU7Zo-Vd.js +0 -1
- package/dist/esm/blockDiagram-RJAE7QA3-DSHzRL6J.js +0 -1
- package/dist/esm/c4Diagram-XDPPPE54-CpLQ9pqY.js +0 -1
- package/dist/esm/channel-p0K5iSo0.js +0 -1
- package/dist/esm/classDiagram-v2-4MYWR3UA-BGFOFtLW.js +0 -1
- package/dist/esm/cose-bilkent-JH36ORCC-WrGk8F3q.js +0 -1
- package/dist/esm/cynefinDiagram-WF24UDRP-plMeajnN.js +0 -1
- package/dist/esm/dagre-NK4GIZVX-DFmweJ5L.js +0 -1
- package/dist/esm/diagram-CBK3MWTC-Do3xyOgp.js +0 -1
- package/dist/esm/diagram-I5XIIV2D-BjcBIOdi.js +0 -1
- package/dist/esm/diagram-ODIL2UCW-B9Avmrsd.js +0 -1
- package/dist/esm/diagram-PFBEJUXE-BspjnifG.js +0 -1
- package/dist/esm/diagram-RJA3I4VV-CDb0YVvV.js +0 -1
- package/dist/esm/diagram-TYUNFSNR-CowQmn1U.js +0 -1
- package/dist/esm/ebnfDiagram-V4P3TTPT-DoV9Lfm1.js +0 -1
- package/dist/esm/elk-QONTBCTQ-Di5ig-t7.js +0 -1
- package/dist/esm/erDiagram-KYQIGQAA-bd6-MJG2.js +0 -1
- package/dist/esm/flowDiagram-IUGLLWBU-B0MSMUTA.js +0 -1
- package/dist/esm/ganttDiagram-R7GPNTJY-lkIa_H6_.js +0 -1
- package/dist/esm/gitGraphDiagram-PDYL7XHY-Vj--WuIK.js +0 -1
- package/dist/esm/index-KB6gLBva.js +0 -1
- package/dist/esm/index-jAIWmSeN.js +0 -1
- package/dist/esm/infoDiagram-MVDRKAX5-DOeZ2-C8.js +0 -1
- package/dist/esm/ishikawaDiagram-HPEHV2GE-CENo4osB.js +0 -1
- package/dist/esm/journeyDiagram-BOSHW7O7-C2tDYh4z.js +0 -1
- package/dist/esm/kanban-definition-FNSA4HC5-CoyAxabP.js +0 -1
- package/dist/esm/mindmap-definition-6OY57UG3-Cz5x8Ddo.js +0 -1
- package/dist/esm/pegDiagram-ECIUJNBX-Cp7mSGqB.js +0 -1
- package/dist/esm/pieDiagram-GNMPY74T-DoaR6KZl.js +0 -1
- package/dist/esm/quadrantDiagram-D57K4MC3-vGvfladt.js +0 -1
- package/dist/esm/railroadDiagram-Y72NRBL7-CC8xjkre.js +0 -1
- package/dist/esm/requirementDiagram-EQYSW5RA-CvYZNdVi.js +0 -1
- package/dist/esm/sankeyDiagram-SY24JHO5-DTEzoJWs.js +0 -1
- package/dist/esm/sequenceDiagram-BLEHNHQU-B1ssXHBq.js +0 -1
- package/dist/esm/settings-oXVFKYs2.js +0 -1
- package/dist/esm/sizeCapture-INFHLROL-BpAWjro_.js +0 -1
- package/dist/esm/stateDiagram-v2-A6IESKWZ-BpWTAT11.js +0 -1
- package/dist/esm/swimlanes-B3ENRKFQ-CRPiPPkB.js +0 -1
- package/dist/esm/swimlanesDiagram-AYQRV4AK-CPu0_glt.js +0 -1
- package/dist/esm/timeline-definition-JXYKGLGB-D7lhGXLl.js +0 -1
- package/dist/esm/usecaseDiagram-WPOLBNNX-07MB5ZhJ.js +0 -1
- package/dist/esm/vennDiagram-Q3Y3IDCW-BF4CwCTB.js +0 -1
- package/dist/esm/wardleyDiagram-IVAIDKWA-CE_jsTBp.js +0 -1
- package/dist/esm/websocket-CXHGKJlm.js +0 -1
- package/dist/esm/xychartDiagram-4URNHDU4-DK5TR51V.js +0 -1
- package/dist/module-types/src/components/hooks/useInjectCompanyStyles.d.ts +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as t}from"./chunk-XXDRQBXY-ClHdtw3t.js";import{s as e}from"./chunk-VQ5W62QI-BTvKzH75.js";import{_ as s,l as i,c as n,r,t as o,u as a,a as l,b as c,g as h,s as d,v as u,x as p,ag as y,m as g,C as m,k as f,B as S,E as k,F as b,G as T,M as _}from"./mermaid.core-GJX79pQL.js";import{c as E}from"./chunk-55XCU76K-Bm2vEyhO.js";import"./index-jAIWmSeN.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-CmbPiYDE.js";import"./settings-oXVFKYs2.js";import"./constants.js";import"./LoaderLayer-CyitSTCe.js";import"./websocket-CXHGKJlm.js";import"./index-KB6gLBva.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var $=function(){var t=s(function(t,e,s,i){for(s=s||{},i=t.length;i--;s[t[i]]=e);return s},"o"),e=[1,2],i=[1,3],n=[1,4],r=[2,4],o=[1,9],a=[1,11],l=[1,16],c=[1,17],h=[1,18],d=[1,19],u=[1,33],p=[1,20],y=[1,21],g=[1,22],m=[1,23],f=[1,24],S=[1,26],k=[1,27],b=[1,28],T=[1,29],_=[1,30],E=[1,31],$=[1,32],x=[1,35],C=[1,36],v=[1,37],D=[1,38],w=[1,34],I=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],A=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],L=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],N={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"--\x3e":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"--\x3e",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:s(function(t,e,s,i,n,r,o){var a=r.length-1;switch(n){case 3:return i.setRootDoc(r[a]),r[a];case 4:this.$=[];break;case 5:"nl"!=r[a]&&(r[a-1].push(r[a]),this.$=r[a-1]);break;case 6:case 7:case 12:this.$=r[a];break;case 8:this.$="nl";break;case 13:const t=r[a-1];t.description=i.trimColon(r[a]),this.$=t;break;case 14:this.$={stmt:"relation",state1:r[a-2],state2:r[a]};break;case 15:const e=i.trimColon(r[a]);this.$={stmt:"relation",state1:r[a-3],state2:r[a-1],description:e};break;case 19:this.$={stmt:"state",id:r[a-3],type:"default",description:"",doc:r[a-1]};break;case 20:var l=r[a],c=r[a-2].trim();if(r[a].match(":")){var h=r[a].split(":");l=h[0],c=[c,h[1]]}this.$={stmt:"state",id:l,type:"default",description:c};break;case 21:this.$={stmt:"state",id:r[a-3],type:"default",description:r[a-5],doc:r[a-1]};break;case 22:this.$={stmt:"state",id:r[a],type:"fork"};break;case 23:this.$={stmt:"state",id:r[a],type:"join"};break;case 24:this.$={stmt:"state",id:r[a],type:"choice"};break;case 25:this.$={stmt:"state",id:i.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:r[a-1].trim(),note:{position:r[a-2].trim(),text:r[a].trim()}};break;case 29:this.$=r[a].trim(),i.setAccTitle(this.$);break;case 30:case 31:this.$=r[a].trim(),i.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:r[a-3],url:r[a-2],tooltip:r[a-1]};break;case 33:this.$={stmt:"click",id:r[a-3],url:r[a-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:r[a-1].trim(),classes:r[a].trim()};break;case 36:this.$={stmt:"style",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 37:this.$={stmt:"applyClass",id:r[a-1].trim(),styleClass:r[a].trim()};break;case 38:i.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:i.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:i.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:i.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:r[a].trim(),type:"default",description:""};break;case 46:case 47:this.$={stmt:"state",id:r[a-2].trim(),classes:[r[a].trim()],type:"default",description:""}}},"anonymous"),table:[{3:1,4:e,5:i,6:n},{1:[3]},{3:5,4:e,5:i,6:n},{3:6,4:e,5:i,6:n},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],r,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:l,17:c,19:h,22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,7]),t(I,[2,8]),t(I,[2,9]),t(I,[2,10]),t(I,[2,11]),t(I,[2,12],{14:[1,40],15:[1,41]}),t(I,[2,16]),{18:[1,42]},t(I,[2,18],{20:[1,43]}),{23:[1,44]},t(I,[2,22]),t(I,[2,23]),t(I,[2,24]),t(I,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(I,[2,28]),{34:[1,49]},{36:[1,50]},t(I,[2,31]),{13:51,24:u,57:w},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(A,[2,44],{58:[1,56]}),t(A,[2,45],{58:[1,57]}),t(I,[2,38]),t(I,[2,39]),t(I,[2,40]),t(I,[2,41]),t(I,[2,6]),t(I,[2,13]),{13:58,24:u,57:w},t(I,[2,17]),t(L,r,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(I,[2,29]),t(I,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(I,[2,14],{14:[1,71]}),{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,72],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(I,[2,34]),t(I,[2,35]),t(I,[2,36]),t(I,[2,37]),t(A,[2,46]),t(A,[2,47]),t(I,[2,15]),t(I,[2,19]),t(L,r,{7:78}),t(I,[2,26]),t(I,[2,27]),{5:[1,79]},{5:[1,80]},{4:o,5:a,8:8,9:10,10:12,11:13,12:14,13:15,16:l,17:c,19:h,21:[1,81],22:d,24:u,25:p,26:y,27:g,28:m,29:f,32:25,33:S,35:k,37:b,38:T,41:_,45:E,48:$,51:x,52:C,53:v,54:D,57:w},t(I,[2,32]),t(I,[2,33]),t(I,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:s(function(t,e){if(!e.recoverable){var s=new Error(t);throw s.hash=e,s}this.trace(t)},"parseError"),parse:s(function(t){var e=this,i=[0],n=[],r=[null],o=[],a=this.table,l="",c=0,h=0,d=o.slice.call(arguments,1),u=Object.create(this.lexer),p={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(p.yy[y]=this.yy[y]);u.setInput(t,p.yy),p.yy.lexer=u,p.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var g=u.yylloc;o.push(g);var m=u.options&&u.options.ranges;function f(){var t;return"number"!=typeof(t=n.pop()||u.lex()||1)&&(t instanceof Array&&(t=(n=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof p.yy.parseError?this.parseError=p.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,s(function(t){i.length=i.length-2*t,r.length=r.length-t,o.length=o.length-t},"popStack"),s(f,"lex");for(var S,k,b,T,_,E,$,x,C={};;){if(k=i[i.length-1],this.defaultActions[k]?b=this.defaultActions[k]:(null==S&&(S=f()),b=a[k]&&a[k][S]),void 0===b||!b.length||!b[0]){var v="";for(_ in x=[],a[k])this.terminals_[_]&&_>2&&x.push("'"+this.terminals_[_]+"'");v=u.showPosition?"Parse error on line "+(c+1)+":\n"+u.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[S]||S)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==S?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(v,{text:u.match,token:this.terminals_[S]||S,line:u.yylineno,loc:g,expected:x})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+k+", token: "+S);switch(b[0]){case 1:i.push(S),r.push(u.yytext),o.push(u.yylloc),i.push(b[1]),S=null,h=u.yyleng,l=u.yytext,c=u.yylineno,g=u.yylloc;break;case 2:if(E=this.productions_[b[1]][1],C.$=r[r.length-E],C._$={first_line:o[o.length-(E||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(E||1)].first_column,last_column:o[o.length-1].last_column},m&&(C._$.range=[o[o.length-(E||1)].range[0],o[o.length-1].range[1]]),void 0!==(T=this.performAction.apply(C,[l,h,c,p.yy,b[1],r,o].concat(d))))return T;E&&(i=i.slice(0,-1*E*2),r=r.slice(0,-1*E),o=o.slice(0,-1*E)),i.push(this.productions_[b[1]][0]),r.push(C.$),o.push(C._$),$=a[i[i.length-2]][i[i.length-1]],i.push($);break;case 3:return!0}}return!0},"parse")},O=function(){return{EOF:1,parseError:s(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:s(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:s(function(t){var e=t.length,s=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),s.length-1&&(this.yylineno-=s.length-1);var n=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:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:s(function(t){this.unput(this.match.slice(t))},"less"),pastInput:s(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:s(function(t,e){var s,i,n;if(this.options.backtrack_lexer&&(n={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&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],s=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;var t,e,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if((s=this._input.match(this.rules[n[r]]))&&(!e||s[0].length>e[0].length)){if(e=s,i=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(s,n[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,n[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var t=this.next();return t||this.lex()},"lex"),begin:s(function(t){this.conditionStack.push(t)},"begin"),popState:s(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:s(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:s(function(t){this.begin(t)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:s(function(t,e,i,n){function r(){const s=e.yytext.indexOf("%%");if(0===s)return!1;if(s>0){const i=e.yytext.slice(0,s),n=e.yytext.slice(s);n&&t.lexer.unput(n),e.yytext=i}return!0}switch(s(r,"processId"),i){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:case 43:return 51;case 5:case 44:return 52;case 6:case 45:return 53;case 7:case 46:return 54;case 8:case 78:return 5;case 9:case 10:case 11:case 12:case 57:case 63:break;case 13:case 33:return this.pushState("SCALE"),17;case 14:case 34:return 18;case 15:case 21:case 35:case 50:case 54:this.popState();break;case 16:return this.begin("acc_title"),33;case 17:return this.popState(),"acc_title_value";case 18:return this.begin("acc_descr"),35;case 19:return this.popState(),"acc_descr_value";case 20:this.begin("acc_descr_multiline");break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";case 25:return this.popState(),this.pushState("CLASSDEFID"),42;case 26:return this.popState(),43;case 27:return this.pushState("CLASS"),48;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;case 29:return this.popState(),50;case 30:return this.pushState("STYLE"),45;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;case 32:return this.popState(),47;case 36:this.pushState("STATE");break;case 37:case 40:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),25;case 38:case 41:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),26;case 39:case 42:return this.popState(),e.yytext=e.yytext.slice(0,-10).trim(),27;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";case 49:case 65:if(!r())return;return this.popState(),"ID";case 51:return"STATE_DESCR";case 52:throw new Error('Error: State name must be a single word. Found: "'+e.yytext.trim()+'"');case 53:return 19;case 55:return this.popState(),this.pushState("struct"),20;case 56:return this.popState(),21;case 58:return this.begin("NOTE"),29;case 59:return this.popState(),this.pushState("NOTE_ID"),59;case 60:return this.popState(),this.pushState("NOTE_ID"),60;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";case 64:return"NOTE_TEXT";case 66:if(!r())return;return this.popState(),this.pushState("NOTE_TEXT"),24;case 67:return this.popState(),e.yytext=e.yytext.substr(2).trim(),31;case 68:return this.popState(),e.yytext=e.yytext.slice(0,-8).trim(),31;case 69:case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!r())return;return 24;case 74:return e.yytext=e.yytext.trim(),14;case 75:return 15;case 76:return 28;case 77:return 58;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}}}();function R(){this.yy={}}return N.lexer=O,s(R,"Parser"),R.prototype=N,N.Parser=R,new R}();$.parser=$;var x=$,C="state",v="root",D="relation",w="default",I="divider",A="fill:none",L="fill: #333",N="markdown",O="normal",R="rect",B="rectWithTitle",F="divider",j="roundedWithTitle",P="statediagram",Y=`${P}-state`,G="transition",W=`${G} note-edge`,M=`${P}-note`,z=`${P}-cluster`,U=`${P}-cluster-alt`,X="parent",H="note",V="----",K=`${V}${H}`,J=`${V}${X}`,Q=new Map,q=0,Z=0,tt=new Map,et=s((t,e,s,i)=>{if(t===F&&void 0!==s?.id&&tt.has(s.id)){const t=tt.get(s.id);return tt.set(e,t),t}const n=Z++,r=i?void 0:n;return tt.set(e,r),r},"colorSlotFor");function st(t="",e=0,s="",i=V){return`state-${t}${null!==s&&s.length>0?`${i}${s}`:""}-${e}`}s(st,"stateDomId");var it=s((t,e,s,r,o,a,l,c)=>{i.trace("items",e),e.forEach(e=>{switch(e.stmt){case C:case w:lt(t,e,s,r,o,a,l,c);break;case D:{lt(t,e.state1,s,r,o,a,l,c),lt(t,e.state2,s,r,o,a,l,c);const i="neo"===l,h={id:"edge"+q,start:e.state1.id,end:e.state2.id,arrowhead:"normal",arrowTypeEnd:i?"arrow_barb_neo":"arrow_barb",style:A,labelStyle:"",label:g.sanitizeText(e.description??"",n()),arrowheadStyle:L,labelpos:"c",labelType:N,thickness:O,classes:G,look:l};o.push(h),q++}}})},"setupDoc"),nt=s((t,e="TB")=>{let s=e;if(t.doc)for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir");function rt(t,e,s){if(!e.id||"</join></fork>"===e.id||"</choice>"===e.id)return;e.cssClasses&&(Array.isArray(e.cssCompiledStyles)||(e.cssCompiledStyles=[]),e.cssClasses.split(" ").forEach(t=>{const i=s.get(t);i&&(e.cssCompiledStyles=[...e.cssCompiledStyles??[],...i.styles])}));const i=t.find(t=>t.id===e.id);i?Object.assign(i,e):t.push(e)}function ot(t){return t?.classes?.join(" ")??""}function at(t){return t?.styles??[]}s(rt,"insertOrUpdateNode"),s(ot,"getClassesFromDbInfo"),s(at,"getStylesFromDbInfo");var lt=s((t,e,s,r,o,a,l,c)=>{const h=e.id,d=s.get(h),u=ot(d),p=at(d),y=n(),m=""!==u.trim()||p.length>0;if(i.info("dataFetcher parsedItem",e,d,p),"root"!==h){let s=R;!0===e.start?s="stateStart":!1===e.start&&(s="stateEnd"),e.type!==w&&(s=e.type),Q.get(h)||Q.set(h,{id:h,shape:s,description:g.sanitizeText(h,y),cssClasses:`${u} ${Y}`,cssStyles:p});const n=Q.get(h);e.description&&(Array.isArray(n.description)?(n.shape=B,n.description.push(e.description)):n.description?.length&&n.description.length>0?(n.shape=B,n.description===h?n.description=[e.description]:n.description=[n.description,e.description]):(n.shape=R,n.description=e.description),n.description=g.sanitizeTextOrArray(n.description,y)),1===n.description?.length&&n.shape===B&&("group"===n.type?n.shape=j:n.shape=R),!n.type&&e.doc&&(i.info("Setting cluster for XCX",h,nt(e)),n.type="group",n.isGroup=!0,n.dir=nt(e),n.shape=e.type===I?F:j,n.colorIndex=et(n.shape,h,t,m),n.cssClasses=`${n.cssClasses} ${z} ${a?U:""}`);const d={labelStyle:"",shape:n.shape,label:n.description,cssClasses:n.cssClasses,cssCompiledStyles:[],cssStyles:n.cssStyles,id:h,dir:n.dir,domId:st(h,q),type:n.type,isGroup:"group"===n.type,colorIndex:n.colorIndex,padding:8,rx:10,ry:10,look:l,labelType:"markdown"};if(d.shape===F&&(d.label=""),t&&"root"!==t.id&&(i.trace("Setting node ",h," to be child of its parent ",t.id),d.parentId=t.id),d.centerLabel=!0,e.note){const t={labelStyle:"",shape:"note",label:e.note.text,labelType:"markdown",cssClasses:M,cssStyles:[],cssCompiledStyles:[],id:h+K+"-"+q,domId:st(h,q,H),type:"node",isGroup:!1,padding:y.flowchart?.padding,look:l,position:e.note.position},s=h+J,i={labelStyle:"",shape:"noteGroup",label:e.note.text,cssClasses:n.cssClasses,cssStyles:[],id:h+J,domId:st(h,q,X),type:"group",isGroup:!0,padding:16,look:l,position:e.note.position};q++,i.id=s,t.parentId=s,rt(r,i,c),rt(r,t,c),rt(r,d,c);let a=h,u=t.id;"left of"===e.note.position&&(a=t.id,u=h),o.push({id:a+"-"+u,start:a,end:u,arrowhead:"none",arrowTypeEnd:"",style:A,labelStyle:"",classes:W,pattern:"dashed",arrowheadStyle:L,labelpos:"c",labelType:N,thickness:O,look:l})}else rt(r,d,c)}e.doc&&(i.trace("Adding nodes children "),it(e,e.doc,s,r,o,!a,l,c))},"dataFetcher"),ct=s(()=>{Q.clear(),q=0,Z=0,tt.clear()},"reset"),ht=s((t,e="TB")=>{if(!t.doc)return e;let s=e;for(const e of t.doc)"dir"===e.stmt&&(s=e.value);return s},"getDir"),dt={getClasses:s(function(t,e){return e.db.getClasses()},"getClasses"),draw:s(async function(s,l,c,h){i.info("REF0:"),i.info("Drawing state diagram (v2)",l);const{securityLevel:d,state:u,layout:p}=n();h.db.extract(h.db.getRootDocV2());const y=h.db.getData(),g=t(l,d);y.type=h.type,y.layoutAlgorithm=r(p),y.nodeSpacing=u?.nodeSpacing||50,y.rankSpacing=u?.rankSpacing||50;"neo"===n().look?y.markers=["barbNeo"]:y.markers=["barb"],y.diagramId=l,await o(y,g);try{("function"==typeof h.db.getLinks?h.db.getLinks():new Map).forEach((t,e)=>{const s="string"==typeof e?e:"string"==typeof e?.id?e.id:"",n=y.nodes.find(t=>t.id===s);if(!s)return void i.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(e));const r=g.node()?.querySelectorAll("g.node, g.rough-node");let o;if(r?.forEach(t=>{const e=t.textContent?.trim();t.id!==n?.domId&&e!==s||(o=t)}),!o)return void i.warn("⚠️ Could not find node matching text:",s);const a=o.parentNode;if(!a)return void i.warn("⚠️ Node has no parent, cannot wrap:",s);const l=document.createElementNS("http://www.w3.org/2000/svg","a"),c=t.url.replace(/^"+|"+$/g,"");if(l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c),l.setAttribute("target","_blank"),t.tooltip){const e=t.tooltip.replace(/^"+|"+$/g,"");l.setAttribute("title",e),o.setAttribute("title",e)}a.replaceChild(l,o),l.appendChild(o),i.info("🔗 Wrapped node in <a> tag for:",s,t.url)})}catch(t){i.error("❌ Error injecting clickable links:",t)}a.insertTitle(g,"statediagramTitleText",u?.titleTopMargin??25,h.db.getDiagramTitle()),e(g,8,P,u?.useMaxWidth??!0)},"draw"),getDir:ht},ut="[*]",pt="start",yt="[*]",gt="end",mt="color",ft="fill",St="bgFill",kt=",",bt=s(()=>new Map,"newClassesList"),Tt=s(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),_t=s(t=>JSON.parse(JSON.stringify(t)),"clone"),Et=class{constructor(t){this.version=t,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=bt(),this.documents={root:Tt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=l,this.setAccTitle=c,this.getAccDescription=h,this.setAccDescription=d,this.setDiagramTitle=u,this.getDiagramTitle=p,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{s(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(t){this.clear(!0);for(const e of Array.isArray(t)?t:t.doc)switch(e.stmt){case C:this.addState(e.id.trim(),e.type,e.doc,e.description,e.note);break;case D:this.addRelation(e.state1,e.state2,e.description);break;case"classDef":this.addStyleClass(e.id.trim(),e.classes);break;case"style":this.handleStyleDef(e);break;case"applyClass":this.setCssClass(e.id.trim(),e.styleClass);break;case"click":this.addLink(e.id,e.url,e.tooltip)}const e=this.getStates(),s=n();ct(),lt(void 0,this.getRootDocV2(),e,this.nodes,this.edges,!0,s.look,this.classes);for(const t of this.nodes)if(Array.isArray(t.label)){if(t.description=t.label.slice(1),t.isGroup&&t.description.length>0)throw new Error(`Group nodes can only have label. Remove the additional description for node [${t.id}]`);t.label=t.label[0]}}handleStyleDef(t){const e=t.id.trim().split(","),s=t.styleClass.split(",");for(const t of e){let e=this.getState(t);if(!e){const s=t.trim();this.addState(s),e=this.getState(s)}e&&(e.styles=s.map(t=>t.replace(/;/g,"")?.trim()))}}setRootDoc(t){i.info("Setting root doc",t),this.rootDoc=t,1===this.version?this.extract(t):this.extract(this.getRootDocV2())}docTranslator(t,e,s){if(e.stmt===D)return this.docTranslator(t,e.state1,!0),void this.docTranslator(t,e.state2,!1);if(e.stmt===C&&(e.id===ut?(e.id=t.id+(s?"_start":"_end"),e.start=s):e.id=e.id.trim()),e.stmt!==v&&e.stmt!==C||!e.doc)return;const i=[];let n=[];for(const t of e.doc)if(t.type===I){const e=_t(t);e.doc=_t(n),i.push(e),n=[]}else n.push(t);if(i.length>0&&n.length>0){const t={stmt:C,id:y(),type:"divider",doc:_t(n)};i.push(_t(t)),e.doc=i}e.doc.forEach(t=>this.docTranslator(e,t,!0))}getRootDocV2(){return this.docTranslator({id:v,stmt:v},{id:v,stmt:v,doc:this.rootDoc},!0),{id:v,doc:this.rootDoc}}addState(t,e=w,s=void 0,r=void 0,o=void 0,a=void 0,l=void 0,c=void 0){const h=t?.trim();if(this.currentDocument.states.has(h)){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.doc||(t.doc=s),t.type||(t.type=e)}else i.info("Adding state ",h,r),this.currentDocument.states.set(h,{stmt:C,id:h,descriptions:[],type:e,doc:s,note:o,classes:[],styles:[],textStyles:[]});if(r){i.info("Setting state description",h,r);(Array.isArray(r)?r:[r]).forEach(t=>this.addDescription(h,t.trim()))}if(o){const t=this.currentDocument.states.get(h);if(!t)throw new Error(`State not found: ${h}`);t.note=o,t.note.text=g.sanitizeText(t.note.text,n())}if(a){i.info("Setting state classes",h,a);(Array.isArray(a)?a:[a]).forEach(t=>this.setCssClass(h,t.trim()))}if(l){i.info("Setting state styles",h,l);(Array.isArray(l)?l:[l]).forEach(t=>this.setStyle(h,t.trim()))}if(c){i.info("Setting state styles",h,l);(Array.isArray(c)?c:[c]).forEach(t=>this.setTextStyle(h,t.trim()))}}clear(t){this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Tt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=bt(),t||(this.links=new Map,m())}getState(t){return this.currentDocument.states.get(t)}getStates(){return this.currentDocument.states}logDocuments(){i.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(t,e,s){this.links.set(t,{url:e,tooltip:s}),i.warn("Adding link",t,e,s)}getLinks(){return this.links}startIdIfNeeded(t=""){return t===ut?(this.startEndCount++,`${pt}${this.startEndCount}`):t}startTypeIfNeeded(t="",e=w){return t===ut?pt:e}endIdIfNeeded(t=""){return t===yt?(this.startEndCount++,`${gt}${this.startEndCount}`):t}endTypeIfNeeded(t="",e=w){return t===yt?gt:e}addRelationObjs(t,e,s=""){const i=this.startIdIfNeeded(t.id.trim()),r=this.startTypeIfNeeded(t.id.trim(),t.type),o=this.startIdIfNeeded(e.id.trim()),a=this.startTypeIfNeeded(e.id.trim(),e.type);this.addState(i,r,t.doc,t.description,t.note,t.classes,t.styles,t.textStyles),this.addState(o,a,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.currentDocument.relations.push({id1:i,id2:o,relationTitle:g.sanitizeText(s,n())})}addRelation(t,e,s){if("object"==typeof t&&"object"==typeof e)this.addRelationObjs(t,e,s);else if("string"==typeof t&&"string"==typeof e){const i=this.startIdIfNeeded(t.trim()),r=this.startTypeIfNeeded(t),o=this.endIdIfNeeded(e.trim()),a=this.endTypeIfNeeded(e);this.addState(i,r),this.addState(o,a),this.currentDocument.relations.push({id1:i,id2:o,relationTitle:s?g.sanitizeText(s,n()):void 0})}}addDescription(t,e){const s=this.currentDocument.states.get(t),i=e.startsWith(":")?e.replace(":","").trim():e;s?.descriptions?.push(g.sanitizeText(i,n()))}cleanupLabel(t){return t.startsWith(":")?t.slice(2).trim():t.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(t,e=""){this.classes.has(t)||this.classes.set(t,{id:t,styles:[],textStyles:[]});const s=this.classes.get(t);e&&s&&e.split(kt).forEach(t=>{const e=t.replace(/([^;]*);/,"$1").trim();if(RegExp(mt).exec(t)){const t=e.replace(ft,St).replace(mt,ft);s.textStyles.push(t)}s.styles.push(e)})}getClasses(){return this.classes}setupToolTips(t){const e=E();f(t).select("svg").selectAll("g.node, g.rough-node").on("mouseover",t=>{const s=f(t.currentTarget),i=s.attr("title");if(null===i)return;const n=t.currentTarget?.getBoundingClientRect();e.transition().duration(200).style("opacity",".9"),e.style("left",window.scrollX+n.left+(n.right-n.left)/2+"px").style("top",window.scrollY+n.bottom+"px"),e.html(S.sanitize(i)),s.classed("hover",!0)}).on("mouseout",t=>{e.transition().duration(500).style("opacity",0);f(t.currentTarget).classed("hover",!1)})}setCssClass(t,e){t.split(",").forEach(t=>{let s=this.getState(t);if(!s){const e=t.trim();this.addState(e),s=this.getState(e)}s?.classes?.push(e)})}setStyle(t,e){this.getState(t)?.styles?.push(e)}setTextStyle(t,e){this.getState(t)?.textStyles?.push(e)}bindFunctions(t){this.funs.forEach(e=>{e(t)})}getDirectionStatement(){return this.rootDoc.find(t=>"dir"===t.stmt)}getDirection(){return this.getDirectionStatement()?.value??"TB"}setDirection(t){const e=this.getDirectionStatement();e?e.value=t:this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}getData(){const t=n();for(const e of this.nodes)e.wrappingWidth??=t.state?.wrappingWidth,e.isGroup||(e.minWidth??=t.state?.minNodeWidth);return{nodes:this.nodes,edges:this.edges,other:{},config:t,direction:ht(this.getRootDocV2())}}getConfig(){return n().state}},$t=s(t=>{const{theme:e,bkgColorArray:s,borderColorArray:i}=t;if(!k(e,i))return"";const n=b(t.look),r=T(s);let o="";for(let t=0;t<_(i);t++){const e=i[t],a=r?`fill: ${s[t%s.length]};`:"",l=`[data-look="${n}"][data-color-id="color-${t}"]`;o+=`\n\n /* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers\n the body, so what stays visible of \`outer\` is the band behind the label. */\n ${l}.statediagram-cluster rect.outer {\n stroke: ${e};\n ${a}\n }\n\n ${l}.statediagram-cluster rect.inner {\n stroke: ${e};\n }\n\n /* Concurrency regions. Siblings of one composite share a slot, so a divided composite\n reads as one thing split into parts rather than as several composites. */\n ${l}.statediagram-cluster rect.divider {\n stroke: ${e};\n ${a}\n }\n\n /* handDrawn draws the same container as roughjs shapes rather than plain rects, so it\n needs its own rules. \`roundedWithTitle\` and \`divider\` name those groups \`outer\`,\n \`inner\` and \`divider\` to match the classic branch, which is what lets these\n discriminate -- a bare \`.statediagram-cluster path\` rule reached the body as well and\n tinted the whole composite, losing \`compositeBackground\` and diverging from what\n classic and neo do.\n\n roughjs emits two paths per shape and marks them: the filled shape carries\n \`stroke="none"\` and the sketched outline carries \`fill="none"\`. Splitting on that is\n what keeps \`fill\` off the outline -- a rough outline is open squiggles, not a closed\n region, so filling it produces smears -- and keeps \`stroke\` off the fill shape, which\n would otherwise gain an edge it was drawn without. */\n ${l}.statediagram-cluster .outer path[stroke='none'] {\n ${a}\n }\n\n ${l}.statediagram-cluster .outer path[fill='none'] {\n stroke: ${e};\n }\n\n /* No \`.inner\` rule on purpose. The body shape is left entirely alone under handDrawn,\n where a rect's \`inner\` counterpart cannot be recoloured safely: roughjs draws a\n hachure fill as *stroked* lines, so its fill paths carry \`fill="none"\` exactly like\n the outline and no selector separates them. An \`.inner\` stroke rule therefore\n repainted the hatching of every alt composite in the palette colour instead of\n leaving it on \`altBackground\`. The container still reads as palette-coloured: the\n \`outer\` shape spans the whole composite, so its outline already frames the body. */\n\n /* Regions split the same way, which is why \`divider\` fills solid rather than taking\n roughjs's default hachure -- see the note on that call. Hatched, both of its paths\n carried \`fill="none"\` and these two rules degenerated: the tint matched nothing and\n the border rule repainted the hatching. */\n ${l}.statediagram-cluster .divider path[stroke='none'] {\n ${a}\n }\n\n ${l}.statediagram-cluster .divider path[fill='none'] {\n stroke: ${e};\n }\n `}return o},"genColor"),xt=s(t=>`\n${$t(t)}\ndefs [id$="-barbEnd"] {\n fill: ${t.transitionColor};\n stroke: ${t.transitionColor};\n }\ng.stateGroup text {\n fill: ${t.nodeBorder};\n stroke: none;\n font-size: 10px;\n}\ng.stateGroup text {\n fill: ${t.textColor};\n stroke: none;\n font-size: 10px;\n\n}\ng.stateGroup .state-title {\n font-weight: bolder;\n fill: ${t.stateLabelColor};\n}\n\ng.stateGroup rect {\n fill: ${t.mainBkg};\n stroke: ${t.nodeBorder};\n}\n\ng.stateGroup line {\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.transition {\n stroke: ${t.transitionColor};\n stroke-width: ${t.strokeWidth||1};\n fill: none;\n}\n\n.stateGroup .composit {\n fill: ${t.background};\n border-bottom: 1px\n}\n\n.stateGroup .alt-composit {\n fill: #e0e0e0;\n border-bottom: 1px\n}\n\n.state-note {\n stroke: ${t.noteBorderColor};\n fill: ${t.noteBkgColor};\n\n text {\n fill: ${t.noteTextColor};\n stroke: none;\n font-size: 10px;\n }\n}\n\n.stateLabel .box {\n stroke: none;\n stroke-width: 0;\n fill: ${t.mainBkg};\n opacity: 0.5;\n}\n\n.edgeLabel .label rect {\n fill: ${t.labelBackgroundColor};\n opacity: 0.5;\n}\n.edgeLabel {\n background-color: ${t.edgeLabelBackground};\n p {\n background-color: ${t.edgeLabelBackground};\n }\n rect {\n opacity: 0.5;\n background-color: ${t.edgeLabelBackground};\n fill: ${t.edgeLabelBackground};\n }\n text-align: center;\n}\n.edgeLabel .label text {\n fill: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n.label div .edgeLabel {\n color: ${t.transitionLabelColor||t.tertiaryTextColor};\n}\n\n.stateLabel text {\n fill: ${t.stateLabelColor};\n font-size: 10px;\n font-weight: bold;\n}\n\n.node circle.state-start {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node .fork-join {\n fill: ${t.specialStateColor};\n stroke: ${t.specialStateColor};\n}\n\n.node circle.state-end {\n fill: ${t.innerEndBackground};\n stroke: ${t.background};\n stroke-width: 1.5\n}\n.end-state-inner {\n fill: ${t.compositeBackground||t.background};\n // stroke: ${t.background};\n stroke-width: 1.5\n}\n\n.node rect {\n fill: ${t.stateBkg||t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n.node polygon {\n fill: ${t.mainBkg};\n stroke: ${t.stateBorder||t.nodeBorder};;\n stroke-width: ${t.strokeWidth||1}px;\n}\n[id$="-barbEnd"] {\n fill: ${t.lineColor};\n}\n\n.statediagram-cluster rect {\n fill: ${t.compositeTitleBackground};\n stroke: ${t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth||1}px;\n}\n\n.cluster-label, .nodeLabel {\n color: ${t.stateLabelColor};\n // line-height: 1;\n}\n\n.statediagram-cluster rect.outer {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state .divider {\n stroke: ${t.stateBorder||t.nodeBorder};\n}\n\n.statediagram-state .title-state {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-cluster.statediagram-cluster .inner {\n fill: ${t.compositeBackground||t.background};\n}\n.statediagram-cluster.statediagram-cluster-alt .inner {\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.statediagram-cluster .inner {\n rx:0;\n ry:0;\n}\n\n.statediagram-state rect.basic {\n rx: 5px;\n ry: 5px;\n}\n.statediagram-state rect.divider {\n stroke-dasharray: 10,10;\n fill: ${t.altBackground?t.altBackground:"#efefef"};\n}\n\n.note-edge {\n stroke-dasharray: 5;\n}\n\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n.statediagram-note rect {\n fill: ${t.noteBkgColor};\n stroke: ${t.noteBorderColor};\n stroke-width: 1px;\n rx: 0;\n ry: 0;\n}\n\n.statediagram-note text {\n fill: ${t.noteTextColor};\n}\n\n.statediagram-note .nodeLabel {\n color: ${t.noteTextColor};\n}\n.statediagram .edgeLabel {\n color: red; // ${t.noteTextColor};\n}\n\n[id$="-dependencyStart"], [id$="-dependencyEnd"] {\n fill: ${t.lineColor};\n stroke: ${t.lineColor};\n stroke-width: ${t.strokeWidth||1};\n}\n\n.statediagramTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n}\n\n[data-look="neo"].statediagram-cluster rect {\n fill: ${t.mainBkg};\n stroke: ${t.useGradient?"url("+t.svgId+"-gradient)":t.stateBorder||t.nodeBorder};\n stroke-width: ${t.strokeWidth??1};\n}\n[data-look="neo"].statediagram-cluster rect.outer {\n rx: ${t.radius}px;\n ry: ${t.radius}px;\n filter: ${t.dropShadow?t.dropShadow.replace("url(#drop-shadow)",`url(${t.svgId}-drop-shadow)`):"none"}\n}\n`,"getStyles"),Ct={parser:x,get db(){return new Et(2)},renderer:dt,styles:xt,init:s(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{Ct as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as t}from"./chunk-4EMNKR2T-CwTwaoZv.js";import{c as e}from"./chunk-ZCHMQSOR-BuzD1sYe.js";import{_ as n,l as o}from"./mermaid.core-GJX79pQL.js";import"./graph-rGqC_56m.js";import"./isSymbol-D2gNAbOe.js";import"./isUndefined--MLpwE__.js";import"./index-jAIWmSeN.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-CmbPiYDE.js";import"./settings-oXVFKYs2.js";import"./constants.js";import"./LoaderLayer-CyitSTCe.js";import"./websocket-CXHGKJlm.js";import"./index-KB6gLBva.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";function r(e,{measure:n}){const o=e.config?.swimlane?.lineHops;if(!1===o)return;const r="gap"===o?"gap":"arc",s=e.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));t(n.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:r})}n(r,"applySwimlaneLineJumps");var s="__swimlane_default__";function i(t){return Math.max(t.padding??20,20)}function a(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const i=n-r/2,a=Math.min(s,n+r/2),c=i+Math.min(21,Math.max(0,a-i));c<=i?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:c}}function c(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===s);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:s,label:"",isGroup:!0,shape:"swimlane",padding:20,look:t.config?.look,colorIndex:n.reduce((t,e)=>Math.max(t,e.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(r));for(const t of o)t.parentId=s}function f(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function d(t,e,n,o){const{layout:r}=t,s=t.nodeById,c=o?.layerGap??100,f=o?.nodeGap??40;let d=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=d,t.order=e;const r=n.x[o]??e*f,i=n.y[o]??d*c;t.x=r,t.y=i,e++}d++}const l=r.nodes??[],u=new Map,h=[];for(const t of l){if(!t?.isGroup)continue;t.parentId||h.push(t);const e=l.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,a=-1/0;for(const t of e){const e=t.x??n.x[t.id],i=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=i&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,i-f/2),a=Math.max(a,i+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*i(t),c=e,f=Math.max(0,r-o)+n,d=Math.max(0,a-s)+c,l=(o+r)/2,h=(s+a)/2;t.x=l,t.y=h,t.width=f,t.height=d,u.set(t.id,{minX:o,maxX:r,minY:s,maxY:a})}}if(h.length>0&&u.size>0){let t=1/0,e=-1/0,n=0;for(const o of h){const r=o.padding??20;r>n&&(n=r);const s=u.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of h)e.y=s,e.height=r,e.swimlaneContentTop=t;const c=[...h].sort((t,e)=>(t.x??0)-(e.x??0)),f=[],d=[],l=[];for(const t of c){const e=u.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*i(t),o=(e.minX+e.maxX)/2;f.push(t.id),d.push(o),l.push(n)}const g=f.length;if(g>0){const t=new Map;if(1===g)t.set(f[0],l[0]);else{const e=[];for(let t=0;t<g-1;t++)e.push(d[t+1]-d[t]);const n=new Array(g);n[0]=0;for(let t=0;t<g-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<g;t++){const e=l[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<g;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(l[e],o);t.set(f[e],r)}}for(const e of h){const n=t.get(e.id);null!=n&&(e.width=n),a(e)}}}}}n(i,"topLaneHorizontalPadding"),n(a,"assignTopLaneTitleRect"),n(c,"prepareLayoutForSwimlanes"),n(f,"toGraphView"),n(d,"writeBackToLayoutData");function l(t){const e=[],n=[],r=new Map;for(const e of t.nodes)r.set(e.id,e);for(const s of t.edges){if(!s.label||0===s.label.length)continue;if(s.isLayoutOnly)continue;if(s.labelNodeId)continue;const t=s.start?r.get(s.start):void 0,i=s.end?r.get(s.end):void 0;if(!t||!i){o.warn("[EdgeLabelNodes]",`Edge ${s.id} has missing source or target node`);continue}const a=`edge-label-${s.start}-${s.end}-${s.id}`,c=t.parentId!==i.parentId?i.parentId:t.parentId,f={id:a,label:s.label,edgeStart:s.start??"",edgeEnd:s.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(s.labelStyle)?s.labelStyle[0]:s.labelStyle??"",...t.dir?{dir:t.dir}:{}};e.push(f),s.labelNodeId=a,s.label=void 0,s.text=void 0;const d={id:`${s.id}-to-label`,start:s.start,end:a,type:"normal",isLayoutOnly:!0},l={id:`${s.id}-from-label`,start:a,end:s.end,type:"normal",isLayoutOnly:!0};n.push(d,l)}const s=[...t.nodes,...e],i=[...t.edges,...n];return{...t,nodes:s,edges:i}}n(l,"createEdgeLabelNodes");var u=.001;function h(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:T(e,n,o,r)}:void 0}function g(t){if(t.isGroup)return;const e=h(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function p(t,e,n=u){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function m(t,e,n=u){return Math.abs(t.x-e.x)<n}function x(t,e,n=u){return Math.abs(t.y-e.y)<n}function y(t,e,n=u){return x(t,e,n)&&Math.abs(t.x-e.x)>n}function b(t,e,n=u){return m(t,e,n)&&Math.abs(t.y-e.y)>n}function M(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)))}function I(t,e,n=u){return t.horizontal&&e.horizontal&&x(t.a,e.a,n)?M(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&m(t.a,e.a,n)?M(t.a.y,t.b.y,e.a.y,e.b.y):0}function S(t,e=u){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],i=y(r,s,e),a=b(r,s,e);(i||a)&&n.push({index:o,a:r,b:s,horizontal:i,vertical:a})}return n}function w(t,e=u){const n=S(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function v(t,e=u){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&p(t,o,e)||n.push({x:o.x,y:o.y})}return n}function C(t,e=u){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(y(n,o,e)&&b(o,r,e)&&y(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return b(n,o,e)&&y(o,r,e)&&b(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function L(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&a>n.top-o&&i<n.bottom+o}function k(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}function O(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function R(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function N(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function T(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function B(t){return h(t)?.rect}function F(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}}}function E(t,e,n,o,r,s=u){const i="left"===e||"right"===e,a="left"===o||"right"===o;if(i&&a){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(x(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(x(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!i&&!a){if(e===o){if(m(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(m(t,n,s))return[t,n];const i=(t.y+n.y)/2;return[t,{x:t.x,y:i},{x:n.x,y:i},n]}if(i&&!a){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function $(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function Y(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=g(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function X(t){const e=[],n=[];for(const o of t){const t=g(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function z(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,i=o.height??0;n.push({nodeId:o.id,...T(t,r,s,i)})}return n}function P(t,e,n=u){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),i=e.get(r);return s&&i?{srcId:o,dstId:r,srcInfo:s,dstInfo:i,collinearX:Math.abs(s.cx-i.cx)<n,collinearY:Math.abs(s.cy-i.cy)<n}:void 0}function G(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&L(t,e,s.rect,-r))return!0;return!1}function D(t,e,n,o,r=u,s=1e-6){const i=x(t,e,r),a=m(t,e,r),c=x(n,o,r),f=m(n,o,r);if(i&&c||a&&f)return!1;if(!i&&!a||!c&&!f)return!1;const d=i?{a:t,b:e}:{a:n,b:o},l=a?{a:t,b:e}:{a:n,b:o},h=d.a.y,g=Math.min(d.a.x,d.b.x),p=Math.max(d.a.x,d.b.x),y=l.a.x,b=Math.min(l.a.y,l.b.y),M=Math.max(l.a.y,l.b.y);if(y<g||y>p||h<b||h>M)return!1;const I=Math.abs(y-d.a.x)<s&&Math.abs(h-d.a.y)<s||Math.abs(y-d.b.x)<s&&Math.abs(h-d.b.y)<s,S=Math.abs(y-l.a.x)<s&&Math.abs(h-l.a.y)<s||Math.abs(y-l.b.x)<s&&Math.abs(h-l.b.y)<s;return!(I&&S)}function A(t,e,n,o,r=u){const s=x(t,e,r),i=m(t,e,r),a=x(n,o,r),c=m(n,o,r);return i&&c&&m(t,n,r)?M(t.y,e.y,n.y,o.y)>r:!!(s&&a&&x(t,n,r))&&M(t.x,e.x,n.x,o.x)>r}function H(t,e,n,o,{epsilon:r=u,skipDegenerateOther:s=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const n=i.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const i=n[o],a=n[o+1];if((!s||!p(i,a,r))&&(D(t,e,i,a,r)||A(t,e,i,a,r)))return!0}}return!1}function j(t,e,n,o,r=u){const s=x(t,e,r),i=m(t,e,r),a=x(n,o,r),c=m(n,o,r);if(!(s&&c||i&&a))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,h=Math.min(f.a.x,f.b.x),g=Math.max(f.a.x,f.b.x),p=d.a.x,y=Math.min(d.a.y,d.b.y),b=Math.max(d.a.y,d.b.y);return p>h+r&&p<g-r&&l>y+r&&l<b-r}function _(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+u&&t<r-u}function V(t,e,n){return m(t,e)&&m(e,n)?_(e.y,t.y,n.y):!(!x(t,e)||!x(e,n))&&_(e.x,t.x,n.x)}function W(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],i=o+1<t.length?t[o+1]:void 0;if(r&&i){if(p(r,i)){o++,e=!0;continue}if(V(r,s,i)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function K(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!m(o,r)&&!x(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&m(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&p(e,t)||n.push(t)}return n}function q(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=W(e);if(e=t.points,!t.changed)break}return e}n(h,"measuredNodeRect"),n(g,"nodeBoundsInfoFor"),n(p,"samePoint"),n(m,"sameX"),n(x,"sameY"),n(y,"isHorizontalSegment"),n(b,"isVerticalSegment"),n(M,"overlapLength"),n(I,"sameAxisSegmentOverlapLength"),n(S,"orthogonalSegmentsForPoints"),n(w,"countOrthogonalBends"),n(v,"dedupeConsecutivePoints"),n(C,"classifyThreeSegmentRoute"),n(L,"segmentBoundsOverlapRect"),n(k,"pointInsideRect"),n(O,"rectContainsRect"),n(R,"rectsOverlap"),n(N,"inflateRect"),n(T,"rectFromCenterSize"),n(B,"rectOfNodeBounds"),n(F,"portForRectSide"),n(E,"buildOrthogonalPortPath"),n($,"buildSameSideTrackPath"),n(Y,"collectRealNodeBounds"),n(X,"collectNodeRectEntries"),n(z,"collectLayoutNodeRects"),n(P,"getNodePairGeometry"),n(G,"segmentHitsAnyRect"),n(D,"orthogonalSegmentsCross"),n(A,"sameAxisSegmentsOverlap"),n(H,"segmentConflictsWithAnyEdge"),n(j,"orthogonalSegmentsStrictlyCross"),n(_,"strictlyBetween"),n(V,"isCollinearIntermediate"),n(W,"simplifyPolylineOnce"),n(K,"orthogonalizePolyline"),n(q,"simplifyPolyline");var U=.001;function J(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?B(r):void 0,dstRect:s?B(s):void 0}}function Z(t,e,n){if(x(t,e,U)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(m(t,e,U)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function Q(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&k(t[r],e,.5);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const i=Z(t[r],t[s],e);return n?[i,...t.slice(r)]:[...t.slice(0,r+1),i]}function tt(t,e){for(const n of t){const t=J(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=Q(o,t.srcRect,!0)),t.dstRect&&(o=Q(o,t.dstRect,!1)),o=q(K(o)),o=lt(o,t.srcRect,t.dstRect),t.edge.points=q(K(o))}}function et(t,e,n,o=!1){if(x(t,e,U)){if(e.y<n.top-U||e.y>n.bottom+U)return e;if(o){if(t.x<n.left-U)return{x:n.left,y:t.y};if(t.x>n.right+U)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(m(t,e,U)){if(e.x<n.left-U||e.x>n.right+U)return e;if(o){if(t.y<n.top-U)return{x:t.x,y:n.top};if(t.y>n.bottom+U)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function nt(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!p(e,o,U))return e}return t[e+n]}function ot(t,e){const n=t+4,o=e-4;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function rt(t,e,n){const{lo:o,hi:r}=ot(e,n);return Math.min(r,Math.max(o,t))}function st(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function it(t,e){return"left"===e||"right"===e?ot(t.top,t.bottom):ot(t.left,t.right)}function at(t,e,n){const o=t.y>=n.top-U&&t.y<=n.bottom+U,r=t.x>=n.left-U&&t.x<=n.right+U;if(x(t,e,U)&&o){if(Math.abs(t.x-n.left)<U)return"left";if(Math.abs(t.x-n.right)<U)return"right"}if(m(t,e,U)&&r){if(Math.abs(t.y-n.top)<U)return"top";if(Math.abs(t.y-n.bottom)<U)return"bottom"}}function ct(t){return"left"===t||"right"===t}function ft(t,e,n,o,r){const s=[],i=n?at(t,e,n):void 0,a=o?at(e,t,o):void 0;return n&&i&&ct(i)===r&&s.push(it(n,i)),o&&a&&ct(a)===r&&s.push(it(o,a)),s.length>0?st(s):void 0}function dt(t,e,n,o,r){const s=ft(t,e,n,o,r);if(!s)return;const i=r?t.y:t.x,a=Math.min(s.hi,Math.max(s.lo,i));return Math.abs(a-i)<U?void 0:r?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}function lt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return x(o,r,U)?dt(o,r,e,n,!0)??t:m(o,r,U)?dt(o,r,e,n,!1)??t:t}function ut(t,e,n){return ct(n)?{x:t.x,y:rt(t.y,e.top,e.bottom)}:{x:rt(t.x,e.left,e.right),y:t.y}}function ht(t,e,n,o,r,s){const i=t.map(t=>({...t}));for(let a=e;a>=0&&a<t.length;a+=n){const e=t[a];if(s&&!x(e,o,U))break;if(!s&&!m(e,o,U))break;s?i[a].y=r.y:i[a].x=r.x}return i}function gt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],i=nt(t,o,r);if(!i)return t;const a=at(s,i,e);if(!a)return t;const c=ct(a),f=ut(s,e,a);return p(s,f,U)?t:ht(t,o,r,s,f,c)}function pt(t,e,n){const o=Math.min(t.x,e.x)>=n.left-U&&Math.max(t.x,e.x)<=n.right+U,r=Math.min(t.y,e.y)>=n.top-U&&Math.max(t.y,e.y)<=n.bottom+U;return Math.abs(t.y-n.top)<U&&Math.abs(e.y-n.top)<U&&o?"top":Math.abs(t.y-n.bottom)<U&&Math.abs(e.y-n.bottom)<U&&o?"bottom":Math.abs(t.x-n.left)<U&&Math.abs(e.x-n.left)<U&&r?"left":Math.abs(t.x-n.right)<U&&Math.abs(e.x-n.right)<U&&r?"right":void 0}function mt(t,e,n,o){switch(t){case"top":return m(e,n,U)&&n.y<o.top-U;case"bottom":return m(e,n,U)&&n.y>o.bottom+U;case"left":return x(e,n,U)&&n.x<o.left-U;case"right":return x(e,n,U)&&n.x>o.right+U}}function xt(t,e,n){if(t.length<3)return t;if(n){const n=pt(t[0],t[1],e);return n&&mt(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=pt(t[o-1],t[o],e);return r&&mt(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function yt(t,e,n){let o=t;if(e){const t=nt(o,0,1);if(t){const n=et(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=xt(o,e,!0)}if(n){const t=o.length-1,e=nt(o,t,-1);if(e){const r=et(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=xt(o,n,!1)}const r=lt(o,e,n);return r!==o||2===o.length?r:(e&&(o=gt(o,e,!0)),n&&(o=gt(o,n,!1)),o)}function bt(t,e){for(const n of t){const t=J(n,e,2);if(!t)continue;const o=yt(v(t.points,U),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],{...o[0]},...o.slice(1,-1),o[o.length-1],{...o[o.length-1]}];t.edge.points=r}}function Mt(t){return new Map(t.map(t=>[t.id,t]))}function It(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function St(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function wt(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,i=s.y;if("number"!=typeof t||"number"!=typeof i)continue;const a=s.width??0,c=s.height??0;e=Math.min(e,t-a/2),n=Math.max(n,t+a/2),o=Math.min(o,i-c/2),r=Math.max(r,i+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function vt(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}function Ct(t){const e=Mt(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>St(n,e)-St(t,e));for(const e of n){const n=wt(t.filter(t=>t.parentId===e.id));n&&vt(e,n)}}function Lt(t,e){const o=t.nodes??[],r=t.edges??[],s=o.filter(t=>!t.isGroup);let i=1/0,a=-1/0;for(const t of s){const n=t[e];"number"==typeof n&&(i=Math.min(i,n),a=Math.max(a,n))}if(!Number.isFinite(i)||!Number.isFinite(a))return!1;const c=n(t=>i+a-t,"mirror");for(const t of o){const n=t[e];"number"==typeof n&&(t[e]=c(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?{...o,left:c(o.right),right:c(o.left)}:{...o,top:c(o.bottom),bottom:c(o.top)})}for(const t of r)for(const n of t.points??[])n[e]=c(n[e]);return!0}function kt(t){return!(t.nodes??[]).some(t=>!t.isGroup)||Lt(t,"y")}function Ot(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,i=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<i&&(i=n)}if(!Number.isFinite(s)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-i)*u+a,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-i)*u+a,o=t-s;e.x=n,e.y=o}Ct(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&Lt(t,"x"),!0;const g=Mt(n),p=new Map;for(const t of n){if(t.isGroup)continue;const e=It(t,g);if(!e)continue;const n=p.get(e)??[];n.push(t),p.set(e,n)}let m=0;for(const t of h){const e=t.padding??0;e>m&&(m=e)}const x=[];let y=1/0,b=-1/0;for(const t of h){const e=wt(p.get(t.id)??[]);e&&(y=Math.min(y,e.minX),b=Math.max(b,e.maxX),x.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||b===-1/0)return!0;const M=Math.max(0,b-y)+2*Math.max(m,10),I=a+M,S=(y+b)/2-M/2-a,w=S+I/2,v=Math.max(m,a);x.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<x.length;t++){const e=x[t];let n,o;if(0===t)n=e.contentTop-v;else{n=(x[t-1].contentBottom+e.contentTop)/2}if(t===x.length-1)o=e.contentBottom+v;else{const n=x[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=w,e.lane.y=s,e.lane.width=I,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:S,right:S+a,top:n,bottom:o}}return"RL"===e&&Lt(t,"x"),!0}n(J,"endpointContextFor"),n(Z,"segmentEnterPoint"),n(Q,"clipEndpoint"),n(tt,"clipEdgeEndpointsToNodeBoundaries"),n(et,"snapEndpointToBoundary"),n(nt,"firstDistinctAdjacent"),n(ot,"cornerClearanceRange"),n(rt,"clampToCornerClearance"),n(st,"intersectRanges"),n(it,"clearanceRangeForSide"),n(at,"terminalSideForSegment"),n(ct,"isHorizontalSide"),n(ft,"straightClearanceRange"),n(dt,"clearStraightEndpointCornerAxis"),n(lt,"clearStraightEndpointCornerConnections"),n(ut,"cornerClearedEndpoint"),n(ht,"moveCollinearEndpointRun"),n(gt,"clearEndpointCornerConnection"),n(pt,"borderSideForSegment"),n(mt,"leavesOutward"),n(xt,"collapseOwnBorderStub"),n(yt,"snapAndCollapseEndpoints"),n(bt,"prepareEdgeEndpointsForRenderer"),n(Mt,"buildNodeMap"),n(It,"resolveTopLevelGroupId"),n(St,"groupDepth"),n(wt,"boundsForChildren"),n(vt,"applyGroupBounds"),n(Ct,"recomputeNestedGroupBounds"),n(Lt,"mirrorAxis"),n(kt,"applyBtDirectionTransform"),n(Ot,"applyLrDirectionTransform");var Rt=1e-6,Nt=[0,8,-8,16,-16];function Tt(t,e){const{nodeInfoById:n,realNodeRects:o}=Y(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=C(v(r,Rt),Rt);if(!s)continue;const{p3:i}=s,a="HVH"===s.kind,c=P(e,n,Rt);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let m;const x=l.rect;for(const n of Nt){let r,s,c;if(a){const t=u.cy>l.cy?x.bottom:x.top,e=l.cx+n;if(e<=x.left+Rt||e>=x.right-Rt)continue;r={x:e,y:t},s={x:e,y:i.y},c={x:i.x,y:i.y}}else{const t=u.cx>l.cx?x.right:x.left,e=l.cy+n;if(e<=x.top+Rt||e>=x.bottom-Rt)continue;r={x:t,y:e},s={x:i.x,y:e},c={x:i.x,y:i.y}}const h=p(r,s,Rt),g=p(s,c,Rt);if(h&&g)continue;if(!h&&G(r,s,o,[f],1))continue;if(!g&&G(s,c,o,[d],1))continue;const y=!h&&H(r,s,t,e,{epsilon:Rt,skipDegenerateOther:!0}),b=!g&&H(s,c,t,e,{epsilon:Rt,skipDegenerateOther:!0});if(!y&&!b){m=h?[s,c]:g?[r,s]:[r,s,c];break}}m&&(e.points=m)}}function Bt(t,e){const o=.001,{realNodeRects:r,labelNodeRects:s}=X(e.values());for(const i of t){if(i.isLayoutOnly)continue;const a=i.points;if(!a||a.length<4)continue;const c=v(a,o);if(c.length<4)continue;const f=c.length-1,d=c[f],l=c[f-1],u=c[f-2],h=d.x-l.x,g=d.y-l.y,p=Math.hypot(h,g);if(p>=10||p<o)continue;const M=l.x-u.x,I=l.y-u.y;if(Math.hypot(M,I)<o)continue;const S=y(l,d,o),w=b(l,d,o),C=y(u,l,o),L=b(u,l,o);if(!(S&&L||w&&C))continue;const O=i.end,R=i.start,N=O?e.get(O):void 0;if(!N)continue;const T=N.x??0,F=N.y??0,E=B(N);if(!E)continue;let $,Y;if(L){const t=I<0;$={x:T,y:u.y},Y={x:T,y:t?E.bottom:E.top}}else{const t=M>0;$={x:u.x,y:F},Y={x:t?E.right:E.left,y:F}}if(G($,Y,r,O?[O]:[],-2))continue;if(G($,Y,s,[],-2))continue;if(R){const t=e.get(R),n=t?B(t):void 0;if(n&&k($,n,2))continue}const X=n((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),z=new Set;for(let t=0;t<c.length-1;t++)z.add(X(c[t],c[t+1]));const P=n((e,n)=>{for(const r of t){if(r===i)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],i=t[r+1];if(!z.has(X(s,i))&&j(e,n,s,i,o))return!0}}return!1},"segmentCrossesOtherEdge");if(P($,Y))continue;if(f-3>=0){const t=c[f-3];if(G(t,$,r,[R,O].filter(t=>Boolean(t)),-2))continue;if(P(t,$))continue}const D=[...c.slice(0,f-2),$,Y];i.points=D;const A=i.labelNodeId;if(A){const t=e.get(A);if(t){const e=t.width??0,n=t.height??0;if(e>0&&n>0){let r,s,i=-1;for(let t=0;t<D.length-1;t++){const a=D[t],c=D[t+1],f=Math.hypot(c.x-a.x,c.y-a.y),d=x(a,c,o),l=m(a,c,o);(d&&f>=e+2||l&&f>=n+2)&&(f>i&&(i=f,r=(a.x+c.x)/2,s=(a.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}n(Tt,"portSwapToLShape"),n(Bt,"collapseShortTerminalStub");var Ft=.001,Et=n(t=>"string"==typeof t?t.toUpperCase():"","upperCaseDirection"),$t=S,Yt=n((t,e)=>m(t,e,Ft)||x(t,e,Ft),"orthogonallyAligned");function Xt(t,e){const o=n((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let i=(t.width??0)/2,a=(t.height??0)/2;return Math.abs(s)*i>Math.abs(r)*a?(s<0&&(a=-a),{x:n+(0===s?0:a*r/s),y:o+a}):(r<0&&(i=-i),{x:n+i,y:o+(0===r?0:i*s/r)})},"rectIntersect"),r=n((t,n)=>{const r=v(t.points??[]);if(r.length<2)return;const s=n?t.start:t.end,i=s?e.get(s):void 0,a=i?B(i):void 0;if(!i||!s||!a)return;const c=n?r[0]:r[r.length-1],f=n?r[1]:r[r.length-2],d=o(i,c);let l=c;return Yt(f,d)&&(l=f),m(d,l,Ft)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:n,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:a}:x(d,l,Ft)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:n,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:a}:void 0},"terminalLaneFor"),s=n((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),i=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&m(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&x(t.boundary,e.boundary,1)},"sameTerminalFace"),a=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return s(t,e)>=8&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),c=n((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=s(t,e);if(n<8)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(i(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),f=n((t,e)=>{const o=v(t.edge.points??[]);if(o.length<2)return;const r="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},s="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!n(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?x(r,t.boundary,Ft)&&r.x>=t.rect.left+1&&r.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(m(r,t.boundary,Ft)&&r.y>=t.rect.top+1&&r.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=o.length>1&&p(o[1],t.railEnd,Ft),n=o.slice(e?2:1),i=n[0];if(i&&!Yt(i,s))return;return[r,s,...n]}const i=o.length>1&&p(o[o.length-2],t.railEnd,Ft),a=o.slice(0,i?-2:-1),c=a[a.length-1];return!c||Yt(c,s)?[...a,s,r]:void 0},"shiftedCandidate"),d=n(t=>{const n=t.edge,o=v(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,i=r?e.get(r):void 0,a=s?e.get(s):void 0;if(!i||!a)return!1;const c=i.x??0,f=i.y??0,d=a.x??0,l=a.y??0,[u,h]=o;return x(u,h,Ft)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||m(u,h,Ft)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),l=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[r(t,!0),r(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let o=t+1;o<e.length&&!n;o++){const s=e[t],i=e[o];if(s.edge===i.edge||!a(s,i)&&!c(s,i))continue;const u=!a(s,i),h=[s,i].sort((t,e)=>{const n=d(t),o=d(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const o of l){const s=f(t,o);if(!s)continue;const i=r({...t.edge,points:s},t.atStart);if(i&&!e.some(e=>e.edge!==t.edge&&(a(i,e)||u&&c(i,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function zt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=n((e,n)=>{const s=e.start,i=e.end,a=$t(n);if(a.length!==n.length-1)return!1;const c=[s,i].filter(t=>Boolean(t));for(const t of a){if(G(t.a,t.b,o,c,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of a)for(const n of $t(v(t))){if(I(e,n,.5)>=8)return!1;if(j(e.a,e.b,n.a,n.b,Ft))return!1}}return!0},"candidateIsSafe"),i=n((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=t[e+4],a=y(n,o)&&b(o,r)&&y(r,s)&&b(s,i)&&m(n,s,Ft)&&m(n,i,Ft)&&m(o,r,Ft)&&(o.x-n.x)*(s.x-r.x)<0,c=b(n,o)&&y(o,r)&&b(r,s)&&y(s,i)&&x(n,s,Ft)&&x(n,i,Ft)&&x(o,r,Ft)&&(o.y-n.y)*(s.y-r.y)<0;if(a||c)return v([...t.slice(0,e+1),i,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=b(n,o)&&y(o,r)&&b(r,s)&&y(s,i)&&b(i,f)&&m(n,i,Ft)&&m(n,f,Ft)&&m(r,s,Ft)&&(r.x-o.x)*(i.x-s.x)<0,l=y(n,o)&&b(o,r)&&y(r,s)&&b(s,i)&&y(i,f)&&x(n,i,Ft)&&x(n,f,Ft)&&x(r,s,Ft)&&(r.y-o.y)*(i.y-s.y)<0;return d||l?v([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=v(n.points??[]);for(let o=0;o<=t.length-5;o++){const r=i(t,o);if(r&&s(n,r)){n.points=r,e=!0;break}}if(e)break}if(!e)return}}function Pt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e,n)=>v(t===e?n??[]:t.points??[]),"pointsFor"),a=n((t,e)=>{let n=0;for(let o=0;o<s.length;o++){const r=$t(i(s[o],t,e));for(let a=o+1;a<s.length;a++){const o=$t(i(s[a],t,e));for(const t of r)for(const e of o)j(t.a,t.b,e.a,e.b,Ft)&&n++}}return n},"strictCrossingCount"),c=n(t=>{const e=$t(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),f=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));return o.filter(t=>{if(n.includes(t.id))return!1;const o=t.rect;if(e.horizontal){return M(e.a.x,e.b.x,o.left,o.right)>=8&&e.a.y>=o.top-2&&e.a.y<=o.bottom+2}return M(e.a.y,e.b.y,o.top,o.bottom)>=8&&e.a.x>=o.left-2&&e.a.x<=o.right+2})},"blockingRectsFor"),d=n((t,e,n)=>{const o=t.map(t=>({...t}));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=q(v(o));return $t(r).length===r.length-1?r:void 0},"candidateByMovingRail"),l=n((t,e,n)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=$t(e);if(f.length!==e.length-1)return!1;for(const t of f){if(G(t.a,t.b,o,c,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1}for(const e of s)if(e!==t)for(const t of f)for(const n of $t(i(e)))if(I(t,n,.5)>=8)return!1;return a(t,e)<=n},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of s){const o=i(n),r=c(o);if(!r)continue;const s=f(n,r.segment);if(0===s.length)continue;const a=r.horizontal?[Math.min(...s.map(t=>t.rect.top))-20,Math.max(...s.map(t=>t.rect.bottom))+20]:[Math.min(...s.map(t=>t.rect.left))-20,Math.max(...s.map(t=>t.rect.right))+20];for(const s of a){const i=d(o,r.segment,s);if(i&&l(n,i,t)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function Gt(t,e,o){const r=n(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),s=n(t=>{if(!t.isGroup||t.parentId)return;const e=Et(t.direction??o);if("LR"===e||"RL"===e||"BT"===e)return;const n=r(t),s=t.y,i=t.height;if(!n||"number"!=typeof s||"number"!=typeof i||!Number.isFinite(s)||!Number.isFinite(i)||i<=0)return;const a=n.right-n.left,c=n.bottom-n.top;return c<=0||a<c?void 0:{node:t,rect:n}},"topLaneTitleFor"),i=n((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<e.top-Ft||n>e.bottom+Ft)&&M(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(s).filter(t=>Boolean(t));if(0===a.length)return;let c=0;for(const e of t){if(e.isLayoutOnly)continue;const t=v(e.points??[]);for(const e of $t(t))for(const t of a)i(e,t.rect)&&(c=Math.max(c,t.rect.bottom-e.a.y+4))}if(!(c<=Ft))for(const t of a){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-c/2,t.node.height=n+c,t.node.groupTitleRect={...t.rect,top:t.rect.top-c,bottom:t.rect.bottom-c})}}function Dt(t,e,o){const r=n(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),s=n(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==Et(t.direction??o))return;const e=r(t),n=t.x,s=t.width;if(!e||"number"!=typeof n||"number"!=typeof s||!Number.isFinite(n)||!Number.isFinite(s)||s<=0)return;const i=e.right-e.left,a=e.bottom-e.top;return i<=0||a<i?void 0:{node:t,rect:e}},"leftLaneTitleFor"),i=n((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<e.left-Ft||n>e.right+Ft)&&M(t.a.y,t.b.y,e.top,e.bottom)>=8},"verticalSegmentIntersectsTitle"),a=n((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<e.top-Ft||n>e.bottom+Ft)&&M(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(t=>Boolean(t));if(0===c.length)return;let f=0;for(const e of t){if(e.isLayoutOnly)continue;const t=v(e.points??[]);for(const e of $t(t))for(const t of c)if(i(e,t.rect))f=Math.max(f,t.rect.right-e.a.x+4);else if(a(e,t.rect)){const n=Math.min(e.a.x,e.b.x);f=Math.max(f,t.rect.right-n+4)}}if(!(f<=Ft))for(const t of c){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-f/2,t.node.width=n+f,t.node.groupTitleRect={...t.rect,left:t.rect.left-f,right:t.rect.right-f})}}function At(t,e){const{realNodeRects:o}=X(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),i=n((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=$t(s(r[n],t));for(let i=n+1;i<r.length;i++){const n=$t(s(r[i],t));for(const t of o)for(const o of n)j(t.a,t.b,o.a,o.b,Ft)&&e++}}return e},"crossingCount"),a=n((t=new Map)=>r.reduce((e,n)=>e+w(s(n,t)),0),"totalBends"),c=n(t=>{const e=s(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return y(n,o,Ft)||b(n,o,Ft)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),f=n((t,e)=>{const n=s(t);if(n.length<3)return;const o=n[0],r=n[1];let i;if(y(o,r,Ft))i={x:r.x,y:e.tailStart.y};else{if(!b(o,r,Ft))return;i={x:e.tailStart.x,y:r.y}}const a=q(v([o,r,i,e.tailStart,e.terminal]));return $t(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of $t(e))if(G(t.a,t.b,o,n,-2))return!0;return!1},"pathHasNodeHit"),l=n((t,e,n)=>{for(const o of r)if(o!==t)for(const t of $t(e))for(const e of $t(s(o,n)))if(I(t,e,.5)>=8)return!0;return!1},"pathHasSharedTrack"),u=n((t,e,n)=>!d(t,e)&&!l(t,e,n),"candidateIsSafe"),h=n(()=>{const t=new Map;for(const n of r){const o=n.end;if(!o||!e.has(o))continue;if(s(n).length<4)continue;const r=t.get(o)??[];r.push(n),t.set(o,r)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=i();if(0===t)return;let e,n=t,o=a();for(const r of h().values())for(let s=0;s<r.length;s++)for(let d=s+1;d<r.length;d++){const l=r[s],h=r[d],g=c(l),p=c(h);if(!g||!p)continue;const m=f(l,p),x=f(h,g);if(!m||!x)continue;const y=new Map([[l,m],[h,x]]);if(!u(l,m,y)||!u(h,x,y))continue;const b=i(y),M=a(y);b>=t||(b>n||b===n&&M>=o||(e=y,n=b,o=M))}if(!e)return;for(const[t,n]of e)t.points=n}}function Ht(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),a=n((t=new Map)=>{let e=0;for(let n=0;n<s.length;n++){const o=$t(i(s[n],t));for(let r=n+1;r<s.length;r++){const n=$t(i(s[r],t));for(const t of o)for(const o of n)j(t.a,t.b,o.a,o.b,Ft)&&e++}}return e},"strictCrossingCount"),c=n((t=new Map)=>s.reduce((e,n)=>e+w(i(n,t)),0),"totalBends"),f=n(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,i=r?B(r):void 0,a=s?B(s):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=n((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=f(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),i=Math.max(o.src.right,o.dst.right),a=r<s-Ft?"left":r>i+Ft?"right":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:a,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),i=Math.max(o.src.bottom,o.dst.bottom),a=r<s-Ft?"top":r>i+Ft?"bottom":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:a,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),l=n(()=>{const t=[];for(const e of s){const n=i(e);for(const o of $t(n)){const r=d(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),u=n((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&M(t.min,t.max,e.min,e.max)>=8,"railsInteract"),h=n(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&u(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),g=n(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<Ft)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),p=n(t=>{const e=t.map(t=>t.coord),o=g(t),r=[];if(t.length<=6){const s=new Array(o.length).fill(!1),i=[],a=n(()=>{if(i.length!==t.length)for(const[t,e]of o.entries())s[t]||(s[t]=!0,i.push(e),a(),i.pop(),s[t]=!1);else i.some((t,n)=>Math.abs(t-e[n])>=Ft)&&r.push([...i])},"visit");return a(),r}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const o=[...e];[o[t],o[n]]=[o[n],o[t]],r.push(o)}return r},"coordinateAssignmentsFor"),m=n((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=q(v(e));if($t(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),x=n(t=>{for(const[e,n]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of $t(n)){if(G(e.a,e.b,o,t,-2))return!1;if(G(e.a,e.b,r,[],-2))return!1}}for(let e=0;e<s.length;e++){const n=s[e],o=t.has(n),r=$t(i(n,t));for(let n=e+1;n<s.length;n++){const e=s[n];if(!o&&!t.has(e))continue;const a=$t(i(e,t));for(const t of r)for(const e of a)if(I(t,e,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=c(),r=Number.POSITIVE_INFINITY;for(const s of h(l()))for(const i of p(s)){const f=m(s,i);if(!f||!x(f))continue;const d=a(f);if(d>=t)continue;const l=c(f),u=s.reduce((t,e,n)=>t+Math.abs(i[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function jt(t,e){const{realNodeRects:o,labelNodeRects:r}=X(e.values()),s=t.filter(t=>!t.isLayoutOnly),i=n((t,e,n)=>v(t===e?n??[]:t.points??[]),"pointsFor"),a=n(t=>$t(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),c=n((t,e)=>{let n=0;for(let o=0;o<s.length;o++){const r=$t(i(s[o],t,e));for(let a=o+1;a<s.length;a++){const o=$t(i(s[a],t,e));for(const t of r)for(const e of o)j(t.a,t.b,e.a,e.b,Ft)&&n++}}return n},"strictCrossingCount"),f=n((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&M(t.a.x,t.b.x,e.left,e.right)>=8}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&M(t.a.y,t.b.y,e.top,e.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=n(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?B(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),l=n((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=y(n,o,Ft)&&b(o,r,Ft)&&y(r,s,Ft),a=b(n,o,Ft)&&y(o,r,Ft)&&b(r,s,Ft);if(!i&&!a)return[];if(!(i?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=m(n,s,Ft)||x(n,s,Ft)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>q(v(t))).filter(t=>{if($t(t).length!==t.length-1)return!1;if(!t.some(t=>p(t,s,Ft)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),u=n((t,e,n)=>{const a=[t.start,t.end].filter(t=>Boolean(t)),l=d(t);for(const t of $t(e)){if(G(t.a,t.b,o,a,-2))return!1;if(G(t.a,t.b,r,[],-2))return!1;if(l.some(e=>f(t,e)))return!1}for(const n of s)if(n!==t)for(const t of $t(e))for(const e of $t(i(n)))if(I(t,e,.5)>=8)return!1;return c(t,e)<=n},"candidateIsSafe");for(let t=0;t<8;t++){const t=c();let e,n,o=t,r=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const d of s){const s=i(d),h=w(s,Ft),g=a(s);for(let i=0;i<=s.length-4;i++)for(const p of l(s,i)){const s=w(p,Ft),i=a(p);if(!(s<h||s===h&&i<g-Ft)||!u(d,p,t))continue;const l=c(d,p);l>o||l===o&&(s>r||s===r&&i>=f)||(e=d,n=p,o=l,r=s,f=i)}}if(!e||!n)return;e.points=n}}function _t(t,e){const o=20,r=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,o=B(t);o&&r.push({id:String(t.id??""),cx:e,cy:n,rect:o})}if(0===r.length)return;const s=new Map(r.map(t=>[t.id,t])),i=r.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],c={top:Math.min(...r.map(t=>t.rect.top))-o,bottom:Math.max(...r.map(t=>t.rect.bottom))+o,left:Math.min(...r.map(t=>t.rect.left))-o,right:Math.max(...r.map(t=>t.rect.right))+o},f=t.filter(t=>!t.isLayoutOnly),d=new Map(f.map((t,e)=>[t,e])),l=n(t=>{const e="left"===t||"top"===t?-1:1,n=[];for(let r=0;r<=2;r++)n.push(c[t]+e*o*r);return n},"outwardTracksForSide"),u=n((t,e=new Map)=>v(e.get(t)??t.points??[]),"replacementPointsFor"),h=n((t,e)=>{let n=0;for(const o of t)for(const t of e)j(o.a,o.b,t.a,t.b,Ft)&&n++;return n},"crossingCountBetweenSegments"),g=n((t,e)=>h($t(t),$t(e)),"crossingCountBetweenPaths"),p=n((t=new Map)=>{let e=0;const o=[],r=new Set,s=[],i=n(t=>{r.has(t)||(r.add(t),s.push(t))},"addEdge");for(let n=0;n<f.length;n++){const r=f[n],s=u(r,t);for(let a=n+1;a<f.length;a++){const n=f[a],c=g(s,u(n,t));c>0&&(e+=c,o.push({first:r,second:n,count:c}),i(r),i(n))}}return s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),{count:e,pairs:o,edgeSet:r,edges:s}},"crossingSnapshot"),m=n((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<f.length;t++){const o=f[t],s=n.has(o),i=u(o,e);for(let o=t+1;o<f.length;o++){const t=f[o];(s||n.has(t))&&(r+=g(i,u(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),x=n(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),M=n(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),S=n(t=>{const e=[];for(const n of x(t)){const t=new Set(n),o=new Set(n.flatMap(t=>M(t))),r=[...n];for(const e of f)t.has(e)||M(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),C=n((t,e,n)=>m(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),L=n(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),k=n(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),O=n((t=new Map)=>f.reduce((e,n)=>e+w(u(n,t)),0),"totalBends"),R=n((t=new Map)=>f.reduce((e,n)=>e+k(u(n,t)),0),"totalLength"),N=n((t,e,n=new Map)=>{const o=$t(e);for(const e of f)if(e!==t)for(const t of o)for(const o of $t(u(e,n)))if(I(t,o,.5)>=8)return!0;return!1},"pathHasSegmentConflict"),T=n((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of $t(e))if(G(t.a,t.b,i,n,-2))return!0;return!1},"pathHitsNode"),Y=n((t,e)=>{const n=q(v(e));$t(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),X=n(t=>"left"===t||"right"===t,"sideIsHorizontal"),z=n((t,e,n)=>{switch(e){case"left":return Math.min(t.x,n.x)-o;case"right":return Math.max(t.x,n.x)+o;case"top":return Math.min(t.y,n.y)-o;case"bottom":return Math.max(t.y,n.y)+o}},"localTrackForSameSide"),P=n((t,e,n,r)=>{const s="left"===n||"top"===n?-1:1,i=[z(e,n,r),c[n]];for(const a of i)for(let i=0;i<=2;i++)Y(t,$(e,n,r,a+s*o*i))},"addSameSideCandidates"),D=n((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))Y(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),A=n((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))Y(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),H=n((t,e,n,o,r)=>{const s=[...l("top"),...l("bottom")];for(const i of l(n))for(const n of l(r))for(const r of s)Y(t,[e,{x:i,y:e.y},{x:i,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),_=n((t,e,n,o,r)=>{const s=[...l("left"),...l("right")];for(const i of l(n))for(const n of l(r))for(const r of s)Y(t,[e,{x:e.x,y:i},{x:r,y:i},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),V=n(t=>{const e=new Set;return t.map(t=>v(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),W=n((t,e,n,r)=>{const s=[],i=E(t,e,n,r,o,Ft);i&&Y(s,i),e===r&&P(s,t,e,n);const a=X(e),c=X(r);return a&&!c?D(s,t,e,n,r):!a&&c?A(s,t,e,n,r):a?H(s,t,e,n,r):_(s,t,e,n,r),V(s)},"buildCandidatesForSides"),K=n((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=F(o,i),c="top"===i||"bottom"===i?l(i):s;for(const o of r){Y(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)Y(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),U=n((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=F(o,i),c="left"===i||"right"===i?l(i):r;for(const o of s){Y(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)Y(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),J=n(t=>{const e=t.start,n=t.end,o=n?s.get(n):void 0;if(!e||!o)return[];const r=v(t.points??[]);if(r.length<4)return[];const i=r[0],a=r[1],c=[];return b(i,a,Ft)?K(c,i,a,o):y(i,a,Ft)&&U(c,i,a,o),c},"terminalPreservingOuterTrackCandidates"),Z=n(t=>{const e=t.start,n=t.end,o=e?s.get(e):void 0,r=n?s.get(n):void 0;if(!o||!r)return[];const i=[];for(const t of a){const e=F(o,t);for(const n of a)i.push(...W(e,t,F(r,n),n))}return i.push(...J(t)),i},"candidatePathsFor"),Q=n(()=>new Map(f.map(t=>[t,$t(u(t))])),"currentSegmentsByEdge"),tt=n((t,e,n)=>{const o=new Set;for(const r of f){if(r===t)continue;const s=n.get(r)??$t(u(r));e.some(t=>s.some(e=>I(t,e,.5)>=8))&&o.add(r)}return o},"sharedTrackConflictsFor"),et=n((t,e,n,o)=>{const r=new Set;return Z(t).map(t=>q(v(t))).filter(e=>{if(T(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=$t(r);let i=0;for(const e of f)e!==t&&(i+=h(s,n.get(e)??$t(u(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+i,bends:w(r,Ft),totalBends:w(r),length:k(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:tt(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),nt=n((t,e,n,o,r,s)=>{let i=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(i+=n.count);let a=h(n.segments,r.segments);for(const t of f){if(t===e||t===o)continue;const i=s.get(t)??$t(u(t));a+=h(n.segments,i)+h(r.segments,i)}return t.count-i+a},"pairCrossingCount"),ot=n((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),rt=n((t,e)=>t.segments.some(t=>e.segments.some(e=>I(t,e,.5)>=8)),"candidatesShareTrack"),st=n((t,e,n,o)=>ot(e,n.edge)&&ot(o,t.edge)&&!rt(e,o),"pairCandidatesAreCompatible"),it=n((t,e,n,o,r)=>{const s=nt(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),at=n((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),ct=n((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!st(e,o,n,s))continue;const i=it(t,e,o,n,s);i&&at(i,r)&&(r=i)}return r},"bestScoreForOptionPair"),ft=n(t=>{const e=O(),n=R(),o=Q(),r=L(t),s=new Map(f.map(t=>[t,w(u(t))])),i=new Map(f.map(t=>[t,k(u(t))])),a=new Map,c=S(t);for(const e of c)for(const n of e){if(a.has(n))continue;const e=et(n,t,o,r);e.length>0&&a.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const l={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:i,baseSegments:o};for(const e of c){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>a.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=ct(l,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=p(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const i of t.edges){const a=w(u(i),Ft);for(const c of Z(i)){const f=T(i,c),d=!f&&N(i,c),l=C(t,i,c),u=w(c,Ft);if(f||d)continue;(l<e||l===e&&u<a)&&(l>r||l===r&&u>=s||(n=i,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const i=ft(t);if(!i)return;for(const[t,e]of i)t.points=e}}n(Xt,"separateSharedRenderedTerminalLanes"),n(zt,"collapseRedundantRectangularDoglegs"),n(Pt,"liftObstacleHuggingSameSideRails"),n(Gt,"liftTopLaneTitleBandsAboveRails"),n(Dt,"shiftLeftLaneTitleBandsLeftOfRails"),n(At,"swapDestinationTerminalTailsToReduceCrossings"),n(Ht,"reassignCrossingExternalRailChannels"),n(jt,"shortcutRedundantOrthogonalJogs"),n(_t,"resolveRenderedOrthogonalCrossings");var Vt=.001;function Wt(t,e){const{nodeInfoById:o,realNodeRects:r}=Y(e),s=["top","bottom","left","right"],i={top:Math.min(...r.map(t=>t.rect.top))-20,bottom:Math.max(...r.map(t=>t.rect.bottom))+20,left:Math.min(...r.map(t=>t.rect.left))-20,right:Math.max(...r.map(t=>t.rect.right))+20},a=n((t,e,n,o)=>{const r=[],s=E(t,e,n,o,20,Vt);return s&&r.push(s),e===o&&r.push($(t,e,n,i[e])),r},"buildOrthogonalPathCandidates"),c=n((t,e)=>{for(let n=0;n<t.length-1;n++){if(G(t[n],t[n+1],r,e,1))return!0}return!1},"pathHitsNode"),f=n((e,n,o=!1)=>{let r=0;const s=S(e,Vt),i=n.start,a=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&i&&a&&(t===i||t===a||c===i||c===a))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of S(f,Vt))(D(t.a,t.b,e.a,e.b,Vt,Vt)||I(t,e,Vt)>=8)&&r++}return r},"pathConflictCount"),d=n((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let i="top",a=n;return o<a&&(i="bottom",a=o),r<a&&(i="left",a=r),s<a&&(i="right",a=s),i},"nearestSideOfRect"),l=new Map,u=n((t,e,n)=>{const o=l.get(t)??[];o.push({side:e,edgeId:n}),l.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const n=e.id??"",r=e.start,s=e.end;if(r){const e=o.get(r);e&&u(r,d(t[0],e),n)}if(s){const e=o.get(s);e&&u(s,d(t[t.length-1],e),n)}}const h=n((t,e,n)=>l.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const n=w(t,Vt);if(n<4)continue;const r=e.start,i=e.end;if(!r||!i)continue;const g=o.get(r),p=o.get(i);if(!g||!p)continue;const m=e.id??"",x=f(t,e,!0),y=f(t,e);let b,M=x,I=n;for(const t of s){if(h(r,t,m))continue;const n=F(g,t);for(const o of s){if(h(i,o,m))continue;const s=F(p,o);for(const d of a(n,t,s,o)){if(c(d,[r,i]))continue;const t=w(d,Vt);if(x>0){const n=f(d,e,!0);if(n>M||n===M&&t>=I)continue;M=n,I=t,b=d;continue}f(d,e)>y||t<I&&(I=t,b=d)}}}if(b){e.points=b;const t=l.get(r);t&&l.set(r,t.filter(t=>t.edgeId!==m));const n=l.get(i);n&&l.set(i,n.filter(t=>t.edgeId!==m)),u(r,d(b[0],g),m),u(i,d(b[b.length-1],p),m)}}}n(Wt,"simplifyDetouredEdges");var Kt=.001;function qt(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const i=s.x-r.x,a=s.y-r.y;if(!(Math.abs(i)+Math.abs(a)<Kt)){if(Math.abs(a)<=Kt){const t=r.x+10*Math.sign(i);return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-7,bottom:r.y+7}}if(Math.abs(i)<=Kt){const t=r.y+10*Math.sign(a);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function Ut(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)}}function Jt(t,e){const n=v(e);return[qt(n,!0),qt(n,!1)].some(e=>e&&R(t,Ut(e)))}function Zt(t,e){const o=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let n=0;n<t.length-1;n++)o.push({edgeId:e.id,p1:t[n],p2:t[n+1]})}const r=[],s=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=B(t);e&&s.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const o=B(t);o&&r.push({nodeId:t.id,rect:o})}const i=n((t,e)=>{const n=N(e,3);for(const{nodeId:e,rect:o}of r)if(e!==t&&R(n,o))return!0;return!1},"labelOverlapsForeignNode"),a=n((t,e)=>{const n=N(e,3);for(const e of o)if(e.edgeId!==t&&L(e.p1,e.p2,n))return!0;return!1},"labelOverlapsForeignEdge"),c=n((t,e,n)=>i(t,n)||a(e,n),"labelOverlapsAnything"),f=[],d=n(t=>{for(const{id:e,rect:n}of s)if(O(n,t))return e},"findContainingLane"),l=n((t,e)=>f.some(n=>n.labelId!==t&&R(e,n.rect)),"overlapsPlacedLabel");for(const o of t){if(o.isLayoutOnly)continue;const t=o.labelNodeId;if(!t)continue;const r=e.get(t);if(!r)continue;const u=o.points;if(!u||u.length<2)continue;const h=r.width??0,g=r.height??0;if(h<=0||g<=0)continue;const p=[];for(let t=0;t<u.length-1;t++){const e=u[t],n=u[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<Kt&&r<Kt||(o>=Kt&&r>=Kt||p.push({idx:t,length:o+r,orientation:o>=Kt?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===p.length)continue;const m=p.length>=3?p.filter(t=>t.idx>0&&t.idx<p.length-1):p,x=m.length>0?m:p,y=h>=g?"horizontal":"vertical",b=n(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?h:g)+2;return o!==e.length>=("horizontal"===e.orientation?h:g)+2?o?-1:1:e.length-t.length}),"rankSegments"),M=p[0],I=p[p.length-1],S=[.5,.25,.75,.05,.95,.15,.85,.1,.9],w=n((t,e)=>{const n=u[t.idx],o=u[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),v=n((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),C=n((t,e)=>t.midX>=e.left-Kt&&t.midX<=e.right+Kt&&t.midY>=e.top-Kt&&t.midY<=e.bottom+Kt,"pointInsideRectInclusive"),L=n(t=>{const e=T(t.midX,t.midY,h,g),n=d(e);if(n)return{laneId:n,anchor:t,rect:e};const o=s.find(({rect:e})=>C(t,e));if(!o)return;const r=o.rect.left+h/2+1,i=o.rect.right-h/2-1,a=o.rect.top+g/2+1,c=o.rect.bottom-g/2-1;if(r>i||a>c)return;const f={midX:v(t.midX,r,i),midY:v(t.midY,a,c)},l=T(f.midX,f.midY,h,g);return C(t,l)?{laneId:o.id,anchor:f,rect:l}:void 0},"placementForAnchor"),k=n((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),O=n((t,e)=>{const n=("horizontal"===t.orientation?h/2:g/2)+12;if(t===M){const o=u[t.idx];if(k(t,e,o)+Kt<n)return!1}if(t===I){const o=u[t.idx+1];if(k(t,e,o)+Kt<n)return!1}return!0},"labelClearsTerminalEndpoints"),R=n(e=>{const n=b(e);for(const e of n)for(const n of S){const r=w(e,n);if(!O(e,r))continue;const s=L(r);if(s&&(!Jt(s.rect,u)&&!l(t,s.rect)&&!c(t,o.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),N=n((e,n,r=!1)=>{const s=b(e);for(const e of s){const s={midX:e.midX,midY:e.midY};if(n&&!O(e,s))continue;const c=L(s);if(c&&!Jt(c.rect,u)&&!l(t,c.rect)&&!i(t,c.rect)&&(r||!a(o.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),B=R(x)??(x.length<p.length?R(p):void 0)??N(p,!0)??N(p,!1)??N(p,!1,!0);if(B){r.x=B.anchor.midX,r.y=B.anchor.midY,r.parentId=B.laneId;const e=T(B.anchor.midX,B.anchor.midY,h,g),n=f.findIndex(e=>e.labelId===t);n>=0?f[n]={labelId:t,rect:e}:f.push({labelId:t,rect:e})}}}n(qt,"markerClearanceRectFor"),n(Ut,"normalizeRect"),n(Jt,"labelOverlapsOwnMarker"),n(Zt,"anchorLabelsToPolyline");var Qt=1e-6;function te(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function ee(t,e){const{nodeInfoById:o,realNodeRects:r}=Y(e),s=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&s.set(e,{w:t.width??0,h:t.height??0})}const i=n((e,o,r,i)=>{const a=te(o,r);let c=0;const f=n(t=>{if(!t)return;const e=s.get(t);if(!e)return;const n="x"===i?e.w/2:e.h/2;n>c&&(c=n)},"consider");f(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(te(t,o)===a&&f(n.labelNodeId))}return c>0?c+3:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!C(e.points,Qt))continue;const n=P(e,o,Qt);if(!n)continue;const{srcId:s,dstId:a,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=n;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(G(u,h,r,[s,a],1))continue;const g=i(e,s,a,d?"x":"y"),p=g>4?g:4,m=[0,p,-p];for(const n of m){const o={...u},i={...h};if(d){if(o.x+=n,i.x+=n,o.x<=c.rect.left||o.x>=c.rect.right)continue;if(i.x<=f.rect.left||i.x>=f.rect.right)continue}else{if(o.y+=n,i.y+=n,o.y<=c.rect.top||o.y>=c.rect.bottom)continue;if(i.y<=f.rect.top||i.y>=f.rect.bottom)continue}if(!G(o,i,r,[s,a],1)&&!H(o,i,t,e,{epsilon:Qt})){e.points=[o,i];break}}}}function ne(t,e){const o=.001,{realNodeRects:r,labelNodeRects:s}=X(e.values()),i=n((t,e)=>S(e,o).map(n=>({...n,edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=n(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...i(n,v(t)))}return e},"allSegments"),c=n((t,e)=>t.horizontal&&e.horizontal?M(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(M(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),f=n((e,n)=>{const a=e.start,f=e.end,d=i(e,n);if(d.length!==n.length-1)return!1;const l=[a,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(G(t.a,t.b,r,l,-2))return!1;if(G(t.a,t.b,s,u,-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of d)for(const r of i(n,v(t))){if(c(e,r))return!1;if(j(e.a,e.b,r.a,r.b,o))return!1}}return!0},"candidateIsSafe"),d=n((t,e)=>{const n=v(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>({...t}));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return i(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),l=n((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),u=n(t=>{const n=t.edge,o=v(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,i=r?B(r):void 0,a=s?B(s):void 0,c=o.slice(t.index+2);return r&&s&&i&&a&&0!==c.length?{sourceCenter:l(r,i),targetCenter:l(s,a),sourceRect:i,tail:c}:void 0},"sourceDetourContextFor"),h=n((t,e,n,r,s,i)=>{const a=r.y>=n.y,c=a?s.bottom:s.top,f=c+(a?20:-20);if(a&&t.b.y<=f+o||!a&&t.b.y>=f-o)return;const d=t.a.x+e;return v([{x:n.x,y:c},{x:n.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...i],o)},"verticalSourceDetour"),g=n((t,e,n,r,s,i)=>{const a=r.x>=n.x,c=a?s.right:s.left,f=c+(a?20:-20);if(a&&t.b.x<=f+o||!a&&t.b.x>=f-o)return;const d=t.a.y+e;return v([{x:c,y:n.y},{x:f,y:n.y},{x:f,y:d},{x:t.b.x,y:d},...i],o)},"horizontalSourceDetour"),p=n((t,e)=>{const n=u(t);if(n)return t.vertical?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?g(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),m=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!c(r,s))continue;const i=[r,s].filter(t=>t.interior);for(const t of i){for(const n of m){const o=d(t,n);if(o&&f(t.edge,o)){t.edge.points=o,e=!0;break}const r=p(t,n);if(r&&f(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function oe(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=r*a-s*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*a-d*i)/c,u=(f*s-d*r)/c,h=.01;return l>h&&l<.99&&u>h&&u<.99}function re(t){const e=t.nodes??[],n=t.edges??[],r=[];if(!n.length||!e.length)return r;const s=z(e),i=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,o=t.end,a=t.labelNodeId,c=t.id??`${n}->${o}`;for(const t of s)if(t.nodeId!==n&&t.nodeId!==o&&(!a||t.nodeId!==a))for(let n=0;n<e.length-1;n++)if(L(e[n],e[n+1],t,-1)){r.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)i.push({edgeId:c,start:n,end:o,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++){const n=i[t],o=i[e];if(n.edgeId!==o.edgeId&&(n.start!==o.start&&n.start!==o.end&&n.end!==o.start&&n.end!==o.end&&oe(n.p1,n.p2,o.p1,o.p2))){const t=n.edgeId<o.edgeId?`${n.edgeId}|${o.edgeId}`:`${o.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),r.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:o.edgeId,detail:`edges "${n.edgeId}" and "${o.edgeId}" cross`}))}}if(r.length>0){const t=r.filter(t=>"edge-node-overlap"===t.type).length,e=r.filter(t=>"edge-edge-crossing"===t.type).length;o.warn(`[SWIMLANE_VALIDATE] ${r.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of r)o.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return r}function se(t,e){const o=t.nodes??[],r=t.edges??[],s=o.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&s.length>0&&!Ot(t,e))return;if("BT"===e&&s.length>0&&!kt(t))return;for(const t of r){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=q(K(e)))}Wt(r,o),ee(r,o),Tt(r,o);const i=new Map;for(const t of o)i.set(String(t.id),t);Zt(r,i),tt(r,i),Bt(r,i),ne(r,i),Xt(r,i),zt(r,i),Pt(r,i),At(r,i);const a=n(()=>{_t(r,i),Xt(r,i),Ht(r,i),jt(r,i),Zt(r,i),bt(r,i),Pt(r,i),Zt(r,i),bt(r,i)},"finalizeRenderedEdges");a(),ne(r,i),a(),Gt(r,i,e),Dt(r,i,e),Gt(r,i,e),Dt(r,i,e)}function ie(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 t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function ae(t,e){return t.edges.filter(t=>t.dst===e)}function ce(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}function fe(t){const e=ce(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function de(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}function le(t,e){const o=[...e.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e)),r=new Set(t.edges.flatMap(t=>[t.src,t.dst])),s=n(e=>!r.has(e)&&!t.nodeById.get(e)?.isGroup,"isUnconnected"),i=[...e.keys()].filter(t=>0===e.get(t)&&s(t));let a=0;return o.map(t=>s(t)?i[a++]:t)}function ue(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function he(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function ge(t){const e=de(t),n=le(t,e),o=[],r=fe(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function pe(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function me(t){const e=new Array(t.length),o=n((n,r)=>{if(r-n<=1)return 0;const s=n+r>>1;let i=o(n,s)+o(s,r),a=n,c=s,f=n;for(;a<s||c<r;)c>=r||a<s&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=s-a);for(let o=n;o<r;o++)t[o]=e[o];return i},"count");return o(0,t.length)}function xe(t){const e=ie(t),o=new Map;for(const t of e.nodes)o.set(t,[]);for(const t of e.edges)o.get(t.src).push(t);for(const t of o.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const r=Object.create(null);for(const t of e.nodes)r[t]=0;const s=[],i=n(t=>{r[t]=1;for(const e of o.get(t)??[]){const t=e.dst;0===r[t]?i(t):1===r[t]&&s.push(e)}r[t]=2},"dfs"),a=de(e),c=[...e.nodes.filter(t=>0===(a.get(t)??0)),...e.nodes.filter(t=>0!==(a.get(t)??0))];for(const t of c)0===r[t]&&i(t);const f=new Set(s.map(t=>`${t.id}:${t.src}->${t.dst}`)),d=e.edges.map(t=>f.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:d,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}function ye(t){const e=new Map,o=n(n=>{if(e.has(n))return e.get(n);const r=t.nodeById.get(n);if(!r)return e.set(n,null),null;const s=r.parentId;if(!s)return e.set(n,null),null;const i=o(s)??s;return e.set(n,i),i},"resolve");for(const e of t.nodes)o(e);return e}function be(t){const e=ye(t);return t=>e.get(t)??null}function Me(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function Ie(t,e){const n=Me(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}n(te,"pairKey"),n(ee,"straightenCollinearSiblingDetours"),n(ne,"nudgeSharedInteriorSubpaths"),n(oe,"segmentsIntersect"),n(re,"validateSwimlanesLayout"),n(se,"postProcessSwimlaneLayout"),n(ie,"normalizeGraph"),n(ae,"incoming"),n(ce,"buildSuccessorMap"),n(fe,"buildSortedSuccessorMap"),n(de,"buildInDegreeMap"),n(le,"sortedZeroInDegreeNodes"),n(ue,"buildPredecessorSuccessorMaps"),n(he,"buildLayersFromRanks"),n(ge,"topoSortIfAcyclic"),n(pe,"buildLayerIndex"),n(me,"countInversions"),n(xe,"removeCycles_DFS"),n(ye,"buildTopLaneMap"),n(be,"createTopLaneResolver"),n(Me,"buildTopLaneOrder"),n(Ie,"resolveTopLaneOrder");var Se=8,we=4,ve=!0,Ce=100,Le=40;function ke(t,e){const o=ie(t),r=e?.laneOf??(()=>null),s=e?.rankHint,{preds:i}=ue(o);for(const t of i.values())t.sort((t,e)=>t.localeCompare(e));const a=ge(o)??[...o.nodes].sort((t,e)=>t.localeCompare(e)),c=new Map;for(const[t,e]of a.entries())c.set(e,t);const f=new Map,d=new Map;for(const t of o.nodes)d.set(t,[]);for(const t of a){const e=(i.get(t)??[]).filter(t=>f.has(t));if(e.length>0){const n=Oe(t,e,{laneOf:r,rankHint:s,topoIndex:c});f.set(t,n),d.get(n).push(t)}else f.has(t)||f.set(t,null)}for(const t of o.nodes)f.has(t)||f.set(t,null);const l=new Set;for(const t of o.nodes)null===(f.get(t)??null)&&l.add(t);const u=[...l].sort((t,e)=>{const n=c.get(t)??0,o=c.get(e)??0;return n===o?t.localeCompare(e):n-o}),h=Re(o),g=new Map;for(const[t,e]of h.entries())g.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const p=Ne(g),m=Te(g),x=new Map;for(const t of o.nodes)x.set(t,[]);for(const t of m)for(const e of t.nodes){const n=x.get(e);n?n.push(t.id):x.set(e,[t.id])}const y=[],b=[],M=new Set,I=n(t=>{if(!M.has(t)){M.add(t),y.push(t);for(const e of d.get(t)??[])I(e);b.push(t)}},"walk");for(const t of u)I(t);for(const t of a)I(t);return{parent:f,children:d,roots:u,componentOf:p,blocks:m,nodeBlocks:x,adjacency:g,preorder:y,postorder:b,topologicalOrder:a}}function Oe(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),i=null!=r&&r===o;if(i!==(null!=s&&s===o))return i?-1:1;const a=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=a&&null!=c&&a!==c)return c-a;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function Re(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}function Ne(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function Te(t){const e=new Map,o=new Map,r=[],s=[];let i=0;const a=n((n,c)=>{e.set(n,++i),o.set(n,i);for(const f of t.get(n)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(n)??0)&&(r.push([n,f]),o.set(n,Math.min(o.get(n)??i,e.get(f)??i))):(r.push([n,f]),a(f,n),o.set(n,Math.min(o.get(n)??i,o.get(f)??i)),(o.get(f)??0)>=(e.get(n)??0)&&s.push(Be(n,f,r,s.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return s}function Be(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Fe(t,e,o){const r=[...t.nodes],s=new Map;for(const[t,e]of r.entries())s.set(e,t);const i=r.length,a=new Array(i).fill(-1),c=new Array(i).fill(0),f=[],d=new Set;for(const t of r){const e=o.parent.get(t)??null,n=s.get(t);null!=n&&(null==e&&(a[n]=-1,c[n]=0,d.has(t)||(d.add(t),f.push(t))))}for(;f.length>0;){const t=f.shift(),e=s.get(t);if(null==e)continue;const n=o.children.get(t)??[];for(const t of n){if(d.has(t))continue;const n=s.get(t);null!=n&&(a[n]=e,c[n]=c[e]+1,d.add(t),f.push(t))}}for(const t of r){if(d.has(t))continue;const e=s.get(t);null!=e&&(a[e]=-1,c[e]=0,d.add(t))}const l=Math.max(1,Math.ceil(Math.log2(Math.max(1,i)))+1),u=Array.from({length:l},()=>new Array(i).fill(-1));for(let t=0;t<i;t++)u[0][t]=a[t];for(let t=1;t<l;t++)for(let e=0;e<i;e++){const n=u[t-1][e];u[t][e]=-1===n?-1:u[t-1][n]}const h=n((t,e)=>{if(-1===t||-1===e)return-1;c[t]<c[e]&&([t,e]=[e,t]);const n=c[t]-c[e];for(let e=0;e<l;e++)if(n>>e&1&&-1===(t=u[e][t]))return-1;if(t===e)return t;for(let n=l-1;n>=0;n--){const o=u[n][t],r=u[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return u[0][t]},"lcaIndex"),g=Array.from({length:i},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,r=e[t],i=e[o];if(null==r||null==i)continue;if(r>i&&([t,o]=[o,t],[r,i]=[i,r]),null==r||null==i||r===i)continue;const a=s.get(t),c=s.get(o);if(null==a||null==c)continue;const f=h(a,c);if(-1===f)continue;const d=g[f];for(let t=r;t<i;t++)d.set(t,(d.get(t)??0)+1)}const p=new Map,m=n((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),x=new Set,y=n(t=>{const n=s.get(t);x.add(t);const r=null==n?void 0:g[n],i=r?new Map(r):new Map,a=o.children.get(t)??[];for(const n of a){const o=y(n),r=e[t];if(null!=r){let s=p.get(t);s||(s=new Map,p.set(t,s));let i=o.get(r)??0;const a=e[n];null!=a&&a>r&&(i+=1),s.set(n,i)}m(i,o)}return i},"dfs");for(const t of o.roots)x.has(t)||y(t);for(const t of r)x.has(t)||y(t);return p}function Ee(t,e,o){const r=new Map,s=n(t=>{let n=o[t]??0;const i=[...e.get(t)??[]];i.sort($e(o));for(const t of i){s(t);const e=r.get(t);null!=e&&(n=Math.min(n,e))}r.set(t,n)},"annotate");for(const e of t)s(e);return r}function $e(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function Ye(t,e,o,r){let s=0;for(const t of e){const e=o[t]??0;e>s&&(s=e)}const i=Array.from({length:s+1},()=>[]),a=new Set,c=n(t=>{if(a.has(t))return;a.add(t);const e=o[t]??0;i[e]||(i[e]=[]),i[e].push(t);for(const e of r(t))c(e)},"emit");for(const e of t)c(e);for(const t of e)if(!a.has(t)){const e=o[t]??0;i[e]||(i[e]=[]),i[e].push(t),a.add(t)}return i}function Xe(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function ze(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const i=e[r]??0,a=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??i;e>i?a.push({child:t,min:e}):c.push(t)}return a.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??i,a=o.get(e)??i;return s!==a?s-a:t.localeCompare(e)}),[...a.map(t=>t.child),...c]}}function Pe(t,e,n){const o=ke(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const i=Fe(t,e,o),a=[...s].sort($e(e)),c=ze(r,e,i,Ee(a,r,e));let f=Ye(a,t.nodes,e,c);return f=Xe(f),f}function Ge(t,e,n){const o=new Set(t),r=new Set(e),s=pe(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push(s.get(t.dst));return me(i)}function De(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,i=t.dst,a=e,c=r;e>r&&(s=t.dst,i=t.src,a=r,c=e);for(let e=a;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:i,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=Ge(t[e],t[e+1],o);return r}function Ae(t,e){const n={...e},{preds:o}=ue(t),r=be(t);let s=De(Pe(t,n,r),t.edges,n);const i=we;for(let e=0;e<i;e++){let e=!1;const i=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const a of i){const i=n[a]??0;if(0===i)continue;let c=0;for(const t of o.get(a)??[])c=Math.max(c,(n[t]??0)+1);if(c>=i)continue;const f=i;n[a]=c;const d=De(Pe(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[a]=f}if(!e)break}return n}function He(t,e){const n=be(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let i=!1,a=0;for(const t of s){const e=n(t.dst);null==e||e===o?i=!0:a++}if(0===a||i)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+a;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function je(t,e){const n=ie(t),o=ge(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=be(n);let i=Object.create(null);for(const t of o){const o=ae(n,t),a=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===a.length)i[t]=0;else if(r&&1===a.length){const e=a[0].src,n=s(e),o=s(t);i[t]=n!==o?i[e]??0:(i[e]??0)+1}else{let e=-1/0;for(const t of a)e=Math.max(e,(i[t.src]??0)+1);i[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(i=Ae(n,i)),e?.ignoreCrossLaneEdges&&He(n,i);return{layers:Pe(n,i,s),rankOf:i,dummy:new Set}}function _e(t,e){const o=ie(t),r={...je(o,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},s=be(o),{preds:i,succs:a}=ue(o,t=>{if(e?.ignoreCrossLaneEdges){const e=s(t.src),n=s(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=ge(o)??[...o.nodes],f=[...c].reverse(),d=n((t,e)=>{let n=0;for(const e of i.get(t)??[])n=Math.max(n,(r[e]??0)+1);let o=Number.POSITIVE_INFINITY;const s=a.get(t)??[];return s.length>0&&(o=Math.min(...s.map(t=>(r[t]??0)-1))),Number.isFinite(o)||(o=Math.max(n,e)),Math.min(Math.max(e,n),o)},"clampFeasible"),l=Se,u=n(t=>{let e=!1;for(const n of t){const t=i.get(n)??[],o=a.get(n)??[];if(0===t.length&&0===o.length)continue;const s=t.length>0?t.reduce((t,e)=>t+(r[e]??0)+1,0)/t.length:r[n]??0,c=o.length>0?o.reduce((t,e)=>t+(r[e]??0)-1,0)/o.length:r[n]??0,f=Math.round((s+c)/2),l=d(n,f);l!==r[n]&&(r[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of i.get(t)??[])e=Math.max(e,(r[n]??0)+1);(r[t]??0)<e&&(r[t]=e)}for(const t of f){const e=a.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(r[t]??0)-1));(r[t]??0)>n&&(r[t]=n)}}return{layers:he(o,c,r),rankOf:r,dummy:new Set}}function Ve(t){const e=de(t),n=fe(t);let o=le(t,e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function We(t,e){const o=ie(t),r="LR"===e?.direction?Ve(o)??[...o.nodes].sort():ge(o)??[...o.nodes].sort(),s=be(o),i=n(t=>s(t)??t,"laneOf"),a=Object.create(null),c=new Map,f=n((t,n)=>e?.ignoreCrossLaneEdges??!0?i(t)===i(n)?1:0:1,"edgeWeight");for(const t of r){const e=o.nodeById.get(t);if(e?.isGroup)continue;const n=ae(o,t);let r=0;if(n.length>0)for(const e of n){const n=e.src,o=a[n]??0;r=Math.max(r,o+f(n,t))}const s=i(t),d=c.get(s)??0,l=Math.max(r,d);a[t]=l,c.set(s,l+1)}return{layers:he(o,r,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function Ke(t,e){const o=ie(e),{rankOf:r}=t,s=t.layers.map(t=>[...t]),i=new Set(t.dummy?[...t.dummy]:[]);let a=0;const c=new Map(o.nodeById),f=n(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(e,n),i.add(e);s.length<=t;)s.push([]);return s[t].push(e),r[e]=t,e},"addDummyAt"),d=[...o.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),l=[];for(const t of d){const e=r[t.src]??0,n=r[t.dst]??0;if(n-e<=1){l.push(t);continue}let o=t.src;for(let r=e+1,s=0;r<n;r++,s++){const e=f(r);l.push({id:`${t.id}#${s}`,src:o,dst:e,weight:t.weight,ref:t.ref}),o=e}const s=n-e-2;l.push({id:`${t.id}#${Math.max(s+1,0)}`,src:o,dst:t.dst,weight:t.weight,ref:t.ref})}const u={nodes:[...o.nodes,...[...i].filter(t=>!o.nodes.includes(t))],edges:l,layout:o.layout,nodeById:c};return{layering:{layers:s,rankOf:r,dummy:i},graphWithDummies:u}}function qe(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function Ue(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function Je(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function Ze(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function Qe(t,e,n){const o=new Set(t),r=new Set(e),s=pe(t),i=pe(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push({u:s.get(t.src),v:i.get(t.dst)});a.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return me(a.map(t=>t.v))}function tn(t,e,n){return[...t].sort((t,o)=>{const r=qe(e.get(t)??[]),s=qe(e.get(o)??[]);return r===s?Ze(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function en(t,e,n,o,r,s){const i=pe(t),a=pe(e),c=Je(e,i,n,o);if(!r||!s||0===s.length)return tn(e,c,a);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=tn(e,c,a);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=tn(l,c,a);for(const e of t){const t=Ue(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<Ue(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function nn(t,e,o,r,s){const i=[...e],a=new Set(t),c=new Set(e),f=r?new Set(r):null,d=o.filter(t=>a.has(t.src)&&c.has(t.dst)),l=f?o.filter(t=>c.has(t.src)&&f.has(t.dst)):void 0,u=n(e=>{let n=Qe(t,e,d);return l&&r&&(n+=Qe(e,r,l)),n},"crossingScore"),h=s?new Map:null;if(s&&h)for(const t of e)h.set(t,s(t));let g=!0,p=u(i);for(;g;){g=!1;for(let t=0;t+1<i.length;t++){if(h){if(h.get(i[t])!==h.get(i[t+1]))continue}const e=p;[i[t],i[t+1]]=[i[t+1],i[t]];const n=u(i);n<e?(p=n,g=!0):[i[t],i[t+1]]=[i[t+1],i[t]]}}return i}function on(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=be(e),i=Ie(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=en(o[t-1],o[t],r,"down",s,i),o[t]=nn(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=en(o[t+1],o[t],r,"up",s,i),o[t]=nn(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function rn(t,e,o){const r=o?.layerGap??Ce,s=o?.nodeGap??Le,i=o?.laneGap??2*s,a=o?.direction??"TB",c="LR"===a||"RL"===a,f=t.layers,d=Object.create(null),l=Object.create(null),u=n(t=>e.nodeById.get(t),"getNode"),h=n(t=>u(t)?.width??0,"getWidth"),g=n(t=>u(t)?.height??0,"getHeight"),p=be(e),m=Ie(e,o?.laneOrder),x=f.map(t=>t.reduce((t,e)=>Math.max(t,g(e)),0)),y=[];if(c)for(let t=0;t+1<f.length;t++){const e=f[t].reduce((t,e)=>Math.max(t,h(e)),0),n=f[t+1].reduce((t,e)=>Math.max(t,h(e)),0),o=x[t]/2+x[t+1]/2,s=(e+n)/2,i=Math.max(0,s-o-r);y.push(i)}const b=new Set;for(const t of f)for(const e of t)b.add(p(e));const M=b.has(null),I=m.filter(t=>b.has(t)),S=[...M?[null]:[],...I],w=Object.create(null);for(const t of I)w[t]=0;M&&(w.null=0);for(const t of f){const e=Object.create(null),n=[];for(const o of t){const t=p(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+h(e),0)+s*Math.max(0,n.length-1);w[t]=Math.max(w[t]??0,e)}if(M&&n.length){const t=n.reduce((t,e)=>t+h(e),0)+s*Math.max(0,n.length-1);w.null=Math.max(w.null??0,t)}}const v=new Map;{const t=S.map(t=>(null===t?w.null:w[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+i*Math.max(0,S.length-1))/2;for(let n=0;n<S.length;n++){const o=S[n],r=t[n]??0,s=e+r/2;v.set(o,s),e+=r,n<S.length-1&&(e+=i)}}let C=0;for(const[t,e]of f.entries()){const n=x[t]??0,o=new Map;for(const t of e){const e=p(t),n=o.get(e)??[];n.push(t),o.set(e,n)}for(const t of S){const e=o.get(t)??[];if(0===e.length)continue;const r=v.get(t);if(1===e.length){const t=e[0];d[t]=r,l[t]=C+n/2}else{const t=e.map(t=>h(t));let o=r-(t.reduce((t,e)=>t+e,0)+s*(e.length-1))/2;for(const[r,i]of e.entries()){const e=t[r];d[i]=o+e/2,l[i]=C+n/2,o+=e+s}}}C+=n+r+(y[t]??0)}const L=new Map;for(const t of e.edges){const e=t.ref.id;L.has(e)||L.set(e,[]),L.get(e).push(t)}for(const[,t]of L){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((d[o]??0)+(d[r]??0))/2),i=new Set;for(const e of t)i.add(e.src),i.add(e.dst);for(const t of i){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(d[t]=s)}}return{x:d,y:l}}n(ke,"buildDrivingTree"),n(Oe,"chooseParent"),n(Re,"buildAdjacency"),n(Ne,"assignComponents"),n(Te,"computeBlocks"),n(Be,"popBlock"),n(Fe,"computeSubtreeCrossCounts"),n(Ee,"annotateMinimumLayers"),n($e,"compareByRankThenId"),n(Ye,"emitNodesInTreeOrder"),n(Xe,"deduplicateLayers"),n(ze,"createChildOrderer"),n(Pe,"buildMultitreeLayerOrder"),n(Ge,"countCrossingsBetweenAdjacent"),n(De,"totalCrossings"),n(Ae,"optimizeRanksByCrossings"),n(He,"adjustCrossLaneSources"),n(je,"assignLayers_LongestPath"),n(_e,"assignLayers_Gravity"),n(Ve,"topoSortByGenerationIfAcyclic"),n(We,"assignLayers_LaneAwareCompact"),n(Ke,"makeProperLayering"),n(qe,"median"),n(Ue,"barycenter"),n(Je,"neighborPositionsFor"),n(Ze,"currentOrderTieBreak"),n(Qe,"countCrossingsBetweenAdjacent"),n(tn,"sortByHeuristic"),n(en,"reorderLayer"),n(nn,"transposeImprove"),n(on,"orderLayers"),n(rn,"assignCoordinates");function sn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function an(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function cn(t,e){const n=[...t],o=an(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function fn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function dn(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),i=n.get(r);null!=e&&null!=i&&(o+=s*Math.abs(e-i))}return o}function ln(t){const e=Me(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=be(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,i="string"==typeof e.end?e.end:void 0;if(!(s&&i&&t.nodeById.has(s)&&t.nodeById.has(i)))continue;const a=o(s),c=o(i);if(!a||!c||a===c)continue;const f=n.get(a),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[a,c]:[c,a],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function un(t,e,n){const o=[...t];let r=dn(o,e),s=!0,i=0;const a=Math.max(1,o.length);for(;s&&i<a;){s=!1,i++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=dn(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:fn(o,n)}}function hn(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function gn(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return sn(`${t.join("|")}#${o}#${n}`)}function pn(t,e={}){const n=Me(t);if(n.length<2)return n;const o=ln(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=un(n,o,r);const i=Math.max(0,e.restarts??8);for(let t=0;t<i;t++){const e=un(cn(n,gn(n,o,t)),o,r);hn(e,s)&&(s=e)}return s.order}function mn(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=ie(t),s=e?.automaticLaneOrdering?pn(r,{restarts:8}):void 0,i=xe(r),a=i.acyclic,c=n?We(a,{compactSingleInput:e?.compactSingleInput??ve,ignoreCrossLaneEdges:!0,direction:e?.direction}):_e(a,{compactSingleInput:e?.compactSingleInput??ve,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=Ke(c,a),l=on(f,d,{laneOrder:s}),u=rn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:a,reversed:i.reversed,layering:f,ordered:l,coordinates:u}}n(sn,"hashString"),n(an,"mulberry32"),n(cn,"deterministicShuffle"),n(fn,"sourceDistance"),n(dn,"laneArrangementCost"),n(ln,"buildWeightedLaneEdges"),n(un,"greedySwitch"),n(hn,"isBetterCandidate"),n(gn,"seedForRestart"),n(pn,"optimizeTopLaneOrder"),n(mn,"sugiyamaLayout");var xn=1e-6,yn=15,bn=15,Mn=20;function In(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,i=e.y-r,a=Math.abs(s),c=Math.abs(i);if(a<xn&&c<xn)return n;return c>xn&&3*c>=a?i>0?"bottom":"top":a>xn?s>0?"right":"left":n}function Sn(t,e){return Math.abs(t.to-e.from)<xn||Math.abs(t.to-e.to)<xn?t.to:t.from}function wn(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function vn(t,e){const o=t.nodes??[],r=t.edges??[],s=[];for(const t of r)t.isLayoutOnly||s.push({...t,__originalEdge:t});const i=new Map,a=new Map,c=[],f="LR"===e;for(const t of o)i.set(t.id,t);const d=o.filter(t=>t.isGroup&&!t.parentId);for(const t of d){const e={id:t.id},r=n(t=>{a.set(t.id,e),o.filter(e=>e.parentId===t.id).forEach(r)},"assignLane");r(t)}const l=o.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0;return{nodeId:t.id,minX:o-e/2-8,maxX:o+e/2+8,minY:r-n/2-8,maxY:r+n/2+8,visualXHalfExtent:f?n/2+8:e/2+8}}),u=n((t,e,n,o)=>{let r=c.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},c.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),h=n((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),g=n((t,e,n)=>h(t,In(t,e,n?"bottom":"top")),"getOrthogonalPort"),p=[],m=[],x=new Set,y=n((t,e,n)=>{if(0===p.length)return 0;const o=Math.abs(e.y-n.y)<xn,r=Math.abs(e.x-n.x)<xn;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-xn,i=Math.max(e.x,n.x)+xn;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-xn<=o&&e.to+xn>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-xn,i=Math.max(e.y,n.y)+xn;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-xn<=o&&e.to+xn>=o&&(s+=1e3))}return s},"crossingPenalty"),b=s.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=i.get(t.start),o=i.get(t.end),r=a.get(t.start),s=a.get(t.end);return{idx:e,crossLane:r&&s&&r.id!==s.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),M=n((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return!!l.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>xn?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>i&&c.minY<a)))},"isSegmentBlocked"),I=new Map,S=new Map;for(const t of s)t.start&&t.end&&t.start!==t.end&&(S.set(t.start,(S.get(t.start)??0)+1),S.set(t.end,(S.get(t.end)??0)+1));const w=n((t,e)=>In(t,e,"bottom"),"determineSide"),v=new Map;for(const[t,e]of s.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=i.get(e.start),o=i.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),s=(o.y??0)-(n.y??0);v.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:w(n,{x:o.x??0,y:o.y??0}),dstSide:w(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(s),dxSign:Math.sign(r),dySign:Math.sign(s)})}const C=n(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),L=n(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const t of v.values()){const e=`${t.srcId}:${t.srcSide}`;k.has(e)||k.set(e,[]),k.get(e).push(t)}const O=new Map,R=n((t,e)=>`${t}:${e}`,"loadKey");for(const t of v.values())O.set(R(t.srcId,t.srcSide),(O.get(R(t.srcId,t.srcSide))??0)+1),O.set(R(t.dstId,t.dstSide),(O.get(R(t.dstId,t.dstSide))??0)+1);for(const t of k.values())if(!(t.length<2)){t.sort((t,e)=>{const n=C(t),o=C(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=L(n),r=O.get(R(n.srcId,n.srcSide))??0,s=O.get(R(n.srcId,o))??0;s>=r||(O.set(R(n.srcId,n.srcSide),r-1),O.set(R(n.srcId,o),s+1),n.srcSide=o)}}const N=n(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),T=new Map;for(const t of v.values())T.has(t.dstId)||T.set(t.dstId,new Set),T.get(t.dstId).add(t.dstSide);for(const t of v.values()){if(!N(i.get(t.srcId)))continue;const e=T.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=L(t);if(e.has(n)||(O.get(R(t.srcId,n))??0)>0)continue;const o=O.get(R(t.srcId,t.srcSide))??0;O.set(R(t.srcId,t.srcSide),Math.max(0,o-1)),O.set(R(t.srcId,n),1),t.srcSide=n}for(const t of v.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:s}=t,a=i.get(n),c=i.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;I.has(f)||I.set(f,[]),I.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${s}:dst`,u="top"===s||"bottom"===s?a.x??0:a.y??0;I.has(l)||I.set(l,[]),I.get(l).push({edgeIdx:e,oppositeCoord:u})}const B=new Map;for(const[t,e]of I){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],s=n[n.length-1],a=i.get(o);if(!a)continue;const c="left"===r||"right"===r?a.height??10:a.width??10,f=a.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${s}`;B.set(o,e)}}const F=n(t=>Boolean(s[t]?.labelNodeId),"edgeHasLabelNode"),E=n((t,e)=>!!t&&((I.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>F(t))||(I.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>F(t))),"faceHasLabelNode"),$=n((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),Y=n((t,e,n)=>{const o=v.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},i=o?.srcSide??w(e,r),a=o?.dstSide??w(n,s);let c=o?h(e,o.srcSide):g(e,r,!0),f=o?h(n,o.dstSide):g(n,s,!1);const d=B.get(`${t}:src`),l=B.get(`${t}:dst`);return void 0!==d&&(c=$(c,i,d)),void 0!==l&&(f=$(f,a,l)),{pSrcPort:c,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(const t of b){const e=s[t];if(m[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const o=i.get(e.start),r=i.get(e.end);if(!o||!r)continue;const{pSrcPort:a,pDstPort:d,srcSide:h,dstSide:g}=Y(t,o,r),b={...a},w={...d},v="top"===h||"bottom"===h,C="top"===g||"bottom"===g;if(v){const t=a.y>(o.y??0);b.y=t?a.y+Mn:a.y-Mn}else{const t=a.x>(o.x??0);b.x=t?a.x+Mn:a.x-Mn}if(C){const t=d.y>(r.y??0);w.y=t?d.y+Mn:d.y-Mn}else{const t=d.x>(r.x??0);w.x=t?d.x+Mn:d.x-Mn}const L=n((t,e)=>{for(const n of l)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),k=n((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+yn:o.minX-yn,y:r?o.maxY+bn:o.minY-bn,leavesPositiveSide:r}}const s=t.x>(e.x??0),i=(n.y??0)>=t.y;return{x:s?o.maxX+yn:o.minX-yn,y:i?o.maxY+bn:o.minY-bn,leavesPositiveSide:s}},"obstacleDetour");let O=[];const R=[e.start,e.end],N=L(b,R);if(N.inside&&N.obstacle){const t=N.obstacle;if(v){const e=k(a,o,r,t,!0);b.x=e.x,b.y=e.y;const n=e.leavesPositiveSide?Math.min(t.minY-2,a.y+Mn):Math.max(t.maxY+2,a.y-Mn);O=[{x:a.x,y:n},{x:e.x,y:n},{x:e.x,y:e.y}]}else{const e=k(a,o,r,t,!1),n=e.leavesPositiveSide?Math.min(t.minX-2,a.x+Mn):Math.max(t.maxX+2,a.x-Mn);b.x=e.x,b.y=e.y,O=[{x:n,y:a.y},{x:n,y:e.y},{x:e.x,y:e.y}]}}let T=[];const F=L(w,R);if(F.inside&&F.obstacle){const t=F.obstacle;if(C){const e=k(d,r,o,t,!0);w.x=e.x,w.y=e.y,T=[{x:e.x,y:e.y},{x:d.x,y:e.y}]}else{const e=k(d,r,o,t,!1);w.x=e.x,w.y=e.y,T=[{x:e.x,y:e.y},{x:e.x,y:d.y}]}}if(0===O.length&&0===T.length){const n=yn,o=Math.abs(b.x-w.x)<n,r=Math.abs(b.y-w.y)<n,s=void 0!==B.get(`${t}:src`)||void 0!==B.get(`${t}:dst`),i=(I.get(`${e.start??""}:${h}:src`)?.length??0)+(I.get(`${e.start??""}:${h}:dst`)?.length??0),c=(I.get(`${e.end??""}:${g}:src`)?.length??0)+(I.get(`${e.end??""}:${g}:dst`)?.length??0),f=i>1||c>1,l=S.get(e.start??"")??0,u=S.get(e.end??"")??0,m=i>1&&E(e.start,h)||c>1&&E(e.end,g);if((o||r)&&!s&&(!f||f&&!m&&(i<=1||l<=2)&&(c<=1||u<=2))){if(!M(a,d,e.start,e.end)){e.points=[{...a},{...b},{...w},{...d}],x.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,d.x):Math.min(a.y,d.y),i=r?Math.max(a.x,d.x):Math.max(a.y,d.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};p.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const $=u("vertical",b.x,b.y,b.y);b.x=$.coord;const X=u("vertical",w.x,w.y,w.y);w.x=X.coord;let z=Math.min(b.x,w.x)-50,P=Math.max(b.x,w.x)+50,G=Math.min(b.y,w.y)-50,D=Math.max(b.y,w.y)+50;for(const t of l){const e=Math.min(b.x,w.x),n=Math.max(b.x,w.x),o=Math.min(b.y,w.y),r=Math.max(b.y,w.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(z=Math.min(z,t.minX-25),P=Math.max(P,t.maxX+25),G=Math.min(G,t.minY-25),D=Math.max(D,t.maxY+25))}for(const t of l){if(t.maxX<z||t.minX>P||t.maxY<G||t.minY>D)continue;const e=yn;u("horizontal",t.minY-e,z,P),u("horizontal",t.maxY+e,z,P);const n=bn;u("vertical",t.minX-n,G,D),u("vertical",t.maxX+n,G,D)}u("horizontal",b.y,z,P),u("horizontal",w.y,z,P);const A=c.filter(t=>"horizontal"===t.orientation&&t.coord>=G&&t.coord<=D),H=c.filter(t=>"vertical"===t.orientation&&t.coord>=z&&t.coord<=P),j=n((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),_=j(b.x,b.y),V=j(w.x,w.y),W=new Map,K=new Map,q=new Map,U=new Set,J=[];W.set(_,0),q.set(_,"n"),J.push({key:_,f:Math.hypot(w.x-b.x,w.y-b.y),pt:b}),U.add(_);let Z=[];const Q=n((t,n)=>M(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:w.x,y:b.y},et=Q(b,tt),nt=Q(tt,w),ot=et||nt,rt={x:b.x,y:w.y},st=Q(b,rt),it=Q(rt,w);if(ot?st||it||(Z=Math.abs(b.x-w.x)<xn?[b,w]:[b,rt,w]):Z=Math.abs(b.y-w.y)<xn||Math.abs(b.x-w.x)<xn?[b,w]:[b,tt,w],0===Z.length)for(;J.length>0;){J.sort((t,e)=>t.f-e.f);const n=J.shift();if(U.delete(n.key),n.key===V){let t=V,e=w;for(Z=[e];K.has(t);){const n=K.get(t);Z.unshift(n),e=n,t=j(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=H.sort((t,e)=>t.coord-e.coord),i=s.findIndex(t=>Math.abs(t.coord-o)<1),a=A.sort((t,e)=>t.coord-e.coord),c=a.findIndex(t=>Math.abs(t.coord-r)<1),f=[];i>0&&f.push({x:s[i-1].coord,y:r}),i>=0&&i<s.length-1&&f.push({x:s[i+1].coord,y:r}),c>0&&f.push({x:o,y:a[c-1].coord}),c>=0&&c<a.length-1&&f.push({x:o,y:a[c+1].coord});for(const s of f){const i=Math.min(o,s.x),a=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(l.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(i!==a?t.minY<r&&t.maxY>r&&t.maxX>i&&t.minX<a:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const d=j(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const p=w.x-b.x,m=w.y-b.y,x=s.x-o,M=s.y-r;(m>10&&M<-5||m<-10&&M>5)&&(g=100*Math.abs(M)),(p>10&&x<-5||p<-10&&x>5)&&(g+=50*Math.abs(x));let I=0;const S=q.get(n.key)??"n",v=Math.abs(x)>xn?"h":"v";"n"!==S&&S!==v&&(I=50);const C=u+h+g+I,L=(W.get(n.key)??1/0)+C,k=Math.abs(w.x-s.x)+Math.abs(w.y-s.y);if(L<(W.get(d)??1/0))if(K.set(d,n.pt),W.set(d,L),q.set(d,v),U.has(d)){const t=J.findIndex(t=>t.key===d);-1!==t&&(J[t].f=L+k)}else J.push({key:d,f:L+k,pt:s}),U.add(d)}}if(0===Z.length&&(Z=[b,{x:b.x,y:w.y},w]),Z.length>4){const t=Z[0],e=Z[Z.length-1];let o=Math.min(t.x,e.x),r=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y);for(const t of Z)o=Math.min(o,t.x),r=Math.max(r,t.x),s=Math.min(s,t.y),i=Math.max(i,t.y);const a=r>Math.max(t.x,e.x),c=o<Math.min(t.x,e.x);if(f){const n=bn;if(a){const o=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y),a=l.filter(t=>t.minX<o&&t.maxX>o&&t.minY<i&&t.maxY>s);if(a.length>0){let o=Math.max(t.x,e.x);for(const t of a){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const r=e+t.visualXHalfExtent+n;o=Math.max(o,r)}isNaN(o)||(r=o)}}if(c){const r=l.filter(o=>o.minX<Math.min(t.x,e.x)+n&&o.minY<Math.max(t.y,e.y)&&o.maxY>Math.min(t.y,e.y));if(r.length>0){let s=Math.min(t.x,e.x);for(const t of r){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-n;s=Math.min(s,e)}o=s}}}const d=n(n=>{const o=e.y>t.y,r=l.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(f&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;if(o){const t=Math.max(...s.map(t=>t.maxY))+15;if(t<e.y-xn)return t}else{const t=Math.min(...s.map(t=>t.minY))-15;if(t>e.y+xn)return t}return e.y},"findBestReturnY"),u=n(n=>{const o=d(n),r={x:n,y:t.y},s={x:n,y:o},i={x:e.x,y:o},a=Q(t,r),c=Q(r,s),f=Q(s,i),l=o!==e.y&&Q(i,e);return a||c||f||l?null:Math.abs(o-e.y)<xn?[t,r,s,e]:[t,r,s,i,e]},"trySimplifyWithDetourX"),h=a&&!c?u(r):c&&!a?u(o):null;h&&(Z=h)}const at=[a,...O,...Z,...T.reverse(),d];if(at.length>=3){const t=at[at.length-1],e=at[at.length-2],n=at[at.length-3],o=Math.abs(n.y-e.y)<xn&&Math.abs(e.y-t.y)<xn,r=Math.abs(n.x-e.x)<xn&&Math.abs(e.x-t.x)<xn;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&at.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&at.splice(-2,1)}}const ct=[at[0]];for(let t=1;t<at.length-1;t++){if(1===t){ct.push(at[t]);continue}const e=ct[ct.length-1],n=at[t],o=at[t+1];if(Math.abs(e.y-n.y)<xn&&Math.abs(n.y-o.y)<xn){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<xn&&Math.abs(n.x-o.x)<xn){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(at[at.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<xn?"vertical":"horizontal",s="vertical"===r?n.x:n.y,i="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),a="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=u(r,s,i,a),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:i,to:a};p.push(f),m[t].push(p.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:i,to:a})}}const X=n((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),z=n((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&X(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&X(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),P=n(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),G=n((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),D=n((t,e)=>{const n=m[t.edgeIndex];for(const o of n){const n=p[o];n.pipe===t.pipe&&G(n,e)}},"moveSegmentChainToTrack"),A=n(t=>{const e=m[t.edgeIndex],n=e.indexOf(p.indexOf(t)),o=[];return n>0&&o.push(p[e[n-1]]),n<e.length-1&&o.push(p[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),H=n((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),j=n((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&X(t,e)))return n.index}return-1},"findAvailableTrack"),_=n((t,e)=>{if(t.trackIndex===e.trackIndex)return X(t,e);const n=A(t),o=A(e);return n.some(t=>o.some(e=>H(t,e)))},"segmentsConflict"),V=n((t,e,n)=>{if(z(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=j(t.pipe,e);n(e,-1!==o?o:P(t.pipe))},"resolveTrackConflict"),W=n(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(_(r,s)&&(e++,V(r,s,D)))}return e},"resolveHandleConflicts"),K=new Map,q=n(t=>{if(K.has(t))return K.get(t);const e=m[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return K.set(t,e),e}const n=p[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=p[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return K.set(t,r),r},"getDestInfo"),U=n(()=>{let t=0;const e=new Map;for(const[t,n]of s.entries())0!==m[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const o=n(t=>{const e=s[t];if(!e.start||!e.end)return 0;const n=i.get(e.start),o=i.get(e.end);if(!n||!o)return 0;const r=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);return Math.abs(r)+Math.abs(a)},"getEdgeDistance");for(const n of e.values()){n.sort((t,e)=>{const n=q(t),r=q(e);if(Math.abs(n.deviation-r.deviation)>1)return n.deviation-r.deviation;if(Math.abs(n.dest-r.dest)>1)return n.dest-r.dest;const s=o(t),i=o(e);if(Math.abs(s-i)>1)return i-s;const a=m[t].length,c=m[e].length;if(a!==c)return a-c;if(1===a){const n=m[t][0],o=m[e][0];if(p[n]&&p[o]){const t=p[n],e=p[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=n.map(t=>p[m[t][0]]);t+=W(e)}return t},"fixSourceHandleCrossings"),J=n(()=>{let t=0;const e=new Map;for(const[t,n]of s.entries()){0!==m[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const o of e.values()){o.sort((t,e)=>{const o=n(t=>{const e=m[t];if(e.length<2)return 0;const n=p[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),r=o(t),s=o(e);return Math.abs(r-s)>.1?r-s:t-e});const e=o.map(t=>p[m[t][m[t].length-1]]);t+=W(e)}return t},"fixTargetHandleCrossings"),Z=n(()=>{let t=0;for(const e of c){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=m[e.edgeIndex].find(t=>p[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(p[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];_(r,s)&&(t++,V(r,s,G))}}return t},"fixPipeCrossings");let Q=0;for(;Q<10;){let t=0;if(t+=U(),t+=J(),t+=Z(),0===t)break;Q++}const tt=new Map;for(const t of c){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const o=[];if(e.length>0){let t=[e[0]],n=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<n?(t.push(s),n=Math.max(n,s.to)):(o.push(t),t=[s],n=s.to)}o.push(t)}for(const e of o){const o=new Set;e.forEach(t=>o.add(t.trackIndex));const r=new Map;e.forEach(t=>{const e=q(t.edgeIndex);r.set(t.trackIndex,(r.get(t.trackIndex)??0)+e.delta)});const s=[...o].filter(t=>(r.get(t)??0)<-1),i=[...o].filter(t=>(r.get(t)??0)>1),a=[...o].filter(t=>Math.abs(r.get(t)??0)<=1);s.sort((t,e)=>(r.get(e)??0)-(r.get(t)??0)),i.sort((t,e)=>(r.get(t)??0)-(r.get(e)??0));const c=n((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=x.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let f=0;for(const e of s)f++,c(e,t.coord-10*f);if(0===a.length&&o.size>0){const t=[...o].sort((t,e)=>Math.abs(r.get(t)??0)-Math.abs(r.get(e)??0))[0],e=s.indexOf(t);-1!==e&&s.splice(e,1);const n=i.indexOf(t);-1!==n&&i.splice(n,1),a.push(t)}let d=0;for(const e of a){if(0===d)c(e,t.coord);else{const n=d%2==1?1:-1,o=Math.ceil(d/2);c(e,t.coord+n*o*10*.5)}d++}let l=0;for(const e of i)l++,c(e,t.coord+10*l)}}for(const[t,e]of s.entries()){const n=m[t]??[];if(0===n.length)continue;const o=[],r=i.get(e.start),s=i.get(e.end),{pSrcPort:a,pDstPort:c}=Y(t,r,s),f=n.map(t=>{const e=p[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(a);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,i=f[t+1],a=t<f.length-1;if(Math.abs(s-e.coord)>xn&&o.push(wn(e,r)),a&&i.orient===e.orient)if(Math.abs(e.coord-i.coord)>xn){const t="vertical"===e.orient?(r+i.from)/2:Sn(e,i);o.push(wn(e,t),wn(i,t))}else 0!==t&&t!==f.length-2||o.push(wn(e,Sn(e,i)));else if(a)o.push(wn(e,i.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(wn(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>xn||Math.abs(d.y-c.y)>xn)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>xn||Math.abs(e.y-n.y)>xn)&&l.push(e)}e.points=l}for(const t of s){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=n((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const i=n-r/2,a=n+r/2,c=o-s/2,f=o+s/2;if(t.x<i||t.x>a||t.y<c||t.y>f)return t;const d=t.x-i,l=a-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:i,y:t.y}:g===l?{x:a,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?i.get(n):void 0,s=o?i.get(o):void 0;r&&(t[0]=et(t[0],r)),s&&(t[t.length-1]=et(t[t.length-1],s))}return t}function Cn(t){return t.direction??"TB"}function Ln(t){const e=f(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,a=Cn(t),{ordered:c,coordinates:l}=mn(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:i,direction:a});d(e,c,l,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;vn(t,a);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return se(t,a),re(t),a}function kn(t){c(t);const e=l(t);t.nodes=e.nodes,t.edges=e.edges}n(In,"chooseOrthogonalSide"),n(Sn,"sharedLineEndpointCoord"),n(wn,"pointOnLine"),n(vn,"routeEdgesOrthogonal"),n(Cn,"getSwimlaneDirection"),n(Ln,"runSwimlaneLayoutCore"),n(kn,"prepareSwimlaneLayout");var On=e({prepareLayout:kn,runLayoutCore:Ln,afterPaint:r});export{On as render};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as t,s as r}from"./chunk-NQOKRVIF-BsYoUZL4.js";import{_ as o}from"./mermaid.core-GJX79pQL.js";import"./chunk-5VM5RSS4-bDfGkvI-.js";import"./chunk-XXDRQBXY-ClHdtw3t.js";import"./chunk-VQ5W62QI-BTvKzH75.js";import"./chunk-55XCU76K-Bm2vEyhO.js";import"./channel-p0K5iSo0.js";import"./index-jAIWmSeN.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-CmbPiYDE.js";import"./settings-oXVFKYs2.js";import"./constants.js";import"./LoaderLayer-CyitSTCe.js";import"./websocket-CXHGKJlm.js";import"./index-KB6gLBva.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var s=t({styles:o(t=>`${r(t)}\n .swimlane.cluster:not([data-color-id]) rect {\n stroke: ${t.clusterBorder} !important;\n }\n [data-look="neo"].cluster rect {\n filter: none;\n }\n`,"getStyles")});export{s as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as t,O as e,H as n,E as r,ah as i,ai as a,aj as s,c as o,l as c,T as l,ab as h,ak as d,k as p,N as u,al as g,C as y}from"./mermaid.core-GJX79pQL.js";import{d as f}from"./arc-DomqdCJb.js";import"./index-jAIWmSeN.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-CmbPiYDE.js";import"./settings-oXVFKYs2.js";import"./constants.js";import"./LoaderLayer-CyitSTCe.js";import"./websocket-CXHGKJlm.js";import"./index-KB6gLBva.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"ably/react";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var m=function(){var e=t(function(t,e,n,r){for(n=n||{},r=t.length;r--;n[t[r]]=e);return n},"o"),n=[6,11,13,14,15,17,19,20,23,24],r=[1,12],i=[1,13],a=[1,14],s=[1,15],o=[1,16],c=[1,19],l=[1,20],h={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:t(function(t,e,n,r,i,a,s){var o=a.length-1;switch(i){case 1:return a[o-1];case 3:r.setDirection("LR");break;case 4:r.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:a[o-1].push(a[o]),this.$=a[o-1];break;case 7:case 8:this.$=a[o];break;case 11:r.getCommonDb().setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 12:this.$=a[o].trim(),r.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[o].trim(),r.getCommonDb().setAccDescription(this.$);break;case 15:r.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 18:r.addTask(a[o],0,""),this.$=a[o];break;case 19:r.addEvent(a[o].substr(2)),this.$=a[o]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(n,[2,5],{5:6}),e(n,[2,2]),e(n,[2,3]),e(n,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:i,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,10],{1:[2,1]}),e(n,[2,6]),{12:21,14:r,15:i,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,8]),e(n,[2,9]),e(n,[2,11]),{16:[1,22]},{18:[1,23]},e(n,[2,14]),e(n,[2,15]),e(n,[2,16]),e(n,[2,17]),e(n,[2,18]),e(n,[2,19]),e(n,[2,7]),e(n,[2,12]),e(n,[2,13])],defaultActions:{},parseError:t(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:t(function(e){var n=this,r=[0],i=[],a=[null],s=[],o=this.table,c="",l=0,h=0,d=s.slice.call(arguments,1),p=Object.create(this.lexer),u={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(u.yy[g]=this.yy[g]);p.setInput(e,u.yy),u.yy.lexer=p,u.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var y=p.yylloc;s.push(y);var f=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=i.pop()||p.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t(function(t){r.length=r.length-2*t,a.length=a.length-t,s.length=s.length-t},"popStack"),t(m,"lex");for(var x,b,k,w,_,v,$,S,E={};;){if(b=r[r.length-1],this.defaultActions[b]?k=this.defaultActions[b]:(null==x&&(x=m()),k=o[b]&&o[b][x]),void 0===k||!k.length||!k[0]){var T="";for(_ in S=[],o[b])this.terminals_[_]&&_>2&&S.push("'"+this.terminals_[_]+"'");T=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[x]||x)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==x?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(T,{text:p.match,token:this.terminals_[x]||x,line:p.yylineno,loc:y,expected:S})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+x);switch(k[0]){case 1:r.push(x),a.push(p.yytext),s.push(p.yylloc),r.push(k[1]),x=null,h=p.yyleng,c=p.yytext,l=p.yylineno,y=p.yylloc;break;case 2:if(v=this.productions_[k[1]][1],E.$=a[a.length-v],E._$={first_line:s[s.length-(v||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(v||1)].first_column,last_column:s[s.length-1].last_column},f&&(E._$.range=[s[s.length-(v||1)].range[0],s[s.length-1].range[1]]),void 0!==(w=this.performAction.apply(E,[c,h,l,u.yy,k[1],a,s].concat(d))))return w;v&&(r=r.slice(0,-1*v*2),a=a.slice(0,-1*v),s=s.slice(0,-1*v)),r.push(this.productions_[k[1]][0]),a.push(E.$),s.push(E._$),$=o[r[r.length-2]][r[r.length-1]],r.push($);break;case 3:return!0}}return!0},"parse")},d=function(){return{EOF:1,parseError:t(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:t(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:t(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:t(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:t(function(t){this.unput(this.match.slice(t))},"less"),pastInput:t(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:t(function(t,e){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;var t,e,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;a<i.length;a++)if((n=this._input.match(this.rules[i[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,r=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[r]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var t=this.next();return t||this.lex()},"lex"),begin:t(function(t){this.conditionStack.push(t)},"begin"),popState:t(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:t(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:t(function(t){this.begin(t)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(t,e,n,r){switch(n){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function p(){this.yy={}}return h.lexer=d,t(p,"Parser"),p.prototype=h,h.Parser=p,new p}();m.parser=m;var x=m,b={};u(b,{addEvent:()=>j,addSection:()=>H,addTask:()=>N,addTaskOrg:()=>D,clear:()=>T,default:()=>O,getCommonDb:()=>E,getDirection:()=>M,getSections:()=>C,getTasks:()=>L,setDirection:()=>I});var k="",w=0,_="LR",v=[],$=[],S=[],E=t(()=>g,"getCommonDb"),T=t(function(){v.length=0,$.length=0,k="",S.length=0,_="LR",y()},"clear"),I=t(function(t){_=t},"setDirection"),M=t(function(){return _},"getDirection"),H=t(function(t){k=t,v.push(t)},"addSection"),C=t(function(){return v},"getSections"),L=t(function(){let t=A();let e=0;for(;!t&&e<100;)t=A(),e++;return $.push(...S),$},"getTasks"),N=t(function(t,e,n){const r={id:w++,section:k,type:k,task:t,score:e||0,events:n?[n]:[]};S.push(r)},"addTask"),j=t(function(t){S.find(t=>t.id===w-1).events.push(t)},"addEvent"),D=t(function(t){const e={section:k,type:k,description:t,task:t,classes:[]};$.push(e)},"addTaskOrg"),A=t(function(){const e=t(function(t){return S[t].processed},"compileTask");let n=!0;for(const[t,r]of S.entries())e(t),n=n&&r.processed;return n},"compileTasks"),O={clear:T,getCommonDb:E,getDirection:M,setDirection:I,addSection:H,getSections:C,getTasks:L,addTask:N,addTaskOrg:D,addEvent:j},B=0,R=t(function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},"drawRect"),P=t(function(e,n){const r=15,i=e.append("circle").attr("cx",n.cx).attr("cy",n.cy).attr("class","face").attr("r",r).attr("stroke-width",2).attr("overflow","visible"),a=e.append("g");function s(t){const e=f().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(r/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+2)+")")}function o(t){const e=f().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(r/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+7)+")")}function c(t){t.append("line").attr("class","mouth").attr("stroke",2).attr("x1",n.cx-5).attr("y1",n.cy+7).attr("x2",n.cx+5).attr("y2",n.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return a.append("circle").attr("cx",n.cx-5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),a.append("circle").attr("cx",n.cx+5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),t(s,"smile"),t(o,"sad"),t(c,"ambivalent"),n.score>3?s(a):n.score<3?o(a):c(a),i},"drawFace"),W=t(function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n},"drawCircle"),F=t(function(t,e){const n=e.text.replace(/<br\s*\/?>/gi," "),r=t.append("text");r.attr("x",e.x),r.attr("y",e.y),r.attr("class","legend"),r.style("text-anchor",e.anchor),void 0!==e.class&&r.attr("class",e.class);const i=r.append("tspan");return i.attr("x",e.x+2*e.textMargin),i.text(n),r},"drawText"),z=t(function(e,n){function r(t,e,n,r,i){return t+","+e+" "+(t+n)+","+e+" "+(t+n)+","+(e+r-i)+" "+(t+n-1.2*i)+","+(e+r)+" "+t+","+(e+r)}t(r,"genPoints");const i=e.append("polygon");i.attr("points",r(n.x,n.y,50,20,7)),i.attr("class","labelBox"),n.y=n.y+n.labelMargin,n.x=n.x+.5*n.labelMargin,F(e,n)},"drawLabel"),V=t(function(t,e,n){const r=t.append("g"),i=Y();i.x=e.x,i.y=e.y,i.fill=e.fill,i.width=n.width,i.height=n.height,i.class="journey-section section-type-"+e.num,i.rx=3,i.ry=3,R(r,i),X(n)(e.text,r,i.x,i.y,i.width,i.height,{class:"journey-section section-type-"+e.num},n,e.colour)},"drawSection"),G=-1,U=t(function(t,e,n,r){const i=e.x+n.width/2,a=t.append("g");G++;a.append("line").attr("id",r+"-task"+G).attr("x1",i).attr("y1",e.y).attr("x2",i).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),P(a,{cx:i,cy:300+30*(5-e.score),score:e.score});const s=Y();s.x=e.x,s.y=e.y,s.fill=e.fill,s.width=n.width,s.height=n.height,s.class="task task-type-"+e.num,s.rx=3,s.ry=3,R(a,s),X(n)(e.task,a,s.x,s.y,s.width,s.height,{class:"task"},n,e.colour)},"drawTask"),Z=t(function(t,e){R(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},"drawBackgroundRect"),q=t(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),Y=t(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),X=function(){function e(t,e,n,r,a,s,o,c){i(e.append("text").attr("x",n+a/2).attr("y",r+s/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function n(t,e,n,r,a,s,o,c,l){const{taskFontSize:h,taskFontFamily:d}=c,p=t.split(/<br\s*\/?>/gi);for(let t=0;t<p.length;t++){const c=t*h-h*(p.length-1)/2,u=e.append("text").attr("x",n+a/2).attr("y",r).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",d);u.append("tspan").attr("x",n+a/2).attr("dy",c).text(p[t]),u.attr("y",r+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),i(u,o)}}function r(t,e,r,a,s,o,c,l){const h=e.append("switch"),d=h.append("foreignObject").attr("x",r).attr("y",a).attr("width",s).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),n(t,h,r,a,s,o,c,l),i(d,c)}function i(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return t(e,"byText"),t(n,"byTspan"),t(r,"byFo"),t(i,"_setTextAttrs"),function(t){return"fo"===t.textPlacement?r:"old"===t.textPlacement?e:n}}(),J=t(function(t,e){B=0,G=-1,t.append("defs").append("marker").attr("id",e+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function K(t,e){t.each(function(){var t,n=p(this),r=n.text().split(/(\s+|<br>)/).reverse(),i=[],a=n.attr("y"),s=parseFloat(n.attr("dy")),o=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",s+"em");for(let s=0;s<r.length;s++)t=r[r.length-1-s],i.push(t),o.text(i.join(" ").trim()),(o.node().getComputedTextLength()>e||"<br>"===t)&&(i.pop(),o.text(i.join(" ").trim()),i="<br>"===t?[""]:[t],o=n.append("tspan").attr("x",0).attr("y",a).attr("dy","1.1em").text(t))})}t(K,"wrap");var Q=t(function(t,e,n,r,i,a=!1){const{theme:s,look:o}=r,c=s?.includes("redux"),l=n%(r?.themeVariables?.THEME_COLOR_LIMIT??12)-1,h=t.append("g");e.section=l,h.attr("class",(e.class?e.class+" ":"")+"timeline-node section-"+l);const d=h.append("g"),u=h.append("g"),g=u.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(K,e.width).node().getBBox(),y=r.fontSize?.replace?r.fontSize.replace("px",""):r.fontSize;if(e.height=g.height+1.1*y*.5+e.padding,e.height=Math.max(e.height,e.maxHeight),e.width=e.width+2*e.padding,u.attr("transform","translate("+e.width/2+", "+e.padding/2+")"),c&&u.attr("transform",`translate(${e.width/2}, ${a?e.padding/2+3:e.padding})`),et(d,e,l,i,r),"neo"===o&&(h.attr("data-look","neo"),c)){const e=s.includes("dark"),n=t.node()?.ownerSVGElement??t.node(),r=p(n),i=r.attr("id")??"",a=i?`${i}-drop-shadow`:"drop-shadow";if(r.select(`#${a}`).empty()){const t=r.select("defs");(t.empty()?r.append("defs"):t).append("filter").attr("id",a).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",e?"0.2":"0.06").attr("flood-color",e?"#FFFFFF":"#000000")}}return e},"drawNode"),tt=t(function(t,e,n){const r=t.append("g"),i=r.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(K,e.width).node().getBBox(),a=n.fontSize?.replace?n.fontSize.replace("px",""):n.fontSize;return r.remove(),i.height+1.1*a*.5+e.padding},"getVirtualNodeHeight"),et=t(function(t,e,n,r,i){const{theme:a}=i,s=a?.includes("redux")?0:5,o=s>0?`M0 ${e.height-5} v${10-e.height} q0,-${s},${s},-${s} h${e.width-10} q${s},0,${s},${s} v${e.height-5} H0 Z`:`M0 ${e.height-5} v${-(e.height-5)} h${e.width} v${e.height} H0 Z`;t.append("path").attr("id",r+"-node-"+B++).attr("class","node-bkg node-"+e.type).attr("d",o),a?.includes("redux")||t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},"defaultBkg"),nt={drawRect:R,drawCircle:W,drawSection:V,drawText:F,drawLabel:z,drawTask:U,drawBackgroundRect:Z,getTextObj:q,getNoteRect:Y,initGraphics:J,drawNode:Q,getVirtualNodeHeight:tt},rt=t(function(t,e,n,r){const i=o(),{look:a,theme:s,themeVariables:l}=i,{useGradient:h,gradientStart:u,gradientStop:g}=l,y=i.timeline?.leftMargin??50;c.debug("timeline",r.db);const f=i.securityLevel;let m;"sandbox"===f&&(m=p("#i"+e));const x=p("sandbox"===f?m.nodes()[0].contentDocument.body:"body").select("#"+e);x.append("g");const b=r.db.getTasks(),k=r.db.getCommonDb().getDiagramTitle();c.debug("task",b),nt.initGraphics(x,e);const w=r.db.getSections();c.debug("sections",w);let _=0,v=0,$=0,S=0,E=50+y,T=50;S=50;let I=0,M=!0;w.forEach(function(t){const e={number:I,descr:t,section:I,width:150,padding:20,maxHeight:_},n=nt.getVirtualNodeHeight(x,e,i);c.debug("sectionHeight before draw",n),_=Math.max(_,n+20)});let H=0,C=0;c.debug("tasks.length",b.length);for(const[t,e]of b.entries()){const n={number:t,descr:e,section:e.section,width:150,padding:20,maxHeight:v},r=nt.getVirtualNodeHeight(x,n,i);c.debug("taskHeight before draw",r),v=Math.max(v,r+20),H=Math.max(H,e.events.length);let a=0;for(const t of e.events){const n={descr:t,section:e.section,number:e.section,width:150,padding:20,maxHeight:50};a+=nt.getVirtualNodeHeight(x,n,i)}e.events.length>0&&(a+=10*(e.events.length-1)),C=Math.max(C,a)}c.debug("maxSectionHeight before draw",_),c.debug("maxTaskHeight before draw",v),w&&w.length>0?w.forEach(t=>{const n=b.filter(e=>e.section===t),r={number:I,descr:t,section:I,width:200*Math.max(n.length,1)-50,padding:20,maxHeight:_};c.debug("sectionNode",r);const a=x.append("g"),s=nt.drawNode(a,r,I,i,e);c.debug("sectionNode output",s),a.attr("transform",`translate(${E}, 50)`),T+=_+50,n.length>0&&it(x,n,I,E,T,v,i,H,C,_,!1,e),E+=200*Math.max(n.length,1),T=50,I++}):(M=!1,it(x,b,I,E,T,v,i,H,C,_,!0,e));const L=x.node().getBBox();c.debug("bounds",L),k&&x.append("text").text(k).attr("x","neo"===a?2*L.x+y:L.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),$=M?_+v+150:v+100;if(x.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",$).attr("x2",L.width+3*y).attr("y2",$).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${e}-arrowhead)`),"neo"===a&&h&&"neutral"!==s){const t=x.select("defs"),e=(t.empty()?x.append("defs"):t).append("linearGradient").attr("id",x.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");e.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),e.append("stop").attr("offset","100%").attr("stop-color",g).attr("stop-opacity",1)}d(void 0,x,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),it=t(function(t,e,n,r,i,a,s,o,l,h,d,p){for(const o of e){const e={descr:o.task,section:n,number:n,width:150,padding:20,maxHeight:a};c.debug("taskNode",e);const h=t.append("g").attr("class","taskWrapper"),u=nt.drawNode(h,e,n,s,p).height;if(c.debug("taskHeight after draw",u),h.attr("transform",`translate(${r}, ${i})`),a=Math.max(a,u),o.events){const e=t.append("g").attr("class","lineWrapper");let c=a;i+=100,c+=at(t,o.events,n,r,i,s,p),i-=100,e.append("line").attr("x1",r+95).attr("y1",i+a).attr("x2",r+95).attr("y2",i+a+100+l+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${p}-arrowhead)`).attr("stroke-dasharray","5,5")}r+=200,d&&!s.timeline?.disableMulticolor&&n++}i-=10},"drawTasks"),at=t(function(t,e,n,r,i,a,s){let o=0;const l=i;i+=100;for(const l of e){const e={descr:l,section:n,number:n,width:150,padding:20,maxHeight:50};c.debug("eventNode",e);const h=t.append("g").attr("class","eventWrapper"),d=nt.drawNode(h,e,n,a,s,!0).height;o+=d,h.attr("transform",`translate(${r}, ${i})`),i=i+10+d}return i=l,o},"drawEvents"),st={setConf:t(()=>{},"setConf"),draw:rt},ot=200,ct=t(function(t,e,n,r){const i=o(),a=i.timeline?.leftMargin??50;c.debug("timeline",r.db);const s=l(e);s.append("g");const p=r.db.getTasks(),u=r.db.getCommonDb().getDiagramTitle();c.debug("task",p),nt.initGraphics(s);const g=r.db.getSections();c.debug("sections",g);let y=0,f=0;const m=50+a;let x=50;const b=x,k=230,w=m+k;let _=0;const v=g&&g.length>0,$=v?w:m+k,S=Math.max(50,580);g.forEach(function(t){const e={number:_,descr:t,section:_,width:S,padding:5,maxHeight:y},n=nt.getVirtualNodeHeight(s,e,i);c.debug("sectionHeight before draw",n),y=Math.max(y,n)});let E=0;c.debug("tasks.length",p.length);for(const[t,e]of p.entries()){const n={number:t,descr:e,section:e.section,width:ot,padding:5,maxHeight:f},r=nt.getVirtualNodeHeight(s,n,i);c.debug("taskHeight before draw",r),f=Math.max(f,r);let a=0;for(const t of e.events){const n={descr:t,section:e.section,number:e.section,width:300,padding:5,maxHeight:50};a+=nt.getVirtualNodeHeight(s,n,i)}e.events.length>0&&(a+=10*(e.events.length-1)),E=Math.max(E,a)+0}c.debug("maxSectionHeight before draw",y),c.debug("maxTaskHeight before draw",f);const T=Math.max(f,E)+30;v?g.forEach(t=>{const e=p.filter(e=>e.section===t),n={number:_,descr:t,section:_,width:S,padding:5,maxHeight:y};c.debug("sectionNode",n);const r=s.append("g"),a=nt.drawNode(r,n,_,i);c.debug("sectionNode output",a);const o=$-k;r.attr("transform",`translate(${o}, ${x})`);const l=x+a.height+20;e.length>0&<(s,e,_,$,l,f,i,T,!1);const h=e.length,d=a.height+20+T*Math.max(h,1)-(h>0?60:0);x+=d,_++}):lt(s,p,_,$,x,f,i,T,!0);let I=s.node()?.getBBox();if(!I)throw new Error("bbox not found");if(c.debug("bounds",I),u){if(s.append("text").text(u).attr("x",I.width/2-a).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),I=s.node()?.getBBox(),!I)throw new Error("bbox not found");c.debug("bounds after title",I)}const[M]=h(i.fontSize),H=2*(M??16),C=.5*(M??16)+20,L=s.append("g").attr("class","lineWrapper");L.append("line").attr("x1",$).attr("y1",b-H).attr("x2",$).attr("y2",I.y+I.height+C).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),L.lower(),d(void 0,s,i.timeline?.padding??50,i.timeline?.useMaxWidth??!1)},"draw"),lt=t(function(t,e,n,r,i,a,s,o,l){for(const h of e){const e={descr:h.task,section:n,number:n,width:ot,padding:5,maxHeight:a};c.debug("taskNode",e);const d=t.append("g").attr("class","taskWrapper"),p=nt.drawNode(d,e,n,s),u=p.height;c.debug("taskHeight after draw",u);const g=r-20-p.width;if(d.attr("transform",`translate(${g}, ${i})`),a=Math.max(a,u),h.events&&h.events.length>0){const e=i,a=r+50;ht(t,h.events,n,r,a,e,s)}i+=o,l&&!s.timeline?.disableMulticolor&&n++}},"drawTasks"),ht=t(function(t,e,n,r,i,a,s){let o=a;for(const a of e){const e={descr:a,section:n,number:n,width:300,padding:5,maxHeight:0};c.debug("eventNode",e);const l=t.append("g").attr("class","eventWrapper"),h=nt.drawNode(l,e,n,s).height;l.attr("transform",`translate(${i}, ${o})`);const d=o+h/2;t.append("g").attr("class","lineWrapper").append("line").attr("x1",r).attr("y1",d).attr("x2",i).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),o=o+h+10}return o-a},"drawEvents"),dt={setConf:t(()=>{},"setConf"),draw:ct},pt=t(t=>{const{theme:i}=e(),a=i?.includes("dark"),s=r(i,t.borderColorArray),o=t.svgId?.replace(/^#/,"")??"",c=o?`url(#${o}-drop-shadow)`:t.dropShadow??"none";let l="";for(let e=0;e<n(t.THEME_COLOR_LIMIT);e++){const n=""+(17-3*e),r=s?t.borderColorArray[e%t.borderColorArray.length]:void 0,i=r??t.mainBkg,o=r??t.nodeBorder;l+=`\n .section-${e-1} rect,\n .section-${e-1} path,\n .section-${e-1} circle {\n fill: ${a&&s?t.mainBkg:i};\n stroke: ${o};\n stroke-width: ${t.strokeWidth};\n filter: ${c};\n }\n\n .section-${e-1} text {\n fill: ${t.nodeBorder};\n font-weight: ${t.fontWeight}\n }\n\n .node-icon-${e-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+e]};\n }\n\n .section-edge-${e-1} {\n stroke: ${t["cScale"+e]};\n }\n\n .edge-depth-${e-1} {\n stroke-width: ${n};\n }\n\n .section-${e-1} line {\n stroke: ${t["cScaleInv"+e]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${t.nodeBorder};\n stroke-width:${t.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return l},"genReduxSections"),ut=t(t=>{let e="";const r=n(t.THEME_COLOR_LIMIT);for(let e=0;e<r;e++)t["lineColor"+e]=t["lineColor"+e]??t["cScaleInv"+e],i(t["lineColor"+e])?t["lineColor"+e]=a(t["lineColor"+e],20):t["lineColor"+e]=s(t["lineColor"+e],20);for(let n=0;n<r;n++){const r=""+(17-3*n);e+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path {\n fill: ${t["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${t["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${t["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${r};\n }\n .section-${n-1} line {\n stroke: ${t["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${t["cScaleLabel"+n]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return e},"genSections"),gt=t(t=>{const{theme:r}=e(),i=r?.includes("redux"),a="neutral"===r,s=t.svgId?.replace(/^#/,"")??"";let o="";if(t.useGradient&&s&&t.THEME_COLOR_LIMIT&&!a){const e=n(t.THEME_COLOR_LIMIT);for(let n=0;n<e;n++)o+=`\n .section-${n-1}[data-look="neo"] rect,\n .section-${n-1}[data-look="neo"] path,\n .section-${n-1}[data-look="neo"] circle {\n fill: ${t.mainBkg};\n stroke: url(#${s}-gradient);\n stroke-width: 2;\n }\n .section-${n-1}[data-look="neo"] line {\n stroke: url(#${s}-gradient);\n stroke-width: 2;\n }`}return`\n .edge {\n stroke-width: 3;\n }\n ${i?pt(t):ut(t)}\n ${o}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),yt={db:b,renderer:{setConf:t(()=>{},"setConf"),draw:t((t,e,n,r)=>"TD"===(r?.db?.getDirection?.()??"LR")?dt.draw(t,e,n,r):st.draw(t,e,n,r),"draw")},parser:x,styles:gt};export{yt as diagram};
|