@mcp-graph-workflow/mcp-graph 5.1.5 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/router.d.ts +0 -1
- package/dist/api/router.d.ts.map +1 -1
- package/dist/api/router.js +3 -4
- package/dist/api/router.js.map +1 -1
- package/dist/api/routes/benchmark.d.ts.map +1 -1
- package/dist/api/routes/benchmark.js +47 -2
- package/dist/api/routes/benchmark.js.map +1 -1
- package/dist/api/routes/code-graph.d.ts +12 -0
- package/dist/api/routes/code-graph.d.ts.map +1 -0
- package/dist/api/routes/code-graph.js +154 -0
- package/dist/api/routes/code-graph.js.map +1 -0
- package/dist/api/routes/folder.d.ts +1 -4
- package/dist/api/routes/folder.d.ts.map +1 -1
- package/dist/api/routes/folder.js +19 -17
- package/dist/api/routes/folder.js.map +1 -1
- package/dist/api/routes/integrations.d.ts.map +1 -1
- package/dist/api/routes/integrations.js +60 -16
- package/dist/api/routes/integrations.js.map +1 -1
- package/dist/api/routes/knowledge.js +1 -1
- package/dist/api/routes/knowledge.js.map +1 -1
- package/dist/api/routes/skills.d.ts.map +1 -1
- package/dist/api/routes/skills.js +57 -3
- package/dist/api/routes/skills.js.map +1 -1
- package/dist/cli/commands/index-cmd.js +5 -5
- package/dist/cli/commands/index-cmd.js.map +1 -1
- package/dist/core/analyzer/ac-parser.d.ts +7 -0
- package/dist/core/analyzer/ac-parser.d.ts.map +1 -0
- package/dist/core/analyzer/ac-parser.js +67 -0
- package/dist/core/analyzer/ac-parser.js.map +1 -0
- package/dist/core/analyzer/ac-validator.d.ts +15 -0
- package/dist/core/analyzer/ac-validator.d.ts.map +1 -0
- package/dist/core/analyzer/ac-validator.js +142 -0
- package/dist/core/analyzer/ac-validator.js.map +1 -0
- package/dist/core/analyzer/definition-of-ready.d.ts +16 -0
- package/dist/core/analyzer/definition-of-ready.d.ts.map +1 -0
- package/dist/core/analyzer/definition-of-ready.js +107 -0
- package/dist/core/analyzer/definition-of-ready.js.map +1 -0
- package/dist/core/analyzer/prd-quality.d.ts +14 -0
- package/dist/core/analyzer/prd-quality.d.ts.map +1 -0
- package/dist/core/analyzer/prd-quality.js +156 -0
- package/dist/core/analyzer/prd-quality.js.map +1 -0
- package/dist/core/analyzer/risk-assessment.d.ts +11 -0
- package/dist/core/analyzer/risk-assessment.d.ts.map +1 -0
- package/dist/core/analyzer/risk-assessment.js +97 -0
- package/dist/core/analyzer/risk-assessment.js.map +1 -0
- package/dist/core/analyzer/scope-analyzer.d.ts +7 -0
- package/dist/core/analyzer/scope-analyzer.d.ts.map +1 -0
- package/dist/core/analyzer/scope-analyzer.js +99 -0
- package/dist/core/analyzer/scope-analyzer.js.map +1 -0
- package/dist/core/code/code-indexer.d.ts +20 -0
- package/dist/core/code/code-indexer.d.ts.map +1 -0
- package/dist/core/code/code-indexer.js +161 -0
- package/dist/core/code/code-indexer.js.map +1 -0
- package/dist/core/code/code-search.d.ts +16 -0
- package/dist/core/code/code-search.d.ts.map +1 -0
- package/dist/core/code/code-search.js +77 -0
- package/dist/core/code/code-search.js.map +1 -0
- package/dist/core/code/code-store.d.ts +35 -0
- package/dist/core/code/code-store.d.ts.map +1 -0
- package/dist/core/code/code-store.js +228 -0
- package/dist/core/code/code-store.js.map +1 -0
- package/dist/core/code/code-types.d.ts +209 -0
- package/dist/core/code/code-types.d.ts.map +1 -0
- package/dist/core/code/code-types.js +94 -0
- package/dist/core/code/code-types.js.map +1 -0
- package/dist/core/code/graph-traversal.d.ts +27 -0
- package/dist/core/code/graph-traversal.d.ts.map +1 -0
- package/dist/core/code/graph-traversal.js +122 -0
- package/dist/core/code/graph-traversal.js.map +1 -0
- package/dist/core/code/process-detector.d.ts +11 -0
- package/dist/core/code/process-detector.d.ts.map +1 -0
- package/dist/core/code/process-detector.js +65 -0
- package/dist/core/code/process-detector.js.map +1 -0
- package/dist/core/code/ts-analyzer.d.ts +12 -0
- package/dist/core/code/ts-analyzer.d.ts.map +1 -0
- package/dist/core/code/ts-analyzer.js +331 -0
- package/dist/core/code/ts-analyzer.js.map +1 -0
- package/dist/core/config/ai-memory-generator.d.ts.map +1 -1
- package/dist/core/config/ai-memory-generator.js +149 -64
- package/dist/core/config/ai-memory-generator.js.map +1 -1
- package/dist/core/config/config-loader.d.ts.map +1 -1
- package/dist/core/config/config-loader.js +2 -10
- package/dist/core/config/config-loader.js.map +1 -1
- package/dist/core/config/config-schema.d.ts +1 -2
- package/dist/core/config/config-schema.d.ts.map +1 -1
- package/dist/core/config/config-schema.js +2 -3
- package/dist/core/config/config-schema.js.map +1 -1
- package/dist/core/context/compact-context.d.ts +51 -0
- package/dist/core/context/compact-context.d.ts.map +1 -1
- package/dist/core/context/compact-context.js +292 -0
- package/dist/core/context/compact-context.js.map +1 -1
- package/dist/core/context/context-assembler.d.ts +4 -1
- package/dist/core/context/context-assembler.d.ts.map +1 -1
- package/dist/core/context/context-assembler.js +6 -3
- package/dist/core/context/context-assembler.js.map +1 -1
- package/dist/core/context/rag-context.d.ts +4 -2
- package/dist/core/context/rag-context.d.ts.map +1 -1
- package/dist/core/context/rag-context.js +8 -5
- package/dist/core/context/rag-context.js.map +1 -1
- package/dist/core/designer/adr-validator.d.ts +8 -0
- package/dist/core/designer/adr-validator.d.ts.map +1 -0
- package/dist/core/designer/adr-validator.js +61 -0
- package/dist/core/designer/adr-validator.js.map +1 -0
- package/dist/core/designer/coupling-analyzer.d.ts +7 -0
- package/dist/core/designer/coupling-analyzer.d.ts.map +1 -0
- package/dist/core/designer/coupling-analyzer.js +59 -0
- package/dist/core/designer/coupling-analyzer.js.map +1 -0
- package/dist/core/designer/definition-of-ready.d.ts +8 -0
- package/dist/core/designer/definition-of-ready.d.ts.map +1 -0
- package/dist/core/designer/definition-of-ready.js +146 -0
- package/dist/core/designer/definition-of-ready.js.map +1 -0
- package/dist/core/designer/interface-checker.d.ts +7 -0
- package/dist/core/designer/interface-checker.d.ts.map +1 -0
- package/dist/core/designer/interface-checker.js +53 -0
- package/dist/core/designer/interface-checker.js.map +1 -0
- package/dist/core/designer/tech-risk-assessor.d.ts +7 -0
- package/dist/core/designer/tech-risk-assessor.d.ts.map +1 -0
- package/dist/core/designer/tech-risk-assessor.js +95 -0
- package/dist/core/designer/tech-risk-assessor.js.map +1 -0
- package/dist/core/designer/traceability-matrix.d.ts +8 -0
- package/dist/core/designer/traceability-matrix.d.ts.map +1 -0
- package/dist/core/designer/traceability-matrix.js +67 -0
- package/dist/core/designer/traceability-matrix.js.map +1 -0
- package/dist/core/doctor/doctor-checks.d.ts +1 -1
- package/dist/core/doctor/doctor-checks.js +21 -21
- package/dist/core/doctor/doctor-checks.js.map +1 -1
- package/dist/core/events/event-types.d.ts +11 -1
- package/dist/core/events/event-types.d.ts.map +1 -1
- package/dist/core/handoff/delivery-checklist.d.ts +10 -0
- package/dist/core/handoff/delivery-checklist.d.ts.map +1 -0
- package/dist/core/handoff/delivery-checklist.js +148 -0
- package/dist/core/handoff/delivery-checklist.js.map +1 -0
- package/dist/core/handoff/doc-completeness.d.ts +7 -0
- package/dist/core/handoff/doc-completeness.d.ts.map +1 -0
- package/dist/core/handoff/doc-completeness.js +19 -0
- package/dist/core/handoff/doc-completeness.js.map +1 -0
- package/dist/core/implementer/definition-of-done.d.ts +11 -0
- package/dist/core/implementer/definition-of-done.d.ts.map +1 -0
- package/dist/core/implementer/definition-of-done.js +158 -0
- package/dist/core/implementer/definition-of-done.js.map +1 -0
- package/dist/core/implementer/sprint-progress.d.ts +11 -0
- package/dist/core/implementer/sprint-progress.d.ts.map +1 -0
- package/dist/core/implementer/sprint-progress.js +80 -0
- package/dist/core/implementer/sprint-progress.js.map +1 -0
- package/dist/core/implementer/tdd-checker.d.ts +15 -0
- package/dist/core/implementer/tdd-checker.d.ts.map +1 -0
- package/dist/core/implementer/tdd-checker.js +132 -0
- package/dist/core/implementer/tdd-checker.js.map +1 -0
- package/dist/core/insights/bottleneck-detector.js +1 -1
- package/dist/core/insights/bottleneck-detector.js.map +1 -1
- package/dist/core/integrations/enriched-context.d.ts +10 -6
- package/dist/core/integrations/enriched-context.d.ts.map +1 -1
- package/dist/core/integrations/enriched-context.js +35 -35
- package/dist/core/integrations/enriched-context.js.map +1 -1
- package/dist/core/integrations/integration-orchestrator.js +2 -2
- package/dist/core/integrations/integration-orchestrator.js.map +1 -1
- package/dist/core/integrations/mcp-deps-installer.d.ts +1 -1
- package/dist/core/integrations/mcp-deps-installer.d.ts.map +1 -1
- package/dist/core/integrations/mcp-deps-installer.js +1 -60
- package/dist/core/integrations/mcp-deps-installer.js.map +1 -1
- package/dist/core/integrations/mcp-servers-config.d.ts +1 -1
- package/dist/core/integrations/mcp-servers-config.d.ts.map +1 -1
- package/dist/core/integrations/mcp-servers-config.js +0 -17
- package/dist/core/integrations/mcp-servers-config.js.map +1 -1
- package/dist/core/integrations/tool-status.d.ts +8 -3
- package/dist/core/integrations/tool-status.d.ts.map +1 -1
- package/dist/core/integrations/tool-status.js +38 -48
- package/dist/core/integrations/tool-status.js.map +1 -1
- package/dist/core/listener/backlog-health.d.ts +7 -0
- package/dist/core/listener/backlog-health.d.ts.map +1 -0
- package/dist/core/listener/backlog-health.js +64 -0
- package/dist/core/listener/backlog-health.js.map +1 -0
- package/dist/core/listener/feedback-readiness.d.ts +11 -0
- package/dist/core/listener/feedback-readiness.d.ts.map +1 -0
- package/dist/core/listener/feedback-readiness.js +124 -0
- package/dist/core/listener/feedback-readiness.js.map +1 -0
- package/dist/core/memory/memory-migrator.d.ts +15 -0
- package/dist/core/memory/memory-migrator.d.ts.map +1 -0
- package/dist/core/memory/memory-migrator.js +64 -0
- package/dist/core/memory/memory-migrator.js.map +1 -0
- package/dist/core/memory/memory-reader.d.ts +30 -0
- package/dist/core/memory/memory-reader.d.ts.map +1 -0
- package/dist/core/memory/memory-reader.js +106 -0
- package/dist/core/memory/memory-reader.js.map +1 -0
- package/dist/core/planner/lifecycle-phase.d.ts +1 -0
- package/dist/core/planner/lifecycle-phase.d.ts.map +1 -1
- package/dist/core/planner/lifecycle-phase.js +89 -58
- package/dist/core/planner/lifecycle-phase.js.map +1 -1
- package/dist/core/rag/memory-indexer.d.ts +16 -0
- package/dist/core/rag/memory-indexer.d.ts.map +1 -0
- package/dist/core/rag/{serena-indexer.js → memory-indexer.js} +12 -12
- package/dist/core/rag/memory-indexer.js.map +1 -0
- package/dist/core/rag/{serena-rag-query.d.ts → memory-rag-query.d.ts} +11 -9
- package/dist/core/rag/memory-rag-query.d.ts.map +1 -0
- package/dist/core/rag/{serena-rag-query.js → memory-rag-query.js} +18 -15
- package/dist/core/rag/memory-rag-query.js.map +1 -0
- package/dist/core/rag/phase-metadata.d.ts +23 -0
- package/dist/core/rag/phase-metadata.d.ts.map +1 -0
- package/dist/core/rag/phase-metadata.js +72 -0
- package/dist/core/rag/phase-metadata.js.map +1 -0
- package/dist/core/rag/phase-summary.d.ts +17 -0
- package/dist/core/rag/phase-summary.d.ts.map +1 -0
- package/dist/core/rag/phase-summary.js +104 -0
- package/dist/core/rag/phase-summary.js.map +1 -0
- package/dist/core/rag/prd-indexer.d.ts +16 -0
- package/dist/core/rag/prd-indexer.d.ts.map +1 -0
- package/dist/core/rag/prd-indexer.js +37 -0
- package/dist/core/rag/prd-indexer.js.map +1 -0
- package/dist/core/rag/skill-indexer.d.ts +16 -0
- package/dist/core/rag/skill-indexer.d.ts.map +1 -0
- package/dist/core/rag/skill-indexer.js +98 -0
- package/dist/core/rag/skill-indexer.js.map +1 -0
- package/dist/core/reviewer/review-readiness.d.ts +8 -0
- package/dist/core/reviewer/review-readiness.d.ts.map +1 -0
- package/dist/core/reviewer/review-readiness.js +159 -0
- package/dist/core/reviewer/review-readiness.js.map +1 -0
- package/dist/core/skills/built-in-skills.d.ts +26 -0
- package/dist/core/skills/built-in-skills.d.ts.map +1 -0
- package/dist/core/skills/built-in-skills.js +203 -0
- package/dist/core/skills/built-in-skills.js.map +1 -0
- package/dist/core/store/knowledge-store.d.ts +10 -1
- package/dist/core/store/knowledge-store.d.ts.map +1 -1
- package/dist/core/store/knowledge-store.js +23 -1
- package/dist/core/store/knowledge-store.js.map +1 -1
- package/dist/core/store/migrations.d.ts.map +1 -1
- package/dist/core/store/migrations.js +89 -0
- package/dist/core/store/migrations.js.map +1 -1
- package/dist/core/store/tool-token-store.d.ts +39 -0
- package/dist/core/store/tool-token-store.d.ts.map +1 -0
- package/dist/core/store/tool-token-store.js +79 -0
- package/dist/core/store/tool-token-store.js.map +1 -0
- package/dist/core/validator/definition-of-ready.d.ts +8 -0
- package/dist/core/validator/definition-of-ready.d.ts.map +1 -0
- package/dist/core/validator/definition-of-ready.js +155 -0
- package/dist/core/validator/definition-of-ready.js.map +1 -0
- package/dist/core/validator/done-integrity-checker.d.ts +7 -0
- package/dist/core/validator/done-integrity-checker.d.ts.map +1 -0
- package/dist/core/validator/done-integrity-checker.js +38 -0
- package/dist/core/validator/done-integrity-checker.js.map +1 -0
- package/dist/core/validator/status-flow-checker.d.ts +7 -0
- package/dist/core/validator/status-flow-checker.d.ts.map +1 -0
- package/dist/core/validator/status-flow-checker.js +26 -0
- package/dist/core/validator/status-flow-checker.js.map +1 -0
- package/dist/mcp/app-factory.d.ts +0 -1
- package/dist/mcp/app-factory.d.ts.map +1 -1
- package/dist/mcp/app-factory.js +2 -2
- package/dist/mcp/app-factory.js.map +1 -1
- package/dist/mcp/lifecycle-wrapper.d.ts +10 -0
- package/dist/mcp/lifecycle-wrapper.d.ts.map +1 -1
- package/dist/mcp/lifecycle-wrapper.js +48 -2
- package/dist/mcp/lifecycle-wrapper.js.map +1 -1
- package/dist/mcp/server.js +19 -14
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools/{stats.d.ts → analyze.d.ts} +2 -2
- package/dist/mcp/tools/analyze.d.ts.map +1 -0
- package/dist/mcp/tools/analyze.js +272 -0
- package/dist/mcp/tools/analyze.js.map +1 -0
- package/dist/mcp/tools/import-prd.d.ts.map +1 -1
- package/dist/mcp/tools/import-prd.js +15 -1
- package/dist/mcp/tools/import-prd.js.map +1 -1
- package/dist/mcp/tools/index.js +10 -10
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/list-skills.d.ts +7 -0
- package/dist/mcp/tools/list-skills.d.ts.map +1 -0
- package/dist/mcp/tools/list-skills.js +68 -0
- package/dist/mcp/tools/list-skills.js.map +1 -0
- package/dist/mcp/tools/memory.d.ts +8 -0
- package/dist/mcp/tools/memory.d.ts.map +1 -0
- package/dist/mcp/tools/memory.js +106 -0
- package/dist/mcp/tools/memory.js.map +1 -0
- package/dist/mcp/tools/{velocity.d.ts → metrics.d.ts} +2 -2
- package/dist/mcp/tools/metrics.d.ts.map +1 -0
- package/dist/mcp/tools/metrics.js +69 -0
- package/dist/mcp/tools/metrics.js.map +1 -0
- package/dist/mcp/tools/next.d.ts.map +1 -1
- package/dist/mcp/tools/next.js +19 -5
- package/dist/mcp/tools/next.js.map +1 -1
- package/dist/mcp/tools/plan-sprint.d.ts.map +1 -1
- package/dist/mcp/tools/plan-sprint.js +20 -0
- package/dist/mcp/tools/plan-sprint.js.map +1 -1
- package/dist/mcp/tools/rag-context.d.ts.map +1 -1
- package/dist/mcp/tools/rag-context.js +20 -5
- package/dist/mcp/tools/rag-context.js.map +1 -1
- package/dist/mcp/tools/reindex-knowledge.d.ts.map +1 -1
- package/dist/mcp/tools/reindex-knowledge.js +11 -7
- package/dist/mcp/tools/reindex-knowledge.js.map +1 -1
- package/dist/mcp/tools/set-phase.d.ts.map +1 -1
- package/dist/mcp/tools/set-phase.js +16 -1
- package/dist/mcp/tools/set-phase.js.map +1 -1
- package/dist/mcp/tools/update-status.d.ts.map +1 -1
- package/dist/mcp/tools/update-status.js +21 -6
- package/dist/mcp/tools/update-status.js.map +1 -1
- package/dist/mcp/tools/{decompose.d.ts → validate-ac.d.ts} +2 -2
- package/dist/mcp/tools/validate-ac.d.ts.map +1 -0
- package/dist/mcp/tools/validate-ac.js +23 -0
- package/dist/mcp/tools/validate-ac.js.map +1 -0
- package/dist/schemas/ac-quality-schema.d.ts +90 -0
- package/dist/schemas/ac-quality-schema.d.ts.map +1 -0
- package/dist/schemas/ac-quality-schema.js +34 -0
- package/dist/schemas/ac-quality-schema.js.map +1 -0
- package/dist/schemas/analyzer-schema.d.ts +160 -0
- package/dist/schemas/analyzer-schema.d.ts.map +1 -0
- package/dist/schemas/analyzer-schema.js +74 -0
- package/dist/schemas/analyzer-schema.js.map +1 -0
- package/dist/schemas/designer-schema.d.ts +259 -0
- package/dist/schemas/designer-schema.d.ts.map +1 -0
- package/dist/schemas/designer-schema.js +102 -0
- package/dist/schemas/designer-schema.js.map +1 -0
- package/dist/schemas/handoff-schema.d.ts +49 -0
- package/dist/schemas/handoff-schema.d.ts.map +1 -0
- package/dist/schemas/handoff-schema.js +28 -0
- package/dist/schemas/handoff-schema.js.map +1 -0
- package/dist/schemas/implementer-schema.d.ts +187 -0
- package/dist/schemas/implementer-schema.d.ts.map +1 -0
- package/dist/schemas/implementer-schema.js +80 -0
- package/dist/schemas/implementer-schema.js.map +1 -0
- package/dist/schemas/knowledge.schema.d.ts +12 -0
- package/dist/schemas/knowledge.schema.d.ts.map +1 -1
- package/dist/schemas/knowledge.schema.js +1 -1
- package/dist/schemas/knowledge.schema.js.map +1 -1
- package/dist/schemas/listener-schema.d.ts +62 -0
- package/dist/schemas/listener-schema.d.ts.map +1 -0
- package/dist/schemas/listener-schema.js +35 -0
- package/dist/schemas/listener-schema.js.map +1 -0
- package/dist/schemas/reviewer-schema.d.ts +34 -0
- package/dist/schemas/reviewer-schema.d.ts.map +1 -0
- package/dist/schemas/reviewer-schema.js +17 -0
- package/dist/schemas/reviewer-schema.js.map +1 -0
- package/dist/schemas/validator-schema.d.ts +79 -0
- package/dist/schemas/validator-schema.d.ts.map +1 -0
- package/dist/schemas/validator-schema.js +43 -0
- package/dist/schemas/validator-schema.js.map +1 -0
- package/dist/web/dashboard/dist/assets/benchmark-tab-B5Sr8Cah.js +1 -0
- package/dist/web/dashboard/dist/assets/constants-kpH_c6vY.js +1 -0
- package/dist/web/dashboard/dist/assets/gitnexus-tab-DqmbSdzV.js +430 -0
- package/dist/web/dashboard/dist/assets/graph-tab-BKns5HdW.js +1 -0
- package/dist/web/dashboard/dist/assets/graph-utils-BxUWNvsI.js +7 -0
- package/dist/web/dashboard/dist/assets/index-CZOiKbTP.js +53 -0
- package/dist/web/dashboard/dist/assets/index-Dd4vKyDX.js +17 -0
- package/dist/web/dashboard/dist/assets/index-xyMN-_UV.css +1 -0
- package/dist/web/dashboard/dist/assets/insights-tab-B1kPckBM.js +52 -0
- package/dist/web/dashboard/dist/assets/{logs-tab-BPDyVj2B.js → logs-tab-BWfsrRlB.js} +1 -1
- package/dist/web/dashboard/dist/assets/memories-tab-D3zm-1Sq.js +1 -0
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-DXP4dFP-.js +1 -0
- package/dist/web/dashboard/dist/assets/skills-tab-CAlVL80S.js +1 -0
- package/dist/web/dashboard/dist/index.html +2 -2
- package/package.json +2 -2
- package/dist/api/routes/gitnexus.d.ts +0 -12
- package/dist/api/routes/gitnexus.d.ts.map +0 -1
- package/dist/api/routes/gitnexus.js +0 -164
- package/dist/api/routes/gitnexus.js.map +0 -1
- package/dist/core/integrations/gitnexus-launcher.d.ts +0 -67
- package/dist/core/integrations/gitnexus-launcher.d.ts.map +0 -1
- package/dist/core/integrations/gitnexus-launcher.js +0 -268
- package/dist/core/integrations/gitnexus-launcher.js.map +0 -1
- package/dist/core/integrations/gitnexus-queries.d.ts +0 -55
- package/dist/core/integrations/gitnexus-queries.d.ts.map +0 -1
- package/dist/core/integrations/gitnexus-queries.js +0 -168
- package/dist/core/integrations/gitnexus-queries.js.map +0 -1
- package/dist/core/integrations/serena-reader.d.ts +0 -18
- package/dist/core/integrations/serena-reader.d.ts.map +0 -1
- package/dist/core/integrations/serena-reader.js +0 -68
- package/dist/core/integrations/serena-reader.js.map +0 -1
- package/dist/core/rag/serena-indexer.d.ts +0 -16
- package/dist/core/rag/serena-indexer.d.ts.map +0 -1
- package/dist/core/rag/serena-indexer.js.map +0 -1
- package/dist/core/rag/serena-rag-query.d.ts.map +0 -1
- package/dist/core/rag/serena-rag-query.js.map +0 -1
- package/dist/mcp/tools/bulk-update-status.d.ts +0 -4
- package/dist/mcp/tools/bulk-update-status.d.ts.map +0 -1
- package/dist/mcp/tools/bulk-update-status.js +0 -22
- package/dist/mcp/tools/bulk-update-status.js.map +0 -1
- package/dist/mcp/tools/decompose.d.ts.map +0 -1
- package/dist/mcp/tools/decompose.js +0 -25
- package/dist/mcp/tools/decompose.js.map +0 -1
- package/dist/mcp/tools/dependencies.d.ts +0 -4
- package/dist/mcp/tools/dependencies.d.ts.map +0 -1
- package/dist/mcp/tools/dependencies.js +0 -47
- package/dist/mcp/tools/dependencies.js.map +0 -1
- package/dist/mcp/tools/stats.d.ts.map +0 -1
- package/dist/mcp/tools/stats.js +0 -46
- package/dist/mcp/tools/stats.js.map +0 -1
- package/dist/mcp/tools/velocity.d.ts.map +0 -1
- package/dist/mcp/tools/velocity.js +0 -25
- package/dist/mcp/tools/velocity.js.map +0 -1
- package/dist/web/dashboard/dist/assets/benchmark-tab-DzYj_lJO.js +0 -1
- package/dist/web/dashboard/dist/assets/constants-BIEJOBya.js +0 -1
- package/dist/web/dashboard/dist/assets/gitnexus-tab-B16kDpcc.js +0 -312
- package/dist/web/dashboard/dist/assets/graph-tab-bgRao3Qi.js +0 -1
- package/dist/web/dashboard/dist/assets/graph-utils-CETPf3Qj.js +0 -23
- package/dist/web/dashboard/dist/assets/index-D4nxPvv8.css +0 -1
- package/dist/web/dashboard/dist/assets/index-DLehETrJ.js +0 -53
- package/dist/web/dashboard/dist/assets/insights-tab-MkpvetqF.js +0 -1
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-DbnFo6Ve.js +0 -1
- package/dist/web/dashboard/dist/assets/serena-tab-CLJOpG5i.js +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
var Mc=Object.defineProperty;var Ic=(e,t,n)=>t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>Ic(e,typeof t!="symbol"?t+"":t,n);import{t as Ac,r as V,j as M,g as Tc}from"./index-CZOiKbTP.js";import{N as Pt,S as ir,E as ke}from"./constants-kpH_c6vY.js";import{i as Te,c as Yr,a as Gr,b as Lc,d as rn,u as Pc,r as jc}from"./index-Dd4vKyDX.js";function ae(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ae(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Oc={value:()=>{}};function Bt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Mt(n)}function Mt(e){this._=e}function Rc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Mt.prototype=Bt.prototype={constructor:Mt,on:function(e,t){var n=this._,r=Rc(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=Dc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<i;)if(o=(e=r[s]).type)n[o]=Xr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Xr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Mt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,s;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,o=s.length;r<o;++r)s[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,s=r.length;o<s;++o)r[o].value.apply(t,n)}};function Dc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Xr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Oc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var sr="http://www.w3.org/1999/xhtml";const Wr={svg:"http://www.w3.org/2000/svg",xhtml:sr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Wr.hasOwnProperty(t)?{space:Wr[t],local:e}:e}function $c(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===sr&&t.documentElement.namespaceURI===sr?t.createElement(e):t.createElementNS(n,e)}}function zc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $i(e){var t=qt(e);return(t.local?zc:$c)(t)}function Vc(){}function xr(e){return e==null?Vc:function(){return this.querySelector(e)}}function Fc(e){typeof e!="function"&&(e=xr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=new Array(i),c,d,u=0;u<i;++u)(c=s[u])&&(d=e.call(c,c.__data__,u,s))&&("__data__"in c&&(d.__data__=c.__data__),a[u]=d);return new ue(r,this._parents)}function Hc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Bc(){return[]}function zi(e){return e==null?Bc:function(){return this.querySelectorAll(e)}}function qc(e){return function(){return Hc(e.apply(this,arguments))}}function Yc(e){typeof e=="function"?e=qc(e):e=zi(e);for(var t=this._groups,n=t.length,r=[],o=[],s=0;s<n;++s)for(var i=t[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&(r.push(e.call(c,c.__data__,d,i)),o.push(c));return new ue(r,o)}function Vi(e){return function(){return this.matches(e)}}function Fi(e){return function(t){return t.matches(e)}}var Gc=Array.prototype.find;function Xc(e){return function(){return Gc.call(this.children,e)}}function Wc(){return this.firstElementChild}function Uc(e){return this.select(e==null?Wc:Xc(typeof e=="function"?e:Fi(e)))}var Kc=Array.prototype.filter;function Zc(){return Array.from(this.children)}function Qc(e){return function(){return Kc.call(this.children,e)}}function Jc(e){return this.selectAll(e==null?Zc:Qc(typeof e=="function"?e:Fi(e)))}function el(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new ue(r,this._parents)}function Hi(e){return new Array(e.length)}function tl(){return new ue(this._enter||this._groups.map(Hi),this._parents)}function jt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jt.prototype={constructor:jt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function nl(e){return function(){return e}}function rl(e,t,n,r,o,s){for(var i=0,a,c=t.length,d=s.length;i<d;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new jt(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function ol(e,t,n,r,o,s,i){var a,c,d=new Map,u=t.length,l=s.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",d.has(h)?o[a]=c:d.set(h,c));for(a=0;a<l;++a)h=i.call(e,s[a],a,s)+"",(c=d.get(h))?(r[a]=c,c.__data__=s[a],d.delete(h)):n[a]=new jt(e,s[a]);for(a=0;a<u;++a)(c=t[a])&&d.get(f[a])===c&&(o[a]=c)}function il(e){return e.__data__}function sl(e,t){if(!arguments.length)return Array.from(this,il);var n=t?ol:rl,r=this._parents,o=this._groups;typeof e!="function"&&(e=nl(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],l=o[d],f=l.length,h=al(e.call(u,u&&u.__data__,d,r)),p=h.length,x=a[d]=new Array(p),m=i[d]=new Array(p),y=c[d]=new Array(f);n(u,l,x,m,y,h,t);for(var v=0,g=0,w,C;v<p;++v)if(w=x[v]){for(v>=g&&(g=v+1);!(C=m[g])&&++g<p;);w._next=C||null}}return i=new ue(i,r),i._enter=a,i._exit=c,i}function al(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function cl(){return new ue(this._exit||this._groups.map(Hi),this._parents)}function ll(e,t,n){var r=this.enter(),o=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?s.remove():n(s),r&&o?r.merge(o).order():o}function ul(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,s=r.length,i=Math.min(o,s),a=new Array(o),c=0;c<i;++c)for(var d=n[c],u=r[c],l=d.length,f=a[c]=new Array(l),h,p=0;p<l;++p)(h=d[p]||u[p])&&(f[p]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function dl(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,s=r[o],i;--o>=0;)(i=r[o])&&(s&&i.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(i,s),s=i);return this}function fl(e){e||(e=hl);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),s=0;s<r;++s){for(var i=n[s],a=i.length,c=o[s]=new Array(a),d,u=0;u<a;++u)(d=i[u])&&(c[u]=d);c.sort(t)}return new ue(o,this._parents).order()}function hl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function pl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function gl(){return Array.from(this)}function ml(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length;o<s;++o){var i=r[o];if(i)return i}return null}function yl(){let e=0;for(const t of this)++e;return e}function wl(){return!this.node()}function xl(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],s=0,i=o.length,a;s<i;++s)(a=o[s])&&e.call(a,a.__data__,s,o);return this}function vl(e){return function(){this.removeAttribute(e)}}function bl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _l(e,t){return function(){this.setAttribute(e,t)}}function El(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Nl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Sl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Cl(e,t){var n=qt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?bl:vl:typeof t=="function"?n.local?Sl:Nl:n.local?El:_l)(n,t))}function Bi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function kl(e){return function(){this.style.removeProperty(e)}}function Ml(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Il(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Al(e,t,n){return arguments.length>1?this.each((t==null?kl:typeof t=="function"?Il:Ml)(e,t,n??"")):He(this.node(),e)}function He(e,t){return e.style.getPropertyValue(t)||Bi(e).getComputedStyle(e,null).getPropertyValue(t)}function Tl(e){return function(){delete this[e]}}function Ll(e,t){return function(){this[e]=t}}function Pl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function jl(e,t){return arguments.length>1?this.each((t==null?Tl:typeof t=="function"?Pl:Ll)(e,t)):this.node()[e]}function qi(e){return e.trim().split(/^|\s+/)}function vr(e){return e.classList||new Yi(e)}function Yi(e){this._node=e,this._names=qi(e.getAttribute("class")||"")}Yi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Gi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Xi(e,t){for(var n=vr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Ol(e){return function(){Gi(this,e)}}function Rl(e){return function(){Xi(this,e)}}function Dl(e,t){return function(){(t.apply(this,arguments)?Gi:Xi)(this,e)}}function $l(e,t){var n=qi(e+"");if(arguments.length<2){for(var r=vr(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Dl:t?Ol:Rl)(n,t))}function zl(){this.textContent=""}function Vl(e){return function(){this.textContent=e}}function Fl(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Hl(e){return arguments.length?this.each(e==null?zl:(typeof e=="function"?Fl:Vl)(e)):this.node().textContent}function Bl(){this.innerHTML=""}function ql(e){return function(){this.innerHTML=e}}function Yl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Gl(e){return arguments.length?this.each(e==null?Bl:(typeof e=="function"?Yl:ql)(e)):this.node().innerHTML}function Xl(){this.nextSibling&&this.parentNode.appendChild(this)}function Wl(){return this.each(Xl)}function Ul(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kl(){return this.each(Ul)}function Zl(e){var t=typeof e=="function"?e:$i(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ql(){return null}function Jl(e,t){var n=typeof e=="function"?e:$i(e),r=t==null?Ql:typeof t=="function"?t:xr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function eu(){var e=this.parentNode;e&&e.removeChild(this)}function tu(){return this.each(eu)}function nu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ru(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ou(e){return this.select(e?ru:nu)}function iu(e){return arguments.length?this.property("__data__",e):this.node().__data__}function su(e){return function(t){e.call(this,t,this.__data__)}}function au(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function cu(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,s;n<o;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function lu(e,t,n){return function(){var r=this.__on,o,s=su(t);if(r){for(var i=0,a=r.length;i<a;++i)if((o=r[i]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=s,o.options=n),o.value=t;return}}this.addEventListener(e.type,s,n),o={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(o):this.__on=[o]}}function uu(e,t,n){var r=au(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,d=a.length,u;c<d;++c)for(o=0,u=a[c];o<s;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value}return}for(a=t?lu:cu,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function Wi(e,t,n){var r=Bi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function du(e,t){return function(){return Wi(this,e,t)}}function fu(e,t){return function(){return Wi(this,e,t.apply(this,arguments))}}function hu(e,t){return this.each((typeof t=="function"?fu:du)(e,t))}function*pu(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,s=r.length,i;o<s;++o)(i=r[o])&&(yield i)}var Ui=[null];function ue(e,t){this._groups=e,this._parents=t}function ft(){return new ue([[document.documentElement]],Ui)}function gu(){return this}ue.prototype=ft.prototype={constructor:ue,select:Fc,selectAll:Yc,selectChild:Uc,selectChildren:Jc,filter:el,data:sl,enter:tl,exit:cl,join:ll,merge:ul,selection:gu,order:dl,sort:fl,call:pl,nodes:gl,node:ml,size:yl,empty:wl,each:xl,attr:Cl,style:Al,property:jl,classed:$l,text:Hl,html:Gl,raise:Wl,lower:Kl,append:Zl,insert:Jl,remove:tu,clone:ou,datum:iu,on:uu,dispatch:hu,[Symbol.iterator]:pu};function le(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Ui)}function mu(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=mu(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const yu={passive:!1},it={capture:!0,passive:!1};function on(e){e.stopImmediatePropagation()}function Fe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ki(e){var t=e.document.documentElement,n=le(e).on("dragstart.drag",Fe,it);"onselectstart"in t?n.on("selectstart.drag",Fe,it):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Zi(e,t){var n=e.document.documentElement,r=le(e).on("dragstart.drag",null);t&&(r.on("click.drag",Fe,it),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const vt=e=>()=>e;function ar(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,y:a,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:i,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}ar.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function wu(e){return!e.ctrlKey&&!e.button}function xu(){return this.parentNode}function vu(e,t){return t??{x:e.x,y:e.y}}function bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qi(){var e=wu,t=xu,n=vu,r=bu,o={},s=Bt("start","drag","end"),i=0,a,c,d,u,l=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",m).on("touchmove.drag",y,yu).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,C){if(!(u||!e.call(this,w,C))){var S=g(this,t.call(this,w,C),w,C,"mouse");S&&(le(w.view).on("mousemove.drag",p,it).on("mouseup.drag",x,it),Ki(w.view),on(w),d=!1,a=w.clientX,c=w.clientY,S("start",w))}}function p(w){if(Fe(w),!d){var C=w.clientX-a,S=w.clientY-c;d=C*C+S*S>l}o.mouse("drag",w)}function x(w){le(w.view).on("mousemove.drag mouseup.drag",null),Zi(w.view,d),Fe(w),o.mouse("end",w)}function m(w,C){if(e.call(this,w,C)){var S=w.changedTouches,I=t.call(this,w,C),b=S.length,E,A;for(E=0;E<b;++E)(A=g(this,I,w,C,S[E].identifier,S[E]))&&(on(w),A("start",w,S[E]))}}function y(w){var C=w.changedTouches,S=C.length,I,b;for(I=0;I<S;++I)(b=o[C[I].identifier])&&(Fe(w),b("drag",w,C[I]))}function v(w){var C=w.changedTouches,S=C.length,I,b;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),I=0;I<S;++I)(b=o[C[I].identifier])&&(on(w),b("end",w,C[I]))}function g(w,C,S,I,b,E){var A=s.copy(),N=de(E||S,C),k,D,_;if((_=n.call(w,new ar("beforestart",{sourceEvent:S,target:f,identifier:b,active:i,x:N[0],y:N[1],dx:0,dy:0,dispatch:A}),I))!=null)return k=_.x-N[0]||0,D=_.y-N[1]||0,function P(L,$,R){var j=N,F;switch(L){case"start":o[b]=P,F=i++;break;case"end":delete o[b],--i;case"drag":N=de(R||$,C),F=i;break}A.call(L,w,new ar(L,{sourceEvent:$,subject:_,target:f,identifier:b,active:F,x:N[0]+k,y:N[1]+D,dx:N[0]-j[0],dy:N[1]-j[1],dispatch:A}),I)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:vt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:vt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:vt(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:vt(!!w),f):r},f.on=function(){var w=s.on.apply(s,arguments);return w===s?f:w},f.clickDistance=function(w){return arguments.length?(l=(w=+w)*w,f):Math.sqrt(l)},f}var Ur=180/Math.PI,cr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ji(e,t,n,r,o,s){var i,a,c;return(i=Math.sqrt(e*e+t*t))&&(e/=i,t/=i),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,i=-i),{translateX:o,translateY:s,rotate:Math.atan2(t,e)*Ur,skewX:Math.atan(c)*Ur,scaleX:i,scaleY:a}}var bt;function _u(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?cr:Ji(t.a,t.b,t.c,t.d,t.e,t.f)}function Eu(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?cr:(e=e.matrix,Ji(e.a,e.b,e.c,e.d,e.e,e.f))}function es(e,t,n,r){function o(d){return d.length?d.pop()+" ":""}function s(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push("translate(",null,t,null,n);p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function i(d,u,l,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:Te(d,u)})):u&&l.push(o(l)+"rotate("+u+r)}function a(d,u,l,f){d!==u?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:Te(d,u)}):u&&l.push(o(l)+"skewX("+u+r)}function c(d,u,l,f,h,p){if(d!==l||u!==f){var x=h.push(o(h)+"scale(",null,",",null,")");p.push({i:x-4,x:Te(d,l)},{i:x-2,x:Te(u,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(d,u){var l=[],f=[];return d=e(d),u=e(u),s(d.translateX,d.translateY,u.translateX,u.translateY,l,f),i(d.rotate,u.rotate,l,f),a(d.skewX,u.skewX,l,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,l,f),d=u=null,function(h){for(var p=-1,x=f.length,m;++p<x;)l[(m=f[p]).i]=m.x(h);return l.join("")}}}var Nu=es(_u,"px, ","px)","deg)"),Su=es(Eu,", ",")",")"),Cu=1e-12;function Kr(e){return((e=Math.exp(e))+1/e)/2}function ku(e){return((e=Math.exp(e))-1/e)/2}function Mu(e){return((e=Math.exp(2*e))-1)/(e+1)}const It=(function e(t,n,r){function o(s,i){var a=s[0],c=s[1],d=s[2],u=i[0],l=i[1],f=i[2],h=u-a,p=l-c,x=h*h+p*p,m,y;if(x<Cu)y=Math.log(f/d)/t,m=function(I){return[a+I*h,c+I*p,d*Math.exp(t*I*y)]};else{var v=Math.sqrt(x),g=(f*f-d*d+r*x)/(2*d*n*v),w=(f*f-d*d-r*x)/(2*f*n*v),C=Math.log(Math.sqrt(g*g+1)-g),S=Math.log(Math.sqrt(w*w+1)-w);y=(S-C)/t,m=function(I){var b=I*y,E=Kr(C),A=d/(n*v)*(E*Mu(t*b+C)-ku(C));return[a+A*h,c+A*p,d*E/Kr(t*b+C)]}}return m.duration=y*1e3*t/Math.SQRT2,m}return o.rho=function(s){var i=Math.max(.001,+s),a=i*i,c=a*a;return e(i,a,c)},o})(Math.SQRT2,2,4);var Be=0,nt=0,et=0,ts=1e3,Ot,rt,Rt=0,je=0,Yt=0,st=typeof performance=="object"&&performance.now?performance:Date,ns=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function br(){return je||(ns(Iu),je=st.now()+Yt)}function Iu(){je=0}function Dt(){this._call=this._time=this._next=null}Dt.prototype=rs.prototype={constructor:Dt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?br():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:Ot=this,rt=this),this._call=e,this._time=n,lr()},stop:function(){this._call&&(this._call=null,this._time=1/0,lr())}};function rs(e,t,n){var r=new Dt;return r.restart(e,t,n),r}function Au(){br(),++Be;for(var e=Ot,t;e;)(t=je-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Be}function Zr(){je=(Rt=st.now())+Yt,Be=nt=0;try{Au()}finally{Be=0,Lu(),je=0}}function Tu(){var e=st.now(),t=e-Rt;t>ts&&(Yt-=t,Rt=e)}function Lu(){for(var e,t=Ot,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);rt=e,lr(r)}function lr(e){if(!Be){nt&&(nt=clearTimeout(nt));var t=e-je;t>24?(e<1/0&&(nt=setTimeout(Zr,e-st.now()-Yt)),et&&(et=clearInterval(et))):(et||(Rt=st.now(),et=setInterval(Tu,ts)),Be=1,ns(Zr))}}function Qr(e,t,n){var r=new Dt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Pu=Bt("start","end","cancel","interrupt"),ju=[],os=0,Jr=1,ur=2,At=3,eo=4,dr=5,Tt=6;function Gt(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Ou(e,n,{name:t,index:r,group:o,on:Pu,tween:ju,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:os})}function _r(e,t){var n=ge(e,t);if(n.state>os)throw new Error("too late; already scheduled");return n}function ye(e,t){var n=ge(e,t);if(n.state>At)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ou(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=rs(s,0,n.time);function s(d){n.state=Jr,n.timer.restart(i,n.delay,n.time),n.delay<=d&&i(d-n.delay)}function i(d){var u,l,f,h;if(n.state!==Jr)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===At)return Qr(i);h.state===eo?(h.state=Tt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=Tt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Qr(function(){n.state===At&&(n.state=eo,n.timer.restart(a,n.delay,n.time),a(d))}),n.state=ur,n.on.call("start",e,e.__data__,n.index,n.group),n.state===ur){for(n.state=At,o=new Array(f=n.tween.length),u=0,l=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=dr,1),l=-1,f=o.length;++l<f;)o[l].call(e,u);n.state===dr&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Tt,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Lt(e,t){var n=e.__transition,r,o,s=!0,i;if(n){t=t==null?null:t+"";for(i in n){if((r=n[i]).name!==t){s=!1;continue}o=r.state>ur&&r.state<dr,r.state=Tt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function Ru(e){return this.each(function(){Lt(this,e)})}function Du(e,t){var n,r;return function(){var o=ye(this,e),s=o.tween;if(s!==n){r=n=s;for(var i=0,a=r.length;i<a;++i)if(r[i].name===t){r=r.slice(),r.splice(i,1);break}}o.tween=r}}function $u(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=ye(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,d=o.length;c<d;++c)if(o[c].name===t){o[c]=a;break}c===d&&o.push(a)}s.tween=o}}function zu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ge(this.node(),n).tween,o=0,s=r.length,i;o<s;++o)if((i=r[o]).name===e)return i.value;return null}return this.each((t==null?Du:$u)(n,e,t))}function Er(e,t,n){var r=e._id;return e.each(function(){var o=ye(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ge(o,r).value[t]}}function is(e,t){var n;return(typeof t=="number"?Te:t instanceof Yr?Gr:(n=Yr(t))?(t=n,Gr):Lc)(e,t)}function Vu(e){return function(){this.removeAttribute(e)}}function Fu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttribute(e);return i===o?null:i===r?s:s=t(r=i,n)}}function Bu(e,t,n){var r,o=n+"",s;return function(){var i=this.getAttributeNS(e.space,e.local);return i===o?null:i===r?s:s=t(r=i,n)}}function qu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttribute(e):(i=this.getAttribute(e),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Yu(e,t,n){var r,o,s;return function(){var i,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(i=this.getAttributeNS(e.space,e.local),c=a+"",i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a)))}}function Gu(e,t){var n=qt(e),r=n==="transform"?Su:is;return this.attrTween(e,typeof t=="function"?(n.local?Yu:qu)(n,r,Er(this,"attr."+e,t)):t==null?(n.local?Fu:Vu)(n):(n.local?Bu:Hu)(n,r,t))}function Xu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Uu(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Wu(e,s)),n}return o._value=t,o}function Ku(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&Xu(e,s)),n}return o._value=t,o}function Zu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=qt(e);return this.tween(n,(r.local?Uu:Ku)(r,t))}function Qu(e,t){return function(){_r(this,e).delay=+t.apply(this,arguments)}}function Ju(e,t){return t=+t,function(){_r(this,e).delay=t}}function ed(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qu:Ju)(t,e)):ge(this.node(),t).delay}function td(e,t){return function(){ye(this,e).duration=+t.apply(this,arguments)}}function nd(e,t){return t=+t,function(){ye(this,e).duration=t}}function rd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?td:nd)(t,e)):ge(this.node(),t).duration}function od(e,t){if(typeof t!="function")throw new Error;return function(){ye(this,e).ease=t}}function id(e){var t=this._id;return arguments.length?this.each(od(t,e)):ge(this.node(),t).ease}function sd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ye(this,e).ease=n}}function ad(e){if(typeof e!="function")throw new Error;return this.each(sd(this._id,e))}function cd(e){typeof e!="function"&&(e=Vi(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var s=t[o],i=s.length,a=r[o]=[],c,d=0;d<i;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&a.push(c);return new be(r,this._parents,this._name,this._id)}function ld(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,s=Math.min(r,o),i=new Array(r),a=0;a<s;++a)for(var c=t[a],d=n[a],u=c.length,l=i[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||d[h])&&(l[h]=f);for(;a<r;++a)i[a]=t[a];return new be(i,this._parents,this._name,this._id)}function ud(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function dd(e,t,n){var r,o,s=ud(t)?_r:ye;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function fd(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(dd(n,e,t))}function hd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function pd(){return this.on("end.remove",hd(this._id))}function gd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=xr(e));for(var r=this._groups,o=r.length,s=new Array(o),i=0;i<o;++i)for(var a=r[i],c=a.length,d=s[i]=new Array(c),u,l,f=0;f<c;++f)(u=a[f])&&(l=e.call(u,u.__data__,f,a))&&("__data__"in u&&(l.__data__=u.__data__),d[f]=l,Gt(d[f],t,n,f,d,ge(u,n)));return new be(s,this._parents,t,n)}function md(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zi(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],d=c.length,u,l=0;l<d;++l)if(u=c[l]){for(var f=e.call(u,u.__data__,l,c),h,p=ge(u,n),x=0,m=f.length;x<m;++x)(h=f[x])&&Gt(h,t,n,x,f,p);s.push(f),i.push(u)}return new be(s,i,t,n)}var yd=ft.prototype.constructor;function wd(){return new yd(this._groups,this._parents)}function xd(e,t){var n,r,o;return function(){var s=He(this,e),i=(this.style.removeProperty(e),He(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function ss(e){return function(){this.style.removeProperty(e)}}function vd(e,t,n){var r,o=n+"",s;return function(){var i=He(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function bd(e,t,n){var r,o,s;return function(){var i=He(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),He(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function _d(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=ye(this,e),d=c.on,u=c.value[s]==null?a||(a=ss(t)):void 0;(d!==n||o!==u)&&(r=(n=d).copy()).on(i,o=u),c.on=r}}function Ed(e,t,n){var r=(e+="")=="transform"?Nu:is;return t==null?this.styleTween(e,xd(e,r)).on("end.style."+e,ss(e)):typeof t=="function"?this.styleTween(e,bd(e,r,Er(this,"style."+e,t))).each(_d(this._id,e)):this.styleTween(e,vd(e,r,t),n).on("end.style."+e,null)}function Nd(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Sd(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Nd(e,i,n)),r}return s._value=t,s}function Cd(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,Sd(e,t,n??""))}function kd(e){return function(){this.textContent=e}}function Md(e){return function(){var t=e(this);this.textContent=t??""}}function Id(e){return this.tween("text",typeof e=="function"?Md(Er(this,"text",e)):kd(e==null?"":e+""))}function Ad(e){return function(t){this.textContent=e.call(this,t)}}function Td(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Ad(o)),t}return r._value=e,r}function Ld(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Td(e))}function Pd(){for(var e=this._name,t=this._id,n=as(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)if(c=i[d]){var u=ge(c,t);Gt(c,e,n,d,i,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new be(r,this._parents,e,n)}function jd(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(s,i){var a={value:i},c={value:function(){--o===0&&s()}};n.each(function(){var d=ye(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),d.on=t}),o===0&&s()})}var Od=0;function be(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function as(){return++Od}var xe=ft.prototype;be.prototype={constructor:be,select:gd,selectAll:md,selectChild:xe.selectChild,selectChildren:xe.selectChildren,filter:cd,merge:ld,selection:wd,transition:Pd,call:xe.call,nodes:xe.nodes,node:xe.node,size:xe.size,empty:xe.empty,each:xe.each,on:fd,attr:Gu,attrTween:Zu,style:Ed,styleTween:Cd,text:Id,textTween:Ld,remove:pd,tween:zu,delay:ed,duration:rd,ease:id,easeVarying:ad,end:jd,[Symbol.iterator]:xe[Symbol.iterator]};function Rd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dd={time:null,delay:0,duration:250,ease:Rd};function $d(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function zd(e){var t,n;e instanceof be?(t=e._id,e=e._name):(t=as(),(n=Dd).time=br(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,d=0;d<a;++d)(c=i[d])&&Gt(c,e,t,d,i,n||$d(c,t));return new be(r,this._parents,e,t)}ft.prototype.interrupt=Ru;ft.prototype.transition=zd;const _t=e=>()=>e;function Vd(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function ve(e,t,n){this.k=e,this.x=t,this.y=n}ve.prototype={constructor:ve,scale:function(e){return e===1?this:new ve(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ve(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Xt=new ve(1,0,0);cs.prototype=ve.prototype;function cs(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xt;return e.__zoom}function sn(e){e.stopImmediatePropagation()}function tt(e){e.preventDefault(),e.stopImmediatePropagation()}function Fd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Hd(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function to(){return this.__zoom||Xt}function Bd(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qd(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yd(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],i=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),i>s?(s+i)/2:Math.min(0,s)||Math.max(0,i))}function ls(){var e=Fd,t=Hd,n=Yd,r=Bd,o=qd,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=It,d=Bt("start","zoom","end"),u,l,f,h=500,p=150,x=0,m=10;function y(_){_.property("__zoom",to).on("wheel.zoom",b,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(o).on("touchstart.zoom",N).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",D).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(_,P,L,$){var R=_.selection?_.selection():_;R.property("__zoom",to),_!==R?C(_,P,L,$):R.interrupt().each(function(){S(this,arguments).event($).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(_,P,L,$){y.scaleTo(_,function(){var R=this.__zoom.k,j=typeof P=="function"?P.apply(this,arguments):P;return R*j},L,$)},y.scaleTo=function(_,P,L,$){y.transform(_,function(){var R=t.apply(this,arguments),j=this.__zoom,F=L==null?w(R):typeof L=="function"?L.apply(this,arguments):L,q=j.invert(F),H=typeof P=="function"?P.apply(this,arguments):P;return n(g(v(j,H),F,q),R,i)},L,$)},y.translateBy=function(_,P,L,$){y.transform(_,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof L=="function"?L.apply(this,arguments):L),t.apply(this,arguments),i)},null,$)},y.translateTo=function(_,P,L,$,R){y.transform(_,function(){var j=t.apply(this,arguments),F=this.__zoom,q=$==null?w(j):typeof $=="function"?$.apply(this,arguments):$;return n(Xt.translate(q[0],q[1]).scale(F.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof L=="function"?-L.apply(this,arguments):-L),j,i)},$,R)};function v(_,P){return P=Math.max(s[0],Math.min(s[1],P)),P===_.k?_:new ve(P,_.x,_.y)}function g(_,P,L){var $=P[0]-L[0]*_.k,R=P[1]-L[1]*_.k;return $===_.x&&R===_.y?_:new ve(_.k,$,R)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function C(_,P,L,$){_.on("start.zoom",function(){S(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){S(this,arguments).event($).end()}).tween("zoom",function(){var R=this,j=arguments,F=S(R,j).event($),q=t.apply(R,j),H=L==null?w(q):typeof L=="function"?L.apply(R,j):L,T=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),O=R.__zoom,z=typeof P=="function"?P.apply(R,j):P,B=c(O.invert(H).concat(T/O.k),z.invert(H).concat(T/z.k));return function(G){if(G===1)G=z;else{var Y=B(G),X=T/Y[2];G=new ve(X,H[0]-Y[0]*X,H[1]-Y[1]*X)}F.zoom(null,G)}})}function S(_,P,L){return!L&&_.__zooming||new I(_,P)}function I(_,P){this.that=_,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,P),this.taps=0}I.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,P){return this.mouse&&_!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var P=le(this.that).datum();d.call(_,this.that,new Vd(_,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),P)}};function b(_,...P){if(!e.apply(this,arguments))return;var L=S(this,P).event(_),$=this.__zoom,R=Math.max(s[0],Math.min(s[1],$.k*Math.pow(2,r.apply(this,arguments)))),j=de(_);if(L.wheel)(L.mouse[0][0]!==j[0]||L.mouse[0][1]!==j[1])&&(L.mouse[1]=$.invert(L.mouse[0]=j)),clearTimeout(L.wheel);else{if($.k===R)return;L.mouse=[j,$.invert(j)],Lt(this),L.start()}tt(_),L.wheel=setTimeout(F,p),L.zoom("mouse",n(g(v($,R),L.mouse[0],L.mouse[1]),L.extent,i));function F(){L.wheel=null,L.end()}}function E(_,...P){if(f||!e.apply(this,arguments))return;var L=_.currentTarget,$=S(this,P,!0).event(_),R=le(_.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",T,!0),j=de(_,L),F=_.clientX,q=_.clientY;Ki(_.view),sn(_),$.mouse=[j,this.__zoom.invert(j)],Lt(this),$.start();function H(O){if(tt(O),!$.moved){var z=O.clientX-F,B=O.clientY-q;$.moved=z*z+B*B>x}$.event(O).zoom("mouse",n(g($.that.__zoom,$.mouse[0]=de(O,L),$.mouse[1]),$.extent,i))}function T(O){R.on("mousemove.zoom mouseup.zoom",null),Zi(O.view,$.moved),tt(O),$.event(O).end()}}function A(_,...P){if(e.apply(this,arguments)){var L=this.__zoom,$=de(_.changedTouches?_.changedTouches[0]:_,this),R=L.invert($),j=L.k*(_.shiftKey?.5:2),F=n(g(v(L,j),$,R),t.apply(this,P),i);tt(_),a>0?le(this).transition().duration(a).call(C,F,$,_):le(this).call(y.transform,F,$,_)}}function N(_,...P){if(e.apply(this,arguments)){var L=_.touches,$=L.length,R=S(this,P,_.changedTouches.length===$).event(_),j,F,q,H;for(sn(_),F=0;F<$;++F)q=L[F],H=de(q,this),H=[H,this.__zoom.invert(H),q.identifier],R.touch0?!R.touch1&&R.touch0[2]!==H[2]&&(R.touch1=H,R.taps=0):(R.touch0=H,j=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),j&&(R.taps<2&&(l=H[0],u=setTimeout(function(){u=null},h)),Lt(this),R.start())}}function k(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F,q,H;for(tt(_),j=0;j<R;++j)F=$[j],q=de(F,this),L.touch0&&L.touch0[2]===F.identifier?L.touch0[0]=q:L.touch1&&L.touch1[2]===F.identifier&&(L.touch1[0]=q);if(F=L.that.__zoom,L.touch1){var T=L.touch0[0],O=L.touch0[1],z=L.touch1[0],B=L.touch1[1],G=(G=z[0]-T[0])*G+(G=z[1]-T[1])*G,Y=(Y=B[0]-O[0])*Y+(Y=B[1]-O[1])*Y;F=v(F,Math.sqrt(G/Y)),q=[(T[0]+z[0])/2,(T[1]+z[1])/2],H=[(O[0]+B[0])/2,(O[1]+B[1])/2]}else if(L.touch0)q=L.touch0[0],H=L.touch0[1];else return;L.zoom("touch",n(g(F,q,H),L.extent,i))}}function D(_,...P){if(this.__zooming){var L=S(this,P).event(_),$=_.changedTouches,R=$.length,j,F;for(sn(_),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),j=0;j<R;++j)F=$[j],L.touch0&&L.touch0[2]===F.identifier?delete L.touch0:L.touch1&&L.touch1[2]===F.identifier&&delete L.touch1;if(L.touch1&&!L.touch0&&(L.touch0=L.touch1,delete L.touch1),L.touch0)L.touch0[1]=this.__zoom.invert(L.touch0[0]);else if(L.end(),L.taps===2&&(F=de(F,this),Math.hypot(l[0]-F[0],l[1]-F[1])<m)){var q=le(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return y.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:_t(+_),y):r},y.filter=function(_){return arguments.length?(e=typeof _=="function"?_:_t(!!_),y):e},y.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:_t(!!_),y):o},y.extent=function(_){return arguments.length?(t=typeof _=="function"?_:_t([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),y):t},y.scaleExtent=function(_){return arguments.length?(s[0]=+_[0],s[1]=+_[1],y):[s[0],s[1]]},y.translateExtent=function(_){return arguments.length?(i[0][0]=+_[0][0],i[1][0]=+_[1][0],i[0][1]=+_[0][1],i[1][1]=+_[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(_){return arguments.length?(n=_,y):n},y.duration=function(_){return arguments.length?(a=+_,y):a},y.interpolate=function(_){return arguments.length?(c=_,y):c},y.on=function(){var _=d.on.apply(d,arguments);return _===d?y:_},y.clickDistance=function(_){return arguments.length?(x=(_=+_)*_,y):Math.sqrt(x)},y.tapDistance=function(_){return arguments.length?(m=+_,y):m},y}const me={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:e=>`Node type "${e}" 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:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/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."},at=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],us=["Enter"," ","Escape"],ds={"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:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, 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 qe;(function(e){e.Strict="strict",e.Loose="loose"})(qe||(qe={}));var Pe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Pe||(Pe={}));var ct;(function(e){e.Partial="partial",e.Full="full"})(ct||(ct={}));const fs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ce;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ce||(Ce={}));var $t;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})($t||($t={}));var K;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(K||(K={}));const no={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function hs(e){return e===null?null:e?"valid":"invalid"}const ps=e=>"id"in e&&"source"in e&&"target"in e,Gd=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),ht=(e,t=[0,0])=>{const{width:n,height:r}=_e(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},Xd=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const s=typeof o=="string";let i=!t.nodeLookup&&!s?o:void 0;t.nodeLookup&&(i=s?t.nodeLookup.get(o):Nr(o)?o:t.nodeLookup.get(o.id));const a=i?zt(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Wt(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ut(n)},pt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=Wt(n,zt(o)),r=!0)}),r?Ut(n):{x:0,y:0,width:0,height:0}},Sr=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...mt(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const d of e.values()){const{measured:u,selectable:l=!0,hidden:f=!1}=d;if(i&&!l||f)continue;const h=u.width??d.width??d.initialWidth??null,p=u.height??d.height??d.initialHeight??null,x=lt(a,Ge(d)),m=(h??0)*(p??0),y=s&&x>0;(!d.internals.handleBounds||y||x>=m||d.dragging)&&c.push(d)}return c},Wd=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Ud(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Kd({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return Promise.resolve(!0);const a=Ud(e,i),c=pt(a),d=Cr(c,t,n,(i==null?void 0:i.minZoom)??o,(i==null?void 0:i.maxZoom)??s,(i==null?void 0:i.padding)??.1);return await r.setViewport(d,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),Promise.resolve(!0)}function gs({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:s}){const i=n.get(e),a=i.parentId?n.get(i.parentId):void 0,{x:c,y:d}=a?a.internals.positionAbsolute:{x:0,y:0},u=i.origin??r;let l=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",me.error005());else{const h=a.measured.width,p=a.measured.height;h&&p&&(l=[[c,d],[c+h,d+p]])}else a&&Xe(i.extent)&&(l=[[i.extent[0][0]+c,i.extent[0][1]+d],[i.extent[1][0]+c,i.extent[1][1]+d]]);const f=Xe(l)?Oe(t,l,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",me.error015())),{position:{x:f.x-c+(i.measured.width??0)*u[0],y:f.y-d+(i.measured.height??0)*u[1]},positionAbsolute:f}}async function Zd({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const s=new Set(e.map(f=>f.id)),i=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),p=!h&&f.parentId&&i.find(x=>x.id===f.parentId);(h||p)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=Wd(i,c);for(const f of c)a.has(f.id)&&!u.find(p=>p.id===f.id)&&u.push(f);if(!o)return{edges:u,nodes:i};const l=await o({nodes:i,edges:u});return typeof l=="boolean"?l?{edges:u,nodes:i}:{edges:[],nodes:[]}:l}const Ye=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Oe=(e={x:0,y:0},t,n)=>({x:Ye(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ye(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ms(e,t,n){const{width:r,height:o}=_e(n),{x:s,y:i}=n.internals.positionAbsolute;return Oe(e,[[s,i],[s+r,i+o]],t)}const ro=(e,t,n)=>e<t?Ye(Math.abs(e-t),1,t)/t:e>n?-Ye(Math.abs(e-n),1,t)/t:0,ys=(e,t,n=15,r=40)=>{const o=ro(e.x,r,t.width-r)*n,s=ro(e.y,r,t.height-r)*n;return[o,s]},Wt=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),fr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ut=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ge=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},zt=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Nr(e)?e.internals.positionAbsolute:ht(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},ws=(e,t)=>Ut(Wt(fr(e),fr(t))),lt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},oo=e=>fe(e.width)&&fe(e.height)&&fe(e.x)&&fe(e.y),fe=e=>!isNaN(e)&&isFinite(e),Qd=(e,t)=>{},gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mt=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?gt(a,i):a},Vt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function $e(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Jd(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=$e(e,n),o=$e(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=$e(e.top??e.y??0,n),o=$e(e.bottom??e.y??0,n),s=$e(e.left??e.x??0,t),i=$e(e.right??e.x??0,t);return{top:r,right:i,bottom:o,left:s,x:s+i,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ef(e,t,n,r,o,s){const{x:i,y:a}=Vt(e,[t,n,r]),{x:c,y:d}=Vt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=o-c,l=s-d;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(l)}}const Cr=(e,t,n,r,o,s)=>{const i=Jd(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,d=Math.min(a,c),u=Ye(d,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*u,p=n/2-f*u,x=ef(e,h,p,u,t,n),m={left:Math.min(x.left-i.left,0),top:Math.min(x.top-i.top,0),right:Math.min(x.right-i.right,0),bottom:Math.min(x.bottom-i.bottom,0)};return{x:h-m.left+m.right,y:p-m.top+m.bottom,zoom:u}},ut=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Xe(e){return e!=null&&e!=="parent"}function _e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function xs(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function vs(e,t={width:0,height:0},n,r,o){const s={...e},i=r.get(n);if(i){const a=i.origin||o;s.x+=i.internals.positionAbsolute.x-(t.width??0)*a[0],s.y+=i.internals.positionAbsolute.y-(t.height??0)*a[1]}return s}function io(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tf(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function nf(e){return{...ds,...e||{}}}function ot(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=he(e),a=mt({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:d}=n?gt(a,t):a;return{xSnapped:c,ySnapped:d,...a}}const kr=e=>({width:e.offsetWidth,height:e.offsetHeight}),bs=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},rf=["INPUT","SELECT","TEXTAREA"];function _s(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:rf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Es=e=>"clientX"in e,he=(e,t)=>{var s,i;const n=Es(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,o=n?e.clientY:(i=e.touches)==null?void 0:i[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},so=(e,t,n,r,o)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(i=>{const a=i.getBoundingClientRect();return{id:i.getAttribute("data-handleid"),type:e,nodeId:o,position:i.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...kr(i)}})};function Ns({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:s,targetControlX:i,targetControlY:a}){const c=e*.125+o*.375+i*.375+n*.125,d=t*.125+s*.375+a*.375+r*.125,u=Math.abs(c-e),l=Math.abs(d-t);return[c,d,u,l]}function Et(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ao({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case K.Left:return[t-Et(t-r,s),n];case K.Right:return[t+Et(r-t,s),n];case K.Top:return[t,n-Et(n-o,s)];case K.Bottom:return[t,n+Et(o-n,s)]}}function Mr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,curvature:i=.25}){const[a,c]=ao({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[d,u]=ao({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[l,f,h,p]=Ns({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${a},${c} ${d},${u} ${r},${o}`,l,f,h,p]}function Ss({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,s=n<e?n+o:n-o,i=Math.abs(r-t)/2,a=r<t?r+i:r-i;return[s,a,o,i]}function of({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const i=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return i+a}function sf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=Wt(zt(e),zt(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const i={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return lt(i,Ut(s))>0}const af=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,cf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),lf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||af;let o;return ps(e)?o={...e}:o={...e,id:r(e)},cf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Cs({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=Ss({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const co={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},uf=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function df({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:o,offset:s,stepPosition:i}){const a=co[t],c=co[r],d={x:e.x+a.x*s,y:e.y+a.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},l=uf({source:d,sourcePosition:t,target:u}),f=l.x!==0?"x":"y",h=l[f];let p=[],x,m;const y={x:0,y:0},v={x:0,y:0},[,,g,w]=Ss({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??d.x+(u.x-d.x)*i,m=o.y??(d.y+u.y)/2):(x=o.x??(d.x+u.x)/2,m=o.y??d.y+(u.y-d.y)*i);const S=[{x,y:d.y},{x,y:u.y}],I=[{x:d.x,y:m},{x:u.x,y:m}];a[f]===h?p=f==="x"?S:I:p=f==="x"?I:S}else{const S=[{x:d.x,y:u.y}],I=[{x:u.x,y:d.y}];if(f==="x"?p=a.x===h?I:S:p=a.y===h?S:I,t===r){const k=Math.abs(e[f]-n[f]);if(k<=s){const D=Math.min(s-1,s-k);a[f]===h?y[f]=(d[f]>e[f]?-1:1)*D:v[f]=(u[f]>n[f]?-1:1)*D}}if(t!==r){const k=f==="x"?"y":"x",D=a[f]===c[k],_=d[k]>u[k],P=d[k]<u[k];(a[f]===1&&(!D&&_||D&&P)||a[f]!==1&&(!D&&P||D&&_))&&(p=f==="x"?S:I)}const b={x:d.x+y.x,y:d.y+y.y},E={x:u.x+v.x,y:u.y+v.y},A=Math.max(Math.abs(b.x-p[0].x),Math.abs(E.x-p[0].x)),N=Math.max(Math.abs(b.y-p[0].y),Math.abs(E.y-p[0].y));A>=N?(x=(b.x+E.x)/2,m=p[0].y):(x=p[0].x,m=(b.y+E.y)/2)}return[[e,{x:d.x+y.x,y:d.y+y.y},...p,{x:u.x+v.x,y:u.y+v.y},n],x,m,g,w]}function ff(e,t,n,r){const o=Math.min(lo(e,t)/2,lo(t,n)/2,r),{x:s,y:i}=t;if(e.x===s&&s===n.x||e.y===i&&i===n.y)return`L${s} ${i}`;if(e.y===i){const d=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+o*d},${i}Q ${s},${i} ${s},${i+o*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${i+o*c}Q ${s},${i} ${s+o*a},${i}`}function hr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top,borderRadius:i=5,centerX:a,centerY:c,offset:d=20,stepPosition:u=.5}){const[l,f,h,p,x]=df({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:d,stepPosition:u});return[l.reduce((y,v,g)=>{let w="";return g>0&&g<l.length-1?w=ff(l[g-1],v,l[g+1],i):w=`${g===0?"M":"L"}${v.x} ${v.y}`,y+=w,y},""),f,h,p,x]}function uo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hf(e){var l;const{sourceNode:t,targetNode:n}=e;if(!uo(t)||!uo(n))return null;const r=t.internals.handleBounds||fo(t.handles),o=n.internals.handleBounds||fo(n.handles),s=ho((r==null?void 0:r.source)??[],e.sourceHandle),i=ho(e.connectionMode===qe.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!s||!i)return(l=e.onError)==null||l.call(e,"008",me.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||K.Bottom,c=(i==null?void 0:i.position)||K.Top,d=Re(t,s,a),u=Re(n,i,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function fo(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Re(e,t,n=K.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:i,height:a}=t??_e(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case K.Top:return{x:o+i/2,y:s};case K.Right:return{x:o+i,y:s+a/2};case K.Bottom:return{x:o+i/2,y:s+a};case K.Left:return{x:o,y:s+a/2}}}function ho(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function pr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function pf(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const s=new Set;return e.reduce((i,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const d=pr(c,t);s.has(d)||(i.push({id:d,color:c.color||n,...c}),s.add(d))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const ks=1e3,gf=10,Ir={nodeOrigin:[0,0],nodeExtent:at,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},mf={...Ir,checkEquality:!0};function Ar(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function yf(e,t,n){const r=Ar(Ir,n);for(const o of e.values())if(o.parentId)Lr(o,e,t,r);else{const s=ht(o,r.nodeOrigin),i=Xe(o.extent)?o.extent:r.nodeExtent,a=Oe(s,i,_e(o));o.internals.positionAbsolute=a}}function wf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const s={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(s):o.type==="target"&&r.push(s)}return{source:n,target:r}}function Tr(e){return e==="manual"}function gr(e,t,n,r={}){var d,u;const o=Ar(mf,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Tr(o.zIndexMode)?ks:0;let c=e.length>0;t.clear(),n.clear();for(const l of e){let f=i.get(l.id);if(o.checkEquality&&l===(f==null?void 0:f.internals.userNode))t.set(l.id,f);else{const h=ht(l,o.nodeOrigin),p=Xe(l.extent)?l.extent:o.nodeExtent,x=Oe(h,p,_e(l));f={...o.defaults,...l,measured:{width:(d=l.measured)==null?void 0:d.width,height:(u=l.measured)==null?void 0:u.height},internals:{positionAbsolute:x,handleBounds:wf(l,f),z:Ms(l,a,o.zIndexMode),userNode:l}},t.set(l.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),l.parentId&&Lr(f,t,n,r,s)}return c}function xf(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Lr(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Ar(Ir,r),d=e.parentId,u=t.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}xf(e,n),o&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++o.i,u.internals.z=u.internals.z+o.i*gf),o&&u.internals.rootParentIndex!==void 0&&(o.i=u.internals.rootParentIndex);const l=s&&!Tr(c)?ks:0,{x:f,y:h,z:p}=vf(e,u,i,a,l,c),{positionAbsolute:x}=e.internals,m=f!==x.x||h!==x.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:x,z:p}})}function Ms(e,t,n){const r=fe(e.zIndex)?e.zIndex:0;return Tr(n)?r:r+(e.selected?t:0)}function vf(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=_e(e),d=ht(e,n),u=Xe(e.extent)?Oe(d,e.extent,c):d;let l=Oe({x:i+u.x,y:a+u.y},r,c);e.extent==="parent"&&(l=ms(l,c,t));const f=Ms(e,o,s),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function Pr(e,t,n,r=[0,0]){var i;const o=[],s=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const d=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??Ge(c),u=ws(d,a.rect);s.set(a.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},d)=>{var g;const u=c.internals.positionAbsolute,l=_e(c),f=c.origin??r,h=a.x<u.x?Math.round(Math.abs(u.x-a.x)):0,p=a.y<u.y?Math.round(Math.abs(u.y-a.y)):0,x=Math.max(l.width,Math.round(a.width)),m=Math.max(l.height,Math.round(a.height)),y=(x-l.width)*f[0],v=(m-l.height)*f[1];(h>0||p>0||y||v)&&(o.push({id:d,type:"position",position:{x:c.position.x-h+y,y:c.position.y-p+v}}),(g=n.get(d))==null||g.forEach(w=>{e.some(C=>C.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+p}})})),(l.width<a.width||l.height<a.height||h||p)&&o.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-y:0),height:m+(p?f[1]*p-v:0)}})}),o}function bf(e,t,n,r,o,s,i){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const p=t.get(h.id);if(!p)continue;if(p.hidden){t.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const x=kr(h.nodeElement),m=p.measured.width!==x.width||p.measured.height!==x.height;if(!!(x.width&&x.height&&(m||!p.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),g=Xe(p.extent)?p.extent:s;let{positionAbsolute:w}=p.internals;p.parentId&&p.extent==="parent"?w=ms(w,x,t.get(p.parentId)):g&&(w=Oe(w,g,x));const C={...p,measured:x,internals:{...p.internals,positionAbsolute:w,handleBounds:{source:so("source",h.nodeElement,v,l,p.id),target:so("target",h.nodeElement,v,l,p.id)}}};t.set(p.id,C),p.parentId&&Lr(C,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,m&&(d.push({id:p.id,type:"dimensions",dimensions:x}),p.expandParent&&p.parentId&&f.push({id:p.id,parentId:p.parentId,rect:Ge(C,o)}))}}if(f.length>0){const h=Pr(f,t,n,o);d.push(...h)}return{changes:d,updatedInternals:c}}async function _f({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r),a=!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2]);return Promise.resolve(a)}function po(e,t,n,r,o,s){let i=o;const a=r.get(i)||new Map;r.set(i,a.set(n,t)),i=`${o}-${e}`;const c=r.get(i)||new Map;if(r.set(i,c.set(n,t)),s){i=`${o}-${e}-${s}`;const d=r.get(i)||new Map;r.set(i,d.set(n,t))}}function Is(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:s,sourceHandle:i=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:s,sourceHandle:i,targetHandle:a},d=`${o}-${i}--${s}-${a}`,u=`${s}-${a}--${o}-${i}`;po("source",c,u,e,o,i),po("target",c,d,e,s,a),t.set(r.id,r)}}function As(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:As(n,t):!1}function go(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Ef(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!As(i,e))&&(i.draggable||t&&typeof i.draggable>"u")){const a=e.get(s);a&&o.set(s,{id:s,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 o}function an({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[d,u]of t){const l=(i=n.get(d))==null?void 0:i.internals.userNode;l&&o.push({...l,position:u.position,dragging:r})}if(!e)return[o[0],o];const s=(a=n.get(e))==null?void 0:a.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:o[0],o]}function Nf({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const s={x:n-o.distance.x,y:r-o.distance.y},i=gt(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Sf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,d={x:0,y:0},u=null,l=!1,f=null,h=!1,p=!1,x=null;function m({noDragClassName:v,handleSelector:g,domNode:w,isSelectable:C,nodeId:S,nodeClickDistance:I=0}){f=le(w);function b({x:k,y:D}){const{nodeLookup:_,nodeExtent:P,snapGrid:L,snapToGrid:$,nodeOrigin:R,onNodeDrag:j,onSelectionDrag:F,onError:q,updateNodePositions:H}=t();s={x:k,y:D};let T=!1;const O=a.size>1,z=O&&P?fr(pt(a)):null,B=O&&$?Nf({dragItems:a,snapGrid:L,x:k,y:D}):null;for(const[G,Y]of a){if(!_.has(G))continue;let X={x:k-Y.distance.x,y:D-Y.distance.y};$&&(X=B?{x:Math.round(X.x+B.x),y:Math.round(X.y+B.y)}:gt(X,L));let Z=null;if(O&&P&&!Y.extent&&z){const{positionAbsolute:W}=Y.internals,J=W.x-z.x+P[0][0],ne=W.x+Y.measured.width-z.x2+P[1][0],ee=W.y-z.y+P[0][1],ce=W.y+Y.measured.height-z.y2+P[1][1];Z=[[J,ee],[ne,ce]]}const{position:Q,positionAbsolute:U}=gs({nodeId:G,nextPosition:X,nodeLookup:_,nodeExtent:Z||P,nodeOrigin:R,onError:q});T=T||Y.position.x!==Q.x||Y.position.y!==Q.y,Y.position=Q,Y.internals.positionAbsolute=U}if(p=p||T,!!T&&(H(a,!0),x&&(r||j||!S&&F))){const[G,Y]=an({nodeId:S,dragItems:a,nodeLookup:_});r==null||r(x,a,G,Y),j==null||j(x,G,Y),S||F==null||F(x,Y)}}async function E(){if(!u)return;const{transform:k,panBy:D,autoPanSpeed:_,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[L,$]=ys(d,u,_);(L!==0||$!==0)&&(s.x=(s.x??0)-L/k[2],s.y=(s.y??0)-$/k[2],await D({x:L,y:$})&&b(s)),i=requestAnimationFrame(E)}function A(k){var O;const{nodeLookup:D,multiSelectionActive:_,nodesDraggable:P,transform:L,snapGrid:$,snapToGrid:R,selectNodesOnDrag:j,onNodeDragStart:F,onSelectionDragStart:q,unselectNodesAndEdges:H}=t();l=!0,(!j||!C)&&!_&&S&&((O=D.get(S))!=null&&O.selected||H()),C&&j&&S&&(e==null||e(S));const T=ot(k.sourceEvent,{transform:L,snapGrid:$,snapToGrid:R,containerBounds:u});if(s=T,a=Ef(D,P,T,S),a.size>0&&(n||F||!S&&q)){const[z,B]=an({nodeId:S,dragItems:a,nodeLookup:D});n==null||n(k.sourceEvent,a,z,B),F==null||F(k.sourceEvent,z,B),S||q==null||q(k.sourceEvent,B)}}const N=Qi().clickDistance(I).on("start",k=>{const{domNode:D,nodeDragThreshold:_,transform:P,snapGrid:L,snapToGrid:$}=t();u=(D==null?void 0:D.getBoundingClientRect())||null,h=!1,p=!1,x=k.sourceEvent,_===0&&A(k),s=ot(k.sourceEvent,{transform:P,snapGrid:L,snapToGrid:$,containerBounds:u}),d=he(k.sourceEvent,u)}).on("drag",k=>{const{autoPanOnNodeDrag:D,transform:_,snapGrid:P,snapToGrid:L,nodeDragThreshold:$,nodeLookup:R}=t(),j=ot(k.sourceEvent,{transform:_,snapGrid:P,snapToGrid:L,containerBounds:u});if(x=k.sourceEvent,(k.sourceEvent.type==="touchmove"&&k.sourceEvent.touches.length>1||S&&!R.has(S))&&(h=!0),!h){if(!c&&D&&l&&(c=!0,E()),!l){const F=he(k.sourceEvent,u),q=F.x-d.x,H=F.y-d.y;Math.sqrt(q*q+H*H)>$&&A(k)}(s.x!==j.xSnapped||s.y!==j.ySnapped)&&a&&l&&(d=he(k.sourceEvent,u),b(j))}}).on("end",k=>{if(!(!l||h)&&(c=!1,l=!1,cancelAnimationFrame(i),a.size>0)){const{nodeLookup:D,updateNodePositions:_,onNodeDragStop:P,onSelectionDragStop:L}=t();if(p&&(_(a,!1),p=!1),o||P||!S&&L){const[$,R]=an({nodeId:S,dragItems:a,nodeLookup:D,dragging:!1});o==null||o(k.sourceEvent,a,$,R),P==null||P(k.sourceEvent,$,R),S||L==null||L(k.sourceEvent,R)}}}).filter(k=>{const D=k.target;return!k.button&&(!v||!go(D,`.${v}`,w))&&(!g||go(D,g,w))});f.call(N)}function y(){f==null||f.on(".drag",null)}return{update:m,destroy:y}}function Cf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())lt(o,Ge(s))>0&&r.push(s);return r}const kf=250;function Mf(e,t,n,r){var a,c;let o=[],s=1/0;const i=Cf(e,n,t+kf);for(const d of i){const u=[...((a=d.internals.handleBounds)==null?void 0:a.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of u){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=Re(d,l,l.position,!0),p=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));p>t||(p<s?(o=[{...l,x:f,y:h}],s=p):p===s&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const d=r.type==="source"?"target":"source";return o.find(u=>u.type===d)??o[0]}return o[0]}function Ts(e,t,n,r,o,s=!1){var d,u,l;const i=r.get(e);if(!i)return null;const a=o==="strict"?(d=i.internals.handleBounds)==null?void 0:d[t]:[...((u=i.internals.handleBounds)==null?void 0:u.source)??[],...((l=i.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...Re(i,c,c.position,!0)}:c}function Ls(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function If(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ps=()=>!0;function Af(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:l,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:x,onConnectEnd:m,isValidConnection:y=Ps,onReconnectEnd:v,updateConnection:g,getTransform:w,getFromHandle:C,autoPanSpeed:S,dragThreshold:I=1,handleDomNode:b}){const E=bs(e.target);let A=0,N;const{x:k,y:D}=he(e),_=Ls(s,b),P=a==null?void 0:a.getBoundingClientRect();let L=!1;if(!P||!_)return;const $=Ts(o,_,r,c,t);if(!$)return;let R=he(e,P),j=!1,F=null,q=!1,H=null;function T(){if(!u||!P)return;const[Q,U]=ys(R,P,S);f({x:Q,y:U}),A=requestAnimationFrame(T)}const O={...$,nodeId:o,type:_,position:$.position},z=c.get(o);let G={inProgress:!0,isValid:null,from:Re(z,O,K.Left,!0),fromHandle:O,fromPosition:O.position,fromNode:z,to:R,toHandle:null,toPosition:no[O.position],toNode:null,pointer:R};function Y(){L=!0,g(G),p==null||p(e,{nodeId:o,handleId:r,handleType:_})}I===0&&Y();function X(Q){if(!L){const{x:ce,y:Ee}=he(Q),we=ce-k,Ie=Ee-D;if(!(we*we+Ie*Ie>I*I))return;Y()}if(!C()||!O){Z(Q);return}const U=w();R=he(Q,P),N=Mf(mt(R,U,!1,[1,1]),n,c,O),j||(T(),j=!0);const W=js(Q,{handle:N,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:y,doc:E,lib:d,flowId:l,nodeLookup:c});H=W.handleDomNode,F=W.connection,q=If(!!N,W.isValid);const J=c.get(o),ne=J?Re(J,O,K.Left,!0):G.from,ee={...G,from:ne,isValid:q,to:W.toHandle&&q?Vt({x:W.toHandle.x,y:W.toHandle.y},U):R,toHandle:W.toHandle,toPosition:q&&W.toHandle?W.toHandle.position:no[O.position],toNode:W.toHandle?c.get(W.toHandle.nodeId):null,pointer:R};g(ee),G=ee}function Z(Q){if(!("touches"in Q&&Q.touches.length>0)){if(L){(N||H)&&F&&q&&(x==null||x(F));const{inProgress:U,...W}=G,J={...W,toPosition:G.toHandle?G.toPosition:null};m==null||m(Q,J),s&&(v==null||v(Q,J))}h(),cancelAnimationFrame(A),j=!1,q=!1,F=null,H=null,E.removeEventListener("mousemove",X),E.removeEventListener("mouseup",Z),E.removeEventListener("touchmove",X),E.removeEventListener("touchend",Z)}}E.addEventListener("mousemove",X),E.addEventListener("mouseup",Z),E.addEventListener("touchmove",X),E.addEventListener("touchend",Z)}function js(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:d=Ps,nodeLookup:u}){const l=s==="target",f=t?i.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:p}=he(e),x=i.elementFromPoint(h,p),m=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const v=Ls(void 0,m),g=m.getAttribute("data-nodeid"),w=m.getAttribute("data-handleid"),C=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!g||!v)return y;const I={source:l?g:r,sourceHandle:l?w:o,target:l?r:g,targetHandle:l?o:w};y.connection=I;const E=C&&S&&(n===qe.Strict?l&&v==="source"||!l&&v==="target":g!==r||w!==o);y.isValid=E&&d(I),y.toHandle=Ts(g,v,w,u,n,!0)}return y}const mr={onPointerDown:Af,isValid:js};function Tf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=le(e);function s({translateExtent:a,width:c,height:d,zoomStep:u=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const p=g=>{if(g.sourceEvent.type!=="wheel"||!t)return;const w=n(),C=g.sourceEvent.ctrlKey&&ut()?10:1,S=-g.sourceEvent.deltaY*(g.sourceEvent.deltaMode===1?.05:g.sourceEvent.deltaMode?1:.002)*u,I=w[2]*Math.pow(2,S*C);t.scaleTo(I)};let x=[0,0];const m=g=>{(g.sourceEvent.type==="mousedown"||g.sourceEvent.type==="touchstart")&&(x=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY])},y=g=>{const w=n();if(g.sourceEvent.type!=="mousemove"&&g.sourceEvent.type!=="touchmove"||!t)return;const C=[g.sourceEvent.clientX??g.sourceEvent.touches[0].clientX,g.sourceEvent.clientY??g.sourceEvent.touches[0].clientY],S=[C[0]-x[0],C[1]-x[1]];x=C;const I=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),b={x:w[0]-S[0]*I,y:w[1]-S[1]*I},E=[[0,0],[c,d]];t.setViewportConstrained({x:b.x,y:b.y,zoom:w[2]},E,a)},v=ls().on("start",m).on("zoom",l?y:null).on("zoom.wheel",f?p:null);o.call(v,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:de}}const Kt=e=>({x:e.x,y:e.y,zoom:e.k}),cn=({x:e,y:t,zoom:n})=>Xt.translate(e,t).scale(n),ze=(e,t)=>e.target.closest(`.${t}`),Os=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Lf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ln=(e,t=0,n=Lf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Rs=e=>{const t=e.ctrlKey&&ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Pf({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(ze(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(u.ctrlKey&&i){const m=de(u),y=Rs(u),v=l*Math.pow(2,y);r.scaleTo(n,v,m,u);return}const f=u.deltaMode===1?20:1;let h=o===Pe.Vertical?0:u.deltaX*f,p=o===Pe.Horizontal?0:u.deltaY*f;!ut()&&u.shiftKey&&o!==Pe.Vertical&&(h=u.deltaY*f,p=0),r.translateBy(n,-(h/l)*s,-(p/l)*s,{internal:!0});const x=Kt(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,x),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(u,x))}}function jf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=ze(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function Of({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=Kt(r.transform);e.mouseButton=((i=r.sourceEvent)==null?void 0:i.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function Rf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&Os(t,e.mouseButton??0)),(i=s.sourceEvent)!=null&&i.sync||r([s.transform.x,s.transform.y,s.transform.k]),o&&!((a=s.sourceEvent)!=null&&a.internal)&&(o==null||o(s.sourceEvent,Kt(s.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:s}){return i=>{var a;if(!((a=i.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,s&&Os(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=Kt(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function $f({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:d,connectionInProgress:u}){return l=>{var m;const f=e||t,h=n&&l.ctrlKey,p=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(ze(l,`${d}-flow__node`)||ze(l,`${d}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||u&&!p||ze(l,a)&&p||ze(l,c)&&(!p||o&&p&&!e)||!n&&l.ctrlKey&&p)return!1;if(!n&&l.type==="touchstart"&&((m=l.touches)==null?void 0:m.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&p||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||p)&&x}}function zf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),l=ls().scaleExtent([t,n]).translateExtent(r),f=le(e).call(l);v({x:o.x,y:o.y,zoom:Ye(o.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=f.on("wheel.zoom"),p=f.on("dblclick.zoom");l.wheelDelta(Rs);function x(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).transform(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function m({noWheelClassName:N,noPanClassName:k,onPaneContextMenu:D,userSelectionActive:_,panOnScroll:P,panOnDrag:L,panOnScrollMode:$,panOnScrollSpeed:R,preventScrolling:j,zoomOnPinch:F,zoomOnScroll:q,zoomOnDoubleClick:H,zoomActivationKeyPressed:T,lib:O,onTransformChange:z,connectionInProgress:B,paneClickDistance:G,selectionOnDrag:Y}){_&&!d.isZoomingOrPanning&&y();const X=P&&!T&&!_;l.clickDistance(Y?1/0:!fe(G)||G<0?0:G);const Z=X?Pf({zoomPanValues:d,noWheelClassName:N,d3Selection:f,d3Zoom:l,panOnScrollMode:$,panOnScrollSpeed:R,zoomOnPinch:F,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):jf({noWheelClassName:N,preventScrolling:j,d3ZoomHandler:h});if(f.on("wheel.zoom",Z,{passive:!1}),!_){const U=Of({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:i});l.on("start",U);const W=Rf({zoomPanValues:d,panOnDrag:L,onPaneContextMenu:!!D,onPanZoom:s,onTransformChange:z});l.on("zoom",W);const J=Df({zoomPanValues:d,panOnDrag:L,panOnScroll:P,onPaneContextMenu:D,onPanZoomEnd:a,onDraggingChange:c});l.on("end",J)}const Q=$f({zoomActivationKeyPressed:T,panOnDrag:L,zoomOnScroll:q,panOnScroll:P,zoomOnDoubleClick:H,zoomOnPinch:F,userSelectionActive:_,noPanClassName:k,noWheelClassName:N,lib:O,connectionInProgress:B});l.filter(Q),H?f.on("dblclick.zoom",p):f.on("dblclick.zoom",null)}function y(){l.on("zoom",null)}async function v(N,k,D){const _=cn(N),P=l==null?void 0:l.constrain()(_,k,D);return P&&await x(P),new Promise(L=>L(P))}async function g(N,k){const D=cn(N);return await x(D,k),new Promise(_=>_(D))}function w(N){if(f){const k=cn(N),D=f.property("__zoom");(D.k!==N.zoom||D.x!==N.x||D.y!==N.y)&&(l==null||l.transform(f,k,null,{sync:!0}))}}function C(){const N=f?cs(f.node()):{x:0,y:0,k:1};return{x:N.x,y:N.y,zoom:N.k}}function S(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleTo(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function I(N,k){return f?new Promise(D=>{l==null||l.interpolate((k==null?void 0:k.interpolate)==="linear"?rn:It).scaleBy(ln(f,k==null?void 0:k.duration,k==null?void 0:k.ease,()=>D(!0)),N)}):Promise.resolve(!1)}function b(N){l==null||l.scaleExtent(N)}function E(N){l==null||l.translateExtent(N)}function A(N){const k=!fe(N)||N<0?0:N;l==null||l.clickDistance(k)}return{update:m,destroy:y,setViewport:g,setViewportConstrained:v,getViewport:C,scaleTo:S,scaleBy:I,setScaleExtent:b,setTranslateExtent:E,syncViewport:w,setClickDistance:A}}var We;(function(e){e.Line="line",e.Handle="handle"})(We||(We={}));function Vf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:s}){const i=e-t,a=n-r,c=[i>0?1:i<0?-1:0,a>0?1:a<0?-1:0];return i&&o&&(c[0]=c[0]*-1),a&&s&&(c[1]=c[1]*-1),c}function mo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ne(e,t){return Math.max(0,t-e)}function Se(e,t){return Math.max(0,e-t)}function Nt(e,t,n){return Math.max(0,t-e,e-n)}function yo(e,t){return e?!t:t}function Ff(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:l}=t,f=u&&l,{xSnapped:h,ySnapped:p}=n,{minWidth:x,maxWidth:m,minHeight:y,maxHeight:v}=r,{x:g,y:w,width:C,height:S,aspectRatio:I}=e;let b=Math.floor(u?h-e.pointerX:0),E=Math.floor(l?p-e.pointerY:0);const A=C+(c?-b:b),N=S+(d?-E:E),k=-s[0]*C,D=-s[1]*S;let _=Nt(A,x,m),P=Nt(N,y,v);if(i){let R=0,j=0;c&&b<0?R=Ne(g+b+k,i[0][0]):!c&&b>0&&(R=Se(g+A+k,i[1][0])),d&&E<0?j=Ne(w+E+D,i[0][1]):!d&&E>0&&(j=Se(w+N+D,i[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(a){let R=0,j=0;c&&b>0?R=Se(g+b,a[0][0]):!c&&b<0&&(R=Ne(g+A,a[1][0])),d&&E>0?j=Se(w+E,a[0][1]):!d&&E<0&&(j=Ne(w+N,a[1][1])),_=Math.max(_,R),P=Math.max(P,j)}if(o){if(u){const R=Nt(A/I,y,v)*I;if(_=Math.max(_,R),i){let j=0;!c&&!d||c&&!d&&f?j=Se(w+D+A/I,i[1][1])*I:j=Ne(w+D+(c?b:-b)/I,i[0][1])*I,_=Math.max(_,j)}if(a){let j=0;!c&&!d||c&&!d&&f?j=Ne(w+A/I,a[1][1])*I:j=Se(w+(c?b:-b)/I,a[0][1])*I,_=Math.max(_,j)}}if(l){const R=Nt(N*I,x,m)/I;if(P=Math.max(P,R),i){let j=0;!c&&!d||d&&!c&&f?j=Se(g+N*I+k,i[1][0])/I:j=Ne(g+(d?E:-E)*I+k,i[0][0])/I,P=Math.max(P,j)}if(a){let j=0;!c&&!d||d&&!c&&f?j=Ne(g+N*I,a[1][0])/I:j=Se(g+(d?E:-E)*I,a[0][0])/I,P=Math.max(P,j)}}}E=E+(E<0?P:-P),b=b+(b<0?_:-_),o&&(f?A>N*I?E=(yo(c,d)?-b:b)/I:b=(yo(c,d)?-E:E)*I:u?(E=b/I,d=c):(b=E*I,c=d));const L=c?g+b:g,$=d?w+E:w;return{width:C+(c?-b:b),height:S+(d?-E:E),x:s[0]*b*(c?-1:1)+L,y:s[1]*E*(d?-1:1)+$}}const Ds={width:0,height:0,x:0,y:0},Hf={...Ds,pointerX:0,pointerY:0,aspectRatio:1};function Bf(e){return[[0,0],[e.measured.width,e.measured.height]]}function qf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,s=e.measured.width??0,i=e.measured.height??0,a=n[0]*s,c=n[1]*i;return[[r-a,o-c],[r+s-a,o+i-c]]}function Yf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=le(e);let i={controlDirection:mo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:d,boundaries:u,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:p,onResizeEnd:x,shouldResize:m}){let y={...Ds},v={...Hf};i={boundaries:u,resizeDirection:f,keepAspectRatio:l,controlDirection:mo(d)};let g,w=null,C=[],S,I,b,E=!1;const A=Qi().on("start",N=>{const{nodeLookup:k,transform:D,snapGrid:_,snapToGrid:P,nodeOrigin:L,paneDomNode:$}=n();if(g=k.get(t),!g)return;w=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:j}=ot(N.sourceEvent,{transform:D,snapGrid:_,snapToGrid:P,containerBounds:w});y={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},v={...y,pointerX:R,pointerY:j,aspectRatio:y.width/y.height},S=void 0,g.parentId&&(g.extent==="parent"||g.expandParent)&&(S=k.get(g.parentId),I=S&&g.extent==="parent"?Bf(S):void 0),C=[],b=void 0;for(const[F,q]of k)if(q.parentId===t&&(C.push({id:F,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const H=qf(q,g,q.origin??L);b?b=[[Math.min(H[0][0],b[0][0]),Math.min(H[0][1],b[0][1])],[Math.max(H[1][0],b[1][0]),Math.max(H[1][1],b[1][1])]]:b=H}h==null||h(N,{...y})}).on("drag",N=>{const{transform:k,snapGrid:D,snapToGrid:_,nodeOrigin:P}=n(),L=ot(N.sourceEvent,{transform:k,snapGrid:D,snapToGrid:_,containerBounds:w}),$=[];if(!g)return;const{x:R,y:j,width:F,height:q}=y,H={},T=g.origin??P,{width:O,height:z,x:B,y:G}=Ff(v,i.controlDirection,L,i.boundaries,i.keepAspectRatio,T,I,b),Y=O!==F,X=z!==q,Z=B!==R&&Y,Q=G!==j&&X;if(!Z&&!Q&&!Y&&!X)return;if((Z||Q||T[0]===1||T[1]===1)&&(H.x=Z?B:y.x,H.y=Q?G:y.y,y.x=H.x,y.y=H.y,C.length>0)){const ne=B-R,ee=G-j;for(const ce of C)ce.position={x:ce.position.x-ne+T[0]*(O-F),y:ce.position.y-ee+T[1]*(z-q)},$.push(ce)}if((Y||X)&&(H.width=Y&&(!i.resizeDirection||i.resizeDirection==="horizontal")?O:y.width,H.height=X&&(!i.resizeDirection||i.resizeDirection==="vertical")?z:y.height,y.width=H.width,y.height=H.height),S&&g.expandParent){const ne=T[0]*(H.width??0);H.x&&H.x<ne&&(y.x=ne,v.x=v.x-(H.x-ne));const ee=T[1]*(H.height??0);H.y&&H.y<ee&&(y.y=ee,v.y=v.y-(H.y-ee))}const U=Vf({width:y.width,prevWidth:F,height:y.height,prevHeight:q,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),W={...y,direction:U};(m==null?void 0:m(N,W))!==!1&&(E=!0,p==null||p(N,W),r(H,$))}).on("end",N=>{E&&(x==null||x(N,{...y}),o==null||o({...y}),E=!1)});s.call(A)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}const Gf={},wo=e=>{let t;const n=new Set,r=(u,l)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=l??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(p=>p(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Gf?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,o,c);return c},Xf=e=>e?wo(e):wo,{useDebugValue:Wf}=Ac,{useSyncExternalStoreWithSelector:Uf}=Pc,Kf=e=>e;function $s(e,t=Kf,n){const r=Uf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Wf(r),r}const xo=(e,t)=>{const n=Xf(e),r=(o,s=t)=>$s(n,o,s);return Object.assign(r,n),r},Zf=(e,t)=>e?xo(e,t):xo;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Zt=V.createContext(null),Qf=Zt.Provider,zs=me.error001();function te(e,t){const n=V.useContext(Zt);if(n===null)throw new Error(zs);return $s(n,e,t)}function oe(){const e=V.useContext(Zt);if(e===null)throw new Error(zs);return V.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const vo={display:"none"},Jf={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Vs="react-flow__node-desc",Fs="react-flow__edge-desc",eh="react-flow__aria-live",th=e=>e.ariaLiveMessage,nh=e=>e.ariaLabelConfig;function rh({rfId:e}){const t=te(th);return M.jsx("div",{id:`${eh}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Jf,children:t})}function oh({rfId:e,disableKeyboardA11y:t}){const n=te(nh);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${Vs}-${e}`,style:vo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${Fs}-${e}`,style:vo,children:n["edge.a11yDescription.default"]}),!t&&M.jsx(rh,{rfId:e})]})}const Qt=V.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return M.jsx("div",{className:ae(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});Qt.displayName="Panel";function ih({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:M.jsx(Qt,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const sh=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},St=e=>e.id;function ah(e,t){return re(e.selectedNodes.map(St),t.selectedNodes.map(St))&&re(e.selectedEdges.map(St),t.selectedEdges.map(St))}function ch({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=te(sh,ah);return V.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const lh=e=>!!e.onSelectionChangeHandlers;function uh({onSelectionChange:e}){const t=te(lh);return e||t?M.jsx(ch,{onSelectionChange:e}):null}const Hs=[0,0],dh={x:0,y:0,zoom:1},fh=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],bo=[...fh,"rfId"],hh=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),_o={translateExtent:at,nodeOrigin:Hs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ph(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=te(hh,re),d=oe();V.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=_o,a()}),[]);const u=V.useRef(_o);return V.useEffect(()=>{for(const l of bo){const f=e[l],h=u.current[l];f!==h&&(typeof e[l]>"u"||(l==="nodes"?t(f):l==="edges"?n(f):l==="minZoom"?r(f):l==="maxZoom"?o(f):l==="translateExtent"?s(f):l==="nodeExtent"?i(f):l==="ariaLabelConfig"?d.setState({ariaLabelConfig:nf(f)}):l==="fitView"?d.setState({fitViewQueued:f}):l==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[l]:f})))}u.current=e},bo.map(l=>e[l])),null}function Eo(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function gh(e){var r;const[t,n]=V.useState(e==="system"?null:e);return V.useEffect(()=>{if(e!=="system"){n(e);return}const o=Eo(),s=()=>n(o!=null&&o.matches?"dark":"light");return s(),o==null||o.addEventListener("change",s),()=>{o==null||o.removeEventListener("change",s)}},[e]),t!==null?t:(r=Eo())!=null&&r.matches?"dark":"light"}const No=typeof document<"u"?document:null;function dt(e=null,t={target:No,actInsideInputWithModifier:!0}){const[n,r]=V.useState(!1),o=V.useRef(!1),s=V.useRef(new Set([])),[i,a]=V.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(l=>typeof l=="string").map(l=>l.replace("+",`
|
|
2
|
+
`).replace(`
|
|
3
|
+
|
|
4
|
+
`,`
|
|
5
|
+
+`).split(`
|
|
6
|
+
`)),u=d.reduce((l,f)=>l.concat(...f),[]);return[d,u]}return[[],[]]},[e]);return V.useEffect(()=>{const c=(t==null?void 0:t.target)??No,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var m,y;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!d)&&_s(h))return!1;const x=Co(h.code,a);if(s.current.add(h[x]),So(i,s.current,!1)){const v=((y=(m=h.composedPath)==null?void 0:m.call(h))==null?void 0:y[0])||h.target,g=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(o.current||!g)&&h.preventDefault(),r(!0)}},l=h=>{const p=Co(h.code,a);So(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[p]),h.key==="Meta"&&s.current.clear(),o.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",l),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",l),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function So(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Co(e,t){return t.includes(e)?"code":"key"}const mh=()=>{const e=oe();return V.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,s],panZoom:i}=e.getState();return i?(await i.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??s},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:s,maxZoom:i,panZoom:a}=e.getState(),c=Cr(t,r,o,s,i,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{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:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:s,domNode:i}=e.getState();if(!i)return t;const{x:a,y:c}=i.getBoundingClientRect(),d={x:t.x-a,y:t.y-c},u=n.snapGrid??o,l=n.snapToGrid??s;return mt(d,r,l,u)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:s}=r.getBoundingClientRect(),i=Vt(t,n);return{x:i.x+o,y:i.y+s}}}),[])};function Bs(e,t){const n=[],r=new Map,o=[];for(const s of e)if(s.type==="add"){o.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const i=r.get(s.id);i?i.push(s):r.set(s.id,[s])}for(const s of t){const i=r.get(s.id);if(!i){n.push(s);continue}if(i[0].type==="remove")continue;if(i[0].type==="replace"){n.push({...i[0].item});continue}const a={...s};for(const c of i)yh(c,a);n.push(a)}return o.length&&o.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function yh(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function qs(e,t){return Bs(e,t)}function Ys(e,t){return Bs(e,t)}function Le(e,t){return{id:e,type:"select",selected:t}}function Ve(e,t=new Set,n=!1){const r=[];for(const[o,s]of e){const i=t.has(o);!(s.selected===void 0&&!i)&&s.selected!==i&&(n&&(s.selected=i),r.push(Le(s.id,i)))}return r}function ko({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,i]of e.entries()){const a=t.get(i.id),c=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;c!==void 0&&c!==i&&n.push({id:i.id,item:i,type:"replace"}),c===void 0&&n.push({item:i,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Mo(e){return{id:e.id,type:"remove"}}const Io=e=>Gd(e),wh=e=>ps(e);function Gs(e){return V.forwardRef(e)}const xh=typeof window<"u"?V.useLayoutEffect:V.useEffect;function Ao(e){const[t,n]=V.useState(BigInt(0)),[r]=V.useState(()=>vh(()=>n(o=>o+BigInt(1))));return xh(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function vh(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Xs=V.createContext(null);function bh({children:e}){const t=oe(),n=V.useCallback(a=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:l,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:p}=t.getState();let x=c;for(const y of a)x=typeof y=="function"?y(x):y;let m=ko({items:x,lookup:f});for(const y of p.values())m=y(m);u&&d(x),m.length>0?l==null||l(m):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:g}=t.getState();y&&g(v)})},[]),r=Ao(n),o=V.useCallback(a=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:l,edgeLookup:f}=t.getState();let h=c;for(const p of a)h=typeof p=="function"?p(h):p;u?d(h):l&&l(ko({items:h,lookup:f}))},[]),s=Ao(o),i=V.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return M.jsx(Xs.Provider,{value:i,children:e})}function _h(){const e=V.useContext(Xs);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const Eh=e=>!!e.panZoom;function jr(){const e=mh(),t=oe(),n=_h(),r=te(Eh),o=V.useMemo(()=>{const s=l=>t.getState().nodeLookup.get(l),i=l=>{n.nodeQueue.push(l)},a=l=>{n.edgeQueue.push(l)},c=l=>{var y,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),p=Io(l)?l:f.get(l.id),x=p.parentId?vs(p.position,p.measured,p.parentId,f,h):p.position,m={...p,position:x,width:((y=p.measured)==null?void 0:y.width)??p.width,height:((v=p.measured)==null?void 0:v.height)??p.height};return Ge(m)},d=(l,f,h={replace:!1})=>{i(p=>p.map(x=>{if(x.id===l){const m=typeof f=="function"?f(x):f;return h.replace&&Io(m)?m:{...x,...m}}return x}))},u=(l,f,h={replace:!1})=>{a(p=>p.map(x=>{if(x.id===l){const m=typeof f=="function"?f(x):f;return h.replace&&wh(m)?m:{...x,...m}}return x}))};return{getNodes:()=>t.getState().nodes.map(l=>({...l})),getNode:l=>{var f;return(f=s(l))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:l=[]}=t.getState();return l.map(f=>({...f}))},getEdge:l=>t.getState().edgeLookup.get(l),setNodes:i,setEdges:a,addNodes:l=>{const f=Array.isArray(l)?l:[l];n.nodeQueue.push(h=>[...h,...f])},addEdges:l=>{const f=Array.isArray(l)?l:[l];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:l=[],edges:f=[],transform:h}=t.getState(),[p,x,m]=h;return{nodes:l.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:p,y:x,zoom:m}}},deleteElements:async({nodes:l=[],edges:f=[]})=>{const{nodes:h,edges:p,onNodesDelete:x,onEdgesDelete:m,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:g,onBeforeDelete:w}=t.getState(),{nodes:C,edges:S}=await Zd({nodesToRemove:l,edgesToRemove:f,nodes:h,edges:p,onBeforeDelete:w}),I=S.length>0,b=C.length>0;if(I){const E=S.map(Mo);m==null||m(S),v(E)}if(b){const E=C.map(Mo);x==null||x(C),y(E)}return(b||I)&&(g==null||g({nodes:C,edges:S})),{deletedNodes:C,deletedEdges:S}},getIntersectingNodes:(l,f=!0,h)=>{const p=oo(l),x=p?l:c(l),m=h!==void 0;return x?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!p&&(y.id===l.id||!v.internals.positionAbsolute))return!1;const g=Ge(m?y:v),w=lt(g,x);return f&&w>0||w>=g.width*g.height||w>=x.width*x.height}):[]},isNodeIntersecting:(l,f,h=!0)=>{const x=oo(l)?l:c(l);if(!x)return!1;const m=lt(x,f);return h&&m>0||m>=f.width*f.height||m>=x.width*x.height},updateNode:d,updateNodeData:(l,f,h={replace:!1})=>{d(l,p=>{const x=typeof f=="function"?f(p):f;return h.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},h)},updateEdge:u,updateEdgeData:(l,f,h={replace:!1})=>{u(l,p=>{const x=typeof f=="function"?f(p):f;return h.replace?{...p,data:x}:{...p,data:{...p.data,...x}}},h)},getNodesBounds:l=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return Xd(l,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:l,id:f,nodeId:h})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${h}-${l}${f?`-${f}`:""}`))==null?void 0:p.values())??[])},getNodeConnections:({type:l,handleId:f,nodeId:h})=>{var p;return Array.from(((p=t.getState().connectionLookup.get(`${h}${l?f?`-${l}-${f}`:`-${l}`:""}`))==null?void 0:p.values())??[])},fitView:async l=>{const f=t.getState().fitViewResolver??tf();return t.setState({fitViewQueued:!0,fitViewOptions:l,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return V.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const To=e=>e.selected,Nh=typeof window<"u"?window:void 0;function Sh({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=oe(),{deleteElements:r}=jr(),o=dt(e,{actInsideInputWithModifier:!1}),s=dt(t,{target:Nh});V.useEffect(()=>{if(o){const{edges:i,nodes:a}=n.getState();r({nodes:a.filter(To),edges:i.filter(To)}),n.setState({nodesSelectionActive:!1})}},[o]),V.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function Ch(e){const t=oe();V.useEffect(()=>{const n=()=>{var o,s,i,a;if(!e.current||!(((s=(o=e.current).checkVisibility)==null?void 0:s.call(o))??!0))return!1;const r=kr(e.current);(r.height===0||r.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",me.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Jt={position:"absolute",width:"100%",height:"100%",top:0,left:0},kh=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Mh({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=Pe.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:l,zoomActivationKeyCode:f,preventScrolling:h=!0,children:p,noWheelClassName:x,noPanClassName:m,onViewportChange:y,isControlledViewport:v,paneClickDistance:g,selectionOnDrag:w}){const C=oe(),S=V.useRef(null),{userSelectionActive:I,lib:b,connectionInProgress:E}=te(kh,re),A=dt(f),N=V.useRef();Ch(S);const k=V.useCallback(D=>{y==null||y({x:D[0],y:D[1],zoom:D[2]}),v||C.setState({transform:D})},[y,v]);return V.useEffect(()=>{if(S.current){N.current=zf({domNode:S.current,minZoom:u,maxZoom:l,translateExtent:d,viewport:c,onDraggingChange:L=>C.setState($=>$.paneDragging===L?$:{paneDragging:L}),onPanZoomStart:(L,$)=>{const{onViewportChangeStart:R,onMoveStart:j}=C.getState();j==null||j(L,$),R==null||R($)},onPanZoom:(L,$)=>{const{onViewportChange:R,onMove:j}=C.getState();j==null||j(L,$),R==null||R($)},onPanZoomEnd:(L,$)=>{const{onViewportChangeEnd:R,onMoveEnd:j}=C.getState();j==null||j(L,$),R==null||R($)}});const{x:D,y:_,zoom:P}=N.current.getViewport();return C.setState({panZoom:N.current,transform:[D,_,P],domNode:S.current.closest(".react-flow")}),()=>{var L;(L=N.current)==null||L.destroy()}}},[]),V.useEffect(()=>{var D;(D=N.current)==null||D.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:A,preventScrolling:h,noPanClassName:m,userSelectionActive:I,noWheelClassName:x,lib:b,onTransformChange:k,connectionInProgress:E,selectionOnDrag:w,paneClickDistance:g})},[e,t,n,r,o,s,i,a,A,h,m,I,x,b,k,E,w,g]),M.jsx("div",{className:"react-flow__renderer",ref:S,style:Jt,children:p})}const Ih=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Ah(){const{userSelectionActive:e,userSelectionRect:t}=te(Ih,re);return e&&t?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const un=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Th=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Lh({isSelecting:e,selectionKeyPressed:t,selectionMode:n=ct.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:s,onSelectionStart:i,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:l,onPaneMouseMove:f,onPaneMouseLeave:h,children:p}){const x=oe(),{userSelectionActive:m,elementsSelectable:y,dragging:v,connectionInProgress:g}=te(Th,re),w=y&&(e||m),C=V.useRef(null),S=V.useRef(),I=V.useRef(new Set),b=V.useRef(new Set),E=V.useRef(!1),A=R=>{if(E.current||g){E.current=!1;return}c==null||c(R),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},N=R=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){R.preventDefault();return}d==null||d(R)},k=u?R=>u(R):void 0,D=R=>{E.current&&(R.stopPropagation(),E.current=!1)},_=R=>{var z,B;const{domNode:j}=x.getState();if(S.current=j==null?void 0:j.getBoundingClientRect(),!S.current)return;const F=R.target===C.current;if(!F&&!!R.target.closest(".nokey")||!e||!(s&&F||t)||R.button!==0||!R.isPrimary)return;(B=(z=R.target)==null?void 0:z.setPointerCapture)==null||B.call(z,R.pointerId),E.current=!1;const{x:T,y:O}=he(R.nativeEvent,S.current);x.setState({userSelectionRect:{width:0,height:0,startX:T,startY:O,x:T,y:O}}),F||(R.stopPropagation(),R.preventDefault())},P=R=>{const{userSelectionRect:j,transform:F,nodeLookup:q,edgeLookup:H,connectionLookup:T,triggerNodeChanges:O,triggerEdgeChanges:z,defaultEdgeOptions:B,resetSelectedElements:G}=x.getState();if(!S.current||!j)return;const{x:Y,y:X}=he(R.nativeEvent,S.current),{startX:Z,startY:Q}=j;if(!E.current){const ee=t?0:o;if(Math.hypot(Y-Z,X-Q)<=ee)return;G(),i==null||i(R)}E.current=!0;const U={startX:Z,startY:Q,x:Y<Z?Y:Z,y:X<Q?X:Q,width:Math.abs(Y-Z),height:Math.abs(X-Q)},W=I.current,J=b.current;I.current=new Set(Sr(q,U,F,n===ct.Partial,!0).map(ee=>ee.id)),b.current=new Set;const ne=(B==null?void 0:B.selectable)??!0;for(const ee of I.current){const ce=T.get(ee);if(ce)for(const{edgeId:Ee}of ce.values()){const we=H.get(Ee);we&&(we.selectable??ne)&&b.current.add(Ee)}}if(!io(W,I.current)){const ee=Ve(q,I.current,!0);O(ee)}if(!io(J,b.current)){const ee=Ve(H,b.current);z(ee)}x.setState({userSelectionRect:U,userSelectionActive:!0,nodesSelectionActive:!1})},L=R=>{var j,F;R.button===0&&((F=(j=R.target)==null?void 0:j.releasePointerCapture)==null||F.call(j,R.pointerId),!m&&R.target===C.current&&x.getState().userSelectionRect&&(A==null||A(R)),x.setState({userSelectionActive:!1,userSelectionRect:null}),E.current&&(a==null||a(R),x.setState({nodesSelectionActive:I.current.size>0})))},$=r===!0||Array.isArray(r)&&r.includes(0);return M.jsxs("div",{className:ae(["react-flow__pane",{draggable:$,dragging:v,selection:e}]),onClick:w?void 0:un(A,C),onContextMenu:un(N,C),onWheel:un(k,C),onPointerEnter:w?void 0:l,onPointerMove:w?P:f,onPointerUp:w?L:void 0,onPointerDownCapture:w?_:void 0,onClickCapture:w?D:void 0,onPointerLeave:h,ref:C,style:Jt,children:[p,M.jsx(Ah,{})]})}function yr({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:c}=t.getState(),d=a.get(e);if(!d){c==null||c("012",me.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&i)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):o([e])}function Ws({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,nodeClickDistance:i}){const a=oe(),[c,d]=V.useState(!1),u=V.useRef();return V.useEffect(()=>{u.current=Sf({getStoreItems:()=>a.getState(),onNodeMouseDown:l=>{yr({id:l,store:a,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),V.useEffect(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:i}),()=>{var l;(l=u.current)==null||l.destroy()}},[n,r,t,s,e,o,i]),c}const Ph=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Us(){const e=oe();return V.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:c,nodeLookup:d,nodeOrigin:u}=e.getState(),l=new Map,f=Ph(i),h=o?s[0]:5,p=o?s[1]:5,x=n.direction.x*h*n.factor,m=n.direction.y*p*n.factor;for(const[,y]of d){if(!f(y))continue;let v={x:y.internals.positionAbsolute.x+x,y:y.internals.positionAbsolute.y+m};o&&(v=gt(v,s));const{position:g,positionAbsolute:w}=gs({nodeId:y.id,nextPosition:v,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:a});y.position=g,y.internals.positionAbsolute=w,l.set(y.id,y)}c(l)},[])}const Or=V.createContext(null),jh=Or.Provider;Or.Consumer;const Ks=()=>V.useContext(Or),Oh=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),Rh=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:s,connection:i}=r,{fromHandle:a,toHandle:c,isValid:d}=i,u=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:u,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:s===qe.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:u&&d}};function Dh({type:e="source",position:t=K.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:c,className:d,onMouseDown:u,onTouchStart:l,...f},h){var P,L;const p=i||null,x=e==="target",m=oe(),y=Ks(),{connectOnClick:v,noPanClassName:g,rfId:w}=te(Oh,re),{connectingFrom:C,connectingTo:S,clickConnecting:I,isPossibleEndHandle:b,connectionInProcess:E,clickConnectionInProcess:A,valid:N}=te(Rh(y,p,e),re);y||(L=(P=m.getState()).onError)==null||L.call(P,"010",me.error010());const k=$=>{const{defaultEdgeOptions:R,onConnect:j,hasDefaultEdges:F}=m.getState(),q={...R,...$};if(F){const{edges:H,setEdges:T}=m.getState();T(lf(q,H))}j==null||j(q),a==null||a(q)},D=$=>{if(!y)return;const R=Es($.nativeEvent);if(o&&(R&&$.button===0||!R)){const j=m.getState();mr.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:j.autoPanOnConnect,connectionMode:j.connectionMode,connectionRadius:j.connectionRadius,domNode:j.domNode,nodeLookup:j.nodeLookup,lib:j.lib,isTarget:x,handleId:p,nodeId:y,flowId:j.rfId,panBy:j.panBy,cancelConnection:j.cancelConnection,onConnectStart:j.onConnectStart,onConnectEnd:(...F)=>{var q,H;return(H=(q=m.getState()).onConnectEnd)==null?void 0:H.call(q,...F)},updateConnection:j.updateConnection,onConnect:k,isValidConnection:n||((...F)=>{var q,H;return((H=(q=m.getState()).isValidConnection)==null?void 0:H.call(q,...F))??!0}),getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,autoPanSpeed:j.autoPanSpeed,dragThreshold:j.connectionDragThreshold})}R?u==null||u($):l==null||l($)},_=$=>{const{onClickConnectStart:R,onClickConnectEnd:j,connectionClickStartHandle:F,connectionMode:q,isValidConnection:H,lib:T,rfId:O,nodeLookup:z,connection:B}=m.getState();if(!y||!F&&!o)return;if(!F){R==null||R($.nativeEvent,{nodeId:y,handleId:p,handleType:e}),m.setState({connectionClickStartHandle:{nodeId:y,type:e,id:p}});return}const G=bs($.target),Y=n||H,{connection:X,isValid:Z}=mr.isValid($.nativeEvent,{handle:{nodeId:y,id:p,type:e},connectionMode:q,fromNodeId:F.nodeId,fromHandleId:F.id||null,fromType:F.type,isValidConnection:Y,flowId:O,doc:G,lib:T,nodeLookup:z});Z&&X&&k(X);const Q=structuredClone(B);delete Q.inProgress,Q.toPosition=Q.toHandle?Q.toHandle.position:null,j==null||j($,Q),m.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":p,"data-nodeid":y,"data-handlepos":t,"data-id":`${w}-${y}-${p}-${e}`,className:ae(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,d,{source:!x,target:x,connectable:r,connectablestart:o,connectableend:s,clickconnecting:I,connectingfrom:C,connectingto:S,valid:N,connectionindicator:r&&(!E||b)&&(E||A?s:o)}]),onMouseDown:D,onTouchStart:D,onClick:v?_:void 0,ref:h,...f,children:c})}const Ue=V.memo(Gs(Dh));function $h({data:e,isConnectable:t,sourcePosition:n=K.Bottom}){return M.jsxs(M.Fragment,{children:[e==null?void 0:e.label,M.jsx(Ue,{type:"source",position:n,isConnectable:t})]})}function zh({data:e,isConnectable:t,targetPosition:n=K.Top,sourcePosition:r=K.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(Ue,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,M.jsx(Ue,{type:"source",position:r,isConnectable:t})]})}function Vh(){return null}function Fh({data:e,isConnectable:t,targetPosition:n=K.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(Ue,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ft={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Lo={input:$h,default:zh,output:Fh,group:Vh};function Hh(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const Bh=e=>{const{width:t,height:n,x:r,y:o}=pt(e.nodeLookup,{filter:s=>!!s.selected});return{width:fe(t)?t:null,height:fe(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function qh({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=oe(),{width:o,height:s,transformString:i,userSelectionActive:a}=te(Bh,re),c=Us(),d=V.useRef(null);V.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const u=!a&&o!==null&&s!==null;if(Ws({nodeRef:d,disabled:!u}),!u)return null;const l=e?h=>{const p=r.getState().nodes.filter(x=>x.selected);e(h,p)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(Ft,h.key)&&(h.preventDefault(),c({direction:Ft[h.key],factor:h.shiftKey?4:1}))};return M.jsx("div",{className:ae(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:M.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:l,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:s}})})}const Po=typeof window<"u"?window:void 0,Yh=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Zs({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:u,selectionMode:l,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:p,panActivationKeyCode:x,zoomActivationKeyCode:m,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:w,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:I,panOnDrag:b,defaultViewport:E,translateExtent:A,minZoom:N,maxZoom:k,preventScrolling:D,onSelectionContextMenu:_,noWheelClassName:P,noPanClassName:L,disableKeyboardA11y:$,onViewportChange:R,isControlledViewport:j}){const{nodesSelectionActive:F,userSelectionActive:q}=te(Yh,re),H=dt(d,{target:Po}),T=dt(x,{target:Po}),O=T||b,z=T||w,B=u&&O!==!0,G=H||q||B;return Sh({deleteKeyCode:c,multiSelectionKeyCode:p}),M.jsx(Mh,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:g,panOnScroll:z,panOnScrollSpeed:C,panOnScrollMode:S,zoomOnDoubleClick:I,panOnDrag:!H&&O,defaultViewport:E,translateExtent:A,minZoom:N,maxZoom:k,zoomActivationKeyCode:m,preventScrolling:D,noWheelClassName:P,noPanClassName:L,onViewportChange:R,isControlledViewport:j,paneClickDistance:a,selectionOnDrag:B,children:M.jsxs(Lh,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:O,isSelecting:!!G,selectionMode:l,selectionKeyPressed:H,paneClickDistance:a,selectionOnDrag:B,children:[e,F&&M.jsx(qh,{onSelectionContextMenu:_,noPanClassName:L,disableKeyboardA11y:$})]})})}Zs.displayName="FlowRenderer";const Gh=V.memo(Zs),Xh=e=>t=>e?Sr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function Wh(e){return te(V.useCallback(Xh(e),[e]),re)}const Uh=e=>e.updateNodeInternals;function Kh(){const e=te(Uh),[t]=V.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const s=o.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:o.target,force:!0})}),e(r)}));return V.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function Zh({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=oe(),s=V.useRef(null),i=V.useRef(null),a=V.useRef(e.sourcePosition),c=V.useRef(e.targetPosition),d=V.useRef(t),u=n&&!!e.internals.handleBounds;return V.useEffect(()=>{s.current&&!e.hidden&&(!u||i.current!==s.current)&&(i.current&&(r==null||r.unobserve(i.current)),r==null||r.observe(s.current),i.current=s.current)},[u,e.hidden]),V.useEffect(()=>()=>{i.current&&(r==null||r.unobserve(i.current),i.current=null)},[]),V.useEffect(()=>{if(s.current){const l=d.current!==t,f=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(l||f||h)&&(d.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function Qh({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:c,nodesConnectable:d,nodesFocusable:u,resizeObserver:l,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:p,rfId:x,nodeTypes:m,nodeClickDistance:y,onError:v}){const{node:g,internals:w,isParent:C}=te(Y=>{const X=Y.nodeLookup.get(e),Z=Y.parentLookup.has(e);return{node:X,internals:X.internals,isParent:Z}},re);let S=g.type||"default",I=(m==null?void 0:m[S])||Lo[S];I===void 0&&(v==null||v("003",me.error003(S)),S="default",I=(m==null?void 0:m.default)||Lo.default);const b=!!(g.draggable||a&&typeof g.draggable>"u"),E=!!(g.selectable||c&&typeof g.selectable>"u"),A=!!(g.connectable||d&&typeof g.connectable>"u"),N=!!(g.focusable||u&&typeof g.focusable>"u"),k=oe(),D=xs(g),_=Zh({node:g,nodeType:S,hasDimensions:D,resizeObserver:l}),P=Ws({nodeRef:_,disabled:g.hidden||!b,noDragClassName:f,handleSelector:g.dragHandle,nodeId:e,isSelectable:E,nodeClickDistance:y}),L=Us();if(g.hidden)return null;const $=_e(g),R=Hh(g),j=E||b||t||n||r||o,F=n?Y=>n(Y,{...w.userNode}):void 0,q=r?Y=>r(Y,{...w.userNode}):void 0,H=o?Y=>o(Y,{...w.userNode}):void 0,T=s?Y=>s(Y,{...w.userNode}):void 0,O=i?Y=>i(Y,{...w.userNode}):void 0,z=Y=>{const{selectNodesOnDrag:X,nodeDragThreshold:Z}=k.getState();E&&(!X||!b||Z>0)&&yr({id:e,store:k,nodeRef:_}),t&&t(Y,{...w.userNode})},B=Y=>{if(!(_s(Y.nativeEvent)||p)){if(us.includes(Y.key)&&E){const X=Y.key==="Escape";yr({id:e,store:k,unselect:X,nodeRef:_})}else if(b&&g.selected&&Object.prototype.hasOwnProperty.call(Ft,Y.key)){Y.preventDefault();const{ariaLabelConfig:X}=k.getState();k.setState({ariaLiveMessage:X["node.a11yDescription.ariaLiveMessage"]({direction:Y.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),L({direction:Ft[Y.key],factor:Y.shiftKey?4:1})}}},G=()=>{var J;if(p||!((J=_.current)!=null&&J.matches(":focus-visible")))return;const{transform:Y,width:X,height:Z,autoPanOnNodeFocus:Q,setCenter:U}=k.getState();if(!Q)return;Sr(new Map([[e,g]]),{x:0,y:0,width:X,height:Z},Y,!0).length>0||U(g.position.x+$.width/2,g.position.y+$.height/2,{zoom:Y[2]})};return M.jsx("div",{className:ae(["react-flow__node",`react-flow__node-${S}`,{[h]:b},g.className,{selected:g.selected,selectable:E,parent:C,draggable:b,dragging:P}]),ref:_,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:D?"visible":"hidden",...g.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:q,onMouseLeave:H,onContextMenu:T,onClick:z,onDoubleClick:O,onKeyDown:N?B:void 0,tabIndex:N?0:void 0,onFocus:N?G:void 0,role:g.ariaRole??(N?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${Vs}-${x}`,"aria-label":g.ariaLabel,...g.domAttributes,children:M.jsx(jh,{value:e,children:M.jsx(I,{id:e,data:g.data,type:S,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:g.selected??!1,selectable:E,draggable:b,deletable:g.deletable??!0,isConnectable:A,sourcePosition:g.sourcePosition,targetPosition:g.targetPosition,dragging:P,dragHandle:g.dragHandle,zIndex:w.z,parentId:g.parentId,...$})})})}var Jh=V.memo(Qh);const ep=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Qs(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:s}=te(ep,re),i=Wh(e.onlyRenderVisibleElements),a=Kh();return M.jsx("div",{className:"react-flow__nodes",style:Jt,children:i.map(c=>M.jsx(Jh,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}Qs.displayName="NodeRenderer";const tp=V.memo(Qs);function np(e){return te(V.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const s=n.nodeLookup.get(o.source),i=n.nodeLookup.get(o.target);s&&i&&sf({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),re)}const rp=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},op=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},jo={[$t.Arrow]:rp,[$t.ArrowClosed]:op};function ip(e){const t=oe();return V.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(jo,e)?jo[e]:((s=(o=t.getState()).onError)==null||s.call(o,"009",me.error009(e)),null)},[e])}const sp=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:s="strokeWidth",strokeWidth:i,orient:a="auto-start-reverse"})=>{const c=ip(t);return c?M.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:a,refX:"0",refY:"0",children:M.jsx(c,{color:n,strokeWidth:i})}):null},Js=({defaultColor:e,rfId:t})=>{const n=te(s=>s.edges),r=te(s=>s.defaultEdgeOptions),o=V.useMemo(()=>pf(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:o.map(s=>M.jsx(sp,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};Js.displayName="MarkerDefinitions";var ap=V.memo(Js);function ea({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:c,className:d,...u}){const[l,f]=V.useState({x:1,y:0,width:0,height:0}),h=ae(["react-flow__edge-textwrapper",d]),p=V.useRef(null);return V.useEffect(()=>{if(p.current){const x=p.current.getBBox();f({x:x.x,y:x.y,width:x.width,height:x.height})}},[n]),n?M.jsxs("g",{transform:`translate(${e-l.width/2} ${t-l.height/2})`,className:h,visibility:l.width?"visible":"hidden",...u,children:[o&&M.jsx("rect",{width:l.width+2*i[0],x:-i[0],y:-i[1],height:l.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),M.jsx("text",{className:"react-flow__edge-text",y:l.height/2,dy:"0.3em",ref:p,style:r,children:n}),c]}):null}ea.displayName="EdgeText";const cp=V.memo(ea);function yt({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:d=20,...u}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...u,d:e,fill:"none",className:ae(["react-flow__edge-path",u.className])}),d?M.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&fe(t)&&fe(n)?M.jsx(cp,{x:t,y:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function Oo({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===K.Left||e===K.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function ta({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:o,targetPosition:s=K.Top}){const[i,a]=Oo({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,d]=Oo({pos:s,x1:r,y1:o,x2:e,y2:t}),[u,l,f,h]=Ns({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:i,sourceControlY:a,targetControlX:c,targetControlY:d});return[`M${e},${t} C${i},${a} ${c},${d} ${r},${o}`,u,l,f,h]}function na(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i,targetPosition:a,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:m,interactionWidth:y})=>{const[v,g,w]=ta({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a}),C=e.isInternal?void 0:t;return M.jsx(yt,{id:C,path:v,labelX:g,labelY:w,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:m,interactionWidth:y})})}const lp=na({isInternal:!1}),ra=na({isInternal:!0});lp.displayName="SimpleBezierEdge";ra.displayName="SimpleBezierEdgeInternal";function oa(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:l,style:f,sourcePosition:h=K.Bottom,targetPosition:p=K.Top,markerEnd:x,markerStart:m,pathOptions:y,interactionWidth:v})=>{const[g,w,C]=hr({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:s,targetPosition:p,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),S=e.isInternal?void 0:t;return M.jsx(yt,{id:S,path:g,labelX:w,labelY:C,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:l,style:f,markerEnd:x,markerStart:m,interactionWidth:v})})}const ia=oa({isInternal:!1}),sa=oa({isInternal:!0});ia.displayName="SmoothStepEdge";sa.displayName="SmoothStepEdgeInternal";function aa(e){return V.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return M.jsx(ia,{...n,id:r,pathOptions:V.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const up=aa({isInternal:!1}),ca=aa({isInternal:!0});up.displayName="StepEdge";ca.displayName="StepEdgeInternal";function la(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:l,style:f,markerEnd:h,markerStart:p,interactionWidth:x})=>{const[m,y,v]=Cs({sourceX:n,sourceY:r,targetX:o,targetY:s}),g=e.isInternal?void 0:t;return M.jsx(yt,{id:g,path:m,labelX:y,labelY:v,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:l,style:f,markerEnd:h,markerStart:p,interactionWidth:x})})}const dp=la({isInternal:!1}),ua=la({isInternal:!0});dp.displayName="StraightEdge";ua.displayName="StraightEdgeInternal";function da(e){return V.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i=K.Bottom,targetPosition:a=K.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:m,pathOptions:y,interactionWidth:v})=>{const[g,w,C]=Mr({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a,curvature:y==null?void 0:y.curvature}),S=e.isInternal?void 0:t;return M.jsx(yt,{id:S,path:g,labelX:w,labelY:C,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:l,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:x,markerStart:m,interactionWidth:v})})}const fp=da({isInternal:!1}),fa=da({isInternal:!0});fp.displayName="BezierEdge";fa.displayName="BezierEdgeInternal";const Ro={default:fa,straight:ua,step:ca,smoothstep:sa,simplebezier:ra},Do={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},hp=(e,t,n)=>n===K.Left?e-t:n===K.Right?e+t:e,pp=(e,t,n)=>n===K.Top?e-t:n===K.Bottom?e+t:e,$o="react-flow__edgeupdater";function zo({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:s,onMouseOut:i,type:a}){return M.jsx("circle",{onMouseDown:o,onMouseEnter:s,onMouseOut:i,className:ae([$o,`${$o}-${a}`]),cx:hp(t,r,e),cy:pp(n,r,e),r,stroke:"transparent",fill:"transparent"})}function gp({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:s,targetY:i,sourcePosition:a,targetPosition:c,onReconnect:d,onReconnectStart:u,onReconnectEnd:l,setReconnecting:f,setUpdateHover:h}){const p=oe(),x=(w,C)=>{if(w.button!==0)return;const{autoPanOnConnect:S,domNode:I,connectionMode:b,connectionRadius:E,lib:A,onConnectStart:N,cancelConnection:k,nodeLookup:D,rfId:_,panBy:P,updateConnection:L}=p.getState(),$=C.type==="target",R=(q,H)=>{f(!1),l==null||l(q,n,C.type,H)},j=q=>d==null?void 0:d(n,q),F=(q,H)=>{f(!0),u==null||u(w,n,C.type),N==null||N(q,H)};mr.onPointerDown(w.nativeEvent,{autoPanOnConnect:S,connectionMode:b,connectionRadius:E,domNode:I,handleId:C.id,nodeId:C.nodeId,nodeLookup:D,isTarget:$,edgeUpdaterType:C.type,lib:A,flowId:_,cancelConnection:k,panBy:P,isValidConnection:(...q)=>{var H,T;return((T=(H=p.getState()).isValidConnection)==null?void 0:T.call(H,...q))??!0},onConnect:j,onConnectStart:F,onConnectEnd:(...q)=>{var H,T;return(T=(H=p.getState()).onConnectEnd)==null?void 0:T.call(H,...q)},onReconnectEnd:R,updateConnection:L,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},m=w=>x(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=w=>x(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),g=()=>h(!1);return M.jsxs(M.Fragment,{children:[(e===!0||e==="source")&&M.jsx(zo,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:m,onMouseEnter:v,onMouseOut:g,type:"source"}),(e===!0||e==="target")&&M.jsx(zo,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:g,type:"target"})]})}function mp({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:d,reconnectRadius:u,onReconnect:l,onReconnectStart:f,onReconnectEnd:h,rfId:p,edgeTypes:x,noPanClassName:m,onError:y,disableKeyboardA11y:v}){let g=te(U=>U.edgeLookup.get(e));const w=te(U=>U.defaultEdgeOptions);g=w?{...w,...g}:g;let C=g.type||"default",S=(x==null?void 0:x[C])||Ro[C];S===void 0&&(y==null||y("011",me.error011(C)),C="default",S=(x==null?void 0:x.default)||Ro.default);const I=!!(g.focusable||t&&typeof g.focusable>"u"),b=typeof l<"u"&&(g.reconnectable||n&&typeof g.reconnectable>"u"),E=!!(g.selectable||r&&typeof g.selectable>"u"),A=V.useRef(null),[N,k]=V.useState(!1),[D,_]=V.useState(!1),P=oe(),{zIndex:L,sourceX:$,sourceY:R,targetX:j,targetY:F,sourcePosition:q,targetPosition:H}=te(V.useCallback(U=>{const W=U.nodeLookup.get(g.source),J=U.nodeLookup.get(g.target);if(!W||!J)return{zIndex:g.zIndex,...Do};const ne=hf({id:e,sourceNode:W,targetNode:J,sourceHandle:g.sourceHandle||null,targetHandle:g.targetHandle||null,connectionMode:U.connectionMode,onError:y});return{zIndex:of({selected:g.selected,zIndex:g.zIndex,sourceNode:W,targetNode:J,elevateOnSelect:U.elevateEdgesOnSelect,zIndexMode:U.zIndexMode}),...ne||Do}},[g.source,g.target,g.sourceHandle,g.targetHandle,g.selected,g.zIndex]),re),T=V.useMemo(()=>g.markerStart?`url('#${pr(g.markerStart,p)}')`:void 0,[g.markerStart,p]),O=V.useMemo(()=>g.markerEnd?`url('#${pr(g.markerEnd,p)}')`:void 0,[g.markerEnd,p]);if(g.hidden||$===null||R===null||j===null||F===null)return null;const z=U=>{var ee;const{addSelectedEdges:W,unselectNodesAndEdges:J,multiSelectionActive:ne}=P.getState();E&&(P.setState({nodesSelectionActive:!1}),g.selected&&ne?(J({nodes:[],edges:[g]}),(ee=A.current)==null||ee.blur()):W([e])),o&&o(U,g)},B=s?U=>{s(U,{...g})}:void 0,G=i?U=>{i(U,{...g})}:void 0,Y=a?U=>{a(U,{...g})}:void 0,X=c?U=>{c(U,{...g})}:void 0,Z=d?U=>{d(U,{...g})}:void 0,Q=U=>{var W;if(!v&&us.includes(U.key)&&E){const{unselectNodesAndEdges:J,addSelectedEdges:ne}=P.getState();U.key==="Escape"?((W=A.current)==null||W.blur(),J({edges:[g]})):ne([e])}};return M.jsx("svg",{style:{zIndex:L},children:M.jsxs("g",{className:ae(["react-flow__edge",`react-flow__edge-${C}`,g.className,m,{selected:g.selected,animated:g.animated,inactive:!E&&!o,updating:N,selectable:E}]),onClick:z,onDoubleClick:B,onContextMenu:G,onMouseEnter:Y,onMouseMove:X,onMouseLeave:Z,onKeyDown:I?Q:void 0,tabIndex:I?0:void 0,role:g.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":g.ariaLabel===null?void 0:g.ariaLabel||`Edge from ${g.source} to ${g.target}`,"aria-describedby":I?`${Fs}-${p}`:void 0,ref:A,...g.domAttributes,children:[!D&&M.jsx(S,{id:e,source:g.source,target:g.target,type:g.type,selected:g.selected,animated:g.animated,selectable:E,deletable:g.deletable??!0,label:g.label,labelStyle:g.labelStyle,labelShowBg:g.labelShowBg,labelBgStyle:g.labelBgStyle,labelBgPadding:g.labelBgPadding,labelBgBorderRadius:g.labelBgBorderRadius,sourceX:$,sourceY:R,targetX:j,targetY:F,sourcePosition:q,targetPosition:H,data:g.data,style:g.style,sourceHandleId:g.sourceHandle,targetHandleId:g.targetHandle,markerStart:T,markerEnd:O,pathOptions:"pathOptions"in g?g.pathOptions:void 0,interactionWidth:g.interactionWidth}),b&&M.jsx(gp,{edge:g,isReconnectable:b,reconnectRadius:u,onReconnect:l,onReconnectStart:f,onReconnectEnd:h,sourceX:$,sourceY:R,targetX:j,targetY:F,sourcePosition:q,targetPosition:H,setUpdateHover:k,setReconnecting:_})]})})}var yp=V.memo(mp);const wp=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ha({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:l,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:p,disableKeyboardA11y:x}){const{edgesFocusable:m,edgesReconnectable:y,elementsSelectable:v,onError:g}=te(wp,re),w=np(t);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(ap,{defaultColor:e,rfId:n}),w.map(C=>M.jsx(yp,{id:C,edgesFocusable:m,edgesReconnectable:y,elementsSelectable:v,noPanClassName:o,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:l,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:p,rfId:n,onError:g,edgeTypes:r,disableKeyboardA11y:x},C))]})}ha.displayName="EdgeRenderer";const xp=V.memo(ha),vp=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function bp({children:e}){const t=te(vp);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function _p(e){const t=jr(),n=V.useRef(!1);V.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Ep=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Np(e){const t=te(Ep),n=oe();return V.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Sp(e){return e.connection.inProgress?{...e.connection,to:mt(e.connection.to,e.transform)}:{...e.connection}}function Cp(e){return Sp}function kp(e){const t=Cp();return te(t,re)}const Mp=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ip({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:s,height:i,isValid:a,inProgress:c}=te(Mp,re);return!(s&&o&&c)?null:M.jsx("svg",{style:e,width:s,height:i,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:ae(["react-flow__connection",hs(a)]),children:M.jsx(pa,{style:t,type:n,CustomComponent:r,isValid:a})})})}const pa=({style:e,type:t=Ce.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:s,fromNode:i,fromHandle:a,fromPosition:c,to:d,toNode:u,toHandle:l,toPosition:f,pointer:h}=kp();if(!o)return;if(n)return M.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:f,connectionStatus:hs(r),toNode:u,toHandle:l,pointer:h});let p="";const x={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:f};switch(t){case Ce.Bezier:[p]=Mr(x);break;case Ce.SimpleBezier:[p]=ta(x);break;case Ce.Step:[p]=hr({...x,borderRadius:0});break;case Ce.SmoothStep:[p]=hr(x);break;default:[p]=Cs(x)}return M.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:e})};pa.displayName="ConnectionLine";const Ap={};function Vo(e=Ap){V.useRef(e),oe(),V.useEffect(()=>{},[e])}function Tp(){oe(),V.useRef(!1),V.useEffect(()=>{},[])}function ga({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:l,onSelectionStart:f,onSelectionEnd:h,connectionLineType:p,connectionLineStyle:x,connectionLineComponent:m,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:g,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:I,deleteKeyCode:b,onlyRenderVisibleElements:E,elementsSelectable:A,defaultViewport:N,translateExtent:k,minZoom:D,maxZoom:_,preventScrolling:P,defaultMarkerColor:L,zoomOnScroll:$,zoomOnPinch:R,panOnScroll:j,panOnScrollSpeed:F,panOnScrollMode:q,zoomOnDoubleClick:H,panOnDrag:T,onPaneClick:O,onPaneMouseEnter:z,onPaneMouseMove:B,onPaneMouseLeave:G,onPaneScroll:Y,onPaneContextMenu:X,paneClickDistance:Z,nodeClickDistance:Q,onEdgeContextMenu:U,onEdgeMouseEnter:W,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:ee,onReconnect:ce,onReconnectStart:Ee,onReconnectEnd:we,noDragClassName:Ie,noWheelClassName:Ke,noPanClassName:Ze,disableKeyboardA11y:Qe,nodeExtent:en,rfId:wt,viewport:De,onViewportChange:Je}){return Vo(e),Vo(t),Tp(),_p(n),Np(De),M.jsx(Gh,{onPaneClick:O,onPaneMouseEnter:z,onPaneMouseMove:B,onPaneMouseLeave:G,onPaneContextMenu:X,onPaneScroll:Y,paneClickDistance:Z,deleteKeyCode:b,selectionKeyCode:v,selectionOnDrag:g,selectionMode:w,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:S,zoomActivationKeyCode:I,elementsSelectable:A,zoomOnScroll:$,zoomOnPinch:R,zoomOnDoubleClick:H,panOnScroll:j,panOnScrollSpeed:F,panOnScrollMode:q,panOnDrag:T,defaultViewport:N,translateExtent:k,minZoom:D,maxZoom:_,onSelectionContextMenu:l,preventScrolling:P,noDragClassName:Ie,noWheelClassName:Ke,noPanClassName:Ze,disableKeyboardA11y:Qe,onViewportChange:Je,isControlledViewport:!!De,children:M.jsxs(bp,{children:[M.jsx(xp,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:i,onReconnect:ce,onReconnectStart:Ee,onReconnectEnd:we,onlyRenderVisibleElements:E,onEdgeContextMenu:U,onEdgeMouseEnter:W,onEdgeMouseMove:J,onEdgeMouseLeave:ne,reconnectRadius:ee,defaultMarkerColor:L,noPanClassName:Ze,disableKeyboardA11y:Qe,rfId:wt}),M.jsx(Ip,{style:x,type:p,component:m,containerStyle:y}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(tp,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:Q,onlyRenderVisibleElements:E,noPanClassName:Ze,noDragClassName:Ie,disableKeyboardA11y:Qe,nodeExtent:en,rfId:wt}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}ga.displayName="GraphView";const Lp=V.memo(ga),Fo=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:l,zIndexMode:f="basic"}={})=>{const h=new Map,p=new Map,x=new Map,m=new Map,y=r??t??[],v=n??e??[],g=u??[0,0],w=l??at;Is(x,m,y);const C=gr(v,h,p,{nodeOrigin:g,nodeExtent:w,zIndexMode:f});let S=[0,0,1];if(i&&o&&s){const I=pt(h,{filter:N=>!!((N.width||N.initialWidth)&&(N.height||N.initialHeight))}),{x:b,y:E,zoom:A}=Cr(I,o,s,c,d,(a==null?void 0:a.padding)??.1);S=[b,E,A]}return{rfId:"1",width:o??0,height:s??0,transform:S,nodes:v,nodesInitialized:C,nodeLookup:h,parentLookup:p,edges:y,edgeLookup:m,connectionLookup:x,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:at,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:qe.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:g,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:i??!1,fitViewOptions:a,fitViewResolver:null,connection:{...fs},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Qd,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ds,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Pp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:l,zIndexMode:f})=>Zf((h,p)=>{async function x(){const{nodeLookup:m,panZoom:y,fitViewOptions:v,fitViewResolver:g,width:w,height:C,minZoom:S,maxZoom:I}=p();y&&(await Kd({nodes:m,width:w,height:C,panZoom:y,minZoom:S,maxZoom:I},v),g==null||g.resolve(!0),h({fitViewResolver:null}))}return{...Fo({nodes:e,edges:t,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:l,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:m=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:g,elevateNodesOnSelect:w,fitViewQueued:C,zIndexMode:S}=p(),I=gr(m,y,v,{nodeOrigin:g,nodeExtent:l,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:S});C&&I?(x(),h({nodes:m,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:m,nodesInitialized:I})},setEdges:m=>{const{connectionLookup:y,edgeLookup:v}=p();Is(y,v,m),h({edges:m})},setDefaultNodesAndEdges:(m,y)=>{if(m){const{setNodes:v}=p();v(m),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=p();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:m=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:g,domNode:w,nodeOrigin:C,nodeExtent:S,debug:I,fitViewQueued:b,zIndexMode:E}=p(),{changes:A,updatedInternals:N}=bf(m,v,g,w,C,S,E);N&&(yf(v,g,{nodeOrigin:C,nodeExtent:S,zIndexMode:E}),b?(x(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(A==null?void 0:A.length)>0&&(I&&console.log("React Flow: trigger node changes",A),y==null||y(A)))},updateNodePositions:(m,y=!1)=>{const v=[];let g=[];const{nodeLookup:w,triggerNodeChanges:C,connection:S,updateConnection:I,onNodesChangeMiddlewareMap:b}=p();for(const[E,A]of m){const N=w.get(E),k=!!(N!=null&&N.expandParent&&(N!=null&&N.parentId)&&(A!=null&&A.position)),D={id:E,type:"position",position:k?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:y};if(N&&S.inProgress&&S.fromNode.id===N.id){const _=Re(N,S.fromHandle,K.Left,!0);I({...S,from:_})}k&&N.parentId&&v.push({id:E,parentId:N.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),g.push(D)}if(v.length>0){const{parentLookup:E,nodeOrigin:A}=p(),N=Pr(v,w,E,A);g.push(...N)}for(const E of b.values())g=E(g);C(g)},triggerNodeChanges:m=>{const{onNodesChange:y,setNodes:v,nodes:g,hasDefaultNodes:w,debug:C}=p();if(m!=null&&m.length){if(w){const S=qs(m,g);v(S)}C&&console.log("React Flow: trigger node changes",m),y==null||y(m)}},triggerEdgeChanges:m=>{const{onEdgesChange:y,setEdges:v,edges:g,hasDefaultEdges:w,debug:C}=p();if(m!=null&&m.length){if(w){const S=Ys(m,g);v(S)}C&&console.log("React Flow: trigger edge changes",m),y==null||y(m)}},addSelectedNodes:m=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:g,triggerNodeChanges:w,triggerEdgeChanges:C}=p();if(y){const S=m.map(I=>Le(I,!0));w(S);return}w(Ve(g,new Set([...m]),!0)),C(Ve(v))},addSelectedEdges:m=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:g,triggerNodeChanges:w,triggerEdgeChanges:C}=p();if(y){const S=m.map(I=>Le(I,!0));C(S);return}C(Ve(v,new Set([...m]))),w(Ve(g,new Set,!0))},unselectNodesAndEdges:({nodes:m,edges:y}={})=>{const{edges:v,nodes:g,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:S}=p(),I=m||g,b=y||v,E=[];for(const N of I){if(!N.selected)continue;const k=w.get(N.id);k&&(k.selected=!1),E.push(Le(N.id,!1))}const A=[];for(const N of b)N.selected&&A.push(Le(N.id,!1));C(E),S(A)},setMinZoom:m=>{const{panZoom:y,maxZoom:v}=p();y==null||y.setScaleExtent([m,v]),h({minZoom:m})},setMaxZoom:m=>{const{panZoom:y,minZoom:v}=p();y==null||y.setScaleExtent([v,m]),h({maxZoom:m})},setTranslateExtent:m=>{var y;(y=p().panZoom)==null||y.setTranslateExtent(m),h({translateExtent:m})},resetSelectedElements:()=>{const{edges:m,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:g,elementsSelectable:w}=p();if(!w)return;const C=y.reduce((I,b)=>b.selected?[...I,Le(b.id,!1)]:I,[]),S=m.reduce((I,b)=>b.selected?[...I,Le(b.id,!1)]:I,[]);v(C),g(S)},setNodeExtent:m=>{const{nodes:y,nodeLookup:v,parentLookup:g,nodeOrigin:w,elevateNodesOnSelect:C,nodeExtent:S,zIndexMode:I}=p();m[0][0]===S[0][0]&&m[0][1]===S[0][1]&&m[1][0]===S[1][0]&&m[1][1]===S[1][1]||(gr(y,v,g,{nodeOrigin:w,nodeExtent:m,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:I}),h({nodeExtent:m}))},panBy:m=>{const{transform:y,width:v,height:g,panZoom:w,translateExtent:C}=p();return _f({delta:m,panZoom:w,transform:y,translateExtent:C,width:v,height:g})},setCenter:async(m,y,v)=>{const{width:g,height:w,maxZoom:C,panZoom:S}=p();if(!S)return Promise.resolve(!1);const I=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:C;return await S.setViewport({x:g/2-m*I,y:w/2-y*I,zoom:I},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...fs}})},updateConnection:m=>{h({connection:m})},reset:()=>h({...Fo()})}},Object.is);function jp({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:c,fitView:d,nodeOrigin:u,nodeExtent:l,zIndexMode:f,children:h}){const[p]=V.useState(()=>Pp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:d,minZoom:i,maxZoom:a,fitViewOptions:c,nodeOrigin:u,nodeExtent:l,zIndexMode:f}));return M.jsx(Qf,{value:p,children:M.jsx(bh,{children:h})})}function Op({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:i,fitView:a,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:l,nodeExtent:f,zIndexMode:h}){return V.useContext(Zt)?M.jsx(M.Fragment,{children:e}):M.jsx(jp,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:l,nodeExtent:f,zIndexMode:h,children:e})}const Rp={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Dp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:c,onInit:d,onMove:u,onMoveStart:l,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:x,onClickConnectStart:m,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:S,onNodeDragStart:I,onNodeDrag:b,onNodeDragStop:E,onNodesDelete:A,onEdgesDelete:N,onDelete:k,onSelectionChange:D,onSelectionDragStart:_,onSelectionDrag:P,onSelectionDragStop:L,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:j,onBeforeDelete:F,connectionMode:q,connectionLineType:H=Ce.Bezier,connectionLineStyle:T,connectionLineComponent:O,connectionLineContainerStyle:z,deleteKeyCode:B="Backspace",selectionKeyCode:G="Shift",selectionOnDrag:Y=!1,selectionMode:X=ct.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:Q=ut()?"Meta":"Control",zoomActivationKeyCode:U=ut()?"Meta":"Control",snapToGrid:W,snapGrid:J,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ee,nodesDraggable:ce,autoPanOnNodeFocus:Ee,nodesConnectable:we,nodesFocusable:Ie,nodeOrigin:Ke=Hs,edgesFocusable:Ze,edgesReconnectable:Qe,elementsSelectable:en=!0,defaultViewport:wt=dh,minZoom:De=.5,maxZoom:Je=2,translateExtent:Dr=at,preventScrolling:Sa=!0,nodeExtent:tn,defaultMarkerColor:Ca="#b1b1b7",zoomOnScroll:ka=!0,zoomOnPinch:Ma=!0,panOnScroll:Ia=!1,panOnScrollSpeed:Aa=.5,panOnScrollMode:Ta=Pe.Free,zoomOnDoubleClick:La=!0,panOnDrag:Pa=!0,onPaneClick:ja,onPaneMouseEnter:Oa,onPaneMouseMove:Ra,onPaneMouseLeave:Da,onPaneScroll:$a,onPaneContextMenu:za,paneClickDistance:Va=1,nodeClickDistance:Fa=0,children:Ha,onReconnect:Ba,onReconnectStart:qa,onReconnectEnd:Ya,onEdgeContextMenu:Ga,onEdgeDoubleClick:Xa,onEdgeMouseEnter:Wa,onEdgeMouseMove:Ua,onEdgeMouseLeave:Ka,reconnectRadius:Za=10,onNodesChange:Qa,onEdgesChange:Ja,noDragClassName:ec="nodrag",noWheelClassName:tc="nowheel",noPanClassName:$r="nopan",fitView:zr,fitViewOptions:Vr,connectOnClick:nc,attributionPosition:rc,proOptions:oc,defaultEdgeOptions:ic,elevateNodesOnSelect:sc=!0,elevateEdgesOnSelect:ac=!1,disableKeyboardA11y:Fr=!1,autoPanOnConnect:cc,autoPanOnNodeDrag:lc,autoPanSpeed:uc,connectionRadius:dc,isValidConnection:fc,onError:hc,style:pc,id:Hr,nodeDragThreshold:gc,connectionDragThreshold:mc,viewport:yc,onViewportChange:wc,width:xc,height:vc,colorMode:bc="light",debug:_c,onScroll:xt,ariaLabelConfig:Ec,zIndexMode:Br="basic",...Nc},Sc){const nn=Hr||"1",Cc=gh(bc),kc=V.useCallback(qr=>{qr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),xt==null||xt(qr)},[xt]);return M.jsx("div",{"data-testid":"rf__wrapper",...Nc,onScroll:kc,style:{...pc,...Rp},ref:Sc,className:ae(["react-flow",o,Cc]),id:Hr,role:"application",children:M.jsxs(Op,{nodes:e,edges:t,width:xc,height:vc,fitView:zr,fitViewOptions:Vr,minZoom:De,maxZoom:Je,nodeOrigin:Ke,nodeExtent:tn,zIndexMode:Br,children:[M.jsx(Lp,{onInit:d,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:g,onNodeMouseLeave:w,onNodeContextMenu:C,onNodeDoubleClick:S,nodeTypes:s,edgeTypes:i,connectionLineType:H,connectionLineStyle:T,connectionLineComponent:O,connectionLineContainerStyle:z,selectionKeyCode:G,selectionOnDrag:Y,selectionMode:X,deleteKeyCode:B,multiSelectionKeyCode:Q,panActivationKeyCode:Z,zoomActivationKeyCode:U,onlyRenderVisibleElements:ne,defaultViewport:wt,translateExtent:Dr,minZoom:De,maxZoom:Je,preventScrolling:Sa,zoomOnScroll:ka,zoomOnPinch:Ma,zoomOnDoubleClick:La,panOnScroll:Ia,panOnScrollSpeed:Aa,panOnScrollMode:Ta,panOnDrag:Pa,onPaneClick:ja,onPaneMouseEnter:Oa,onPaneMouseMove:Ra,onPaneMouseLeave:Da,onPaneScroll:$a,onPaneContextMenu:za,paneClickDistance:Va,nodeClickDistance:Fa,onSelectionContextMenu:$,onSelectionStart:R,onSelectionEnd:j,onReconnect:Ba,onReconnectStart:qa,onReconnectEnd:Ya,onEdgeContextMenu:Ga,onEdgeDoubleClick:Xa,onEdgeMouseEnter:Wa,onEdgeMouseMove:Ua,onEdgeMouseLeave:Ka,reconnectRadius:Za,defaultMarkerColor:Ca,noDragClassName:ec,noWheelClassName:tc,noPanClassName:$r,rfId:nn,disableKeyboardA11y:Fr,nodeExtent:tn,viewport:yc,onViewportChange:wc}),M.jsx(ph,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:x,onClickConnectStart:m,onClickConnectEnd:y,nodesDraggable:ce,autoPanOnNodeFocus:Ee,nodesConnectable:we,nodesFocusable:Ie,edgesFocusable:Ze,edgesReconnectable:Qe,elementsSelectable:en,elevateNodesOnSelect:sc,elevateEdgesOnSelect:ac,minZoom:De,maxZoom:Je,nodeExtent:tn,onNodesChange:Qa,onEdgesChange:Ja,snapToGrid:W,snapGrid:J,connectionMode:q,translateExtent:Dr,connectOnClick:nc,defaultEdgeOptions:ic,fitView:zr,fitViewOptions:Vr,onNodesDelete:A,onEdgesDelete:N,onDelete:k,onNodeDragStart:I,onNodeDrag:b,onNodeDragStop:E,onSelectionDrag:P,onSelectionDragStart:_,onSelectionDragStop:L,onMove:u,onMoveStart:l,onMoveEnd:f,noPanClassName:$r,nodeOrigin:Ke,rfId:nn,autoPanOnConnect:cc,autoPanOnNodeDrag:lc,autoPanSpeed:uc,onError:hc,connectionRadius:dc,isValidConnection:fc,selectNodesOnDrag:ee,nodeDragThreshold:gc,connectionDragThreshold:mc,onBeforeDelete:F,debug:_c,ariaLabelConfig:Ec,zIndexMode:Br}),M.jsx(uh,{onSelectionChange:D}),Ha,M.jsx(ih,{proOptions:oc,position:rc}),M.jsx(oh,{rfId:nn,disableKeyboardA11y:Fr})]})})}var tm=Gs(Dp);const $p=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function zp({children:e}){const t=te($p);return t?jc.createPortal(e,t):null}function nm(e){const[t,n]=V.useState(e),r=V.useCallback(o=>n(s=>qs(o,s)),[]);return[t,n,r]}function rm(e){const[t,n]=V.useState(e),r=V.useCallback(o=>n(s=>Ys(o,s)),[]);return[t,n,r]}function Vp({dimensions:e,lineWidth:t,variant:n,className:r}){return M.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ae(["react-flow__background-pattern",n,r])})}function Fp({radius:e,className:t}){return M.jsx("circle",{cx:e,cy:e,r:e,className:ae(["react-flow__background-pattern","dots",t])})}var Me;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Me||(Me={}));const Hp={[Me.Dots]:1,[Me.Lines]:1,[Me.Cross]:6},Bp=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ma({id:e,variant:t=Me.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=0,color:i,bgColor:a,style:c,className:d,patternClassName:u}){const l=V.useRef(null),{transform:f,patternId:h}=te(Bp,re),p=r||Hp[t],x=t===Me.Dots,m=t===Me.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*f[2]||1,y[1]*f[2]||1],g=p*f[2],w=Array.isArray(s)?s:[s,s],C=m?[g,g]:v,S=[w[0]*f[2]||1+C[0]/2,w[1]*f[2]||1+C[1]/2],I=`${h}${e||""}`;return M.jsxs("svg",{className:ae(["react-flow__background",d]),style:{...c,...Jt,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:l,"data-testid":"rf__background",children:[M.jsx("pattern",{id:I,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:x?M.jsx(Fp,{radius:g/2,className:u}):M.jsx(Vp,{dimensions:C,lineWidth:o,variant:t,className:u})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}ma.displayName="Background";const om=V.memo(ma);function qp(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Yp(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Gp(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.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 Xp(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 Wp(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 Ct({children:e,className:t,...n}){return M.jsx("button",{type:"button",className:ae(["react-flow__controls-button",t]),...n,children:e})}const Up=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ya({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:c,className:d,children:u,position:l="bottom-left",orientation:f="vertical","aria-label":h}){const p=oe(),{isInteractive:x,minZoomReached:m,maxZoomReached:y,ariaLabelConfig:v}=te(Up,re),{zoomIn:g,zoomOut:w,fitView:C}=jr(),S=()=>{g(),s==null||s()},I=()=>{w(),i==null||i()},b=()=>{C(o),a==null||a()},E=()=>{p.setState({nodesDraggable:!x,nodesConnectable:!x,elementsSelectable:!x}),c==null||c(!x)},A=f==="horizontal"?"horizontal":"vertical";return M.jsxs(Qt,{className:ae(["react-flow__controls",A,d]),position:l,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&M.jsxs(M.Fragment,{children:[M.jsx(Ct,{onClick:S,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:M.jsx(qp,{})}),M.jsx(Ct,{onClick:I,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:m,children:M.jsx(Yp,{})})]}),n&&M.jsx(Ct,{className:"react-flow__controls-fitview",onClick:b,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:M.jsx(Gp,{})}),r&&M.jsx(Ct,{className:"react-flow__controls-interactive",onClick:E,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:x?M.jsx(Wp,{}):M.jsx(Xp,{})}),u]})}ya.displayName="Controls";const im=V.memo(ya);function Kp({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:a,strokeWidth:c,className:d,borderRadius:u,shapeRendering:l,selected:f,onClick:h}){const{background:p,backgroundColor:x}=s||{},m=i||p||x;return M.jsx("rect",{className:ae(["react-flow__minimap-node",{selected:f},d]),x:t,y:n,rx:u,ry:u,width:r,height:o,style:{fill:m,stroke:a,strokeWidth:c},shapeRendering:l,onClick:h?y=>h(y,e):void 0})}const Zp=V.memo(Kp),Qp=e=>e.nodes.map(t=>t.id),dn=e=>e instanceof Function?e:()=>e;function Jp({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:s=Zp,onClick:i}){const a=te(Qp,re),c=dn(t),d=dn(e),u=dn(n),l=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:a.map(f=>M.jsx(tg,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:s,onClick:i,shapeRendering:l},f))})}function eg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:c}){const{node:d,x:u,y:l,width:f,height:h}=te(p=>{const x=p.nodeLookup.get(e);if(!x)return{node:void 0,x:0,y:0,width:0,height:0};const m=x.internals.userNode,{x:y,y:v}=x.internals.positionAbsolute,{width:g,height:w}=_e(m);return{node:m,x:y,y:v,width:g,height:w}},re);return!d||d.hidden||!xs(d)?null:M.jsx(a,{x:u,y:l,width:f,height:h,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:o,strokeColor:n(d),strokeWidth:s,shapeRendering:i,onClick:c,id:d.id})}const tg=V.memo(eg);var ng=V.memo(Jp);const rg=200,og=150,ig=e=>!e.hidden,sg=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?ws(pt(e.nodeLookup,{filter:ig}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},ag="react-flow__minimap-desc";function wa({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:c,maskColor:d,maskStrokeColor:u,maskStrokeWidth:l,position:f="bottom-right",onClick:h,onNodeClick:p,pannable:x=!1,zoomable:m=!1,ariaLabel:y,inversePan:v,zoomStep:g=1,offsetScale:w=5}){const C=oe(),S=V.useRef(null),{boundingRect:I,viewBB:b,rfId:E,panZoom:A,translateExtent:N,flowWidth:k,flowHeight:D,ariaLabelConfig:_}=te(sg,re),P=(e==null?void 0:e.width)??rg,L=(e==null?void 0:e.height)??og,$=I.width/P,R=I.height/L,j=Math.max($,R),F=j*P,q=j*L,H=w*j,T=I.x-(F-I.width)/2-H,O=I.y-(q-I.height)/2-H,z=F+H*2,B=q+H*2,G=`${ag}-${E}`,Y=V.useRef(0),X=V.useRef();Y.current=j,V.useEffect(()=>{if(S.current&&A)return X.current=Tf({domNode:S.current,panZoom:A,getTransform:()=>C.getState().transform,getViewScale:()=>Y.current}),()=>{var W;(W=X.current)==null||W.destroy()}},[A]),V.useEffect(()=>{var W;(W=X.current)==null||W.update({translateExtent:N,width:k,height:D,inversePan:v,pannable:x,zoomStep:g,zoomable:m})},[x,m,v,g,N,k,D]);const Z=h?W=>{var ee;const[J,ne]=((ee=X.current)==null?void 0:ee.pointer(W))||[0,0];h(W,{x:J,y:ne})}:void 0,Q=p?V.useCallback((W,J)=>{const ne=C.getState().nodeLookup.get(J).internals.userNode;p(W,ne)},[]):void 0,U=y??_["minimap.ariaLabel"];return M.jsx(Qt,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof l=="number"?l*j:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof i=="number"?i:void 0},className:ae(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:P,height:L,viewBox:`${T} ${O} ${z} ${B}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":G,ref:S,onClick:Z,children:[U&&M.jsx("title",{id:G,children:U}),M.jsx(ng,{onClick:Q,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:a}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${T-H},${O-H}h${z+H*2}v${B+H*2}h${-z-H*2}z
|
|
7
|
+
M${b.x},${b.y}h${b.width}v${b.height}h${-b.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}wa.displayName="MiniMap";V.memo(wa);const cg=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,lg={[We.Line]:"right",[We.Handle]:"bottom-right"};function ug({nodeId:e,position:t,variant:n=We.Handle,className:r,style:o=void 0,children:s,color:i,minWidth:a=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:l=!1,resizeDirection:f,autoScale:h=!0,shouldResize:p,onResizeStart:x,onResize:m,onResizeEnd:y}){const v=Ks(),g=typeof e=="string"?e:v,w=oe(),C=V.useRef(null),S=n===We.Handle,I=te(V.useCallback(cg(S&&h),[S,h]),re),b=V.useRef(null),E=t??lg[n];V.useEffect(()=>{if(!(!C.current||!g))return b.current||(b.current=Yf({domNode:C.current,nodeId:g,getStoreItems:()=>{const{nodeLookup:N,transform:k,snapGrid:D,snapToGrid:_,nodeOrigin:P,domNode:L}=w.getState();return{nodeLookup:N,transform:k,snapGrid:D,snapToGrid:_,nodeOrigin:P,paneDomNode:L}},onChange:(N,k)=>{const{triggerNodeChanges:D,nodeLookup:_,parentLookup:P,nodeOrigin:L}=w.getState(),$=[],R={x:N.x,y:N.y},j=_.get(g);if(j&&j.expandParent&&j.parentId){const F=j.origin??L,q=N.width??j.measured.width??0,H=N.height??j.measured.height??0,T={id:j.id,parentId:j.parentId,rect:{width:q,height:H,...vs({x:N.x??j.position.x,y:N.y??j.position.y},{width:q,height:H},j.parentId,_,F)}},O=Pr([T],_,P,L);$.push(...O),R.x=N.x?Math.max(F[0]*q,N.x):void 0,R.y=N.y?Math.max(F[1]*H,N.y):void 0}if(R.x!==void 0&&R.y!==void 0){const F={id:g,type:"position",position:{...R}};$.push(F)}if(N.width!==void 0&&N.height!==void 0){const q={id:g,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:N.width,height:N.height}};$.push(q)}for(const F of k){const q={...F,type:"position"};$.push(q)}D($)},onEnd:({width:N,height:k})=>{const D={id:g,type:"dimensions",resizing:!1,dimensions:{width:N,height:k}};w.getState().triggerNodeChanges([D])}})),b.current.update({controlPosition:E,boundaries:{minWidth:a,minHeight:c,maxWidth:d,maxHeight:u},keepAspectRatio:l,resizeDirection:f,onResizeStart:x,onResize:m,onResizeEnd:y,shouldResize:p}),()=>{var N;(N=b.current)==null||N.destroy()}},[E,a,c,d,u,l,x,m,y,p]);const A=E.split("-");return M.jsx("div",{className:ae(["react-flow__resize-control","nodrag",...A,n,r]),ref:C,style:{...o,scale:I,...i&&{[S?"backgroundColor":"borderColor"]:i}},children:s})}V.memo(ug);function sm(e,t){const n=new Map,r=(s,i)=>{let a=n.get(s);a||(a=new Set,n.set(s,a)),a.add(i)};for(const s of e)s.parentId&&r(s.parentId,s.id);for(const s of t)s.relationType==="parent_of"?r(s.from,s.to):s.relationType==="child_of"&&r(s.to,s.from);const o=new Map;for(const[s,i]of n)o.set(s,[...i]);return o}function am(e,t,n){const r=new Map,o=new Set;for(const d of e)r.set(d.id,d),o.add(d.id);const s=e.filter(d=>!d.parentId||!o.has(d.parentId)),i=[],a=new Set,c=d=>{if(a.has(d))return;a.add(d);const u=r.get(d);if(u&&i.push(u),t.has(d)){const l=n.get(d)??[];for(const f of l)c(f)}};for(const d of s)c(d.id);return i}function cm(e,t){if(e.length===0)return[];const n=new Map,r=new Set;for(const c of e)n.set(c.id,c),r.add(c.id);const o=(c,d)=>{if(d.has(c))return null;d.add(c);const u=n.get(c);if(!u)return null;const l=t.get(c)??[],f=[];for(const h of l){const p=o(h,d);p&&f.push(p)}return{node:u,children:f}},s=e.filter(c=>!c.parentId||!r.has(c.parentId)),i=new Set,a=[];for(const c of s){const d=o(c.id,i);d&&a.push(d)}return a}const lm=V.memo(function({data:t}){const n=Pt[t.nodeType]||"#6c757d",r=ir[t.status]||"#9e9e9e",o=V.useCallback(s=>{var i;s.stopPropagation(),(i=t.onExpand)==null||i.call(t,t.sourceNode.id)},[t]);return M.jsxs(M.Fragment,{children:[M.jsx(Ue,{type:"target",position:K.Top,className:"!w-2 !h-2"}),M.jsxs("div",{className:"bg-[var(--color-bg)] border border-[var(--color-border)] rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px]",children:[M.jsxs("div",{className:"p-2.5",children:[M.jsxs("div",{className:"flex items-center justify-between mb-1",children:[M.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${n}20`,color:n},children:t.nodeType}),M.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:`${r}20`,color:r},children:t.status.replace("_"," ")})]}),M.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:t.label}),M.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-[var(--color-text-muted)]",children:[M.jsxs("span",{children:["P",t.priority]}),t.xpSize&&M.jsx("span",{children:t.xpSize}),t.sprint&&M.jsx("span",{children:t.sprint})]})]}),t.hasChildren&&M.jsxs("button",{onClick:o,className:"w-full flex items-center justify-center gap-1.5 py-1.5 text-xs font-medium border-t border-[var(--color-border)] text-[var(--color-text-muted)] hover:text-[var(--color-text)] hover:bg-[var(--color-bg-tertiary)] transition-colors rounded-b-lg",title:t.isExpanded?"Collapse children":"Expand children",children:[M.jsx("span",{children:t.isExpanded?"▼":"▶"}),M.jsxs("span",{children:[t.childCount," ",t.childCount===1?"child":"children"]})]})]}),M.jsx(Ue,{type:"source",position:K.Bottom,className:"!w-2 !h-2"})]})}),um=V.memo(function({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i,targetPosition:a,data:c,style:d={}}){const[u,l,f]=Mr({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a}),h=(c==null?void 0:c.relationType)||"related_to",p=ke[h]||ke.related_to;return M.jsxs(M.Fragment,{children:[M.jsx(yt,{id:t,path:u,style:{...d,stroke:p.color,strokeDasharray:p.dashed?"5 5":void 0,strokeWidth:1.5}}),M.jsx(zp,{children:M.jsx("div",{className:"text-[9px] text-[var(--color-text-muted)] bg-[var(--color-bg)] px-1 rounded pointer-events-none absolute",style:{transform:`translate(-50%, -50%) translate(${l}px,${f}px)`},children:p.label})})]})});function dg(e,t){const n=[],r=[];for(const o of t)o.from===e&&n.push(o),o.to===e&&r.push(o);return{outgoing:n,incoming:r}}const dm=V.memo(function({node:t,edges:n=[],allNodes:r=[],childrenMap:o,onClose:s,onNodeNavigate:i}){if(!t)return null;const a=Pt[t.type]||"#6c757d",c=ir[t.status]||"#9e9e9e",d=V.useMemo(()=>dg(t.id,n),[t.id,n]),u=V.useMemo(()=>{const f=new Map;for(const h of r)f.set(h.id,h);return f},[r]),l=d.outgoing.length>0||d.incoming.length>0;return M.jsxs("div",{className:"w-80 border-l border-[var(--color-border)] bg-[var(--color-bg-secondary)] overflow-y-auto p-4",children:[M.jsxs("div",{className:"flex items-center justify-between mb-3",children:[M.jsx("h3",{className:"text-sm font-bold",children:"Node Details"}),M.jsx("button",{onClick:s,className:"text-[var(--color-text-muted)] hover:text-[var(--color-text)] text-lg leading-none",children:"×"})]}),M.jsx("h4",{className:"text-base font-semibold mb-3",children:t.title}),M.jsxs("div",{className:"space-y-2 text-sm",children:[M.jsx(Ae,{label:"ID",children:M.jsx("code",{className:"text-xs bg-[var(--color-bg-tertiary)] px-1 rounded break-all",children:t.id})}),M.jsx(Ae,{label:"Type",children:M.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{background:`${a}20`,color:a},children:t.type})}),M.jsx(Ae,{label:"Status",children:M.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium",style:{background:`${c}20`,color:c},children:t.status.replace("_"," ")})}),M.jsxs(Ae,{label:"Priority",children:["P",t.priority]}),t.xpSize&&M.jsx(Ae,{label:"Size",children:t.xpSize}),t.estimateMinutes!=null&&M.jsxs(Ae,{label:"Estimate",children:[t.estimateMinutes,"min"]}),t.sprint&&M.jsx(Ae,{label:"Sprint",children:t.sprint}),t.description&&M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsx("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Description"}),M.jsx("p",{className:"text-xs whitespace-pre-wrap",children:t.description})]}),o&&(()=>{const f=o.get(t.id)??[];return f.length===0?null:M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsxs("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:["Children (",f.length,")"]}),M.jsx("div",{className:"space-y-1",children:f.map(h=>{const p=u.get(h);if(!p)return null;const x=ir[p.status]||"#9e9e9e",m=Pt[p.type]||"#6c757d";return M.jsxs("button",{onClick:()=>i==null?void 0:i(h),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-[var(--color-bg-tertiary)] transition-colors text-xs",children:[M.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:x}}),M.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${m}20`,color:m},children:p.type}),M.jsx("span",{className:"truncate font-medium",children:p.title})]},h)})})]})})(),l&&M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsxs("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:["Relationships (",d.outgoing.length+d.incoming.length,")"]}),M.jsxs("div",{className:"space-y-1",children:[d.outgoing.map(f=>{const h=u.get(f.to),p=ke[f.relationType]||ke.related_to;return M.jsx(Ho,{direction:"out",label:p.label,color:p.color,targetTitle:(h==null?void 0:h.title)??f.to,targetId:f.to,onNavigate:i},f.id)}),d.incoming.map(f=>{const h=u.get(f.from),p=ke[f.relationType]||ke.related_to;return M.jsx(Ho,{direction:"in",label:p.label,color:p.color,targetTitle:(h==null?void 0:h.title)??f.from,targetId:f.from,onNavigate:i},f.id)})]})]}),t.acceptanceCriteria&&t.acceptanceCriteria.length>0&&M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsxs("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:["Acceptance Criteria (",t.acceptanceCriteria.length,")"]}),M.jsx("ul",{className:"text-xs space-y-1 list-disc pl-4",children:t.acceptanceCriteria.map((f,h)=>M.jsx("li",{children:f},h))})]}),t.tags&&t.tags.length>0&&M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsx("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Tags"}),M.jsx("div",{className:"flex flex-wrap gap-1",children:t.tags.map(f=>M.jsx("span",{className:"text-[10px] bg-[var(--color-bg-tertiary)] px-1.5 py-0.5 rounded",children:f},f))})]}),t.sourceRef&&M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)]",children:[M.jsx("div",{className:"text-xs font-medium text-[var(--color-text-muted)] mb-1",children:"Source"}),M.jsxs("div",{className:"text-xs",children:[t.sourceRef.file,t.sourceRef.startLine!=null&&` (L${t.sourceRef.startLine}–${t.sourceRef.endLine??"?"})`]})]}),M.jsxs("div",{className:"pt-2 border-t border-[var(--color-border)] text-[10px] text-[var(--color-text-muted)]",children:[M.jsxs("div",{children:["Created: ",new Date(t.createdAt).toLocaleString()]}),M.jsxs("div",{children:["Updated: ",new Date(t.updatedAt).toLocaleString()]})]})]})]})});function Ae({label:e,children:t}){return M.jsxs("div",{className:"flex items-start justify-between gap-2",children:[M.jsx("span",{className:"text-xs text-[var(--color-text-muted)] shrink-0",children:e}),M.jsx("div",{className:"text-right",children:t})]})}function Ho({direction:e,label:t,color:n,targetTitle:r,targetId:o,onNavigate:s}){const i=e==="out"?"→":"←";return M.jsxs("button",{onClick:()=>s==null?void 0:s(o),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-[var(--color-bg-tertiary)] transition-colors text-xs",children:[M.jsx("span",{style:{color:n},children:i}),M.jsx("span",{className:"text-[10px] text-[var(--color-text-muted)]",children:t}),M.jsx("span",{className:"truncate font-medium",children:r})]})}var fn,Bo;function Rr(){if(Bo)return fn;Bo=1;var e="\0",t="\0",n="";class r{constructor(u){ie(this,"_isDirected",!0);ie(this,"_isMultigraph",!1);ie(this,"_isCompound",!1);ie(this,"_label");ie(this,"_defaultNodeLabelFn",()=>{});ie(this,"_defaultEdgeLabelFn",()=>{});ie(this,"_nodes",{});ie(this,"_in",{});ie(this,"_preds",{});ie(this,"_out",{});ie(this,"_sucs",{});ie(this,"_edgeObjs",{});ie(this,"_edgeLabels",{});ie(this,"_nodeCount",0);ie(this,"_edgeCount",0);ie(this,"_parent");ie(this,"_children");u&&(this._isDirected=Object.hasOwn(u,"directed")?u.directed:!0,this._isMultigraph=Object.hasOwn(u,"multigraph")?u.multigraph:!1,this._isCompound=Object.hasOwn(u,"compound")?u.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[t]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(u){return this._label=u,this}graph(){return this._label}setDefaultNodeLabel(u){return this._defaultNodeLabelFn=u,typeof u!="function"&&(this._defaultNodeLabelFn=()=>u),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var u=this;return this.nodes().filter(l=>Object.keys(u._in[l]).length===0)}sinks(){var u=this;return this.nodes().filter(l=>Object.keys(u._out[l]).length===0)}setNodes(u,l){var f=arguments,h=this;return u.forEach(function(p){f.length>1?h.setNode(p,l):h.setNode(p)}),this}setNode(u,l){return Object.hasOwn(this._nodes,u)?(arguments.length>1&&(this._nodes[u]=l),this):(this._nodes[u]=arguments.length>1?l:this._defaultNodeLabelFn(u),this._isCompound&&(this._parent[u]=t,this._children[u]={},this._children[t][u]=!0),this._in[u]={},this._preds[u]={},this._out[u]={},this._sucs[u]={},++this._nodeCount,this)}node(u){return this._nodes[u]}hasNode(u){return Object.hasOwn(this._nodes,u)}removeNode(u){var l=this;if(Object.hasOwn(this._nodes,u)){var f=h=>l.removeEdge(l._edgeObjs[h]);delete this._nodes[u],this._isCompound&&(this._removeFromParentsChildList(u),delete this._parent[u],this.children(u).forEach(function(h){l.setParent(h)}),delete this._children[u]),Object.keys(this._in[u]).forEach(f),delete this._in[u],delete this._preds[u],Object.keys(this._out[u]).forEach(f),delete this._out[u],delete this._sucs[u],--this._nodeCount}return this}setParent(u,l){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(l===void 0)l=t;else{l+="";for(var f=l;f!==void 0;f=this.parent(f))if(f===u)throw new Error("Setting "+l+" as parent of "+u+" would create a cycle");this.setNode(l)}return this.setNode(u),this._removeFromParentsChildList(u),this._parent[u]=l,this._children[l][u]=!0,this}_removeFromParentsChildList(u){delete this._children[this._parent[u]][u]}parent(u){if(this._isCompound){var l=this._parent[u];if(l!==t)return l}}children(u=t){if(this._isCompound){var l=this._children[u];if(l)return Object.keys(l)}else{if(u===t)return this.nodes();if(this.hasNode(u))return[]}}predecessors(u){var l=this._preds[u];if(l)return Object.keys(l)}successors(u){var l=this._sucs[u];if(l)return Object.keys(l)}neighbors(u){var l=this.predecessors(u);if(l){const h=new Set(l);for(var f of this.successors(u))h.add(f);return Array.from(h.values())}}isLeaf(u){var l;return this.isDirected()?l=this.successors(u):l=this.neighbors(u),l.length===0}filterNodes(u){var l=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});l.setGraph(this.graph());var f=this;Object.entries(this._nodes).forEach(function([x,m]){u(x)&&l.setNode(x,m)}),Object.values(this._edgeObjs).forEach(function(x){l.hasNode(x.v)&&l.hasNode(x.w)&&l.setEdge(x,f.edge(x))});var h={};function p(x){var m=f.parent(x);return m===void 0||l.hasNode(m)?(h[x]=m,m):m in h?h[m]:p(m)}return this._isCompound&&l.nodes().forEach(x=>l.setParent(x,p(x))),l}setDefaultEdgeLabel(u){return this._defaultEdgeLabelFn=u,typeof u!="function"&&(this._defaultEdgeLabelFn=()=>u),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(u,l){var f=this,h=arguments;return u.reduce(function(p,x){return h.length>1?f.setEdge(p,x,l):f.setEdge(p,x),x}),this}setEdge(){var u,l,f,h,p=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(u=x.v,l=x.w,f=x.name,arguments.length===2&&(h=arguments[1],p=!0)):(u=x,l=arguments[1],f=arguments[3],arguments.length>2&&(h=arguments[2],p=!0)),u=""+u,l=""+l,f!==void 0&&(f=""+f);var m=i(this._isDirected,u,l,f);if(Object.hasOwn(this._edgeLabels,m))return p&&(this._edgeLabels[m]=h),this;if(f!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(u),this.setNode(l),this._edgeLabels[m]=p?h:this._defaultEdgeLabelFn(u,l,f);var y=a(this._isDirected,u,l,f);return u=y.v,l=y.w,Object.freeze(y),this._edgeObjs[m]=y,o(this._preds[l],u),o(this._sucs[u],l),this._in[l][m]=y,this._out[u][m]=y,this._edgeCount++,this}edge(u,l,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):i(this._isDirected,u,l,f);return this._edgeLabels[h]}edgeAsObj(){const u=this.edge(...arguments);return typeof u!="object"?{label:u}:u}hasEdge(u,l,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):i(this._isDirected,u,l,f);return Object.hasOwn(this._edgeLabels,h)}removeEdge(u,l,f){var h=arguments.length===1?c(this._isDirected,arguments[0]):i(this._isDirected,u,l,f),p=this._edgeObjs[h];return p&&(u=p.v,l=p.w,delete this._edgeLabels[h],delete this._edgeObjs[h],s(this._preds[l],u),s(this._sucs[u],l),delete this._in[l][h],delete this._out[u][h],this._edgeCount--),this}inEdges(u,l){var f=this._in[u];if(f){var h=Object.values(f);return l?h.filter(p=>p.v===l):h}}outEdges(u,l){var f=this._out[u];if(f){var h=Object.values(f);return l?h.filter(p=>p.w===l):h}}nodeEdges(u,l){var f=this.inEdges(u,l);if(f)return f.concat(this.outEdges(u,l))}}function o(d,u){d[u]?d[u]++:d[u]=1}function s(d,u){--d[u]||delete d[u]}function i(d,u,l,f){var h=""+u,p=""+l;if(!d&&h>p){var x=h;h=p,p=x}return h+n+p+n+(f===void 0?e:f)}function a(d,u,l,f){var h=""+u,p=""+l;if(!d&&h>p){var x=h;h=p,p=x}var m={v:h,w:p};return f&&(m.name=f),m}function c(d,u){return i(d,u.v,u.w,u.name)}return fn=r,fn}var hn,qo;function fg(){return qo||(qo=1,hn="2.2.4"),hn}var pn,Yo;function hg(){return Yo||(Yo=1,pn={Graph:Rr(),version:fg()}),pn}var gn,Go;function pg(){if(Go)return gn;Go=1;var e=Rr();gn={write:t,read:o};function t(s){var i={options:{directed:s.isDirected(),multigraph:s.isMultigraph(),compound:s.isCompound()},nodes:n(s),edges:r(s)};return s.graph()!==void 0&&(i.value=structuredClone(s.graph())),i}function n(s){return s.nodes().map(function(i){var a=s.node(i),c=s.parent(i),d={v:i};return a!==void 0&&(d.value=a),c!==void 0&&(d.parent=c),d})}function r(s){return s.edges().map(function(i){var a=s.edge(i),c={v:i.v,w:i.w};return i.name!==void 0&&(c.name=i.name),a!==void 0&&(c.value=a),c})}function o(s){var i=new e(s.options).setGraph(s.value);return s.nodes.forEach(function(a){i.setNode(a.v,a.value),a.parent&&i.setParent(a.v,a.parent)}),s.edges.forEach(function(a){i.setEdge({v:a.v,w:a.w,name:a.name},a.value)}),i}return gn}var mn,Xo;function gg(){if(Xo)return mn;Xo=1,mn=e;function e(t){var n={},r=[],o;function s(i){Object.hasOwn(n,i)||(n[i]=!0,o.push(i),t.successors(i).forEach(s),t.predecessors(i).forEach(s))}return t.nodes().forEach(function(i){o=[],s(i),o.length&&r.push(o)}),r}return mn}var yn,Wo;function xa(){if(Wo)return yn;Wo=1;class e{constructor(){ie(this,"_arr",[]);ie(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,r){var o=this._keyIndices;if(n=String(n),!Object.hasOwn(o,n)){var s=this._arr,i=s.length;return o[n]=i,s.push({key:n,priority:r}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,r){var o=this._keyIndices[n];if(r>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[o].priority+" New: "+r);this._arr[o].priority=r,this._decrease(o)}_heapify(n){var r=this._arr,o=2*n,s=o+1,i=n;o<r.length&&(i=r[o].priority<r[i].priority?o:i,s<r.length&&(i=r[s].priority<r[i].priority?s:i),i!==n&&(this._swap(n,i),this._heapify(i)))}_decrease(n){for(var r=this._arr,o=r[n].priority,s;n!==0&&(s=n>>1,!(r[s].priority<o));)this._swap(n,s),n=s}_swap(n,r){var o=this._arr,s=this._keyIndices,i=o[n],a=o[r];o[n]=a,o[r]=i,s[a.key]=n,s[i.key]=r}}return yn=e,yn}var wn,Uo;function va(){if(Uo)return wn;Uo=1;var e=xa();wn=n;var t=()=>1;function n(o,s,i,a){return r(o,String(s),i||t,a||function(c){return o.outEdges(c)})}function r(o,s,i,a){var c={},d=new e,u,l,f=function(h){var p=h.v!==u?h.v:h.w,x=c[p],m=i(h),y=l.distance+m;if(m<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+m);y<x.distance&&(x.distance=y,x.predecessor=u,d.decrease(p,y))};for(o.nodes().forEach(function(h){var p=h===s?0:Number.POSITIVE_INFINITY;c[h]={distance:p},d.add(h,p)});d.size()>0&&(u=d.removeMin(),l=c[u],l.distance!==Number.POSITIVE_INFINITY);)a(u).forEach(f);return c}return wn}var xn,Ko;function mg(){if(Ko)return xn;Ko=1;var e=va();xn=t;function t(n,r,o){return n.nodes().reduce(function(s,i){return s[i]=e(n,i,r,o),s},{})}return xn}var vn,Zo;function ba(){if(Zo)return vn;Zo=1,vn=e;function e(t){var n=0,r=[],o={},s=[];function i(a){var c=o[a]={onStack:!0,lowlink:n,index:n++};if(r.push(a),t.successors(a).forEach(function(l){Object.hasOwn(o,l)?o[l].onStack&&(c.lowlink=Math.min(c.lowlink,o[l].index)):(i(l),c.lowlink=Math.min(c.lowlink,o[l].lowlink))}),c.lowlink===c.index){var d=[],u;do u=r.pop(),o[u].onStack=!1,d.push(u);while(a!==u);s.push(d)}}return t.nodes().forEach(function(a){Object.hasOwn(o,a)||i(a)}),s}return vn}var bn,Qo;function yg(){if(Qo)return bn;Qo=1;var e=ba();bn=t;function t(n){return e(n).filter(function(r){return r.length>1||r.length===1&&n.hasEdge(r[0],r[0])})}return bn}var _n,Jo;function wg(){if(Jo)return _n;Jo=1,_n=t;var e=()=>1;function t(r,o,s){return n(r,o||e,s||function(i){return r.outEdges(i)})}function n(r,o,s){var i={},a=r.nodes();return a.forEach(function(c){i[c]={},i[c][c]={distance:0},a.forEach(function(d){c!==d&&(i[c][d]={distance:Number.POSITIVE_INFINITY})}),s(c).forEach(function(d){var u=d.v===c?d.w:d.v,l=o(d);i[c][u]={distance:l,predecessor:c}})}),a.forEach(function(c){var d=i[c];a.forEach(function(u){var l=i[u];a.forEach(function(f){var h=l[c],p=d[f],x=l[f],m=h.distance+p.distance;m<x.distance&&(x.distance=m,x.predecessor=p.predecessor)})})}),i}return _n}var En,ei;function _a(){if(ei)return En;ei=1;function e(n){var r={},o={},s=[];function i(a){if(Object.hasOwn(o,a))throw new t;Object.hasOwn(r,a)||(o[a]=!0,r[a]=!0,n.predecessors(a).forEach(i),delete o[a],s.push(a))}if(n.sinks().forEach(i),Object.keys(r).length!==n.nodeCount())throw new t;return s}class t extends Error{constructor(){super(...arguments)}}return En=e,e.CycleException=t,En}var Nn,ti;function xg(){if(ti)return Nn;ti=1;var e=_a();Nn=t;function t(n){try{e(n)}catch(r){if(r instanceof e.CycleException)return!1;throw r}return!0}return Nn}var Sn,ni;function Ea(){if(ni)return Sn;ni=1,Sn=e;function e(o,s,i){Array.isArray(s)||(s=[s]);var a=o.isDirected()?l=>o.successors(l):l=>o.neighbors(l),c=i==="post"?t:n,d=[],u={};return s.forEach(l=>{if(!o.hasNode(l))throw new Error("Graph does not have node: "+l);c(l,a,u,d)}),d}function t(o,s,i,a){for(var c=[[o,!1]];c.length>0;){var d=c.pop();d[1]?a.push(d[0]):Object.hasOwn(i,d[0])||(i[d[0]]=!0,c.push([d[0],!0]),r(s(d[0]),u=>c.push([u,!1])))}}function n(o,s,i,a){for(var c=[o];c.length>0;){var d=c.pop();Object.hasOwn(i,d)||(i[d]=!0,a.push(d),r(s(d),u=>c.push(u)))}}function r(o,s){for(var i=o.length;i--;)s(o[i],i,o);return o}return Sn}var Cn,ri;function vg(){if(ri)return Cn;ri=1;var e=Ea();Cn=t;function t(n,r){return e(n,r,"post")}return Cn}var kn,oi;function bg(){if(oi)return kn;oi=1;var e=Ea();kn=t;function t(n,r){return e(n,r,"pre")}return kn}var Mn,ii;function _g(){if(ii)return Mn;ii=1;var e=Rr(),t=xa();Mn=n;function n(r,o){var s=new e,i={},a=new t,c;function d(l){var f=l.v===c?l.w:l.v,h=a.priority(f);if(h!==void 0){var p=o(l);p<h&&(i[f]=c,a.decrease(f,p))}}if(r.nodeCount()===0)return s;r.nodes().forEach(function(l){a.add(l,Number.POSITIVE_INFINITY),s.setNode(l)}),a.decrease(r.nodes()[0],0);for(var u=!1;a.size()>0;){if(c=a.removeMin(),Object.hasOwn(i,c))s.setEdge(c,i[c]);else{if(u)throw new Error("Input graph is not connected: "+r);u=!0}r.nodeEdges(c).forEach(d)}return s}return Mn}var In,si;function Eg(){return si||(si=1,In={components:gg(),dijkstra:va(),dijkstraAll:mg(),findCycles:yg(),floydWarshall:wg(),isAcyclic:xg(),postorder:vg(),preorder:bg(),prim:_g(),tarjan:ba(),topsort:_a()}),In}var An,ai;function pe(){if(ai)return An;ai=1;var e=hg();return An={Graph:e.Graph,json:pg(),alg:Eg(),version:e.version},An}var Tn,ci;function Ng(){if(ci)return Tn;ci=1;class e{constructor(){let o={};o._next=o._prev=o,this._sentinel=o}dequeue(){let o=this._sentinel,s=o._prev;if(s!==o)return t(s),s}enqueue(o){let s=this._sentinel;o._prev&&o._next&&t(o),o._next=s._next,s._next._prev=o,s._next=o,o._prev=s}toString(){let o=[],s=this._sentinel,i=s._prev;for(;i!==s;)o.push(JSON.stringify(i,n)),i=i._prev;return"["+o.join(", ")+"]"}}function t(r){r._prev._next=r._next,r._next._prev=r._prev,delete r._next,delete r._prev}function n(r,o){if(r!=="_next"&&r!=="_prev")return o}return Tn=e,Tn}var Ln,li;function Sg(){if(li)return Ln;li=1;let e=pe().Graph,t=Ng();Ln=r;let n=()=>1;function r(d,u){if(d.nodeCount()<=1)return[];let l=i(d,u||n);return o(l.graph,l.buckets,l.zeroIdx).flatMap(h=>d.outEdges(h.v,h.w))}function o(d,u,l){let f=[],h=u[u.length-1],p=u[0],x;for(;d.nodeCount();){for(;x=p.dequeue();)s(d,u,l,x);for(;x=h.dequeue();)s(d,u,l,x);if(d.nodeCount()){for(let m=u.length-2;m>0;--m)if(x=u[m].dequeue(),x){f=f.concat(s(d,u,l,x,!0));break}}}return f}function s(d,u,l,f,h){let p=h?[]:void 0;return d.inEdges(f.v).forEach(x=>{let m=d.edge(x),y=d.node(x.v);h&&p.push({v:x.v,w:x.w}),y.out-=m,a(u,l,y)}),d.outEdges(f.v).forEach(x=>{let m=d.edge(x),y=x.w,v=d.node(y);v.in-=m,a(u,l,v)}),d.removeNode(f.v),p}function i(d,u){let l=new e,f=0,h=0;d.nodes().forEach(m=>{l.setNode(m,{v:m,in:0,out:0})}),d.edges().forEach(m=>{let y=l.edge(m.v,m.w)||0,v=u(m),g=y+v;l.setEdge(m.v,m.w,g),h=Math.max(h,l.node(m.v).out+=v),f=Math.max(f,l.node(m.w).in+=v)});let p=c(h+f+3).map(()=>new t),x=f+1;return l.nodes().forEach(m=>{a(p,x,l.node(m))}),{graph:l,buckets:p,zeroIdx:x}}function a(d,u,l){l.out?l.in?d[l.out-l.in+u].enqueue(l):d[d.length-1].enqueue(l):d[0].enqueue(l)}function c(d){const u=[];for(let l=0;l<d;l++)u.push(l);return u}return Ln}var Pn,ui;function se(){if(ui)return Pn;ui=1;let e=pe().Graph;Pn={addBorderNode:u,addDummyNode:t,applyWithChunking:h,asNonCompoundGraph:r,buildLayerMatrix:a,intersectRect:i,mapValues:S,maxRank:p,normalizeRanks:c,notime:y,partition:x,pick:C,predecessorWeights:s,range:w,removeEmptyRanks:d,simplify:n,successorWeights:o,time:m,uniqueId:g,zipObject:I};function t(b,E,A,N){for(var k=N;b.hasNode(k);)k=g(N);return A.dummy=E,b.setNode(k,A),k}function n(b){let E=new e().setGraph(b.graph());return b.nodes().forEach(A=>E.setNode(A,b.node(A))),b.edges().forEach(A=>{let N=E.edge(A.v,A.w)||{weight:0,minlen:1},k=b.edge(A);E.setEdge(A.v,A.w,{weight:N.weight+k.weight,minlen:Math.max(N.minlen,k.minlen)})}),E}function r(b){let E=new e({multigraph:b.isMultigraph()}).setGraph(b.graph());return b.nodes().forEach(A=>{b.children(A).length||E.setNode(A,b.node(A))}),b.edges().forEach(A=>{E.setEdge(A,b.edge(A))}),E}function o(b){let E=b.nodes().map(A=>{let N={};return b.outEdges(A).forEach(k=>{N[k.w]=(N[k.w]||0)+b.edge(k).weight}),N});return I(b.nodes(),E)}function s(b){let E=b.nodes().map(A=>{let N={};return b.inEdges(A).forEach(k=>{N[k.v]=(N[k.v]||0)+b.edge(k).weight}),N});return I(b.nodes(),E)}function i(b,E){let A=b.x,N=b.y,k=E.x-A,D=E.y-N,_=b.width/2,P=b.height/2;if(!k&&!D)throw new Error("Not possible to find intersection inside of the rectangle");let L,$;return Math.abs(D)*_>Math.abs(k)*P?(D<0&&(P=-P),L=P*k/D,$=P):(k<0&&(_=-_),L=_,$=_*D/k),{x:A+L,y:N+$}}function a(b){let E=w(p(b)+1).map(()=>[]);return b.nodes().forEach(A=>{let N=b.node(A),k=N.rank;k!==void 0&&(E[k][N.order]=A)}),E}function c(b){let E=b.nodes().map(N=>{let k=b.node(N).rank;return k===void 0?Number.MAX_VALUE:k}),A=h(Math.min,E);b.nodes().forEach(N=>{let k=b.node(N);Object.hasOwn(k,"rank")&&(k.rank-=A)})}function d(b){let E=b.nodes().map(_=>b.node(_).rank),A=h(Math.min,E),N=[];b.nodes().forEach(_=>{let P=b.node(_).rank-A;N[P]||(N[P]=[]),N[P].push(_)});let k=0,D=b.graph().nodeRankFactor;Array.from(N).forEach((_,P)=>{_===void 0&&P%D!==0?--k:_!==void 0&&k&&_.forEach(L=>b.node(L).rank+=k)})}function u(b,E,A,N){let k={width:0,height:0};return arguments.length>=4&&(k.rank=A,k.order=N),t(b,"border",k,E)}function l(b,E=f){const A=[];for(let N=0;N<b.length;N+=E){const k=b.slice(N,N+E);A.push(k)}return A}const f=65535;function h(b,E){if(E.length>f){const A=l(E);return b.apply(null,A.map(N=>b.apply(null,N)))}else return b.apply(null,E)}function p(b){const A=b.nodes().map(N=>{let k=b.node(N).rank;return k===void 0?Number.MIN_VALUE:k});return h(Math.max,A)}function x(b,E){let A={lhs:[],rhs:[]};return b.forEach(N=>{E(N)?A.lhs.push(N):A.rhs.push(N)}),A}function m(b,E){let A=Date.now();try{return E()}finally{console.log(b+" time: "+(Date.now()-A)+"ms")}}function y(b,E){return E()}let v=0;function g(b){var E=++v;return b+(""+E)}function w(b,E,A=1){E==null&&(E=b,b=0);let N=D=>D<E;A<0&&(N=D=>E<D);const k=[];for(let D=b;N(D);D+=A)k.push(D);return k}function C(b,E){const A={};for(const N of E)b[N]!==void 0&&(A[N]=b[N]);return A}function S(b,E){let A=E;return typeof E=="string"&&(A=N=>N[E]),Object.entries(b).reduce((N,[k,D])=>(N[k]=A(D,k),N),{})}function I(b,E){return b.reduce((A,N,k)=>(A[N]=E[k],A),{})}return Pn}var jn,di;function Cg(){if(di)return jn;di=1;let e=Sg(),t=se().uniqueId;jn={run:n,undo:o};function n(s){(s.graph().acyclicer==="greedy"?e(s,a(s)):r(s)).forEach(c=>{let d=s.edge(c);s.removeEdge(c),d.forwardName=c.name,d.reversed=!0,s.setEdge(c.w,c.v,d,t("rev"))});function a(c){return d=>c.edge(d).weight}}function r(s){let i=[],a={},c={};function d(u){Object.hasOwn(c,u)||(c[u]=!0,a[u]=!0,s.outEdges(u).forEach(l=>{Object.hasOwn(a,l.w)?i.push(l):d(l.w)}),delete a[u])}return s.nodes().forEach(d),i}function o(s){s.edges().forEach(i=>{let a=s.edge(i);if(a.reversed){s.removeEdge(i);let c=a.forwardName;delete a.reversed,delete a.forwardName,s.setEdge(i.w,i.v,a,c)}})}return jn}var On,fi;function kg(){if(fi)return On;fi=1;let e=se();On={run:t,undo:r};function t(o){o.graph().dummyChains=[],o.edges().forEach(s=>n(o,s))}function n(o,s){let i=s.v,a=o.node(i).rank,c=s.w,d=o.node(c).rank,u=s.name,l=o.edge(s),f=l.labelRank;if(d===a+1)return;o.removeEdge(s);let h,p,x;for(x=0,++a;a<d;++x,++a)l.points=[],p={width:0,height:0,edgeLabel:l,edgeObj:s,rank:a},h=e.addDummyNode(o,"edge",p,"_d"),a===f&&(p.width=l.width,p.height=l.height,p.dummy="edge-label",p.labelpos=l.labelpos),o.setEdge(i,h,{weight:l.weight},u),x===0&&o.graph().dummyChains.push(h),i=h;o.setEdge(i,c,{weight:l.weight},u)}function r(o){o.graph().dummyChains.forEach(s=>{let i=o.node(s),a=i.edgeLabel,c;for(o.setEdge(i.edgeObj,a);i.dummy;)c=o.successors(s)[0],o.removeNode(s),a.points.push({x:i.x,y:i.y}),i.dummy==="edge-label"&&(a.x=i.x,a.y=i.y,a.width=i.width,a.height=i.height),s=c,i=o.node(s)})}return On}var Rn,hi;function Ht(){if(hi)return Rn;hi=1;const{applyWithChunking:e}=se();Rn={longestPath:t,slack:n};function t(r){var o={};function s(i){var a=r.node(i);if(Object.hasOwn(o,i))return a.rank;o[i]=!0;let c=r.outEdges(i).map(u=>u==null?Number.POSITIVE_INFINITY:s(u.w)-r.edge(u).minlen);var d=e(Math.min,c);return d===Number.POSITIVE_INFINITY&&(d=0),a.rank=d}r.sources().forEach(s)}function n(r,o){return r.node(o.w).rank-r.node(o.v).rank-r.edge(o).minlen}return Rn}var Dn,pi;function Na(){if(pi)return Dn;pi=1;var e=pe().Graph,t=Ht().slack;Dn=n;function n(i){var a=new e({directed:!1}),c=i.nodes()[0],d=i.nodeCount();a.setNode(c,{});for(var u,l;r(a,i)<d;)u=o(a,i),l=a.hasNode(u.v)?t(i,u):-t(i,u),s(a,i,l);return a}function r(i,a){function c(d){a.nodeEdges(d).forEach(u=>{var l=u.v,f=d===l?u.w:l;!i.hasNode(f)&&!t(a,u)&&(i.setNode(f,{}),i.setEdge(d,f,{}),c(f))})}return i.nodes().forEach(c),i.nodeCount()}function o(i,a){return a.edges().reduce((d,u)=>{let l=Number.POSITIVE_INFINITY;return i.hasNode(u.v)!==i.hasNode(u.w)&&(l=t(a,u)),l<d[0]?[l,u]:d},[Number.POSITIVE_INFINITY,null])[1]}function s(i,a,c){i.nodes().forEach(d=>a.node(d).rank+=c)}return Dn}var $n,gi;function Mg(){if(gi)return $n;gi=1;var e=Na(),t=Ht().slack,n=Ht().longestPath,r=pe().alg.preorder,o=pe().alg.postorder,s=se().simplify;$n=i,i.initLowLimValues=u,i.initCutValues=a,i.calcCutValue=d,i.leaveEdge=f,i.enterEdge=h,i.exchangeEdges=p;function i(v){v=s(v),n(v);var g=e(v);u(g),a(g,v);for(var w,C;w=f(g);)C=h(g,v,w),p(g,v,w,C)}function a(v,g){var w=o(v,v.nodes());w=w.slice(0,w.length-1),w.forEach(C=>c(v,g,C))}function c(v,g,w){var C=v.node(w),S=C.parent;v.edge(w,S).cutvalue=d(v,g,w)}function d(v,g,w){var C=v.node(w),S=C.parent,I=!0,b=g.edge(w,S),E=0;return b||(I=!1,b=g.edge(S,w)),E=b.weight,g.nodeEdges(w).forEach(A=>{var N=A.v===w,k=N?A.w:A.v;if(k!==S){var D=N===I,_=g.edge(A).weight;if(E+=D?_:-_,m(v,w,k)){var P=v.edge(w,k).cutvalue;E+=D?-P:P}}}),E}function u(v,g){arguments.length<2&&(g=v.nodes()[0]),l(v,{},1,g)}function l(v,g,w,C,S){var I=w,b=v.node(C);return g[C]=!0,v.neighbors(C).forEach(E=>{Object.hasOwn(g,E)||(w=l(v,g,w,E,C))}),b.low=I,b.lim=w++,S?b.parent=S:delete b.parent,w}function f(v){return v.edges().find(g=>v.edge(g).cutvalue<0)}function h(v,g,w){var C=w.v,S=w.w;g.hasEdge(C,S)||(C=w.w,S=w.v);var I=v.node(C),b=v.node(S),E=I,A=!1;I.lim>b.lim&&(E=b,A=!0);var N=g.edges().filter(k=>A===y(v,v.node(k.v),E)&&A!==y(v,v.node(k.w),E));return N.reduce((k,D)=>t(g,D)<t(g,k)?D:k)}function p(v,g,w,C){var S=w.v,I=w.w;v.removeEdge(S,I),v.setEdge(C.v,C.w,{}),u(v),a(v,g),x(v,g)}function x(v,g){var w=v.nodes().find(S=>!g.node(S).parent),C=r(v,w);C=C.slice(1),C.forEach(S=>{var I=v.node(S).parent,b=g.edge(S,I),E=!1;b||(b=g.edge(I,S),E=!0),g.node(S).rank=g.node(I).rank+(E?b.minlen:-b.minlen)})}function m(v,g,w){return v.hasEdge(g,w)}function y(v,g,w){return w.low<=g.lim&&g.lim<=w.lim}return $n}var zn,mi;function Ig(){if(mi)return zn;mi=1;var e=Ht(),t=e.longestPath,n=Na(),r=Mg();zn=o;function o(c){var d=c.graph().ranker;if(d instanceof Function)return d(c);switch(c.graph().ranker){case"network-simplex":a(c);break;case"tight-tree":i(c);break;case"longest-path":s(c);break;case"none":break;default:a(c)}}var s=t;function i(c){t(c),n(c)}function a(c){r(c)}return zn}var Vn,yi;function Ag(){if(yi)return Vn;yi=1,Vn=e;function e(r){let o=n(r);r.graph().dummyChains.forEach(s=>{let i=r.node(s),a=i.edgeObj,c=t(r,o,a.v,a.w),d=c.path,u=c.lca,l=0,f=d[l],h=!0;for(;s!==a.w;){if(i=r.node(s),h){for(;(f=d[l])!==u&&r.node(f).maxRank<i.rank;)l++;f===u&&(h=!1)}if(!h){for(;l<d.length-1&&r.node(f=d[l+1]).minRank<=i.rank;)l++;f=d[l]}r.setParent(s,f),s=r.successors(s)[0]}})}function t(r,o,s,i){let a=[],c=[],d=Math.min(o[s].low,o[i].low),u=Math.max(o[s].lim,o[i].lim),l,f;l=s;do l=r.parent(l),a.push(l);while(l&&(o[l].low>d||u>o[l].lim));for(f=l,l=i;(l=r.parent(l))!==f;)c.push(l);return{path:a.concat(c.reverse()),lca:f}}function n(r){let o={},s=0;function i(a){let c=s;r.children(a).forEach(i),o[a]={low:c,lim:s++}}return r.children().forEach(i),o}return Vn}var Fn,wi;function Tg(){if(wi)return Fn;wi=1;let e=se();Fn={run:t,cleanup:s};function t(i){let a=e.addDummyNode(i,"root",{},"_root"),c=r(i),d=Object.values(c),u=e.applyWithChunking(Math.max,d)-1,l=2*u+1;i.graph().nestingRoot=a,i.edges().forEach(h=>i.edge(h).minlen*=l);let f=o(i)+1;i.children().forEach(h=>n(i,a,l,f,u,c,h)),i.graph().nodeRankFactor=l}function n(i,a,c,d,u,l,f){let h=i.children(f);if(!h.length){f!==a&&i.setEdge(a,f,{weight:0,minlen:c});return}let p=e.addBorderNode(i,"_bt"),x=e.addBorderNode(i,"_bb"),m=i.node(f);i.setParent(p,f),m.borderTop=p,i.setParent(x,f),m.borderBottom=x,h.forEach(y=>{n(i,a,c,d,u,l,y);let v=i.node(y),g=v.borderTop?v.borderTop:y,w=v.borderBottom?v.borderBottom:y,C=v.borderTop?d:2*d,S=g!==w?1:u-l[f]+1;i.setEdge(p,g,{weight:C,minlen:S,nestingEdge:!0}),i.setEdge(w,x,{weight:C,minlen:S,nestingEdge:!0})}),i.parent(f)||i.setEdge(a,p,{weight:0,minlen:u+l[f]})}function r(i){var a={};function c(d,u){var l=i.children(d);l&&l.length&&l.forEach(f=>c(f,u+1)),a[d]=u}return i.children().forEach(d=>c(d,1)),a}function o(i){return i.edges().reduce((a,c)=>a+i.edge(c).weight,0)}function s(i){var a=i.graph();i.removeNode(a.nestingRoot),delete a.nestingRoot,i.edges().forEach(c=>{var d=i.edge(c);d.nestingEdge&&i.removeEdge(c)})}return Fn}var Hn,xi;function Lg(){if(xi)return Hn;xi=1;let e=se();Hn=t;function t(r){function o(s){let i=r.children(s),a=r.node(s);if(i.length&&i.forEach(o),Object.hasOwn(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(let c=a.minRank,d=a.maxRank+1;c<d;++c)n(r,"borderLeft","_bl",s,a,c),n(r,"borderRight","_br",s,a,c)}}r.children().forEach(o)}function n(r,o,s,i,a,c){let d={width:0,height:0,rank:c,borderType:o},u=a[o][c-1],l=e.addDummyNode(r,"border",d,s);a[o][c]=l,r.setParent(l,i),u&&r.setEdge(u,l,{weight:1})}return Hn}var Bn,vi;function Pg(){if(vi)return Bn;vi=1,Bn={adjust:e,undo:t};function e(c){let d=c.graph().rankdir.toLowerCase();(d==="lr"||d==="rl")&&n(c)}function t(c){let d=c.graph().rankdir.toLowerCase();(d==="bt"||d==="rl")&&o(c),(d==="lr"||d==="rl")&&(i(c),n(c))}function n(c){c.nodes().forEach(d=>r(c.node(d))),c.edges().forEach(d=>r(c.edge(d)))}function r(c){let d=c.width;c.width=c.height,c.height=d}function o(c){c.nodes().forEach(d=>s(c.node(d))),c.edges().forEach(d=>{let u=c.edge(d);u.points.forEach(s),Object.hasOwn(u,"y")&&s(u)})}function s(c){c.y=-c.y}function i(c){c.nodes().forEach(d=>a(c.node(d))),c.edges().forEach(d=>{let u=c.edge(d);u.points.forEach(a),Object.hasOwn(u,"x")&&a(u)})}function a(c){let d=c.x;c.x=c.y,c.y=d}return Bn}var qn,bi;function jg(){if(bi)return qn;bi=1;let e=se();qn=t;function t(n){let r={},o=n.nodes().filter(u=>!n.children(u).length),s=o.map(u=>n.node(u).rank),i=e.applyWithChunking(Math.max,s),a=e.range(i+1).map(()=>[]);function c(u){if(r[u])return;r[u]=!0;let l=n.node(u);a[l.rank].push(u),n.successors(u).forEach(c)}return o.sort((u,l)=>n.node(u).rank-n.node(l).rank).forEach(c),a}return qn}var Yn,_i;function Og(){if(_i)return Yn;_i=1;let e=se().zipObject;Yn=t;function t(r,o){let s=0;for(let i=1;i<o.length;++i)s+=n(r,o[i-1],o[i]);return s}function n(r,o,s){let i=e(s,s.map((f,h)=>h)),a=o.flatMap(f=>r.outEdges(f).map(h=>({pos:i[h.w],weight:r.edge(h).weight})).sort((h,p)=>h.pos-p.pos)),c=1;for(;c<s.length;)c<<=1;let d=2*c-1;c-=1;let u=new Array(d).fill(0),l=0;return a.forEach(f=>{let h=f.pos+c;u[h]+=f.weight;let p=0;for(;h>0;)h%2&&(p+=u[h+1]),h=h-1>>1,u[h]+=f.weight;l+=f.weight*p}),l}return Yn}var Gn,Ei;function Rg(){if(Ei)return Gn;Ei=1,Gn=e;function e(t,n=[]){return n.map(r=>{let o=t.inEdges(r);if(o.length){let s=o.reduce((i,a)=>{let c=t.edge(a),d=t.node(a.v);return{sum:i.sum+c.weight*d.order,weight:i.weight+c.weight}},{sum:0,weight:0});return{v:r,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:r}})}return Gn}var Xn,Ni;function Dg(){if(Ni)return Xn;Ni=1;let e=se();Xn=t;function t(o,s){let i={};o.forEach((c,d)=>{let u=i[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:d};c.barycenter!==void 0&&(u.barycenter=c.barycenter,u.weight=c.weight)}),s.edges().forEach(c=>{let d=i[c.v],u=i[c.w];d!==void 0&&u!==void 0&&(u.indegree++,d.out.push(i[c.w]))});let a=Object.values(i).filter(c=>!c.indegree);return n(a)}function n(o){let s=[];function i(c){return d=>{d.merged||(d.barycenter===void 0||c.barycenter===void 0||d.barycenter>=c.barycenter)&&r(c,d)}}function a(c){return d=>{d.in.push(c),--d.indegree===0&&o.push(d)}}for(;o.length;){let c=o.pop();s.push(c),c.in.reverse().forEach(i(c)),c.out.forEach(a(c))}return s.filter(c=>!c.merged).map(c=>e.pick(c,["vs","i","barycenter","weight"]))}function r(o,s){let i=0,a=0;o.weight&&(i+=o.barycenter*o.weight,a+=o.weight),s.weight&&(i+=s.barycenter*s.weight,a+=s.weight),o.vs=s.vs.concat(o.vs),o.barycenter=i/a,o.weight=a,o.i=Math.min(s.i,o.i),s.merged=!0}return Xn}var Wn,Si;function $g(){if(Si)return Wn;Si=1;let e=se();Wn=t;function t(o,s){let i=e.partition(o,p=>Object.hasOwn(p,"barycenter")),a=i.lhs,c=i.rhs.sort((p,x)=>x.i-p.i),d=[],u=0,l=0,f=0;a.sort(r(!!s)),f=n(d,c,f),a.forEach(p=>{f+=p.vs.length,d.push(p.vs),u+=p.barycenter*p.weight,l+=p.weight,f=n(d,c,f)});let h={vs:d.flat(!0)};return l&&(h.barycenter=u/l,h.weight=l),h}function n(o,s,i){let a;for(;s.length&&(a=s[s.length-1]).i<=i;)s.pop(),o.push(a.vs),i++;return i}function r(o){return(s,i)=>s.barycenter<i.barycenter?-1:s.barycenter>i.barycenter?1:o?i.i-s.i:s.i-i.i}return Wn}var Un,Ci;function zg(){if(Ci)return Un;Ci=1;let e=Rg(),t=Dg(),n=$g();Un=r;function r(i,a,c,d){let u=i.children(a),l=i.node(a),f=l?l.borderLeft:void 0,h=l?l.borderRight:void 0,p={};f&&(u=u.filter(v=>v!==f&&v!==h));let x=e(i,u);x.forEach(v=>{if(i.children(v.v).length){let g=r(i,v.v,c,d);p[v.v]=g,Object.hasOwn(g,"barycenter")&&s(v,g)}});let m=t(x,c);o(m,p);let y=n(m,d);if(f&&(y.vs=[f,y.vs,h].flat(!0),i.predecessors(f).length)){let v=i.node(i.predecessors(f)[0]),g=i.node(i.predecessors(h)[0]);Object.hasOwn(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+v.order+g.order)/(y.weight+2),y.weight+=2}return y}function o(i,a){i.forEach(c=>{c.vs=c.vs.flatMap(d=>a[d]?a[d].vs:d)})}function s(i,a){i.barycenter!==void 0?(i.barycenter=(i.barycenter*i.weight+a.barycenter*a.weight)/(i.weight+a.weight),i.weight+=a.weight):(i.barycenter=a.barycenter,i.weight=a.weight)}return Un}var Kn,ki;function Vg(){if(ki)return Kn;ki=1;let e=pe().Graph,t=se();Kn=n;function n(o,s,i,a){a||(a=o.nodes());let c=r(o),d=new e({compound:!0}).setGraph({root:c}).setDefaultNodeLabel(u=>o.node(u));return a.forEach(u=>{let l=o.node(u),f=o.parent(u);(l.rank===s||l.minRank<=s&&s<=l.maxRank)&&(d.setNode(u),d.setParent(u,f||c),o[i](u).forEach(h=>{let p=h.v===u?h.w:h.v,x=d.edge(p,u),m=x!==void 0?x.weight:0;d.setEdge(p,u,{weight:o.edge(h).weight+m})}),Object.hasOwn(l,"minRank")&&d.setNode(u,{borderLeft:l.borderLeft[s],borderRight:l.borderRight[s]}))}),d}function r(o){for(var s;o.hasNode(s=t.uniqueId("_root")););return s}return Kn}var Zn,Mi;function Fg(){if(Mi)return Zn;Mi=1,Zn=e;function e(t,n,r){let o={},s;r.forEach(i=>{let a=t.parent(i),c,d;for(;a;){if(c=t.parent(a),c?(d=o[c],o[c]=a):(d=s,s=a),d&&d!==a){n.setEdge(d,a);return}a=c}})}return Zn}var Qn,Ii;function Hg(){if(Ii)return Qn;Ii=1;let e=jg(),t=Og(),n=zg(),r=Vg(),o=Fg(),s=pe().Graph,i=se();Qn=a;function a(l,f){if(f&&typeof f.customOrder=="function"){f.customOrder(l,a);return}let h=i.maxRank(l),p=c(l,i.range(1,h+1),"inEdges"),x=c(l,i.range(h-1,-1,-1),"outEdges"),m=e(l);if(u(l,m),f&&f.disableOptimalOrderHeuristic)return;let y=Number.POSITIVE_INFINITY,v;for(let g=0,w=0;w<4;++g,++w){d(g%2?p:x,g%4>=2),m=i.buildLayerMatrix(l);let C=t(l,m);C<y&&(w=0,v=Object.assign({},m),y=C)}u(l,v)}function c(l,f,h){const p=new Map,x=(m,y)=>{p.has(m)||p.set(m,[]),p.get(m).push(y)};for(const m of l.nodes()){const y=l.node(m);if(typeof y.rank=="number"&&x(y.rank,m),typeof y.minRank=="number"&&typeof y.maxRank=="number")for(let v=y.minRank;v<=y.maxRank;v++)v!==y.rank&&x(v,m)}return f.map(function(m){return r(l,m,h,p.get(m)||[])})}function d(l,f){let h=new s;l.forEach(function(p){let x=p.graph().root,m=n(p,x,h,f);m.vs.forEach((y,v)=>p.node(y).order=v),o(p,h,m.vs)})}function u(l,f){Object.values(f).forEach(h=>h.forEach((p,x)=>l.node(p).order=x))}return Qn}var Jn,Ai;function Bg(){if(Ai)return Jn;Ai=1;let e=pe().Graph,t=se();Jn={positionX:h,findType1Conflicts:n,findType2Conflicts:r,addConflict:s,hasConflict:i,verticalAlignment:a,horizontalCompaction:c,alignCoordinates:l,findSmallestWidthAlignment:u,balance:f};function n(m,y){let v={};function g(w,C){let S=0,I=0,b=w.length,E=C[C.length-1];return C.forEach((A,N)=>{let k=o(m,A),D=k?m.node(k).order:b;(k||A===E)&&(C.slice(I,N+1).forEach(_=>{m.predecessors(_).forEach(P=>{let L=m.node(P),$=L.order;($<S||D<$)&&!(L.dummy&&m.node(_).dummy)&&s(v,P,_)})}),I=N+1,S=D)}),C}return y.length&&y.reduce(g),v}function r(m,y){let v={};function g(C,S,I,b,E){let A;t.range(S,I).forEach(N=>{A=C[N],m.node(A).dummy&&m.predecessors(A).forEach(k=>{let D=m.node(k);D.dummy&&(D.order<b||D.order>E)&&s(v,k,A)})})}function w(C,S){let I=-1,b,E=0;return S.forEach((A,N)=>{if(m.node(A).dummy==="border"){let k=m.predecessors(A);k.length&&(b=m.node(k[0]).order,g(S,E,N,I,b),E=N,I=b)}g(S,E,S.length,b,C.length)}),S}return y.length&&y.reduce(w),v}function o(m,y){if(m.node(y).dummy)return m.predecessors(y).find(v=>m.node(v).dummy)}function s(m,y,v){if(y>v){let w=y;y=v,v=w}let g=m[y];g||(m[y]=g={}),g[v]=!0}function i(m,y,v){if(y>v){let g=y;y=v,v=g}return!!m[y]&&Object.hasOwn(m[y],v)}function a(m,y,v,g){let w={},C={},S={};return y.forEach(I=>{I.forEach((b,E)=>{w[b]=b,C[b]=b,S[b]=E})}),y.forEach(I=>{let b=-1;I.forEach(E=>{let A=g(E);if(A.length){A=A.sort((k,D)=>S[k]-S[D]);let N=(A.length-1)/2;for(let k=Math.floor(N),D=Math.ceil(N);k<=D;++k){let _=A[k];C[E]===E&&b<S[_]&&!i(v,E,_)&&(C[_]=E,C[E]=w[E]=w[_],b=S[_])}}})}),{root:w,align:C}}function c(m,y,v,g,w){let C={},S=d(m,y,v,w),I=w?"borderLeft":"borderRight";function b(N,k){let D=S.nodes(),_=D.pop(),P={};for(;_;)P[_]?N(_):(P[_]=!0,D.push(_),D=D.concat(k(_))),_=D.pop()}function E(N){C[N]=S.inEdges(N).reduce((k,D)=>Math.max(k,C[D.v]+S.edge(D)),0)}function A(N){let k=S.outEdges(N).reduce((_,P)=>Math.min(_,C[P.w]-S.edge(P)),Number.POSITIVE_INFINITY),D=m.node(N);k!==Number.POSITIVE_INFINITY&&D.borderType!==I&&(C[N]=Math.max(C[N],k))}return b(E,S.predecessors.bind(S)),b(A,S.successors.bind(S)),Object.keys(g).forEach(N=>C[N]=C[v[N]]),C}function d(m,y,v,g){let w=new e,C=m.graph(),S=p(C.nodesep,C.edgesep,g);return y.forEach(I=>{let b;I.forEach(E=>{let A=v[E];if(w.setNode(A),b){var N=v[b],k=w.edge(N,A);w.setEdge(N,A,Math.max(S(m,E,b),k||0))}b=E})}),w}function u(m,y){return Object.values(y).reduce((v,g)=>{let w=Number.NEGATIVE_INFINITY,C=Number.POSITIVE_INFINITY;Object.entries(g).forEach(([I,b])=>{let E=x(m,I)/2;w=Math.max(b+E,w),C=Math.min(b-E,C)});const S=w-C;return S<v[0]&&(v=[S,g]),v},[Number.POSITIVE_INFINITY,null])[1]}function l(m,y){let v=Object.values(y),g=t.applyWithChunking(Math.min,v),w=t.applyWithChunking(Math.max,v);["u","d"].forEach(C=>{["l","r"].forEach(S=>{let I=C+S,b=m[I];if(b===y)return;let E=Object.values(b),A=g-t.applyWithChunking(Math.min,E);S!=="l"&&(A=w-t.applyWithChunking(Math.max,E)),A&&(m[I]=t.mapValues(b,N=>N+A))})})}function f(m,y){return t.mapValues(m.ul,(v,g)=>{if(y)return m[y.toLowerCase()][g];{let w=Object.values(m).map(C=>C[g]).sort((C,S)=>C-S);return(w[1]+w[2])/2}})}function h(m){let y=t.buildLayerMatrix(m),v=Object.assign(n(m,y),r(m,y)),g={},w;["u","d"].forEach(S=>{w=S==="u"?y:Object.values(y).reverse(),["l","r"].forEach(I=>{I==="r"&&(w=w.map(N=>Object.values(N).reverse()));let b=(S==="u"?m.predecessors:m.successors).bind(m),E=a(m,w,v,b),A=c(m,w,E.root,E.align,I==="r");I==="r"&&(A=t.mapValues(A,N=>-N)),g[S+I]=A})});let C=u(m,g);return l(g,C),f(g,m.graph().align)}function p(m,y,v){return(g,w,C)=>{let S=g.node(w),I=g.node(C),b=0,E;if(b+=S.width/2,Object.hasOwn(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":E=-S.width/2;break;case"r":E=S.width/2;break}if(E&&(b+=v?E:-E),E=0,b+=(S.dummy?y:m)/2,b+=(I.dummy?y:m)/2,b+=I.width/2,Object.hasOwn(I,"labelpos"))switch(I.labelpos.toLowerCase()){case"l":E=I.width/2;break;case"r":E=-I.width/2;break}return E&&(b+=v?E:-E),E=0,b}}function x(m,y){return m.node(y).width}return Jn}var er,Ti;function qg(){if(Ti)return er;Ti=1;let e=se(),t=Bg().positionX;er=n;function n(o){o=e.asNonCompoundGraph(o),r(o),Object.entries(t(o)).forEach(([s,i])=>o.node(s).x=i)}function r(o){let s=e.buildLayerMatrix(o),i=o.graph().ranksep,a=0;s.forEach(c=>{const d=c.reduce((u,l)=>{const f=o.node(l).height;return u>f?u:f},0);c.forEach(u=>o.node(u).y=a+d/2),a+=d+i})}return er}var tr,Li;function Yg(){if(Li)return tr;Li=1;let e=Cg(),t=kg(),n=Ig(),r=se().normalizeRanks,o=Ag(),s=se().removeEmptyRanks,i=Tg(),a=Lg(),c=Pg(),d=Hg(),u=qg(),l=se(),f=pe().Graph;tr=h;function h(T,O){let z=O&&O.debugTiming?l.time:l.notime;z("layout",()=>{let B=z(" buildLayoutGraph",()=>b(T));z(" runLayout",()=>p(B,z,O)),z(" updateInputGraph",()=>x(T,B))})}function p(T,O,z){O(" makeSpaceForEdgeLabels",()=>E(T)),O(" removeSelfEdges",()=>R(T)),O(" acyclic",()=>e.run(T)),O(" nestingGraph.run",()=>i.run(T)),O(" rank",()=>n(l.asNonCompoundGraph(T))),O(" injectEdgeLabelProxies",()=>A(T)),O(" removeEmptyRanks",()=>s(T)),O(" nestingGraph.cleanup",()=>i.cleanup(T)),O(" normalizeRanks",()=>r(T)),O(" assignRankMinMax",()=>N(T)),O(" removeEdgeLabelProxies",()=>k(T)),O(" normalize.run",()=>t.run(T)),O(" parentDummyChains",()=>o(T)),O(" addBorderSegments",()=>a(T)),O(" order",()=>d(T,z)),O(" insertSelfEdges",()=>j(T)),O(" adjustCoordinateSystem",()=>c.adjust(T)),O(" position",()=>u(T)),O(" positionSelfEdges",()=>F(T)),O(" removeBorderNodes",()=>$(T)),O(" normalize.undo",()=>t.undo(T)),O(" fixupEdgeLabelCoords",()=>P(T)),O(" undoCoordinateSystem",()=>c.undo(T)),O(" translateGraph",()=>D(T)),O(" assignNodeIntersects",()=>_(T)),O(" reversePoints",()=>L(T)),O(" acyclic.undo",()=>e.undo(T))}function x(T,O){T.nodes().forEach(z=>{let B=T.node(z),G=O.node(z);B&&(B.x=G.x,B.y=G.y,B.rank=G.rank,O.children(z).length&&(B.width=G.width,B.height=G.height))}),T.edges().forEach(z=>{let B=T.edge(z),G=O.edge(z);B.points=G.points,Object.hasOwn(G,"x")&&(B.x=G.x,B.y=G.y)}),T.graph().width=O.graph().width,T.graph().height=O.graph().height}let m=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},v=["acyclicer","ranker","rankdir","align"],g=["width","height","rank"],w={width:0,height:0},C=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},I=["labelpos"];function b(T){let O=new f({multigraph:!0,compound:!0}),z=H(T.graph());return O.setGraph(Object.assign({},y,q(z,m),l.pick(z,v))),T.nodes().forEach(B=>{let G=H(T.node(B));const Y=q(G,g);Object.keys(w).forEach(X=>{Y[X]===void 0&&(Y[X]=w[X])}),O.setNode(B,Y),O.setParent(B,T.parent(B))}),T.edges().forEach(B=>{let G=H(T.edge(B));O.setEdge(B,Object.assign({},S,q(G,C),l.pick(G,I)))}),O}function E(T){let O=T.graph();O.ranksep/=2,T.edges().forEach(z=>{let B=T.edge(z);B.minlen*=2,B.labelpos.toLowerCase()!=="c"&&(O.rankdir==="TB"||O.rankdir==="BT"?B.width+=B.labeloffset:B.height+=B.labeloffset)})}function A(T){T.edges().forEach(O=>{let z=T.edge(O);if(z.width&&z.height){let B=T.node(O.v),Y={rank:(T.node(O.w).rank-B.rank)/2+B.rank,e:O};l.addDummyNode(T,"edge-proxy",Y,"_ep")}})}function N(T){let O=0;T.nodes().forEach(z=>{let B=T.node(z);B.borderTop&&(B.minRank=T.node(B.borderTop).rank,B.maxRank=T.node(B.borderBottom).rank,O=Math.max(O,B.maxRank))}),T.graph().maxRank=O}function k(T){T.nodes().forEach(O=>{let z=T.node(O);z.dummy==="edge-proxy"&&(T.edge(z.e).labelRank=z.rank,T.removeNode(O))})}function D(T){let O=Number.POSITIVE_INFINITY,z=0,B=Number.POSITIVE_INFINITY,G=0,Y=T.graph(),X=Y.marginx||0,Z=Y.marginy||0;function Q(U){let W=U.x,J=U.y,ne=U.width,ee=U.height;O=Math.min(O,W-ne/2),z=Math.max(z,W+ne/2),B=Math.min(B,J-ee/2),G=Math.max(G,J+ee/2)}T.nodes().forEach(U=>Q(T.node(U))),T.edges().forEach(U=>{let W=T.edge(U);Object.hasOwn(W,"x")&&Q(W)}),O-=X,B-=Z,T.nodes().forEach(U=>{let W=T.node(U);W.x-=O,W.y-=B}),T.edges().forEach(U=>{let W=T.edge(U);W.points.forEach(J=>{J.x-=O,J.y-=B}),Object.hasOwn(W,"x")&&(W.x-=O),Object.hasOwn(W,"y")&&(W.y-=B)}),Y.width=z-O+X,Y.height=G-B+Z}function _(T){T.edges().forEach(O=>{let z=T.edge(O),B=T.node(O.v),G=T.node(O.w),Y,X;z.points?(Y=z.points[0],X=z.points[z.points.length-1]):(z.points=[],Y=G,X=B),z.points.unshift(l.intersectRect(B,Y)),z.points.push(l.intersectRect(G,X))})}function P(T){T.edges().forEach(O=>{let z=T.edge(O);if(Object.hasOwn(z,"x"))switch((z.labelpos==="l"||z.labelpos==="r")&&(z.width-=z.labeloffset),z.labelpos){case"l":z.x-=z.width/2+z.labeloffset;break;case"r":z.x+=z.width/2+z.labeloffset;break}})}function L(T){T.edges().forEach(O=>{let z=T.edge(O);z.reversed&&z.points.reverse()})}function $(T){T.nodes().forEach(O=>{if(T.children(O).length){let z=T.node(O),B=T.node(z.borderTop),G=T.node(z.borderBottom),Y=T.node(z.borderLeft[z.borderLeft.length-1]),X=T.node(z.borderRight[z.borderRight.length-1]);z.width=Math.abs(X.x-Y.x),z.height=Math.abs(G.y-B.y),z.x=Y.x+z.width/2,z.y=B.y+z.height/2}}),T.nodes().forEach(O=>{T.node(O).dummy==="border"&&T.removeNode(O)})}function R(T){T.edges().forEach(O=>{if(O.v===O.w){var z=T.node(O.v);z.selfEdges||(z.selfEdges=[]),z.selfEdges.push({e:O,label:T.edge(O)}),T.removeEdge(O)}})}function j(T){var O=l.buildLayerMatrix(T);O.forEach(z=>{var B=0;z.forEach((G,Y)=>{var X=T.node(G);X.order=Y+B,(X.selfEdges||[]).forEach(Z=>{l.addDummyNode(T,"selfedge",{width:Z.label.width,height:Z.label.height,rank:X.rank,order:Y+ ++B,e:Z.e,label:Z.label},"_se")}),delete X.selfEdges})})}function F(T){T.nodes().forEach(O=>{var z=T.node(O);if(z.dummy==="selfedge"){var B=T.node(z.e.v),G=B.x+B.width/2,Y=B.y,X=z.x-G,Z=B.height/2;T.setEdge(z.e,z.label),T.removeNode(O),z.label.points=[{x:G+2*X/3,y:Y-Z},{x:G+5*X/6,y:Y-Z},{x:G+X,y:Y},{x:G+5*X/6,y:Y+Z},{x:G+2*X/3,y:Y+Z}],z.label.x=z.x,z.label.y=z.y}})}function q(T,O){return l.mapValues(l.pick(T,O),Number)}function H(T){var O={};return T&&Object.entries(T).forEach(([z,B])=>{typeof z=="string"&&(z=z.toLowerCase()),O[z]=B}),O}return tr}var nr,Pi;function Gg(){if(Pi)return nr;Pi=1;let e=se(),t=pe().Graph;nr={debugOrdering:n};function n(r){let o=e.buildLayerMatrix(r),s=new t({compound:!0,multigraph:!0}).setGraph({});return r.nodes().forEach(i=>{s.setNode(i,{label:i}),s.setParent(i,"layer"+r.node(i).rank)}),r.edges().forEach(i=>s.setEdge(i.v,i.w,{},i.name)),o.forEach((i,a)=>{let c="layer"+a;s.setNode(c,{rank:"same"}),i.reduce((d,u)=>(s.setEdge(d,u,{style:"invis"}),u))}),s}return nr}var rr,ji;function Xg(){return ji||(ji=1,rr="1.1.8"),rr}var or,Oi;function Wg(){return Oi||(Oi=1,or={graphlib:pe(),layout:Yg(),debug:Gg(),util:{time:se().time,notime:se().notime},version:Xg()}),or}var Ug=Wg();const Ri=Tc(Ug),wr=240,Di=80;function fm(e,t,n,r,o){return e.filter(s=>{var i,a;return!((i=t==null?void 0:t.statuses)!=null&&i.size&&!t.statuses.has(s.status)||(a=t==null?void 0:t.types)!=null&&a.size&&!t.types.has(s.type))}).map(s=>{const i=n==null?void 0:n.get(s.id),a=i!=null&&i.length>0;return{id:s.id,type:"workflowNode",position:{x:0,y:0},data:{label:s.title,nodeType:s.type,status:s.status,priority:s.priority,xpSize:s.xpSize,sprint:s.sprint,sourceNode:s,hasChildren:a,isExpanded:(r==null?void 0:r.has(s.id))??!1,childCount:(i==null?void 0:i.length)??0,onExpand:o},style:{width:wr,borderLeft:`4px solid ${Pt[s.type]||"#6c757d"}`}}})}function hm(e,t){return e.filter(n=>t.has(n.from)&&t.has(n.to)).map(n=>{const r=ke[n.relationType]||ke.related_to;return{id:n.id,source:n.from,target:n.to,label:r.label,type:"workflowEdge",data:{relationType:n.relationType},style:{stroke:r.color,strokeDasharray:r.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}})}function Kg(e,t,n){let r=0;const o=[n,...e,"|",...t];for(const s of o)for(let i=0;i<s.length;i++)r=(r<<5)-r+s.charCodeAt(i)|0;return r}function pm(e,t){if(e===null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}let kt=null;function gm(e,t,n="TB"){const r=e.map(c=>c.id),o=t.map(c=>`${c.source}-${c.target}`),s=Kg(r,o,n);let i;if(kt&&kt.key===s)i=kt.positions;else{const c=new Ri.graphlib.Graph;c.setDefaultEdgeLabel(()=>({})),c.setGraph({rankdir:n,ranksep:60,nodesep:40});for(const d of e)c.setNode(d.id,{width:wr,height:Di});for(const d of t)c.setEdge(d.source,d.target);Ri.layout(c),i=new Map;for(const d of e){const u=c.node(d.id);i.set(d.id,{x:u.x-wr/2,y:u.y-Di/2})}kt={key:s,positions:i}}return{nodes:e.map(c=>{const d=i.get(c.id)??{x:0,y:0};return{...c,position:d}}),edges:t}}export{om as B,im as C,dm as N,jp as R,um as W,rm as a,sm as b,cm as c,hm as d,gm as e,lm as f,am as g,jr as h,tm as i,pm as s,fm as t,nm as u};
|