claude-code-workflow 7.2.10 → 7.2.11
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/.claude/agents/cli-planning-agent.md +3 -0
- package/.claude/agents/debug-explore-agent.md +1 -0
- package/.claude/agents/tdd-developer.md +1 -0
- package/.claude/agents/team-worker.md +1 -1
- package/.claude/agents/test-action-planning-agent.md +3 -0
- package/.claude/agents/test-context-search-agent.md +1 -0
- package/.claude/agents/test-fix-agent.md +3 -0
- package/.claude/skills/review-code/SKILL.md +2 -0
- package/.claude/skills/review-cycle/SKILL.md +4 -0
- package/.claude/skills/skill-simplify/phases/02-optimize.md +4 -0
- package/.claude/skills/spec-generator/phases/05-epics-stories.md +4 -0
- package/.claude/skills/team-arch-opt/specs/team-config.json +5 -5
- package/.claude/skills/team-frontend-debug/roles/analyzer/role.md +3 -2
- package/.claude/skills/team-perf-opt/roles/coordinator/commands/monitor.md +1 -1
- package/.claude/skills/team-perf-opt/specs/team-config.json +5 -5
- package/.claude/skills/team-quality-assurance/roles/executor/role.md +2 -1
- package/.claude/skills/team-review/roles/reviewer/role.md +2 -1
- package/.claude/skills/team-tech-debt/roles/scanner/role.md +2 -1
- package/.claude/skills/team-testing/roles/executor/role.md +2 -1
- package/.claude/skills/team-testing/roles/generator/role.md +2 -1
- package/.claude/skills/team-ultra-analyze/roles/explorer/role.md +2 -1
- package/.claude/skills/team-ux-improve/specs/team-config.json +6 -6
- package/.claude/skills/workflow-execute/phases/06-review.md +4 -4
- package/.claude/skills/workflow-lite-test-review/SKILL.md +2 -0
- package/.claude/skills/workflow-plan/phases/05-plan-verify.md +4 -0
- package/.claude/skills/workflow-tdd-plan/phases/02-context-gathering.md +1 -0
- package/.claude/skills/workflow-tdd-plan/phases/05-tdd-task-generation.md +2 -1
- package/.claude/skills/workflow-test-fix/phases/02-test-context-gather.md +1 -0
- package/.claude/skills/workflow-test-fix/phases/05-test-cycle-execute.md +2 -1
- package/.claude/skills/workflow-tune/SKILL.md +487 -0
- package/.claude/skills/workflow-tune/phases/01-setup.md +548 -0
- package/.claude/skills/workflow-tune/phases/02-step-execute.md +197 -0
- package/.claude/skills/workflow-tune/phases/03-step-analyze.md +386 -0
- package/.claude/skills/workflow-tune/phases/04-synthesize.md +257 -0
- package/.claude/skills/workflow-tune/phases/05-optimize-report.md +246 -0
- package/.claude/skills/workflow-tune/specs/workflow-eval-criteria.md +57 -0
- package/.claude/skills/workflow-tune/templates/step-analysis-prompt.md +88 -0
- package/.claude/skills/workflow-tune/templates/synthesis-prompt.md +90 -0
- package/.codex/skills/analyze-with-file/SKILL.md +2 -0
- package/.codex/skills/debug-with-file/SKILL.md +4 -0
- package/.codex/skills/issue-discover/SKILL.md +1 -0
- package/.codex/skills/review-cycle/phases/02-parallel-review.md +3 -0
- package/.codex/skills/team-designer/agents/validation-reporter.md +186 -0
- package/.codex/skills/team-iterdev/agents/gc-controller.md +193 -0
- package/.codex/skills/team-iterdev/agents/task-analyzer.md +206 -0
- package/.codex/skills/team-lifecycle-v4/agents/quality-gate.md +165 -0
- package/.codex/skills/team-lifecycle-v4/agents/requirement-clarifier.md +163 -0
- package/.codex/skills/team-lifecycle-v4/agents/supervisor.md +182 -0
- package/.codex/skills/team-uidesign/agents/completion-handler.md +177 -0
- package/.codex/skills/team-uidesign/agents/gc-loop-handler.md +162 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/01-test-fix-gen.md +4 -0
- package/.codex/skills/workflow-test-fix-cycle/phases/02-test-cycle-execute.md +2 -0
- package/ccw/dist/commands/spec.d.ts.map +1 -1
- package/ccw/dist/commands/spec.js +9 -4
- package/ccw/dist/commands/spec.js.map +1 -1
- package/ccw/dist/core/routes/codexlens-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens-routes.js +3 -1
- package/ccw/dist/core/routes/codexlens-routes.js.map +1 -1
- package/ccw/dist/tools/spec-index-builder.d.ts +8 -4
- package/ccw/dist/tools/spec-index-builder.d.ts.map +1 -1
- package/ccw/dist/tools/spec-index-builder.js +8 -4
- package/ccw/dist/tools/spec-index-builder.js.map +1 -1
- package/ccw/dist/tools/spec-init.d.ts +1 -1
- package/ccw/dist/tools/spec-init.d.ts.map +1 -1
- package/ccw/dist/tools/spec-init.js +127 -0
- package/ccw/dist/tools/spec-init.js.map +1 -1
- package/ccw/dist/tools/spec-loader.d.ts.map +1 -1
- package/ccw/dist/tools/spec-loader.js +2 -1
- package/ccw/dist/tools/spec-loader.js.map +1 -1
- package/ccw/frontend/dist/assets/{AlertDialog-gTMl4gSG.js → AlertDialog-BW9jiZ-p.js} +2 -2
- package/ccw/frontend/dist/assets/{AlertDialog-gTMl4gSG.js.map → AlertDialog-BW9jiZ-p.js.map} +1 -1
- package/ccw/frontend/dist/assets/{AnalysisPage-Bc4p4SvJ.js → AnalysisPage-ds-w_nVO.js} +2 -2
- package/ccw/frontend/dist/assets/{AnalysisPage-Bc4p4SvJ.js.map → AnalysisPage-ds-w_nVO.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CVK108u2.js → ApiSettingsPage-DlCbXxTz.js} +2 -2
- package/ccw/frontend/dist/assets/{ApiSettingsPage-CVK108u2.js.map → ApiSettingsPage-DlCbXxTz.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliModeToggle-34Sjwl05.js → CliModeToggle-Dq3nL4fF.js} +2 -2
- package/ccw/frontend/dist/assets/{CliModeToggle-34Sjwl05.js.map → CliModeToggle-Dq3nL4fF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliSessionSharePage-bJZAYI38.js → CliSessionSharePage-BNDkEE4u.js} +2 -2
- package/ccw/frontend/dist/assets/{CliSessionSharePage-bJZAYI38.js.map → CliSessionSharePage-BNDkEE4u.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CliViewerPage-VYnQGjxU.js → CliViewerPage-ChM-uNx_.js} +2 -2
- package/ccw/frontend/dist/assets/{CliViewerPage-VYnQGjxU.js.map → CliViewerPage-ChM-uNx_.js.map} +1 -1
- package/ccw/frontend/dist/assets/CodexLensPage-DOcsYNQk.js +2 -0
- package/ccw/frontend/dist/assets/CodexLensPage-DOcsYNQk.js.map +1 -0
- package/ccw/frontend/dist/assets/{Collapsible-B_xd1Qbg.js → Collapsible-CRNbykXN.js} +2 -2
- package/ccw/frontend/dist/assets/{Collapsible-B_xd1Qbg.js.map → Collapsible-CRNbykXN.js.map} +1 -1
- package/ccw/frontend/dist/assets/{CommandsManagerPage-Bjx1bPbH.js → CommandsManagerPage-C2JWcemF.js} +2 -2
- package/ccw/frontend/dist/assets/{CommandsManagerPage-Bjx1bPbH.js.map → CommandsManagerPage-C2JWcemF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{DeepWikiPage-EgHsHvAH.js → DeepWikiPage-CvleOtJy.js} +2 -2
- package/ccw/frontend/dist/assets/{DeepWikiPage-EgHsHvAH.js.map → DeepWikiPage-CvleOtJy.js.map} +1 -1
- package/ccw/frontend/dist/assets/{EndpointsPage-CuwpbCzK.js → EndpointsPage-CMOWQG64.js} +2 -2
- package/ccw/frontend/dist/assets/{EndpointsPage-CuwpbCzK.js.map → EndpointsPage-CMOWQG64.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ExplorerPage-cvlx0Zw0.js → ExplorerPage-DaFPRlNo.js} +2 -2
- package/ccw/frontend/dist/assets/{ExplorerPage-cvlx0Zw0.js.map → ExplorerPage-DaFPRlNo.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FixSessionPage-C74-MPza.js → FixSessionPage-CC4p04Az.js} +2 -2
- package/ccw/frontend/dist/assets/{FixSessionPage-C74-MPza.js.map → FixSessionPage-CC4p04Az.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-x_-6y_n2.js → FloatingFileBrowser-DROn1xZ5.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingFileBrowser-x_-6y_n2.js.map → FloatingFileBrowser-DROn1xZ5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{FloatingPanel-BGwmbJR1.js → FloatingPanel-CmL_yhDv.js} +2 -2
- package/ccw/frontend/dist/assets/{FloatingPanel-BGwmbJR1.js.map → FloatingPanel-CmL_yhDv.js.map} +1 -1
- package/ccw/frontend/dist/assets/{GraphExplorerPage-Bg5-aQxi.js → GraphExplorerPage-DCV5ybKE.js} +2 -2
- package/ccw/frontend/dist/assets/{GraphExplorerPage-Bg5-aQxi.js.map → GraphExplorerPage-DCV5ybKE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HistoryPage-C00fh0HE.js → HistoryPage-D0fYQZgc.js} +2 -2
- package/ccw/frontend/dist/assets/{HistoryPage-C00fh0HE.js.map → HistoryPage-D0fYQZgc.js.map} +1 -1
- package/ccw/frontend/dist/assets/{HookManagerPage-CtVTB_ae.js → HookManagerPage-D2FuJfsM.js} +2 -2
- package/ccw/frontend/dist/assets/{HookManagerPage-CtVTB_ae.js.map → HookManagerPage-D2FuJfsM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{InstallationsPage-CYuMQDbC.js → InstallationsPage-tjklillZ.js} +2 -2
- package/ccw/frontend/dist/assets/{InstallationsPage-CYuMQDbC.js.map → InstallationsPage-tjklillZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{IssueHubPage-T_VSvUMh.js → IssueHubPage-E4JVrhO1.js} +2 -2
- package/ccw/frontend/dist/assets/{IssueHubPage-T_VSvUMh.js.map → IssueHubPage-E4JVrhO1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{LiteTasksPage-DmcgvIvi.js → LiteTasksPage-aJuRoyLt.js} +2 -2
- package/ccw/frontend/dist/assets/{LiteTasksPage-DmcgvIvi.js.map → LiteTasksPage-aJuRoyLt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{McpManagerPage-C_a7QSKz.js → McpManagerPage-BJeuWJv1.js} +2 -2
- package/ccw/frontend/dist/assets/{McpManagerPage-C_a7QSKz.js.map → McpManagerPage-BJeuWJv1.js.map} +1 -1
- package/ccw/frontend/dist/assets/{MemoryPage-CWKmXY5k.js → MemoryPage-BI4FAXhs.js} +2 -2
- package/ccw/frontend/dist/assets/{MemoryPage-CWKmXY5k.js.map → MemoryPage-BI4FAXhs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{NotFoundPage-B1duXK6r.js → NotFoundPage-DD2svchp.js} +2 -2
- package/ccw/frontend/dist/assets/{NotFoundPage-B1duXK6r.js.map → NotFoundPage-DD2svchp.js.map} +1 -1
- package/ccw/frontend/dist/assets/{OrchestratorPage-Ib9TM6HE.js → OrchestratorPage-FC__7yYa.js} +2 -2
- package/ccw/frontend/dist/assets/{OrchestratorPage-Ib9TM6HE.js.map → OrchestratorPage-FC__7yYa.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-sXSWMbF8.js → ProjectOverviewPage-DBB_-FzV.js} +2 -2
- package/ccw/frontend/dist/assets/{ProjectOverviewPage-sXSWMbF8.js.map → ProjectOverviewPage-DBB_-FzV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{PromptHistoryPage-B6jaqG12.js → PromptHistoryPage-BwOAvCH8.js} +2 -2
- package/ccw/frontend/dist/assets/{PromptHistoryPage-B6jaqG12.js.map → PromptHistoryPage-BwOAvCH8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ReviewSessionPage-D5qJyr3s.js → ReviewSessionPage-Dd1-g_gp.js} +2 -2
- package/ccw/frontend/dist/assets/{ReviewSessionPage-D5qJyr3s.js.map → ReviewSessionPage-Dd1-g_gp.js.map} +1 -1
- package/ccw/frontend/dist/assets/{RulesManagerPage-DyawK8QE.js → RulesManagerPage-B3RGdsKD.js} +2 -2
- package/ccw/frontend/dist/assets/{RulesManagerPage-DyawK8QE.js.map → RulesManagerPage-B3RGdsKD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionDetailPage-Cym_RvC9.js → SessionDetailPage-DM-W5R8K.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionDetailPage-Cym_RvC9.js.map → SessionDetailPage-DM-W5R8K.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SessionsPage-Dkc1Hv8W.js → SessionsPage-BVz1KCc7.js} +2 -2
- package/ccw/frontend/dist/assets/{SessionsPage-Dkc1Hv8W.js.map → SessionsPage-BVz1KCc7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SettingsPage-Rik9cUIj.js → SettingsPage-ComW7EZS.js} +4 -4
- package/ccw/frontend/dist/assets/{SettingsPage-Rik9cUIj.js.map → SettingsPage-ComW7EZS.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SkillsManagerPage-BGDWYAyI.js → SkillsManagerPage-CKom9XwV.js} +2 -2
- package/ccw/frontend/dist/assets/{SkillsManagerPage-BGDWYAyI.js.map → SkillsManagerPage-CKom9XwV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-CTiA1DMP.js → SpecsSettingsPage-DQz7WP2s.js} +2 -2
- package/ccw/frontend/dist/assets/{SpecsSettingsPage-CTiA1DMP.js.map → SpecsSettingsPage-DQz7WP2s.js.map} +1 -1
- package/ccw/frontend/dist/assets/{Switch-BgAFC-Wk.js → Switch-BPMdND9H.js} +2 -2
- package/ccw/frontend/dist/assets/{Switch-BgAFC-Wk.js.map → Switch-BPMdND9H.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TabsNavigation-drSnu5jn.js → TabsNavigation-qqt70VYL.js} +2 -2
- package/ccw/frontend/dist/assets/{TabsNavigation-drSnu5jn.js.map → TabsNavigation-qqt70VYL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TaskDrawer-ePC__6-P.js → TaskDrawer-BqK_qiHX.js} +2 -2
- package/ccw/frontend/dist/assets/{TaskDrawer-ePC__6-P.js.map → TaskDrawer-BqK_qiHX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TeamPage-C6bdFWn8.js → TeamPage-u5_i0Rgh.js} +2 -2
- package/ccw/frontend/dist/assets/{TeamPage-C6bdFWn8.js.map → TeamPage-u5_i0Rgh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-Zofi_DZM.js → TerminalDashboardPage-rUtC9e40.js} +2 -2
- package/ccw/frontend/dist/assets/{TerminalDashboardPage-Zofi_DZM.js.map → TerminalDashboardPage-rUtC9e40.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-Bza1KlB9.js → archive-C3u8YNQF.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-Bza1KlB9.js.map → archive-C3u8YNQF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{archive-restore-CpsDm-cG.js → archive-restore-DfQ998g5.js} +2 -2
- package/ccw/frontend/dist/assets/{archive-restore-CpsDm-cG.js.map → archive-restore-DfQ998g5.js.map} +1 -1
- package/ccw/frontend/dist/assets/{arrow-right-CibG_LVO.js → arrow-right-BshJM9Po.js} +2 -2
- package/ccw/frontend/dist/assets/{arrow-right-CibG_LVO.js.map → arrow-right-BshJM9Po.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bookmark-plus-BheO8EgG.js → bookmark-plus-D03qJyOZ.js} +2 -2
- package/ccw/frontend/dist/assets/{bookmark-plus-BheO8EgG.js.map → bookmark-plus-D03qJyOZ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{bot-BlhM0Nl0.js → bot-CyzWuwq0.js} +2 -2
- package/ccw/frontend/dist/assets/{bot-BlhM0Nl0.js.map → bot-CyzWuwq0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{braces-Dqjg_eCO.js → braces-BPgtyjsG.js} +2 -2
- package/ccw/frontend/dist/assets/{braces-Dqjg_eCO.js.map → braces-BPgtyjsG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{circle-stop-DYZSLYU0.js → circle-stop-Dix1AOmw.js} +2 -2
- package/ccw/frontend/dist/assets/{circle-stop-DYZSLYU0.js.map → circle-stop-Dix1AOmw.js.map} +1 -1
- package/ccw/frontend/dist/assets/{cpu-DWCyAOAv.js → cpu-CCQ4Q0Zh.js} +2 -2
- package/ccw/frontend/dist/assets/{cpu-DWCyAOAv.js.map → cpu-CCQ4Q0Zh.js.map} +1 -1
- package/ccw/frontend/dist/assets/{ellipsis-vertical-DIyoSEHx.js → ellipsis-vertical-BpTysg-Y.js} +2 -2
- package/ccw/frontend/dist/assets/{ellipsis-vertical-DIyoSEHx.js.map → ellipsis-vertical-BpTysg-Y.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-DUy7aLEx.js → eye-DGY1rAZs.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-DUy7aLEx.js.map → eye-DGY1rAZs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{eye-off-CGRUVRDR.js → eye-off-D8t3JfWG.js} +2 -2
- package/ccw/frontend/dist/assets/{eye-off-CGRUVRDR.js.map → eye-off-D8t3JfWG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-json-BxLBtU9d.js → file-json-BAdJb0n8.js} +2 -2
- package/ccw/frontend/dist/assets/{file-json-BxLBtU9d.js.map → file-json-BAdJb0n8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{file-text-BoHsW2es.js → file-text-DrJFiOUB.js} +2 -2
- package/ccw/frontend/dist/assets/{file-text-BoHsW2es.js.map → file-text-DrJFiOUB.js.map} +1 -1
- package/ccw/frontend/dist/assets/{filter-B4vOqP6B.js → filter-CKqzYbz7.js} +2 -2
- package/ccw/frontend/dist/assets/{filter-B4vOqP6B.js.map → filter-CKqzYbz7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{folder-BKhwCNFG.js → folder-CV8511y9.js} +2 -2
- package/ccw/frontend/dist/assets/{folder-BKhwCNFG.js.map → folder-CV8511y9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{gauge-Dgf64gkT.js → gauge-XKvmu_uU.js} +2 -2
- package/ccw/frontend/dist/assets/{gauge-Dgf64gkT.js.map → gauge-XKvmu_uU.js.map} +1 -1
- package/ccw/frontend/dist/assets/{globe-Cus_S6Ux.js → globe-C56cDUzX.js} +2 -2
- package/ccw/frontend/dist/assets/{globe-Cus_S6Ux.js.map → globe-C56cDUzX.js.map} +1 -1
- package/ccw/frontend/dist/assets/{grid-3x3-DM08hpAN.js → grid-3x3-Bya-suFW.js} +2 -2
- package/ccw/frontend/dist/assets/{grid-3x3-DM08hpAN.js.map → grid-3x3-Bya-suFW.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hard-drive-eCtll84F.js → hard-drive-CmuTZpsB.js} +2 -2
- package/ccw/frontend/dist/assets/{hard-drive-eCtll84F.js.map → hard-drive-CmuTZpsB.js.map} +1 -1
- package/ccw/frontend/dist/assets/{hash-Bd1RD285.js → hash-CRPT_tJQ.js} +2 -2
- package/ccw/frontend/dist/assets/{hash-Bd1RD285.js.map → hash-CRPT_tJQ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{history-eyyCQA6b.js → history-C1pJZQCL.js} +2 -2
- package/ccw/frontend/dist/assets/{history-eyyCQA6b.js.map → history-C1pJZQCL.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-ZnmWxcZg.js → index-B6TpijCe.js} +2 -2
- package/ccw/frontend/dist/assets/{index-ZnmWxcZg.js.map → index-B6TpijCe.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-b2C0iFd1.js → index-Bcq-7r6F.js} +2 -2
- package/ccw/frontend/dist/assets/{index-b2C0iFd1.js.map → index-Bcq-7r6F.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-Cs2ShCCy.js → index-CI8-rBff.js} +2 -2
- package/ccw/frontend/dist/assets/{index-Cs2ShCCy.js.map → index-CI8-rBff.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-CY6Lueph.js → index-Dmt9OiEf.js} +2 -2
- package/ccw/frontend/dist/assets/{index-CY6Lueph.js.map → index-Dmt9OiEf.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-DfeBbFXo.js → index-anSMmEF8.js} +2 -2
- package/ccw/frontend/dist/assets/{index-DfeBbFXo.js.map → index-anSMmEF8.js.map} +1 -1
- package/ccw/frontend/dist/assets/{index-B6I7GQC5.js → index-dWT2M6Ef.js} +4 -4
- package/ccw/frontend/dist/assets/{index-B6I7GQC5.js.map → index-dWT2M6Ef.js.map} +1 -1
- package/ccw/frontend/dist/assets/{layout-grid-ChrTrCby.js → layout-grid-TSO0BFQE.js} +2 -2
- package/ccw/frontend/dist/assets/{layout-grid-ChrTrCby.js.map → layout-grid-TSO0BFQE.js.map} +1 -1
- package/ccw/frontend/dist/assets/{lightbulb-CvXiTlzN.js → lightbulb-Caj6fIQD.js} +2 -2
- package/ccw/frontend/dist/assets/{lightbulb-CvXiTlzN.js.map → lightbulb-Caj6fIQD.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-2-W0Nl17ec.js → link-2-DE9lMxa-.js} +2 -2
- package/ccw/frontend/dist/assets/{link-2-W0Nl17ec.js.map → link-2-DE9lMxa-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{link-CL4JmoHb.js → link-BZtPgLW0.js} +2 -2
- package/ccw/frontend/dist/assets/{link-CL4JmoHb.js.map → link-BZtPgLW0.js.map} +1 -1
- package/ccw/frontend/dist/assets/{list-CDmYFcio.js → list-DubWyY-U.js} +2 -2
- package/ccw/frontend/dist/assets/{list-CDmYFcio.js.map → list-DubWyY-U.js.map} +1 -1
- package/ccw/frontend/dist/assets/{map-pin-0Mfsw_3d.js → map-pin-DwN_48AF.js} +2 -2
- package/ccw/frontend/dist/assets/{map-pin-0Mfsw_3d.js.map → map-pin-DwN_48AF.js.map} +1 -1
- package/ccw/frontend/dist/assets/{messages-square-C6h08ple.js → messages-square-bjxvaiM9.js} +2 -2
- package/ccw/frontend/dist/assets/{messages-square-C6h08ple.js.map → messages-square-bjxvaiM9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{minimize-2-Cbu2yRzi.js → minimize-2-CGfBKD_V.js} +2 -2
- package/ccw/frontend/dist/assets/{minimize-2-Cbu2yRzi.js.map → minimize-2-CGfBKD_V.js.map} +1 -1
- package/ccw/frontend/dist/assets/{package-CoLVUZGJ.js → package-nzWY6ilt.js} +2 -2
- package/ccw/frontend/dist/assets/{package-CoLVUZGJ.js.map → package-nzWY6ilt.js.map} +1 -1
- package/ccw/frontend/dist/assets/{plug-BYTYqsw1.js → plug-CiLce49C.js} +2 -2
- package/ccw/frontend/dist/assets/{plug-BYTYqsw1.js.map → plug-CiLce49C.js.map} +1 -1
- package/ccw/frontend/dist/assets/{power-DmIojFl-.js → power-CFLmB-U9.js} +2 -2
- package/ccw/frontend/dist/assets/{power-DmIojFl-.js.map → power-CFLmB-U9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{save-BFa03OnG.js → save-DuO6OF0C.js} +2 -2
- package/ccw/frontend/dist/assets/{save-BFa03OnG.js.map → save-DuO6OF0C.js.map} +1 -1
- package/ccw/frontend/dist/assets/{send-Vet3sN4J.js → send-CZk9p0mM.js} +2 -2
- package/ccw/frontend/dist/assets/{send-Vet3sN4J.js.map → send-CZk9p0mM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-check-big-B9nzZRfE.js → square-check-big-BY_1YQQg.js} +2 -2
- package/ccw/frontend/dist/assets/{square-check-big-B9nzZRfE.js.map → square-check-big-BY_1YQQg.js.map} +1 -1
- package/ccw/frontend/dist/assets/{square-pen-C7K13x4Z.js → square-pen-CnZgm6g-.js} +2 -2
- package/ccw/frontend/dist/assets/{square-pen-C7K13x4Z.js.map → square-pen-CnZgm6g-.js.map} +1 -1
- package/ccw/frontend/dist/assets/{star-BCQHcnSe.js → star-Cn1F0qy7.js} +2 -2
- package/ccw/frontend/dist/assets/{star-BCQHcnSe.js.map → star-Cn1F0qy7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{style-CJsrp48L.js → style-Dxs1iXCV.js} +2 -2
- package/ccw/frontend/dist/assets/{style-CJsrp48L.js.map → style-Dxs1iXCV.js.map} +1 -1
- package/ccw/frontend/dist/assets/{target-CBzCJCB1.js → target-Bz1fLRKH.js} +2 -2
- package/ccw/frontend/dist/assets/{target-CBzCJCB1.js.map → target-Bz1fLRKH.js.map} +1 -1
- package/ccw/frontend/dist/assets/{test-tube-BYTc5mvQ.js → test-tube-C6qCYlDr.js} +2 -2
- package/ccw/frontend/dist/assets/{test-tube-BYTc5mvQ.js.map → test-tube-C6qCYlDr.js.map} +1 -1
- package/ccw/frontend/dist/assets/{upload-DzyQj7ib.js → upload-C71kd4Qs.js} +2 -2
- package/ccw/frontend/dist/assets/{upload-DzyQj7ib.js.map → upload-C71kd4Qs.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useApiSettings-CFPww7gU.js → useApiSettings-CqP2BAJ7.js} +2 -2
- package/ccw/frontend/dist/assets/{useApiSettings-CFPww7gU.js.map → useApiSettings-CqP2BAJ7.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCli-ByL_a5CD.js → useCli-PCoPoVeM.js} +2 -2
- package/ccw/frontend/dist/assets/{useCli-ByL_a5CD.js.map → useCli-PCoPoVeM.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useCommands-BvKIoOzB.js → useCommands-3OfPQPw4.js} +2 -2
- package/ccw/frontend/dist/assets/{useCommands-BvKIoOzB.js.map → useCommands-3OfPQPw4.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useDebounce-CmKmoP7n.js → useDebounce-bXiFhQx9.js} +2 -2
- package/ccw/frontend/dist/assets/{useDebounce-CmKmoP7n.js.map → useDebounce-bXiFhQx9.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useFileExplorer-G5UoArCU.js → useFileExplorer-DEyUm46_.js} +2 -2
- package/ccw/frontend/dist/assets/{useFileExplorer-G5UoArCU.js.map → useFileExplorer-DEyUm46_.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useLocale-D2iHK44M.js → useLocale-sXTrdxcJ.js} +2 -2
- package/ccw/frontend/dist/assets/{useLocale-D2iHK44M.js.map → useLocale-sXTrdxcJ.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSkills-CYU4zqhm.js → useSkills-D0W0kXYm.js} +3 -3
- package/ccw/frontend/dist/assets/{useSkills-CYU4zqhm.js.map → useSkills-D0W0kXYm.js.map} +1 -1
- package/ccw/frontend/dist/assets/{useSystemSettings-JznNpij7.js → useSystemSettings-DZ-8lZsG.js} +2 -2
- package/ccw/frontend/dist/assets/{useSystemSettings-JznNpij7.js.map → useSystemSettings-DZ-8lZsG.js.map} +1 -1
- package/ccw/frontend/dist/assets/{wand-sparkles-DqS0VCeN.js → wand-sparkles-83GmAYuw.js} +2 -2
- package/ccw/frontend/dist/assets/{wand-sparkles-DqS0VCeN.js.map → wand-sparkles-83GmAYuw.js.map} +1 -1
- package/ccw/frontend/dist/index.html +1 -1
- package/package.json +1 -1
- package/.claude/skills/team-arch-opt/role-specs/analyzer.md +0 -80
- package/.claude/skills/team-arch-opt/role-specs/designer.md +0 -118
- package/.claude/skills/team-arch-opt/role-specs/refactorer.md +0 -106
- package/.claude/skills/team-arch-opt/role-specs/reviewer.md +0 -116
- package/.claude/skills/team-arch-opt/role-specs/validator.md +0 -117
- package/.claude/skills/team-brainstorm/role-specs/challenger.md +0 -63
- package/.claude/skills/team-brainstorm/role-specs/evaluator.md +0 -58
- package/.claude/skills/team-brainstorm/role-specs/ideator.md +0 -71
- package/.claude/skills/team-brainstorm/role-specs/synthesizer.md +0 -59
- package/.claude/skills/team-frontend/role-specs/analyst.md +0 -91
- package/.claude/skills/team-frontend/role-specs/architect.md +0 -85
- package/.claude/skills/team-frontend/role-specs/developer.md +0 -92
- package/.claude/skills/team-frontend/role-specs/qa.md +0 -78
- package/.claude/skills/team-issue/role-specs/explorer.md +0 -95
- package/.claude/skills/team-issue/role-specs/implementer.md +0 -89
- package/.claude/skills/team-issue/role-specs/integrator.md +0 -86
- package/.claude/skills/team-issue/role-specs/planner.md +0 -83
- package/.claude/skills/team-issue/role-specs/reviewer.md +0 -89
- package/.claude/skills/team-iterdev/role-specs/architect.md +0 -64
- package/.claude/skills/team-iterdev/role-specs/developer.md +0 -73
- package/.claude/skills/team-iterdev/role-specs/reviewer.md +0 -65
- package/.claude/skills/team-iterdev/role-specs/tester.md +0 -87
- package/.claude/skills/team-perf-opt/role-specs/benchmarker.md +0 -110
- package/.claude/skills/team-perf-opt/role-specs/optimizer.md +0 -102
- package/.claude/skills/team-perf-opt/role-specs/profiler.md +0 -73
- package/.claude/skills/team-perf-opt/role-specs/reviewer.md +0 -91
- package/.claude/skills/team-perf-opt/role-specs/strategist.md +0 -114
- package/.claude/skills/team-planex/role-specs/executor.md +0 -90
- package/.claude/skills/team-planex/role-specs/planner.md +0 -110
- package/.claude/skills/team-quality-assurance/role-specs/analyst.md +0 -79
- package/.claude/skills/team-quality-assurance/role-specs/executor.md +0 -64
- package/.claude/skills/team-quality-assurance/role-specs/generator.md +0 -67
- package/.claude/skills/team-quality-assurance/role-specs/scout.md +0 -66
- package/.claude/skills/team-quality-assurance/role-specs/strategist.md +0 -70
- package/.claude/skills/team-review/role-specs/fixer.md +0 -75
- package/.claude/skills/team-review/role-specs/reviewer.md +0 -66
- package/.claude/skills/team-review/role-specs/scanner.md +0 -70
- package/.claude/skills/team-roadmap-dev/role-specs/executor.md +0 -71
- package/.claude/skills/team-roadmap-dev/role-specs/planner.md +0 -77
- package/.claude/skills/team-roadmap-dev/role-specs/verifier.md +0 -73
- package/.claude/skills/team-tech-debt/role-specs/assessor.md +0 -70
- package/.claude/skills/team-tech-debt/role-specs/executor.md +0 -80
- package/.claude/skills/team-tech-debt/role-specs/planner.md +0 -71
- package/.claude/skills/team-tech-debt/role-specs/scanner.md +0 -85
- package/.claude/skills/team-tech-debt/role-specs/validator.md +0 -83
- package/.claude/skills/team-testing/role-specs/analyst.md +0 -94
- package/.claude/skills/team-testing/role-specs/executor.md +0 -97
- package/.claude/skills/team-testing/role-specs/generator.md +0 -96
- package/.claude/skills/team-testing/role-specs/strategist.md +0 -82
- package/.claude/skills/team-uidesign/role-specs/designer.md +0 -72
- package/.claude/skills/team-uidesign/role-specs/implementer.md +0 -74
- package/.claude/skills/team-uidesign/role-specs/researcher.md +0 -84
- package/.claude/skills/team-uidesign/role-specs/reviewer.md +0 -70
- package/.claude/skills/team-ux-improve/role-specs/designer.md +0 -191
- package/.claude/skills/team-ux-improve/role-specs/diagnoser.md +0 -110
- package/.claude/skills/team-ux-improve/role-specs/explorer.md +0 -109
- package/.claude/skills/team-ux-improve/role-specs/implementer.md +0 -164
- package/.claude/skills/team-ux-improve/role-specs/scanner.md +0 -117
- package/.claude/skills/team-ux-improve/role-specs/tester.md +0 -163
- package/ccw/frontend/dist/assets/CodexLensPage-My6DnfN6.js +0 -2
- package/ccw/frontend/dist/assets/CodexLensPage-My6DnfN6.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dW as Mt,dX as Yn,dY as jn,dZ as Ps,d_ as Ue,b8 as jo,d$ as $s,aG as Ts,r as D,j as $,bb as zs}from"./index-B6I7GQC5.js";var Wn=180/Math.PI,cn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wo(t,e,n,o,r,i){var s,a,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,u/=a),t*o<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*Wn,skewX:Math.atan(u)*Wn,scaleX:s,scaleY:a}}var he;function Ds(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?cn:Wo(e.a,e.b,e.c,e.d,e.e,e.f)}function Ls(t){return t==null||(he||(he=document.createElementNS("http://www.w3.org/2000/svg","g")),he.setAttribute("transform",t),!(t=he.transform.baseVal.consolidate()))?cn:(t=t.matrix,Wo(t.a,t.b,t.c,t.d,t.e,t.f))}function Go(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,d,c,f,p,g){if(l!==c||d!==f){var y=p.push("translate(",null,e,null,n);g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(d,f)})}else(c||f)&&p.push("translate("+c+e+f+n)}function s(l,d,c,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:c.push(r(c)+"rotate(",null,o)-2,x:Mt(l,d)})):d&&c.push(r(c)+"rotate("+d+o)}function a(l,d,c,f){l!==d?f.push({i:c.push(r(c)+"skewX(",null,o)-2,x:Mt(l,d)}):d&&c.push(r(c)+"skewX("+d+o)}function u(l,d,c,f,p,g){if(l!==c||d!==f){var y=p.push(r(p)+"scale(",null,",",null,")");g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(d,f)})}else(c!==1||f!==1)&&p.push(r(p)+"scale("+c+","+f+")")}return function(l,d){var c=[],f=[];return l=t(l),d=t(d),i(l.translateX,l.translateY,d.translateX,d.translateY,c,f),s(l.rotate,d.rotate,c,f),a(l.skewX,d.skewX,c,f),u(l.scaleX,l.scaleY,d.scaleX,d.scaleY,c,f),l=d=null,function(p){for(var g=-1,y=f.length,x;++g<y;)c[(x=f[g]).i]=x.x(p);return c.join("")}}}var Hs=Go(Ds,"px, ","px)","deg)"),Rs=Go(Ls,", ",")",")"),Vs=1e-12;function Gn(t){return((t=Math.exp(t))+1/t)/2}function Bs(t){return((t=Math.exp(t))-1/t)/2}function Fs(t){return((t=Math.exp(2*t))-1)/(t+1)}const ve=(function t(e,n,o){function r(i,s){var a=i[0],u=i[1],l=i[2],d=s[0],c=s[1],f=s[2],p=d-a,g=c-u,y=p*p+g*g,x,m;if(y<Vs)m=Math.log(f/l)/e,x=function(M){return[a+M*p,u+M*g,l*Math.exp(e*M*m)]};else{var _=Math.sqrt(y),h=(f*f-l*l+o*y)/(2*l*n*_),w=(f*f-l*l-o*y)/(2*f*n*_),N=Math.log(Math.sqrt(h*h+1)-h),b=Math.log(Math.sqrt(w*w+1)-w);m=(b-N)/e,x=function(M){var T=M*m,z=Gn(N),B=l/(n*_)*(z*Fs(e*T+N)-Bs(N));return[a+B*p,u+B*g,l*z/Gn(e*T+N)]}}return x.duration=m*1e3*e/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,u=a*a;return t(s,a,u)},r})(Math.SQRT2,2,4);function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Os={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new _e(n)}function _e(t){this._=t}function Xs(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}_e.prototype=ze.prototype={constructor:_e,on:function(t,e){var n=this._,o=Xs(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Ys(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=qn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=qn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _e(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Ys(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function qn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Os,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var un="http://www.w3.org/1999/xhtml";const Un={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Un.hasOwnProperty(e)?{space:Un[e],local:t}:t}function js(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===un&&e.documentElement.namespaceURI===un?e.createElement(t):e.createElementNS(n,t)}}function Ws(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function qo(t){var e=De(t);return(e.local?Ws:js)(e)}function Gs(){}function vn(t){return t==null?Gs:function(){return this.querySelector(t)}}function qs(t){typeof t!="function"&&(t=vn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),u,l,d=0;d<s;++d)(u=i[d])&&(l=t.call(u,u.__data__,d,i))&&("__data__"in u&&(l.__data__=u.__data__),a[d]=l);return new ct(o,this._parents)}function Us(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ks(){return[]}function Uo(t){return t==null?Ks:function(){return this.querySelectorAll(t)}}function Zs(t){return function(){return Us(t.apply(this,arguments))}}function Qs(t){typeof t=="function"?t=Zs(t):t=Uo(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,u,l=0;l<a;++l)(u=s[l])&&(o.push(t.call(u,u.__data__,l,s)),r.push(u));return new ct(o,r)}function Ko(t){return function(){return this.matches(t)}}function Zo(t){return function(e){return e.matches(t)}}var Js=Array.prototype.find;function ta(t){return function(){return Js.call(this.children,t)}}function ea(){return this.firstElementChild}function na(t){return this.select(t==null?ea:ta(typeof t=="function"?t:Zo(t)))}var oa=Array.prototype.filter;function ra(){return Array.from(this.children)}function ia(t){return function(){return oa.call(this.children,t)}}function sa(t){return this.selectAll(t==null?ra:ia(typeof t=="function"?t:Zo(t)))}function aa(t){typeof t!="function"&&(t=Ko(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&a.push(u);return new ct(o,this._parents)}function Qo(t){return new Array(t.length)}function ca(){return new ct(this._enter||this._groups.map(Qo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function ua(t){return function(){return t}}function la(t,e,n,o,r,i){for(var s=0,a,u=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<u;++s)(a=e[s])&&(r[s]=a)}function fa(t,e,n,o,r,i,s){var a,u,l=new Map,d=e.length,c=i.length,f=new Array(d),p;for(a=0;a<d;++a)(u=e[a])&&(f[a]=p=s.call(u,u.__data__,a,e)+"",l.has(p)?r[a]=u:l.set(p,u));for(a=0;a<c;++a)p=s.call(t,i[a],a,i)+"",(u=l.get(p))?(o[a]=u,u.__data__=i[a],l.delete(p)):n[a]=new Ne(t,i[a]);for(a=0;a<d;++a)(u=e[a])&&l.get(f[a])===u&&(r[a]=u)}function da(t){return t.__data__}function ha(t,e){if(!arguments.length)return Array.from(this,da);var n=e?fa:la,o=this._parents,r=this._groups;typeof t!="function"&&(t=ua(t));for(var i=r.length,s=new Array(i),a=new Array(i),u=new Array(i),l=0;l<i;++l){var d=o[l],c=r[l],f=c.length,p=ga(t.call(d,d&&d.__data__,l,o)),g=p.length,y=a[l]=new Array(g),x=s[l]=new Array(g),m=u[l]=new Array(f);n(d,c,y,x,m,p,e);for(var _=0,h=0,w,N;_<g;++_)if(w=y[_]){for(_>=h&&(h=_+1);!(N=x[h])&&++h<g;);w._next=N||null}}return s=new ct(s,o),s._enter=a,s._exit=u,s}function ga(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function pa(){return new ct(this._exit||this._groups.map(Qo),this._parents)}function ma(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ya(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),u=0;u<s;++u)for(var l=n[u],d=o[u],c=l.length,f=a[u]=new Array(c),p,g=0;g<c;++g)(p=l[g]||d[g])&&(f[g]=p);for(;u<r;++u)a[u]=n[u];return new ct(a,this._parents)}function xa(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function wa(t){t||(t=va);function e(c,f){return c&&f?t(c.__data__,f.__data__):!c-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,u=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(u[d]=l);u.sort(e)}return new ct(r,this._parents).order()}function va(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function _a(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ba(){return Array.from(this)}function Ea(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Sa(){let t=0;for(const e of this)++t;return t}function Na(){return!this.node()}function Ma(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function Ca(t){return function(){this.removeAttribute(t)}}function Ia(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Aa(t,e){return function(){this.setAttribute(t,e)}}function ka(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function $a(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ta(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Ia:Ca:typeof e=="function"?n.local?$a:Pa:n.local?ka:Aa)(n,e))}function Jo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function za(t){return function(){this.style.removeProperty(t)}}function Da(t,e,n){return function(){this.style.setProperty(t,e,n)}}function La(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ha(t,e,n){return arguments.length>1?this.each((e==null?za:typeof e=="function"?La:Da)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Jo(t).getComputedStyle(t,null).getPropertyValue(e)}function Ra(t){return function(){delete this[t]}}function Va(t,e){return function(){this[t]=e}}function Ba(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Fa(t,e){return arguments.length>1?this.each((e==null?Ra:typeof e=="function"?Ba:Va)(t,e)):this.node()[t]}function tr(t){return t.trim().split(/^|\s+/)}function _n(t){return t.classList||new er(t)}function er(t){this._node=t,this._names=tr(t.getAttribute("class")||"")}er.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function nr(t,e){for(var n=_n(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function or(t,e){for(var n=_n(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Oa(t){return function(){nr(this,t)}}function Xa(t){return function(){or(this,t)}}function Ya(t,e){return function(){(e.apply(this,arguments)?nr:or)(this,t)}}function ja(t,e){var n=tr(t+"");if(arguments.length<2){for(var o=_n(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ya:e?Oa:Xa)(n,e))}function Wa(){this.textContent=""}function Ga(t){return function(){this.textContent=t}}function qa(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ua(t){return arguments.length?this.each(t==null?Wa:(typeof t=="function"?qa:Ga)(t)):this.node().textContent}function Ka(){this.innerHTML=""}function Za(t){return function(){this.innerHTML=t}}function Qa(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ja(t){return arguments.length?this.each(t==null?Ka:(typeof t=="function"?Qa:Za)(t)):this.node().innerHTML}function tc(){this.nextSibling&&this.parentNode.appendChild(this)}function ec(){return this.each(tc)}function nc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oc(){return this.each(nc)}function rc(t){var e=typeof t=="function"?t:qo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ic(){return null}function sc(t,e){var n=typeof t=="function"?t:qo(t),o=e==null?ic:typeof e=="function"?e:vn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ac(){var t=this.parentNode;t&&t.removeChild(this)}function cc(){return this.each(ac)}function uc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function fc(t){return this.select(t?lc:uc)}function dc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function hc(t){return function(e){t.call(this,e,this.__data__)}}function gc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function pc(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function mc(t,e,n){return function(){var o=this.__on,r,i=hc(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function yc(t,e,n){var o=gc(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var u=0,l=a.length,d;u<l;++u)for(r=0,d=a[u];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=e?mc:pc,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function rr(t,e,n){var o=Jo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function xc(t,e){return function(){return rr(this,t,e)}}function wc(t,e){return function(){return rr(this,t,e.apply(this,arguments))}}function vc(t,e){return this.each((typeof e=="function"?wc:xc)(t,e))}function*_c(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var ir=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],ir)}function bc(){return this}ct.prototype=se.prototype={constructor:ct,select:qs,selectAll:Qs,selectChild:na,selectChildren:sa,filter:aa,data:ha,enter:ca,exit:pa,join:ma,merge:ya,selection:bc,order:xa,sort:wa,call:_a,nodes:ba,node:Ea,size:Sa,empty:Na,each:Ma,attr:Ta,style:Ha,property:Fa,classed:ja,text:Ua,html:Ja,raise:ec,lower:oc,append:rc,insert:sc,remove:cc,clone:fc,datum:dc,on:yc,dispatch:vc,[Symbol.iterator]:_c};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],ir)}function Ec(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=Ec(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const Sc={passive:!1},Jt={capture:!0,passive:!1};function Ke(t){t.stopImmediatePropagation()}function Lt(t){t.preventDefault(),t.stopImmediatePropagation()}function sr(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Lt,Jt);"onselectstart"in e?n.on("selectstart.drag",Lt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ar(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Lt,Jt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ge=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:u,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Nc(t){return!t.ctrlKey&&!t.button}function Mc(){return this.parentNode}function Cc(t,e){return e??{x:t.x,y:t.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function cr(){var t=Nc,e=Mc,n=Cc,o=Ic,r={},i=ze("start","drag","end"),s=0,a,u,l,d,c=0;function f(w){w.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Sc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,N){if(!(d||!t.call(this,w,N))){var b=h(this,e.call(this,w,N),w,N,"mouse");b&&(at(w.view).on("mousemove.drag",g,Jt).on("mouseup.drag",y,Jt),sr(w.view),Ke(w),l=!1,a=w.clientX,u=w.clientY,b("start",w))}}function g(w){if(Lt(w),!l){var N=w.clientX-a,b=w.clientY-u;l=N*N+b*b>c}r.mouse("drag",w)}function y(w){at(w.view).on("mousemove.drag mouseup.drag",null),ar(w.view,l),Lt(w),r.mouse("end",w)}function x(w,N){if(t.call(this,w,N)){var b=w.changedTouches,M=e.call(this,w,N),T=b.length,z,B;for(z=0;z<T;++z)(B=h(this,M,w,N,b[z].identifier,b[z]))&&(Ke(w),B("start",w,b[z]))}}function m(w){var N=w.changedTouches,b=N.length,M,T;for(M=0;M<b;++M)(T=r[N[M].identifier])&&(Lt(w),T("drag",w,N[M]))}function _(w){var N=w.changedTouches,b=N.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<b;++M)(T=r[N[M].identifier])&&(Ke(w),T("end",w,N[M]))}function h(w,N,b,M,T,z){var B=i.copy(),I=ut(z||b,N),k,H,v;if((v=n.call(w,new ln("beforestart",{sourceEvent:b,target:f,identifier:T,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:B}),M))!=null)return k=v.x-I[0]||0,H=v.y-I[1]||0,function A(S,P,C){var E=I,L;switch(S){case"start":r[T]=A,L=s++;break;case"end":delete r[T],--s;case"drag":I=ut(C||P,N),L=s;break}B.call(S,w,new ln(S,{sourceEvent:P,subject:v,target:f,identifier:T,active:L,x:I[0]+k,y:I[1]+H,dx:I[0]-E[0],dy:I[1]-E[1],dispatch:B}),M)}}return f.filter=function(w){return arguments.length?(t=typeof w=="function"?w:ge(!!w),f):t},f.container=function(w){return arguments.length?(e=typeof w=="function"?w:ge(w),f):e},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:ge(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:ge(!!w),f):o},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(c=(w=+w)*w,f):Math.sqrt(c)},f}var Rt=0,Kt=0,qt=0,ur=1e3,Me,Zt,Ce=0,At=0,Le=0,te=typeof performance=="object"&&performance.now?performance:Date,lr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function bn(){return At||(lr(Ac),At=te.now()+Le)}function Ac(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=fr.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?bn():+n)+(e==null?0:+e),!this._next&&Zt!==this&&(Zt?Zt._next=this:Me=this,Zt=this),this._call=t,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function fr(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function kc(){bn(),++Rt;for(var t=Me,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Kn(){At=(Ce=te.now())+Le,Rt=Kt=0;try{kc()}finally{Rt=0,$c(),At=0}}function Pc(){var t=te.now(),e=t-Ce;e>ur&&(Le-=e,Ce=t)}function $c(){for(var t,e=Me,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Me=n);Zt=t,fn(o)}function fn(t){if(!Rt){Kt&&(Kt=clearTimeout(Kt));var e=t-At;e>24?(t<1/0&&(Kt=setTimeout(Kn,t-te.now()-Le)),qt&&(qt=clearInterval(qt))):(qt||(Ce=te.now(),qt=setInterval(Pc,ur)),Rt=1,lr(Kn))}}function Zn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Tc=ze("start","end","cancel","interrupt"),zc=[],dr=0,Qn=1,dn=2,be=3,Jn=4,hn=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Dc(t,n,{name:e,index:o,group:r,on:Tc,tween:zc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:dr})}function En(t,e){var n=dt(t,e);if(n.state>dr)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=dt(t,e);if(n.state>be)throw new Error("too late; already running");return n}function dt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Dc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=fr(i,0,n.time);function i(l){n.state=Qn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,c,f,p;if(n.state!==Qn)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===be)return Zn(s);p.state===Jn?(p.state=Ee,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[d]):+d<e&&(p.state=Ee,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[d])}if(Zn(function(){n.state===be&&(n.state=Jn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=dn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===dn){for(n.state=be,r=new Array(f=n.tween.length),d=0,c=-1;d<f;++d)(p=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=p);r.length=c+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=hn,1),c=-1,f=r.length;++c<f;)r[c].call(t,d);n.state===hn&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>dn&&o.state<hn,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Lc(t){return this.each(function(){Se(this,t)})}function Hc(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Rc(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},u=0,l=r.length;u<l;++u)if(r[u].name===e){r[u]=a;break}u===l&&r.push(a)}i.tween=r}}function Vc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=dt(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Hc:Rc)(n,t,e))}function Sn(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return dt(r,o).value[e]}}function hr(t,e){var n;return(typeof e=="number"?Mt:e instanceof Yn?jn:(n=Yn(e))?(e=n,jn):Ps)(t,e)}function Bc(t){return function(){this.removeAttribute(t)}}function Fc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Oc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function Xc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Yc(t,e,n){var o,r,i;return function(){var s,a=n(this),u;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=a+"",s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a)))}}function jc(t,e,n){var o,r,i;return function(){var s,a=n(this),u;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=a+"",s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a)))}}function Wc(t,e){var n=De(t),o=n==="transform"?Rs:hr;return this.attrTween(t,typeof e=="function"?(n.local?jc:Yc)(n,o,Sn(this,"attr."+t,e)):e==null?(n.local?Fc:Bc)(n):(n.local?Xc:Oc)(n,o,e))}function Gc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function qc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Uc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&qc(t,i)),n}return r._value=e,r}function Kc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Gc(t,i)),n}return r._value=e,r}function Zc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Uc:Kc)(o,e))}function Qc(t,e){return function(){En(this,t).delay=+e.apply(this,arguments)}}function Jc(t,e){return e=+e,function(){En(this,t).delay=e}}function tu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Qc:Jc)(e,t)):dt(this.node(),e).delay}function eu(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function nu(t,e){return e=+e,function(){gt(this,t).duration=e}}function ou(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?eu:nu)(e,t)):dt(this.node(),e).duration}function ru(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function iu(t){var e=this._id;return arguments.length?this.each(ru(e,t)):dt(this.node(),e).ease}function su(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function au(t){if(typeof t!="function")throw new Error;return this.each(su(this._id,t))}function cu(t){typeof t!="function"&&(t=Ko(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&a.push(u);return new xt(o,this._parents,this._name,this._id)}function uu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var u=e[a],l=n[a],d=u.length,c=s[a]=new Array(d),f,p=0;p<d;++p)(f=u[p]||l[p])&&(c[p]=f);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function lu(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function fu(t,e,n){var o,r,i=lu(e)?En:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function du(t,e){var n=this._id;return arguments.length<2?dt(this.node(),n).on.on(t):this.each(fu(n,t,e))}function hu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function gu(){return this.on("end.remove",hu(this._id))}function pu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=vn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],u=a.length,l=i[s]=new Array(u),d,c,f=0;f<u;++f)(d=a[f])&&(c=t.call(d,d.__data__,f,a))&&("__data__"in d&&(c.__data__=d.__data__),l[f]=c,He(l[f],e,n,f,l,dt(d,n)));return new xt(i,this._parents,e,n)}function mu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Uo(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var u=o[a],l=u.length,d,c=0;c<l;++c)if(d=u[c]){for(var f=t.call(d,d.__data__,c,u),p,g=dt(d,n),y=0,x=f.length;y<x;++y)(p=f[y])&&He(p,e,n,y,f,g);i.push(f),s.push(d)}return new xt(i,s,e,n)}var yu=se.prototype.constructor;function xu(){return new yu(this._groups,this._parents)}function wu(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function gr(t){return function(){this.style.removeProperty(t)}}function vu(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function _u(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),u=a+"";return a==null&&(u=a=(this.style.removeProperty(t),Ht(this,t))),s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a))}}function bu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var u=gt(this,t),l=u.on,d=u.value[i]==null?a||(a=gr(e)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),u.on=o}}function Eu(t,e,n){var o=(t+="")=="transform"?Hs:hr;return e==null?this.styleTween(t,wu(t,o)).on("end.style."+t,gr(t)):typeof e=="function"?this.styleTween(t,_u(t,o,Sn(this,"style."+t,e))).each(bu(this._id,t)):this.styleTween(t,vu(t,o,e),n).on("end.style."+t,null)}function Su(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function Nu(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&Su(t,s,n)),o}return i._value=e,i}function Mu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,Nu(t,e,n??""))}function Cu(t){return function(){this.textContent=t}}function Iu(t){return function(){var e=t(this);this.textContent=e??""}}function Au(t){return this.tween("text",typeof t=="function"?Iu(Sn(this,"text",t)):Cu(t==null?"":t+""))}function ku(t){return function(e){this.textContent=t.call(this,e)}}function Pu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&ku(r)),e}return o._value=t,o}function $u(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Pu(t))}function Tu(){for(var t=this._name,e=this._id,n=pr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,u,l=0;l<a;++l)if(u=s[l]){var d=dt(u,e);He(u,t,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new xt(o,this._parents,t,n)}function zu(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},u={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),d=l.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(u)),l.on=e}),r===0&&i()})}var Du=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function pr(){return++Du}var mt=se.prototype;xt.prototype={constructor:xt,select:pu,selectAll:mu,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:cu,merge:uu,selection:xu,transition:Tu,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:du,attr:Wc,attrTween:Zc,style:Eu,styleTween:Mu,text:Au,textTween:$u,remove:gu,tween:Vc,delay:tu,duration:ou,ease:iu,easeVarying:au,end:zu,[Symbol.iterator]:mt[Symbol.iterator]};function Lu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Hu={time:null,delay:0,duration:250,ease:Lu};function Ru(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Vu(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=pr(),(n=Hu).time=bn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,u,l=0;l<a;++l)(u=s[l])&&He(u,t,e,l,s,n||Ru(u,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Lc;se.prototype.transition=Vu;const pe=t=>()=>t;function Bu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);mr.prototype=yt.prototype;function mr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ze(t){t.stopImmediatePropagation()}function Ut(t){t.preventDefault(),t.stopImmediatePropagation()}function Fu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ou(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function to(){return this.__zoom||Re}function Xu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Yu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ju(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function yr(){var t=Fu,e=Ou,n=ju,o=Xu,r=Yu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,u=ve,l=ze("start","zoom","end"),d,c,f,p=500,g=150,y=0,x=10;function m(v){v.property("__zoom",to).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,S,P){var C=v.selection?v.selection():v;C.property("__zoom",to),v!==C?N(v,A,S,P):C.interrupt().each(function(){b(this,arguments).event(P).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,S,P){m.scaleTo(v,function(){var C=this.__zoom.k,E=typeof A=="function"?A.apply(this,arguments):A;return C*E},S,P)},m.scaleTo=function(v,A,S,P){m.transform(v,function(){var C=e.apply(this,arguments),E=this.__zoom,L=S==null?w(C):typeof S=="function"?S.apply(this,arguments):S,V=E.invert(L),R=typeof A=="function"?A.apply(this,arguments):A;return n(h(_(E,R),L,V),C,s)},S,P)},m.translateBy=function(v,A,S,P){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof S=="function"?S.apply(this,arguments):S),e.apply(this,arguments),s)},null,P)},m.translateTo=function(v,A,S,P,C){m.transform(v,function(){var E=e.apply(this,arguments),L=this.__zoom,V=P==null?w(E):typeof P=="function"?P.apply(this,arguments):P;return n(Re.translate(V[0],V[1]).scale(L.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof S=="function"?-S.apply(this,arguments):-S),E,s)},P,C)};function _(v,A){return A=Math.max(i[0],Math.min(i[1],A)),A===v.k?v:new yt(A,v.x,v.y)}function h(v,A,S){var P=A[0]-S[0]*v.k,C=A[1]-S[1]*v.k;return P===v.x&&C===v.y?v:new yt(v.k,P,C)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,A,S,P){v.on("start.zoom",function(){b(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(P).end()}).tween("zoom",function(){var C=this,E=arguments,L=b(C,E).event(P),V=e.apply(C,E),R=S==null?w(V):typeof S=="function"?S.apply(C,E):S,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),O=C.__zoom,j=typeof A=="function"?A.apply(C,E):A,U=u(O.invert(R).concat(X/O.k),j.invert(R).concat(X/j.k));return function(G){if(G===1)G=j;else{var F=U(G),W=X/F[2];G=new yt(W,R[0]-F[0]*W,R[1]-F[1]*W)}L.zoom(null,G)}})}function b(v,A,S){return!S&&v.__zooming||new M(v,A)}function M(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,A),this.taps=0}M.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var A=at(this.that).datum();l.call(v,this.that,new Bu(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function T(v,...A){if(!t.apply(this,arguments))return;var S=b(this,A).event(v),P=this.__zoom,C=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),E=ut(v);if(S.wheel)(S.mouse[0][0]!==E[0]||S.mouse[0][1]!==E[1])&&(S.mouse[1]=P.invert(S.mouse[0]=E)),clearTimeout(S.wheel);else{if(P.k===C)return;S.mouse=[E,P.invert(E)],Se(this),S.start()}Ut(v),S.wheel=setTimeout(L,g),S.zoom("mouse",n(h(_(P,C),S.mouse[0],S.mouse[1]),S.extent,s));function L(){S.wheel=null,S.end()}}function z(v,...A){if(f||!t.apply(this,arguments))return;var S=v.currentTarget,P=b(this,A,!0).event(v),C=at(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),E=ut(v,S),L=v.clientX,V=v.clientY;sr(v.view),Ze(v),P.mouse=[E,this.__zoom.invert(E)],Se(this),P.start();function R(O){if(Ut(O),!P.moved){var j=O.clientX-L,U=O.clientY-V;P.moved=j*j+U*U>y}P.event(O).zoom("mouse",n(h(P.that.__zoom,P.mouse[0]=ut(O,S),P.mouse[1]),P.extent,s))}function X(O){C.on("mousemove.zoom mouseup.zoom",null),ar(O.view,P.moved),Ut(O),P.event(O).end()}}function B(v,...A){if(t.apply(this,arguments)){var S=this.__zoom,P=ut(v.changedTouches?v.changedTouches[0]:v,this),C=S.invert(P),E=S.k*(v.shiftKey?.5:2),L=n(h(_(S,E),P,C),e.apply(this,A),s);Ut(v),a>0?at(this).transition().duration(a).call(N,L,P,v):at(this).call(m.transform,L,P,v)}}function I(v,...A){if(t.apply(this,arguments)){var S=v.touches,P=S.length,C=b(this,A,v.changedTouches.length===P).event(v),E,L,V,R;for(Ze(v),L=0;L<P;++L)V=S[L],R=ut(V,this),R=[R,this.__zoom.invert(R),V.identifier],C.touch0?!C.touch1&&C.touch0[2]!==R[2]&&(C.touch1=R,C.taps=0):(C.touch0=R,E=!0,C.taps=1+!!d);d&&(d=clearTimeout(d)),E&&(C.taps<2&&(c=R[0],d=setTimeout(function(){d=null},p)),Se(this),C.start())}}function k(v,...A){if(this.__zooming){var S=b(this,A).event(v),P=v.changedTouches,C=P.length,E,L,V,R;for(Ut(v),E=0;E<C;++E)L=P[E],V=ut(L,this),S.touch0&&S.touch0[2]===L.identifier?S.touch0[0]=V:S.touch1&&S.touch1[2]===L.identifier&&(S.touch1[0]=V);if(L=S.that.__zoom,S.touch1){var X=S.touch0[0],O=S.touch0[1],j=S.touch1[0],U=S.touch1[1],G=(G=j[0]-X[0])*G+(G=j[1]-X[1])*G,F=(F=U[0]-O[0])*F+(F=U[1]-O[1])*F;L=_(L,Math.sqrt(G/F)),V=[(X[0]+j[0])/2,(X[1]+j[1])/2],R=[(O[0]+U[0])/2,(O[1]+U[1])/2]}else if(S.touch0)V=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(h(L,V,R),S.extent,s))}}function H(v,...A){if(this.__zooming){var S=b(this,A).event(v),P=v.changedTouches,C=P.length,E,L;for(Ze(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),E=0;E<C;++E)L=P[E],S.touch0&&S.touch0[2]===L.identifier?delete S.touch0:S.touch1&&S.touch1[2]===L.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(L=ut(L,this),Math.hypot(c[0]-L[0],c[1]-L[1])<x)){var V=at(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(u=v,m):u},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,m):Math.sqrt(y)},m.tapDistance=function(v){return arguments.length?(x=+v,m):x},m}const ht={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xr=["Enter"," ","Escape"],wr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const vr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const eo={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function _r(t){return t===null?null:t?"valid":"invalid"}const br=t=>"id"in t&&"source"in t&&"target"in t,Wu=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Nn=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Gu=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):Nn(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},Mn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...le(e,[n,o,r]),width:e.width/r,height:e.height/r},u=[];for(const l of t.values()){const{measured:d,selectable:c=!0,hidden:f=!1}=l;if(s&&!c||f)continue;const p=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,y=oe(a,Ft(l)),x=(p??0)*(g??0),m=i&&y>0;(!l.internals.handleBounds||m||y>=x||l.dragging)&&u.push(l)}return u},qu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Uu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ku({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Uu(t,s),u=ce(a),l=Cn(u,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Er({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:u,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let c=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(c=[[u,l],[u+p,l+g]])}else a&&Ot(s.extent)&&(c=[[s.extent[0][0]+u,s.extent[0][1]+l],[s.extent[1][0]+u,s.extent[1][1]+l]]);const f=Ot(c)?kt(e,c,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:f.x-u+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function Zu({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const p=i.has(f.id),g=!p&&f.parentId&&s.find(y=>y.id===f.parentId);(p||g)&&s.push(f)}const a=new Set(e.map(f=>f.id)),u=o.filter(f=>f.deletable!==!1),d=qu(s,u);for(const f of u)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!r)return{edges:d,nodes:s};const c=await r({nodes:s,edges:d});return typeof c=="boolean"?c?{edges:d,nodes:s}:{edges:[],nodes:[]}:c}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function Sr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const no=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,Nr=(t,e,n=15,o=40)=>{const r=no(t.x,o,e.width-o)*n,i=no(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),gn=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Nn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Nn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},Mr=(t,e)=>Be(Ve(gn(t),gn(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},oo=t=>lt(t.width)&<(t.height)&<(t.x)&<(t.y),lt=t=>!isNaN(t)&&isFinite(t),Qu=(t,e)=>{},ue=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),le=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?ue(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ju(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function tl(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:u,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),d=r-u,c=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(c)}}const Cn=(t,e,n,o,r,i)=>{const s=Ju(i,e,n),a=(e-s.x)/t.width,u=(n-s.y)/t.height,l=Math.min(a,u),d=Bt(l,o,r),c=t.x+t.width/2,f=t.y+t.height/2,p=e/2-c*d,g=n/2-f*d,y=tl(t,p,g,d,e,n),x={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:p-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function Cr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Ir(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function ro(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function el(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function nl(t){return{...wr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ft(t),a=le({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:u,y:l}=n?ue(a,e):a;return{xSnapped:u,ySnapped:l,...a}}const In=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ar=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ol=["INPUT","SELECT","TEXTAREA"];function kr(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:ol.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Pr=t=>"clientX"in t,ft=(t,e)=>{var i,s;const n=Pr(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},io=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...In(s)}})};function $r({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const u=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,d=Math.abs(u-t),c=Math.abs(l-e);return[u,l,d,c]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function so({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Tr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,u]=so({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,d]=so({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[c,f,p,g]=$r({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:u,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${u} ${l},${d} ${o},${r}`,c,f,p,g]}function zr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function rl({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function il({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return oe(s,Be(i))>0}const sl=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,al=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),cl=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||sl;let r;return br(t)?r={...t}:r={...t,id:o(t)},al(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Dr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=zr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ao={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},ul=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},co=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function ll({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=ao[e],u=ao[o],l={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+u.x*i,y:n.y+u.y*i},c=ul({source:l,sourcePosition:e,target:d}),f=c.x!==0?"x":"y",p=c[f];let g=[],y,x;const m={x:0,y:0},_={x:0,y:0},[,,h,w]=zr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[f]*u[f]===-1){f==="x"?(y=r.x??l.x+(d.x-l.x)*s,x=r.y??(l.y+d.y)/2):(y=r.x??(l.x+d.x)/2,x=r.y??l.y+(d.y-l.y)*s);const b=[{x:y,y:l.y},{x:y,y:d.y}],M=[{x:l.x,y:x},{x:d.x,y:x}];a[f]===p?g=f==="x"?b:M:g=f==="x"?M:b}else{const b=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===p?M:b:g=a.y===p?b:M,e===o){const k=Math.abs(t[f]-n[f]);if(k<=i){const H=Math.min(i-1,i-k);a[f]===p?m[f]=(l[f]>t[f]?-1:1)*H:_[f]=(d[f]>n[f]?-1:1)*H}}if(e!==o){const k=f==="x"?"y":"x",H=a[f]===u[k],v=l[k]>d[k],A=l[k]<d[k];(a[f]===1&&(!H&&v||H&&A)||a[f]!==1&&(!H&&A||H&&v))&&(g=f==="x"?b:M)}const T={x:l.x+m.x,y:l.y+m.y},z={x:d.x+_.x,y:d.y+_.y},B=Math.max(Math.abs(T.x-g[0].x),Math.abs(z.x-g[0].x)),I=Math.max(Math.abs(T.y-g[0].y),Math.abs(z.y-g[0].y));B>=I?(y=(T.x+z.x)/2,x=g[0].y):(y=g[0].x,x=(T.y+z.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:d.x+_.x,y:d.y+_.y},n],y,x,h,w]}function fl(t,e,n,o){const r=Math.min(co(t,e)/2,co(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=t.x<n.x?1:-1,u=t.y<n.y?-1:1;return`L ${i},${s+r*u}Q ${i},${s} ${i+r*a},${s}`}function pn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:u,offset:l=20,stepPosition:d=.5}){const[c,f,p,g,y]=ll({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:u},offset:l,stepPosition:d});return[c.reduce((m,_,h)=>{let w="";return h>0&&h<c.length-1?w=fl(c[h-1],_,c[h+1],s):w=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=w,m},""),f,p,g,y]}function uo(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function dl(t){var c;const{sourceNode:e,targetNode:n}=t;if(!uo(e)||!uo(n))return null;const o=e.internals.handleBounds||lo(e.handles),r=n.internals.handleBounds||lo(n.handles),i=fo((o==null?void 0:o.source)??[],t.sourceHandle),s=fo(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(c=t.onError)==null||c.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,u=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),d=Pt(n,s,u);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:u}}function lo(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function fo(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function mn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function hl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(u=>{if(u&&typeof u=="object"){const l=mn(u,e);i.has(l)||(s.push({id:l,color:u.color||n,...u}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Lr=1e3,gl=10,An={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},pl={...An,checkEquality:!0};function kn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function ml(t,e,n){const o=kn(An,n);for(const r of t.values())if(r.parentId)$n(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function yl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Pn(t){return t==="manual"}function yn(t,e,n,o={}){var l,d;const r=kn(pl,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Pn(r.zIndexMode)?Lr:0;let u=t.length>0;e.clear(),n.clear();for(const c of t){let f=s.get(c.id);if(r.checkEquality&&c===(f==null?void 0:f.internals.userNode))e.set(c.id,f);else{const p=ae(c,r.nodeOrigin),g=Ot(c.extent)?c.extent:r.nodeExtent,y=kt(p,g,wt(c));f={...r.defaults,...c,measured:{width:(l=c.measured)==null?void 0:l.width,height:(d=c.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:yl(c,f),z:Hr(c,a,r.zIndexMode),userNode:c}},e.set(c.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(u=!1),c.parentId&&$n(f,e,n,o,i)}return u}function xl(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function $n(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:u}=kn(An,o),l=t.parentId,d=e.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xl(t,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&u==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*gl),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const c=i&&!Pn(u)?Lr:0,{x:f,y:p,z:g}=wl(t,d,s,a,c,u),{positionAbsolute:y}=t.internals,x=f!==y.x||p!==y.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:f,y:p}:y,z:g}})}function Hr(t,e,n){const o=lt(t.zIndex)?t.zIndex:0;return Pn(n)?o:o+(t.selected?e:0)}function wl(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,u=wt(t),l=ae(t,n),d=Ot(t.extent)?kt(l,t.extent,u):l;let c=kt({x:s+d.x,y:a+d.y},o,u);t.extent==="parent"&&(c=Sr(c,u,e));const f=Hr(t,r,i),p=e.internals.z??0;return{x:c.x,y:c.y,z:p>=f?p+1:f}}function Tn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const u=e.get(a.parentId);if(!u)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(u),d=Mr(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:u})}return i.size>0&&i.forEach(({expandedRect:a,parent:u},l)=>{var h;const d=u.internals.positionAbsolute,c=wt(u),f=u.origin??o,p=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,y=Math.max(c.width,Math.round(a.width)),x=Math.max(c.height,Math.round(a.height)),m=(y-c.width)*f[0],_=(x-c.height)*f[1];(p>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:u.position.x-p+m,y:u.position.y-g+_}}),(h=n.get(l))==null||h.forEach(w=>{t.some(N=>N.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+g}})})),(c.width<a.width||c.height<a.height||p||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:y+(p?f[0]*p-m:0),height:x+(g?f[1]*g-_:0)}})}),r}function vl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let u=!1;if(!a)return{changes:[],updatedInternals:u};const l=[],d=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const p of t.values()){const g=e.get(p.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),u=!0;continue}const y=In(p.nodeElement),x=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(x||!g.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),h=Ot(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Sr(w,y,e.get(g.parentId)):h&&(w=kt(w,h,y));const N={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:io("source",p.nodeElement,_,c,g.id),target:io("target",p.nodeElement,_,c,g.id)}}};e.set(g.id,N),g.parentId&&$n(N,e,n,{nodeOrigin:r,zIndexMode:s}),u=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ft(N,r)}))}}if(f.length>0){const p=Tn(f,e,n,r);l.push(...p)}return{changes:l,updatedInternals:u}}async function _l({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function ho(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const u=o.get(s)||new Map;if(o.set(s,u.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Rr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,u={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;ho("source",u,d,t,r,s),ho("target",u,l,t,i,a),e.set(o.id,o)}}function Vr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Vr(n,e):!1}function go(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function bl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Vr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,u;const r=[];for(const[l,d]of e){const c=(s=n.get(l))==null?void 0:s.internals.userNode;c&&r.push({...c,position:d.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((u=e.get(t))==null?void 0:u.position)||i.position,dragging:o}:r[0],r]}function El({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ue(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Sl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,u=!1,l={x:0,y:0},d=null,c=!1,f=null,p=!1,g=!1,y=null;function x({noDragClassName:_,handleSelector:h,domNode:w,isSelectable:N,nodeId:b,nodeClickDistance:M=0}){f=at(w);function T({x:k,y:H}){const{nodeLookup:v,nodeExtent:A,snapGrid:S,snapToGrid:P,nodeOrigin:C,onNodeDrag:E,onSelectionDrag:L,onError:V,updateNodePositions:R}=e();i={x:k,y:H};let X=!1;const O=a.size>1,j=O&&A?gn(ce(a)):null,U=O&&P?El({dragItems:a,snapGrid:S,x:k,y:H}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:k-F.distance.x,y:H-F.distance.y};P&&(W=U?{x:Math.round(W.x+U.x),y:Math.round(W.y+U.y)}:ue(W,S));let Q=null;if(O&&A&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+A[0][0],nt=q.x+F.measured.width-j.x2+A[1][0],tt=q.y-j.y+A[0][1],st=q.y+F.measured.height-j.y2+A[1][1];Q=[[et,tt],[nt,st]]}const{position:Z,positionAbsolute:K}=Er({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||A,nodeOrigin:C,onError:V});X=X||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F.internals.positionAbsolute=K}if(g=g||X,!!X&&(R(a,!0),y&&(o||E||!b&&L))){const[G,F]=Qe({nodeId:b,dragItems:a,nodeLookup:v});o==null||o(y,a,G,F),E==null||E(y,G,F),b||L==null||L(y,F)}}async function z(){if(!d)return;const{transform:k,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:A}=e();if(!A){u=!1,cancelAnimationFrame(s);return}const[S,P]=Nr(l,d,v);(S!==0||P!==0)&&(i.x=(i.x??0)-S/k[2],i.y=(i.y??0)-P/k[2],await H({x:S,y:P})&&T(i)),s=requestAnimationFrame(z)}function B(k){var O;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:A,transform:S,snapGrid:P,snapToGrid:C,selectNodesOnDrag:E,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=e();c=!0,(!E||!N)&&!v&&b&&((O=H.get(b))!=null&&O.selected||R()),N&&E&&b&&(t==null||t(b));const X=Qt(k.sourceEvent,{transform:S,snapGrid:P,snapToGrid:C,containerBounds:d});if(i=X,a=bl(H,A,X,b),a.size>0&&(n||L||!b&&V)){const[j,U]=Qe({nodeId:b,dragItems:a,nodeLookup:H});n==null||n(k.sourceEvent,a,j,U),L==null||L(k.sourceEvent,j,U),b||V==null||V(k.sourceEvent,U)}}const I=cr().clickDistance(M).on("start",k=>{const{domNode:H,nodeDragThreshold:v,transform:A,snapGrid:S,snapToGrid:P}=e();d=(H==null?void 0:H.getBoundingClientRect())||null,p=!1,g=!1,y=k.sourceEvent,v===0&&B(k),i=Qt(k.sourceEvent,{transform:A,snapGrid:S,snapToGrid:P,containerBounds:d}),l=ft(k.sourceEvent,d)}).on("drag",k=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:A,snapToGrid:S,nodeDragThreshold:P,nodeLookup:C}=e(),E=Qt(k.sourceEvent,{transform:v,snapGrid:A,snapToGrid:S,containerBounds:d});if(y=k.sourceEvent,(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1||b&&!C.has(b))&&(p=!0),!p){if(!u&&H&&c&&(u=!0,z()),!c){const L=ft(k.sourceEvent,d),V=L.x-l.x,R=L.y-l.y;Math.sqrt(V*V+R*R)>P&&B(k)}(i.x!==E.xSnapped||i.y!==E.ySnapped)&&a&&c&&(l=ft(k.sourceEvent,d),T(E))}}).on("end",k=>{if(!(!c||p)&&(u=!1,c=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:A,onSelectionDragStop:S}=e();if(g&&(v(a,!1),g=!1),r||A||!b&&S){const[P,C]=Qe({nodeId:b,dragItems:a,nodeLookup:H,dragging:!1});r==null||r(k.sourceEvent,a,P,C),A==null||A(k.sourceEvent,P,C),b||S==null||S(k.sourceEvent,C)}}}).filter(k=>{const H=k.target;return!k.button&&(!_||!go(H,`.${_}`,w))&&(!h||go(H,h,w))});f.call(I)}function m(){f==null||f.on(".drag",null)}return{update:x,destroy:m}}function Nl(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const Ml=250;function Cl(t,e,n,o){var a,u;let r=[],i=1/0;const s=Nl(t,n,e+Ml);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((u=l.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of d){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:f,y:p}=Pt(l,c,c.position,!0),g=Math.sqrt(Math.pow(f-t.x,2)+Math.pow(p-t.y,2));g>e||(g<i?(r=[{...c,x:f,y:p}],i=g):g===i&&r.push({...c,x:f,y:p}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(d=>d.type===l)??r[0]}return r[0]}function Br(t,e,n,o,r,i=!1){var l,d,c;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((c=s.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return u&&i?{...u,...Pt(s,u,u.position,!0)}:u}function Fr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Il(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Or=()=>!0;function Al(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:u,lib:l,autoPanOnConnect:d,flowId:c,panBy:f,cancelConnection:p,onConnectStart:g,onConnect:y,onConnectEnd:x,isValidConnection:m=Or,onReconnectEnd:_,updateConnection:h,getTransform:w,getFromHandle:N,autoPanSpeed:b,dragThreshold:M=1,handleDomNode:T}){const z=Ar(t.target);let B=0,I;const{x:k,y:H}=ft(t),v=Fr(i,T),A=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!A||!v)return;const P=Br(r,v,o,u,e);if(!P)return;let C=ft(t,A),E=!1,L=null,V=!1,R=null;function X(){if(!d||!A)return;const[Z,K]=Nr(C,A,b);f({x:Z,y:K}),B=requestAnimationFrame(X)}const O={...P,nodeId:r,type:v,position:P.position},j=u.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,O,Y.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:j,to:C,toHandle:null,toPosition:eo[O.position],toNode:null,pointer:C};function F(){S=!0,h(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}M===0&&F();function W(Z){if(!S){const{x:st,y:vt}=ft(Z),pt=st-k,Nt=vt-H;if(!(pt*pt+Nt*Nt>M*M))return;F()}if(!N()||!O){Q(Z);return}const K=w();C=ft(Z,A),I=Cl(le(C,K,!1,[1,1]),n,u,O),E||(X(),E=!0);const q=Xr(Z,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:z,lib:l,flowId:c,nodeLookup:u});R=q.handleDomNode,L=q.connection,V=Il(!!I,q.isValid);const et=u.get(r),nt=et?Pt(et,O,Y.Left,!0):G.from,tt={...G,from:nt,isValid:V,to:q.toHandle&&V?Pe({x:q.toHandle.x,y:q.toHandle.y},K):C,toHandle:q.toHandle,toPosition:V&&q.toHandle?q.toHandle.position:eo[O.position],toNode:q.toHandle?u.get(q.toHandle.nodeId):null,pointer:C};h(tt),G=tt}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(S){(I||R)&&L&&V&&(y==null||y(L));const{inProgress:K,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};x==null||x(Z,et),i&&(_==null||_(Z,et))}p(),cancelAnimationFrame(B),E=!1,V=!1,L=null,R=null,z.removeEventListener("mousemove",W),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",W),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",W),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",W),z.addEventListener("touchend",Q)}function Xr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:u,isValidConnection:l=Or,nodeLookup:d}){const c=i==="target",f=e?s.querySelector(`.${a}-flow__handle[data-id="${u}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:p,y:g}=ft(t),y=s.elementFromPoint(p,g),x=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Fr(void 0,x),h=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!h||!_)return m;const M={source:c?h:o,sourceHandle:c?w:r,target:c?o:h,targetHandle:c?r:w};m.connection=M;const z=N&&b&&(n===Vt.Strict?c&&_==="source"||!c&&_==="target":h!==o||w!==r);m.isValid=z&&l(M),m.toHandle=Br(h,_,w,d,n,!0)}return m}const xn={onPointerDown:Al,isValid:Xr};function kl({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:u,height:l,zoomStep:d=1,pannable:c=!0,zoomable:f=!0,inversePan:p=!1}){const g=h=>{if(h.sourceEvent.type!=="wheel"||!e)return;const w=n(),N=h.sourceEvent.ctrlKey&&re()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*d,M=w[2]*Math.pow(2,b*N);e.scaleTo(M)};let y=[0,0];const x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(y=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const w=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!e)return;const N=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],b=[N[0]-y[0],N[1]-y[1]];y=N;const M=o()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-b[0]*M,y:w[1]-b[1]*M},z=[[0,0],[u,l]];e.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},z,a)},_=yr().on("start",x).on("zoom",c?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Yr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Pl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=Pl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},jr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function $l({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:u,onPanZoomEnd:l}){return d=>{if(zt(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=ut(d),m=jr(d),_=c*Math.pow(2,m);o.scaleTo(n,_,x,d);return}const f=d.deltaMode===1?20:1;let p=r===It.Vertical?0:d.deltaX*f,g=r===It.Horizontal?0:d.deltaY*f;!re()&&d.shiftKey&&r!==It.Vertical&&(p=d.deltaY*f,g=0),o.translateBy(n,-(p/c)*i,-(g/c)*i,{internal:!0});const y=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(u==null||u(d,y),t.panScrollTimeout=setTimeout(()=>{l==null||l(d,y),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(d,y))}}function Tl({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function zl({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Dl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Yr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Ll({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Yr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const u=Fe(s.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,u)},n?150:0)}}}function Hl({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:u,lib:l,connectionInProgress:d}){return c=>{var x;const f=t||e,p=n&&c.ctrlKey,g=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(zt(c,`${l}-flow__node`)||zt(c,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||d&&!g||zt(c,a)&&g||zt(c,u)&&(!g||r&&g&&!t)||!n&&c.ctrlKey&&g)return!1;if(!n&&c.type==="touchstart"&&((x=c.touches)==null?void 0:x.length)>1)return c.preventDefault(),!1;if(!f&&!r&&!p&&g||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||g)&&y}}function Rl({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:u}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect(),c=yr().scaleExtent([e,n]).translateExtent(o),f=at(t).call(c);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[d.width,d.height]],o);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");c.wheelDelta(jr);function y(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).transform(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function x({noWheelClassName:I,noPanClassName:k,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:A,panOnDrag:S,panOnScrollMode:P,panOnScrollSpeed:C,preventScrolling:E,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:X,lib:O,onTransformChange:j,connectionInProgress:U,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=A&&!X&&!v;c.clickDistance(F?1/0:!lt(G)||G<0?0:G);const Q=W?$l({zoomPanValues:l,noWheelClassName:I,d3Selection:f,d3Zoom:c,panOnScrollMode:P,panOnScrollSpeed:C,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Tl({noWheelClassName:I,preventScrolling:E,d3ZoomHandler:p});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const K=zl({zoomPanValues:l,onDraggingChange:u,onPanZoomStart:s});c.on("start",K);const q=Dl({zoomPanValues:l,panOnDrag:S,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:j});c.on("zoom",q);const et=Ll({zoomPanValues:l,panOnDrag:S,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:u});c.on("end",et)}const Z=Hl({zoomActivationKeyPressed:X,panOnDrag:S,zoomOnScroll:V,panOnScroll:A,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:v,noPanClassName:k,noWheelClassName:I,lib:O,connectionInProgress:U});c.filter(Z),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){c.on("zoom",null)}async function _(I,k,H){const v=Je(I),A=c==null?void 0:c.constrain()(v,k,H);return A&&await y(A),new Promise(S=>S(A))}async function h(I,k){const H=Je(I);return await y(H,k),new Promise(v=>v(H))}function w(I){if(f){const k=Je(I),H=f.property("__zoom");(H.k!==I.zoom||H.x!==I.x||H.y!==I.y)&&(c==null||c.transform(f,k,null,{sync:!0}))}}function N(){const I=f?mr(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function b(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).scaleTo(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function M(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).scaleBy(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function T(I){c==null||c.scaleExtent(I)}function z(I){c==null||c.translateExtent(I)}function B(I){const k=!lt(I)||I<0?0:I;c==null||c.clickDistance(k)}return{update:x,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:N,scaleTo:b,scaleBy:M,setScaleExtent:T,setTranslateExtent:z,syncViewport:w,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function Vl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,u=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(u[0]=u[0]*-1),a&&i&&(u[1]=u[1]*-1),u}function po(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function mo(t,e){return t?!e:e}function Bl(t,e,n,o,r,i,s,a){let{affectsX:u,affectsY:l}=e;const{isHorizontal:d,isVertical:c}=e,f=d&&c,{xSnapped:p,ySnapped:g}=n,{minWidth:y,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:h,y:w,width:N,height:b,aspectRatio:M}=t;let T=Math.floor(d?p-t.pointerX:0),z=Math.floor(c?g-t.pointerY:0);const B=N+(u?-T:T),I=b+(l?-z:z),k=-i[0]*N,H=-i[1]*b;let v=ye(B,y,x),A=ye(I,m,_);if(s){let C=0,E=0;u&&T<0?C=_t(h+T+k,s[0][0]):!u&&T>0&&(C=bt(h+B+k,s[1][0])),l&&z<0?E=_t(w+z+H,s[0][1]):!l&&z>0&&(E=bt(w+I+H,s[1][1])),v=Math.max(v,C),A=Math.max(A,E)}if(a){let C=0,E=0;u&&T>0?C=bt(h+T,a[0][0]):!u&&T<0&&(C=_t(h+B,a[1][0])),l&&z>0?E=bt(w+z,a[0][1]):!l&&z<0&&(E=_t(w+I,a[1][1])),v=Math.max(v,C),A=Math.max(A,E)}if(r){if(d){const C=ye(B/M,m,_)*M;if(v=Math.max(v,C),s){let E=0;!u&&!l||u&&!l&&f?E=bt(w+H+B/M,s[1][1])*M:E=_t(w+H+(u?T:-T)/M,s[0][1])*M,v=Math.max(v,E)}if(a){let E=0;!u&&!l||u&&!l&&f?E=_t(w+B/M,a[1][1])*M:E=bt(w+(u?T:-T)/M,a[0][1])*M,v=Math.max(v,E)}}if(c){const C=ye(I*M,y,x)/M;if(A=Math.max(A,C),s){let E=0;!u&&!l||l&&!u&&f?E=bt(h+I*M+k,s[1][0])/M:E=_t(h+(l?z:-z)*M+k,s[0][0])/M,A=Math.max(A,E)}if(a){let E=0;!u&&!l||l&&!u&&f?E=_t(h+I*M,a[1][0])/M:E=bt(h+(l?z:-z)*M,a[0][0])/M,A=Math.max(A,E)}}}z=z+(z<0?A:-A),T=T+(T<0?v:-v),r&&(f?B>I*M?z=(mo(u,l)?-T:T)/M:T=(mo(u,l)?-z:z)*M:d?(z=T/M,l=u):(T=z*M,u=l));const S=u?h+T:h,P=l?w+z:w;return{width:N+(u?-T:T),height:b+(l?-z:z),x:i[0]*T*(u?-1:1)+S,y:i[1]*z*(l?-1:1)+P}}const Wr={width:0,height:0,x:0,y:0},Fl={...Wr,pointerX:0,pointerY:0,aspectRatio:1};function Ol(t){return[[0,0],[t.measured.width,t.measured.height]]}function Xl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,u=n[1]*s;return[[o-a,r-u],[o+i-a,r+s-u]]}function Yl({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:po("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:c,resizeDirection:f,onResizeStart:p,onResize:g,onResizeEnd:y,shouldResize:x}){let m={...Wr},_={...Fl};s={boundaries:d,resizeDirection:f,keepAspectRatio:c,controlDirection:po(l)};let h,w=null,N=[],b,M,T,z=!1;const B=cr().on("start",I=>{const{nodeLookup:k,transform:H,snapGrid:v,snapToGrid:A,nodeOrigin:S,paneDomNode:P}=n();if(h=k.get(e),!h)return;w=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:E}=Qt(I.sourceEvent,{transform:H,snapGrid:v,snapToGrid:A,containerBounds:w});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:C,pointerY:E,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=k.get(h.parentId),M=b&&h.extent==="parent"?Ol(b):void 0),N=[],T=void 0;for(const[L,V]of k)if(V.parentId===e&&(N.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Xl(V,h,V.origin??S);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}p==null||p(I,{...m})}).on("drag",I=>{const{transform:k,snapGrid:H,snapToGrid:v,nodeOrigin:A}=n(),S=Qt(I.sourceEvent,{transform:k,snapGrid:H,snapToGrid:v,containerBounds:w}),P=[];if(!h)return;const{x:C,y:E,width:L,height:V}=m,R={},X=h.origin??A,{width:O,height:j,x:U,y:G}=Bl(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,X,M,T),F=O!==L,W=j!==V,Q=U!==C&&F,Z=G!==E&&W;if(!Q&&!Z&&!F&&!W)return;if((Q||Z||X[0]===1||X[1]===1)&&(R.x=Q?U:m.x,R.y=Z?G:m.y,m.x=R.x,m.y=R.y,N.length>0)){const nt=U-C,tt=G-E;for(const st of N)st.position={x:st.position.x-nt+X[0]*(O-L),y:st.position.y-tt+X[1]*(j-V)},P.push(st)}if((F||W)&&(R.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:m.width,R.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=R.width,m.height=R.height),b&&h.expandParent){const nt=X[0]*(R.width??0);R.x&&R.x<nt&&(m.x=nt,_.x=_.x-(R.x-nt));const tt=X[1]*(R.height??0);R.y&&R.y<tt&&(m.y=tt,_.y=_.y-(R.y-tt))}const K=Vl({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:K};(x==null?void 0:x(I,q))!==!1&&(z=!0,g==null||g(I,q),o(R,P))}).on("end",I=>{z&&(y==null||y(I,{...m}),r==null||r({...m}),z=!1)});i.call(B)}function u(){i.on(".drag",null)}return{update:a,destroy:u}}var en={exports:{}},nn={},on={exports:{}},rn={};/**
|
|
1
|
+
import{dW as Mt,dX as Yn,dY as jn,dZ as Ps,d_ as Ue,b8 as jo,d$ as $s,aG as Ts,r as D,j as $,bb as zs}from"./index-dWT2M6Ef.js";var Wn=180/Math.PI,cn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wo(t,e,n,o,r,i){var s,a,u;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,u/=a),t*o<e*n&&(t=-t,e=-e,u=-u,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*Wn,skewX:Math.atan(u)*Wn,scaleX:s,scaleY:a}}var he;function Ds(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?cn:Wo(e.a,e.b,e.c,e.d,e.e,e.f)}function Ls(t){return t==null||(he||(he=document.createElementNS("http://www.w3.org/2000/svg","g")),he.setAttribute("transform",t),!(t=he.transform.baseVal.consolidate()))?cn:(t=t.matrix,Wo(t.a,t.b,t.c,t.d,t.e,t.f))}function Go(t,e,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,d,c,f,p,g){if(l!==c||d!==f){var y=p.push("translate(",null,e,null,n);g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(d,f)})}else(c||f)&&p.push("translate("+c+e+f+n)}function s(l,d,c,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:c.push(r(c)+"rotate(",null,o)-2,x:Mt(l,d)})):d&&c.push(r(c)+"rotate("+d+o)}function a(l,d,c,f){l!==d?f.push({i:c.push(r(c)+"skewX(",null,o)-2,x:Mt(l,d)}):d&&c.push(r(c)+"skewX("+d+o)}function u(l,d,c,f,p,g){if(l!==c||d!==f){var y=p.push(r(p)+"scale(",null,",",null,")");g.push({i:y-4,x:Mt(l,c)},{i:y-2,x:Mt(d,f)})}else(c!==1||f!==1)&&p.push(r(p)+"scale("+c+","+f+")")}return function(l,d){var c=[],f=[];return l=t(l),d=t(d),i(l.translateX,l.translateY,d.translateX,d.translateY,c,f),s(l.rotate,d.rotate,c,f),a(l.skewX,d.skewX,c,f),u(l.scaleX,l.scaleY,d.scaleX,d.scaleY,c,f),l=d=null,function(p){for(var g=-1,y=f.length,x;++g<y;)c[(x=f[g]).i]=x.x(p);return c.join("")}}}var Hs=Go(Ds,"px, ","px)","deg)"),Rs=Go(Ls,", ",")",")"),Vs=1e-12;function Gn(t){return((t=Math.exp(t))+1/t)/2}function Bs(t){return((t=Math.exp(t))-1/t)/2}function Fs(t){return((t=Math.exp(2*t))-1)/(t+1)}const ve=(function t(e,n,o){function r(i,s){var a=i[0],u=i[1],l=i[2],d=s[0],c=s[1],f=s[2],p=d-a,g=c-u,y=p*p+g*g,x,m;if(y<Vs)m=Math.log(f/l)/e,x=function(M){return[a+M*p,u+M*g,l*Math.exp(e*M*m)]};else{var _=Math.sqrt(y),h=(f*f-l*l+o*y)/(2*l*n*_),w=(f*f-l*l-o*y)/(2*f*n*_),N=Math.log(Math.sqrt(h*h+1)-h),b=Math.log(Math.sqrt(w*w+1)-w);m=(b-N)/e,x=function(M){var T=M*m,z=Gn(N),B=l/(n*_)*(z*Fs(e*T+N)-Bs(N));return[a+B*p,u+B*g,l*z/Gn(e*T+N)]}}return x.duration=m*1e3*e/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,u=a*a;return t(s,a,u)},r})(Math.SQRT2,2,4);function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=it(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Os={value:()=>{}};function ze(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new _e(n)}function _e(t){this._=t}function Xs(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}_e.prototype=ze.prototype={constructor:_e,on:function(t,e){var n=this._,o=Xs(t+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(t=o[i]).type)&&(r=Ys(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(r=(t=o[i]).type)n[r]=qn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=qn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _e(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};function Ys(t,e){for(var n=0,o=t.length,r;n<o;++n)if((r=t[n]).name===e)return r.value}function qn(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=Os,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var un="http://www.w3.org/1999/xhtml";const Un={svg:"http://www.w3.org/2000/svg",xhtml:un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function De(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Un.hasOwnProperty(e)?{space:Un[e],local:t}:t}function js(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===un&&e.documentElement.namespaceURI===un?e.createElement(t):e.createElementNS(n,t)}}function Ws(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function qo(t){var e=De(t);return(e.local?Ws:js)(e)}function Gs(){}function vn(t){return t==null?Gs:function(){return this.querySelector(t)}}function qs(t){typeof t!="function"&&(t=vn(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=new Array(s),u,l,d=0;d<s;++d)(u=i[d])&&(l=t.call(u,u.__data__,d,i))&&("__data__"in u&&(l.__data__=u.__data__),a[d]=l);return new ct(o,this._parents)}function Us(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ks(){return[]}function Uo(t){return t==null?Ks:function(){return this.querySelectorAll(t)}}function Zs(t){return function(){return Us(t.apply(this,arguments))}}function Qs(t){typeof t=="function"?t=Zs(t):t=Uo(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var s=e[i],a=s.length,u,l=0;l<a;++l)(u=s[l])&&(o.push(t.call(u,u.__data__,l,s)),r.push(u));return new ct(o,r)}function Ko(t){return function(){return this.matches(t)}}function Zo(t){return function(e){return e.matches(t)}}var Js=Array.prototype.find;function ta(t){return function(){return Js.call(this.children,t)}}function ea(){return this.firstElementChild}function na(t){return this.select(t==null?ea:ta(typeof t=="function"?t:Zo(t)))}var oa=Array.prototype.filter;function ra(){return Array.from(this.children)}function ia(t){return function(){return oa.call(this.children,t)}}function sa(t){return this.selectAll(t==null?ra:ia(typeof t=="function"?t:Zo(t)))}function aa(t){typeof t!="function"&&(t=Ko(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&a.push(u);return new ct(o,this._parents)}function Qo(t){return new Array(t.length)}function ca(){return new ct(this._enter||this._groups.map(Qo),this._parents)}function Ne(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ne.prototype={constructor:Ne,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function ua(t){return function(){return t}}function la(t,e,n,o,r,i){for(var s=0,a,u=e.length,l=i.length;s<l;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Ne(t,i[s]);for(;s<u;++s)(a=e[s])&&(r[s]=a)}function fa(t,e,n,o,r,i,s){var a,u,l=new Map,d=e.length,c=i.length,f=new Array(d),p;for(a=0;a<d;++a)(u=e[a])&&(f[a]=p=s.call(u,u.__data__,a,e)+"",l.has(p)?r[a]=u:l.set(p,u));for(a=0;a<c;++a)p=s.call(t,i[a],a,i)+"",(u=l.get(p))?(o[a]=u,u.__data__=i[a],l.delete(p)):n[a]=new Ne(t,i[a]);for(a=0;a<d;++a)(u=e[a])&&l.get(f[a])===u&&(r[a]=u)}function da(t){return t.__data__}function ha(t,e){if(!arguments.length)return Array.from(this,da);var n=e?fa:la,o=this._parents,r=this._groups;typeof t!="function"&&(t=ua(t));for(var i=r.length,s=new Array(i),a=new Array(i),u=new Array(i),l=0;l<i;++l){var d=o[l],c=r[l],f=c.length,p=ga(t.call(d,d&&d.__data__,l,o)),g=p.length,y=a[l]=new Array(g),x=s[l]=new Array(g),m=u[l]=new Array(f);n(d,c,y,x,m,p,e);for(var _=0,h=0,w,N;_<g;++_)if(w=y[_]){for(_>=h&&(h=_+1);!(N=x[h])&&++h<g;);w._next=N||null}}return s=new ct(s,o),s._enter=a,s._exit=u,s}function ga(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function pa(){return new ct(this._exit||this._groups.map(Qo),this._parents)}function ma(t,e,n){var o=this.enter(),r=this,i=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function ya(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),u=0;u<s;++u)for(var l=n[u],d=o[u],c=l.length,f=a[u]=new Array(c),p,g=0;g<c;++g)(p=l[g]||d[g])&&(f[g]=p);for(;u<r;++u)a[u]=n[u];return new ct(a,this._parents)}function xa(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function wa(t){t||(t=va);function e(c,f){return c&&f?t(c.__data__,f.__data__):!c-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,u=r[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(u[d]=l);u.sort(e)}return new ct(r,this._parents).order()}function va(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function _a(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ba(){return Array.from(this)}function Ea(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Sa(){let t=0;for(const e of this)++t;return t}function Na(){return!this.node()}function Ma(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r=e[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&t.call(a,a.__data__,i,r);return this}function Ca(t){return function(){this.removeAttribute(t)}}function Ia(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Aa(t,e){return function(){this.setAttribute(t,e)}}function ka(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Pa(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function $a(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ta(t,e){var n=De(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?Ia:Ca:typeof e=="function"?n.local?$a:Pa:n.local?ka:Aa)(n,e))}function Jo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function za(t){return function(){this.style.removeProperty(t)}}function Da(t,e,n){return function(){this.style.setProperty(t,e,n)}}function La(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function Ha(t,e,n){return arguments.length>1?this.each((e==null?za:typeof e=="function"?La:Da)(t,e,n??"")):Ht(this.node(),t)}function Ht(t,e){return t.style.getPropertyValue(e)||Jo(t).getComputedStyle(t,null).getPropertyValue(e)}function Ra(t){return function(){delete this[t]}}function Va(t,e){return function(){this[t]=e}}function Ba(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Fa(t,e){return arguments.length>1?this.each((e==null?Ra:typeof e=="function"?Ba:Va)(t,e)):this.node()[t]}function tr(t){return t.trim().split(/^|\s+/)}function _n(t){return t.classList||new er(t)}function er(t){this._node=t,this._names=tr(t.getAttribute("class")||"")}er.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function nr(t,e){for(var n=_n(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function or(t,e){for(var n=_n(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function Oa(t){return function(){nr(this,t)}}function Xa(t){return function(){or(this,t)}}function Ya(t,e){return function(){(e.apply(this,arguments)?nr:or)(this,t)}}function ja(t,e){var n=tr(t+"");if(arguments.length<2){for(var o=_n(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ya:e?Oa:Xa)(n,e))}function Wa(){this.textContent=""}function Ga(t){return function(){this.textContent=t}}function qa(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Ua(t){return arguments.length?this.each(t==null?Wa:(typeof t=="function"?qa:Ga)(t)):this.node().textContent}function Ka(){this.innerHTML=""}function Za(t){return function(){this.innerHTML=t}}function Qa(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ja(t){return arguments.length?this.each(t==null?Ka:(typeof t=="function"?Qa:Za)(t)):this.node().innerHTML}function tc(){this.nextSibling&&this.parentNode.appendChild(this)}function ec(){return this.each(tc)}function nc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function oc(){return this.each(nc)}function rc(t){var e=typeof t=="function"?t:qo(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function ic(){return null}function sc(t,e){var n=typeof t=="function"?t:qo(t),o=e==null?ic:typeof e=="function"?e:vn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function ac(){var t=this.parentNode;t&&t.removeChild(this)}function cc(){return this.each(ac)}function uc(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function lc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function fc(t){return this.select(t?lc:uc)}function dc(t){return arguments.length?this.property("__data__",t):this.node().__data__}function hc(t){return function(e){t.call(this,e,this.__data__)}}function gc(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function pc(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,r=e.length,i;n<r;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++o]=i;++o?e.length=o:delete this.__on}}}function mc(t,e,n){return function(){var o=this.__on,r,i=hc(e);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=e;return}}this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},o?o.push(r):this.__on=[r]}}function yc(t,e,n){var o=gc(t+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var u=0,l=a.length,d;u<l;++u)for(r=0,d=a[u];r<i;++r)if((s=o[r]).type===d.type&&s.name===d.name)return d.value}return}for(a=e?mc:pc,r=0;r<i;++r)this.each(a(o[r],e,n));return this}function rr(t,e,n){var o=Jo(t),r=o.CustomEvent;typeof r=="function"?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function xc(t,e){return function(){return rr(this,t,e)}}function wc(t,e){return function(){return rr(this,t,e.apply(this,arguments))}}function vc(t,e){return this.each((typeof e=="function"?wc:xc)(t,e))}function*_c(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var ir=[null];function ct(t,e){this._groups=t,this._parents=e}function se(){return new ct([[document.documentElement]],ir)}function bc(){return this}ct.prototype=se.prototype={constructor:ct,select:qs,selectAll:Qs,selectChild:na,selectChildren:sa,filter:aa,data:ha,enter:ca,exit:pa,join:ma,merge:ya,selection:bc,order:xa,sort:wa,call:_a,nodes:ba,node:Ea,size:Sa,empty:Na,each:Ma,attr:Ta,style:Ha,property:Fa,classed:ja,text:Ua,html:Ja,raise:ec,lower:oc,append:rc,insert:sc,remove:cc,clone:fc,datum:dc,on:yc,dispatch:vc,[Symbol.iterator]:_c};function at(t){return typeof t=="string"?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],ir)}function Ec(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ut(t,e){if(t=Ec(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}const Sc={passive:!1},Jt={capture:!0,passive:!1};function Ke(t){t.stopImmediatePropagation()}function Lt(t){t.preventDefault(),t.stopImmediatePropagation()}function sr(t){var e=t.document.documentElement,n=at(t).on("dragstart.drag",Lt,Jt);"onselectstart"in e?n.on("selectstart.drag",Lt,Jt):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ar(t,e){var n=t.document.documentElement,o=at(t).on("dragstart.drag",null);e&&(o.on("click.drag",Lt,Jt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const ge=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:u,dy:l,dispatch:d}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function Nc(t){return!t.ctrlKey&&!t.button}function Mc(){return this.parentNode}function Cc(t,e){return e??{x:t.x,y:t.y}}function Ic(){return navigator.maxTouchPoints||"ontouchstart"in this}function cr(){var t=Nc,e=Mc,n=Cc,o=Ic,r={},i=ze("start","drag","end"),s=0,a,u,l,d,c=0;function f(w){w.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Sc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(w,N){if(!(d||!t.call(this,w,N))){var b=h(this,e.call(this,w,N),w,N,"mouse");b&&(at(w.view).on("mousemove.drag",g,Jt).on("mouseup.drag",y,Jt),sr(w.view),Ke(w),l=!1,a=w.clientX,u=w.clientY,b("start",w))}}function g(w){if(Lt(w),!l){var N=w.clientX-a,b=w.clientY-u;l=N*N+b*b>c}r.mouse("drag",w)}function y(w){at(w.view).on("mousemove.drag mouseup.drag",null),ar(w.view,l),Lt(w),r.mouse("end",w)}function x(w,N){if(t.call(this,w,N)){var b=w.changedTouches,M=e.call(this,w,N),T=b.length,z,B;for(z=0;z<T;++z)(B=h(this,M,w,N,b[z].identifier,b[z]))&&(Ke(w),B("start",w,b[z]))}}function m(w){var N=w.changedTouches,b=N.length,M,T;for(M=0;M<b;++M)(T=r[N[M].identifier])&&(Lt(w),T("drag",w,N[M]))}function _(w){var N=w.changedTouches,b=N.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<b;++M)(T=r[N[M].identifier])&&(Ke(w),T("end",w,N[M]))}function h(w,N,b,M,T,z){var B=i.copy(),I=ut(z||b,N),k,H,v;if((v=n.call(w,new ln("beforestart",{sourceEvent:b,target:f,identifier:T,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:B}),M))!=null)return k=v.x-I[0]||0,H=v.y-I[1]||0,function A(S,P,C){var E=I,L;switch(S){case"start":r[T]=A,L=s++;break;case"end":delete r[T],--s;case"drag":I=ut(C||P,N),L=s;break}B.call(S,w,new ln(S,{sourceEvent:P,subject:v,target:f,identifier:T,active:L,x:I[0]+k,y:I[1]+H,dx:I[0]-E[0],dy:I[1]-E[1],dispatch:B}),M)}}return f.filter=function(w){return arguments.length?(t=typeof w=="function"?w:ge(!!w),f):t},f.container=function(w){return arguments.length?(e=typeof w=="function"?w:ge(w),f):e},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:ge(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:ge(!!w),f):o},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(c=(w=+w)*w,f):Math.sqrt(c)},f}var Rt=0,Kt=0,qt=0,ur=1e3,Me,Zt,Ce=0,At=0,Le=0,te=typeof performance=="object"&&performance.now?performance:Date,lr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function bn(){return At||(lr(Ac),At=te.now()+Le)}function Ac(){At=0}function Ie(){this._call=this._time=this._next=null}Ie.prototype=fr.prototype={constructor:Ie,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?bn():+n)+(e==null?0:+e),!this._next&&Zt!==this&&(Zt?Zt._next=this:Me=this,Zt=this),this._call=t,this._time=n,fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,fn())}};function fr(t,e,n){var o=new Ie;return o.restart(t,e,n),o}function kc(){bn(),++Rt;for(var t=Me,e;t;)(e=At-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Rt}function Kn(){At=(Ce=te.now())+Le,Rt=Kt=0;try{kc()}finally{Rt=0,$c(),At=0}}function Pc(){var t=te.now(),e=t-Ce;e>ur&&(Le-=e,Ce=t)}function $c(){for(var t,e=Me,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Me=n);Zt=t,fn(o)}function fn(t){if(!Rt){Kt&&(Kt=clearTimeout(Kt));var e=t-At;e>24?(t<1/0&&(Kt=setTimeout(Kn,t-te.now()-Le)),qt&&(qt=clearInterval(qt))):(qt||(Ce=te.now(),qt=setInterval(Pc,ur)),Rt=1,lr(Kn))}}function Zn(t,e,n){var o=new Ie;return e=e==null?0:+e,o.restart(r=>{o.stop(),t(r+e)},e,n),o}var Tc=ze("start","end","cancel","interrupt"),zc=[],dr=0,Qn=1,dn=2,be=3,Jn=4,hn=5,Ee=6;function He(t,e,n,o,r,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;Dc(t,n,{name:e,index:o,group:r,on:Tc,tween:zc,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:dr})}function En(t,e){var n=dt(t,e);if(n.state>dr)throw new Error("too late; already scheduled");return n}function gt(t,e){var n=dt(t,e);if(n.state>be)throw new Error("too late; already running");return n}function dt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Dc(t,e,n){var o=t.__transition,r;o[e]=n,n.timer=fr(i,0,n.time);function i(l){n.state=Qn,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,c,f,p;if(n.state!==Qn)return u();for(d in o)if(p=o[d],p.name===n.name){if(p.state===be)return Zn(s);p.state===Jn?(p.state=Ee,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete o[d]):+d<e&&(p.state=Ee,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete o[d])}if(Zn(function(){n.state===be&&(n.state=Jn,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=dn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===dn){for(n.state=be,r=new Array(f=n.tween.length),d=0,c=-1;d<f;++d)(p=n.tween[d].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=p);r.length=c+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(u),n.state=hn,1),c=-1,f=r.length;++c<f;)r[c].call(t,d);n.state===hn&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){n.state=Ee,n.timer.stop(),delete o[e];for(var l in o)return;delete t.__transition}}function Se(t,e){var n=t.__transition,o,r,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((o=n[s]).name!==e){i=!1;continue}r=o.state>dn&&o.state<hn,o.state=Ee,o.timer.stop(),o.on.call(r?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[s]}i&&delete t.__transition}}function Lc(t){return this.each(function(){Se(this,t)})}function Hc(t,e){var n,o;return function(){var r=gt(this,t),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===e){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Rc(t,e,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=gt(this,t),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:e,value:n},u=0,l=r.length;u<l;++u)if(r[u].name===e){r[u]=a;break}u===l&&r.push(a)}i.tween=r}}function Vc(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=dt(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===t)return s.value;return null}return this.each((e==null?Hc:Rc)(n,t,e))}function Sn(t,e,n){var o=t._id;return t.each(function(){var r=gt(this,o);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return dt(r,o).value[e]}}function hr(t,e){var n;return(typeof e=="number"?Mt:e instanceof Yn?jn:(n=Yn(e))?(e=n,jn):Ps)(t,e)}function Bc(t){return function(){this.removeAttribute(t)}}function Fc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Oc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttribute(t);return s===r?null:s===o?i:i=e(o=s,n)}}function Xc(t,e,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===r?null:s===o?i:i=e(o=s,n)}}function Yc(t,e,n){var o,r,i;return function(){var s,a=n(this),u;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),u=a+"",s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a)))}}function jc(t,e,n){var o,r,i;return function(){var s,a=n(this),u;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),u=a+"",s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a)))}}function Wc(t,e){var n=De(t),o=n==="transform"?Rs:hr;return this.attrTween(t,typeof e=="function"?(n.local?jc:Yc)(n,o,Sn(this,"attr."+t,e)):e==null?(n.local?Fc:Bc)(n):(n.local?Xc:Oc)(n,o,e))}function Gc(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function qc(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Uc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&qc(t,i)),n}return r._value=e,r}function Kc(t,e){var n,o;function r(){var i=e.apply(this,arguments);return i!==o&&(n=(o=i)&&Gc(t,i)),n}return r._value=e,r}function Zc(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=De(t);return this.tween(n,(o.local?Uc:Kc)(o,e))}function Qc(t,e){return function(){En(this,t).delay=+e.apply(this,arguments)}}function Jc(t,e){return e=+e,function(){En(this,t).delay=e}}function tu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Qc:Jc)(e,t)):dt(this.node(),e).delay}function eu(t,e){return function(){gt(this,t).duration=+e.apply(this,arguments)}}function nu(t,e){return e=+e,function(){gt(this,t).duration=e}}function ou(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?eu:nu)(e,t)):dt(this.node(),e).duration}function ru(t,e){if(typeof e!="function")throw new Error;return function(){gt(this,t).ease=e}}function iu(t){var e=this._id;return arguments.length?this.each(ru(e,t)):dt(this.node(),e).ease}function su(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;gt(this,t).ease=n}}function au(t){if(typeof t!="function")throw new Error;return this.each(su(this._id,t))}function cu(t){typeof t!="function"&&(t=Ko(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i=e[r],s=i.length,a=o[r]=[],u,l=0;l<s;++l)(u=i[l])&&t.call(u,u.__data__,l,i)&&a.push(u);return new xt(o,this._parents,this._name,this._id)}function uu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var u=e[a],l=n[a],d=u.length,c=s[a]=new Array(d),f,p=0;p<d;++p)(f=u[p]||l[p])&&(c[p]=f);for(;a<o;++a)s[a]=e[a];return new xt(s,this._parents,this._name,this._id)}function lu(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function fu(t,e,n){var o,r,i=lu(e)?En:gt;return function(){var s=i(this,t),a=s.on;a!==o&&(r=(o=a).copy()).on(e,n),s.on=r}}function du(t,e){var n=this._id;return arguments.length<2?dt(this.node(),n).on.on(t):this.each(fu(n,t,e))}function hu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function gu(){return this.on("end.remove",hu(this._id))}function pu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=vn(t));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],u=a.length,l=i[s]=new Array(u),d,c,f=0;f<u;++f)(d=a[f])&&(c=t.call(d,d.__data__,f,a))&&("__data__"in d&&(c.__data__=d.__data__),l[f]=c,He(l[f],e,n,f,l,dt(d,n)));return new xt(i,this._parents,e,n)}function mu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Uo(t));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var u=o[a],l=u.length,d,c=0;c<l;++c)if(d=u[c]){for(var f=t.call(d,d.__data__,c,u),p,g=dt(d,n),y=0,x=f.length;y<x;++y)(p=f[y])&&He(p,e,n,y,f,g);i.push(f),s.push(d)}return new xt(i,s,e,n)}var yu=se.prototype.constructor;function xu(){return new yu(this._groups,this._parents)}function wu(t,e){var n,o,r;return function(){var i=Ht(this,t),s=(this.style.removeProperty(t),Ht(this,t));return i===s?null:i===n&&s===o?r:r=e(n=i,o=s)}}function gr(t){return function(){this.style.removeProperty(t)}}function vu(t,e,n){var o,r=n+"",i;return function(){var s=Ht(this,t);return s===r?null:s===o?i:i=e(o=s,n)}}function _u(t,e,n){var o,r,i;return function(){var s=Ht(this,t),a=n(this),u=a+"";return a==null&&(u=a=(this.style.removeProperty(t),Ht(this,t))),s===u?null:s===o&&u===r?i:(r=u,i=e(o=s,a))}}function bu(t,e){var n,o,r,i="style."+e,s="end."+i,a;return function(){var u=gt(this,t),l=u.on,d=u.value[i]==null?a||(a=gr(e)):void 0;(l!==n||r!==d)&&(o=(n=l).copy()).on(s,r=d),u.on=o}}function Eu(t,e,n){var o=(t+="")=="transform"?Hs:hr;return e==null?this.styleTween(t,wu(t,o)).on("end.style."+t,gr(t)):typeof e=="function"?this.styleTween(t,_u(t,o,Sn(this,"style."+t,e))).each(bu(this._id,t)):this.styleTween(t,vu(t,o,e),n).on("end.style."+t,null)}function Su(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function Nu(t,e,n){var o,r;function i(){var s=e.apply(this,arguments);return s!==r&&(o=(r=s)&&Su(t,s,n)),o}return i._value=e,i}function Mu(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,Nu(t,e,n??""))}function Cu(t){return function(){this.textContent=t}}function Iu(t){return function(){var e=t(this);this.textContent=e??""}}function Au(t){return this.tween("text",typeof t=="function"?Iu(Sn(this,"text",t)):Cu(t==null?"":t+""))}function ku(t){return function(e){this.textContent=t.call(this,e)}}function Pu(t){var e,n;function o(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&ku(r)),e}return o._value=t,o}function $u(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Pu(t))}function Tu(){for(var t=this._name,e=this._id,n=pr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,u,l=0;l<a;++l)if(u=s[l]){var d=dt(u,e);He(u,t,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new xt(o,this._parents,t,n)}function zu(){var t,e,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},u={value:function(){--r===0&&i()}};n.each(function(){var l=gt(this,o),d=l.on;d!==t&&(e=(t=d).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(u)),l.on=e}),r===0&&i()})}var Du=0;function xt(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function pr(){return++Du}var mt=se.prototype;xt.prototype={constructor:xt,select:pu,selectAll:mu,selectChild:mt.selectChild,selectChildren:mt.selectChildren,filter:cu,merge:uu,selection:xu,transition:Tu,call:mt.call,nodes:mt.nodes,node:mt.node,size:mt.size,empty:mt.empty,each:mt.each,on:du,attr:Wc,attrTween:Zc,style:Eu,styleTween:Mu,text:Au,textTween:$u,remove:gu,tween:Vc,delay:tu,duration:ou,ease:iu,easeVarying:au,end:zu,[Symbol.iterator]:mt[Symbol.iterator]};function Lu(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Hu={time:null,delay:0,duration:250,ease:Lu};function Ru(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Vu(t){var e,n;t instanceof xt?(e=t._id,t=t._name):(e=pr(),(n=Hu).time=bn(),t=t==null?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,u,l=0;l<a;++l)(u=s[l])&&He(u,t,e,l,s,n||Ru(u,e));return new xt(o,this._parents,t,e)}se.prototype.interrupt=Lc;se.prototype.transition=Vu;const pe=t=>()=>t;function Bu(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function yt(t,e,n){this.k=t,this.x=e,this.y=n}yt.prototype={constructor:yt,scale:function(t){return t===1?this:new yt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new yt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new yt(1,0,0);mr.prototype=yt.prototype;function mr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return Re;return t.__zoom}function Ze(t){t.stopImmediatePropagation()}function Ut(t){t.preventDefault(),t.stopImmediatePropagation()}function Fu(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ou(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function to(){return this.__zoom||Re}function Xu(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Yu(){return navigator.maxTouchPoints||"ontouchstart"in this}function ju(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function yr(){var t=Fu,e=Ou,n=ju,o=Xu,r=Yu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,u=ve,l=ze("start","zoom","end"),d,c,f,p=500,g=150,y=0,x=10;function m(v){v.property("__zoom",to).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",I).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,S,P){var C=v.selection?v.selection():v;C.property("__zoom",to),v!==C?N(v,A,S,P):C.interrupt().each(function(){b(this,arguments).event(P).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,S,P){m.scaleTo(v,function(){var C=this.__zoom.k,E=typeof A=="function"?A.apply(this,arguments):A;return C*E},S,P)},m.scaleTo=function(v,A,S,P){m.transform(v,function(){var C=e.apply(this,arguments),E=this.__zoom,L=S==null?w(C):typeof S=="function"?S.apply(this,arguments):S,V=E.invert(L),R=typeof A=="function"?A.apply(this,arguments):A;return n(h(_(E,R),L,V),C,s)},S,P)},m.translateBy=function(v,A,S,P){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof S=="function"?S.apply(this,arguments):S),e.apply(this,arguments),s)},null,P)},m.translateTo=function(v,A,S,P,C){m.transform(v,function(){var E=e.apply(this,arguments),L=this.__zoom,V=P==null?w(E):typeof P=="function"?P.apply(this,arguments):P;return n(Re.translate(V[0],V[1]).scale(L.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof S=="function"?-S.apply(this,arguments):-S),E,s)},P,C)};function _(v,A){return A=Math.max(i[0],Math.min(i[1],A)),A===v.k?v:new yt(A,v.x,v.y)}function h(v,A,S){var P=A[0]-S[0]*v.k,C=A[1]-S[1]*v.k;return P===v.x&&C===v.y?v:new yt(v.k,P,C)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,A,S,P){v.on("start.zoom",function(){b(this,arguments).event(P).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(P).end()}).tween("zoom",function(){var C=this,E=arguments,L=b(C,E).event(P),V=e.apply(C,E),R=S==null?w(V):typeof S=="function"?S.apply(C,E):S,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),O=C.__zoom,j=typeof A=="function"?A.apply(C,E):A,U=u(O.invert(R).concat(X/O.k),j.invert(R).concat(X/j.k));return function(G){if(G===1)G=j;else{var F=U(G),W=X/F[2];G=new yt(W,R[0]-F[0]*W,R[1]-F[1]*W)}L.zoom(null,G)}})}function b(v,A,S){return!S&&v.__zooming||new M(v,A)}function M(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=e.apply(v,A),this.taps=0}M.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var A=at(this.that).datum();l.call(v,this.that,new Bu(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function T(v,...A){if(!t.apply(this,arguments))return;var S=b(this,A).event(v),P=this.__zoom,C=Math.max(i[0],Math.min(i[1],P.k*Math.pow(2,o.apply(this,arguments)))),E=ut(v);if(S.wheel)(S.mouse[0][0]!==E[0]||S.mouse[0][1]!==E[1])&&(S.mouse[1]=P.invert(S.mouse[0]=E)),clearTimeout(S.wheel);else{if(P.k===C)return;S.mouse=[E,P.invert(E)],Se(this),S.start()}Ut(v),S.wheel=setTimeout(L,g),S.zoom("mouse",n(h(_(P,C),S.mouse[0],S.mouse[1]),S.extent,s));function L(){S.wheel=null,S.end()}}function z(v,...A){if(f||!t.apply(this,arguments))return;var S=v.currentTarget,P=b(this,A,!0).event(v),C=at(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),E=ut(v,S),L=v.clientX,V=v.clientY;sr(v.view),Ze(v),P.mouse=[E,this.__zoom.invert(E)],Se(this),P.start();function R(O){if(Ut(O),!P.moved){var j=O.clientX-L,U=O.clientY-V;P.moved=j*j+U*U>y}P.event(O).zoom("mouse",n(h(P.that.__zoom,P.mouse[0]=ut(O,S),P.mouse[1]),P.extent,s))}function X(O){C.on("mousemove.zoom mouseup.zoom",null),ar(O.view,P.moved),Ut(O),P.event(O).end()}}function B(v,...A){if(t.apply(this,arguments)){var S=this.__zoom,P=ut(v.changedTouches?v.changedTouches[0]:v,this),C=S.invert(P),E=S.k*(v.shiftKey?.5:2),L=n(h(_(S,E),P,C),e.apply(this,A),s);Ut(v),a>0?at(this).transition().duration(a).call(N,L,P,v):at(this).call(m.transform,L,P,v)}}function I(v,...A){if(t.apply(this,arguments)){var S=v.touches,P=S.length,C=b(this,A,v.changedTouches.length===P).event(v),E,L,V,R;for(Ze(v),L=0;L<P;++L)V=S[L],R=ut(V,this),R=[R,this.__zoom.invert(R),V.identifier],C.touch0?!C.touch1&&C.touch0[2]!==R[2]&&(C.touch1=R,C.taps=0):(C.touch0=R,E=!0,C.taps=1+!!d);d&&(d=clearTimeout(d)),E&&(C.taps<2&&(c=R[0],d=setTimeout(function(){d=null},p)),Se(this),C.start())}}function k(v,...A){if(this.__zooming){var S=b(this,A).event(v),P=v.changedTouches,C=P.length,E,L,V,R;for(Ut(v),E=0;E<C;++E)L=P[E],V=ut(L,this),S.touch0&&S.touch0[2]===L.identifier?S.touch0[0]=V:S.touch1&&S.touch1[2]===L.identifier&&(S.touch1[0]=V);if(L=S.that.__zoom,S.touch1){var X=S.touch0[0],O=S.touch0[1],j=S.touch1[0],U=S.touch1[1],G=(G=j[0]-X[0])*G+(G=j[1]-X[1])*G,F=(F=U[0]-O[0])*F+(F=U[1]-O[1])*F;L=_(L,Math.sqrt(G/F)),V=[(X[0]+j[0])/2,(X[1]+j[1])/2],R=[(O[0]+U[0])/2,(O[1]+U[1])/2]}else if(S.touch0)V=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(h(L,V,R),S.extent,s))}}function H(v,...A){if(this.__zooming){var S=b(this,A).event(v),P=v.changedTouches,C=P.length,E,L;for(Ze(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),E=0;E<C;++E)L=P[E],S.touch0&&S.touch0[2]===L.identifier?delete S.touch0:S.touch1&&S.touch1[2]===L.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(L=ut(L,this),Math.hypot(c[0]-L[0],c[1]-L[1])<x)){var V=at(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:pe(+v),m):o},m.filter=function(v){return arguments.length?(t=typeof v=="function"?v:pe(!!v),m):t},m.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:pe(!!v),m):r},m.extent=function(v){return arguments.length?(e=typeof v=="function"?v:pe([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):e},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(u=v,m):u},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,m):Math.sqrt(y)},m.tapDistance=function(v){return arguments.length?(x=+v,m):x},m}const ht={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ee=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],xr=["Enter"," ","Escape"],wr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Vt;(function(t){t.Strict="strict",t.Loose="loose"})(Vt||(Vt={}));var It;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(It||(It={}));var ne;(function(t){t.Partial="partial",t.Full="full"})(ne||(ne={}));const vr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Et;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Et||(Et={}));var Ae;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Ae||(Ae={}));var Y;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Y||(Y={}));const eo={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function _r(t){return t===null?null:t?"valid":"invalid"}const br=t=>"id"in t&&"source"in t&&"target"in t,Wu=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Nn=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ae=(t,e=[0,0])=>{const{width:n,height:o}=wt(t),r=t.origin??e,i=n*r[0],s=o*r[1];return{x:t.position.x-i,y:t.position.y-s}},Gu=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,r)=>{const i=typeof r=="string";let s=!e.nodeLookup&&!i?r:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(r):Nn(r)?r:e.nodeLookup.get(r.id));const a=s?ke(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ve(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Be(n)},ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(r=>{(e.filter===void 0||e.filter(r))&&(n=Ve(n,ke(r)),o=!0)}),o?Be(n):{x:0,y:0,width:0,height:0}},Mn=(t,e,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a={...le(e,[n,o,r]),width:e.width/r,height:e.height/r},u=[];for(const l of t.values()){const{measured:d,selectable:c=!0,hidden:f=!1}=l;if(s&&!c||f)continue;const p=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,y=oe(a,Ft(l)),x=(p??0)*(g??0),m=i&&y>0;(!l.internals.handleBounds||m||y>=x||l.dragging)&&u.push(l)}return u},qu=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function Uu(t,e){const n=new Map,o=e!=null&&e.nodes?new Set(e.nodes.map(r=>r.id)):null;return t.forEach(r=>{r.measured.width&&r.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function Ku({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=Uu(t,s),u=ce(a),l=Cn(u,e,n,(s==null?void 0:s.minZoom)??r,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await o.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function Er({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:u,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let c=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ht.error005());else{const p=a.measured.width,g=a.measured.height;p&&g&&(c=[[u,l],[u+p,l+g]])}else a&&Ot(s.extent)&&(c=[[s.extent[0][0]+u,s.extent[0][1]+l],[s.extent[1][0]+u,s.extent[1][1]+l]]);const f=Ot(c)?kt(e,c,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ht.error015())),{position:{x:f.x-u+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function Zu({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const p=i.has(f.id),g=!p&&f.parentId&&s.find(y=>y.id===f.parentId);(p||g)&&s.push(f)}const a=new Set(e.map(f=>f.id)),u=o.filter(f=>f.deletable!==!1),d=qu(s,u);for(const f of u)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!r)return{edges:d,nodes:s};const c=await r({nodes:s,edges:d});return typeof c=="boolean"?c?{edges:d,nodes:s}:{edges:[],nodes:[]}:c}const Bt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),kt=(t={x:0,y:0},e,n)=>({x:Bt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Bt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function Sr(t,e,n){const{width:o,height:r}=wt(n),{x:i,y:s}=n.internals.positionAbsolute;return kt(t,[[i,s],[i+o,s+r]],e)}const no=(t,e,n)=>t<e?Bt(Math.abs(t-e),1,e)/e:t>n?-Bt(Math.abs(t-n),1,e)/e:0,Nr=(t,e,n=15,o=40)=>{const r=no(t.x,o,e.width-o)*n,i=no(t.y,o,e.height-o)*n;return[r,i]},Ve=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),gn=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),Be=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ft=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Nn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,width:((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},ke=(t,e=[0,0])=>{var r,i;const{x:n,y:o}=Nn(t)?t.internals.positionAbsolute:ae(t,e);return{x:n,y:o,x2:n+(((r=t.measured)==null?void 0:r.width)??t.width??t.initialWidth??0),y2:o+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},Mr=(t,e)=>Be(Ve(gn(t),gn(e))),oe=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},oo=t=>lt(t.width)&<(t.height)&<(t.x)&<(t.y),lt=t=>!isNaN(t)&&isFinite(t),Qu=(t,e)=>{},ue=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),le=({x:t,y:e},[n,o,r],i=!1,s=[1,1])=>{const a={x:(t-n)/r,y:(e-o)/r};return i?ue(a,s):a},Pe=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function Tt(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Ju(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Tt(t,n),r=Tt(t,e);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof t=="object"){const o=Tt(t.top??t.y??0,n),r=Tt(t.bottom??t.y??0,n),i=Tt(t.left??t.x??0,e),s=Tt(t.right??t.x??0,e);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function tl(t,e,n,o,r,i){const{x:s,y:a}=Pe(t,[e,n,o]),{x:u,y:l}=Pe({x:t.x+t.width,y:t.y+t.height},[e,n,o]),d=r-u,c=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(c)}}const Cn=(t,e,n,o,r,i)=>{const s=Ju(i,e,n),a=(e-s.x)/t.width,u=(n-s.y)/t.height,l=Math.min(a,u),d=Bt(l,o,r),c=t.x+t.width/2,f=t.y+t.height/2,p=e/2-c*d,g=n/2-f*d,y=tl(t,p,g,d,e,n),x={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:p-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},re=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function Ot(t){return t!=null&&t!=="parent"}function wt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function Cr(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Ir(t,e={width:0,height:0},n,o,r){const i={...t},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function ro(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function el(){let t,e;return{promise:new Promise((o,r)=>{t=o,e=r}),resolve:t,reject:e}}function nl(t){return{...wr,...t||{}}}function Qt(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ft(t),a=le({x:i-((r==null?void 0:r.left)??0),y:s-((r==null?void 0:r.top)??0)},o),{x:u,y:l}=n?ue(a,e):a;return{xSnapped:u,ySnapped:l,...a}}const In=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ar=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},ol=["INPUT","SELECT","TEXTAREA"];function kr(t){var o,r;const e=((r=(o=t.composedPath)==null?void 0:o.call(t))==null?void 0:r[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:ol.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Pr=t=>"clientX"in t,ft=(t,e)=>{var i,s;const n=Pr(t),o=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,r=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:o-((e==null?void 0:e.left)??0),y:r-((e==null?void 0:e.top)??0)}},io=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...In(s)}})};function $r({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const u=t*.125+r*.375+s*.375+n*.125,l=e*.125+i*.375+a*.375+o*.125,d=Math.abs(u-t),c=Math.abs(l-e);return[u,l,d,c]}function me(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function so({pos:t,x1:e,y1:n,x2:o,y2:r,c:i}){switch(t){case Y.Left:return[e-me(e-o,i),n];case Y.Right:return[e+me(o-e,i),n];case Y.Top:return[e,n-me(n-r,i)];case Y.Bottom:return[e,n+me(r-n,i)]}}function Tr({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,u]=so({pos:n,x1:t,y1:e,x2:o,y2:r,c:s}),[l,d]=so({pos:i,x1:o,y1:r,x2:t,y2:e,c:s}),[c,f,p,g]=$r({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:a,sourceControlY:u,targetControlX:l,targetControlY:d});return[`M${t},${e} C${a},${u} ${l},${d} ${o},${r}`,c,f,p,g]}function zr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,s=Math.abs(o-e)/2,a=o<e?o+s:o-s;return[i,a,r,s]}function rl({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0);return s+a}function il({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=Ve(ke(t),ke(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return oe(s,Be(i))>0}const sl=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,al=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),cl=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||sl;let r;return br(t)?r={...t}:r={...t,id:o(t)},al(r,e)?e:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,e.concat(r))};function Dr({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,s,a]=zr({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,s,a]}const ao={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},ul=({source:t,sourcePosition:e=Y.Bottom,target:n})=>e===Y.Left||e===Y.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},co=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function ll({source:t,sourcePosition:e=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=ao[e],u=ao[o],l={x:t.x+a.x*i,y:t.y+a.y*i},d={x:n.x+u.x*i,y:n.y+u.y*i},c=ul({source:l,sourcePosition:e,target:d}),f=c.x!==0?"x":"y",p=c[f];let g=[],y,x;const m={x:0,y:0},_={x:0,y:0},[,,h,w]=zr({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[f]*u[f]===-1){f==="x"?(y=r.x??l.x+(d.x-l.x)*s,x=r.y??(l.y+d.y)/2):(y=r.x??(l.x+d.x)/2,x=r.y??l.y+(d.y-l.y)*s);const b=[{x:y,y:l.y},{x:y,y:d.y}],M=[{x:l.x,y:x},{x:d.x,y:x}];a[f]===p?g=f==="x"?b:M:g=f==="x"?M:b}else{const b=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===p?M:b:g=a.y===p?b:M,e===o){const k=Math.abs(t[f]-n[f]);if(k<=i){const H=Math.min(i-1,i-k);a[f]===p?m[f]=(l[f]>t[f]?-1:1)*H:_[f]=(d[f]>n[f]?-1:1)*H}}if(e!==o){const k=f==="x"?"y":"x",H=a[f]===u[k],v=l[k]>d[k],A=l[k]<d[k];(a[f]===1&&(!H&&v||H&&A)||a[f]!==1&&(!H&&A||H&&v))&&(g=f==="x"?b:M)}const T={x:l.x+m.x,y:l.y+m.y},z={x:d.x+_.x,y:d.y+_.y},B=Math.max(Math.abs(T.x-g[0].x),Math.abs(z.x-g[0].x)),I=Math.max(Math.abs(T.y-g[0].y),Math.abs(z.y-g[0].y));B>=I?(y=(T.x+z.x)/2,x=g[0].y):(y=g[0].x,x=(T.y+z.y)/2)}return[[t,{x:l.x+m.x,y:l.y+m.y},...g,{x:d.x+_.x,y:d.y+_.y},n],y,x,h,w]}function fl(t,e,n,o){const r=Math.min(co(t,e)/2,co(e,n)/2,o),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const l=t.x<n.x?-1:1,d=t.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*d}`}const a=t.x<n.x?1:-1,u=t.y<n.y?-1:1;return`L ${i},${s+r*u}Q ${i},${s} ${i+r*a},${s}`}function pn({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:u,offset:l=20,stepPosition:d=.5}){const[c,f,p,g,y]=ll({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:u},offset:l,stepPosition:d});return[c.reduce((m,_,h)=>{let w="";return h>0&&h<c.length-1?w=fl(c[h-1],_,c[h+1],s):w=`${h===0?"M":"L"}${_.x} ${_.y}`,m+=w,m},""),f,p,g,y]}function uo(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function dl(t){var c;const{sourceNode:e,targetNode:n}=t;if(!uo(e)||!uo(n))return null;const o=e.internals.handleBounds||lo(e.handles),r=n.internals.handleBounds||lo(n.handles),i=fo((o==null?void 0:o.source)??[],t.sourceHandle),s=fo(t.connectionMode===Vt.Strict?(r==null?void 0:r.target)??[]:((r==null?void 0:r.target)??[]).concat((r==null?void 0:r.source)??[]),t.targetHandle);if(!i||!s)return(c=t.onError)==null||c.call(t,"008",ht.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||Y.Bottom,u=(s==null?void 0:s.position)||Y.Top,l=Pt(e,i,a),d=Pt(n,s,u);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:u}}function lo(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Pt(t,e,n=Y.Left,o=!1){const r=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??wt(t);if(o)return{x:r+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function fo(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function mn(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function hl(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(u=>{if(u&&typeof u=="object"){const l=mn(u,e);i.has(l)||(s.push({id:l,color:u.color||n,...u}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const Lr=1e3,gl=10,An={nodeOrigin:[0,0],nodeExtent:ee,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},pl={...An,checkEquality:!0};function kn(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function ml(t,e,n){const o=kn(An,n);for(const r of t.values())if(r.parentId)$n(r,t,e,o);else{const i=ae(r,o.nodeOrigin),s=Ot(r.extent)?r.extent:o.nodeExtent,a=kt(i,s,wt(r));r.internals.positionAbsolute=a}}function yl(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],o=[];for(const r of t.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:t.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function Pn(t){return t==="manual"}function yn(t,e,n,o={}){var l,d;const r=kn(pl,o),i={i:0},s=new Map(e),a=r!=null&&r.elevateNodesOnSelect&&!Pn(r.zIndexMode)?Lr:0;let u=t.length>0;e.clear(),n.clear();for(const c of t){let f=s.get(c.id);if(r.checkEquality&&c===(f==null?void 0:f.internals.userNode))e.set(c.id,f);else{const p=ae(c,r.nodeOrigin),g=Ot(c.extent)?c.extent:r.nodeExtent,y=kt(p,g,wt(c));f={...r.defaults,...c,measured:{width:(l=c.measured)==null?void 0:l.width,height:(d=c.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:yl(c,f),z:Hr(c,a,r.zIndexMode),userNode:c}},e.set(c.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(u=!1),c.parentId&&$n(f,e,n,o,i)}return u}function xl(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function $n(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:u}=kn(An,o),l=t.parentId,d=e.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xl(t,n),r&&!d.parentId&&d.internals.rootParentIndex===void 0&&u==="auto"&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+r.i*gl),r&&d.internals.rootParentIndex!==void 0&&(r.i=d.internals.rootParentIndex);const c=i&&!Pn(u)?Lr:0,{x:f,y:p,z:g}=wl(t,d,s,a,c,u),{positionAbsolute:y}=t.internals,x=f!==y.x||p!==y.y;(x||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:x?{x:f,y:p}:y,z:g}})}function Hr(t,e,n){const o=lt(t.zIndex)?t.zIndex:0;return Pn(n)?o:o+(t.selected?e:0)}function wl(t,e,n,o,r,i){const{x:s,y:a}=e.internals.positionAbsolute,u=wt(t),l=ae(t,n),d=Ot(t.extent)?kt(l,t.extent,u):l;let c=kt({x:s+d.x,y:a+d.y},o,u);t.extent==="parent"&&(c=Sr(c,u,e));const f=Hr(t,r,i),p=e.internals.z??0;return{x:c.x,y:c.y,z:p>=f?p+1:f}}function Tn(t,e,n,o=[0,0]){var s;const r=[],i=new Map;for(const a of t){const u=e.get(a.parentId);if(!u)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ft(u),d=Mr(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:u})}return i.size>0&&i.forEach(({expandedRect:a,parent:u},l)=>{var h;const d=u.internals.positionAbsolute,c=wt(u),f=u.origin??o,p=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,y=Math.max(c.width,Math.round(a.width)),x=Math.max(c.height,Math.round(a.height)),m=(y-c.width)*f[0],_=(x-c.height)*f[1];(p>0||g>0||m||_)&&(r.push({id:l,type:"position",position:{x:u.position.x-p+m,y:u.position.y-g+_}}),(h=n.get(l))==null||h.forEach(w=>{t.some(N=>N.id===w.id)||r.push({id:w.id,type:"position",position:{x:w.position.x+p,y:w.position.y+g}})})),(c.width<a.width||c.height<a.height||p||g)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:y+(p?f[0]*p-m:0),height:x+(g?f[1]*g-_:0)}})}),r}function vl(t,e,n,o,r,i,s){const a=o==null?void 0:o.querySelector(".xyflow__viewport");let u=!1;if(!a)return{changes:[],updatedInternals:u};const l=[],d=window.getComputedStyle(a),{m22:c}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const p of t.values()){const g=e.get(p.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),u=!0;continue}const y=In(p.nodeElement),x=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(x||!g.internals.handleBounds||p.force))){const _=p.nodeElement.getBoundingClientRect(),h=Ot(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=Sr(w,y,e.get(g.parentId)):h&&(w=kt(w,h,y));const N={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:io("source",p.nodeElement,_,c,g.id),target:io("target",p.nodeElement,_,c,g.id)}}};e.set(g.id,N),g.parentId&&$n(N,e,n,{nodeOrigin:r,zIndexMode:s}),u=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ft(N,r)}))}}if(f.length>0){const p=Tn(f,e,n,r);l.push(...p)}return{changes:l,updatedInternals:u}}async function _l({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function ho(t,e,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,e)),s=`${r}-${t}`;const u=o.get(s)||new Map;if(o.set(s,u.set(n,e)),i){s=`${r}-${t}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,e))}}function Rr(t,e,n){t.clear(),e.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,u={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,d=`${i}-${a}--${r}-${s}`;ho("source",u,d,t,r,s),ho("target",u,l,t,i,a),e.set(o.id,o)}}function Vr(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:Vr(n,e):!1}function go(t,e,n){var r;let o=t;do{if((r=o==null?void 0:o.matches)!=null&&r.call(o,e))return!0;if(o===n)return!1;o=o==null?void 0:o.parentElement}while(o);return!1}function bl(t,e,n,o){const r=new Map;for(const[i,s]of t)if((s.selected||s.id===o)&&(!s.parentId||!Vr(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.get(i);a&&r.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return r}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){var s,a,u;const r=[];for(const[l,d]of e){const c=(s=n.get(l))==null?void 0:s.internals.userNode;c&&r.push({...c,position:d.position,dragging:o})}if(!t)return[r[0],r];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((u=e.get(t))==null?void 0:u.position)||i.position,dragging:o}:r[0],r]}function El({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=ue(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Sl({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,u=!1,l={x:0,y:0},d=null,c=!1,f=null,p=!1,g=!1,y=null;function x({noDragClassName:_,handleSelector:h,domNode:w,isSelectable:N,nodeId:b,nodeClickDistance:M=0}){f=at(w);function T({x:k,y:H}){const{nodeLookup:v,nodeExtent:A,snapGrid:S,snapToGrid:P,nodeOrigin:C,onNodeDrag:E,onSelectionDrag:L,onError:V,updateNodePositions:R}=e();i={x:k,y:H};let X=!1;const O=a.size>1,j=O&&A?gn(ce(a)):null,U=O&&P?El({dragItems:a,snapGrid:S,x:k,y:H}):null;for(const[G,F]of a){if(!v.has(G))continue;let W={x:k-F.distance.x,y:H-F.distance.y};P&&(W=U?{x:Math.round(W.x+U.x),y:Math.round(W.y+U.y)}:ue(W,S));let Q=null;if(O&&A&&!F.extent&&j){const{positionAbsolute:q}=F.internals,et=q.x-j.x+A[0][0],nt=q.x+F.measured.width-j.x2+A[1][0],tt=q.y-j.y+A[0][1],st=q.y+F.measured.height-j.y2+A[1][1];Q=[[et,tt],[nt,st]]}const{position:Z,positionAbsolute:K}=Er({nodeId:G,nextPosition:W,nodeLookup:v,nodeExtent:Q||A,nodeOrigin:C,onError:V});X=X||F.position.x!==Z.x||F.position.y!==Z.y,F.position=Z,F.internals.positionAbsolute=K}if(g=g||X,!!X&&(R(a,!0),y&&(o||E||!b&&L))){const[G,F]=Qe({nodeId:b,dragItems:a,nodeLookup:v});o==null||o(y,a,G,F),E==null||E(y,G,F),b||L==null||L(y,F)}}async function z(){if(!d)return;const{transform:k,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:A}=e();if(!A){u=!1,cancelAnimationFrame(s);return}const[S,P]=Nr(l,d,v);(S!==0||P!==0)&&(i.x=(i.x??0)-S/k[2],i.y=(i.y??0)-P/k[2],await H({x:S,y:P})&&T(i)),s=requestAnimationFrame(z)}function B(k){var O;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:A,transform:S,snapGrid:P,snapToGrid:C,selectNodesOnDrag:E,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=e();c=!0,(!E||!N)&&!v&&b&&((O=H.get(b))!=null&&O.selected||R()),N&&E&&b&&(t==null||t(b));const X=Qt(k.sourceEvent,{transform:S,snapGrid:P,snapToGrid:C,containerBounds:d});if(i=X,a=bl(H,A,X,b),a.size>0&&(n||L||!b&&V)){const[j,U]=Qe({nodeId:b,dragItems:a,nodeLookup:H});n==null||n(k.sourceEvent,a,j,U),L==null||L(k.sourceEvent,j,U),b||V==null||V(k.sourceEvent,U)}}const I=cr().clickDistance(M).on("start",k=>{const{domNode:H,nodeDragThreshold:v,transform:A,snapGrid:S,snapToGrid:P}=e();d=(H==null?void 0:H.getBoundingClientRect())||null,p=!1,g=!1,y=k.sourceEvent,v===0&&B(k),i=Qt(k.sourceEvent,{transform:A,snapGrid:S,snapToGrid:P,containerBounds:d}),l=ft(k.sourceEvent,d)}).on("drag",k=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:A,snapToGrid:S,nodeDragThreshold:P,nodeLookup:C}=e(),E=Qt(k.sourceEvent,{transform:v,snapGrid:A,snapToGrid:S,containerBounds:d});if(y=k.sourceEvent,(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1||b&&!C.has(b))&&(p=!0),!p){if(!u&&H&&c&&(u=!0,z()),!c){const L=ft(k.sourceEvent,d),V=L.x-l.x,R=L.y-l.y;Math.sqrt(V*V+R*R)>P&&B(k)}(i.x!==E.xSnapped||i.y!==E.ySnapped)&&a&&c&&(l=ft(k.sourceEvent,d),T(E))}}).on("end",k=>{if(!(!c||p)&&(u=!1,c=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:A,onSelectionDragStop:S}=e();if(g&&(v(a,!1),g=!1),r||A||!b&&S){const[P,C]=Qe({nodeId:b,dragItems:a,nodeLookup:H,dragging:!1});r==null||r(k.sourceEvent,a,P,C),A==null||A(k.sourceEvent,P,C),b||S==null||S(k.sourceEvent,C)}}}).filter(k=>{const H=k.target;return!k.button&&(!_||!go(H,`.${_}`,w))&&(!h||go(H,h,w))});f.call(I)}function m(){f==null||f.on(".drag",null)}return{update:x,destroy:m}}function Nl(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())oe(r,Ft(i))>0&&o.push(i);return o}const Ml=250;function Cl(t,e,n,o){var a,u;let r=[],i=1/0;const s=Nl(t,n,e+Ml);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((u=l.internals.handleBounds)==null?void 0:u.target)??[]];for(const c of d){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:f,y:p}=Pt(l,c,c.position,!0),g=Math.sqrt(Math.pow(f-t.x,2)+Math.pow(p-t.y,2));g>e||(g<i?(r=[{...c,x:f,y:p}],i=g):g===i&&r.push({...c,x:f,y:p}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(d=>d.type===l)??r[0]}return r[0]}function Br(t,e,n,o,r,i=!1){var l,d,c;const s=o.get(t);if(!s)return null;const a=r==="strict"?(l=s.internals.handleBounds)==null?void 0:l[e]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((c=s.internals.handleBounds)==null?void 0:c.target)??[]],u=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return u&&i?{...u,...Pt(s,u,u.position,!0)}:u}function Fr(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Il(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Or=()=>!0;function Al(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:u,lib:l,autoPanOnConnect:d,flowId:c,panBy:f,cancelConnection:p,onConnectStart:g,onConnect:y,onConnectEnd:x,isValidConnection:m=Or,onReconnectEnd:_,updateConnection:h,getTransform:w,getFromHandle:N,autoPanSpeed:b,dragThreshold:M=1,handleDomNode:T}){const z=Ar(t.target);let B=0,I;const{x:k,y:H}=ft(t),v=Fr(i,T),A=a==null?void 0:a.getBoundingClientRect();let S=!1;if(!A||!v)return;const P=Br(r,v,o,u,e);if(!P)return;let C=ft(t,A),E=!1,L=null,V=!1,R=null;function X(){if(!d||!A)return;const[Z,K]=Nr(C,A,b);f({x:Z,y:K}),B=requestAnimationFrame(X)}const O={...P,nodeId:r,type:v,position:P.position},j=u.get(r);let G={inProgress:!0,isValid:null,from:Pt(j,O,Y.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:j,to:C,toHandle:null,toPosition:eo[O.position],toNode:null,pointer:C};function F(){S=!0,h(G),g==null||g(t,{nodeId:r,handleId:o,handleType:v})}M===0&&F();function W(Z){if(!S){const{x:st,y:vt}=ft(Z),pt=st-k,Nt=vt-H;if(!(pt*pt+Nt*Nt>M*M))return;F()}if(!N()||!O){Q(Z);return}const K=w();C=ft(Z,A),I=Cl(le(C,K,!1,[1,1]),n,u,O),E||(X(),E=!0);const q=Xr(Z,{handle:I,connectionMode:e,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:z,lib:l,flowId:c,nodeLookup:u});R=q.handleDomNode,L=q.connection,V=Il(!!I,q.isValid);const et=u.get(r),nt=et?Pt(et,O,Y.Left,!0):G.from,tt={...G,from:nt,isValid:V,to:q.toHandle&&V?Pe({x:q.toHandle.x,y:q.toHandle.y},K):C,toHandle:q.toHandle,toPosition:V&&q.toHandle?q.toHandle.position:eo[O.position],toNode:q.toHandle?u.get(q.toHandle.nodeId):null,pointer:C};h(tt),G=tt}function Q(Z){if(!("touches"in Z&&Z.touches.length>0)){if(S){(I||R)&&L&&V&&(y==null||y(L));const{inProgress:K,...q}=G,et={...q,toPosition:G.toHandle?G.toPosition:null};x==null||x(Z,et),i&&(_==null||_(Z,et))}p(),cancelAnimationFrame(B),E=!1,V=!1,L=null,R=null,z.removeEventListener("mousemove",W),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",W),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",W),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",W),z.addEventListener("touchend",Q)}function Xr(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:u,isValidConnection:l=Or,nodeLookup:d}){const c=i==="target",f=e?s.querySelector(`.${a}-flow__handle[data-id="${u}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:p,y:g}=ft(t),y=s.elementFromPoint(p,g),x=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Fr(void 0,x),h=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!h||!_)return m;const M={source:c?h:o,sourceHandle:c?w:r,target:c?o:h,targetHandle:c?r:w};m.connection=M;const z=N&&b&&(n===Vt.Strict?c&&_==="source"||!c&&_==="target":h!==o||w!==r);m.isValid=z&&l(M),m.toHandle=Br(h,_,w,d,n,!0)}return m}const xn={onPointerDown:Al,isValid:Xr};function kl({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=at(t);function i({translateExtent:a,width:u,height:l,zoomStep:d=1,pannable:c=!0,zoomable:f=!0,inversePan:p=!1}){const g=h=>{if(h.sourceEvent.type!=="wheel"||!e)return;const w=n(),N=h.sourceEvent.ctrlKey&&re()?10:1,b=-h.sourceEvent.deltaY*(h.sourceEvent.deltaMode===1?.05:h.sourceEvent.deltaMode?1:.002)*d,M=w[2]*Math.pow(2,b*N);e.scaleTo(M)};let y=[0,0];const x=h=>{(h.sourceEvent.type==="mousedown"||h.sourceEvent.type==="touchstart")&&(y=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY])},m=h=>{const w=n();if(h.sourceEvent.type!=="mousemove"&&h.sourceEvent.type!=="touchmove"||!e)return;const N=[h.sourceEvent.clientX??h.sourceEvent.touches[0].clientX,h.sourceEvent.clientY??h.sourceEvent.touches[0].clientY],b=[N[0]-y[0],N[1]-y[1]];y=N;const M=o()*Math.max(w[2],Math.log(w[2]))*(p?-1:1),T={x:w[0]-b[0]*M,y:w[1]-b[1]*M},z=[[0,0],[u,l]];e.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},z,a)},_=yr().on("start",x).on("zoom",c?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:ut}}const Fe=t=>({x:t.x,y:t.y,zoom:t.k}),Je=({x:t,y:e,zoom:n})=>Re.translate(t,e).scale(n),zt=(t,e)=>t.target.closest(`.${e}`),Yr=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Pl=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,tn=(t,e=0,n=Pl,o=()=>{})=>{const r=typeof e=="number"&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},jr=t=>{const e=t.ctrlKey&&re()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function $l({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:u,onPanZoomEnd:l}){return d=>{if(zt(d,e))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const c=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=ut(d),m=jr(d),_=c*Math.pow(2,m);o.scaleTo(n,_,x,d);return}const f=d.deltaMode===1?20:1;let p=r===It.Vertical?0:d.deltaX*f,g=r===It.Horizontal?0:d.deltaY*f;!re()&&d.shiftKey&&r!==It.Vertical&&(p=d.deltaY*f,g=0),o.translateBy(n,-(p/c)*i,-(g/c)*i,{internal:!0});const y=Fe(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(u==null||u(d,y),t.panScrollTimeout=setTimeout(()=>{l==null||l(d,y),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(d,y))}}function Tl({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!e&&i&&!o.ctrlKey,a=zt(o,t);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function zl({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{var i,s,a;if((i=o.sourceEvent)!=null&&i.internal)return;const r=Fe(o.transform);t.mouseButton=((s=o.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=r,((a=o.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(o.sourceEvent,r))}}function Dl({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Yr(e,t.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!((a=i.sourceEvent)!=null&&a.internal)&&(r==null||r(i.sourceEvent,Fe(i.transform)))}}function Ll({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Yr(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const u=Fe(s.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{r==null||r(s.sourceEvent,u)},n?150:0)}}}function Hl({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:u,lib:l,connectionInProgress:d}){return c=>{var x;const f=t||e,p=n&&c.ctrlKey,g=c.type==="wheel";if(c.button===1&&c.type==="mousedown"&&(zt(c,`${l}-flow__node`)||zt(c,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||d&&!g||zt(c,a)&&g||zt(c,u)&&(!g||r&&g&&!t)||!n&&c.ctrlKey&&g)return!1;if(!n&&c.type==="touchstart"&&((x=c.touches)==null?void 0:x.length)>1)return c.preventDefault(),!1;if(!f&&!r&&!p&&g||!o&&(c.type==="mousedown"||c.type==="touchstart")||Array.isArray(o)&&!o.includes(c.button)&&c.type==="mousedown")return!1;const y=Array.isArray(o)&&o.includes(c.button)||!c.button||c.button<=1;return(!c.ctrlKey||g)&&y}}function Rl({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:u}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=t.getBoundingClientRect(),c=yr().scaleExtent([e,n]).translateExtent(o),f=at(t).call(c);_({x:r.x,y:r.y,zoom:Bt(r.zoom,e,n)},[[0,0],[d.width,d.height]],o);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");c.wheelDelta(jr);function y(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).transform(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function x({noWheelClassName:I,noPanClassName:k,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:A,panOnDrag:S,panOnScrollMode:P,panOnScrollSpeed:C,preventScrolling:E,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:X,lib:O,onTransformChange:j,connectionInProgress:U,paneClickDistance:G,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=A&&!X&&!v;c.clickDistance(F?1/0:!lt(G)||G<0?0:G);const Q=W?$l({zoomPanValues:l,noWheelClassName:I,d3Selection:f,d3Zoom:c,panOnScrollMode:P,panOnScrollSpeed:C,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Tl({noWheelClassName:I,preventScrolling:E,d3ZoomHandler:p});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const K=zl({zoomPanValues:l,onDraggingChange:u,onPanZoomStart:s});c.on("start",K);const q=Dl({zoomPanValues:l,panOnDrag:S,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:j});c.on("zoom",q);const et=Ll({zoomPanValues:l,panOnDrag:S,panOnScroll:A,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:u});c.on("end",et)}const Z=Hl({zoomActivationKeyPressed:X,panOnDrag:S,zoomOnScroll:V,panOnScroll:A,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:v,noPanClassName:k,noWheelClassName:I,lib:O,connectionInProgress:U});c.filter(Z),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){c.on("zoom",null)}async function _(I,k,H){const v=Je(I),A=c==null?void 0:c.constrain()(v,k,H);return A&&await y(A),new Promise(S=>S(A))}async function h(I,k){const H=Je(I);return await y(H,k),new Promise(v=>v(H))}function w(I){if(f){const k=Je(I),H=f.property("__zoom");(H.k!==I.zoom||H.x!==I.x||H.y!==I.y)&&(c==null||c.transform(f,k,null,{sync:!0}))}}function N(){const I=f?mr(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function b(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).scaleTo(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function M(I,k){return f?new Promise(H=>{c==null||c.interpolate((k==null?void 0:k.interpolate)==="linear"?Ue:ve).scaleBy(tn(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>H(!0)),I)}):Promise.resolve(!1)}function T(I){c==null||c.scaleExtent(I)}function z(I){c==null||c.translateExtent(I)}function B(I){const k=!lt(I)||I<0?0:I;c==null||c.clickDistance(k)}return{update:x,destroy:m,setViewport:h,setViewportConstrained:_,getViewport:N,scaleTo:b,scaleBy:M,setScaleExtent:T,setTranslateExtent:z,syncViewport:w,setClickDistance:B}}var Xt;(function(t){t.Line="line",t.Handle="handle"})(Xt||(Xt={}));function Vl({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=t-e,a=n-o,u=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(u[0]=u[0]*-1),a&&i&&(u[1]=u[1]*-1),u}function po(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),r=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:r}}function _t(t,e){return Math.max(0,e-t)}function bt(t,e){return Math.max(0,t-e)}function ye(t,e,n){return Math.max(0,e-t,t-n)}function mo(t,e){return t?!e:e}function Bl(t,e,n,o,r,i,s,a){let{affectsX:u,affectsY:l}=e;const{isHorizontal:d,isVertical:c}=e,f=d&&c,{xSnapped:p,ySnapped:g}=n,{minWidth:y,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:h,y:w,width:N,height:b,aspectRatio:M}=t;let T=Math.floor(d?p-t.pointerX:0),z=Math.floor(c?g-t.pointerY:0);const B=N+(u?-T:T),I=b+(l?-z:z),k=-i[0]*N,H=-i[1]*b;let v=ye(B,y,x),A=ye(I,m,_);if(s){let C=0,E=0;u&&T<0?C=_t(h+T+k,s[0][0]):!u&&T>0&&(C=bt(h+B+k,s[1][0])),l&&z<0?E=_t(w+z+H,s[0][1]):!l&&z>0&&(E=bt(w+I+H,s[1][1])),v=Math.max(v,C),A=Math.max(A,E)}if(a){let C=0,E=0;u&&T>0?C=bt(h+T,a[0][0]):!u&&T<0&&(C=_t(h+B,a[1][0])),l&&z>0?E=bt(w+z,a[0][1]):!l&&z<0&&(E=_t(w+I,a[1][1])),v=Math.max(v,C),A=Math.max(A,E)}if(r){if(d){const C=ye(B/M,m,_)*M;if(v=Math.max(v,C),s){let E=0;!u&&!l||u&&!l&&f?E=bt(w+H+B/M,s[1][1])*M:E=_t(w+H+(u?T:-T)/M,s[0][1])*M,v=Math.max(v,E)}if(a){let E=0;!u&&!l||u&&!l&&f?E=_t(w+B/M,a[1][1])*M:E=bt(w+(u?T:-T)/M,a[0][1])*M,v=Math.max(v,E)}}if(c){const C=ye(I*M,y,x)/M;if(A=Math.max(A,C),s){let E=0;!u&&!l||l&&!u&&f?E=bt(h+I*M+k,s[1][0])/M:E=_t(h+(l?z:-z)*M+k,s[0][0])/M,A=Math.max(A,E)}if(a){let E=0;!u&&!l||l&&!u&&f?E=_t(h+I*M,a[1][0])/M:E=bt(h+(l?z:-z)*M,a[0][0])/M,A=Math.max(A,E)}}}z=z+(z<0?A:-A),T=T+(T<0?v:-v),r&&(f?B>I*M?z=(mo(u,l)?-T:T)/M:T=(mo(u,l)?-z:z)*M:d?(z=T/M,l=u):(T=z*M,u=l));const S=u?h+T:h,P=l?w+z:w;return{width:N+(u?-T:T),height:b+(l?-z:z),x:i[0]*T*(u?-1:1)+S,y:i[1]*z*(l?-1:1)+P}}const Wr={width:0,height:0,x:0,y:0},Fl={...Wr,pointerX:0,pointerY:0,aspectRatio:1};function Ol(t){return[[0,0],[t.measured.width,t.measured.height]]}function Xl(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,u=n[1]*s;return[[o-a,r-u],[o+i-a,r+s-u]]}function Yl({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=at(t);let s={controlDirection:po("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:c,resizeDirection:f,onResizeStart:p,onResize:g,onResizeEnd:y,shouldResize:x}){let m={...Wr},_={...Fl};s={boundaries:d,resizeDirection:f,keepAspectRatio:c,controlDirection:po(l)};let h,w=null,N=[],b,M,T,z=!1;const B=cr().on("start",I=>{const{nodeLookup:k,transform:H,snapGrid:v,snapToGrid:A,nodeOrigin:S,paneDomNode:P}=n();if(h=k.get(e),!h)return;w=(P==null?void 0:P.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:E}=Qt(I.sourceEvent,{transform:H,snapGrid:v,snapToGrid:A,containerBounds:w});m={width:h.measured.width??0,height:h.measured.height??0,x:h.position.x??0,y:h.position.y??0},_={...m,pointerX:C,pointerY:E,aspectRatio:m.width/m.height},b=void 0,h.parentId&&(h.extent==="parent"||h.expandParent)&&(b=k.get(h.parentId),M=b&&h.extent==="parent"?Ol(b):void 0),N=[],T=void 0;for(const[L,V]of k)if(V.parentId===e&&(N.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Xl(V,h,V.origin??S);T?T=[[Math.min(R[0][0],T[0][0]),Math.min(R[0][1],T[0][1])],[Math.max(R[1][0],T[1][0]),Math.max(R[1][1],T[1][1])]]:T=R}p==null||p(I,{...m})}).on("drag",I=>{const{transform:k,snapGrid:H,snapToGrid:v,nodeOrigin:A}=n(),S=Qt(I.sourceEvent,{transform:k,snapGrid:H,snapToGrid:v,containerBounds:w}),P=[];if(!h)return;const{x:C,y:E,width:L,height:V}=m,R={},X=h.origin??A,{width:O,height:j,x:U,y:G}=Bl(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,X,M,T),F=O!==L,W=j!==V,Q=U!==C&&F,Z=G!==E&&W;if(!Q&&!Z&&!F&&!W)return;if((Q||Z||X[0]===1||X[1]===1)&&(R.x=Q?U:m.x,R.y=Z?G:m.y,m.x=R.x,m.y=R.y,N.length>0)){const nt=U-C,tt=G-E;for(const st of N)st.position={x:st.position.x-nt+X[0]*(O-L),y:st.position.y-tt+X[1]*(j-V)},P.push(st)}if((F||W)&&(R.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?O:m.width,R.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?j:m.height,m.width=R.width,m.height=R.height),b&&h.expandParent){const nt=X[0]*(R.width??0);R.x&&R.x<nt&&(m.x=nt,_.x=_.x-(R.x-nt));const tt=X[1]*(R.height??0);R.y&&R.y<tt&&(m.y=tt,_.y=_.y-(R.y-tt))}const K=Vl({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...m,direction:K};(x==null?void 0:x(I,q))!==!1&&(z=!0,g==null||g(I,q),o(R,P))}).on("end",I=>{z&&(y==null||y(I,{...m}),r==null||r({...m}),z=!1)});i.call(B)}function u(){i.on(".drag",null)}return{update:a,destroy:u}}var en={exports:{}},nn={},on={exports:{}},rn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
|
@@ -21,4 +21,4 @@ import{dW as Mt,dX as Yn,dY as jn,dZ as Ps,d_ as Ue,b8 as jo,d$ as $s,aG as Ts,r
|
|
|
21
21
|
+`).split(`
|
|
22
22
|
`)),d=l.reduce((c,f)=>c.concat(...f),[]);return[l,d]}return[[],[]]},[t]);return D.useEffect(()=>{const u=(e==null?void 0:e.target)??Co,l=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const d=p=>{var x,m;if(r.current=p.ctrlKey||p.metaKey||p.shiftKey||p.altKey,(!r.current||r.current&&!l)&&kr(p))return!1;const y=Ao(p.code,a);if(i.current.add(p[y]),Io(s,i.current,!1)){const _=((m=(x=p.composedPath)==null?void 0:x.call(p))==null?void 0:m[0])||p.target,h=(_==null?void 0:_.nodeName)==="BUTTON"||(_==null?void 0:_.nodeName)==="A";e.preventDefault!==!1&&(r.current||!h)&&p.preventDefault(),o(!0)}},c=p=>{const g=Ao(p.code,a);Io(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(p[g]),p.key==="Meta"&&i.current.clear(),r.current=!1},f=()=>{i.current.clear(),o(!1)};return u==null||u.addEventListener("keydown",d),u==null||u.addEventListener("keyup",c),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{u==null||u.removeEventListener("keydown",d),u==null||u.removeEventListener("keyup",c),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[t,o]),n}function Io(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(r=>e.has(r)))}function Ao(t,e){return e.includes(t)?"code":"key"}const bf=()=>{const t=rt();return D.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e==null?void 0:e.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:o}=t.getState();return o?o.scaleTo(e,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[o,r,i],panZoom:s}=t.getState();return s?(await s.setViewport({x:e.x??o,y:e.y??r,zoom:e.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,o]=t.getState().transform;return{x:e,y:n,zoom:o}},setCenter:async(e,n,o)=>t.getState().setCenter(e,n,o),fitBounds:async(e,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=t.getState(),u=Cn(e,o,r,i,s,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=t.getState();if(!s)return e;const{x:a,y:u}=s.getBoundingClientRect(),l={x:e.x-a,y:e.y-u},d=n.snapGrid??r,c=n.snapToGrid??i;return le(l,o,c,d)},flowToScreenPosition:e=>{const{transform:n,domNode:o}=t.getState();if(!o)return e;const{x:r,y:i}=o.getBoundingClientRect(),s=Pe(e,n);return{x:s.x+r,y:s.y+i}}}),[])};function Qr(t,e){const n=[],o=new Map,r=[];for(const i of t)if(i.type==="add"){r.push(i);continue}else if(i.type==="remove"||i.type==="replace")o.set(i.id,[i]);else{const s=o.get(i.id);s?s.push(i):o.set(i.id,[i])}for(const i of e){const s=o.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const u of s)Ef(u,a);n.push(a)}return r.length&&r.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Ef(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function Jr(t,e){return Qr(t,e)}function ti(t,e){return Qr(t,e)}function Ct(t,e){return{id:t,type:"select",selected:e}}function Dt(t,e=new Set,n=!1){const o=[];for(const[r,i]of t){const s=e.has(r);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),o.push(Ct(i.id,s)))}return o}function ko({items:t=[],lookup:e}){var r;const n=[],o=new Map(t.map(i=>[i.id,i]));for(const[i,s]of t.entries()){const a=e.get(s.id),u=((r=a==null?void 0:a.internals)==null?void 0:r.userNode)??a;u!==void 0&&u!==s&&n.push({id:s.id,item:s,type:"replace"}),u===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of e)o.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function Po(t){return{id:t.id,type:"remove"}}const $o=t=>Wu(t),Sf=t=>br(t);function ei(t){return D.forwardRef(t)}const Nf=typeof window<"u"?D.useLayoutEffect:D.useEffect;function To(t){const[e,n]=D.useState(BigInt(0)),[o]=D.useState(()=>Mf(()=>n(r=>r+BigInt(1))));return Nf(()=>{const r=o.get();r.length&&(t(r),o.reset())},[e]),o}function Mf(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const ni=D.createContext(null);function Cf({children:t}){const e=rt(),n=D.useCallback(a=>{const{nodes:u=[],setNodes:l,hasDefaultNodes:d,onNodesChange:c,nodeLookup:f,fitViewQueued:p,onNodesChangeMiddlewareMap:g}=e.getState();let y=u;for(const m of a)y=typeof m=="function"?m(y):m;let x=ko({items:y,lookup:f});for(const m of g.values())x=m(x);d&&l(y),x.length>0?c==null||c(x):p&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:_,setNodes:h}=e.getState();m&&h(_)})},[]),o=To(n),r=D.useCallback(a=>{const{edges:u=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:c,edgeLookup:f}=e.getState();let p=u;for(const g of a)p=typeof g=="function"?g(p):g;d?l(p):c&&c(ko({items:p,lookup:f}))},[]),i=To(r),s=D.useMemo(()=>({nodeQueue:o,edgeQueue:i}),[]);return $.jsx(ni.Provider,{value:s,children:t})}function If(){const t=D.useContext(ni);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const Af=t=>!!t.panZoom;function zn(){const t=bf(),e=rt(),n=If(),o=J(Af),r=D.useMemo(()=>{const i=c=>e.getState().nodeLookup.get(c),s=c=>{n.nodeQueue.push(c)},a=c=>{n.edgeQueue.push(c)},u=c=>{var m,_;const{nodeLookup:f,nodeOrigin:p}=e.getState(),g=$o(c)?c:f.get(c.id),y=g.parentId?Ir(g.position,g.measured,g.parentId,f,p):g.position,x={...g,position:y,width:((m=g.measured)==null?void 0:m.width)??g.width,height:((_=g.measured)==null?void 0:_.height)??g.height};return Ft(x)},l=(c,f,p={replace:!1})=>{s(g=>g.map(y=>{if(y.id===c){const x=typeof f=="function"?f(y):f;return p.replace&&$o(x)?x:{...y,...x}}return y}))},d=(c,f,p={replace:!1})=>{a(g=>g.map(y=>{if(y.id===c){const x=typeof f=="function"?f(y):f;return p.replace&&Sf(x)?x:{...y,...x}}return y}))};return{getNodes:()=>e.getState().nodes.map(c=>({...c})),getNode:c=>{var f;return(f=i(c))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:c=[]}=e.getState();return c.map(f=>({...f}))},getEdge:c=>e.getState().edgeLookup.get(c),setNodes:s,setEdges:a,addNodes:c=>{const f=Array.isArray(c)?c:[c];n.nodeQueue.push(p=>[...p,...f])},addEdges:c=>{const f=Array.isArray(c)?c:[c];n.edgeQueue.push(p=>[...p,...f])},toObject:()=>{const{nodes:c=[],edges:f=[],transform:p}=e.getState(),[g,y,x]=p;return{nodes:c.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:g,y,zoom:x}}},deleteElements:async({nodes:c=[],edges:f=[]})=>{const{nodes:p,edges:g,onNodesDelete:y,onEdgesDelete:x,triggerNodeChanges:m,triggerEdgeChanges:_,onDelete:h,onBeforeDelete:w}=e.getState(),{nodes:N,edges:b}=await Zu({nodesToRemove:c,edgesToRemove:f,nodes:p,edges:g,onBeforeDelete:w}),M=b.length>0,T=N.length>0;if(M){const z=b.map(Po);x==null||x(b),_(z)}if(T){const z=N.map(Po);y==null||y(N),m(z)}return(T||M)&&(h==null||h({nodes:N,edges:b})),{deletedNodes:N,deletedEdges:b}},getIntersectingNodes:(c,f=!0,p)=>{const g=oo(c),y=g?c:u(c),x=p!==void 0;return y?(p||e.getState().nodes).filter(m=>{const _=e.getState().nodeLookup.get(m.id);if(_&&!g&&(m.id===c.id||!_.internals.positionAbsolute))return!1;const h=Ft(x?m:_),w=oe(h,y);return f&&w>0||w>=h.width*h.height||w>=y.width*y.height}):[]},isNodeIntersecting:(c,f,p=!0)=>{const y=oo(c)?c:u(c);if(!y)return!1;const x=oe(y,f);return p&&x>0||x>=f.width*f.height||x>=y.width*y.height},updateNode:l,updateNodeData:(c,f,p={replace:!1})=>{l(c,g=>{const y=typeof f=="function"?f(g):f;return p.replace?{...g,data:y}:{...g,data:{...g.data,...y}}},p)},updateEdge:d,updateEdgeData:(c,f,p={replace:!1})=>{d(c,g=>{const y=typeof f=="function"?f(g):f;return p.replace?{...g,data:y}:{...g,data:{...g.data,...y}}},p)},getNodesBounds:c=>{const{nodeLookup:f,nodeOrigin:p}=e.getState();return Gu(c,{nodeLookup:f,nodeOrigin:p})},getHandleConnections:({type:c,id:f,nodeId:p})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${p}-${c}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:c,handleId:f,nodeId:p})=>{var g;return Array.from(((g=e.getState().connectionLookup.get(`${p}${c?f?`-${c}-${f}`:`-${c}`:""}`))==null?void 0:g.values())??[])},fitView:async c=>{const f=e.getState().fitViewResolver??el();return e.setState({fitViewQueued:!0,fitViewOptions:c,fitViewResolver:f}),n.nodeQueue.push(p=>[...p]),f.promise}}},[]);return D.useMemo(()=>({...r,...t,viewportInitialized:o}),[o])}const zo=t=>t.selected,kf=typeof window<"u"?window:void 0;function Pf({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=rt(),{deleteElements:o}=zn(),r=ie(t,{actInsideInputWithModifier:!1}),i=ie(e,{target:kf});D.useEffect(()=>{if(r){const{edges:s,nodes:a}=n.getState();o({nodes:a.filter(zo),edges:s.filter(zo)}),n.setState({nodesSelectionActive:!1})}},[r]),D.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function $f(t){const e=rt();D.useEffect(()=>{const n=()=>{var r,i,s,a;if(!t.current||!(((i=(r=t.current).checkVisibility)==null?void 0:i.call(r))??!0))return!1;const o=In(t.current);(o.height===0||o.width===0)&&((a=(s=e.getState()).onError)==null||a.call(s,"004",ht.error004())),e.setState({width:o.width||500,height:o.height||500})};if(t.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(t.current),()=>{window.removeEventListener("resize",n),o&&t.current&&o.unobserve(t.current)}}},[])}const Ye={position:"absolute",width:"100%",height:"100%",top:0,left:0},Tf=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function zf({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:r=.5,panOnScrollMode:i=It.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:u,translateExtent:l,minZoom:d,maxZoom:c,zoomActivationKeyCode:f,preventScrolling:p=!0,children:g,noWheelClassName:y,noPanClassName:x,onViewportChange:m,isControlledViewport:_,paneClickDistance:h,selectionOnDrag:w}){const N=rt(),b=D.useRef(null),{userSelectionActive:M,lib:T,connectionInProgress:z}=J(Tf,ot),B=ie(f),I=D.useRef();$f(b);const k=D.useCallback(H=>{m==null||m({x:H[0],y:H[1],zoom:H[2]}),_||N.setState({transform:H})},[m,_]);return D.useEffect(()=>{if(b.current){I.current=Rl({domNode:b.current,minZoom:d,maxZoom:c,translateExtent:l,viewport:u,onDraggingChange:S=>N.setState({paneDragging:S}),onPanZoomStart:(S,P)=>{const{onViewportChangeStart:C,onMoveStart:E}=N.getState();E==null||E(S,P),C==null||C(P)},onPanZoom:(S,P)=>{const{onViewportChange:C,onMove:E}=N.getState();E==null||E(S,P),C==null||C(P)},onPanZoomEnd:(S,P)=>{const{onViewportChangeEnd:C,onMoveEnd:E}=N.getState();E==null||E(S,P),C==null||C(P)}});const{x:H,y:v,zoom:A}=I.current.getViewport();return N.setState({panZoom:I.current,transform:[H,v,A],domNode:b.current.closest(".react-flow")}),()=>{var S;(S=I.current)==null||S.destroy()}}},[]),D.useEffect(()=>{var H;(H=I.current)==null||H.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:r,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:B,preventScrolling:p,noPanClassName:x,userSelectionActive:M,noWheelClassName:y,lib:T,onTransformChange:k,connectionInProgress:z,selectionOnDrag:w,paneClickDistance:h})},[t,e,n,o,r,i,s,a,B,p,x,M,y,T,k,z,w,h]),$.jsx("div",{className:"react-flow__renderer",ref:b,style:Ye,children:g})}const Df=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function Lf(){const{userSelectionActive:t,userSelectionRect:e}=J(Df,ot);return t&&e?$.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const sn=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},Hf=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function Rf({isSelecting:t,selectionKeyPressed:e,selectionMode:n=ne.Full,panOnDrag:o,paneClickDistance:r,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:u,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:c,onPaneMouseMove:f,onPaneMouseLeave:p,children:g}){const y=rt(),{userSelectionActive:x,elementsSelectable:m,dragging:_,connectionInProgress:h}=J(Hf,ot),w=m&&(t||x),N=D.useRef(null),b=D.useRef(),M=D.useRef(new Set),T=D.useRef(new Set),z=D.useRef(!1),B=C=>{if(z.current||h){z.current=!1;return}u==null||u(C),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},I=C=>{if(Array.isArray(o)&&(o!=null&&o.includes(2))){C.preventDefault();return}l==null||l(C)},k=d?C=>d(C):void 0,H=C=>{z.current&&(C.stopPropagation(),z.current=!1)},v=C=>{var j,U;const{domNode:E}=y.getState();if(b.current=E==null?void 0:E.getBoundingClientRect(),!b.current)return;const L=C.target===N.current;if(!L&&!!C.target.closest(".nokey")||!t||!(i&&L||e)||C.button!==0||!C.isPrimary)return;(U=(j=C.target)==null?void 0:j.setPointerCapture)==null||U.call(j,C.pointerId),z.current=!1;const{x:X,y:O}=ft(C.nativeEvent,b.current);y.setState({userSelectionRect:{width:0,height:0,startX:X,startY:O,x:X,y:O}}),L||(C.stopPropagation(),C.preventDefault())},A=C=>{const{userSelectionRect:E,transform:L,nodeLookup:V,edgeLookup:R,connectionLookup:X,triggerNodeChanges:O,triggerEdgeChanges:j,defaultEdgeOptions:U,resetSelectedElements:G}=y.getState();if(!b.current||!E)return;const{x:F,y:W}=ft(C.nativeEvent,b.current),{startX:Q,startY:Z}=E;if(!z.current){const tt=e?0:r;if(Math.hypot(F-Q,W-Z)<=tt)return;G(),s==null||s(C)}z.current=!0;const K={startX:Q,startY:Z,x:F<Q?F:Q,y:W<Z?W:Z,width:Math.abs(F-Q),height:Math.abs(W-Z)},q=M.current,et=T.current;M.current=new Set(Mn(V,K,L,n===ne.Partial,!0).map(tt=>tt.id)),T.current=new Set;const nt=(U==null?void 0:U.selectable)??!0;for(const tt of M.current){const st=X.get(tt);if(st)for(const{edgeId:vt}of st.values()){const pt=R.get(vt);pt&&(pt.selectable??nt)&&T.current.add(vt)}}if(!ro(q,M.current)){const tt=Dt(V,M.current,!0);O(tt)}if(!ro(et,T.current)){const tt=Dt(R,T.current);j(tt)}y.setState({userSelectionRect:K,userSelectionActive:!0,nodesSelectionActive:!1})},S=C=>{var E,L;C.button===0&&((L=(E=C.target)==null?void 0:E.releasePointerCapture)==null||L.call(E,C.pointerId),!x&&C.target===N.current&&y.getState().userSelectionRect&&(B==null||B(C)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(a==null||a(C),y.setState({nodesSelectionActive:M.current.size>0})))},P=o===!0||Array.isArray(o)&&o.includes(0);return $.jsxs("div",{className:it(["react-flow__pane",{draggable:P,dragging:_,selection:t}]),onClick:w?void 0:sn(B,N),onContextMenu:sn(I,N),onWheel:sn(k,N),onPointerEnter:w?void 0:c,onPointerMove:w?A:f,onPointerUp:w?S:void 0,onPointerDownCapture:w?v:void 0,onClickCapture:w?H:void 0,onPointerLeave:p,ref:N,style:Ye,children:[g,$.jsx(Lf,{})]})}function wn({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:u}=e.getState(),l=a.get(t);if(!l){u==null||u("012",ht.error012(t));return}e.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.blur()})):r([t])}function oi({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const a=rt(),[u,l]=D.useState(!1),d=D.useRef();return D.useEffect(()=>{d.current=Sl({getStoreItems:()=>a.getState(),onNodeMouseDown:c=>{wn({id:c,store:a,nodeRef:t})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),D.useEffect(()=>{var c,f;if(e)(c=d.current)==null||c.destroy();else if(t.current)return(f=d.current)==null||f.update({noDragClassName:n,handleSelector:o,domNode:t.current,isSelectable:i,nodeId:r,nodeClickDistance:s}),()=>{var p;(p=d.current)==null||p.destroy()}},[n,o,e,i,t,r]),u}const Vf=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function ri(){const t=rt();return D.useCallback(n=>{const{nodeExtent:o,snapToGrid:r,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:u,nodeLookup:l,nodeOrigin:d}=t.getState(),c=new Map,f=Vf(s),p=r?i[0]:5,g=r?i[1]:5,y=n.direction.x*p*n.factor,x=n.direction.y*g*n.factor;for(const[,m]of l){if(!f(m))continue;let _={x:m.internals.positionAbsolute.x+y,y:m.internals.positionAbsolute.y+x};r&&(_=ue(_,i));const{position:h,positionAbsolute:w}=Er({nodeId:m.id,nextPosition:_,nodeLookup:l,nodeExtent:o,nodeOrigin:d,onError:a});m.position=h,m.internals.positionAbsolute=w,c.set(m.id,m)}u(c)},[])}const Dn=D.createContext(null),Bf=Dn.Provider;Dn.Consumer;const ii=()=>D.useContext(Dn),Ff=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),Of=(t,e,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:u,isValid:l}=s,d=(u==null?void 0:u.nodeId)===t&&(u==null?void 0:u.id)===e&&(u==null?void 0:u.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===t&&(a==null?void 0:a.id)===e&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(r==null?void 0:r.nodeId)===t&&(r==null?void 0:r.id)===e&&(r==null?void 0:r.type)===n,isPossibleEndHandle:i===Vt.Strict?(a==null?void 0:a.type)!==n:t!==(a==null?void 0:a.nodeId)||e!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&l}};function Xf({type:t="source",position:e=Y.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:u,className:l,onMouseDown:d,onTouchStart:c,...f},p){var A,S;const g=s||null,y=t==="target",x=rt(),m=ii(),{connectOnClick:_,noPanClassName:h,rfId:w}=J(Ff,ot),{connectingFrom:N,connectingTo:b,clickConnecting:M,isPossibleEndHandle:T,connectionInProcess:z,clickConnectionInProcess:B,valid:I}=J(Of(m,g,t),ot);m||(S=(A=x.getState()).onError)==null||S.call(A,"010",ht.error010());const k=P=>{const{defaultEdgeOptions:C,onConnect:E,hasDefaultEdges:L}=x.getState(),V={...C,...P};if(L){const{edges:R,setEdges:X}=x.getState();X(cl(V,R))}E==null||E(V),a==null||a(V)},H=P=>{if(!m)return;const C=Pr(P.nativeEvent);if(r&&(C&&P.button===0||!C)){const E=x.getState();xn.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:E.autoPanOnConnect,connectionMode:E.connectionMode,connectionRadius:E.connectionRadius,domNode:E.domNode,nodeLookup:E.nodeLookup,lib:E.lib,isTarget:y,handleId:g,nodeId:m,flowId:E.rfId,panBy:E.panBy,cancelConnection:E.cancelConnection,onConnectStart:E.onConnectStart,onConnectEnd:E.onConnectEnd,updateConnection:E.updateConnection,onConnect:k,isValidConnection:n||E.isValidConnection,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:E.autoPanSpeed,dragThreshold:E.connectionDragThreshold})}C?d==null||d(P):c==null||c(P)},v=P=>{const{onClickConnectStart:C,onClickConnectEnd:E,connectionClickStartHandle:L,connectionMode:V,isValidConnection:R,lib:X,rfId:O,nodeLookup:j,connection:U}=x.getState();if(!m||!L&&!r)return;if(!L){C==null||C(P.nativeEvent,{nodeId:m,handleId:g,handleType:t}),x.setState({connectionClickStartHandle:{nodeId:m,type:t,id:g}});return}const G=Ar(P.target),F=n||R,{connection:W,isValid:Q}=xn.isValid(P.nativeEvent,{handle:{nodeId:m,id:g,type:t},connectionMode:V,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:F,flowId:O,doc:G,lib:X,nodeLookup:j});Q&&W&&k(W);const Z=structuredClone(U);delete Z.inProgress,Z.toPosition=Z.toHandle?Z.toHandle.position:null,E==null||E(P,Z),x.setState({connectionClickStartHandle:null})};return $.jsx("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":e,"data-id":`${w}-${m}-${g}-${t}`,className:it(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",h,l,{source:!y,target:y,connectable:o,connectablestart:r,connectableend:i,clickconnecting:M,connectingfrom:N,connectingto:b,valid:I,connectionindicator:o&&(!z||T)&&(z||B?i:r)}]),onMouseDown:H,onTouchStart:H,onClick:_?v:void 0,ref:p,...f,children:u})}const $e=D.memo(ei(Xf));function Yf({data:t,isConnectable:e,sourcePosition:n=Y.Bottom}){return $.jsxs($.Fragment,{children:[t==null?void 0:t.label,$.jsx($e,{type:"source",position:n,isConnectable:e})]})}function jf({data:t,isConnectable:e,targetPosition:n=Y.Top,sourcePosition:o=Y.Bottom}){return $.jsxs($.Fragment,{children:[$.jsx($e,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,$.jsx($e,{type:"source",position:o,isConnectable:e})]})}function Wf(){return null}function Gf({data:t,isConnectable:e,targetPosition:n=Y.Top}){return $.jsxs($.Fragment,{children:[$.jsx($e,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label]})}const Te={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Do={input:Yf,default:jf,output:Gf,group:Wf};function qf(t){var e,n,o,r;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((n=t.style)==null?void 0:n.height)}:{width:t.width??((o=t.style)==null?void 0:o.width),height:t.height??((r=t.style)==null?void 0:r.height)}}const Uf=t=>{const{width:e,height:n,x:o,y:r}=ce(t.nodeLookup,{filter:i=>!!i.selected});return{width:lt(e)?e:null,height:lt(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${o}px,${r}px)`}};function Kf({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=rt(),{width:r,height:i,transformString:s,userSelectionActive:a}=J(Uf,ot),u=ri(),l=D.useRef(null);if(D.useEffect(()=>{var f;n||(f=l.current)==null||f.focus({preventScroll:!0})},[n]),oi({nodeRef:l}),a||!r||!i)return null;const d=t?f=>{const p=o.getState().nodes.filter(g=>g.selected);t(f,p)}:void 0,c=f=>{Object.prototype.hasOwnProperty.call(Te,f.key)&&(f.preventDefault(),u({direction:Te[f.key],factor:f.shiftKey?4:1}))};return $.jsx("div",{className:it(["react-flow__nodesselection","react-flow__container",e]),style:{transform:s},children:$.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:c,style:{width:r,height:i}})})}const Lo=typeof window<"u"?window:void 0,Zf=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function si({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:u,selectionKeyCode:l,selectionOnDrag:d,selectionMode:c,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:g,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:w,panOnScrollSpeed:N,panOnScrollMode:b,zoomOnDoubleClick:M,panOnDrag:T,defaultViewport:z,translateExtent:B,minZoom:I,maxZoom:k,preventScrolling:H,onSelectionContextMenu:v,noWheelClassName:A,noPanClassName:S,disableKeyboardA11y:P,onViewportChange:C,isControlledViewport:E}){const{nodesSelectionActive:L,userSelectionActive:V}=J(Zf,ot),R=ie(l,{target:Lo}),X=ie(y,{target:Lo}),O=X||T,j=X||w,U=d&&O!==!0,G=R||V||U;return Pf({deleteKeyCode:u,multiSelectionKeyCode:g}),$.jsx(zf,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:_,zoomOnPinch:h,panOnScroll:j,panOnScrollSpeed:N,panOnScrollMode:b,zoomOnDoubleClick:M,panOnDrag:!R&&O,defaultViewport:z,translateExtent:B,minZoom:I,maxZoom:k,zoomActivationKeyCode:x,preventScrolling:H,noWheelClassName:A,noPanClassName:S,onViewportChange:C,isControlledViewport:E,paneClickDistance:a,selectionOnDrag:U,children:$.jsxs(Rf,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:O,isSelecting:!!G,selectionMode:c,selectionKeyPressed:R,paneClickDistance:a,selectionOnDrag:U,children:[t,L&&$.jsx(Kf,{onSelectionContextMenu:v,noPanClassName:S,disableKeyboardA11y:P})]})})}si.displayName="FlowRenderer";const Qf=D.memo(si),Jf=t=>e=>t?Mn(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function td(t){return J(D.useCallback(Jf(t),[t]),ot)}const ed=t=>t.updateNodeInternals;function nd(){const t=J(ed),[e]=D.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(r=>{const i=r.target.getAttribute("data-id");o.set(i,{id:i,nodeElement:r.target,force:!0})}),t(o)}));return D.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function od({node:t,nodeType:e,hasDimensions:n,resizeObserver:o}){const r=rt(),i=D.useRef(null),s=D.useRef(null),a=D.useRef(t.sourcePosition),u=D.useRef(t.targetPosition),l=D.useRef(e),d=n&&!!t.internals.handleBounds;return D.useEffect(()=>{i.current&&!t.hidden&&(!d||s.current!==i.current)&&(s.current&&(o==null||o.unobserve(s.current)),o==null||o.observe(i.current),s.current=i.current)},[d,t.hidden]),D.useEffect(()=>()=>{s.current&&(o==null||o.unobserve(s.current),s.current=null)},[]),D.useEffect(()=>{if(i.current){const c=l.current!==e,f=a.current!==t.sourcePosition,p=u.current!==t.targetPosition;(c||f||p)&&(l.current=e,a.current=t.sourcePosition,u.current=t.targetPosition,r.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:i.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),i}function rd({id:t,onClick:e,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:u,nodesConnectable:l,nodesFocusable:d,resizeObserver:c,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:g,rfId:y,nodeTypes:x,nodeClickDistance:m,onError:_}){const{node:h,internals:w,isParent:N}=J(F=>{const W=F.nodeLookup.get(t),Q=F.parentLookup.has(t);return{node:W,internals:W.internals,isParent:Q}},ot);let b=h.type||"default",M=(x==null?void 0:x[b])||Do[b];M===void 0&&(_==null||_("003",ht.error003(b)),b="default",M=(x==null?void 0:x.default)||Do.default);const T=!!(h.draggable||a&&typeof h.draggable>"u"),z=!!(h.selectable||u&&typeof h.selectable>"u"),B=!!(h.connectable||l&&typeof h.connectable>"u"),I=!!(h.focusable||d&&typeof h.focusable>"u"),k=rt(),H=Cr(h),v=od({node:h,nodeType:b,hasDimensions:H,resizeObserver:c}),A=oi({nodeRef:v,disabled:h.hidden||!T,noDragClassName:f,handleSelector:h.dragHandle,nodeId:t,isSelectable:z,nodeClickDistance:m}),S=ri();if(h.hidden)return null;const P=wt(h),C=qf(h),E=z||T||e||n||o||r,L=n?F=>n(F,{...w.userNode}):void 0,V=o?F=>o(F,{...w.userNode}):void 0,R=r?F=>r(F,{...w.userNode}):void 0,X=i?F=>i(F,{...w.userNode}):void 0,O=s?F=>s(F,{...w.userNode}):void 0,j=F=>{const{selectNodesOnDrag:W,nodeDragThreshold:Q}=k.getState();z&&(!W||!T||Q>0)&&wn({id:t,store:k,nodeRef:v}),e&&e(F,{...w.userNode})},U=F=>{if(!(kr(F.nativeEvent)||g)){if(xr.includes(F.key)&&z){const W=F.key==="Escape";wn({id:t,store:k,unselect:W,nodeRef:v})}else if(T&&h.selected&&Object.prototype.hasOwnProperty.call(Te,F.key)){F.preventDefault();const{ariaLabelConfig:W}=k.getState();k.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:F.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),S({direction:Te[F.key],factor:F.shiftKey?4:1})}}},G=()=>{var et;if(g||!((et=v.current)!=null&&et.matches(":focus-visible")))return;const{transform:F,width:W,height:Q,autoPanOnNodeFocus:Z,setCenter:K}=k.getState();if(!Z)return;Mn(new Map([[t,h]]),{x:0,y:0,width:W,height:Q},F,!0).length>0||K(h.position.x+P.width/2,h.position.y+P.height/2,{zoom:F[2]})};return $.jsx("div",{className:it(["react-flow__node",`react-flow__node-${b}`,{[p]:T},h.className,{selected:h.selected,selectable:z,parent:N,draggable:T,dragging:A}]),ref:v,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:E?"all":"none",visibility:H?"visible":"hidden",...h.style,...C},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:L,onMouseMove:V,onMouseLeave:R,onContextMenu:X,onClick:j,onDoubleClick:O,onKeyDown:I?U:void 0,tabIndex:I?0:void 0,onFocus:I?G:void 0,role:h.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Ur}-${y}`,"aria-label":h.ariaLabel,...h.domAttributes,children:$.jsx(Bf,{value:t,children:$.jsx(M,{id:t,data:h.data,type:b,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:h.selected??!1,selectable:z,draggable:T,deletable:h.deletable??!0,isConnectable:B,sourcePosition:h.sourcePosition,targetPosition:h.targetPosition,dragging:A,dragHandle:h.dragHandle,zIndex:w.z,parentId:h.parentId,...P})})})}var id=D.memo(rd);const sd=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function ai(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,onError:i}=J(sd,ot),s=td(t.onlyRenderVisibleElements),a=nd();return $.jsx("div",{className:"react-flow__nodes",style:Ye,children:s.map(u=>$.jsx(id,{id:u,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:a,nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:r,nodeClickDistance:t.nodeClickDistance,onError:i},u))})}ai.displayName="NodeRenderer";const ad=D.memo(ai);function cd(t){return J(D.useCallback(n=>{if(!t)return n.edges.map(r=>r.id);const o=[];if(n.width&&n.height)for(const r of n.edges){const i=n.nodeLookup.get(r.source),s=n.nodeLookup.get(r.target);i&&s&&il({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&o.push(r.id)}return o},[t]),ot)}const ud=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return $.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},ld=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return $.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Ho={[Ae.Arrow]:ud,[Ae.ArrowClosed]:ld};function fd(t){const e=rt();return D.useMemo(()=>{var r,i;return Object.prototype.hasOwnProperty.call(Ho,t)?Ho[t]:((i=(r=e.getState()).onError)==null||i.call(r,"009",ht.error009(t)),null)},[t])}const dd=({id:t,type:e,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const u=fd(e);return u?$.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:$.jsx(u,{color:n,strokeWidth:s})}):null},ci=({defaultColor:t,rfId:e})=>{const n=J(i=>i.edges),o=J(i=>i.defaultEdgeOptions),r=D.useMemo(()=>hl(n,{id:e,defaultColor:t,defaultMarkerStart:o==null?void 0:o.markerStart,defaultMarkerEnd:o==null?void 0:o.markerEnd}),[n,o,e,t]);return r.length?$.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:$.jsx("defs",{children:r.map(i=>$.jsx(dd,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};ci.displayName="MarkerDefinitions";var hd=D.memo(ci);function ui({x:t,y:e,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:u,className:l,...d}){const[c,f]=D.useState({x:1,y:0,width:0,height:0}),p=it(["react-flow__edge-textwrapper",l]),g=D.useRef(null);return D.useEffect(()=>{if(g.current){const y=g.current.getBBox();f({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?$.jsxs("g",{transform:`translate(${t-c.width/2} ${e-c.height/2})`,className:p,visibility:c.width?"visible":"hidden",...d,children:[r&&$.jsx("rect",{width:c.width+2*s[0],x:-s[0],y:-s[1],height:c.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),$.jsx("text",{className:"react-flow__edge-text",y:c.height/2,dy:"0.3em",ref:g,style:o,children:n}),u]}):null}ui.displayName="EdgeText";const gd=D.memo(ui);function je({path:t,labelX:e,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:u,interactionWidth:l=20,...d}){return $.jsxs($.Fragment,{children:[$.jsx("path",{...d,d:t,fill:"none",className:it(["react-flow__edge-path",d.className])}),l?$.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,o&<(e)&<(n)?$.jsx(gd,{x:e,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:u}):null]})}function Ro({pos:t,x1:e,y1:n,x2:o,y2:r}){return t===Y.Left||t===Y.Right?[.5*(e+o),n]:[e,.5*(n+r)]}function li({sourceX:t,sourceY:e,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top}){const[s,a]=Ro({pos:n,x1:t,y1:e,x2:o,y2:r}),[u,l]=Ro({pos:i,x1:o,y1:r,x2:t,y2:e}),[d,c,f,p]=$r({sourceX:t,sourceY:e,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:u,targetControlY:l});return[`M${t},${e} C${s},${a} ${u},${l} ${o},${r}`,d,c,f,p]}function fi(t){return D.memo(({id:e,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:u,labelStyle:l,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:x,interactionWidth:m})=>{const[_,h,w]=li({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),N=t.isInternal?void 0:e;return $.jsx(je,{id:N,path:_,labelX:h,labelY:w,label:u,labelStyle:l,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:x,interactionWidth:m})})}const pd=fi({isInternal:!1}),di=fi({isInternal:!0});pd.displayName="SimpleBezierEdge";di.displayName="SimpleBezierEdgeInternal";function hi(t){return D.memo(({id:e,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:c,style:f,sourcePosition:p=Y.Bottom,targetPosition:g=Y.Top,markerEnd:y,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[h,w,N]=pn({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),b=t.isInternal?void 0:e;return $.jsx(je,{id:b,path:h,labelX:w,labelY:N,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:y,markerStart:x,interactionWidth:_})})}const gi=hi({isInternal:!1}),pi=hi({isInternal:!0});gi.displayName="SmoothStepEdge";pi.displayName="SmoothStepEdgeInternal";function mi(t){return D.memo(({id:e,...n})=>{var r;const o=t.isInternal?void 0:e;return $.jsx(gi,{...n,id:o,pathOptions:D.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(r=n.pathOptions)==null?void 0:r.offset])})})}const md=mi({isInternal:!1}),yi=mi({isInternal:!0});md.displayName="StepEdge";yi.displayName="StepEdgeInternal";function xi(t){return D.memo(({id:e,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:p,markerStart:g,interactionWidth:y})=>{const[x,m,_]=Dr({sourceX:n,sourceY:o,targetX:r,targetY:i}),h=t.isInternal?void 0:e;return $.jsx(je,{id:h,path:x,labelX:m,labelY:_,label:s,labelStyle:a,labelShowBg:u,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:c,style:f,markerEnd:p,markerStart:g,interactionWidth:y})})}const yd=xi({isInternal:!1}),wi=xi({isInternal:!0});yd.displayName="StraightEdge";wi.displayName="StraightEdgeInternal";function vi(t){return D.memo(({id:e,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=Y.Bottom,targetPosition:a=Y.Top,label:u,labelStyle:l,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:x,pathOptions:m,interactionWidth:_})=>{const[h,w,N]=Tr({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:m==null?void 0:m.curvature}),b=t.isInternal?void 0:e;return $.jsx(je,{id:b,path:h,labelX:w,labelY:N,label:u,labelStyle:l,labelShowBg:d,labelBgStyle:c,labelBgPadding:f,labelBgBorderRadius:p,style:g,markerEnd:y,markerStart:x,interactionWidth:_})})}const xd=vi({isInternal:!1}),_i=vi({isInternal:!0});xd.displayName="BezierEdge";_i.displayName="BezierEdgeInternal";const Vo={default:_i,straight:wi,step:yi,smoothstep:pi,simplebezier:di},Bo={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},wd=(t,e,n)=>n===Y.Left?t-e:n===Y.Right?t+e:t,vd=(t,e,n)=>n===Y.Top?t-e:n===Y.Bottom?t+e:t,Fo="react-flow__edgeupdater";function Oo({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return $.jsx("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:it([Fo,`${Fo}-${a}`]),cx:wd(e,o,t),cy:vd(n,o,t),r:o,stroke:"transparent",fill:"transparent"})}function _d({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:u,onReconnect:l,onReconnectStart:d,onReconnectEnd:c,setReconnecting:f,setUpdateHover:p}){const g=rt(),y=(w,N)=>{if(w.button!==0)return;const{autoPanOnConnect:b,domNode:M,isValidConnection:T,connectionMode:z,connectionRadius:B,lib:I,onConnectStart:k,onConnectEnd:H,cancelConnection:v,nodeLookup:A,rfId:S,panBy:P,updateConnection:C}=g.getState(),E=N.type==="target",L=(X,O)=>{f(!1),c==null||c(X,n,N.type,O)},V=X=>l==null?void 0:l(n,X),R=(X,O)=>{f(!0),d==null||d(w,n,N.type),k==null||k(X,O)};xn.onPointerDown(w.nativeEvent,{autoPanOnConnect:b,connectionMode:z,connectionRadius:B,domNode:M,handleId:N.id,nodeId:N.nodeId,nodeLookup:A,isTarget:E,edgeUpdaterType:N.type,lib:I,flowId:S,cancelConnection:v,panBy:P,isValidConnection:T,onConnect:V,onConnectStart:R,onConnectEnd:H,onReconnectEnd:L,updateConnection:C,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},x=w=>y(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=w=>y(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),_=()=>p(!0),h=()=>p(!1);return $.jsxs($.Fragment,{children:[(t===!0||t==="source")&&$.jsx(Oo,{position:a,centerX:o,centerY:r,radius:e,onMouseDown:x,onMouseEnter:_,onMouseOut:h,type:"source"}),(t===!0||t==="target")&&$.jsx(Oo,{position:u,centerX:i,centerY:s,radius:e,onMouseDown:m,onMouseEnter:_,onMouseOut:h,type:"target"})]})}function bd({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:u,onMouseLeave:l,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:p,rfId:g,edgeTypes:y,noPanClassName:x,onError:m,disableKeyboardA11y:_}){let h=J(K=>K.edgeLookup.get(t));const w=J(K=>K.defaultEdgeOptions);h=w?{...w,...h}:h;let N=h.type||"default",b=(y==null?void 0:y[N])||Vo[N];b===void 0&&(m==null||m("011",ht.error011(N)),N="default",b=(y==null?void 0:y.default)||Vo.default);const M=!!(h.focusable||e&&typeof h.focusable>"u"),T=typeof c<"u"&&(h.reconnectable||n&&typeof h.reconnectable>"u"),z=!!(h.selectable||o&&typeof h.selectable>"u"),B=D.useRef(null),[I,k]=D.useState(!1),[H,v]=D.useState(!1),A=rt(),{zIndex:S,sourceX:P,sourceY:C,targetX:E,targetY:L,sourcePosition:V,targetPosition:R}=J(D.useCallback(K=>{const q=K.nodeLookup.get(h.source),et=K.nodeLookup.get(h.target);if(!q||!et)return{zIndex:h.zIndex,...Bo};const nt=dl({id:t,sourceNode:q,targetNode:et,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:K.connectionMode,onError:m});return{zIndex:rl({selected:h.selected,zIndex:h.zIndex,sourceNode:q,targetNode:et,elevateOnSelect:K.elevateEdgesOnSelect,zIndexMode:K.zIndexMode}),...nt||Bo}},[h.source,h.target,h.sourceHandle,h.targetHandle,h.selected,h.zIndex]),ot),X=D.useMemo(()=>h.markerStart?`url('#${mn(h.markerStart,g)}')`:void 0,[h.markerStart,g]),O=D.useMemo(()=>h.markerEnd?`url('#${mn(h.markerEnd,g)}')`:void 0,[h.markerEnd,g]);if(h.hidden||P===null||C===null||E===null||L===null)return null;const j=K=>{var tt;const{addSelectedEdges:q,unselectNodesAndEdges:et,multiSelectionActive:nt}=A.getState();z&&(A.setState({nodesSelectionActive:!1}),h.selected&&nt?(et({nodes:[],edges:[h]}),(tt=B.current)==null||tt.blur()):q([t])),r&&r(K,h)},U=i?K=>{i(K,{...h})}:void 0,G=s?K=>{s(K,{...h})}:void 0,F=a?K=>{a(K,{...h})}:void 0,W=u?K=>{u(K,{...h})}:void 0,Q=l?K=>{l(K,{...h})}:void 0,Z=K=>{var q;if(!_&&xr.includes(K.key)&&z){const{unselectNodesAndEdges:et,addSelectedEdges:nt}=A.getState();K.key==="Escape"?((q=B.current)==null||q.blur(),et({edges:[h]})):nt([t])}};return $.jsx("svg",{style:{zIndex:S},children:$.jsxs("g",{className:it(["react-flow__edge",`react-flow__edge-${N}`,h.className,x,{selected:h.selected,animated:h.animated,inactive:!z&&!r,updating:I,selectable:z}]),onClick:j,onDoubleClick:U,onContextMenu:G,onMouseEnter:F,onMouseMove:W,onMouseLeave:Q,onKeyDown:M?Z:void 0,tabIndex:M?0:void 0,role:h.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":h.ariaLabel===null?void 0:h.ariaLabel||`Edge from ${h.source} to ${h.target}`,"aria-describedby":M?`${Kr}-${g}`:void 0,ref:B,...h.domAttributes,children:[!H&&$.jsx(b,{id:t,source:h.source,target:h.target,type:h.type,selected:h.selected,animated:h.animated,selectable:z,deletable:h.deletable??!0,label:h.label,labelStyle:h.labelStyle,labelShowBg:h.labelShowBg,labelBgStyle:h.labelBgStyle,labelBgPadding:h.labelBgPadding,labelBgBorderRadius:h.labelBgBorderRadius,sourceX:P,sourceY:C,targetX:E,targetY:L,sourcePosition:V,targetPosition:R,data:h.data,style:h.style,sourceHandleId:h.sourceHandle,targetHandleId:h.targetHandle,markerStart:X,markerEnd:O,pathOptions:"pathOptions"in h?h.pathOptions:void 0,interactionWidth:h.interactionWidth}),T&&$.jsx(_d,{edge:h,isReconnectable:T,reconnectRadius:d,onReconnect:c,onReconnectStart:f,onReconnectEnd:p,sourceX:P,sourceY:C,targetX:E,targetY:L,sourcePosition:V,targetPosition:R,setUpdateHover:k,setReconnecting:v})]})})}var Ed=D.memo(bd);const Sd=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function bi({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:c,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,onError:h}=J(Sd,ot),w=cd(e);return $.jsxs("div",{className:"react-flow__edges",children:[$.jsx(hd,{defaultColor:t,rfId:n}),w.map(N=>$.jsx(Ed,{id:N,edgesFocusable:x,edgesReconnectable:m,elementsSelectable:_,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:u,onMouseLeave:l,onClick:d,reconnectRadius:c,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:g,rfId:n,onError:h,edgeTypes:o,disableKeyboardA11y:y},N))]})}bi.displayName="EdgeRenderer";const Nd=D.memo(bi),Md=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function Cd({children:t}){const e=J(Md);return $.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function Id(t){const e=zn(),n=D.useRef(!1);D.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Ad=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function kd(t){const e=J(Ad),n=rt();return D.useEffect(()=>{t&&(e==null||e(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function Pd(t){return t.connection.inProgress?{...t.connection,to:le(t.connection.to,t.transform)}:{...t.connection}}function $d(t){return Pd}function Td(t){const e=$d();return J(e,ot)}const zd=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function Dd({containerStyle:t,style:e,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:u}=J(zd,ot);return!(i&&r&&u)?null:$.jsx("svg",{style:t,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:$.jsx("g",{className:it(["react-flow__connection",_r(a)]),children:$.jsx(Ei,{style:e,type:n,CustomComponent:o,isValid:a})})})}const Ei=({style:t,type:e=Et.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:u,to:l,toNode:d,toHandle:c,toPosition:f,pointer:p}=Td();if(!r)return;if(n)return $.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:u,toPosition:f,connectionStatus:_r(o),toNode:d,toHandle:c,pointer:p});let g="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:u,targetX:l.x,targetY:l.y,targetPosition:f};switch(e){case Et.Bezier:[g]=Tr(y);break;case Et.SimpleBezier:[g]=li(y);break;case Et.Step:[g]=pn({...y,borderRadius:0});break;case Et.SmoothStep:[g]=pn(y);break;default:[g]=Dr(y)}return $.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:t})};Ei.displayName="ConnectionLine";const Ld={};function Xo(t=Ld){D.useRef(t),rt(),D.useEffect(()=>{},[t])}function Hd(){rt(),D.useRef(!1),D.useEffect(()=>{},[])}function Si({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:u,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:c,onSelectionStart:f,onSelectionEnd:p,connectionLineType:g,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:m,selectionKeyCode:_,selectionOnDrag:h,selectionMode:w,multiSelectionKeyCode:N,panActivationKeyCode:b,zoomActivationKeyCode:M,deleteKeyCode:T,onlyRenderVisibleElements:z,elementsSelectable:B,defaultViewport:I,translateExtent:k,minZoom:H,maxZoom:v,preventScrolling:A,defaultMarkerColor:S,zoomOnScroll:P,zoomOnPinch:C,panOnScroll:E,panOnScrollSpeed:L,panOnScrollMode:V,zoomOnDoubleClick:R,panOnDrag:X,onPaneClick:O,onPaneMouseEnter:j,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneScroll:F,onPaneContextMenu:W,paneClickDistance:Q,nodeClickDistance:Z,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:et,onEdgeMouseLeave:nt,reconnectRadius:tt,onReconnect:st,onReconnectStart:vt,onReconnectEnd:pt,noDragClassName:Nt,noWheelClassName:Yt,noPanClassName:jt,disableKeyboardA11y:Wt,nodeExtent:We,rfId:fe,viewport:$t,onViewportChange:Gt}){return Xo(t),Xo(e),Hd(),Id(n),kd($t),$.jsx(Qf,{onPaneClick:O,onPaneMouseEnter:j,onPaneMouseMove:U,onPaneMouseLeave:G,onPaneContextMenu:W,onPaneScroll:F,paneClickDistance:Q,deleteKeyCode:T,selectionKeyCode:_,selectionOnDrag:h,selectionMode:w,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:N,panActivationKeyCode:b,zoomActivationKeyCode:M,elementsSelectable:B,zoomOnScroll:P,zoomOnPinch:C,zoomOnDoubleClick:R,panOnScroll:E,panOnScrollSpeed:L,panOnScrollMode:V,panOnDrag:X,defaultViewport:I,translateExtent:k,minZoom:H,maxZoom:v,onSelectionContextMenu:c,preventScrolling:A,noDragClassName:Nt,noWheelClassName:Yt,noPanClassName:jt,disableKeyboardA11y:Wt,onViewportChange:Gt,isControlledViewport:!!$t,children:$.jsxs(Cd,{children:[$.jsx(Nd,{edgeTypes:e,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:st,onReconnectStart:vt,onReconnectEnd:pt,onlyRenderVisibleElements:z,onEdgeContextMenu:K,onEdgeMouseEnter:q,onEdgeMouseMove:et,onEdgeMouseLeave:nt,reconnectRadius:tt,defaultMarkerColor:S,noPanClassName:jt,disableKeyboardA11y:Wt,rfId:fe}),$.jsx(Dd,{style:y,type:g,component:x,containerStyle:m}),$.jsx("div",{className:"react-flow__edgelabel-renderer"}),$.jsx(ad,{nodeTypes:t,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:u,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:Z,onlyRenderVisibleElements:z,noPanClassName:jt,noDragClassName:Nt,disableKeyboardA11y:Wt,nodeExtent:We,rfId:fe}),$.jsx("div",{className:"react-flow__viewport-portal"})]})})}Si.displayName="GraphView";const Rd=D.memo(Si),Yo=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:u=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:c,zIndexMode:f="basic"}={})=>{const p=new Map,g=new Map,y=new Map,x=new Map,m=o??e??[],_=n??t??[],h=d??[0,0],w=c??ee;Rr(y,x,m);const N=yn(_,p,g,{nodeOrigin:h,nodeExtent:w,zIndexMode:f});let b=[0,0,1];if(s&&r&&i){const M=ce(p,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:T,y:z,zoom:B}=Cn(M,r,i,u,l,(a==null?void 0:a.padding)??.1);b=[T,z,B]}return{rfId:"1",width:r??0,height:i??0,transform:b,nodes:_,nodesInitialized:N,nodeLookup:p,parentLookup:g,edges:m,edgeLookup:x,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:u,maxZoom:l,translateExtent:ee,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Vt.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:h,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...vr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qu,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:wr,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Vd=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:u,maxZoom:l,nodeOrigin:d,nodeExtent:c,zIndexMode:f})=>nf((p,g)=>{async function y(){const{nodeLookup:x,panZoom:m,fitViewOptions:_,fitViewResolver:h,width:w,height:N,minZoom:b,maxZoom:M}=g();m&&(await Ku({nodes:x,width:w,height:N,panZoom:m,minZoom:b,maxZoom:M},_),h==null||h.resolve(!0),p({fitViewResolver:null}))}return{...Yo({nodes:t,edges:e,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:u,maxZoom:l,nodeOrigin:d,nodeExtent:c,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:x=>{const{nodeLookup:m,parentLookup:_,nodeOrigin:h,elevateNodesOnSelect:w,fitViewQueued:N,zIndexMode:b}=g(),M=yn(x,m,_,{nodeOrigin:h,nodeExtent:c,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:b});N&&M?(y(),p({nodes:x,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0})):p({nodes:x,nodesInitialized:M})},setEdges:x=>{const{connectionLookup:m,edgeLookup:_}=g();Rr(m,_,x),p({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){const{setNodes:_}=g();_(x),p({hasDefaultNodes:!0})}if(m){const{setEdges:_}=g();_(m),p({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:m,nodeLookup:_,parentLookup:h,domNode:w,nodeOrigin:N,nodeExtent:b,debug:M,fitViewQueued:T,zIndexMode:z}=g(),{changes:B,updatedInternals:I}=vl(x,_,h,w,N,b,z);I&&(ml(_,h,{nodeOrigin:N,nodeExtent:b,zIndexMode:z}),T?(y(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),(B==null?void 0:B.length)>0&&(M&&console.log("React Flow: trigger node changes",B),m==null||m(B)))},updateNodePositions:(x,m=!1)=>{const _=[];let h=[];const{nodeLookup:w,triggerNodeChanges:N,connection:b,updateConnection:M,onNodesChangeMiddlewareMap:T}=g();for(const[z,B]of x){const I=w.get(z),k=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(B!=null&&B.position)),H={id:z,type:"position",position:k?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:m};if(I&&b.inProgress&&b.fromNode.id===I.id){const v=Pt(I,b.fromHandle,Y.Left,!0);M({...b,from:v})}k&&I.parentId&&_.push({id:z,parentId:I.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),h.push(H)}if(_.length>0){const{parentLookup:z,nodeOrigin:B}=g(),I=Tn(_,w,z,B);h.push(...I)}for(const z of T.values())h=z(h);N(h)},triggerNodeChanges:x=>{const{onNodesChange:m,setNodes:_,nodes:h,hasDefaultNodes:w,debug:N}=g();if(x!=null&&x.length){if(w){const b=Jr(x,h);_(b)}N&&console.log("React Flow: trigger node changes",x),m==null||m(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:m,setEdges:_,edges:h,hasDefaultEdges:w,debug:N}=g();if(x!=null&&x.length){if(w){const b=ti(x,h);_(b)}N&&console.log("React Flow: trigger edge changes",x),m==null||m(x)}},addSelectedNodes:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(m){const b=x.map(M=>Ct(M,!0));w(b);return}w(Dt(h,new Set([...x]),!0)),N(Dt(_))},addSelectedEdges:x=>{const{multiSelectionActive:m,edgeLookup:_,nodeLookup:h,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(m){const b=x.map(M=>Ct(M,!0));N(b);return}N(Dt(_,new Set([...x]))),w(Dt(h,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{const{edges:_,nodes:h,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:b}=g(),M=x||h,T=m||_,z=M.map(I=>{const k=w.get(I.id);return k&&(k.selected=!1),Ct(I.id,!1)}),B=T.map(I=>Ct(I.id,!1));N(z),b(B)},setMinZoom:x=>{const{panZoom:m,maxZoom:_}=g();m==null||m.setScaleExtent([x,_]),p({minZoom:x})},setMaxZoom:x=>{const{panZoom:m,minZoom:_}=g();m==null||m.setScaleExtent([_,x]),p({maxZoom:x})},setTranslateExtent:x=>{var m;(m=g().panZoom)==null||m.setTranslateExtent(x),p({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:m,triggerNodeChanges:_,triggerEdgeChanges:h,elementsSelectable:w}=g();if(!w)return;const N=m.reduce((M,T)=>T.selected?[...M,Ct(T.id,!1)]:M,[]),b=x.reduce((M,T)=>T.selected?[...M,Ct(T.id,!1)]:M,[]);_(N),h(b)},setNodeExtent:x=>{const{nodes:m,nodeLookup:_,parentLookup:h,nodeOrigin:w,elevateNodesOnSelect:N,nodeExtent:b,zIndexMode:M}=g();x[0][0]===b[0][0]&&x[0][1]===b[0][1]&&x[1][0]===b[1][0]&&x[1][1]===b[1][1]||(yn(m,_,h,{nodeOrigin:w,nodeExtent:x,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:M}),p({nodeExtent:x}))},panBy:x=>{const{transform:m,width:_,height:h,panZoom:w,translateExtent:N}=g();return _l({delta:x,panZoom:w,transform:m,translateExtent:N,width:_,height:h})},setCenter:async(x,m,_)=>{const{width:h,height:w,maxZoom:N,panZoom:b}=g();if(!b)return Promise.resolve(!1);const M=typeof(_==null?void 0:_.zoom)<"u"?_.zoom:N;return await b.setViewport({x:h/2-x*M,y:w/2-m*M,zoom:M},{duration:_==null?void 0:_.duration,ease:_==null?void 0:_.ease,interpolate:_==null?void 0:_.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{p({connection:{...vr}})},updateConnection:x=>{p({connection:x})},reset:()=>p({...Yo()})}},Object.is);function Bd({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:u,fitView:l,nodeOrigin:d,nodeExtent:c,zIndexMode:f,children:p}){const[g]=D.useState(()=>Vd({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:l,minZoom:s,maxZoom:a,fitViewOptions:u,nodeOrigin:d,nodeExtent:c,zIndexMode:f}));return $.jsx(of,{value:g,children:$.jsx(Cf,{children:p})})}function Fd({children:t,nodes:e,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:a,fitViewOptions:u,minZoom:l,maxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:p}){return D.useContext(Oe)?$.jsx($.Fragment,{children:t}):$.jsx(Bd,{initialNodes:e,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:u,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:c,nodeExtent:f,zIndexMode:p,children:t})}const Od={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Xd({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:u,onInit:l,onMove:d,onMoveStart:c,onMoveEnd:f,onConnect:p,onConnectStart:g,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:b,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:z,onNodesDelete:B,onEdgesDelete:I,onDelete:k,onSelectionChange:H,onSelectionDragStart:v,onSelectionDrag:A,onSelectionDragStop:S,onSelectionContextMenu:P,onSelectionStart:C,onSelectionEnd:E,onBeforeDelete:L,connectionMode:V,connectionLineType:R=Et.Bezier,connectionLineStyle:X,connectionLineComponent:O,connectionLineContainerStyle:j,deleteKeyCode:U="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:F=!1,selectionMode:W=ne.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:Z=re()?"Meta":"Control",zoomActivationKeyCode:K=re()?"Meta":"Control",snapToGrid:q,snapGrid:et,onlyRenderVisibleElements:nt=!1,selectNodesOnDrag:tt,nodesDraggable:st,autoPanOnNodeFocus:vt,nodesConnectable:pt,nodesFocusable:Nt,nodeOrigin:Yt=Zr,edgesFocusable:jt,edgesReconnectable:Wt,elementsSelectable:We=!0,defaultViewport:fe=yf,minZoom:$t=.5,maxZoom:Gt=2,translateExtent:Ln=ee,preventScrolling:Ii=!0,nodeExtent:Ge,defaultMarkerColor:Ai="#b1b1b7",zoomOnScroll:ki=!0,zoomOnPinch:Pi=!0,panOnScroll:$i=!1,panOnScrollSpeed:Ti=.5,panOnScrollMode:zi=It.Free,zoomOnDoubleClick:Di=!0,panOnDrag:Li=!0,onPaneClick:Hi,onPaneMouseEnter:Ri,onPaneMouseMove:Vi,onPaneMouseLeave:Bi,onPaneScroll:Fi,onPaneContextMenu:Oi,paneClickDistance:Xi=1,nodeClickDistance:Yi=0,children:ji,onReconnect:Wi,onReconnectStart:Gi,onReconnectEnd:qi,onEdgeContextMenu:Ui,onEdgeDoubleClick:Ki,onEdgeMouseEnter:Zi,onEdgeMouseMove:Qi,onEdgeMouseLeave:Ji,reconnectRadius:ts=10,onNodesChange:es,onEdgesChange:ns,noDragClassName:os="nodrag",noWheelClassName:rs="nowheel",noPanClassName:Hn="nopan",fitView:Rn,fitViewOptions:Vn,connectOnClick:is,attributionPosition:ss,proOptions:as,defaultEdgeOptions:cs,elevateNodesOnSelect:us=!0,elevateEdgesOnSelect:ls=!1,disableKeyboardA11y:Bn=!1,autoPanOnConnect:fs,autoPanOnNodeDrag:ds,autoPanSpeed:hs,connectionRadius:gs,isValidConnection:ps,onError:ms,style:ys,id:Fn,nodeDragThreshold:xs,connectionDragThreshold:ws,viewport:vs,onViewportChange:_s,width:bs,height:Es,colorMode:Ss="light",debug:Ns,onScroll:de,ariaLabelConfig:Ms,zIndexMode:On="basic",...Cs},Is){const qe=Fn||"1",As=_f(Ss),ks=D.useCallback(Xn=>{Xn.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),de==null||de(Xn)},[de]);return $.jsx("div",{"data-testid":"rf__wrapper",...Cs,onScroll:ks,style:{...ys,...Od},ref:Is,className:it(["react-flow",r,As]),id:Fn,role:"application",children:$.jsxs(Fd,{nodes:t,edges:e,width:bs,height:Es,fitView:Rn,fitViewOptions:Vn,minZoom:$t,maxZoom:Gt,nodeOrigin:Yt,nodeExtent:Ge,zIndexMode:On,children:[$.jsx(Rd,{onInit:l,onNodeClick:a,onEdgeClick:u,onNodeMouseEnter:_,onNodeMouseMove:h,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:b,nodeTypes:i,edgeTypes:s,connectionLineType:R,connectionLineStyle:X,connectionLineComponent:O,connectionLineContainerStyle:j,selectionKeyCode:G,selectionOnDrag:F,selectionMode:W,deleteKeyCode:U,multiSelectionKeyCode:Z,panActivationKeyCode:Q,zoomActivationKeyCode:K,onlyRenderVisibleElements:nt,defaultViewport:fe,translateExtent:Ln,minZoom:$t,maxZoom:Gt,preventScrolling:Ii,zoomOnScroll:ki,zoomOnPinch:Pi,zoomOnDoubleClick:Di,panOnScroll:$i,panOnScrollSpeed:Ti,panOnScrollMode:zi,panOnDrag:Li,onPaneClick:Hi,onPaneMouseEnter:Ri,onPaneMouseMove:Vi,onPaneMouseLeave:Bi,onPaneScroll:Fi,onPaneContextMenu:Oi,paneClickDistance:Xi,nodeClickDistance:Yi,onSelectionContextMenu:P,onSelectionStart:C,onSelectionEnd:E,onReconnect:Wi,onReconnectStart:Gi,onReconnectEnd:qi,onEdgeContextMenu:Ui,onEdgeDoubleClick:Ki,onEdgeMouseEnter:Zi,onEdgeMouseMove:Qi,onEdgeMouseLeave:Ji,reconnectRadius:ts,defaultMarkerColor:Ai,noDragClassName:os,noWheelClassName:rs,noPanClassName:Hn,rfId:qe,disableKeyboardA11y:Bn,nodeExtent:Ge,viewport:vs,onViewportChange:_s}),$.jsx(vf,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:p,onConnectStart:g,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:st,autoPanOnNodeFocus:vt,nodesConnectable:pt,nodesFocusable:Nt,edgesFocusable:jt,edgesReconnectable:Wt,elementsSelectable:We,elevateNodesOnSelect:us,elevateEdgesOnSelect:ls,minZoom:$t,maxZoom:Gt,nodeExtent:Ge,onNodesChange:es,onEdgesChange:ns,snapToGrid:q,snapGrid:et,connectionMode:V,translateExtent:Ln,connectOnClick:is,defaultEdgeOptions:cs,fitView:Rn,fitViewOptions:Vn,onNodesDelete:B,onEdgesDelete:I,onDelete:k,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:z,onSelectionDrag:A,onSelectionDragStart:v,onSelectionDragStop:S,onMove:d,onMoveStart:c,onMoveEnd:f,noPanClassName:Hn,nodeOrigin:Yt,rfId:qe,autoPanOnConnect:fs,autoPanOnNodeDrag:ds,autoPanSpeed:hs,onError:ms,connectionRadius:gs,isValidConnection:ps,selectNodesOnDrag:tt,nodeDragThreshold:xs,connectionDragThreshold:ws,onBeforeDelete:L,debug:Ns,ariaLabelConfig:Ms,zIndexMode:On}),$.jsx(mf,{onSelectionChange:H}),ji,$.jsx(ff,{proOptions:as,position:ss}),$.jsx(lf,{rfId:qe,disableKeyboardA11y:Bn})]})})}var yh=ei(Xd);const Yd=t=>{var e;return(e=t.domNode)==null?void 0:e.querySelector(".react-flow__edgelabel-renderer")};function xh({children:t}){const e=J(Yd);return e?zs.createPortal(t,e):null}function wh(t){const[e,n]=D.useState(t),o=D.useCallback(r=>n(i=>Jr(r,i)),[]);return[e,n,o]}function vh(t){const[e,n]=D.useState(t),o=D.useCallback(r=>n(i=>ti(r,i)),[]);return[e,n,o]}function jd({dimensions:t,lineWidth:e,variant:n,className:o}){return $.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:it(["react-flow__background-pattern",n,o])})}function Wd({radius:t,className:e}){return $.jsx("circle",{cx:t,cy:t,r:t,className:it(["react-flow__background-pattern","dots",e])})}var St;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(St||(St={}));const Gd={[St.Dots]:1,[St.Lines]:1,[St.Cross]:6},qd=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Ni({id:t,variant:e=St.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:a,style:u,className:l,patternClassName:d}){const c=D.useRef(null),{transform:f,patternId:p}=J(qd,ot),g=o||Gd[e],y=e===St.Dots,x=e===St.Cross,m=Array.isArray(n)?n:[n,n],_=[m[0]*f[2]||1,m[1]*f[2]||1],h=g*f[2],w=Array.isArray(i)?i:[i,i],N=x?[h,h]:_,b=[w[0]*f[2]||1+N[0]/2,w[1]*f[2]||1+N[1]/2],M=`${p}${t||""}`;return $.jsxs("svg",{className:it(["react-flow__background",l]),style:{...u,...Ye,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:c,"data-testid":"rf__background",children:[$.jsx("pattern",{id:M,x:f[0]%_[0],y:f[1]%_[1],width:_[0],height:_[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${b[0]},-${b[1]})`,children:y?$.jsx(Wd,{radius:h/2,className:d}):$.jsx(jd,{dimensions:N,lineWidth:r,variant:e,className:d})}),$.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}Ni.displayName="Background";const _h=D.memo(Ni);function Ud(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:$.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Kd(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:$.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Zd(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:$.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Qd(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:$.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function Jd(){return $.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:$.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function we({children:t,className:e,...n}){return $.jsx("button",{type:"button",className:it(["react-flow__controls-button",e]),...n,children:t})}const th=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Mi({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:u,className:l,children:d,position:c="bottom-left",orientation:f="vertical","aria-label":p}){const g=rt(),{isInteractive:y,minZoomReached:x,maxZoomReached:m,ariaLabelConfig:_}=J(th,ot),{zoomIn:h,zoomOut:w,fitView:N}=zn(),b=()=>{h(),i==null||i()},M=()=>{w(),s==null||s()},T=()=>{N(r),a==null||a()},z=()=>{g.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),u==null||u(!y)},B=f==="horizontal"?"horizontal":"vertical";return $.jsxs(Xe,{className:it(["react-flow__controls",B,l]),position:c,style:t,"data-testid":"rf__controls","aria-label":p??_["controls.ariaLabel"],children:[e&&$.jsxs($.Fragment,{children:[$.jsx(we,{onClick:b,className:"react-flow__controls-zoomin",title:_["controls.zoomIn.ariaLabel"],"aria-label":_["controls.zoomIn.ariaLabel"],disabled:m,children:$.jsx(Ud,{})}),$.jsx(we,{onClick:M,className:"react-flow__controls-zoomout",title:_["controls.zoomOut.ariaLabel"],"aria-label":_["controls.zoomOut.ariaLabel"],disabled:x,children:$.jsx(Kd,{})})]}),n&&$.jsx(we,{className:"react-flow__controls-fitview",onClick:T,title:_["controls.fitView.ariaLabel"],"aria-label":_["controls.fitView.ariaLabel"],children:$.jsx(Zd,{})}),o&&$.jsx(we,{className:"react-flow__controls-interactive",onClick:z,title:_["controls.interactive.ariaLabel"],"aria-label":_["controls.interactive.ariaLabel"],children:y?$.jsx(Jd,{}):$.jsx(Qd,{})}),d]})}Mi.displayName="Controls";const bh=D.memo(Mi);function eh({id:t,x:e,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:u,className:l,borderRadius:d,shapeRendering:c,selected:f,onClick:p}){const{background:g,backgroundColor:y}=i||{},x=s||g||y;return $.jsx("rect",{className:it(["react-flow__minimap-node",{selected:f},l]),x:e,y:n,rx:d,ry:d,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:u},shapeRendering:c,onClick:p?m=>p(m,t):void 0})}const nh=D.memo(eh),oh=t=>t.nodes.map(e=>e.id),an=t=>t instanceof Function?t:()=>t;function rh({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=nh,onClick:s}){const a=J(oh,ot),u=an(e),l=an(t),d=an(n),c=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return $.jsx($.Fragment,{children:a.map(f=>$.jsx(sh,{id:f,nodeColorFunc:u,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:c},f))})}function ih({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:u}){const{node:l,x:d,y:c,width:f,height:p}=J(g=>{const{internals:y}=g.nodeLookup.get(t),x=y.userNode,{x:m,y:_}=y.positionAbsolute,{width:h,height:w}=wt(x);return{node:x,x:m,y:_,width:h,height:w}},ot);return!l||l.hidden||!Cr(l)?null:$.jsx(a,{x:d,y:c,width:f,height:p,style:l.style,selected:!!l.selected,className:o(l),color:e(l),borderRadius:r,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:u,id:l.id})}const sh=D.memo(ih);var ah=D.memo(rh);const ch=200,uh=150,lh=t=>!t.hidden,fh=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?Mr(ce(t.nodeLookup,{filter:lh}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},dh="react-flow__minimap-desc";function Ci({style:t,className:e,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:u,maskColor:l,maskStrokeColor:d,maskStrokeWidth:c,position:f="bottom-right",onClick:p,onNodeClick:g,pannable:y=!1,zoomable:x=!1,ariaLabel:m,inversePan:_,zoomStep:h=1,offsetScale:w=5}){const N=rt(),b=D.useRef(null),{boundingRect:M,viewBB:T,rfId:z,panZoom:B,translateExtent:I,flowWidth:k,flowHeight:H,ariaLabelConfig:v}=J(fh,ot),A=(t==null?void 0:t.width)??ch,S=(t==null?void 0:t.height)??uh,P=M.width/A,C=M.height/S,E=Math.max(P,C),L=E*A,V=E*S,R=w*E,X=M.x-(L-M.width)/2-R,O=M.y-(V-M.height)/2-R,j=L+R*2,U=V+R*2,G=`${dh}-${z}`,F=D.useRef(0),W=D.useRef();F.current=E,D.useEffect(()=>{if(b.current&&B)return W.current=kl({domNode:b.current,panZoom:B,getTransform:()=>N.getState().transform,getViewScale:()=>F.current}),()=>{var q;(q=W.current)==null||q.destroy()}},[B]),D.useEffect(()=>{var q;(q=W.current)==null||q.update({translateExtent:I,width:k,height:H,inversePan:_,pannable:y,zoomStep:h,zoomable:x})},[y,x,_,h,I,k,H]);const Q=p?q=>{var tt;const[et,nt]=((tt=W.current)==null?void 0:tt.pointer(q))||[0,0];p(q,{x:et,y:nt})}:void 0,Z=g?D.useCallback((q,et)=>{const nt=N.getState().nodeLookup.get(et).internals.userNode;g(q,nt)},[]):void 0,K=m??v["minimap.ariaLabel"];return $.jsx(Xe,{position:f,style:{...t,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof c=="number"?c*E:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:it(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:$.jsxs("svg",{width:A,height:S,viewBox:`${X} ${O} ${j} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":G,ref:b,onClick:Q,children:[K&&$.jsx("title",{id:G,children:K}),$.jsx(ah,{onClick:Z,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:a}),$.jsx("path",{className:"react-flow__minimap-mask",d:`M${X-R},${O-R}h${j+R*2}v${U+R*2}h${-j-R*2}z
|
|
23
23
|
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ci.displayName="MiniMap";const Eh=D.memo(Ci),hh=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,gh={[Xt.Line]:"right",[Xt.Handle]:"bottom-right"};function ph({nodeId:t,position:e,variant:n=Xt.Handle,className:o,style:r=void 0,children:i,color:s,minWidth:a=10,minHeight:u=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:c=!1,resizeDirection:f,autoScale:p=!0,shouldResize:g,onResizeStart:y,onResize:x,onResizeEnd:m}){const _=ii(),h=typeof t=="string"?t:_,w=rt(),N=D.useRef(null),b=n===Xt.Handle,M=J(D.useCallback(hh(b&&p),[b,p]),ot),T=D.useRef(null),z=e??gh[n];D.useEffect(()=>{if(!(!N.current||!h))return T.current||(T.current=Yl({domNode:N.current,nodeId:h,getStoreItems:()=>{const{nodeLookup:I,transform:k,snapGrid:H,snapToGrid:v,nodeOrigin:A,domNode:S}=w.getState();return{nodeLookup:I,transform:k,snapGrid:H,snapToGrid:v,nodeOrigin:A,paneDomNode:S}},onChange:(I,k)=>{const{triggerNodeChanges:H,nodeLookup:v,parentLookup:A,nodeOrigin:S}=w.getState(),P=[],C={x:I.x,y:I.y},E=v.get(h);if(E&&E.expandParent&&E.parentId){const L=E.origin??S,V=I.width??E.measured.width??0,R=I.height??E.measured.height??0,X={id:E.id,parentId:E.parentId,rect:{width:V,height:R,...Ir({x:I.x??E.position.x,y:I.y??E.position.y},{width:V,height:R},E.parentId,v,L)}},O=Tn([X],v,A,S);P.push(...O),C.x=I.x?Math.max(L[0]*V,I.x):void 0,C.y=I.y?Math.max(L[1]*R,I.y):void 0}if(C.x!==void 0&&C.y!==void 0){const L={id:h,type:"position",position:{...C}};P.push(L)}if(I.width!==void 0&&I.height!==void 0){const V={id:h,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};P.push(V)}for(const L of k){const V={...L,type:"position"};P.push(V)}H(P)},onEnd:({width:I,height:k})=>{const H={id:h,type:"dimensions",resizing:!1,dimensions:{width:I,height:k}};w.getState().triggerNodeChanges([H])}})),T.current.update({controlPosition:z,boundaries:{minWidth:a,minHeight:u,maxWidth:l,maxHeight:d},keepAspectRatio:c,resizeDirection:f,onResizeStart:y,onResize:x,onResizeEnd:m,shouldResize:g}),()=>{var I;(I=T.current)==null||I.destroy()}},[z,a,u,l,d,c,y,x,m,g]);const B=z.split("-");return $.jsx("div",{className:it(["react-flow__resize-control","nodrag",...B,n,o]),ref:N,style:{...r,scale:M,...s&&{[b?"backgroundColor":"borderColor"]:s}},children:i})}D.memo(ph);export{_h as B,bh as C,xh as E,$e as H,Eh as M,Y as P,Bd as R,Jr as a,ti as b,Xe as c,St as d,wh as e,vh as f,Tr as g,je as h,yh as i,pn as j,zn as u};
|
|
24
|
-
//# sourceMappingURL=index-
|
|
24
|
+
//# sourceMappingURL=index-CI8-rBff.js.map
|