@weavecode/weave 0.1.7 → 0.1.8
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/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/adapter/bun/serve-static.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/adapter/bun/websocket.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/context.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/helper/css/common.js +3 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/hono-base.js +4 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/hono.js +0 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/basic-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/bearer-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/csrf/index.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/jwk/jwk.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/jwt/jwt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/middleware/mount/index.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/node.js +13 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/prepared-router.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/router.js +39 -51
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/router/reg-exp-router/trie.js +15 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/jwt/jwt.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/mount.js +35 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/utils/url.js +10 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/cjs/validator/validator.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/context.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/helper/css/common.js +3 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/hono-base.js +4 -10
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/hono.js +0 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/basic-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/bearer-auth/index.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/csrf/index.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/jwk/jwk.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/jwt/jwt.js +2 -2
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/language/language.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/middleware/mount/index.js +4 -4
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/node.js +13 -11
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/prepared-router.js +5 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/router.js +40 -52
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/router/reg-exp-router/trie.js +15 -5
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/middleware/mount/index.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/router/reg-exp-router/node.d.ts +3 -3
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/router/reg-exp-router/trie.d.ts +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/mount.d.ts +4 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/types/utils/url.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/jwt/jwt.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/mount.js +34 -0
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/utils/url.js +10 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/dist/validator/validator.js +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/hono/package.json +1 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/jwks/remote.js +3 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/deflate.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +2 -1
- package/node_modules/@modelcontextprotocol/sdk/node_modules/jose/package.json +1 -1
- package/node_modules/@weavecode/cli/dist/commands/msg.js +2 -2
- package/node_modules/@weavecode/cli/dist/i18n/dict/en.js +1 -1
- package/node_modules/@weavecode/cli/dist/i18n/dict/zh.js +1 -1
- package/node_modules/@weavecode/cli/dist/init/claudemd-gen.js +3 -3
- package/node_modules/@weavecode/cli/dist/statusline/ansi.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/mock-input.js +1 -1
- package/node_modules/@weavecode/cli/dist/statusline/preview.js +2 -2
- package/node_modules/@weavecode/cli/package.json +5 -5
- package/node_modules/@weavecode/core/dist/harness.d.ts +78 -0
- package/node_modules/@weavecode/core/dist/harness.js +1 -1
- package/node_modules/@weavecode/core/dist/index.d.ts +1 -1
- package/node_modules/@weavecode/core/dist/index.js +1 -1
- package/node_modules/@weavecode/core/package.json +1 -1
- package/node_modules/@weavecode/harness/dist/claude/commands.d.ts +2 -0
- package/node_modules/@weavecode/harness/dist/claude/commands.js +3 -2
- package/node_modules/@weavecode/harness/dist/driver.d.ts +6 -0
- package/node_modules/@weavecode/harness/dist/zcode/assets.js +1 -1
- package/node_modules/@weavecode/harness/dist/zcode/capture.js +3 -3
- package/node_modules/@weavecode/harness/dist/zcode/mcp.js +2 -2
- package/node_modules/@weavecode/harness/package.json +2 -2
- package/node_modules/@weavecode/server/dist/daemon/dev-entry.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/hooks-routes.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/opener/launch.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.d.ts +6 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-seed.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-window.d.ts +17 -0
- package/node_modules/@weavecode/server/dist/daemon/pet-window.js +2 -0
- package/node_modules/@weavecode/server/dist/daemon/project-files.d.ts +1 -1
- package/node_modules/@weavecode/server/dist/daemon/project-files.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/routes/pets.d.ts +3 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/pets.js +1 -0
- package/node_modules/@weavecode/server/dist/daemon/routes/settings-statusline.js +1 -1
- package/node_modules/@weavecode/server/dist/daemon/routes/visualizations.js +2 -1
- package/node_modules/@weavecode/server/dist/daemon/server.d.ts +2 -0
- package/node_modules/@weavecode/server/dist/daemon/settings.d.ts +21 -0
- package/node_modules/@weavecode/server/dist/daemon/settings.js +2 -2
- package/node_modules/@weavecode/server/dist/daemon/start.js +1 -1
- package/node_modules/@weavecode/server/dist/db/db.d.ts +4 -1
- package/node_modules/@weavecode/server/dist/db/db.js +2 -2
- package/node_modules/@weavecode/server/dist/db/paths.d.ts +4 -0
- package/node_modules/@weavecode/server/dist/db/paths.js +1 -1
- package/node_modules/@weavecode/server/dist/index.d.ts +1 -1
- package/node_modules/@weavecode/server/dist/index.js +1 -1
- package/node_modules/@weavecode/server/dist/repositories/hook-events.d.ts +6 -0
- package/node_modules/@weavecode/server/dist/repositories/hook-events.js +8 -5
- package/node_modules/@weavecode/server/dist/repositories/sessions.js +2 -2
- package/node_modules/@weavecode/server/package.json +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/abnfDiagram-WEYOIA3C-t5OQjhuS.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{arc-CRZTRyjb.js → arc-De-uH_Q9.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/architectureDiagram-ZHVYKT53-ImPclD43.js +36 -0
- package/node_modules/@weavecode/server/web/dist/assets/{blockDiagram-RJAE7QA3-BIH8mSIZ.js → blockDiagram-RJAE7QA3-B5xEQs6X.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{c4Diagram-XDPPPE54-5YoKWFOD.js → c4Diagram-XDPPPE54-DP8MjIgJ.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/channel-C0RGiobt.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2E7WHVMD-B653kMXt.js → chunk-2E7WHVMD-C3UFIDyj.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-2Q5K7J3B-f_A4_eDz.js → chunk-2Q5K7J3B-Bgw-3YfG.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-4EMNKR2T-v5j5qNGj.js → chunk-4EMNKR2T-Dy_Wq9qn.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-55XCU76K-D32C0DXX.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-5VM5RSS4-BeROhLXN.js → chunk-5VM5RSS4-Dpmi-9Gi.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-JWPE2WC7-D6dXb_jr.js → chunk-JWPE2WC7-CEYXaZDX.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/{chunk-VQ5W62QI-CnHdSEMi.js → chunk-VQ5W62QI-A616Pgzo.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-XXDRQBXY-CnxFMLWV.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/chunk-ZCHMQSOR-BhjCTig8.js +2 -0
- package/node_modules/@weavecode/server/web/dist/assets/{classDiagram-v2-4MYWR3UA-DQe1b_k8.js → classDiagram-v2-4MYWR3UA-rzlq5tPv.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/cose-bilkent-JH36ORCC-CxWQXzj8.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{cynefin-EF2NZ3EQ-OZotFKUu.js → cynefin-EF2NZ3EQ-AFHjx2wU.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/cynefinDiagram-WF24UDRP-Bp_Oaf9U.js +62 -0
- package/node_modules/@weavecode/server/web/dist/assets/dagre-NK4GIZVX-7oUPIU35.js +4 -0
- package/node_modules/@weavecode/server/web/dist/assets/diagram-CBK3MWTC-D_rS_rSY.js +24 -0
- package/node_modules/@weavecode/server/web/dist/assets/diagram-I5XIIV2D-Duc_cKMb.js +24 -0
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-ODIL2UCW-D9A6W8oB.js → diagram-ODIL2UCW-DA0XFVXm.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-PFBEJUXE-PeI-eyu2.js → diagram-PFBEJUXE-D1U0Xhtt.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/diagram-RJA3I4VV-CbDFY871.js +41 -0
- package/node_modules/@weavecode/server/web/dist/assets/{diagram-TYUNFSNR-D5KieEw5.js → diagram-TYUNFSNR-jPg9AxQv.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/ebnfDiagram-V4P3TTPT-ZHfGTB0N.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{elk-QONTBCTQ-D3xrVg0U.js → elk-QONTBCTQ-C-ESJrUi.js} +3 -3
- package/node_modules/@weavecode/server/web/dist/assets/{erDiagram-KYQIGQAA-y_V1cor7.js → erDiagram-KYQIGQAA-DGK7TeHj.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{flowDiagram-IUGLLWBU-BJ8Z0MkF.js → flowDiagram-IUGLLWBU-CVV4rL8v.js} +1 -1
- package/node_modules/@weavecode/server/web/dist/assets/ganttDiagram-R7GPNTJY-CuAwNvbm.js +292 -0
- package/node_modules/@weavecode/server/web/dist/assets/gitGraphDiagram-PDYL7XHY-D_15Wtf-.js +106 -0
- package/node_modules/@weavecode/server/web/dist/assets/infoDiagram-MVDRKAX5-ClqhbrCa.js +2 -0
- package/node_modules/@weavecode/server/web/dist/assets/{ishikawaDiagram-HPEHV2GE-ChEnND76.js → ishikawaDiagram-HPEHV2GE-CUJ891JX.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{journeyDiagram-BOSHW7O7-DHcNtpYF.js → journeyDiagram-BOSHW7O7-B4skiMu-.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{kanban-definition-FNSA4HC5-Dft7qpW5.js → kanban-definition-FNSA4HC5-UNGJR_y_.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/linear-BEB-UwbR.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/main-B_0jS_Gz.js +1096 -0
- package/node_modules/@weavecode/server/web/dist/assets/main-Czzlavi4.css +11 -0
- package/node_modules/@weavecode/server/web/dist/assets/{mermaid.core-D_Dp_Kl2.js → mermaid.core-knGXJfjz.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/{mindmap-definition-6OY57UG3-CM6OAd_-.js → mindmap-definition-6OY57UG3-CEldbr3a.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/modulepreload-polyfill-B5Qt9EMX.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pegDiagram-ECIUJNBX-cNCkGLx3.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pet-DJCpIDM5.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/pieDiagram-GNMPY74T-CfMEFiQD.js +39 -0
- package/node_modules/@weavecode/server/web/dist/assets/{quadrantDiagram-D57K4MC3-D8pQ_PU2.js → quadrantDiagram-D57K4MC3-knmi2rwP.js} +4 -4
- package/node_modules/@weavecode/server/web/dist/assets/railroadDiagram-Y72NRBL7-BJ7AzhEo.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{requirementDiagram-EQYSW5RA-C90DU5Ny.js → requirementDiagram-EQYSW5RA-Dte2LGQM.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{sankeyDiagram-SY24JHO5-B_poYGgJ.js → sankeyDiagram-SY24JHO5-3noLaWgd.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{sequenceDiagram-BLEHNHQU-DDW7b2Dn.js → sequenceDiagram-BLEHNHQU-CclOWTTc.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/sizeCapture-INFHLROL-B82sbLhA.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/{stateDiagram-v2-A6IESKWZ-CkVMAyxG.js → stateDiagram-v2-A6IESKWZ-BXfVDwSN.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/swimlanes-B3ENRKFQ-D4lKZaeV.js +1 -0
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-DbdFh_d6.js +8 -0
- package/node_modules/@weavecode/server/web/dist/assets/{timeline-definition-JXYKGLGB-DnhkRGLb.js → timeline-definition-JXYKGLGB-D6H6zP5b.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{usecaseDiagram-WPOLBNNX-_TdIjC6Z.js → usecaseDiagram-WPOLBNNX-D2J2bKo_.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{vennDiagram-Q3Y3IDCW-FzgsymXB.js → vennDiagram-Q3Y3IDCW-pdRbIkpB.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{wardleyDiagram-IVAIDKWA-BwqimStC.js → wardleyDiagram-IVAIDKWA-Cyd2QPMf.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/assets/{xychartDiagram-4URNHDU4-CFjjVPIV.js → xychartDiagram-4URNHDU4-Bd4BkwVM.js} +2 -2
- package/node_modules/@weavecode/server/web/dist/index.html +3 -2
- package/node_modules/@weavecode/server/web/dist/pet.html +60 -0
- package/node_modules/@weavecode/templates/dist/index.d.ts +2 -0
- package/node_modules/@weavecode/templates/dist/index.js +1 -1
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/pet.json +7 -0
- package/node_modules/@weavecode/templates/dist/resources/pets/weave-spider/spritesheet.png +0 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/.claude-plugin/marketplace.json +6 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/.claude-plugin/plugin.json +8 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/skills/weave-pet-hatcher/SKILL.md +121 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/skills/weave-pet-hatcher/scripts/assemble-pet.mjs +308 -0
- package/node_modules/@weavecode/templates/dist/resources/weave-market/plugins/core-skills/weave-pet-hatcher/weave.json +4 -0
- package/node_modules/@weavecode/templates/package.json +2 -2
- package/package.json +11 -7
- package/scripts/preinstall.mjs +70 -0
- package/node_modules/@weavecode/server/web/dist/assets/abnfDiagram-WEYOIA3C-DDeQkTf5.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/architectureDiagram-ZHVYKT53-Dj54DE3O.js +0 -36
- package/node_modules/@weavecode/server/web/dist/assets/channel-5VM93AJ8.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-55XCU76K-CgEqeP7j.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-XXDRQBXY-BkG_e6PE.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/chunk-ZCHMQSOR-DxR-fxzs.js +0 -2
- package/node_modules/@weavecode/server/web/dist/assets/cose-bilkent-JH36ORCC-DThrA8S5.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/cynefinDiagram-WF24UDRP-DJjq2hfT.js +0 -62
- package/node_modules/@weavecode/server/web/dist/assets/dagre-NK4GIZVX-C2vH93HT.js +0 -4
- package/node_modules/@weavecode/server/web/dist/assets/diagram-CBK3MWTC-DrF_ScM-.js +0 -24
- package/node_modules/@weavecode/server/web/dist/assets/diagram-I5XIIV2D-D1qoUJ4t.js +0 -24
- package/node_modules/@weavecode/server/web/dist/assets/diagram-RJA3I4VV-DITY0Rd8.js +0 -41
- package/node_modules/@weavecode/server/web/dist/assets/ebnfDiagram-V4P3TTPT-DDylK-gz.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/ganttDiagram-R7GPNTJY-C0q-CS1T.js +0 -292
- package/node_modules/@weavecode/server/web/dist/assets/gitGraphDiagram-PDYL7XHY-BYTComiB.js +0 -106
- package/node_modules/@weavecode/server/web/dist/assets/index-BKxAxaVG.js +0 -1091
- package/node_modules/@weavecode/server/web/dist/assets/index-C0Sd4MH7.css +0 -11
- package/node_modules/@weavecode/server/web/dist/assets/infoDiagram-MVDRKAX5-DtixgjLP.js +0 -2
- package/node_modules/@weavecode/server/web/dist/assets/linear-DEo11t-X.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/pegDiagram-ECIUJNBX-_QkY0h8Q.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/pieDiagram-GNMPY74T-ZGr5vtDj.js +0 -39
- package/node_modules/@weavecode/server/web/dist/assets/railroadDiagram-Y72NRBL7-DUIo-WmA.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/sizeCapture-INFHLROL-CmKoqX6K.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanes-B3ENRKFQ-Dm_Omzky.js +0 -1
- package/node_modules/@weavecode/server/web/dist/assets/swimlanesDiagram-AYQRV4AK-Bjj8ZA4d.js +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as lr}from"./chunk-4EMNKR2T-Dy_Wq9qn.js";import{c as fr}from"./chunk-ZCHMQSOR-BhjCTig8.js";import{_ as l,l as Mn}from"./mermaid.core-knGXJfjz.js";import"./main-B_0jS_Gz.js";import"./graph-DGbsTEsI.js";import"./modulepreload-polyfill-B5Qt9EMX.js";function Ro(t,{measure:e}){var r,a;const n=(a=(r=t.config)==null?void 0:r.swimlane)==null?void 0:a.lineHops;if(n===!1)return;const o=n==="gap"?"gap":"arc",s=t.edges.filter(c=>Array.isArray(c.points)&&c.points.length>=2).map(c=>({id:c.id,points:c.points,curve:c.curve,arrowTypeStart:c.arrowTypeStart,arrowTypeEnd:c.arrowTypeEnd}));lr(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}l(Ro,"applySwimlaneLineJumps");var yn="__swimlane_default__",dr=21,Lo=20;function Sn(t){return Math.max(t.padding??Lo,Lo)}l(Sn,"topLaneHorizontalPadding");function No(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const a=n-s/2,c=Math.min(r,n+s/2),u=Math.min(dr,Math.max(0,c-a)),m=a+u;if(m<=a){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:a,bottom:m}}l(No,"assignTopLaneTitleRect");function Oo(t){var r;const e=t.direction,n=t.nodes??(t.nodes=[]);for(const a of t.nodes??[])a.isGroup&&!a.parentId&&(a.shape="swimlane",e&&(a.direction=e));const o=n.filter(a=>!a.isGroup&&!a.parentId);if(o.length===0)return;let s=n.find(a=>a.id===yn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:yn,label:"",isGroup:!0,shape:"swimlane",padding:20,look:(r=t.config)==null?void 0:r.look,colorIndex:n.reduce((a,c)=>Math.max(a,c.colorIndex??-1),-1)+1,...e?{direction:e}:{}},n.push(s));for(const a of o)a.parentId=yn}l(Oo,"prepareLayoutForSwimlanes");function Bo(t){const e=new Map;for(const u of t.nodes??[])e.set(u.id,u);const n=[];for(const u of t.edges??[]){const m=typeof u.start=="string"?u.start:void 0,p=typeof u.end=="string"?u.end:void 0;!m||!p||u.labelNodeId||n.push({id:u.id,src:m,dst:p,ref:u})}const o=t.nodes??[],s=o.filter(u=>u.isGroup),r=o.filter(u=>!u.isGroup);return{nodes:[...[...s].reverse(),...r].map(u=>u.id),edges:n,layout:t,nodeById:e}}l(Bo,"toGraphView");function Po(t,e,n,o){const{layout:s}=t,r=t.nodeById,a=(o==null?void 0:o.layerGap)??100,c=(o==null?void 0:o.nodeGap)??40;let u=0;for(const S of e.layers){let f=0;for(const d of S){const i=r.get(d);if(!i){f++;continue}i.layer=u,i.order=f;const y=n.x[d]??f*c,C=n.y[d]??u*a;i.x=y,i.y=C,f++}u++}const m=s.nodes??[],p=new Map,g=[];for(const S of m){if(!(S!=null&&S.isGroup))continue;S.parentId||g.push(S);const f=m.filter(b=>b.parentId===S.id);let d=1/0,i=-1/0,y=1/0,C=-1/0;for(const b of f){const L=b.x??n.x[b.id],v=b.y??n.y[b.id],x=b.width??0,I=b.height??0;L!=null&&v!=null&&(d=Math.min(d,L-x/2),i=Math.max(i,L+x/2),y=Math.min(y,v-I/2),C=Math.max(C,v+I/2))}if(d===1/0||y===1/0)S.x=S.x??0,S.y=S.y??0,S.width=S.width??0,S.height=S.height??0;else{const b=S.padding??20,L=S.parentId?b:2*Sn(S),v=b,x=Math.max(0,i-d)+L,I=Math.max(0,C-y)+v,T=(d+i)/2,A=(y+C)/2;S.x=T,S.y=A,S.width=x,S.height=I,p.set(S.id,{minX:d,maxX:i,minY:y,maxY:C})}}if(g.length>0&&p.size>0){let S=1/0,f=-1/0,d=0;for(const i of g){const y=i.padding??20;y>d&&(d=y);const C=p.get(i.id);C&&(S=Math.min(S,C.minY),f=Math.max(f,C.maxY))}if(S!==1/0&&f!==-1/0){const i=Math.max(0,f-S),C=Math.max(d,36),b=i+2*C,L=(S+f)/2;for(const P of g)P.y=L,P.height=b,P.swimlaneContentTop=S;const v=[...g].sort((P,O)=>{const k=P.x??0,D=O.x??0;return k-D}),x=[],I=[],T=[];for(const P of v){const O=p.get(P.id);if(!O)continue;const k=Math.max(0,O.maxX-O.minX)+2*Sn(P),D=(O.minX+O.maxX)/2;x.push(P.id),I.push(D),T.push(k)}const A=x.length;if(A>0){const P=new Map;if(A===1)P.set(x[0],T[0]);else{const O=[];for(let j=0;j<A-1;j++)O.push(I[j+1]-I[j]);const k=new Array(A);k[0]=0;for(let j=0;j<A-1;j++)k[j+1]=2*O[j]-k[j];let D=0,B=Number.POSITIVE_INFINITY;for(let j=0;j<A;j++){const tt=T[j];j%2===0?D=Math.max(D,tt-k[j]):B=Math.min(B,k[j]-tt)}let G=D;D<=B?G=(D+B)/2:G=D;for(let j=0;j<A;j++){const tt=k[j]+(j%2===0?G:-G),ft=Math.max(T[j],tt);P.set(x[j],ft)}}for(const O of g){const k=P.get(O.id);k!=null&&(O.width=k),No(O)}}}}}l(Po,"writeBackToLayoutData");var ur="[EdgeLabelNodes]";function ko(t){const e=[],n=[],o=new Map;for(const a of t.nodes)o.set(a.id,a);for(const a of t.edges){if(!a.label||a.label.length===0||a.isLayoutOnly||a.labelNodeId)continue;const c=a.start?o.get(a.start):void 0,u=a.end?o.get(a.end):void 0;if(!c||!u){Mn.warn(ur,`Edge ${a.id} has missing source or target node`);continue}const m=`edge-label-${a.start}-${a.end}-${a.id}`,g=c.parentId!==u.parentId?u.parentId:c.parentId,S={id:m,label:a.label,edgeStart:a.start??"",edgeEnd:a.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:g,isGroup:!1,labelStyle:Array.isArray(a.labelStyle)?a.labelStyle[0]:a.labelStyle??"",...c.dir?{dir:c.dir}:{}};e.push(S),a.labelNodeId=m,a.label=void 0,a.text=void 0;const f={id:`${a.id}-to-label`,start:a.start,end:m,type:"normal",isLayoutOnly:!0},d={id:`${a.id}-from-label`,start:m,end:a.end,type:"normal",isLayoutOnly:!0};n.push(f,d)}const s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}l(ko,"createEdgeLabelNodes");var Yt=.001;function to(t){const e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:Ne(e,n,o,s)}:void 0}l(to,"measuredNodeRect");function eo(t){if(t.isGroup)return;const e=to(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}l(eo,"nodeBoundsInfoFor");function ce(t,e,n=Yt){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}l(ce,"samePoint");function gt(t,e,n=Yt){return Math.abs(t.x-e.x)<n}l(gt,"sameX");function xt(t,e,n=Yt){return Math.abs(t.y-e.y)<n}l(xt,"sameY");function Nt(t,e,n=Yt){return xt(t,e,n)&&Math.abs(t.x-e.x)>n}l(Nt,"isHorizontalSegment");function Ot(t,e,n=Yt){return gt(t,e,n)&&Math.abs(t.y-e.y)>n}l(Ot,"isVerticalSegment");function Wt(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)))}l(Wt,"overlapLength");function fe(t,e,n=Yt){return t.horizontal&&e.horizontal&&xt(t.a,e.a,n)?Wt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&>(t.a,e.a,n)?Wt(t.a.y,t.b.y,e.a.y,e.b.y):0}l(fe,"sameAxisSegmentOverlapLength");function Oe(t,e=Yt){const n=[];for(let o=0;o<t.length-1;o++){const s=t[o],r=t[o+1],a=Nt(s,r,e),c=Ot(s,r,e);(a||c)&&n.push({index:o,a:s,b:r,horizontal:a,vertical:c})}return n}l(Oe,"orthogonalSegmentsForPoints");function oe(t,e=Yt){const n=Oe(t,e);let o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}l(oe,"countOrthogonalBends");function pt(t,e=Yt){const n=[];for(const o of t){const s=n.length>0?n[n.length-1]:void 0;(!s||!ce(s,o,e))&&n.push({x:o.x,y:o.y})}return n}l(pt,"dedupeConsecutivePoints");function no(t,e=Yt){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Nt(n,o,e)&&Ot(o,s,e)&&Nt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:Ot(n,o,e)&&Nt(o,s,e)&&Ot(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}l(no,"classifyThreeSegmentRoute");function nn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),a=Math.min(t.y,e.y),c=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&c>n.top-o&&a<n.bottom+o}l(nn,"segmentBoundsOverlapRect");function oo(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}l(oo,"pointInsideRect");function Fo(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}l(Fo,"rectContainsRect");function Ue(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}l(Ue,"rectsOverlap");function Cn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}l(Cn,"inflateRect");function Ne(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}l(Ne,"rectFromCenterSize");function te(t){var e;return(e=to(t))==null?void 0:e.rect}l(te,"rectOfNodeBounds");function ve(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}}}l(ve,"portForRectSide");function so(t,e,n,o,s,r=Yt){const a=e==="left"||e==="right",c=o==="left"||o==="right";if(a&&c){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(xt(t,n,r))return[t,n];const g=(t.x+n.x)/2;return[t,{x:g,y:t.y},{x:g,y:n.y},n]}if(e===o){if(xt(t,n,r))return;const g=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:g,y:t.y},{x:g,y:n.y},n]}return}if(!a&&!c){if(e===o){if(gt(t,n,r))return;const S=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:S},{x:n.x,y:S},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(gt(t,n,r))return[t,n];const g=(t.y+n.y)/2;return[t,{x:t.x,y:g},{x:n.x,y:g},n]}if(a&&!c){const p=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,g=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return p&&g?[t,{x:n.x,y:t.y},n]:void 0}const u=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,m=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return u&&m?[t,{x:t.x,y:n.y},n]:void 0}l(so,"buildOrthogonalPortPath");function ro(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}l(ro,"buildSameSideTrackPath");function on(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=eo(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}l(on,"collectRealNodeBounds");function be(t){const e=[],n=[];for(const o of t){const s=eo(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}l(be,"collectNodeRectEntries");function _o(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,a=o.width??0,c=o.height??0;n.push({nodeId:o.id,...Ne(s,r,a,c)})}return n}l(_o,"collectLayoutNodeRects");function io(t,e,n=Yt){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),a=e.get(s);if(!(!r||!a))return{srcId:o,dstId:s,srcInfo:r,dstInfo:a,collinearX:Math.abs(r.cx-a.cx)<n,collinearY:Math.abs(r.cy-a.cy)<n}}l(io,"getNodePairGeometry");function Bt(t,e,n,o=[],s=0){for(const r of n)if(!o.includes(r.id)&&nn(t,e,r.rect,-s))return!0;return!1}l(Bt,"segmentHitsAnyRect");function co(t,e,n,o,s=Yt,r=1e-6){const a=xt(t,e,s),c=gt(t,e,s),u=xt(n,o,s),m=gt(n,o,s);if(a&&u||c&&m||!(a||c)||!(u||m))return!1;const p=a?{a:t,b:e}:{a:n,b:o},g=c?{a:t,b:e}:{a:n,b:o},S=p.a.y,f=Math.min(p.a.x,p.b.x),d=Math.max(p.a.x,p.b.x),i=g.a.x,y=Math.min(g.a.y,g.b.y),C=Math.max(g.a.y,g.b.y);if(i<f||i>d||S<y||S>C)return!1;const b=Math.abs(i-p.a.x)<r&&Math.abs(S-p.a.y)<r||Math.abs(i-p.b.x)<r&&Math.abs(S-p.b.y)<r,L=Math.abs(i-g.a.x)<r&&Math.abs(S-g.a.y)<r||Math.abs(i-g.b.x)<r&&Math.abs(S-g.b.y)<r;return!(b&&L)}l(co,"orthogonalSegmentsCross");function Ho(t,e,n,o,s=Yt){const r=xt(t,e,s),a=gt(t,e,s),c=xt(n,o,s),u=gt(n,o,s);return a&&u&>(t,n,s)?Wt(t.y,e.y,n.y,o.y)>s:r&&c&&xt(t,n,s)?Wt(t.x,e.x,n.x,o.x)>s:!1}l(Ho,"sameAxisSegmentsOverlap");function We(t,e,n,o,{epsilon:s=Yt,skipDegenerateOther:r=!1}={}){for(const a of n){if(a===o||a.isLayoutOnly)continue;const c=a.points;if(!(!c||c.length<2))for(let u=0;u<c.length-1;u++){const m=c[u],p=c[u+1];if(!(r&&ce(m,p,s))&&(co(t,e,m,p,s)||Ho(t,e,m,p,s)))return!0}}return!1}l(We,"segmentConflictsWithAnyEdge");function ue(t,e,n,o,s=Yt){const r=xt(t,e,s),a=gt(t,e,s),c=xt(n,o,s),u=gt(n,o,s);if(!(r&&u||a&&c))return!1;const m=r?{a:t,b:e}:{a:n,b:o},p=r?{a:n,b:o}:{a:t,b:e},g=m.a.y,S=Math.min(m.a.x,m.b.x),f=Math.max(m.a.x,m.b.x),d=p.a.x,i=Math.min(p.a.y,p.b.y),y=Math.max(p.a.y,p.b.y);return d>S+s&&d<f-s&&g>i+s&&g<y-s}l(ue,"orthogonalSegmentsStrictlyCross");function vn(t,e,n){const o=Math.min(e,n),s=Math.max(e,n);return t>o+Yt&&t<s-Yt}l(vn,"strictlyBetween");function Do(t,e,n){return gt(t,e)&>(e,n)?vn(e.y,t.y,n.y):xt(t,e)&&xt(e,n)?vn(e.x,t.x,n.x):!1}l(Do,"isCollinearIntermediate");function Xo(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const s=n[n.length-1],r=t[o],a=o+1<t.length?t[o+1]:void 0;if(s&&a){if(ce(s,a)){o++,e=!0;continue}if(Do(s,r,a)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}l(Xo,"simplifyPolylineOnce");function Ke(t){const e=[t[0]];for(let o=1;o<t.length;o++){const s=e[e.length-1],r=t[o];if(!gt(s,r)&&!xt(s,r)){const a=e.length>=2?e[e.length-2]:void 0,u=(a?gt(a,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(u)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!ce(s,o))&&n.push(o)}return n}l(Ke,"orthogonalizePolyline");function de(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=Xo(e);if(e=o.points,!o.changed)break}return e}l(de,"simplifyPolyline");var it=.001,hr=.5,To=4;function ao(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?te(s):void 0,dstRect:r?te(r):void 0}}l(ao,"endpointContextFor");function Yo(t,e,n){if(xt(t,e,it))return{x:t.x<n.left?n.left:n.right,y:t.y};if(gt(t,e,it)){const o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}l(Yo,"segmentEnterPoint");function Ln(t,e,n){const o=n?1:-1;let s=n?0:t.length-1;for(;s>=0&&s<t.length&&oo(t[s],e,hr);)s+=o;if(s<0||s>=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const a=Yo(t[s],t[r],e);return n?[a,...t.slice(s)]:[...t.slice(0,s+1),a]}l(Ln,"clipEndpoint");function Go(t,e){for(const n of t){const o=ao(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Ln(s,o.srcRect,!0)),o.dstRect&&(s=Ln(s,o.dstRect,!1)),s=de(Ke(s)),s=lo(s,o.srcRect,o.dstRect),o.edge.points=de(Ke(s))}}l(Go,"clipEdgeEndpointsToNodeBoundaries");function Tn(t,e,n,o=!1){if(xt(t,e,it)){if(e.y<n.top-it||e.y>n.bottom+it)return e;if(o){if(t.x<n.left-it)return{x:n.left,y:t.y};if(t.x>n.right+it)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(gt(t,e,it)){if(e.x<n.left-it||e.x>n.right+it)return e;if(o){if(t.y<n.top-it)return{x:t.x,y:n.top};if(t.y>n.bottom+it)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}l(Tn,"snapEndpointToBoundary");function qe(t,e,n){const o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){const r=t[s];if(!ce(r,o,it))return r}return t[e+n]}l(qe,"firstDistinctAdjacent");function Ze(t,e){const n=t+To,o=e-To;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}l(Ze,"cornerClearanceRange");function wn(t,e,n){const{lo:o,hi:s}=Ze(e,n);return Math.min(s,Math.max(o,t))}l(wn,"clampToCornerClearance");function zo(t){const e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}l(zo,"intersectRanges");function En(t,e){return e==="left"||e==="right"?Ze(t.top,t.bottom):Ze(t.left,t.right)}l(En,"clearanceRangeForSide");function Je(t,e,n){const o=t.y>=n.top-it&&t.y<=n.bottom+it,s=t.x>=n.left-it&&t.x<=n.right+it;if(xt(t,e,it)&&o){if(Math.abs(t.x-n.left)<it)return"left";if(Math.abs(t.x-n.right)<it)return"right"}if(gt(t,e,it)&&s){if(Math.abs(t.y-n.top)<it)return"top";if(Math.abs(t.y-n.bottom)<it)return"bottom"}}l(Je,"terminalSideForSegment");function Pe(t){return t==="left"||t==="right"}l(Pe,"isHorizontalSide");function $o(t,e,n,o,s){const r=[],a=n?Je(t,e,n):void 0,c=o?Je(e,t,o):void 0;return n&&a&&Pe(a)===s&&r.push(En(n,a)),o&&c&&Pe(c)===s&&r.push(En(o,c)),r.length>0?zo(r):void 0}l($o,"straightClearanceRange");function An(t,e,n,o,s){const r=$o(t,e,n,o,s);if(!r)return;const a=s?t.y:t.x,c=Math.min(r.hi,Math.max(r.lo,a));if(!(Math.abs(c-a)<it))return s?[{x:t.x,y:c},{x:e.x,y:c}]:[{x:c,y:t.y},{x:c,y:e.y}]}l(An,"clearStraightEndpointCornerAxis");function lo(t,e,n){if(t.length!==2)return t;const[o,s]=t;return xt(o,s,it)?An(o,s,e,n,!0)??t:gt(o,s,it)?An(o,s,e,n,!1)??t:t}l(lo,"clearStraightEndpointCornerConnections");function Vo(t,e,n){return Pe(n)?{x:t.x,y:wn(t.y,e.top,e.bottom)}:{x:wn(t.x,e.left,e.right),y:t.y}}l(Vo,"cornerClearedEndpoint");function jo(t,e,n,o,s,r){const a=t.map(c=>({...c}));for(let c=e;c>=0&&c<t.length;c+=n){const u=t[c];if(r&&!xt(u,o,it)||!r&&!gt(u,o,it))break;r?a[c].y=s.y:a[c].x=s.x}return a}l(jo,"moveCollinearEndpointRun");function Rn(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,s=n?1:-1,r=t[o],a=qe(t,o,s);if(!a)return t;const c=Je(r,a,e);if(!c)return t;const u=Pe(c),m=Vo(r,e,c);return ce(r,m,it)?t:jo(t,o,s,r,m,u)}l(Rn,"clearEndpointCornerConnection");function Nn(t,e,n){const o=Math.min(t.x,e.x)>=n.left-it&&Math.max(t.x,e.x)<=n.right+it,s=Math.min(t.y,e.y)>=n.top-it&&Math.max(t.y,e.y)<=n.bottom+it;if(Math.abs(t.y-n.top)<it&&Math.abs(e.y-n.top)<it&&o)return"top";if(Math.abs(t.y-n.bottom)<it&&Math.abs(e.y-n.bottom)<it&&o)return"bottom";if(Math.abs(t.x-n.left)<it&&Math.abs(e.x-n.left)<it&&s)return"left";if(Math.abs(t.x-n.right)<it&&Math.abs(e.x-n.right)<it&&s)return"right"}l(Nn,"borderSideForSegment");function On(t,e,n,o){switch(t){case"top":return gt(e,n,it)&&n.y<o.top-it;case"bottom":return gt(e,n,it)&&n.y>o.bottom+it;case"left":return xt(e,n,it)&&n.x<o.left-it;case"right":return xt(e,n,it)&&n.x>o.right+it}}l(On,"leavesOutward");function Bn(t,e,n){if(t.length<3)return t;if(n){const r=Nn(t[0],t[1],e);return r&&On(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=Nn(t[o-1],t[o],e);return s&&On(s,t[o-1],t[o-2],e)?t.slice(0,o):t}l(Bn,"collapseOwnBorderStub");function Uo(t,e,n){let o=t;if(e){const r=qe(o,0,1);if(r){const a=Tn(r,o[0],e);a!==o[0]&&(o=[a,...o.slice(1)])}o=Bn(o,e,!0)}if(n){const r=o.length-1,a=qe(o,r,-1);if(a){const c=Tn(a,o[r],n,!0);c!==o[r]&&(o=[...o.slice(0,r),c])}o=Bn(o,n,!1)}const s=lo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Rn(o,e,!0)),n&&(o=Rn(o,n,!1)),o)}l(Uo,"snapAndCollapseEndpoints");function Pn(t,e){for(const n of t){const o=ao(n,e,2);if(!o)continue;const s=pt(o.points,it),r=Uo(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const a=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=a}}l(Pn,"prepareEdgeEndpointsForRenderer");function fo(t){return new Map(t.map(e=>[e.id,e]))}l(fo,"buildNodeMap");function Wo(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!(s!=null&&s.isGroup))break;o=s.id,n=s.parentId}return o}l(Wo,"resolveTopLevelGroupId");function kn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!(s!=null&&s.isGroup))break;n++,o=s.parentId}return n}l(kn,"groupDepth");function uo(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const a=r.x,c=r.y;if(typeof a!="number"||typeof c!="number")continue;const u=r.width??0,m=r.height??0;e=Math.min(e,a-u/2),n=Math.max(n,a+u/2),o=Math.min(o,c-m/2),s=Math.max(s,c+m/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}l(uo,"boundsForChildren");function Ko(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}l(Ko,"applyGroupBounds");function qo(t){const e=fo(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>kn(s,e)-kn(o,e));for(const o of n){const s=t.filter(a=>a.parentId===o.id),r=uo(s);r&&Ko(o,r)}}l(qo,"recomputeNestedGroupBounds");function Qe(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(u=>!u.isGroup);let r=1/0,a=-1/0;for(const u of s){const m=u[e];typeof m=="number"&&(r=Math.min(r,m),a=Math.max(a,m))}if(!Number.isFinite(r)||!Number.isFinite(a))return!1;const c=l(u=>r+a-u,"mirror");for(const u of n){const m=u[e];typeof m=="number"&&(u[e]=c(m));const p=u.groupTitleRect;p&&(u.groupTitleRect=e==="x"?{...p,left:c(p.right),right:c(p.left)}:{...p,top:c(p.bottom),bottom:c(p.top)})}for(const u of o)for(const m of u.points??[])m[e]=c(m[e]);return!0}l(Qe,"mirrorAxis");function Zo(t){return(t.nodes??[]).some(n=>!n.isGroup)?Qe(t,"y"):!0}l(Zo,"applyBtDirectionTransform");function Jo(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(B=>!B.isGroup);let r=1/0,a=1/0;for(const B of s){const G=B.x??0,j=B.y??0;G<r&&(r=G),j<a&&(a=j)}if(!Number.isFinite(r)||!Number.isFinite(a))return!1;const c=36;let u=0,m=0;for(const B of s)u+=B.width??0,m+=B.height??0;const p=u/s.length,g=m/s.length,S=g>0?Math.max(1,p/g):1;for(const B of s){const G=B.x??0,tt=((B.y??0)-a)*S+c,ft=G-r;B.x=tt,B.y=ft}for(const B of o)if(B.points)for(const G of B.points){const j=G.x,ft=(G.y-a)*S+c,It=j-r;G.x=ft,G.y=It}qo(n);const f=n.filter(B=>B.isGroup&&!B.parentId);if(f.length===0)return e==="RL"&&Qe(t,"x"),!0;const d=fo(n),i=new Map;for(const B of n){if(B.isGroup)continue;const G=Wo(B,d);if(!G)continue;const j=i.get(G)??[];j.push(B),i.set(G,j)}let y=0;for(const B of f){const G=B.padding??0;G>y&&(y=G)}const C=[];let b=1/0,L=-1/0;for(const B of f){const G=i.get(B.id)??[],j=uo(G);j&&(b=Math.min(b,j.minX),L=Math.max(L,j.maxX),C.push({lane:B,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(b===1/0||L===-1/0)return!0;const v=Math.max(0,L-b),x=Math.max(y,10),I=v+2*x,T=c+I,O=(b+L)/2-I/2-c,k=O+T/2,D=Math.max(y,c);C.sort((B,G)=>B.centerY-G.centerY);for(let B=0;B<C.length;B++){const G=C[B];let j,tt;if(B===0?j=G.contentTop-D:j=(C[B-1].contentBottom+G.contentTop)/2,B===C.length-1)tt=G.contentBottom+D;else{const Dt=C[B+1];tt=(G.contentBottom+Dt.contentTop)/2}const ft=Math.max(0,tt-j),It=(j+tt)/2;G.lane.x=k,G.lane.y=It,G.lane.width=T,G.lane.height=ft,G.lane.swimlaneContentTop=G.contentTop,G.lane.groupTitleRect={left:O,right:O+c,top:j,bottom:tt}}return e==="RL"&&Qe(t,"x"),!0}l(Jo,"applyLrDirectionTransform");var ae=1e-6,gr=8,Ge=gr,mr=[0,Ge,-Ge,2*Ge,-2*Ge];function Qo(t,e){const{nodeInfoById:n,realNodeRects:o}=on(e);for(const s of t){if(s.isLayoutOnly)continue;const r=s.points;if(!r||r.length<4)continue;const a=no(pt(r,ae),ae);if(!a)continue;const{p3:c}=a,u=a.kind==="HVH",m=io(s,n,ae);if(!m)continue;const{srcId:p,dstId:g,srcInfo:S,dstInfo:f,collinearX:d,collinearY:i}=m;if(d||i)continue;let y;const C=S.rect;for(const b of mr){let L,v,x;if(u){const k=f.cy>S.cy?C.bottom:C.top,D=S.cx+b;if(D<=C.left+ae||D>=C.right-ae)continue;L={x:D,y:k},v={x:D,y:c.y},x={x:c.x,y:c.y}}else{const k=f.cx>S.cx?C.right:C.left,D=S.cy+b;if(D<=C.top+ae||D>=C.bottom-ae)continue;L={x:k,y:D},v={x:c.x,y:D},x={x:c.x,y:c.y}}const I=ce(L,v,ae),T=ce(v,x,ae);if(I&&T||!I&&Bt(L,v,o,[p],1)||!T&&Bt(v,x,o,[g],1))continue;const A=!I&&We(L,v,t,s,{epsilon:ae,skipDegenerateOther:!0}),P=!T&&We(v,x,t,s,{epsilon:ae,skipDegenerateOther:!0});if(!(A||P)){I?y=[v,x]:T?y=[L,v]:y=[L,v,x];break}}y&&(s.points=y)}}l(Qo,"portSwapToLShape");function ts(t,e){const{realNodeRects:r,labelNodeRects:a}=be(e.values());for(const c of t){if(c.isLayoutOnly)continue;const u=c.points;if(!u||u.length<4)continue;const m=pt(u,.001);if(m.length<4)continue;const p=m.length-1,g=m[p],S=m[p-1],f=m[p-2],d=g.x-S.x,i=g.y-S.y,y=Math.hypot(d,i);if(y>=10||y<.001)continue;const C=S.x-f.x,b=S.y-f.y;if(Math.hypot(C,b)<.001)continue;const v=Nt(S,g,.001),x=Ot(S,g,.001),I=Nt(f,S,.001),T=Ot(f,S,.001);if(!(v&&T||x&&I))continue;const A=c.end,P=c.start,O=A?e.get(A):void 0;if(!O)continue;const k=O.x??0,D=O.y??0,B=te(O);if(!B)continue;let G,j;if(T){const Z=b<0;G={x:k,y:f.y},j={x:k,y:Z?B.bottom:B.top}}else{const Z=C>0;G={x:f.x,y:D},j={x:Z?B.right:B.left,y:D}}if(Bt(G,j,r,A?[A]:[],-2)||Bt(G,j,a,[],-2))continue;if(P){const Z=e.get(P),rt=Z?te(Z):void 0;if(rt&&oo(G,rt,2))continue}const tt=l((Z,rt)=>`${Z.x.toFixed(3)},${Z.y.toFixed(3)}|${rt.x.toFixed(3)},${rt.y.toFixed(3)}`,"ownSegmentKey"),ft=new Set;for(let Z=0;Z<m.length-1;Z++)ft.add(tt(m[Z],m[Z+1]));const It=l((Z,rt)=>{for(const ut of t){if(ut===c||ut.isLayoutOnly)continue;const yt=ut.points;if(!(!yt||yt.length<2))for(let St=0;St<yt.length-1;St++){const Et=yt[St],Kt=yt[St+1];if(!ft.has(tt(Et,Kt))&&ue(Z,rt,Et,Kt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(It(G,j))continue;if(p-3>=0){const Z=m[p-3],rt=[P,A].filter(ut=>!!ut);if(Bt(Z,G,r,rt,-2)||It(Z,G))continue}const _t=[...m.slice(0,p-2),G,j];c.points=_t;const nt=c.labelNodeId;if(nt){const Z=e.get(nt);if(Z){const rt=Z.width??0,ut=Z.height??0;if(rt>0&&ut>0){let yt,St,Et=-1;for(let Kt=0;Kt<_t.length-1;Kt++){const qt=_t[Kt],Zt=_t[Kt+1],se=Math.hypot(Zt.x-qt.x,Zt.y-qt.y),Le=xt(qt,Zt,.001),ge=gt(qt,Zt,.001);(Le&&se>=rt+2||ge&&se>=ut+2)&&se>Et&&(Et=se,yt=(qt.x+Zt.x)/2,St=(qt.y+Zt.y)/2)}yt!==void 0&&St!==void 0&&(Z.x=yt,Z.y=St)}}}}}l(ts,"collapseShortTerminalStub");var et=.001,Xt=8,es=l(t=>typeof t=="string"?t.toUpperCase():"","upperCaseDirection"),at=Oe,pn=l((t,e)=>gt(t,e,et)||xt(t,e,et),"orthogonallyAligned");function Fn(t,e){const s=l((f,d)=>{const i=f.x??0,y=f.y??0,C=d.x-i,b=d.y-y;let L=(f.width??0)/2,v=(f.height??0)/2;return Math.abs(b)*L>Math.abs(C)*v?(b<0&&(v=-v),{x:i+(b===0?0:v*C/b),y:y+v}):(C<0&&(L=-L),{x:i+L,y:y+(C===0?0:L*b/C)})},"rectIntersect"),r=l((f,d)=>{const i=pt(f.points??[]);if(i.length<2)return;const y=d?f.start:f.end,C=y?e.get(y):void 0,b=C?te(C):void 0;if(!C||!y||!b)return;const L=d?i[0]:i[i.length-1],v=d?i[1]:i[i.length-2],x=s(C,L);let I=L;if(pn(v,x)&&(I=v),gt(x,I,et))return{edge:f,edgeId:String(f.id??""),nodeId:y,atStart:d,orientation:"V",coord:x.x,min:Math.min(x.y,I.y),max:Math.max(x.y,I.y),boundary:x,railEnd:I,rect:b};if(xt(x,I,et))return{edge:f,edgeId:String(f.id??""),nodeId:y,atStart:d,orientation:"H",coord:x.y,min:Math.min(x.x,I.x),max:Math.max(x.x,I.x),boundary:x,railEnd:I,rect:b}},"terminalLaneFor"),a=l((f,d)=>Math.max(0,Math.min(f.max,d.max)-Math.max(f.min,d.min)),"projectedOverlapLength"),c=l((f,d)=>f.nodeId!==d.nodeId||f.orientation!==d.orientation?!1:f.orientation==="H"?(Math.abs(f.boundary.x-f.rect.left)<1||Math.abs(f.boundary.x-f.rect.right)<1)&>(f.boundary,d.boundary,1):(Math.abs(f.boundary.y-f.rect.top)<1||Math.abs(f.boundary.y-f.rect.bottom)<1)&&xt(f.boundary,d.boundary,1),"sameTerminalFace"),u=l((f,d)=>f.nodeId!==d.nodeId||f.orientation!==d.orientation?!1:a(f,d)>=Xt&&Math.abs(f.coord-d.coord)<.5,"exactTerminalLaneConflict"),m=l((f,d)=>{if(f.nodeId!==d.nodeId||f.orientation!==d.orientation||f.orientation!=="H"||f.atStart===d.atStart)return!1;const i=a(f,d);if(i<Xt)return!1;const y=f.rect.bottom-f.rect.top;return i<y||i>2*y?!1:c(f,d)&&Math.abs(f.coord-d.coord)<16},"nearTerminalLaneConflict"),p=l((f,d)=>{const i=pt(f.edge.points??[]);if(i.length<2)return;const y=f.orientation==="V"?{x:f.boundary.x+d,y:f.boundary.y}:{x:f.boundary.x,y:f.boundary.y+d},C=f.orientation==="V"?{x:f.railEnd.x+d,y:f.railEnd.y}:{x:f.railEnd.x,y:f.railEnd.y+d};if(!l(()=>Math.abs(f.boundary.y-f.rect.top)<1||Math.abs(f.boundary.y-f.rect.bottom)<1?xt(y,f.boundary,et)&&y.x>=f.rect.left+1&&y.x<=f.rect.right-1:Math.abs(f.boundary.x-f.rect.left)<1||Math.abs(f.boundary.x-f.rect.right)<1?gt(y,f.boundary,et)&&y.y>=f.rect.top+1&&y.y<=f.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(f.atStart){const I=i.length>1&&ce(i[1],f.railEnd,et),T=i.slice(I?2:1),A=T[0];return A&&!pn(A,C)?void 0:[y,C,...T]}const L=i.length>1&&ce(i[i.length-2],f.railEnd,et),v=i.slice(0,L?-2:-1),x=v[v.length-1];if(!(x&&!pn(x,C)))return[...v,C,y]},"shiftedCandidate"),g=l(f=>{const d=f.edge,i=pt(d.points??[]);if(i.length!==2)return!1;const y=d.start,C=d.end,b=y?e.get(y):void 0,L=C?e.get(C):void 0;if(!b||!L)return!1;const v=b.x??0,x=b.y??0,I=L.x??0,T=L.y??0,[A,P]=i;return xt(A,P,et)&&Math.abs(x-T)<1&&Math.abs(v-I)>1||gt(A,P,et)&&Math.abs(v-I)<1&&Math.abs(x-T)>1},"laneIsStraightCollinearConnector"),S=[-7,7,-2*7,2*7,-3*7,3*7];for(let f=0;f<8;f++){const d=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let i=!1;for(let y=0;y<d.length&&!i;y++)for(let C=y+1;C<d.length&&!i;C++){const b=d[y],L=d[C];if(b.edge===L.edge||!(u(b,L)||m(b,L)))continue;const v=!u(b,L),x=[b,L].sort((I,T)=>{const A=g(I),P=g(T);return A!==P?Number(A)-Number(P):+!T.atStart-+!I.atStart});for(const I of x){for(const T of S){const A=p(I,T);if(!A)continue;const P=r({...I.edge,points:A},I.atStart);if(!(!P||d.some(O=>O.edge!==I.edge&&(u(P,O)||v&&m(P,O))))){I.edge.points=A,i=!0;break}}if(i)break}}if(!i)return}}l(Fn,"separateSharedRenderedTerminalLanes");function ns(t,e){const{realNodeRects:o,labelNodeRects:s}=be(e.values()),r=l((c,u)=>{const m=c.start,p=c.end,g=at(u);if(g.length!==u.length-1)return!1;const S=[m,p].filter(f=>!!f);for(const f of g)if(Bt(f.a,f.b,o,S,-2)||Bt(f.a,f.b,s,[],-2))return!1;for(const f of t){if(f===c||f.isLayoutOnly)continue;const d=f.points;if(!(!d||d.length<2)){for(const i of g)for(const y of at(pt(d)))if(fe(i,y,.5)>=Xt||ue(i.a,i.b,y.a,y.b,et))return!1}}return!0},"candidateIsSafe"),a=l((c,u)=>{if(u+4>=c.length)return;const m=c[u],p=c[u+1],g=c[u+2],S=c[u+3],f=c[u+4],d=Nt(m,p)&&Ot(p,g)&&Nt(g,S)&&Ot(S,f)&>(m,S,et)&>(m,f,et)&>(p,g,et)&&(p.x-m.x)*(S.x-g.x)<0,i=Ot(m,p)&&Nt(p,g)&&Ot(g,S)&&Nt(S,f)&&xt(m,S,et)&&xt(m,f,et)&&xt(p,g,et)&&(p.y-m.y)*(S.y-g.y)<0;if(d||i)return pt([...c.slice(0,u+1),f,...c.slice(u+5)]);if(u+5>=c.length)return;const y=c[u+5],C=Ot(m,p)&&Nt(p,g)&&Ot(g,S)&&Nt(S,f)&&Ot(f,y)&>(m,f,et)&>(m,y,et)&>(g,S,et)&&(g.x-p.x)*(f.x-S.x)<0,b=Nt(m,p)&&Ot(p,g)&&Nt(g,S)&&Ot(S,f)&&Nt(f,y)&&xt(m,f,et)&&xt(m,y,et)&&xt(g,S,et)&&(g.y-p.y)*(f.y-S.y)<0;if(!(!C&&!b))return pt([...c.slice(0,u+1),y,...c.slice(u+6)])},"withoutDogleg");for(let c=0;c<8;c++){let u=!1;for(const m of t){if(m.isLayoutOnly)continue;const p=pt(m.points??[]);for(let g=0;g<=p.length-5;g++){const S=a(p,g);if(!(!S||!r(m,S))){m.points=S,u=!0;break}}if(u)break}if(!u)return}}l(ns,"collapseRedundantRectangularDoglegs");function _n(t,e){const{realNodeRects:r,labelNodeRects:a}=be(e.values()),c=t.filter(d=>!d.isLayoutOnly),u=l((d,i,y)=>pt(d===i?y??[]:d.points??[]),"pointsFor"),m=l((d,i)=>{let y=0;for(let C=0;C<c.length;C++){const b=at(u(c[C],d,i));for(let L=C+1;L<c.length;L++){const v=at(u(c[L],d,i));for(const x of b)for(const I of v)ue(x.a,x.b,I.a,I.b,et)&&y++}}return y},"strictCrossingCount"),p=l(d=>{const i=at(d);if(i.length!==3)return;const y=i[1];if(!(i[0].horizontal===y.horizontal||i[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),g=l((d,i)=>{const y=[d.start,d.end].filter(C=>!!C);return r.filter(C=>{if(y.includes(C.id))return!1;const b=C.rect;return i.horizontal?Wt(i.a.x,i.b.x,b.left,b.right)>=Xt&&i.a.y>=b.top-2&&i.a.y<=b.bottom+2:Wt(i.a.y,i.b.y,b.top,b.bottom)>=Xt&&i.a.x>=b.left-2&&i.a.x<=b.right+2})},"blockingRectsFor"),S=l((d,i,y)=>{const C=d.map(L=>({...L}));if(i.horizontal)C[i.index].y=y,C[i.index+1].y=y;else if(i.vertical)C[i.index].x=y,C[i.index+1].x=y;else return;const b=de(pt(C));return at(b).length===b.length-1?b:void 0},"candidateByMovingRail"),f=l((d,i,y)=>{const C=[d.start,d.end].filter(L=>!!L),b=at(i);if(b.length!==i.length-1)return!1;for(const L of b)if(Bt(L.a,L.b,r,C,-2)||Bt(L.a,L.b,a,[],-2))return!1;for(const L of c)if(L!==d){for(const v of b)for(const x of at(u(L)))if(fe(v,x,.5)>=Xt)return!1}return m(d,i)<=y},"candidateIsSafe");for(let d=0;d<8;d++){const i=m();let y=!1;for(const C of c){const b=u(C),L=p(b);if(!L)continue;const v=g(C,L.segment);if(v.length===0)continue;const x=L.horizontal?[Math.min(...v.map(I=>I.rect.top))-20,Math.max(...v.map(I=>I.rect.bottom))+20]:[Math.min(...v.map(I=>I.rect.left))-20,Math.max(...v.map(I=>I.rect.right))+20];for(const I of x){const T=S(b,L.segment,I);if(!(!T||!f(C,T,i))){C.points=T,y=!0;break}}if(y)break}if(!y)return}}l(_n,"liftObstacleHuggingSameSideRails");function Hn(t,e,n){const s=l(m=>{const p=m.groupTitleRect;if(!(!p||typeof p.left!="number"||typeof p.right!="number"||typeof p.top!="number"||typeof p.bottom!="number"||!Number.isFinite(p.left)||!Number.isFinite(p.right)||!Number.isFinite(p.top)||!Number.isFinite(p.bottom)||p.right<=p.left||p.bottom<=p.top))return{left:p.left,right:p.right,top:p.top,bottom:p.bottom}},"validTitleRect"),r=l(m=>{if(!m.isGroup||m.parentId)return;const p=es(m.direction??n);if(p==="LR"||p==="RL"||p==="BT")return;const g=s(m),S=m.y,f=m.height;if(!g||typeof S!="number"||typeof f!="number"||!Number.isFinite(S)||!Number.isFinite(f)||f<=0)return;const d=g.right-g.left,i=g.bottom-g.top;if(!(i<=0||d<i))return{node:m,rect:g}},"topLaneTitleFor"),a=l((m,p)=>{if(!m.horizontal)return!1;const g=m.a.y;return g<p.top-et||g>p.bottom+et?!1:Wt(m.a.x,m.b.x,p.left,p.right)>=Xt},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(r).filter(m=>!!m);if(c.length===0)return;let u=0;for(const m of t){if(m.isLayoutOnly)continue;const p=pt(m.points??[]);for(const g of at(p))for(const S of c)a(g,S.rect)&&(u=Math.max(u,S.rect.bottom-g.a.y+4))}if(!(u<=et))for(const m of c){const p=m.node.y,g=m.node.height;typeof p!="number"||typeof g!="number"||!Number.isFinite(p)||!Number.isFinite(g)||g<=0||(m.node.y=p-u/2,m.node.height=g+u,m.node.groupTitleRect={...m.rect,top:m.rect.top-u,bottom:m.rect.bottom-u})}}l(Hn,"liftTopLaneTitleBandsAboveRails");function Dn(t,e,n){const s=l(p=>{const g=p.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),r=l(p=>{if(!p.isGroup||p.parentId||es(p.direction??n)!=="LR")return;const S=s(p),f=p.x,d=p.width;if(!S||typeof f!="number"||typeof d!="number"||!Number.isFinite(f)||!Number.isFinite(d)||d<=0)return;const i=S.right-S.left,y=S.bottom-S.top;if(!(i<=0||y<i))return{node:p,rect:S}},"leftLaneTitleFor"),a=l((p,g)=>{if(!p.vertical)return!1;const S=p.a.x;return S<g.left-et||S>g.right+et?!1:Wt(p.a.y,p.b.y,g.top,g.bottom)>=Xt},"verticalSegmentIntersectsTitle"),c=l((p,g)=>{if(!p.horizontal)return!1;const S=p.a.y;return S<g.top-et||S>g.bottom+et?!1:Wt(p.a.x,p.b.x,g.left,g.right)>=Xt},"horizontalSegmentIntersectsTitle"),u=[...e.values()].map(r).filter(p=>!!p);if(u.length===0)return;let m=0;for(const p of t){if(p.isLayoutOnly)continue;const g=pt(p.points??[]);for(const S of at(g))for(const f of u)if(a(S,f.rect))m=Math.max(m,f.rect.right-S.a.x+4);else if(c(S,f.rect)){const d=Math.min(S.a.x,S.b.x);m=Math.max(m,f.rect.right-d+4)}}if(!(m<=et))for(const p of u){const g=p.node.x,S=p.node.width;typeof g!="number"||typeof S!="number"||!Number.isFinite(g)||!Number.isFinite(S)||S<=0||(p.node.x=g-m/2,p.node.width=S+m,p.node.groupTitleRect={...p.rect,left:p.rect.left-m,right:p.rect.right-m})}}l(Dn,"shiftLeftLaneTitleBandsLeftOfRails");function os(t,e){const{realNodeRects:o}=be(e.values()),s=t.filter(d=>!d.isLayoutOnly),r=l((d,i=new Map)=>pt(i.get(d)??d.points??[]),"replacementPointsFor"),a=l((d=new Map)=>{let i=0;for(let y=0;y<s.length;y++){const C=at(r(s[y],d));for(let b=y+1;b<s.length;b++){const L=at(r(s[b],d));for(const v of C)for(const x of L)ue(v.a,v.b,x.a,x.b,et)&&i++}}return i},"crossingCount"),c=l((d=new Map)=>s.reduce((i,y)=>i+oe(r(y,d)),0),"totalBends"),u=l(d=>{const i=r(d);if(i.length<4)return;const y=i[i.length-2],C=i[i.length-1];if(!(!Nt(y,C,et)&&!Ot(y,C,et)))return{tailStart:y,terminal:C}},"terminalTailFor"),m=l((d,i)=>{const y=r(d);if(y.length<3)return;const C=y[0],b=y[1];let L;if(Nt(C,b,et))L={x:b.x,y:i.tailStart.y};else if(Ot(C,b,et))L={x:i.tailStart.x,y:b.y};else return;const v=de(pt([C,b,L,i.tailStart,i.terminal]));return at(v).length===v.length-1?v:void 0},"candidateWithDestinationTail"),p=l((d,i)=>{const y=[d.start,d.end].filter(C=>!!C);for(const C of at(i))if(Bt(C.a,C.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),g=l((d,i,y)=>{for(const C of s)if(C!==d){for(const b of at(i))for(const L of at(r(C,y)))if(fe(b,L,.5)>=Xt)return!0}return!1},"pathHasSharedTrack"),S=l((d,i,y)=>!p(d,i)&&!g(d,i,y),"candidateIsSafe"),f=l(()=>{const d=new Map;for(const i of s){const y=i.end;if(!y||!e.has(y)||r(i).length<4)continue;const b=d.get(y)??[];b.push(i),d.set(y,b)}return d},"edgesByDestination");for(let d=0;d<4;d++){const i=a();if(i===0)return;const y=c();let C,b=i,L=y;for(const v of f().values())for(let x=0;x<v.length;x++)for(let I=x+1;I<v.length;I++){const T=v[x],A=v[I],P=u(T),O=u(A);if(!P||!O)continue;const k=m(T,O),D=m(A,P);if(!k||!D)continue;const B=new Map([[T,k],[A,D]]);if(!S(T,k,B)||!S(A,D,B))continue;const G=a(B),j=c(B);G>=i||G>b||G===b&&j>=L||(C=B,b=G,L=j)}if(!C)return;for(const[v,x]of C)v.points=x}}l(os,"swapDestinationTerminalTailsToReduceCrossings");function ss(t,e){const{realNodeRects:r,labelNodeRects:a}=be(e.values()),c=t.filter(v=>!v.isLayoutOnly),u=l((v,x=new Map)=>pt(x.get(v)??v.points??[]),"replacementPointsFor"),m=l((v=new Map)=>{let x=0;for(let I=0;I<c.length;I++){const T=at(u(c[I],v));for(let A=I+1;A<c.length;A++){const P=at(u(c[A],v));for(const O of T)for(const k of P)ue(O.a,O.b,k.a,k.b,et)&&x++}}return x},"strictCrossingCount"),p=l((v=new Map)=>c.reduce((x,I)=>x+oe(u(I,v)),0),"totalBends"),g=l(v=>{const x=v.start,I=v.end,T=x?e.get(x):void 0,A=I?e.get(I):void 0,P=T?te(T):void 0,O=A?te(A):void 0;return P&&O?{src:P,dst:O}:void 0},"endpointRectsFor"),S=l((v,x,I)=>{if(I.index<=0||I.index+1>=x.length-1)return;const T=g(v);if(T){if(I.vertical){const A=I.a.x,P=Math.min(T.src.left,T.dst.left),O=Math.max(T.src.right,T.dst.right),k=A<P-et?"left":A>O+et?"right":void 0;return k?{edge:v,points:x,segmentIndex:I.index,axis:"vertical",side:k,coord:A,min:Math.min(I.a.y,I.b.y),max:Math.max(I.a.y,I.b.y)}:void 0}if(I.horizontal){const A=I.a.y,P=Math.min(T.src.top,T.dst.top),O=Math.max(T.src.bottom,T.dst.bottom),k=A<P-et?"top":A>O+et?"bottom":void 0;return k?{edge:v,points:x,segmentIndex:I.index,axis:"horizontal",side:k,coord:A,min:Math.min(I.a.x,I.b.x),max:Math.max(I.a.x,I.b.x)}:void 0}}},"externalRailForSegment"),f=l(()=>{const v=[];for(const x of c){const I=u(x);for(const T of at(I)){const A=S(x,I,T);A&&v.push(A)}}return v},"collectExternalRails"),d=l((v,x)=>v.edge!==x.edge&&v.axis===x.axis&&v.side===x.side&&Wt(v.min,v.max,x.min,x.max)>=Xt,"railsInteract"),i=l(v=>{const x=[],I=new Set;for(const T of v){if(I.has(T))continue;const A=[T],P=[];for(I.add(T);A.length>0;){const O=A.pop();P.push(O);for(const k of v)!I.has(k)&&d(O,k)&&(I.add(k),A.push(k))}P.length>1&&x.push(P)}return x},"connectedComponents"),y=l(v=>{const x=[];for(const I of v)x.some(T=>Math.abs(T-I.coord)<et)||x.push(I.coord);for(;x.length<v.length;){const I=Math.min(...x),T=Math.max(...x),A=v[0].side;x.push(A==="left"||A==="top"?I-12*(v.length-x.length):T+12*(v.length-x.length))}return x},"uniqueCoordsFor"),C=l(v=>{const x=v.map(A=>A.coord),I=y(v),T=[];if(v.length<=6){const A=new Array(I.length).fill(!1),P=[],O=l(()=>{if(P.length===v.length){P.some((k,D)=>Math.abs(k-x[D])>=et)&&T.push([...P]);return}for(const[k,D]of I.entries())A[k]||(A[k]=!0,P.push(D),O(),P.pop(),A[k]=!1)},"visit");return O(),T}for(let A=0;A<x.length;A++)for(let P=A+1;P<x.length;P++){const O=[...x];[O[A],O[P]]=[O[P],O[A]],T.push(O)}return T},"coordinateAssignmentsFor"),b=l((v,x)=>{const I=new Map;for(const[A,P]of v.entries()){const O=x[A],k=I.get(P.edge)??P.points.map(D=>({x:D.x,y:D.y}));P.axis==="vertical"?(k[P.segmentIndex].x=O,k[P.segmentIndex+1].x=O):(k[P.segmentIndex].y=O,k[P.segmentIndex+1].y=O),I.set(P.edge,k)}const T=new Map;for(const[A,P]of I){const O=de(pt(P));if(at(O).length!==O.length-1)return;T.set(A,O)}return T},"replacementsForAssignment"),L=l(v=>{for(const[x,I]of v){const T=[x.start,x.end].filter(A=>!!A);for(const A of at(I))if(Bt(A.a,A.b,r,T,-2)||Bt(A.a,A.b,a,[],-2))return!1}for(let x=0;x<c.length;x++){const I=c[x],T=v.has(I),A=at(u(I,v));for(let P=x+1;P<c.length;P++){const O=c[P];if(!T&&!v.has(O))continue;const k=at(u(O,v));for(const D of A)for(const B of k)if(fe(D,B,.5)>=Xt)return!1}}return!0},"candidateIsSafe");for(let v=0;v<4;v++){const x=m();if(x===0)return;let I,T=x,A=p(),P=Number.POSITIVE_INFINITY;for(const O of i(f()))for(const k of C(O)){const D=b(O,k);if(!D||!L(D))continue;const B=m(D);if(B>=x)continue;const G=p(D),j=O.reduce((tt,ft,It)=>tt+Math.abs(k[It]-ft.coord),0);B>T||B===T&&(G>A||G===A&&j>=P)||(I=D,T=B,A=G,P=j)}if(!I)return;for(const[O,k]of I)O.points=k}}l(ss,"reassignCrossingExternalRailChannels");function rs(t,e){const{realNodeRects:o,labelNodeRects:s}=be(e.values()),r=t.filter(f=>!f.isLayoutOnly),a=l((f,d,i)=>pt(f===d?i??[]:f.points??[]),"pointsFor"),c=l(f=>at(f).reduce((d,i)=>{const y=i.a.x-i.b.x,C=i.a.y-i.b.y;return d+Math.hypot(y,C)},0),"pathLength"),u=l((f,d)=>{let i=0;for(let y=0;y<r.length;y++){const C=at(a(r[y],f,d));for(let b=y+1;b<r.length;b++){const L=at(a(r[b],f,d));for(const v of C)for(const x of L)ue(v.a,v.b,x.a,x.b,et)&&i++}}return i},"strictCrossingCount"),m=l((f,d)=>{if(f.horizontal){const i=f.a.y;return(Math.abs(i-d.top)<1||Math.abs(i-d.bottom)<1)&&Wt(f.a.x,f.b.x,d.left,d.right)>=Xt}if(f.vertical){const i=f.a.x;return(Math.abs(i-d.left)<1||Math.abs(i-d.right)<1)&&Wt(f.a.y,f.b.y,d.top,d.bottom)>=Xt}return!1},"segmentRunsAlongRectBorder"),p=l(f=>{const d=[f.start,f.end].filter(y=>!!y),i=[];for(const y of d){const C=e.get(y),b=C?te(C):void 0;b&&i.push(b)}return i},"endpointRectsFor"),g=l((f,d)=>{if(d+3>=f.length)return[];const i=f[d],y=f[d+1],C=f[d+2],b=f[d+3],L=Nt(i,y,et)&&Ot(y,C,et)&&Nt(C,b,et),v=Ot(i,y,et)&&Nt(y,C,et)&&Ot(C,b,et);if(!L&&!v)return[];if(!(L?Math.sign(y.x-i.x)!==Math.sign(b.x-C.x):Math.sign(y.y-i.y)!==Math.sign(b.y-C.y)))return[];const I=gt(i,b,et)||xt(i,b,et)?[]:[{x:i.x,y:b.y},{x:b.x,y:i.y}],T=I.length===0?[[...f.slice(0,d+1),...f.slice(d+3)]]:I.map(P=>[...f.slice(0,d+1),P,...f.slice(d+3)]),A=new Set;return T.map(P=>de(pt(P))).filter(P=>{if(at(P).length!==P.length-1||!P.some(k=>ce(k,b,et)))return!1;const O=P.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return A.has(O)?!1:(A.add(O),!0)})},"shortcutCandidatesAt"),S=l((f,d,i)=>{const y=[f.start,f.end].filter(b=>!!b),C=p(f);for(const b of at(d))if(Bt(b.a,b.b,o,y,-2)||Bt(b.a,b.b,s,[],-2)||C.some(L=>m(b,L)))return!1;for(const b of r)if(b!==f){for(const L of at(d))for(const v of at(a(b)))if(fe(L,v,.5)>=Xt)return!1}return u(f,d)<=i},"candidateIsSafe");for(let f=0;f<8;f++){const d=u();let i,y,C=d,b=Number.POSITIVE_INFINITY,L=Number.POSITIVE_INFINITY;for(const v of r){const x=a(v),I=oe(x,et),T=c(x);for(let A=0;A<=x.length-4;A++)for(const P of g(x,A)){const O=oe(P,et),k=c(P);if(!(O<I||O===I&&k<T-et)||!S(v,P,d))continue;const B=u(v,P);B>C||B===C&&(O>b||O===b&&k>=L)||(i=v,y=P,C=B,b=O,L=k)}}if(!i||!y)return;i.points=y}}l(rs,"shortcutRedundantOrthogonalJogs");function is(t,e){const a=[];for(const R of e.values()){if(R.isGroup||R.isEdgeLabel)continue;const F=R.x??0,_=R.y??0,V=te(R);V&&a.push({id:String(R.id??""),cx:F,cy:_,rect:V})}if(a.length===0)return;const c=new Map(a.map(R=>[R.id,R])),u=a.map(R=>({id:R.id,rect:R.rect})),m=["top","bottom","left","right"],p={top:Math.min(...a.map(R=>R.rect.top))-20,bottom:Math.max(...a.map(R=>R.rect.bottom))+20,left:Math.min(...a.map(R=>R.rect.left))-20,right:Math.max(...a.map(R=>R.rect.right))+20},g=t.filter(R=>!R.isLayoutOnly),S=new Map(g.map((R,F)=>[R,F])),f=l(R=>{const F=R==="left"||R==="top"?-1:1,_=[];for(let V=0;V<=2;V++)_.push(p[R]+F*20*V);return _},"outwardTracksForSide"),d=l((R,F=new Map)=>pt(F.get(R)??R.points??[]),"replacementPointsFor"),i=l((R,F)=>{let _=0;for(const V of R)for(const K of F)ue(V.a,V.b,K.a,K.b,et)&&_++;return _},"crossingCountBetweenSegments"),y=l((R,F)=>i(at(R),at(F)),"crossingCountBetweenPaths"),C=l((R=new Map)=>{let F=0;const _=[],V=new Set,K=[],J=l(Y=>{V.has(Y)||(V.add(Y),K.push(Y))},"addEdge");for(let Y=0;Y<g.length;Y++){const q=g[Y],h=d(q,R);for(let M=Y+1;M<g.length;M++){const E=g[M],w=y(h,d(E,R));w>0&&(F+=w,_.push({first:q,second:E,count:w}),J(q),J(E))}}return K.sort((Y,q)=>(S.get(Y)??0)-(S.get(q)??0)),{count:F,pairs:_,edgeSet:V,edges:K}},"crossingSnapshot"),b=l((R,F)=>{const _=new Set(F.keys());if(_.size===0)return R.count;let V=0;for(const J of R.pairs)(_.has(J.first)||_.has(J.second))&&(V+=J.count);let K=0;for(let J=0;J<g.length;J++){const Y=g[J],q=_.has(Y),h=d(Y,F);for(let M=J+1;M<g.length;M++){const E=g[M];!q&&!_.has(E)||(K+=y(h,d(E,F)))}}return R.count-V+K},"crossingCountWithReplacements"),L=l(R=>{const F=new Map;for(const K of R.pairs){const J=F.get(K.first)??new Set;J.add(K.second),F.set(K.first,J);const Y=F.get(K.second)??new Set;Y.add(K.first),F.set(K.second,Y)}const _=[],V=new Set;for(const K of R.edges){if(V.has(K))continue;const J=[K],Y=[];for(V.add(K);J.length>0;){const q=J.pop();Y.push(q);for(const h of F.get(q)??[])V.has(h)||(V.add(h),J.push(h))}Y.sort((q,h)=>(S.get(q)??0)-(S.get(h)??0)),Y.length>1&&_.push(Y)}return _},"crossingComponents"),v=l(R=>[R.start,R.end].filter(F=>!!F),"endpointIdsFor"),x=l(R=>{const F=[];for(const _ of L(R)){const V=new Set(_),K=new Set(_.flatMap(Y=>v(Y))),J=[..._];for(const Y of g)V.has(Y)||v(Y).some(q=>K.has(q))&&J.push(Y);J.sort((Y,q)=>(S.get(Y)??0)-(S.get(q)??0)),F.push(J)}return F},"pairSearchGroups"),I=l((R,F,_)=>b(R,new Map([[F,_]])),"crossingCountWithSingleReplacement"),T=l(R=>{const F=new Map;for(const _ of R.pairs)F.set(_.first,(F.get(_.first)??0)+_.count),F.set(_.second,(F.get(_.second)??0)+_.count);return F},"currentCrossingsByEdge"),A=l(R=>R.slice(1).reduce((F,_,V)=>{const K=R[V];return F+Math.abs(_.x-K.x)+Math.abs(_.y-K.y)},0),"pathLength"),P=l((R=new Map)=>g.reduce((F,_)=>F+oe(d(_,R)),0),"totalBends"),O=l((R=new Map)=>g.reduce((F,_)=>F+A(d(_,R)),0),"totalLength"),k=l((R,F,_=new Map)=>{const V=at(F);for(const K of g)if(K!==R){for(const J of V)for(const Y of at(d(K,_)))if(fe(J,Y,.5)>=Xt)return!0}return!1},"pathHasSegmentConflict"),D=l((R,F)=>{const _=[R.start,R.end].filter(V=>!!V);for(const V of at(F))if(Bt(V.a,V.b,u,_,-2))return!0;return!1},"pathHitsNode"),B=l((R,F)=>{const _=de(pt(F));at(_).length===_.length-1&&R.push(_)},"pushOrthogonalCandidate"),G=l(R=>R==="left"||R==="right","sideIsHorizontal"),j=l((R,F,_)=>{switch(F){case"left":return Math.min(R.x,_.x)-20;case"right":return Math.max(R.x,_.x)+20;case"top":return Math.min(R.y,_.y)-20;case"bottom":return Math.max(R.y,_.y)+20}},"localTrackForSameSide"),tt=l((R,F,_,V)=>{const K=_==="left"||_==="top"?-1:1,J=[j(F,_,V),p[_]];for(const Y of J)for(let q=0;q<=2;q++)B(R,ro(F,_,V,Y+K*20*q))},"addSameSideCandidates"),ft=l((R,F,_,V,K)=>{for(const J of f(_))for(const Y of f(K))B(R,[F,{x:J,y:F.y},{x:J,y:Y},{x:V.x,y:Y},V])},"addHorizontalToVerticalCandidates"),It=l((R,F,_,V,K)=>{for(const J of f(_))for(const Y of f(K))B(R,[F,{x:F.x,y:J},{x:Y,y:J},{x:Y,y:V.y},V])},"addVerticalToHorizontalCandidates"),Dt=l((R,F,_,V,K)=>{const J=[...f("top"),...f("bottom")];for(const Y of f(_))for(const q of f(K))for(const h of J)B(R,[F,{x:Y,y:F.y},{x:Y,y:h},{x:q,y:h},{x:q,y:V.y},V])},"addHorizontalPairCandidates"),_t=l((R,F,_,V,K)=>{const J=[...f("left"),...f("right")];for(const Y of f(_))for(const q of f(K))for(const h of J)B(R,[F,{x:F.x,y:Y},{x:h,y:Y},{x:h,y:q},{x:V.x,y:q},V])},"addVerticalPairCandidates"),nt=l(R=>{const F=new Set;return R.map(_=>pt(_)).filter(_=>{const V=_.map(K=>`${K.x.toFixed(3)},${K.y.toFixed(3)}`).join("|");return F.has(V)||_.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),Z=l((R,F,_,V)=>{const K=[],J=so(R,F,_,V,20,et);J&&B(K,J),F===V&&tt(K,R,F,_);const Y=G(F),q=G(V);return Y&&!q?ft(K,R,F,_,V):!Y&&q?It(K,R,F,_,V):Y?Dt(K,R,F,_,V):_t(K,R,F,_,V),nt(K)},"buildCandidatesForSides"),rt=l((R,F,_,V)=>{const K=[...f("left"),...f("right")],J=[...f("top"),...f("bottom")];for(const Y of m){const q=ve(V,Y),h=Y==="top"||Y==="bottom"?f(Y):J;for(const M of K){B(R,[F,_,{x:M,y:_.y},{x:M,y:q.y},q]);for(const E of h)B(R,[F,_,{x:M,y:_.y},{x:M,y:E},{x:q.x,y:E},q])}}},"addVerticalDepartureOuterTrackCandidates"),ut=l((R,F,_,V)=>{const K=[...f("left"),...f("right")],J=[...f("top"),...f("bottom")];for(const Y of m){const q=ve(V,Y),h=Y==="left"||Y==="right"?f(Y):K;for(const M of J){B(R,[F,_,{x:_.x,y:M},{x:q.x,y:M},q]);for(const E of h)B(R,[F,_,{x:_.x,y:M},{x:E,y:M},{x:E,y:q.y},q])}}},"addHorizontalDepartureOuterTrackCandidates"),yt=l(R=>{const F=R.start,_=R.end,V=_?c.get(_):void 0;if(!F||!V)return[];const K=pt(R.points??[]);if(K.length<4)return[];const J=K[0],Y=K[1],q=[];return Ot(J,Y,et)?rt(q,J,Y,V):Nt(J,Y,et)&&ut(q,J,Y,V),q},"terminalPreservingOuterTrackCandidates"),St=l(R=>{const F=R.start,_=R.end,V=F?c.get(F):void 0,K=_?c.get(_):void 0;if(!V||!K)return[];const J=[];for(const Y of m){const q=ve(V,Y);for(const h of m)J.push(...Z(q,Y,ve(K,h),h))}return J.push(...yt(R)),J},"candidatePathsFor"),Et=l(()=>new Map(g.map(R=>[R,at(d(R))])),"currentSegmentsByEdge"),Kt=l((R,F,_)=>{const V=new Set;for(const K of g){if(K===R)continue;const J=_.get(K)??at(d(K));F.some(Y=>J.some(q=>fe(Y,q,.5)>=Xt))&&V.add(K)}return V},"sharedTrackConflictsFor"),qt=l((R,F,_,V)=>{const K=new Set;return St(R).map(Y=>de(pt(Y))).filter(Y=>{if(D(R,Y))return!1;const q=Y.map(h=>`${h.x.toFixed(3)},${h.y.toFixed(3)}`).join("|");return K.has(q)||Y.length<2?!1:(K.add(q),!0)}).map(Y=>{const q=at(Y);let h=0;for(const M of g)M!==R&&(h+=i(q,_.get(M)??at(d(M))));return{candidate:Y,candidateSegments:q,crossings:F.count-(V.get(R)??0)+h,bends:oe(Y,et),totalBends:oe(Y),length:A(Y)}}).filter(({crossings:Y})=>Y<=F.count).sort((Y,q)=>Y.crossings-q.crossings||Y.bends-q.bends||Y.length-q.length).slice(0,48).map(Y=>({path:Y.candidate,segments:Y.candidateSegments,sharedTrackConflicts:Kt(R,Y.candidateSegments,_),totalBends:Y.totalBends,length:Y.length}))},"pairCandidatesFor"),Zt=l((R,F,_,V,K,J)=>{let Y=0;for(const h of R.pairs)(h.first===F||h.second===F||h.first===V||h.second===V)&&(Y+=h.count);let q=i(_.segments,K.segments);for(const h of g){if(h===F||h===V)continue;const M=J.get(h)??at(d(h));q+=i(_.segments,M)+i(K.segments,M)}return R.count-Y+q},"pairCrossingCount"),se=l((R,F)=>{for(const _ of R.sharedTrackConflicts)if(_!==F)return!1;return!0},"conflictsOnlyWith"),Le=l((R,F)=>R.segments.some(_=>F.segments.some(V=>fe(_,V,.5)>=Xt)),"candidatesShareTrack"),ge=l((R,F,_,V)=>se(F,_.edge)&&se(V,R.edge)&&!Le(F,V),"pairCandidatesAreCompatible"),Te=l((R,F,_,V,K)=>{const J=Zt(R.current,F.edge,_,V.edge,K,R.baseSegments);if(!(J>=R.current.count))return{replacements:new Map([[F.edge,_.path],[V.edge,K.path]]),crossings:J,bends:R.currentBends-(R.baseBendsByEdge.get(F.edge)??0)-(R.baseBendsByEdge.get(V.edge)??0)+_.totalBends+K.totalBends,length:R.currentLength-(R.baseLengthByEdge.get(F.edge)??0)-(R.baseLengthByEdge.get(V.edge)??0)+_.length+K.length}},"scorePairReplacement"),an=l((R,F)=>R.crossings<F.crossings||R.crossings===F.crossings&&(R.bends<F.bends||R.bends===F.bends&&R.length<F.length),"pairScoreIsBetter"),ln=l((R,F,_,V)=>{let K=V;for(const J of F.candidates)for(const Y of _.candidates){if(!ge(F,J,_,Y))continue;const q=Te(R,F,J,_,Y);q&&an(q,K)&&(K=q)}return K},"bestScoreForOptionPair"),fn=l(R=>{const F=P(),_=O(),V=Et(),K=T(R),J=new Map(g.map(w=>[w,oe(d(w))])),Y=new Map(g.map(w=>[w,A(d(w))])),q=new Map,h=x(R);for(const w of h)for(const N of w){if(q.has(N))continue;const H=qt(N,R,V,K);H.length>0&&q.set(N,{edge:N,candidates:H})}let M={replacements:new Map,crossings:R.count,bends:F,length:_};const E={current:R,currentBends:F,currentLength:_,baseBendsByEdge:J,baseLengthByEdge:Y,baseSegments:V};for(const w of h){const N=new Set(w.filter(W=>R.edgeSet.has(W))),H=w.map(W=>q.get(W)).filter(W=>!!W);for(let W=0;W<H.length;W++){const ot=H[W];for(let U=W+1;U<H.length;U++){const $=H[U];!N.has(ot.edge)&&!N.has($.edge)||(M=ln(E,ot,$,M))}}}return M.replacements.size>0?M.replacements:void 0},"bestPairedReplacement");for(let R=0;R<4;R++){const F=C(),_=F.count;if(_===0)return;let V,K,J=_,Y=Number.POSITIVE_INFINITY;for(const h of F.edges){const M=oe(d(h),et);for(const E of St(h)){const w=D(h,E),N=!w&&k(h,E),H=I(F,h,E),W=oe(E,et);w||N||!(H<_||H===_&&W<M)||H>J||H===J&&W>=Y||(V=h,K=E,J=H,Y=W)}}if(V&&K){V.points=K;continue}const q=fn(F);if(!q)return;for(const[h,M]of q)h.points=M}}l(is,"resolveRenderedOrthogonalCrossings");var pe=.001,xr=8;function cs(t,e){const{nodeInfoById:n,realNodeRects:o}=on(e),s=["top","bottom","left","right"],r=20,a={top:Math.min(...o.map(i=>i.rect.top))-r,bottom:Math.max(...o.map(i=>i.rect.bottom))+r,left:Math.min(...o.map(i=>i.rect.left))-r,right:Math.max(...o.map(i=>i.rect.right))+r},c=l((i,y,C,b)=>{const L=[],v=so(i,y,C,b,r,pe);return v&&L.push(v),y===b&&L.push(ro(i,y,C,a[y])),L},"buildOrthogonalPathCandidates"),u=l((i,y)=>{for(let C=0;C<i.length-1;C++){const b=i[C],L=i[C+1];if(Bt(b,L,o,y,1))return!0}return!1},"pathHitsNode"),m=l((i,y,C=!1)=>{let b=0;const L=Oe(i,pe),v=y.start,x=y.end;for(const I of t){if(I===y||I.isLayoutOnly)continue;const T=I.start,A=I.end;if(!C&&v&&x&&(T===v||T===x||A===v||A===x))continue;const P=I.points;if(!(!P||P.length<2))for(const O of L)for(const k of Oe(P,pe)){if(co(O.a,O.b,k.a,k.b,pe,pe)){b++;continue}fe(O,k,pe)>=xr&&b++}}return b},"pathConflictCount"),p=4,g=l((i,y)=>{const C=Math.abs(i.y-y.rect.top),b=Math.abs(i.y-y.rect.bottom),L=Math.abs(i.x-y.rect.left),v=Math.abs(i.x-y.rect.right);let x="top",I=C;return b<I&&(x="bottom",I=b),L<I&&(x="left",I=L),v<I&&(x="right",I=v),x},"nearestSideOfRect"),S=new Map,f=l((i,y,C)=>{const b=S.get(i)??[];b.push({side:y,edgeId:C}),S.set(i,b)},"addFaceClaim");for(const i of t){if(i.isLayoutOnly)continue;const y=i.points??[];if(y.length<1)continue;const C=i.id??"",b=i.start,L=i.end;if(b){const v=n.get(b);v&&f(b,g(y[0],v),C)}if(L){const v=n.get(L);v&&f(L,g(y[y.length-1],v),C)}}const d=l((i,y,C)=>{var b;return((b=S.get(i))==null?void 0:b.some(L=>L.edgeId!==C&&L.side===y))??!1},"faceIsClaimed");for(const i of t){if(i.isLayoutOnly)continue;const y=i.points;if(!y||y.length<2)continue;const C=oe(y,pe);if(C<p)continue;const b=i.start,L=i.end;if(!b||!L)continue;const v=n.get(b),x=n.get(L);if(!v||!x)continue;const I=i.id??"",T=m(y,i,!0),A=m(y,i);let P,O=T,k=C;for(const D of s){if(d(b,D,I))continue;const B=ve(v,D);for(const G of s){if(d(L,G,I))continue;const j=ve(x,G);for(const tt of c(B,D,j,G)){if(u(tt,[b,L]))continue;const ft=oe(tt,pe);if(T>0){const It=m(tt,i,!0);if(It>O||It===O&&ft>=k)continue;O=It,k=ft,P=tt;continue}m(tt,i)>A||ft<k&&(k=ft,P=tt)}}}if(P){i.points=P;const D=S.get(b);D&&S.set(b,D.filter(G=>G.edgeId!==I));const B=S.get(L);B&&S.set(L,B.filter(G=>G.edgeId!==I)),f(b,g(P[0],v),I),f(L,g(P[P.length-1],x),I)}}}l(cs,"simplifyDetouredEdges");var Qt=.001,wo=10,ze=7;function Xn(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const a=r.x-s.x,c=r.y-s.y;if(!(Math.abs(a)+Math.abs(c)<Qt)){if(Math.abs(c)<=Qt){const m=s.x+Math.sign(a)*wo;return{left:Math.min(s.x,m),right:Math.max(s.x,m),top:s.y-ze,bottom:s.y+ze}}if(Math.abs(a)<=Qt){const m=s.y+Math.sign(c)*wo;return{left:s.x-ze,right:s.x+ze,top:Math.min(s.y,m),bottom:Math.max(s.y,m)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}l(Xn,"markerClearanceRectFor");function as(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)}}l(as,"normalizeRect");function Yn(t,e){const n=pt(e),o=Xn(n,!0),s=Xn(n,!1);return[o,s].some(r=>r&&Ue(t,as(r)))}l(Yn,"labelOverlapsOwnMarker");function Ve(t,e){const n=[];for(const d of t){if(d.isLayoutOnly)continue;const i=d.points;if(!(!i||i.length<2))for(let y=0;y<i.length-1;y++)n.push({edgeId:d.id,p1:i[y],p2:i[y+1]})}const o=[],s=[];for(const d of e.values()){const i=d.isGroup,y=d.parentId;if(i&&!y){const b=te(d);b&&s.push({id:d.id,rect:b});continue}if(i||d.isEdgeLabel)continue;const C=te(d);C&&o.push({nodeId:d.id,rect:C})}const r=3,a=1,c=12,u=l((d,i)=>{const y=Cn(i,r);for(const{nodeId:C,rect:b}of o)if(C!==d&&Ue(y,b))return!0;return!1},"labelOverlapsForeignNode"),m=l((d,i)=>{const y=Cn(i,r);for(const C of n)if(C.edgeId!==d&&nn(C.p1,C.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),p=l((d,i,y)=>u(d,y)||m(i,y),"labelOverlapsAnything"),g=[],S=l(d=>{for(const{id:i,rect:y}of s)if(Fo(y,d))return i},"findContainingLane"),f=l((d,i)=>g.some(y=>y.labelId!==d&&Ue(i,y.rect)),"overlapsPlacedLabel");for(const d of t){if(d.isLayoutOnly)continue;const i=d.labelNodeId;if(!i)continue;const y=e.get(i);if(!y)continue;const C=d.points;if(!C||C.length<2)continue;const b=y.width??0,L=y.height??0;if(b<=0||L<=0)continue;const v=[];for(let nt=0;nt<C.length-1;nt++){const Z=C[nt],rt=C[nt+1],ut=Math.abs(Z.x-rt.x),yt=Math.abs(Z.y-rt.y);ut<Qt&&yt<Qt||ut>=Qt&&yt>=Qt||v.push({idx:nt,length:ut+yt,orientation:ut>=Qt?"horizontal":"vertical",midX:(Z.x+rt.x)/2,midY:(Z.y+rt.y)/2})}if(v.length===0)continue;const x=v.length>=3?v.filter(nt=>nt.idx>0&&nt.idx<v.length-1):v,I=x.length>0?x:v,T=b>=L?"horizontal":"vertical",A=l(nt=>[...nt].sort((Z,rt)=>{const ut=Z.orientation===T,yt=rt.orientation===T;if(ut!==yt)return ut?-1:1;const St=Z.length>=(Z.orientation==="horizontal"?b:L)+2,Et=rt.length>=(rt.orientation==="horizontal"?b:L)+2;return St!==Et?St?-1:1:rt.length-Z.length}),"rankSegments"),P=v[0],O=v[v.length-1],k=[.5,.25,.75,.05,.95,.15,.85,.1,.9],D=l((nt,Z)=>{const rt=C[nt.idx],ut=C[nt.idx+1];return{midX:rt.x+(ut.x-rt.x)*Z,midY:rt.y+(ut.y-rt.y)*Z}},"anchorAtT"),B=l((nt,Z,rt)=>Math.min(rt,Math.max(Z,nt)),"clamp"),G=l((nt,Z)=>nt.midX>=Z.left-Qt&&nt.midX<=Z.right+Qt&&nt.midY>=Z.top-Qt&&nt.midY<=Z.bottom+Qt,"pointInsideRectInclusive"),j=l(nt=>{const Z=Ne(nt.midX,nt.midY,b,L),rt=S(Z);if(rt)return{laneId:rt,anchor:nt,rect:Z};const ut=s.find(({rect:se})=>G(nt,se));if(!ut)return;const yt=ut.rect.left+b/2+a,St=ut.rect.right-b/2-a,Et=ut.rect.top+L/2+a,Kt=ut.rect.bottom-L/2-a;if(yt>St||Et>Kt)return;const qt={midX:B(nt.midX,yt,St),midY:B(nt.midY,Et,Kt)},Zt=Ne(qt.midX,qt.midY,b,L);return G(nt,Zt)?{laneId:ut.id,anchor:qt,rect:Zt}:void 0},"placementForAnchor"),tt=l((nt,Z,rt)=>nt.orientation==="horizontal"?Math.abs(Z.midX-rt.x):Math.abs(Z.midY-rt.y),"distanceAlongSegment"),ft=l((nt,Z)=>{const ut=(nt.orientation==="horizontal"?b/2:L/2)+c;if(nt===P){const yt=C[nt.idx];if(tt(nt,Z,yt)+Qt<ut)return!1}if(nt===O){const yt=C[nt.idx+1];if(tt(nt,Z,yt)+Qt<ut)return!1}return!0},"labelClearsTerminalEndpoints"),It=l(nt=>{const Z=A(nt);for(const rt of Z)for(const ut of k){const yt=D(rt,ut);if(!ft(rt,yt))continue;const St=j(yt);if(St&&!Yn(St.rect,C)&&!f(i,St.rect)&&!p(i,d.id,St.rect))return{laneId:St.laneId,anchor:St.anchor}}},"tryPool"),Dt=l((nt,Z,rt=!1)=>{const ut=A(nt);for(const yt of ut){const St={midX:yt.midX,midY:yt.midY};if(Z&&!ft(yt,St))continue;const Et=j(St);if(Et&&!Yn(Et.rect,C)&&!f(i,Et.rect)&&!u(i,Et.rect)&&(rt||!m(d.id,Et.rect)))return{laneId:Et.laneId,anchor:Et.anchor}}},"findLaneContainingFallback"),_t=It(I)??(I.length<v.length?It(v):void 0)??Dt(v,!0)??Dt(v,!1)??Dt(v,!1,!0);if(_t){y.x=_t.anchor.midX,y.y=_t.anchor.midY,y.parentId=_t.laneId;const nt=Ne(_t.anchor.midX,_t.anchor.midY,b,L),Z=g.findIndex(rt=>rt.labelId===i);Z>=0?g[Z]={labelId:i,rect:nt}:g.push({labelId:i,rect:nt})}}}l(Ve,"anchorLabelsToPolyline");var bn=1e-6,yr=8,Eo=yr/2,pr=3;function Gn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}l(Gn,"pairKey");function ls(t,e){const{nodeInfoById:n,realNodeRects:o}=on(e),s=new Map;for(const a of e){const c=a.id;if(!a.isGroup&&a.isEdgeLabel){s.set(c,{w:a.width??0,h:a.height??0});continue}}const r=l((a,c,u,m)=>{const p=Gn(c,u);let g=0;const S=l(f=>{if(!f)return;const d=s.get(f);if(!d)return;const i=m==="x"?d.w/2:d.h/2;i>g&&(g=i)},"consider");S(a.labelNodeId);for(const f of t){if(f===a||f.isLayoutOnly)continue;const d=f.start,i=f.end;!d||!i||Gn(d,i)===p&&S(f.labelNodeId)}return g>0?g+pr:0},"labelClearanceFor");for(const a of t){if(a.isLayoutOnly)continue;const c=a.points;if(!no(c,bn))continue;const u=io(a,n,bn);if(!u)continue;const{srcId:m,dstId:p,srcInfo:g,dstInfo:S,collinearX:f,collinearY:d}=u;if(f===d)continue;let i,y;if(f){const x=S.cy>g.cy;i={x:g.cx,y:x?g.rect.bottom:g.rect.top},y={x:S.cx,y:x?S.rect.top:S.rect.bottom}}else{const x=S.cx>g.cx;i={x:x?g.rect.right:g.rect.left,y:g.cy},y={x:x?S.rect.left:S.rect.right,y:S.cy}}if(Bt(i,y,o,[m,p],1))continue;const b=r(a,m,p,f?"x":"y"),L=b>Eo?b:Eo,v=[0,L,-L];for(const x of v){const I={...i},T={...y};if(f){if(I.x+=x,T.x+=x,I.x<=g.rect.left||I.x>=g.rect.right||T.x<=S.rect.left||T.x>=S.rect.right)continue}else if(I.y+=x,T.y+=x,I.y<=g.rect.top||I.y>=g.rect.bottom||T.y<=S.rect.top||T.y>=S.rect.bottom)continue;if(!Bt(I,T,o,[m,p],1)&&!We(I,T,t,a,{epsilon:bn})){a.points=[I,T];break}}}}l(ls,"straightenCollinearSiblingDetours");function zn(t,e){const{realNodeRects:u,labelNodeRects:m}=be(e.values()),p=l((x,I)=>Oe(I,.001).map(T=>({...T,edge:x,interior:T.index>=1&&T.index<=I.length-3})),"segmentsFor"),g=l(()=>{const x=[];for(const I of t){if(I.isLayoutOnly)continue;const T=I.points;!T||T.length<2||x.push(...p(I,pt(T)))}return x},"allSegments"),S=l((x,I)=>x.horizontal&&I.horizontal?Wt(x.a.x,x.b.x,I.a.x,I.b.x)>=8&&Math.abs(x.a.y-I.a.y)<7:x.vertical&&I.vertical?Wt(x.a.y,x.b.y,I.a.y,I.b.y)>=8&&Math.abs(x.a.x-I.a.x)<7:!1,"hasCrowdedParallelTrack"),f=l((x,I)=>{const T=x.start,A=x.end,P=p(x,I);if(P.length!==I.length-1)return!1;const O=[T,A].filter(D=>!!D),k=x.labelNodeId?[x.labelNodeId]:[];for(const D of P)if(Bt(D.a,D.b,u,O,-2)||Bt(D.a,D.b,m,k,-2))return!1;for(const D of t){if(D===x||D.isLayoutOnly)continue;const B=D.points;if(!(!B||B.length<2)){for(const G of P)for(const j of p(D,pt(B)))if(S(G,j)||ue(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),d=l((x,I)=>{const T=pt(x.edge.points??[]);if(T.length<4||x.index>=T.length-1)return;const A=T.map(P=>({...P}));if(x.horizontal)A[x.index].y+=I,A[x.index+1].y+=I;else if(x.vertical)A[x.index].x+=I,A[x.index+1].x+=I;else return;return p(x.edge,A).length===A.length-1?A:void 0},"shiftedCandidate"),i=l((x,I)=>({x:x.x??(I.left+I.right)/2,y:x.y??(I.top+I.bottom)/2}),"nodeCenter"),y=l(x=>{const I=x.edge,T=pt(I.points??[]);if(T.length!==4||x.index!==1)return;const A=I.start?e.get(I.start):void 0,P=I.end?e.get(I.end):void 0,O=A?te(A):void 0,k=P?te(P):void 0,D=T.slice(x.index+2);if(!(!A||!P||!O||!k||D.length===0))return{sourceCenter:i(A,O),targetCenter:i(P,k),sourceRect:O,tail:D}},"sourceDetourContextFor"),C=l((x,I,T,A,P,O)=>{const k=A.y>=T.y,D=k?P.bottom:P.top,B=D+(k?20:-20);if(k&&x.b.y<=B+.001||!k&&x.b.y>=B-.001)return;const G=x.a.x+I;return pt([{x:T.x,y:D},{x:T.x,y:B},{x:G,y:B},{x:G,y:x.b.y},...O],.001)},"verticalSourceDetour"),b=l((x,I,T,A,P,O)=>{const k=A.x>=T.x,D=k?P.right:P.left,B=D+(k?20:-20);if(k&&x.b.x<=B+.001||!k&&x.b.x>=B-.001)return;const G=x.a.y+I;return pt([{x:D,y:T.y},{x:B,y:T.y},{x:B,y:G},{x:x.b.x,y:G},...O],.001)},"horizontalSourceDetour"),L=l((x,I)=>{const T=y(x);if(T){if(x.vertical)return C(x,I,T.sourceCenter,T.targetCenter,T.sourceRect,T.tail);if(x.horizontal)return b(x,I,T.sourceCenter,T.targetCenter,T.sourceRect,T.tail)}},"sourceDetourCandidate"),v=[-7,7,-2*7,2*7,-3*7,3*7];for(let x=0;x<12;x++){const I=g();let T=!1;for(let A=0;A<I.length&&!T;A++)for(let P=A+1;P<I.length&&!T;P++){const O=I[A],k=I[P];if(O.edge===k.edge||!S(O,k))continue;const D=[O,k].filter(B=>B.interior);for(const B of D){for(const G of v){const j=d(B,G);if(j&&f(B.edge,j)){B.edge.points=j,T=!0;break}const tt=L(B,G);if(tt&&f(B.edge,tt)){B.edge.points=tt,T=!0;break}}if(T)break}}if(!T)return}}l(zn,"nudgeSharedInteriorSubpaths");function fs(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,a=o.x-n.x,c=o.y-n.y,u=s*c-r*a;if(Math.abs(u)<1e-10)return!1;const m=n.x-t.x,p=n.y-t.y,g=(m*c-p*a)/u,S=(m*r-p*s)/u,f=.01;return g>f&&g<1-f&&S>f&&S<1-f}l(fs,"segmentsIntersect");function ds(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=_o(e),r=[];for(const c of n){if(c.isLayoutOnly)continue;const u=c.points;if(!u||u.length<2)continue;const m=c.start,p=c.end,g=c.labelNodeId,S=c.id??`${m}->${p}`;for(const f of s)if(!(f.nodeId===m||f.nodeId===p)&&!(g&&f.nodeId===g)){for(let d=0;d<u.length-1;d++)if(nn(u[d],u[d+1],f,-1)){o.push({type:"edge-node-overlap",edgeId:S,targetId:f.nodeId,detail:`segment ${d} passes through node "${f.nodeId}"`});break}}for(let f=0;f<u.length-1;f++)r.push({edgeId:S,start:m,end:p,p1:u[f],p2:u[f+1]})}const a=new Set;for(let c=0;c<r.length;c++)for(let u=c+1;u<r.length;u++){const m=r[c],p=r[u];if(m.edgeId!==p.edgeId&&!(m.start===p.start||m.start===p.end||m.end===p.start||m.end===p.end)&&fs(m.p1,m.p2,p.p1,p.p2)){const g=m.edgeId<p.edgeId?`${m.edgeId}|${p.edgeId}`:`${p.edgeId}|${m.edgeId}`;a.has(g)||(a.add(g),o.push({type:"edge-edge-crossing",edgeId:m.edgeId,targetId:p.edgeId,detail:`edges "${m.edgeId}" and "${p.edgeId}" cross`}))}}if(o.length>0){const c=o.filter(m=>m.type==="edge-node-overlap").length,u=o.filter(m=>m.type==="edge-edge-crossing").length;Mn.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${u} edge crossing(s)`);for(const m of o)Mn.warn(`[SWIMLANE_VALIDATE] ${m.type}: ${m.detail}`)}return o}l(ds,"validateSwimlanesLayout");function us(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!Jo(t,e)||e==="BT"&&s.length>0&&!Zo(t))return;for(const c of o){if(c.isLayoutOnly)continue;const u=c.points;!u||u.length<2||(c.points=de(Ke(u)))}cs(o,n),ls(o,n),Qo(o,n);const r=new Map;for(const c of n)r.set(String(c.id),c);Ve(o,r),Go(o,r),ts(o,r),zn(o,r),Fn(o,r),ns(o,r),_n(o,r),os(o,r);const a=l(()=>{is(o,r),Fn(o,r),ss(o,r),rs(o,r),Ve(o,r),Pn(o,r),_n(o,r),Ve(o,r),Pn(o,r)},"finalizeRenderedEdges");a(),zn(o,r),a(),Hn(o,r,e),Dn(o,r,e),Hn(o,r,e),Dn(o,r,e)}l(us,"postProcessSwimlaneLayout");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 a=`${r.id}:${r.src}->${r.dst}`;n.has(a)||(n.add(a),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}l(Ie,"normalizeGraph");function ho(t,e){return t.edges.filter(n=>n.dst===e)}l(ho,"incoming");function hs(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}l(hs,"buildSuccessorMap");function go(t){const e=hs(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}l(go,"buildSortedSuccessorMap");function sn(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}l(sn,"buildInDegreeMap");function mo(t,e){const n=[...e.entries()].filter(([,c])=>c===0).map(([c])=>c).sort((c,u)=>c.localeCompare(u)),o=new Set(t.edges.flatMap(c=>[c.src,c.dst])),s=l(c=>{var u;return!o.has(c)&&!((u=t.nodeById.get(c))!=null&&u.isGroup)},"isUnconnected"),r=[...e.keys()].filter(c=>e.get(c)===0&&s(c));let a=0;return n.map(c=>s(c)?r[a++]:c)}l(mo,"sortedZeroInDegreeNodes");function rn(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}l(rn,"buildPredecessorSuccessorMaps");function xo(t,e,n,o){var a,c;let s=0;for(const u of t.nodes)o!=null&&o.skipGroups&&((a=t.nodeById.get(u))!=null&&a.isGroup)||(s=Math.max(s,n[u]??0));const r=Array.from({length:s+1},()=>[]);for(const u of e)o!=null&&o.skipGroups&&((c=t.nodeById.get(u))!=null&&c.isGroup)||r[Math.max(0,n[u]??0)].push(u);return r}l(xo,"buildLayersFromRanks");function ke(t){const e=sn(t),n=mo(t,e),o=[],s=go(t);for(;n.length;){const r=n.shift();o.push(r);for(const a of s.get(r)??[])if(e.set(a,(e.get(a)??0)-1),(e.get(a)??0)===0){let c=0;for(;c<n.length&&n[c]<a;)c++;n.splice(c,0,a)}}return o.length===t.nodes.length?o:null}l(ke,"topoSortIfAcyclic");function Be(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}l(Be,"buildLayerIndex");function yo(t){const e=new Array(t.length),n=l((o,s)=>{if(s-o<=1)return 0;const r=o+s>>1;let a=n(o,r)+n(r,s),c=o,u=r,m=o;for(;c<r||u<s;)u>=s||c<r&&t[c]<=t[u]?e[m++]=t[c++]:(e[m++]=t[u++],a+=r-c);for(let p=o;p<s;p++)t[p]=e[p];return a},"count");return n(0,t.length)}l(yo,"countInversions");function gs(t){const e=Ie(t),n=new Map;for(const g of e.nodes)n.set(g,[]);for(const g of e.edges)n.get(g.src).push(g);for(const g of n.values())g.sort((S,f)=>S.dst===f.dst?S.id.localeCompare(f.id):S.dst.localeCompare(f.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=l(g=>{o[g]=1;for(const S of n.get(g)??[]){const f=S.dst;o[f]===0?r(f):o[f]===1&&s.push(S)}o[g]=2},"dfs"),a=sn(e),c=[...e.nodes.filter(g=>(a.get(g)??0)===0),...e.nodes.filter(g=>(a.get(g)??0)!==0)];for(const g of c)o[g]===0&&r(g);const u=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),m=e.edges.map(g=>u.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:m,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}l(gs,"removeCycles_DFS");function ms(t){const e=new Map,n=l(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const c=n(r)??r;return e.set(o,c),c},"resolve");for(const o of t.nodes)n(o);return e}l(ms,"buildTopLaneMap");function he(t){const e=ms(t);return n=>e.get(n)??null}l(he,"createTopLaneResolver");function cn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}l(cn,"buildTopLaneOrder");function po(t,e){const n=cn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const a of e)!o.has(a)||s.has(a)||(s.add(a),r.push(a));for(const a of n)s.has(a)||r.push(a);return r}l(po,"resolveTopLaneOrder");var br={EPSILON:1e-6},tn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Ao={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function xs(t,e){const n=Ie(t),o=(e==null?void 0:e.laneOf)??(()=>null),s=e==null?void 0:e.rankHint,{preds:r}=rn(n);for(const x of r.values())x.sort((I,T)=>I.localeCompare(T));const a=ke(n)??[...n.nodes].sort((x,I)=>x.localeCompare(I)),c=new Map;for(const[x,I]of a.entries())c.set(I,x);const u=new Map,m=new Map;for(const x of n.nodes)m.set(x,[]);for(const x of a){const I=(r.get(x)??[]).filter(T=>u.has(T));if(I.length>0){const T=ys(x,I,{laneOf:o,rankHint:s,topoIndex:c});u.set(x,T),m.get(T).push(x)}else u.has(x)||u.set(x,null)}for(const x of n.nodes)u.has(x)||u.set(x,null);const p=new Set;for(const x of n.nodes)(u.get(x)??null)===null&&p.add(x);const g=[...p].sort((x,I)=>{const T=c.get(x)??0,A=c.get(I)??0;return T===A?x.localeCompare(I):T-A}),S=ps(n),f=new Map;for(const[x,I]of S.entries())f.set(x,[...I].sort((T,A)=>T.localeCompare(A)));const d=bs(f),i=Is(f),y=new Map;for(const x of n.nodes)y.set(x,[]);for(const x of i)for(const I of x.nodes){const T=y.get(I);T?T.push(x.id):y.set(I,[x.id])}const C=[],b=[],L=new Set,v=l(x=>{if(!L.has(x)){L.add(x),C.push(x);for(const I of m.get(x)??[])v(I);b.push(x)}},"walk");for(const x of g)v(x);for(const x of a)v(x);return{parent:u,children:m,roots:g,componentOf:d,blocks:i,nodeBlocks:y,adjacency:f,preorder:C,postorder:b,topologicalOrder:a}}l(xs,"buildDrivingTree");function ys(t,e,n){const o=n.laneOf(t);return[...e].sort((r,a)=>{var i,y;const c=n.laneOf(r),u=n.laneOf(a),m=c!=null&&c===o,p=u!=null&&u===o;if(m!==p)return m?-1:1;const g=(i=n.rankHint)==null?void 0:i[r],S=(y=n.rankHint)==null?void 0:y[a];if(g!=null&&S!=null&&g!==S)return S-g;const f=n.topoIndex.get(r)??0,d=n.topoIndex.get(a)??0;return f!==d?f-d:r.localeCompare(a)})[0]}l(ys,"chooseParent");function ps(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}l(ps,"buildAdjacency");function bs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const a of t.get(r)??[])e.has(a)||s.push(a)}}n++}return e}l(bs,"assignComponents");function Is(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const a=l((c,u)=>{e.set(c,++r),n.set(c,r);for(const m of t.get(c)??[])m!==u&&(e.has(m)?(e.get(m)??0)<(e.get(c)??0)&&(o.push([c,m]),n.set(c,Math.min(n.get(c)??r,e.get(m)??r))):(o.push([c,m]),a(m,c),n.set(c,Math.min(n.get(c)??r,n.get(m)??r)),(n.get(m)??0)>=(e.get(c)??0)&&s.push(Ms(c,m,o,s.length))))},"visit");for(const c of t.keys())e.has(c)||a(c,null);return s}l(Is,"computeBlocks");function Ms(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const a=n.pop();if(s.push(a),r.add(a[0]),r.add(a[1]),a[0]===t&&a[1]===e||a[0]===e&&a[1]===t)break}return{id:o,edges:s,nodes:[...r]}}l(Ms,"popBlock");function Ss(t,e,n){const o=[...t.nodes],s=new Map;for(const[b,L]of o.entries())s.set(L,b);const r=o.length,a=new Array(r).fill(-1),c=new Array(r).fill(0),u=[],m=new Set;for(const b of o){const L=n.parent.get(b)??null,v=s.get(b);v!=null&&L==null&&(a[v]=-1,c[v]=0,m.has(b)||(m.add(b),u.push(b)))}for(;u.length>0;){const b=u.shift(),L=s.get(b);if(L==null)continue;const v=n.children.get(b)??[];for(const x of v){if(m.has(x))continue;const I=s.get(x);I!=null&&(a[I]=L,c[I]=c[L]+1,m.add(x),u.push(x))}}for(const b of o){if(m.has(b))continue;const L=s.get(b);L!=null&&(a[L]=-1,c[L]=0,m.add(b))}const p=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),g=Array.from({length:p},()=>new Array(r).fill(-1));for(let b=0;b<r;b++)g[0][b]=a[b];for(let b=1;b<p;b++)for(let L=0;L<r;L++){const v=g[b-1][L];g[b][L]=v===-1?-1:g[b-1][v]}const S=l((b,L)=>{if(b===-1||L===-1)return-1;c[b]<c[L]&&([b,L]=[L,b]);const v=c[b]-c[L];for(let x=0;x<p;x++)if(v>>x&1&&(b=g[x][b],b===-1))return-1;if(b===L)return b;for(let x=p-1;x>=0;x--){const I=g[x][b],T=g[x][L];I===-1||T===-1||I!==T&&(b=I,L=T)}return g[0][b]},"lcaIndex"),f=Array.from({length:r},()=>new Map);for(const b of t.edges){let L=b.src,v=b.dst,x=e[L],I=e[v];if(x==null||I==null||(x>I&&([L,v]=[v,L],[x,I]=[I,x]),x==null||I==null||x===I))continue;const T=s.get(L),A=s.get(v);if(T==null||A==null)continue;const P=S(T,A);if(P===-1)continue;const O=f[P];for(let k=x;k<I;k++)O.set(k,(O.get(k)??0)+1)}const d=new Map,i=l((b,L)=>{if(L.size!==0)for(const[v,x]of L)b.set(v,(b.get(v)??0)+x)},"mergeInto"),y=new Set,C=l(b=>{const L=s.get(b);y.add(b);const v=L==null?void 0:f[L],x=v?new Map(v):new Map,I=n.children.get(b)??[];for(const T of I){const A=C(T),P=e[b];if(P!=null){let O=d.get(b);O||(O=new Map,d.set(b,O));let k=A.get(P)??0;const D=e[T];D!=null&&D>P&&(k+=1),O.set(T,k)}i(x,A)}return x},"dfs");for(const b of n.roots)y.has(b)||C(b);for(const b of o)y.has(b)||C(b);return d}l(Ss,"computeSubtreeCrossCounts");function Cs(t,e,n){const o=new Map,s=l(r=>{let a=n[r]??0;const c=[...e.get(r)??[]];c.sort(bo(n));for(const u of c){s(u);const m=o.get(u);m!=null&&(a=Math.min(a,m))}o.set(r,a)},"annotate");for(const r of t)s(r);return o}l(Cs,"annotateMinimumLayers");function bo(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}l(bo,"compareByRankThenId");function vs(t,e,n,o){let s=0;for(const u of e){const m=n[u]??0;m>s&&(s=m)}const r=Array.from({length:s+1},()=>[]),a=new Set,c=l(u=>{if(a.has(u))return;a.add(u);const m=n[u]??0;r[m]||(r[m]=[]),r[m].push(u);for(const p of o(u))c(p)},"emit");for(const u of t)c(u);for(const u of e)if(!a.has(u)){const m=n[u]??0;r[m]||(r[m]=[]),r[m].push(u),a.add(u)}return r}l(vs,"emitNodesInTreeOrder");function Ls(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}l(Ls,"deduplicateLayers");function Ts(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const a=e[s]??0,c=[],u=[],m=n.get(s);for(const p of r){const g=o.get(p)??a;g>a?c.push({child:p,min:g}):u.push(p)}return c.sort((p,g)=>p.min===g.min?p.child.localeCompare(g.child):p.min-g.min),u.sort((p,g)=>{const S=(m==null?void 0:m.get(p))??0,f=(m==null?void 0:m.get(g))??0;if(S!==f)return S-f;const d=o.get(p)??a,i=o.get(g)??a;return d!==i?d-i:p.localeCompare(g)}),[...c.map(p=>p.child),...u]}}l(Ts,"createChildOrderer");function en(t,e,n){const o=xs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const g of t.nodes)s.has(g)||s.set(g,[]);const a=Ss(t,e,o),c=[...r].sort(bo(e)),u=Cs(c,s,e),m=Ts(s,e,a,u);let p=vs(c,t.nodes,e,m);return p=Ls(p),p}l(en,"buildMultitreeLayerOrder");function ws(t,e,n){const o=new Set(t),s=new Set(e),r=Be(e),a=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&a.push(r.get(c.dst));return yo(a)}l(ws,"countCrossingsBetweenAdjacent");function $n(t,e,n){const o=[];for(const r of e){const a=n[r.src],c=n[r.dst];if(a==null||c==null||a===c)continue;let u=r.src,m=r.dst,p=a,g=c;a>c&&(u=r.dst,m=r.src,p=c,g=a);for(let S=p;S<g;S++)o.push({id:`${r.id}@${S}`,src:u,dst:m,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=ws(t[r],t[r+1],o);return s}l($n,"totalCrossings");function Es(t,e){const n={...e},{preds:o}=rn(t),s=he(t),r=en(t,n,s);let a=$n(r,t.edges,n);const c=tn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let u=0;u<c;u++){let m=!1;const p=[...t.nodes].sort((g,S)=>(n[S]??0)-(n[g]??0));for(const g of p){const S=n[g]??0;if(S===0)continue;let f=0;for(const C of o.get(g)??[])f=Math.max(f,(n[C]??0)+1);if(f>=S)continue;const d=S;n[g]=f;const i=en(t,n,s),y=$n(i,t.edges,n);y<a?(a=y,m=!0):n[g]=d}if(!m)break}return n}l(Es,"optimizeRanksByCrossings");function As(t,e){const n=he(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const a=t.edges.filter(i=>i.src===s);if(a.length===0)continue;let c=!1,u=0;for(const i of a){const y=n(i.dst);y==null||y===r?c=!0:u++}if(u===0||c)continue;let m=0,p=!1;for(const i of t.edges){if(i.dst!==s)continue;const y=n(i.src);y&&(y===r?p=!0:m++)}if(m>0||!p)continue;const g=e[s]??0,S=g+u;let f=0;for(const i of t.edges)i.dst===s&&(f=Math.max(f,(e[i.src]??0)+1));const d=Math.max(g,f,S);d!==g&&(e[s]=d)}}l(As,"adjustCrossLaneSources");function Rs(t,e){const n=Ie(t),o=ke(n)??[...n.nodes].sort(),s=(e==null?void 0:e.compactSingleInput)??!1,r=he(n);let a=Object.create(null);for(const u of o){const m=ho(n,u),p=e!=null&&e.ignoreCrossLaneEdges?m.filter(g=>{const S=r(g.src),f=r(u);return!S||!f?!0:S===f}):m;if(p.length===0)a[u]=0;else if(s&&p.length===1){const g=p[0].src,S=r(g),f=r(u);S!==f?a[u]=a[g]??0:a[u]=(a[g]??0)+1}else{let g=-1/0;for(const S of p)g=Math.max(g,(a[S.src]??0)+1);a[u]=g===-1/0?0:g}}return((e==null?void 0:e.optimizeRanksByCrossings)??!1)&&(a=Es(n,a)),e!=null&&e.ignoreCrossLaneEdges&&As(n,a),{layers:en(n,a,r),rankOf:a,dummy:new Set}}l(Rs,"assignLayers_LongestPath");function Ns(t,e){const n=Ie(t),s={...Rs(n,{compactSingleInput:e==null?void 0:e.compactSingleInput,ignoreCrossLaneEdges:e==null?void 0:e.ignoreCrossLaneEdges,optimizeRanksByCrossings:e==null?void 0:e.optimizeRanksByCrossings}).rankOf},r=he(n),{preds:a,succs:c}=rn(n,d=>{if(e!=null&&e.ignoreCrossLaneEdges){const i=r(d.src),y=r(d.dst);if(i&&y&&i!==y)return!1}return!0}),u=ke(n)??[...n.nodes],m=[...u].reverse(),p=l((d,i)=>{let y=0;for(const L of a.get(d)??[])y=Math.max(y,(s[L]??0)+1);let C=Number.POSITIVE_INFINITY;const b=c.get(d)??[];return b.length>0&&(C=Math.min(...b.map(L=>(s[L]??0)-1))),Number.isFinite(C)||(C=Math.max(y,i)),Math.min(Math.max(i,y),C)},"clampFeasible"),g=tn.GRAVITY_ITERATIONS,S=l(d=>{let i=!1;for(const y of d){const C=a.get(y)??[],b=c.get(y)??[];if(C.length===0&&b.length===0)continue;const L=C.length>0?C.reduce((T,A)=>T+(s[A]??0)+1,0)/C.length:s[y]??0,v=b.length>0?b.reduce((T,A)=>T+(s[A]??0)-1,0)/b.length:s[y]??0,x=Math.round((L+v)/2),I=p(y,x);I!==s[y]&&(s[y]=I,i=!0)}return i},"relaxOrder");for(let d=0;d<g;d++){const i=S(u),y=S(m);if(!i&&!y)break}for(const d of u){let i=0;for(const y of a.get(d)??[])i=Math.max(i,(s[y]??0)+1);(s[d]??0)<i&&(s[d]=i)}for(const d of m){const i=c.get(d)??[];if(i.length>0){const y=Math.min(...i.map(C=>(s[C]??0)-1));(s[d]??0)>y&&(s[d]=y)}}return{layers:xo(n,u,s),rankOf:s,dummy:new Set}}l(Ns,"assignLayers_Gravity");function Os(t){const e=sn(t),n=go(t);let o=mo(t,e);const s=[];for(;o.length>0;){const r=[];for(const a of o){s.push(a);for(const c of n.get(a)??[])e.set(c,(e.get(c)??0)-1),(e.get(c)??0)===0&&r.push(c)}o=r.sort((a,c)=>a.localeCompare(c))}return s.length===t.nodes.length?s:null}l(Os,"topoSortByGenerationIfAcyclic");function Bs(t,e){const n=Ie(t),o=(e==null?void 0:e.direction)==="LR"?Os(n)??[...n.nodes].sort():ke(n)??[...n.nodes].sort(),s=he(n),r=l(p=>s(p)??p,"laneOf"),a=Object.create(null),c=new Map,u=l((p,g)=>(e==null?void 0:e.ignoreCrossLaneEdges)??!0?r(p)===r(g)?1:0:1,"edgeWeight");for(const p of o){const g=n.nodeById.get(p);if(g!=null&&g.isGroup)continue;const S=ho(n,p);let f=0;if(S.length>0)for(const C of S){const b=C.src,L=a[b]??0;f=Math.max(f,L+u(b,p))}const d=r(p),i=c.get(d)??0,y=Math.max(f,i);a[p]=y,c.set(d,y+1)}return{layers:xo(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}l(Bs,"assignLayers_LaneAwareCompact");function Ps(t,e){const n=Ie(e),{rankOf:o}=t,s=t.layers.map(f=>[...f]),r=new Set(t.dummy?[...t.dummy]:[]);let a=0;const c=new Map(n.nodeById),u=l(f=>{const d=`placeholder-${a++}`,i={id:d,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(d,i),r.add(d);s.length<=f;)s.push([]);return s[f].push(d),o[d]=f,d},"addDummyAt"),m=[...n.edges].sort((f,d)=>f.id===d.id?f.src===d.src?f.dst.localeCompare(d.dst):f.src.localeCompare(d.src):f.id.localeCompare(d.id)),p=[];for(const f of m){const d=o[f.src]??0,i=o[f.dst]??0;if(i-d<=1){p.push(f);continue}let y=f.src;for(let b=d+1,L=0;b<i;b++,L++){const v=u(b);p.push({id:`${f.id}#${L}`,src:y,dst:v,weight:f.weight,ref:f.ref}),y=v}const C=i-d-2;p.push({id:`${f.id}#${Math.max(C+1,0)}`,src:y,dst:f.dst,weight:f.weight,ref:f.ref})}const S={nodes:[...n.nodes,...[...r].filter(f=>!n.nodes.includes(f))],edges:p,layout:n.layout,nodeById:c};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:S}}l(Ps,"makeProperLayering");function Vn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}l(Vn,"median");function jn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}l(jn,"barycenter");function ks(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}l(ks,"neighborPositionsFor");function Fs(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}l(Fs,"currentOrderTieBreak");function Un(t,e,n){const o=new Set(t),s=new Set(e),r=Be(t),a=Be(e),c=[];for(const m of n)o.has(m.src)&&s.has(m.dst)&&c.push({u:r.get(m.src),v:a.get(m.dst)});c.sort((m,p)=>m.u===p.u?m.v-p.v:m.u-p.u);const u=c.map(m=>m.v);return yo(u)}l(Un,"countCrossingsBetweenAdjacent");function je(t,e,n){return[...t].sort((o,s)=>{const r=Vn(e.get(o)??[]),a=Vn(e.get(s)??[]);return r===a?Fs(o,s,n):isFinite(r)?isFinite(a)?r-a:-1:1})}l(je,"sortByHeuristic");function Wn(t,e,n,o,s,r){const a=Be(t),c=Be(e),u=ks(e,a,n,o);if(!s||!r||r.length===0)return je(e,u,c);const m=new Map;for(const S of e){const f=s(S),d=m.get(f)??[];d.push(S),m.set(f,d)}const p=[];for(const S of r){const f=m.get(S);if(!f||f.length===0)continue;const d=je(f,u,c);p.push(...d)}const g=m.get(null);if(g&&g.length>0){const S=je(g,u,c);for(const f of S){const d=jn(u.get(f)??[]);let i=p.length;if(isFinite(d))for(const[y,C]of p.entries()){const b=jn(u.get(C)??[]);if(d<b){i=y;break}}p.splice(i,0,f)}}return p}l(Wn,"reorderLayer");function Kn(t,e,n,o,s){const r=[...e],a=new Set(t),c=new Set(e),u=o?new Set(o):null,m=n.filter(i=>a.has(i.src)&&c.has(i.dst)),p=u?n.filter(i=>c.has(i.src)&&u.has(i.dst)):void 0,g=l(i=>{let y=Un(t,i,m);return p&&o&&(y+=Un(i,o,p)),y},"crossingScore"),S=s?new Map:null;if(s&&S)for(const i of e)S.set(i,s(i));let f=!0,d=g(r);for(;f;){f=!1;for(let i=0;i+1<r.length;i++){if(S){const b=S.get(r[i]),L=S.get(r[i+1]);if(b!==L)continue}const y=d;[r[i],r[i+1]]=[r[i+1],r[i]];const C=g(r);C<y?(d=C,f=!0):[r[i],r[i+1]]=[r[i+1],r[i]]}}return r}l(Kn,"transposeImprove");function _s(t,e,n){const o=t.layers.map(c=>[...c]),s=e.edges,r=he(e),a=po(e,n==null?void 0:n.laneOrder);for(let c=0;c<3;c++){for(let u=1;u<o.length;u++)o[u]=Wn(o[u-1],o[u],s,"down",r,a),o[u]=Kn(o[u-1],o[u],s,o[u+1],r);for(let u=o.length-2;u>=0;u--)o[u]=Wn(o[u+1],o[u],s,"up",r,a),o[u]=Kn(o[u+1],o[u],s,o[u-1],r)}return{layers:o}}l(_s,"orderLayers");function Hs(t,e,n){const o=(n==null?void 0:n.layerGap)??Ao.DEFAULT_LAYER_GAP,s=(n==null?void 0:n.nodeGap)??Ao.DEFAULT_NODE_GAP,r=(n==null?void 0:n.laneGap)??s*2,a=(n==null?void 0:n.direction)??"TB",c=a==="LR"||a==="RL",u=t.layers,m=Object.create(null),p=Object.create(null),g=l(O=>e.nodeById.get(O),"getNode"),S=l(O=>{var k;return((k=g(O))==null?void 0:k.width)??0},"getWidth"),f=l(O=>{var k;return((k=g(O))==null?void 0:k.height)??0},"getHeight"),d=he(e),i=po(e,n==null?void 0:n.laneOrder),y=u.map(O=>O.reduce((k,D)=>Math.max(k,f(D)),0)),C=[];if(c)for(let O=0;O+1<u.length;O++){const k=u[O].reduce((It,Dt)=>Math.max(It,S(Dt)),0),D=u[O+1].reduce((It,Dt)=>Math.max(It,S(Dt)),0),B=y[O],G=y[O+1],j=B/2+G/2,tt=(k+D)/2,ft=Math.max(0,tt-j-o);C.push(ft)}const b=new Set;for(const O of u)for(const k of O)b.add(d(k));const L=b.has(null),v=i.filter(O=>b.has(O)),x=[...L?[null]:[],...v],I=Object.create(null);for(const O of v)I[O]=0;L&&(I.null=0);for(const O of u){const k=Object.create(null),D=[];for(const B of O){const G=d(B);G===null?D.push(B):(k[G]||(k[G]=[])).push(B)}for(const[B,G]of Object.entries(k)){const j=G.reduce((tt,ft)=>tt+S(ft),0)+s*Math.max(0,G.length-1);I[B]=Math.max(I[B]??0,j)}if(L&&D.length){const B=D.reduce((G,j)=>G+S(j),0)+s*Math.max(0,D.length-1);I.null=Math.max(I.null??0,B)}}const T=new Map;{const O=x.map(B=>(B===null?I.null:I[B])??0);let D=-(O.reduce((B,G)=>B+G,0)+r*Math.max(0,x.length-1))/2;for(let B=0;B<x.length;B++){const G=x[B],j=O[B]??0,tt=D+j/2;T.set(G,tt),D+=j,B<x.length-1&&(D+=r)}}let A=0;for(const[O,k]of u.entries()){const D=y[O]??0,B=new Map;for(const j of k){const tt=d(j),ft=B.get(tt)??[];ft.push(j),B.set(tt,ft)}for(const j of x){const tt=B.get(j)??[];if(tt.length===0)continue;const ft=T.get(j);if(tt.length===1){const It=tt[0];m[It]=ft,p[It]=A+D/2}else{const It=tt.map(nt=>S(nt)),Dt=It.reduce((nt,Z)=>nt+Z,0)+s*(tt.length-1);let _t=ft-Dt/2;for(const[nt,Z]of tt.entries()){const rt=It[nt];m[Z]=_t+rt/2,p[Z]=A+D/2,_t+=rt+s}}}const G=C[O]??0;A+=D+o+G}const P=new Map;for(const O of e.edges){const k=O.ref.id;P.has(k)||P.set(k,[]),P.get(k).push(O)}for(const[,O]of P){if(O.length===0)continue;const k=O[0].ref,D=k.start,B=k.end;if(D==null||B==null)continue;const G=Math.round(((m[D]??0)+(m[B]??0))/2),j=new Set;for(const tt of O)j.add(tt.src),j.add(tt.dst);for(const tt of j){if(tt===D||tt===B)continue;const ft=e.nodeById.get(tt);ft!=null&&ft.isDummy&&(m[tt]=G)}}return{x:m,y:p}}l(Hs,"assignCoordinates");var Ds=8;function Xs(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}l(Xs,"hashString");function Ys(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}l(Ys,"mulberry32");function Gs(t,e){const n=[...t],o=Ys(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}l(Gs,"deterministicShuffle");function zs(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}l(zs,"sourceDistance");function qn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:a}of e){const c=n.get(s),u=n.get(r);c==null||u==null||(o+=a*Math.abs(c-u))}return o}l(qn,"laneArrangementCost");function $s(t){const e=cn(t);if(e.length<2)return[];const n=new Map(e.map((r,a)=>[r,a])),o=he(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const a=typeof r.start=="string"?r.start:void 0,c=typeof r.end=="string"?r.end:void 0;if(!a||!c||!t.nodeById.has(a)||!t.nodeById.has(c))continue;const u=o(a),m=o(c);if(!u||!m||u===m)continue;const p=n.get(u),g=n.get(m);if(p==null||g==null)continue;const[S,f]=p<=g?[u,m]:[m,u],d=`${S}\0${f}`,i=s.get(d);i?i.weight++:s.set(d,{a:S,b:f,weight:1})}return[...s.values()]}l($s,"buildWeightedLaneEdges");function Zn(t,e,n){const o=[...t];let s=qn(o,e),r=!0,a=0;const c=Math.max(1,o.length);for(;r&&a<c;){r=!1,a++;for(let u=0;u+1<o.length;u++){[o[u],o[u+1]]=[o[u+1],o[u]];const m=qn(o,e);m<s?(s=m,r=!0):[o[u],o[u+1]]=[o[u+1],o[u]]}}return{order:o,cost:s,sourceDistance:zs(o,n)}}l(Zn,"greedySwitch");function Vs(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}l(Vs,"isBetterCandidate");function js(t,e,n){const o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:a})=>`${s}:${r}:${a}`).join("|");return Xs(`${t.join("|")}#${o}#${n}`)}l(js,"seedForRestart");function Us(t,e={}){const n=cn(t);if(n.length<2)return n;const o=$s(t);if(o.length===0)return n;const s=new Map(n.map((c,u)=>[c,u]));let r=Zn(n,o,s);const a=Math.max(0,e.restarts??Ds);for(let c=0;c<a;c++){const u=js(n,o,c),m=Gs(n,u),p=Zn(m,o,s);Vs(p,r)&&(r=p)}return r.order}l(Us,"optimizeTopLaneOrder");function Ws(t,e){const n=(e==null?void 0:e.ignoreCrossLaneEdges)??!0,o=(e==null?void 0:e.optimizeRanksByCrossings)??!0,s=Ie(t),r=e!=null&&e.automaticLaneOrdering?Us(s,{restarts:Ds}):void 0,a=gs(s),c=a.acyclic,u=n?Bs(c,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??tn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e==null?void 0:e.direction}):Ns(c,{compactSingleInput:(e==null?void 0:e.compactSingleInput)??tn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:m,graphWithDummies:p}=Ps(u,c),g=_s(m,p,{laneOrder:r}),S=Hs(g,p,{layerGap:e==null?void 0:e.layerGap,nodeGap:e==null?void 0:e.nodeGap,direction:e==null?void 0:e.direction,laneOrder:r});return{acyclic:c,reversed:a.reversed,layering:m,ordered:g,coordinates:S}}l(Ws,"sugiyamaLayout");var lt=br.EPSILON,Ir=8,Se=15,Re=15,$e=25,ie=20,In=10;function Jn(t,e,n){const o=t.x??0,s=t.y??0,r=e.x-o,a=e.y-s,c=Math.abs(r),u=Math.abs(a);return c<lt&&u<lt?n:u>lt&&u*3>=c?a>0?"bottom":"top":c>lt?r>0?"right":"left":n}l(Jn,"chooseOrthogonalSide");function Qn(t,e){return Math.abs(t.to-e.from)<lt||Math.abs(t.to-e.to)<lt?t.to:t.from}l(Qn,"sharedLineEndpointCoord");function Ce(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}l(Ce,"pointOnLine");function Ks(t,e){var K,J,Y,q;const n=t.nodes??[],o=t.edges??[],s=[];for(const h of o)h.isLayoutOnly||s.push({...h,__originalEdge:h});const r=new Map,a=new Map,c=[],u=e==="LR";for(const h of n)r.set(h.id,h);const m=n.filter(h=>h.isGroup&&!h.parentId);for(const h of m){const M={id:h.id},E=l(w=>{a.set(w.id,M),n.filter(N=>N.parentId===w.id).forEach(E)},"assignLane");E(h)}const p=n.filter(h=>!h.isGroup&&!h.isEdgeLabel).map(h=>{const M=h.width??10,E=h.height??10,w=h.x??0,N=h.y??0,H=Ir;return{nodeId:h.id,minX:w-M/2-H,maxX:w+M/2+H,minY:N-E/2-H,maxY:N+E/2+H,visualXHalfExtent:u?E/2+H:M/2+H}}),g=l((h,M,E,w)=>{let N=c.find(H=>H.orientation===h&&Math.abs(H.coord-M)<1);return N||(N={id:`pipe-${h}-${M.toFixed(0)}`,orientation:h,coord:M,spanMin:E,spanMax:w,tracks:[]},c.push(N)),N.spanMin=Math.min(N.spanMin,E),N.spanMax=Math.max(N.spanMax,w),N},"getOrAddPipe"),S=l((h,M)=>{const E=h.width??10,w=h.height??10,N=h.x??0,H=h.y??0;switch(M){case"top":return{x:N,y:H-w/2};case"bottom":return{x:N,y:H+w/2};case"left":return{x:N-E/2,y:H};case"right":return{x:N+E/2,y:H}}},"portForSide"),f=l((h,M,E)=>S(h,Jn(h,M,E?"bottom":"top")),"getOrthogonalPort"),d=[],i=[],y=new Set,C=1e3,b=l((h,M,E)=>{if(d.length===0)return 0;const w=Math.abs(M.y-E.y)<lt,N=Math.abs(M.x-E.x)<lt;if(!w&&!N)return 0;let H=0;if(w){const W=M.y,ot=Math.min(M.x,E.x)-lt,U=Math.max(M.x,E.x)+lt;if(U<=ot)return 0;for(const $ of d)$.edgeIndex===h||$.orientation!=="vertical"||$.pipe.coord<ot||$.pipe.coord>U||$.from-lt<=W&&$.to+lt>=W&&(H+=C)}else if(N){const W=M.x,ot=Math.min(M.y,E.y)-lt,U=Math.max(M.y,E.y)+lt;if(U<=ot)return 0;for(const $ of d)$.edgeIndex===h||$.orientation!=="horizontal"||$.pipe.coord<ot||$.pipe.coord>U||$.from-lt<=W&&$.to+lt>=W&&(H+=C)}return H},"crossingPenalty"),L=s.map((h,M)=>{if(!h.start||!h.end)return{idx:M,crossLane:0,dx:0,dy:0};const E=r.get(h.start),w=r.get(h.end),N=a.get(h.start),H=a.get(h.end),W=N&&H&&N.id!==H.id?1:0,ot=E&&w?Math.abs((w.x??0)-(E.x??0)):0,U=E&&w?Math.abs((w.y??0)-(E.y??0)):0;return{idx:M,crossLane:W,dx:ot,dy:U}}).sort((h,M)=>{if(h.crossLane!==M.crossLane)return M.crossLane-h.crossLane;const E=h.dx+h.dy,w=M.dx+M.dy;return Math.abs(E-w)>1?E-w:h.idx-M.idx}).map(h=>h.idx),v=l((h,M,E,w)=>{const N=Math.min(h.x,M.x),H=Math.max(h.x,M.x),W=Math.min(h.y,M.y),ot=Math.max(h.y,M.y);return!!p.find($=>E&&$.nodeId===E||w&&$.nodeId===w?!1:Math.abs(h.x-M.x)>lt?$.minY<h.y&&$.maxY>h.y&&$.maxX>N&&$.minX<H:$.minX<h.x&&$.maxX>h.x&&$.maxY>W&&$.minY<ot)},"isSegmentBlocked"),x=new Map,I=new Map;for(const h of s)!h.start||!h.end||h.start===h.end||(I.set(h.start,(I.get(h.start)??0)+1),I.set(h.end,(I.get(h.end)??0)+1));const T=l((h,M)=>Jn(h,M,"bottom"),"determineSide"),A=new Map;for(const[h,M]of s.entries()){if(!M.start||!M.end||M.start===M.end||M.points&&M.points.length>0)continue;const E=r.get(M.start),w=r.get(M.end);if(!E||!w)continue;const N=(w.x??0)-(E.x??0),H=(w.y??0)-(E.y??0);A.set(h,{edgeIdx:h,srcId:M.start,dstId:M.end,srcSide:T(E,{x:w.x??0,y:w.y??0}),dstSide:T(w,{x:E.x??0,y:E.y??0}),absDx:Math.abs(N),absDy:Math.abs(H),dxSign:Math.sign(N),dySign:Math.sign(H)})}const P=l(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.absDx===0?1/0:h.absDy/h.absDx:h.absDy===0?1/0:h.absDx/h.absDy,"preferenceStrength"),O=l(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.dxSign>=0?"right":"left":h.dySign>=0?"bottom":"top","secondarySide"),k=new Map;for(const h of A.values()){const M=`${h.srcId}:${h.srcSide}`;k.has(M)||k.set(M,[]),k.get(M).push(h)}const D=new Map,B=l((h,M)=>`${h}:${M}`,"loadKey");for(const h of A.values())D.set(B(h.srcId,h.srcSide),(D.get(B(h.srcId,h.srcSide))??0)+1),D.set(B(h.dstId,h.dstSide),(D.get(B(h.dstId,h.dstSide))??0)+1);for(const h of k.values())if(!(h.length<2)){h.sort((M,E)=>{const w=P(M),N=P(E);return Math.abs(w-N)>1e-9?N-w:M.edgeIdx-E.edgeIdx});for(let M=1;M<h.length;M++){const E=h[M],w=O(E),N=D.get(B(E.srcId,E.srcSide))??0,H=D.get(B(E.srcId,w))??0;H>=N||(D.set(B(E.srcId,E.srcSide),N-1),D.set(B(E.srcId,w),H+1),E.srcSide=w)}}const G=l(h=>{const M=h==null?void 0:h.shape;return M==="question"||M==="diamond"},"isDiamondNode"),j=new Map;for(const h of A.values())j.has(h.dstId)||j.set(h.dstId,new Set),j.get(h.dstId).add(h.dstSide);for(const h of A.values()){if(!G(r.get(h.srcId)))continue;const M=j.get(h.srcId);if(!(M!=null&&M.has(h.srcSide)))continue;const E=O(h);if(M.has(E)||(D.get(B(h.srcId,E))??0)>0)continue;const w=D.get(B(h.srcId,h.srcSide))??0;D.set(B(h.srcId,h.srcSide),Math.max(0,w-1)),D.set(B(h.srcId,E),1),h.srcSide=E}for(const h of A.values()){const{edgeIdx:M,srcId:E,dstId:w,srcSide:N,dstSide:H}=h,W=r.get(E),ot=r.get(w),U=`${E}:${N}:src`,$=N==="top"||N==="bottom"?ot.x??0:ot.y??0;x.has(U)||x.set(U,[]),x.get(U).push({edgeIdx:M,oppositeCoord:$});const bt=`${w}:${H}:dst`,dt=H==="top"||H==="bottom"?W.x??0:W.y??0;x.has(bt)||x.set(bt,[]),x.get(bt).push({edgeIdx:M,oppositeCoord:dt})}const tt=new Map,ft=8;for(const[h,M]of x){if(M.length<2)continue;M.sort((At,Gt)=>At.oppositeCoord-Gt.oppositeCoord);const E=h.split(":"),w=E.slice(0,-2).join(":"),N=E[E.length-2],H=E[E.length-1],W=r.get(w);if(!W)continue;const U=N==="left"||N==="right"?W.height??10:W.width??10,$=W.shape,dt=$==="question"||$==="diamond"?U*.3:U,st=Math.min(20,Math.max(ft,dt/(M.length+1))),Pt=-(st*(M.length-1))/2;for(const[At,Gt]of M.entries()){const ee=Pt+At*st,dn=`${Gt.edgeIdx}:${H}`;tt.set(dn,ee)}}const It=l(h=>{var M;return!!((M=s[h])!=null&&M.labelNodeId)},"edgeHasLabelNode"),Dt=l((h,M)=>h?(x.get(`${h}:${M}:src`)??[]).some(({edgeIdx:E})=>It(E))||(x.get(`${h}:${M}:dst`)??[]).some(({edgeIdx:E})=>It(E)):!1,"faceHasLabelNode"),_t=l((h,M,E)=>M==="top"||M==="bottom"?{x:h.x+E,y:h.y}:{x:h.x,y:h.y+E},"applyPortOffset"),nt=l((h,M,E)=>{const w=A.get(h),N={x:E.x??0,y:E.y??0},H={x:M.x??0,y:M.y??0},W=(w==null?void 0:w.srcSide)??T(M,N),ot=(w==null?void 0:w.dstSide)??T(E,H);let U=w?S(M,w.srcSide):f(M,N,!0),$=w?S(E,w.dstSide):f(E,H,!1);const bt=tt.get(`${h}:src`),dt=tt.get(`${h}:dst`);return bt!==void 0&&(U=_t(U,W,bt)),dt!==void 0&&($=_t($,ot,dt)),{pSrcPort:U,pDstPort:$,srcSide:W,dstSide:ot}},"portsForEdge");for(const h of L){const M=s[h];if(i[h]=[],!M.start||!M.end||M.points&&M.points.length>0||M.start===M.end)continue;const E=r.get(M.start),w=r.get(M.end);if(!E||!w)continue;const{pSrcPort:N,pDstPort:H,srcSide:W,dstSide:ot}=nt(h,E,w),U={...N},$={...H},bt=W==="top"||W==="bottom",dt=ot==="top"||ot==="bottom";if(bt){const X=N.y>(E.y??0);U.y=X?N.y+ie:N.y-ie}else{const X=N.x>(E.x??0);U.x=X?N.x+ie:N.x-ie}if(dt){const X=H.y>(w.y??0);$.y=X?H.y+ie:H.y-ie}else{const X=H.x>(w.x??0);$.x=X?H.x+ie:H.x-ie}const ct=l((X,z)=>{for(const Q of p)if(!z.includes(Q.nodeId)&&X.x>Q.minX&&X.x<Q.maxX&&X.y>Q.minY&&X.y<Q.maxY)return{inside:!0,obstacle:Q};return{inside:!1}},"isPointInObstacle"),st=l((X,z,Q,ht,wt)=>{if(wt){const kt=X.y>(z.y??0);return{x:(Q.x??0)>=X.x?ht.maxX+Se:ht.minX-Se,y:kt?ht.maxY+Re:ht.minY-Re,leavesPositiveSide:kt}}const Ct=X.x>(z.x??0),Rt=(Q.y??0)>=X.y;return{x:Ct?ht.maxX+Se:ht.minX-Se,y:Rt?ht.maxY+Re:ht.minY-Re,leavesPositiveSide:Ct}},"obstacleDetour");let Mt=[];const Pt=[M.start,M.end],At=ct(U,Pt);if(At.inside&&At.obstacle){const X=At.obstacle;if(bt){const z=st(N,E,w,X,!0);U.x=z.x,U.y=z.y;const Q=z.leavesPositiveSide?Math.min(X.minY-2,N.y+ie):Math.max(X.maxY+2,N.y-ie);Mt=[{x:N.x,y:Q},{x:z.x,y:Q},{x:z.x,y:z.y}]}else{const z=st(N,E,w,X,!1),Q=z.leavesPositiveSide?Math.min(X.minX-2,N.x+ie):Math.max(X.maxX+2,N.x-ie);U.x=z.x,U.y=z.y,Mt=[{x:Q,y:N.y},{x:Q,y:z.y},{x:z.x,y:z.y}]}}let Gt=[];const ee=ct($,Pt);if(ee.inside&&ee.obstacle){const X=ee.obstacle;if(dt){const z=st(H,w,E,X,!0);$.x=z.x,$.y=z.y,Gt=[{x:z.x,y:z.y},{x:H.x,y:z.y}]}else{const z=st(H,w,E,X,!1);$.x=z.x,$.y=z.y,Gt=[{x:z.x,y:z.y},{x:z.x,y:H.y}]}}if(Mt.length===0&&Gt.length===0){const X=Se,z=Math.abs(U.x-$.x)<X,Q=Math.abs(U.y-$.y)<X,ht=tt.get(`${h}:src`)!==void 0||tt.get(`${h}:dst`)!==void 0,wt=(((K=x.get(`${M.start??""}:${W}:src`))==null?void 0:K.length)??0)+(((J=x.get(`${M.start??""}:${W}:dst`))==null?void 0:J.length)??0),Ct=(((Y=x.get(`${M.end??""}:${ot}:src`))==null?void 0:Y.length)??0)+(((q=x.get(`${M.end??""}:${ot}:dst`))==null?void 0:q.length)??0),Rt=wt>1||Ct>1,kt=I.get(M.start??"")??0,mt=I.get(M.end??"")??0,Vt=wt>1&&Dt(M.start,W)||Ct>1&&Dt(M.end,ot),re=wt<=1||kt<=2,Ht=Ct<=1||mt<=2;if((z||Q)&&!ht&&(!Rt||Rt&&!Vt&&re&&Ht)&&!v(N,H,M.start,M.end)){M.points=[{...N},{...U},{...$},{...H}],y.add(h);const vt=Q?"horizontal":"vertical",Ut=Q?N.y:N.x,Lt=Q?Math.min(N.x,H.x):Math.min(N.y,H.y),Tt=Q?Math.max(N.x,H.x):Math.max(N.y,H.y),Jt={id:`fast-path-${vt}-${Ut.toFixed(0)}-${h}`,orientation:vt,coord:Ut,spanMin:Lt,spanMax:Tt,tracks:[]};d.push({edgeIndex:h,segmentIndex:0,orientation:vt,pipe:Jt,trackIndex:0,from:Lt,to:Tt});continue}}const dn=g("vertical",U.x,U.y,U.y);U.x=dn.coord;const Qs=g("vertical",$.x,$.y,$.y);$.x=Qs.coord;let me=Math.min(U.x,$.x)-50,xe=Math.max(U.x,$.x)+50,we=Math.min(U.y,$.y)-50,Ee=Math.max(U.y,$.y)+50;for(const X of p){const z=Math.min(U.x,$.x),Q=Math.max(U.x,$.x),ht=Math.min(U.y,$.y),wt=Math.max(U.y,$.y);X.minX<Q&&X.maxX>z&&X.minY<wt&&X.maxY>ht&&(me=Math.min(me,X.minX-$e),xe=Math.max(xe,X.maxX+$e),we=Math.min(we,X.minY-$e),Ee=Math.max(Ee,X.maxY+$e))}for(const X of p){if(X.maxX<me||X.minX>xe||X.maxY<we||X.minY>Ee)continue;const z=Se;g("horizontal",X.minY-z,me,xe),g("horizontal",X.maxY+z,me,xe);const Q=Re;g("vertical",X.minX-Q,we,Ee),g("vertical",X.maxX+Q,we,Ee)}g("horizontal",U.y,me,xe),g("horizontal",$.y,me,xe);const tr=c.filter(X=>X.orientation==="horizontal"&&X.coord>=we&&X.coord<=Ee),er=c.filter(X=>X.orientation==="vertical"&&X.coord>=me&&X.coord<=xe),Fe=l((X,z)=>`${X.toFixed(1)},${z.toFixed(1)}`,"getKey"),_e=Fe(U.x,U.y),Io=Fe($.x,$.y),He=new Map,un=new Map,hn=new Map,De=new Set,Me=[];He.set(_e,0),hn.set(_e,"n"),Me.push({key:_e,f:Math.hypot($.x-U.x,$.y-U.y),pt:U}),De.add(_e);let zt=[];const ye=l((X,z)=>v(X,z,M.start,M.end),"checkSegmentBlocked"),gn={x:$.x,y:U.y},nr=ye(U,gn),or=ye(gn,$),sr=nr||or,mn={x:U.x,y:$.y},rr=ye(U,mn),ir=ye(mn,$);if(sr?rr||ir||(Math.abs(U.x-$.x)<lt?zt=[U,$]:zt=[U,mn,$]):Math.abs(U.y-$.y)<lt||Math.abs(U.x-$.x)<lt?zt=[U,$]:zt=[U,gn,$],zt.length===0)for(;Me.length>0;){Me.sort((mt,Vt)=>mt.f-Vt.f);const X=Me.shift();if(De.delete(X.key),X.key===Io){let mt=Io,Vt=$;for(zt=[Vt];un.has(mt);){const re=un.get(mt);zt.unshift(re),Vt=re,mt=Fe(re.x,re.y)}break}const z=X.pt.x,Q=X.pt.y,ht=er.sort((mt,Vt)=>mt.coord-Vt.coord),wt=ht.findIndex(mt=>Math.abs(mt.coord-z)<1),Ct=tr.sort((mt,Vt)=>mt.coord-Vt.coord),Rt=Ct.findIndex(mt=>Math.abs(mt.coord-Q)<1),kt=[];wt>0&&kt.push({x:ht[wt-1].coord,y:Q}),wt>=0&&wt<ht.length-1&&kt.push({x:ht[wt+1].coord,y:Q}),Rt>0&&kt.push({x:z,y:Ct[Rt-1].coord}),Rt>=0&&Rt<Ct.length-1&&kt.push({x:z,y:Ct[Rt+1].coord});for(const mt of kt){const Vt=Math.min(z,mt.x),re=Math.max(z,mt.x),Ht=Math.min(Q,mt.y),jt=Math.max(Q,mt.y);if(p.some(ne=>ne.nodeId===M.start||ne.nodeId===M.end?!1:Vt!==re?ne.minY<Q&&ne.maxY>Q&&ne.maxX>Vt&&ne.minX<re:ne.minX<z&&ne.maxX>z&&ne.maxY>Ht&&ne.minY<jt))continue;const vt=Fe(mt.x,mt.y),Ut=Math.abs(mt.x-z)+Math.abs(mt.y-Q),Lt=b(h,X.pt,mt);let Tt=0;const Jt=$.x-U.x,Ae=$.y-U.y,Xe=mt.x-z,xn=mt.y-Q;(Ae>10&&xn<-5||Ae<-10&&xn>5)&&(Tt=Math.abs(xn)*100),(Jt>10&&Xe<-5||Jt<-10&&Xe>5)&&(Tt+=Math.abs(Xe)*50);let Mo=0;const So=hn.get(X.key)??"n",Co=Math.abs(Xe)>lt?"h":"v";So!=="n"&&So!==Co&&(Mo=50);const cr=Ut+Lt+Tt+Mo,Ye=(He.get(X.key)??1/0)+cr,vo=Math.abs($.x-mt.x)+Math.abs($.y-mt.y);if(Ye<(He.get(vt)??1/0))if(un.set(vt,X.pt),He.set(vt,Ye),hn.set(vt,Co),!De.has(vt))Me.push({key:vt,f:Ye+vo,pt:mt}),De.add(vt);else{const ne=Me.findIndex(ar=>ar.key===vt);ne!==-1&&(Me[ne].f=Ye+vo)}}}if(zt.length===0&&(zt=[U,{x:U.x,y:$.y},$]),zt.length>4){const X=zt[0],z=zt[zt.length-1];let Q=Math.min(X.x,z.x),ht=Math.max(X.x,z.x),wt=Math.min(X.y,z.y),Ct=Math.max(X.y,z.y);for(const Ht of zt)Q=Math.min(Q,Ht.x),ht=Math.max(ht,Ht.x),wt=Math.min(wt,Ht.y),Ct=Math.max(Ct,Ht.y);const Rt=ht>Math.max(X.x,z.x),kt=Q<Math.min(X.x,z.x);if(u){const Ht=Re;if(Rt){const jt=Math.max(X.x,z.x),Ft=Math.min(X.y,z.y),vt=Math.max(X.y,z.y),Ut=p.filter(Lt=>Lt.minX<jt&&Lt.maxX>jt&&Lt.minY<vt&&Lt.maxY>Ft);if(Ut.length>0){let Lt=Math.max(X.x,z.x);for(const Tt of Ut){const Jt=(Tt.minX+Tt.maxX)/2;if(Tt.visualXHalfExtent===void 0||isNaN(Tt.visualXHalfExtent))continue;const Ae=Jt+Tt.visualXHalfExtent+Ht;Lt=Math.max(Lt,Ae)}isNaN(Lt)||(ht=Lt)}}if(kt){const jt=p.filter(Ft=>Ft.minX<Math.min(X.x,z.x)+Ht&&Ft.minY<Math.max(X.y,z.y)&&Ft.maxY>Math.min(X.y,z.y));if(jt.length>0){let Ft=Math.min(X.x,z.x);for(const vt of jt){const Lt=(vt.minX+vt.maxX)/2-vt.visualXHalfExtent-Ht;Ft=Math.min(Ft,Lt)}Q=Ft}}}const mt=l(Ht=>{const jt=z.y>X.y,Ft=p.filter(Lt=>{const Tt=Math.min(X.x,z.x)<Lt.maxX&&Math.max(X.x,z.x)>Lt.minX,Jt=Math.min(X.y,z.y)<Lt.maxY&&Math.max(X.y,z.y)>Lt.minY;return Tt&&Jt});let vt=Ft;if(u&&Ft.length>0){const Lt=Ft.filter(Tt=>Tt.minX<Ht&&Tt.maxX>Ht);Lt.length>0&&(vt=Lt)}if(vt.length===0)return z.y;const Ut=Se;if(jt){const Tt=Math.max(...vt.map(Jt=>Jt.maxY))+Ut;if(Tt<z.y-lt)return Tt}else{const Tt=Math.min(...vt.map(Jt=>Jt.minY))-Ut;if(Tt>z.y+lt)return Tt}return z.y},"findBestReturnY"),Vt=l(Ht=>{const jt=mt(Ht),Ft={x:Ht,y:X.y},vt={x:Ht,y:jt},Ut={x:z.x,y:jt},Lt=ye(X,Ft),Tt=ye(Ft,vt),Jt=ye(vt,Ut),Ae=jt!==z.y?ye(Ut,z):!1;return!Lt&&!Tt&&!Jt&&!Ae?Math.abs(jt-z.y)<lt?[X,Ft,vt,z]:[X,Ft,vt,Ut,z]:null},"trySimplifyWithDetourX"),re=Rt&&!kt?Vt(ht):kt&&!Rt?Vt(Q):null;re&&(zt=re)}const $t=[N,...Mt,...zt,...Gt.reverse(),H];if($t.length>=3){const X=$t[$t.length-1],z=$t[$t.length-2],Q=$t[$t.length-3],ht=Math.abs(Q.y-z.y)<lt&&Math.abs(z.y-X.y)<lt,wt=Math.abs(Q.x-z.x)<lt&&Math.abs(z.x-X.x)<lt;if(ht){const Ct=Math.sign(z.x-Q.x),Rt=Math.sign(X.x-Q.x);Ct!==0&&Ct===Rt&&Math.abs(z.x-Q.x)>Math.abs(X.x-Q.x)&&$t.splice(-2,1)}else if(wt){const Ct=Math.sign(z.y-Q.y),Rt=Math.sign(X.y-Q.y);Ct!==0&&Ct===Rt&&Math.abs(z.y-Q.y)>Math.abs(X.y-Q.y)&&$t.splice(-2,1)}}const le=[$t[0]];for(let X=1;X<$t.length-1;X++){if(X===1){le.push($t[X]);continue}const z=le[le.length-1],Q=$t[X],ht=$t[X+1];if(Math.abs(z.y-Q.y)<lt&&Math.abs(Q.y-ht.y)<lt){const wt=Q.x>z.x,Ct=ht.x>Q.x;if(wt!==Ct){le.push(Q);continue}continue}if(Math.abs(z.x-Q.x)<lt&&Math.abs(Q.x-ht.x)<lt){const wt=Q.y>z.y,Ct=ht.y>Q.y;if(wt!==Ct){le.push(Q);continue}continue}le.push(Q)}le.push($t[$t.length-1]);for(let X=0;X<le.length-1;X++){const z=le[X],Q=le[X+1],ht=Math.abs(z.x-Q.x)<lt?"vertical":"horizontal",wt=ht==="vertical"?z.x:z.y,Ct=ht==="vertical"?Math.min(z.y,Q.y):Math.min(z.x,Q.x),Rt=ht==="vertical"?Math.max(z.y,Q.y):Math.max(z.x,Q.x),kt=g(ht,wt,Ct,Rt),mt={edgeIndex:h,segmentIndex:X,orientation:ht,pipe:kt,trackIndex:0,from:Ct,to:Rt};d.push(mt),i[h].push(d.length-1),kt.tracks[0]||(kt.tracks[0]={index:0,coord:kt.coord,segments:[]}),kt.tracks[0].segments.push({edgeIndex:h,segmentIndex:X,from:Ct,to:Rt})}}const Z=l((h,M)=>h.from<M.to&&M.from<h.to,"segmentsOverlap"),rt=l((h,M,E,w)=>{const N=!w.segments.some(W=>(W.edgeIndex!==M.edgeIndex||W.segmentIndex!==M.segmentIndex)&&Z(W,h)),H=!E.segments.some(W=>(W.edgeIndex!==h.edgeIndex||W.segmentIndex!==h.segmentIndex)&&Z(W,M));return N&&H?(h.trackIndex=w.index,M.trackIndex=E.index,E.segments=[...E.segments.filter(W=>W.edgeIndex!==h.edgeIndex||W.segmentIndex!==h.segmentIndex),{edgeIndex:M.edgeIndex,segmentIndex:M.segmentIndex,from:M.from,to:M.to}],w.segments=[...w.segments.filter(W=>W.edgeIndex!==M.edgeIndex||W.segmentIndex!==M.segmentIndex),{edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to}],!0):!1},"trySwapSegmentsAcrossTracks"),ut=l(h=>{const M=h.tracks.length;return h.tracks[M]={index:M,coord:h.coord,segments:[]},M},"createNewTrack"),yt=l((h,M)=>{const E=h.pipe.tracks[h.trackIndex];E.segments=E.segments.filter(N=>N.edgeIndex!==h.edgeIndex||N.segmentIndex!==h.segmentIndex),h.trackIndex=M,h.pipe.tracks[M].segments.push({edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to})},"moveSegmentToTrack"),St=l((h,M)=>{const E=i[h.edgeIndex];for(const w of E){const N=d[w];N.pipe===h.pipe&&yt(N,M)}},"moveSegmentChainToTrack"),Et=l(h=>{const M=i[h.edgeIndex],E=M.indexOf(d.indexOf(h)),w=[];return E>0&&w.push(d[M[E-1]]),E<M.length-1&&w.push(d[M[E+1]]),w},"getAdjacentSegmentsAlongEdge"),Kt=l((h,M)=>{if(h.orientation===M.orientation)return!1;const E=h.orientation==="horizontal"?h:M,w=h.orientation==="horizontal"?M:h;return w.pipe.coord>E.from&&w.pipe.coord<E.to&&E.pipe.coord>w.from&&E.pipe.coord<w.to},"haveAnyCrossing"),qt=l((h,M)=>{for(const E of h.tracks)if(!E.segments.some(N=>(N.edgeIndex!==M.edgeIndex||N.segmentIndex!==M.segmentIndex)&&Z(N,M)))return E.index;return-1},"findAvailableTrack"),Zt=l((h,M)=>{if(h.trackIndex===M.trackIndex)return Z(h,M);const E=Et(h),w=Et(M);return E.some(N=>w.some(H=>Kt(N,H)))},"segmentsConflict"),se=l((h,M,E)=>{if(rt(h,M,h.pipe.tracks[h.trackIndex],M.pipe.tracks[M.trackIndex]))return;const w=qt(h.pipe,M);E(M,w!==-1?w:ut(h.pipe))},"resolveTrackConflict"),Le=l(h=>{let M=0;for(let E=0;E<h.length;E++)for(let w=E+1;w<h.length;w++){const N=h[E],H=h[w];N.pipe===H.pipe&&Zt(N,H)&&(M++,se(N,H,St))}return M},"resolveHandleConflicts"),ge=new Map,Te=l(h=>{if(ge.has(h))return ge.get(h);const M=i[h];if(M.length===0){const ot={dest:0,deviation:0,base:0,delta:0};return ge.set(h,ot),ot}const w=d[M[0]].pipe.coord;let N=w;for(let ot=1;ot<M.length;ot++){const U=d[M[ot]];if(U.orientation==="horizontal"){const $=U.from,bt=U.to;N=Math.abs($-w)>Math.abs(bt-w)?$:bt;break}}const H=Math.abs(N-w),W={dest:N,deviation:H,base:w,delta:N-w};return ge.set(h,W),W},"getDestInfo"),an=l(()=>{let h=0;const M=new Map;for(const[w,N]of s.entries())i[w].length!==0&&N.start&&(M.has(N.start)||M.set(N.start,[]),M.get(N.start).push(w));const E=l(w=>{const N=s[w];if(!N.start||!N.end)return 0;const H=r.get(N.start),W=r.get(N.end);if(!H||!W)return 0;const ot=(W.x??0)-(H.x??0),U=(W.y??0)-(H.y??0);return Math.abs(ot)+Math.abs(U)},"getEdgeDistance");for(const w of M.values()){w.sort((H,W)=>{const ot=Te(H),U=Te(W);if(Math.abs(ot.deviation-U.deviation)>1)return ot.deviation-U.deviation;if(Math.abs(ot.dest-U.dest)>1)return ot.dest-U.dest;const $=E(H),bt=E(W);if(Math.abs($-bt)>1)return bt-$;const dt=i[H].length,ct=i[W].length;if(dt!==ct)return dt-ct;if(dt===1){const st=i[H][0],Mt=i[W][0];if(d[st]&&d[Mt]){const Pt=d[st],At=d[Mt],Gt=Math.abs(Pt.to-Pt.from),ee=Math.abs(At.to-At.from);if(Math.abs(Gt-ee)>1)return Gt-ee}}return 0});const N=w.map(H=>d[i[H][0]]);h+=Le(N)}return h},"fixSourceHandleCrossings"),ln=l(()=>{let h=0;const M=new Map;for(const[E,w]of s.entries())i[E].length!==0&&w.end&&(M.has(w.end)||M.set(w.end,[]),M.get(w.end).push(E));for(const E of M.values()){E.sort((N,H)=>{const W=l($=>{const bt=i[$];if(bt.length<2)return 0;const dt=d[bt[bt.length-2]];return Math.abs(dt.to-dt.from)},"getDist"),ot=W(N),U=W(H);return Math.abs(ot-U)>.1?ot-U:N-H});const w=E.map(N=>d[i[N][i[N].length-1]]);h+=Le(w)}return h},"fixTargetHandleCrossings"),fn=l(()=>{let h=0;for(const M of c){const E=[];for(const w of M.tracks)for(const N of w.segments){const H=i[N.edgeIndex].find(W=>d[W].segmentIndex===N.segmentIndex);H!==void 0&&E.push(d[H])}E.sort((w,N)=>w.edgeIndex-N.edgeIndex||w.segmentIndex-N.segmentIndex);for(let w=0;w<E.length;w++)for(let N=w+1;N<E.length;N++){const H=E[w],W=E[N];Zt(H,W)&&(h++,se(H,W,yt))}}return h},"fixPipeCrossings");let R=0;const F=10;for(;R<F;){let h=0;if(h+=an(),h+=ln(),h+=fn(),h===0)break;R++}const _=new Map;for(const h of c){const M=[];h.tracks.forEach(w=>{w.segments.forEach(N=>{M.push({edgeIndex:N.edgeIndex,segmentIndex:N.segmentIndex,trackIndex:w.index,from:N.from,to:N.to})})}),M.sort((w,N)=>w.from-N.from);const E=[];if(M.length>0){let w=[M[0]],N=M[0].to;for(let H=1;H<M.length;H++){const W=M[H];W.from<N?(w.push(W),N=Math.max(N,W.to)):(E.push(w),w=[W],N=W.to)}E.push(w)}for(const w of E){const N=new Set;w.forEach(st=>N.add(st.trackIndex));const H=new Map;w.forEach(st=>{const Mt=Te(st.edgeIndex);H.set(st.trackIndex,(H.get(st.trackIndex)??0)+Mt.delta)});const W=[...N].filter(st=>(H.get(st)??0)<-1),ot=[...N].filter(st=>(H.get(st)??0)>1),U=[...N].filter(st=>Math.abs(H.get(st)??0)<=1);W.sort((st,Mt)=>(H.get(Mt)??0)-(H.get(st)??0)),ot.sort((st,Mt)=>(H.get(st)??0)-(H.get(Mt)??0));const $=l((st,Mt)=>{w.filter(Pt=>Pt.trackIndex===st).forEach(Pt=>{const At=y.has(Pt.edgeIndex)?h.coord:Mt;_.set(`${Pt.edgeIndex}-${Pt.segmentIndex}`,At)})},"assignCoord");let bt=0;for(const st of W)bt++,$(st,h.coord-bt*In);if(U.length===0&&N.size>0){const st=[...N].sort((At,Gt)=>Math.abs(H.get(At)??0)-Math.abs(H.get(Gt)??0))[0],Mt=W.indexOf(st);Mt!==-1&&W.splice(Mt,1);const Pt=ot.indexOf(st);Pt!==-1&&ot.splice(Pt,1),U.push(st)}let dt=0;for(const st of U){if(dt===0)$(st,h.coord);else{const Mt=dt%2===1?1:-1,Pt=Math.ceil(dt/2);$(st,h.coord+Mt*Pt*In*.5)}dt++}let ct=0;for(const st of ot)ct++,$(st,h.coord+ct*In)}}for(const[h,M]of s.entries()){const E=i[h]??[];if(E.length===0)continue;const w=[],N=r.get(M.start),H=r.get(M.end),{pSrcPort:W,pDstPort:ot}=nt(h,N,H),U=E.map(dt=>{const ct=d[dt],st=_.get(`${ct.edgeIndex}-${ct.segmentIndex}`)??ct.pipe.coord;return{orient:ct.orientation,coord:st,from:ct.from,to:ct.to}});w.push(W);for(let dt=0;dt<U.length;dt++){const ct=U[dt],st=w[w.length-1],Mt=ct.orient==="vertical"?st.y:st.x,Pt=ct.orient==="vertical"?st.x:st.y,At=U[dt+1],Gt=dt<U.length-1;if(Math.abs(Pt-ct.coord)>lt&&w.push(Ce(ct,Mt)),Gt&&At.orient===ct.orient)if(Math.abs(ct.coord-At.coord)>lt){const ee=ct.orient==="vertical"?(Mt+At.from)/2:Qn(ct,At);w.push(Ce(ct,ee),Ce(At,ee))}else(dt===0||dt===U.length-2)&&w.push(Ce(ct,Qn(ct,At)));else if(Gt)w.push(Ce(ct,At.coord));else{const ee=Math.abs(ct.from-Mt)<Math.abs(ct.to-Mt)?ct.to:ct.from;w.push(Ce(ct,ee))}}const $=w[w.length-1];(Math.abs($.x-ot.x)>lt||Math.abs($.y-ot.y)>lt)&&w.push(ot);const bt=[];w.length>0&&bt.push(w[0]);for(let dt=1;dt<w.length;dt++){const ct=w[dt],st=bt[bt.length-1];(Math.abs(ct.x-st.x)>lt||Math.abs(ct.y-st.y)>lt)&&bt.push(ct)}M.points=bt}for(const h of s){const M=h.__originalEdge;M&&h.points&&(M.points=h.points)}t.edges=(t.edges??[]).filter(h=>!h.isLayoutOnly);const V=l((h,M)=>{const E=M.x??0,w=M.y??0,N=M.width??0,H=M.height??0;if(N<=0||H<=0)return h;const W=E-N/2,ot=E+N/2,U=w-H/2,$=w+H/2;if(h.x<W||h.x>ot||h.y<U||h.y>$)return h;const bt=h.x-W,dt=ot-h.x,ct=h.y-U,st=$-h.y,Mt=Math.min(bt,dt,ct,st);return Mt===bt?{x:W,y:h.y}:Mt===dt?{x:ot,y:h.y}:Mt===ct?{x:h.x,y:U}:{x:h.x,y:$}},"nodeBoundaryClamp");for(const h of t.edges){const M=h.points;if(!M||M.length<2)continue;const E=h.start,w=h.end,N=E?r.get(E):void 0,H=w?r.get(w):void 0;N&&(M[0]=V(M[0],N)),H&&(M[M.length-1]=V(M[M.length-1],H))}return t}l(Ks,"routeEdgesOrthogonal");function qs(t){return t.direction??"TB"}l(qs,"getSwimlaneDirection");function Zs(t){var p,g,S,f,d;const e=Bo(t),n=((p=t.config.flowchart)==null?void 0:p.nodeSpacing)??40,o=((g=t.config.flowchart)==null?void 0:g.rankSpacing)??100,s=((S=t.config.swimlane)==null?void 0:S.ignoreCrossLaneEdges)??!0,r=((f=t.config.swimlane)==null?void 0:f.optimizeRanksByCrossings)??!0,a=((d=t.config.swimlane)==null?void 0:d.automaticLaneOrdering)??!1,c=qs(t),{ordered:u,coordinates:m}=Ws(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:a,direction:c});Po(e,u,m,{nodeGap:n,layerGap:o});for(const i of t.edges??[])delete i.points;Ks(t,c);for(const i of t.edges??[])(!i.curve||i.curve==="basis")&&(i.curve="rounded");return us(t,c),ds(t),c}l(Zs,"runSwimlaneLayoutCore");function Js(t){Oo(t);const e=ko(t);t.nodes=e.nodes,t.edges=e.edges}l(Js,"prepareSwimlaneLayout");var Er=fr({prepareLayout:Js,runLayoutCore:Zs,afterPaint:Ro});export{Er as render};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as r,s as e}from"./flowDiagram-IUGLLWBU-CVV4rL8v.js";import{_ as o}from"./mermaid.core-knGXJfjz.js";import"./main-B_0jS_Gz.js";import"./chunk-5VM5RSS4-Dpmi-9Gi.js";import"./chunk-XXDRQBXY-CnxFMLWV.js";import"./chunk-VQ5W62QI-A616Pgzo.js";import"./chunk-55XCU76K-D32C0DXX.js";import"./channel-C0RGiobt.js";import"./modulepreload-polyfill-B5Qt9EMX.js";var a=o(t=>`${e(t)}
|
|
2
|
+
.swimlane.cluster:not([data-color-id]) rect {
|
|
3
|
+
stroke: ${t.clusterBorder} !important;
|
|
4
|
+
}
|
|
5
|
+
[data-look="neo"].cluster rect {
|
|
6
|
+
filter: none;
|
|
7
|
+
}
|
|
8
|
+
`,"getStyles"),m=a,y=r({styles:m});export{y as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as l,K as gt,E as nt,B as Pt,a0 as Bt,a1 as Vt,a2 as Ft,c as ft,l as S,P as zt,U as Gt,a3 as yt,I as Ot,a4 as Dt,z as Kt}from"./mermaid.core-
|
|
1
|
+
import{_ as l,K as gt,E as nt,B as Pt,a0 as Bt,a1 as Vt,a2 as Ft,c as ft,l as S,P as zt,U as Gt,a3 as yt,I as Ot,a4 as Dt,z as Kt}from"./mermaid.core-knGXJfjz.js";import{s as J}from"./main-B_0jS_Gz.js";import{d as lt}from"./arc-De-uH_Q9.js";import"./modulepreload-polyfill-B5Qt9EMX.js";var tt=function(){var e=l(function(k,i,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=i);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],s=[1,12],r=[1,13],n=[1,14],o=[1,15],a=[1,16],c=[1,19],p=[1,20],y={trace:l(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:l(function(i,d,h,g,x,u,w){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:s,15:r,17:n,19:o,20:a,21:17,22:18,23:c,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:s,15:r,17:n,19:o,20:a,21:17,22:18,23:c,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(i,d){if(d.recoverable)this.trace(i);else{var h=new Error(i);throw h.hash=d,h}},"parseError"),parse:l(function(i){var d=this,h=[0],g=[],x=[null],u=[],w=this.table,v="",M=0,R=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);_.setInput(i,C.yy),C.yy.lexer=_,C.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function K(A){h.length=h.length-2*A,x.length=x.length-A,u.length=u.length-A}l(K,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var U="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?U="Parse error on line "+(M+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":U="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(U,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),x.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,R=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=x[x.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,R,M,C.yy,b[1],x,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),x=x.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),x.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},m=function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(i,d){return this.yy=d||this.yy||{},this._input=i,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:l(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var d=i.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:l(function(i){var d=i.length,h=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=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),h.length-1&&(this.yylineno-=h.length-1);var x=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:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(i){this.unput(this.match.slice(i))},"less"),pastInput:l(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var i=this.pastInput(),d=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
@@ -117,4 +117,4 @@ Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":U="Parse error on
|
|
|
117
117
|
.eventWrapper {
|
|
118
118
|
filter: brightness(120%);
|
|
119
119
|
}
|
|
120
|
-
`},"getStyles"),me=ye,xe={setConf:l(()=>{},"setConf"),draw:l((e,t,s,r)=>{var o,a;return(((a=(o=r==null?void 0:r.db)==null?void 0:o.getDirection)==null?void 0:a.call(o))??"LR")==="TD"?pe.draw(e,t,s,r):oe.draw(e,t,s,r)},"draw")},
|
|
120
|
+
`},"getStyles"),me=ye,xe={setConf:l(()=>{},"setConf"),draw:l((e,t,s,r)=>{var o,a;return(((a=(o=r==null?void 0:r.db)==null?void 0:o.getDirection)==null?void 0:a.call(o))??"LR")==="TD"?pe.draw(e,t,s,r):oe.draw(e,t,s,r)},"draw")},we={db:mt,renderer:xe,parser:Ut,styles:me};export{we as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ni}from"./chunk-XXDRQBXY-
|
|
1
|
+
import{g as Ni}from"./chunk-XXDRQBXY-CnxFMLWV.js";import{s as Ci}from"./chunk-VQ5W62QI-A616Pgzo.js";import{g as Zs,s as jt,a as Qs,b as Gt,q as bi,p as vi,_ as u,C as je,l as _i,c as en,o as Mi,r as xi,u as wi,j as Ui,z as Pi,N as Di,B as Fi,K as Bi,D as $i,H as ji,bk as Gi}from"./mermaid.core-knGXJfjz.js";import{s as Wi}from"./main-B_0jS_Gz.js";import"./modulepreload-polyfill-B5Qt9EMX.js";function Wt(s){console&&console.error&&console.error(`Error: ${s}`)}function tn(s){console&&console.warn&&console.warn(`Warning: ${s}`)}function sn(s){const e=new Date().getTime(),t=s();return{time:new Date().getTime()-e,value:t}}function nn(s){function e(){}e.prototype=s;const t=new e;function n(){return typeof t.bar}return n(),n(),s}function Ki(s){return Vi(s)?s.LABEL:s.name}function Vi(s){return typeof s.LABEL=="string"&&s.LABEL!==""}class te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){this._definition=e}accept(e){e.visit(this),this.definition.forEach(t=>{t.accept(e)})}}class K extends te{constructor(e){super([]),this.idx=1,Object.assign(this,ie(e))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _e extends te{constructor(e){super(e.definition),this.orgText="",Object.assign(this,ie(e))}}class W extends te{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,Object.assign(this,ie(e))}}class G extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class se extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class ne extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class x extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class J extends te{constructor(e){super(e.definition),this.idx=1,Object.assign(this,ie(e))}}class Z extends te{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,Object.assign(this,ie(e))}}class k{constructor(e){this.idx=1,Object.assign(this,ie(e))}accept(e){e.visit(this)}}function zi(s){return s.map(at)}function at(s){function e(t){return t.map(at)}if(s instanceof K){const t={type:"NonTerminal",name:s.nonTerminalName,idx:s.idx};return typeof s.label=="string"&&(t.label=s.label),t}else{if(s instanceof W)return{type:"Alternative",definition:e(s.definition)};if(s instanceof G)return{type:"Option",idx:s.idx,definition:e(s.definition)};if(s instanceof se)return{type:"RepetitionMandatory",idx:s.idx,definition:e(s.definition)};if(s instanceof ne)return{type:"RepetitionMandatoryWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof J)return{type:"RepetitionWithSeparator",idx:s.idx,separator:at(new k({terminalType:s.separator})),definition:e(s.definition)};if(s instanceof x)return{type:"Repetition",idx:s.idx,definition:e(s.definition)};if(s instanceof Z)return{type:"Alternation",idx:s.idx,definition:e(s.definition)};if(s instanceof k){const t={type:"Terminal",name:s.terminalType.name,label:Ki(s.terminalType),idx:s.idx};typeof s.label=="string"&&(t.terminalLabel=s.label);const n=s.terminalType.PATTERN;return s.terminalType.PATTERN&&(t.pattern=n instanceof RegExp?n.source:n),t}else{if(s instanceof _e)return{type:"Rule",name:s.name,orgText:s.orgText,definition:e(s.definition)};throw Error("non exhaustive match")}}}function ie(s){return Object.fromEntries(Object.entries(s).filter(([,e])=>e!==void 0))}class Me{visit(e){const t=e;switch(t.constructor){case K:return this.visitNonTerminal(t);case W:return this.visitAlternative(t);case G:return this.visitOption(t);case se:return this.visitRepetitionMandatory(t);case ne:return this.visitRepetitionMandatoryWithSeparator(t);case J:return this.visitRepetitionWithSeparator(t);case x:return this.visitRepetition(t);case Z:return this.visitAlternation(t);case k:return this.visitTerminal(t);case _e:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Hi(s){return s instanceof W||s instanceof G||s instanceof x||s instanceof se||s instanceof ne||s instanceof J||s instanceof k||s instanceof _e}function Tt(s,e=[]){return s instanceof G||s instanceof x||s instanceof J?!0:s instanceof Z?s.definition.some(n=>Tt(n,e)):s instanceof K&&e.includes(s)?!1:s instanceof te?(s instanceof K&&e.push(s),s.definition.every(n=>Tt(n,e))):!1}function Xi(s){return s instanceof Z}function ee(s){if(s instanceof K)return"SUBRULE";if(s instanceof G)return"OPTION";if(s instanceof Z)return"OR";if(s instanceof se)return"AT_LEAST_ONE";if(s instanceof ne)return"AT_LEAST_ONE_SEP";if(s instanceof J)return"MANY_SEP";if(s instanceof x)return"MANY";if(s instanceof k)return"CONSUME";throw Error("non exhaustive match")}class kt{walk(e,t=[]){e.definition.forEach((n,i)=>{const a=e.definition.slice(i+1);if(n instanceof K)this.walkProdRef(n,a,t);else if(n instanceof k)this.walkTerminal(n,a,t);else if(n instanceof W)this.walkFlat(n,a,t);else if(n instanceof G)this.walkOption(n,a,t);else if(n instanceof se)this.walkAtLeastOne(n,a,t);else if(n instanceof ne)this.walkAtLeastOneSep(n,a,t);else if(n instanceof J)this.walkManySep(n,a,t);else if(n instanceof x)this.walkMany(n,a,t);else if(n instanceof Z)this.walkOr(n,a,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,n){}walkProdRef(e,t,n){}walkFlat(e,t,n){const i=t.concat(n);this.walk(e,i)}walkOption(e,t,n){const i=t.concat(n);this.walk(e,i)}walkAtLeastOne(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkAtLeastOneSep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkMany(e,t,n){const i=[new G({definition:e.definition})].concat(t,n);this.walk(e,i)}walkManySep(e,t,n){const i=ys(e,t,n);this.walk(e,i)}walkOr(e,t,n){const i=t.concat(n);e.definition.forEach(a=>{const r=new W({definition:[a]});this.walk(r,i)})}}function ys(s,e,t){return[new G({definition:[new k({terminalType:s.separator})].concat(s.definition)})].concat(e,t)}function qe(s){if(s instanceof K)return qe(s.referencedRule);if(s instanceof k)return Ji(s);if(Hi(s))return Yi(s);if(Xi(s))return qi(s);throw Error("non exhaustive match")}function Yi(s){let e=[];const t=s.definition;let n=0,i=t.length>n,a,r=!0;for(;i&&r;)a=t[n],r=Tt(a),e=e.concat(qe(a)),n=n+1,i=t.length>n;return[...new Set(e)]}function qi(s){const e=s.definition.map(t=>qe(t));return[...new Set(e.flat())]}function Ji(s){return[s.terminalType]}const an="_~IN~_";class Zi extends kt{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,n){}walkProdRef(e,t,n){const i=ea(e.referencedRule,e.idx)+this.topProd.name,a=t.concat(n),r=new W({definition:a}),o=qe(r);this.follows[i]=o}}function Qi(s){const e={};return s.forEach(t=>{const n=new Zi(t).startWalking();Object.assign(e,n)}),e}function ea(s,e){return s.name+e+an}function y(s){return s.charCodeAt(0)}function Pt(s,e){Array.isArray(s)?s.forEach(function(t){e.push(t)}):e.push(s)}function Fe(s,e){if(s[e]===!0)throw"duplicate flag "+e;s[e],s[e]=!0}function Se(s){if(s===void 0)throw Error("Internal Error - Should never get here!");return!0}function ta(){throw Error("Internal Error - Should never get here!")}function Rs(s){return s.type==="Character"}const gt=[];for(let s=y("0");s<=y("9");s++)gt.push(s);const At=[y("_")].concat(gt);for(let s=y("a");s<=y("z");s++)At.push(s);for(let s=y("A");s<=y("Z");s++)At.push(s);const Os=[y(" "),y("\f"),y(`
|
|
2
2
|
`),y("\r"),y(" "),y("\v"),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y(" "),y("\u2028"),y("\u2029"),y(" "),y(" "),y(" "),y("\uFEFF")],sa=/[0-9a-fA-F]/,tt=/[0-9]/,na=/[1-9]/;class ia{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const n={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Fe(n,"global");break;case"i":Fe(n,"ignoreCase");break;case"m":Fe(n,"multiLine");break;case"u":Fe(n,"unicode");break;case"y":Fe(n,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:n,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break;case"<":{switch(this.popChar()){case"=":t="Lookbehind";break;case"!":t="NegativeLookbehind"}break}}Se(t);const n=this.disjunction();return this.consumeChar(")"),{type:t,value:n,loc:this.loc(e)}}return ta()}quantifier(e=!1){let t;const n=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let a;this.isDigit()?(a=this.integerIncludingZero(),t={atLeast:i,atMost:a}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;Se(t);break}if(!(e===!0&&t===void 0)&&Se(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(n),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),Se(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[y(`
|
|
3
3
|
`),y("\r"),y("\u2028"),y("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=gt;break;case"D":e=gt,t=!0;break;case"s":e=Os;break;case"S":e=Os,t=!0;break;case"w":e=At;break;case"W":e=At,t=!0;break}if(Se(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=y("\f");break;case"n":e=y(`
|
|
4
4
|
`);break;case"r":e=y("\r");break;case"t":e=y(" ");break;case"v":e=y("\v");break}if(Se(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:y("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:y(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
|
@@ -367,4 +367,4 @@ ${t?"":`
|
|
|
367
367
|
fill: ${s.mainBkg};
|
|
368
368
|
stroke: ${s.lineColor};
|
|
369
369
|
}
|
|
370
|
-
`},"getStyles"),El=ml,
|
|
370
|
+
`},"getStyles"),El=ml,Rl={parser:nl,db:It,renderer:dl,styles:El};export{Rl as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b9 as Kt,s as Wt,g as Ht,q as Yt,p as Xt,a as Zt,b as Jt,_ as S,K as St,P as Qt,as as $t,a0 as te,a1 as ee,a2 as ne,d as se,z as ie,M as re,N as oe}from"./mermaid.core-D_Dp_Kl2.js";import{s as rt}from"./index-BKxAxaVG.js";const kt=(t,n)=>Kt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=W(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(W(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const N=f.slice();return N.fx=f.fx,N.id=f.id,N});x.sort((f,N)=>f.id-N.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(J(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)J(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(J(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)J(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{J(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);J(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,W(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,W(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const N=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&N.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>N.has(C)));let k={},D={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,h),D=Lt(k,f,M)}const X={};f.forEach(I=>{I.label&&(X[I.sets]=I.label)});function G(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const H=I.sets.map(Q=>{let K=V[Q],Y=k[Q];return K||(K={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:K.x*(1-C)+Y.x*C,y:K.y*(1-C)+Y.y*C,radius:K.radius*(1-C)+Y.radius*C}});return wt(H,y)}}const R=B.selectAll(".venn-area").data(f,I=>I.sets),O=R.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=O.append("path"),L=O.append("text").attr("class","label").text(I=>G(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const F=_.selectAll("text").filter(I=>I.sets in D).text(I=>G(I)).attr("x",I=>Math.floor(D[I.sets].x)).attr("y",I=>Math.floor(D[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,G)):F.each("end",ot(k,G)):F.each(ot(k,G)));const A=P(R.exit()).remove();typeof R.transition=="function"&&A.selectAll("path").attrTween("d",q);const Z=A.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),F.style("font-size",p),Z.style("font-size","0px")),{circles:k,textCentres:D,nodes:R,enter:O,update:_,exit:A}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(W(l,a)>a.radius){h=!1;break}for(const a of n)if(W(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=W(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
|
|
1
|
+
import{b9 as Kt,s as Wt,g as Ht,q as Yt,p as Xt,a as Zt,b as Jt,_ as S,K as St,P as Qt,as as $t,a0 as te,a1 as ee,a2 as ne,d as se,z as ie,M as re,N as oe}from"./mermaid.core-knGXJfjz.js";import{s as rt}from"./main-B_0jS_Gz.js";import"./modulepreload-polyfill-B5Qt9EMX.js";const kt=(t,n)=>Kt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=W(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(W(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>W(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function W(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=W(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const N=f.slice();return N.fx=f.fx,N.id=f.id,N});x.sort((f,N)=>f.id-N.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(J(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)J(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(J(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)J(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{J(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);J(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,W(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Ct(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,W(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&W(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;W(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=Ft(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const N=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&N.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>N.has(C)));let k={},D={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Dt(I,o,d)),k=Nt(I,s,e,i,h),D=Lt(k,f,M)}const X={};f.forEach(I=>{I.label&&(X[I.sets]=I.label)});function G(I){if(I.sets in X)return X[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const H=I.sets.map(Q=>{let K=V[Q],Y=k[Q];return K||(K={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:K.x*(1-C)+Y.x*C,y:K.y*(1-C)+Y.y*C,radius:K.radius*(1-C)+Y.radius*C}});return wt(H,y)}}const R=B.selectAll(".venn-area").data(f,I=>I.sets),O=R.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),j=O.append("path"),L=O.append("text").attr("class","label").text(I=>G(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(j.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const F=_.selectAll("text").filter(I=>I.sets in D).text(I=>G(I)).attr("x",I=>Math.floor(D[I.sets].x)).attr("y",I=>Math.floor(D[I.sets].y));u&&(z?"on"in F?F.on("end",ot(k,G)):F.each("end",ot(k,G)):F.each(ot(k,G)));const A=P(R.exit()).remove();typeof R.transition=="function"&&A.selectAll("path").attrTween("d",q);const Z=A.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),F.style("font-size",p),Z.style("font-size","0px")),{circles:k,textCentres:D,nodes:R,enter:O,update:_,exit:A}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Ct:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-W(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-W(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=W(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function jt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(W(l,a)>a.radius){h=!1;break}for(const a of n)if(W(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?jt(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=W(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=jt(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
|
|
2
2
|
M`,t,n),e.push(`
|
|
3
3
|
m`,-s,0),e.push(`
|
|
4
4
|
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
@@ -31,4 +31,4 @@ Expecting `+K.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on
|
|
|
31
31
|
font-family: ${t.fontFamily};
|
|
32
32
|
color: ${t.vennSetTextColor};
|
|
33
33
|
}
|
|
34
|
-
`,"getStyles"),Ve=Be;function qt(t){const n=new Map;for(const s of t){const e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}S(qt,"buildStyleByKey");var qe=S((t,n,s,e)=>{var V,z,q;const i=e.db,r=(V=i.getConfig)==null?void 0:V.call(i),{themeVariables:o,look:l,handDrawnSeed:h}=St(),u=l==="handDrawn",a=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),p=(z=i.getDiagramTitle)==null?void 0:z.call(i),d=i.getSubsetData(),m=i.getTextData(),y=qt(i.getStyleData()),M=Gt(d),E=(r==null?void 0:r.width)??800,T=(r==null?void 0:r.height)??450,g=E/1600,b=p?48*g:0,v=o.primaryTextColor??o.textColor,c=Qt(n);c.attr("viewBox",`0 0 ${E} ${T}`),p&&c.append("text").text(p).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",o.vennTitleTextColor||o.titleColor);const x=rt(document.createElement("div")),f=ve().width(E).height(T-b);x.datum(M).call(f);const N=u?$t.svg(x.select("svg").node()):void 0,k=we(M,{width:E,height:T-b,padding:(r==null?void 0:r.padding)??15}),D=new Map;for(const R of k){const O=$([...R.data.sets].sort());D.set(O,R)}m.length>0&&Ut(r,D,x,m,g,y);const X=te(o.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(R,O){var Q;const j=rt(this),P=$([...R.sets].sort()),_=y.get(P),F=a.length>0?a[O%a.length]:void 0,A=(_==null?void 0:_.fill)||F||o.primaryColor;j.classed(`venn-set-${O%8}`,!0);const Z=(_==null?void 0:_["fill-opacity"])??.1,I=(_==null?void 0:_.stroke)||A,C=(_==null?void 0:_["stroke-width"])||`${5*g}`;if(u&&N){const K=D.get(P);if(K&&K.circles.length>0){const Y=K.circles[0],U=N.circle(Y.x,Y.y,Y.radius*2,{roughness:.7,seed:h,fill:kt(A,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+O*60,stroke:I,strokeWidth:parseFloat(String(C))});j.select("path").remove(),(Q=j.node())==null||Q.insertBefore(U,j.select("text").node())}}else j.select("path").style("fill",A).style("fill-opacity",Z).style("stroke",I).style("stroke-width",C).style("stroke-opacity",.95);const H=(_==null?void 0:_.color)||(X?ee(A,30):ne(A,30));j.select("text").style("font-size",`${48*g}px`).style("fill",H)}),u&&N?x.selectAll(".venn-intersection").each(function(R){var F;const O=rt(this),L=$([...R.sets].sort()),P=y.get(L),_=P==null?void 0:P.fill;if(_){const A=O.select("path"),Z=A.attr("d");if(Z){const I=N.path(Z,{roughness:.7,seed:h,fill:kt(_,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),C=A.node();(F=C==null?void 0:C.parentNode)==null||F.insertBefore(I,C),A.remove()}}else O.select("path").style("fill-opacity",0);O.select("text").style("font-size",`${48*g}px`).style("fill",(P==null?void 0:P.color)??o.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",R=>{var L;const j=$([...R.sets].sort());return((L=y.get(j))==null?void 0:L.color)??o.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",R=>{var L;const j=$([...R.sets].sort());return(L=y.get(j))!=null&&L.fill?1:0}).style("fill",R=>{var L;const j=$([...R.sets].sort());return((L=y.get(j))==null?void 0:L.fill)??"transparent"}));const G=c.append("g").attr("transform",`translate(0, ${b})`),B=x.select("svg").node();if(B&&"childNodes"in B)for(const R of[...B.childNodes])(q=G.node())==null||q.appendChild(R);se(c,T,E,(r==null?void 0:r.useMaxWidth)??!0)},"draw");function $(t){return t.join("|")}S($,"stableSetsKey");function Ut(t,n,s,e,i,r){var a;const o=(t==null?void 0:t.useDebugLayout)??!1,h=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(const p of e){const d=$(p.sets),m=u.get(d);m?m.push(p):u.set(d,[p])}for(const[p,d]of u.entries()){const m=n.get(p);if(!(m!=null&&m.text))continue;const y=m.text.x,M=m.text.y,E=Math.min(...m.circles.map(V=>V.radius)),T=Math.min(...m.circles.map(V=>V.radius-Math.hypot(y-V.x,M-V.y)));let w=Number.isFinite(T)?Math.max(0,T):0;w===0&&Number.isFinite(E)&&(w=E*.6);const g=h.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);o&&g.append("circle").attr("class","venn-text-debug-circle").attr("cx",y).attr("cy",M).attr("r",w).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const b=Math.max(80*i,w*2*.95),v=Math.max(60*i,w*2*.95),f=(m.data.label&&m.data.label.length>0?Math.min(32*i,w*.25):0)+(d.length<=2?30*i:0),N=y-b/2,k=M-v/2+f,D=Math.max(1,Math.ceil(Math.sqrt(d.length))),X=Math.max(1,Math.ceil(d.length/D)),G=b/D,B=v/X;for(const[V,z]of d.entries()){const q=V%D,R=Math.floor(V/D),O=N+G*(q+.5),j=k+B*(R+.5);o&&g.append("rect").attr("class","venn-text-debug-cell").attr("x",N+G*q).attr("y",k+B*R).attr("width",G).attr("height",B).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const L=G*.9,P=B*.9,_=g.append("foreignObject").attr("class","venn-text-node-fo").attr("width",L).attr("height",P).attr("x",O-L/2).attr("y",j-P/2).attr("overflow","visible"),F=(a=r.get(z.id))==null?void 0:a.color,A=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(z.label??z.id);F&&A.style("color",F)}}}S(Ut,"renderTextNodes");function Gt(t){const n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(const i of t){if(i.sets.length<3)continue;const r=[...i.sets].sort();for(let o=0;o<r.length-1;o++)for(let l=o+1;l<r.length;l++){const h=[r[o],r[l]],u=h.join("|");if(!n.has(u)){n.add(u);const a=s.get(h[0]),p=s.get(h[1]),d=a!==void 0&&p!==void 0?Math.min(a,p)/4:2.5;e.push({sets:h,size:d,label:""})}}}return e.length>0?[...t,...e]:t}S(Gt,"ensurePairwiseSubsets");var Ue={draw:qe},
|
|
34
|
+
`,"getStyles"),Ve=Be;function qt(t){const n=new Map;for(const s of t){const e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}S(qt,"buildStyleByKey");var qe=S((t,n,s,e)=>{var V,z,q;const i=e.db,r=(V=i.getConfig)==null?void 0:V.call(i),{themeVariables:o,look:l,handDrawnSeed:h}=St(),u=l==="handDrawn",a=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),p=(z=i.getDiagramTitle)==null?void 0:z.call(i),d=i.getSubsetData(),m=i.getTextData(),y=qt(i.getStyleData()),M=Gt(d),E=(r==null?void 0:r.width)??800,T=(r==null?void 0:r.height)??450,g=E/1600,b=p?48*g:0,v=o.primaryTextColor??o.textColor,c=Qt(n);c.attr("viewBox",`0 0 ${E} ${T}`),p&&c.append("text").text(p).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",o.vennTitleTextColor||o.titleColor);const x=rt(document.createElement("div")),f=ve().width(E).height(T-b);x.datum(M).call(f);const N=u?$t.svg(x.select("svg").node()):void 0,k=we(M,{width:E,height:T-b,padding:(r==null?void 0:r.padding)??15}),D=new Map;for(const R of k){const O=$([...R.data.sets].sort());D.set(O,R)}m.length>0&&Ut(r,D,x,m,g,y);const X=te(o.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(R,O){var Q;const j=rt(this),P=$([...R.sets].sort()),_=y.get(P),F=a.length>0?a[O%a.length]:void 0,A=(_==null?void 0:_.fill)||F||o.primaryColor;j.classed(`venn-set-${O%8}`,!0);const Z=(_==null?void 0:_["fill-opacity"])??.1,I=(_==null?void 0:_.stroke)||A,C=(_==null?void 0:_["stroke-width"])||`${5*g}`;if(u&&N){const K=D.get(P);if(K&&K.circles.length>0){const Y=K.circles[0],U=N.circle(Y.x,Y.y,Y.radius*2,{roughness:.7,seed:h,fill:kt(A,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+O*60,stroke:I,strokeWidth:parseFloat(String(C))});j.select("path").remove(),(Q=j.node())==null||Q.insertBefore(U,j.select("text").node())}}else j.select("path").style("fill",A).style("fill-opacity",Z).style("stroke",I).style("stroke-width",C).style("stroke-opacity",.95);const H=(_==null?void 0:_.color)||(X?ee(A,30):ne(A,30));j.select("text").style("font-size",`${48*g}px`).style("fill",H)}),u&&N?x.selectAll(".venn-intersection").each(function(R){var F;const O=rt(this),L=$([...R.sets].sort()),P=y.get(L),_=P==null?void 0:P.fill;if(_){const A=O.select("path"),Z=A.attr("d");if(Z){const I=N.path(Z,{roughness:.7,seed:h,fill:kt(_,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),C=A.node();(F=C==null?void 0:C.parentNode)==null||F.insertBefore(I,C),A.remove()}}else O.select("path").style("fill-opacity",0);O.select("text").style("font-size",`${48*g}px`).style("fill",(P==null?void 0:P.color)??o.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",R=>{var L;const j=$([...R.sets].sort());return((L=y.get(j))==null?void 0:L.color)??o.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",R=>{var L;const j=$([...R.sets].sort());return(L=y.get(j))!=null&&L.fill?1:0}).style("fill",R=>{var L;const j=$([...R.sets].sort());return((L=y.get(j))==null?void 0:L.fill)??"transparent"}));const G=c.append("g").attr("transform",`translate(0, ${b})`),B=x.select("svg").node();if(B&&"childNodes"in B)for(const R of[...B.childNodes])(q=G.node())==null||q.appendChild(R);se(c,T,E,(r==null?void 0:r.useMaxWidth)??!0)},"draw");function $(t){return t.join("|")}S($,"stableSetsKey");function Ut(t,n,s,e,i,r){var a;const o=(t==null?void 0:t.useDebugLayout)??!1,h=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(const p of e){const d=$(p.sets),m=u.get(d);m?m.push(p):u.set(d,[p])}for(const[p,d]of u.entries()){const m=n.get(p);if(!(m!=null&&m.text))continue;const y=m.text.x,M=m.text.y,E=Math.min(...m.circles.map(V=>V.radius)),T=Math.min(...m.circles.map(V=>V.radius-Math.hypot(y-V.x,M-V.y)));let w=Number.isFinite(T)?Math.max(0,T):0;w===0&&Number.isFinite(E)&&(w=E*.6);const g=h.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);o&&g.append("circle").attr("class","venn-text-debug-circle").attr("cx",y).attr("cy",M).attr("r",w).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const b=Math.max(80*i,w*2*.95),v=Math.max(60*i,w*2*.95),f=(m.data.label&&m.data.label.length>0?Math.min(32*i,w*.25):0)+(d.length<=2?30*i:0),N=y-b/2,k=M-v/2+f,D=Math.max(1,Math.ceil(Math.sqrt(d.length))),X=Math.max(1,Math.ceil(d.length/D)),G=b/D,B=v/X;for(const[V,z]of d.entries()){const q=V%D,R=Math.floor(V/D),O=N+G*(q+.5),j=k+B*(R+.5);o&&g.append("rect").attr("class","venn-text-debug-cell").attr("x",N+G*q).attr("y",k+B*R).attr("width",G).attr("height",B).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const L=G*.9,P=B*.9,_=g.append("foreignObject").attr("class","venn-text-node-fo").attr("width",L).attr("height",P).attr("x",O-L/2).attr("y",j-P/2).attr("overflow","visible"),F=(a=r.get(z.id))==null?void 0:a.color,A=_.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(z.label??z.id);F&&A.style("color",F)}}}S(Ut,"renderTextNodes");function Gt(t){const n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(const i of t){if(i.sets.length<3)continue;const r=[...i.sets].sort();for(let o=0;o<r.length-1;o++)for(let l=o+1;l<r.length;l++){const h=[r[o],r[l]],u=h.join("|");if(!n.has(u)){n.add(u);const a=s.get(h[0]),p=s.get(h[1]),d=a!==void 0&&p!==void 0?Math.min(a,p)/4:2.5;e.push({sets:h,size:d,label:""})}}}return e.length>0?[...t,...e]:t}S(Gt,"ensurePairwiseSubsets");var Ue={draw:qe},He={parser:Se,db:Pe,renderer:Ue,styles:Ve};export{He as diagram};
|