spexcode 0.6.2 → 0.6.6
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/README.md +3 -1
- package/bin/spex.mjs +4 -0
- package/node_modules/@spexcode/session-core/dist/delivery-queue.d.ts +23 -0
- package/node_modules/@spexcode/session-core/dist/delivery-queue.js +195 -0
- package/node_modules/@spexcode/session-core/dist/index.d.ts +5 -0
- package/node_modules/@spexcode/session-core/dist/index.js +5 -0
- package/node_modules/@spexcode/session-core/dist/internal.d.ts +3 -0
- package/node_modules/@spexcode/session-core/dist/internal.js +3 -0
- package/node_modules/@spexcode/session-core/dist/message.d.ts +22 -0
- package/node_modules/@spexcode/session-core/dist/message.js +52 -0
- package/node_modules/@spexcode/session-core/dist/record-lock.d.ts +7 -0
- package/node_modules/@spexcode/session-core/dist/record-lock.js +152 -0
- package/node_modules/@spexcode/session-core/dist/runtime-session.d.ts +50 -0
- package/node_modules/@spexcode/session-core/dist/runtime-session.js +286 -0
- package/node_modules/@spexcode/session-core/dist/session-cursors.d.ts +14 -0
- package/node_modules/@spexcode/session-core/dist/session-cursors.js +82 -0
- package/node_modules/@spexcode/session-core/dist/session-timeline.d.ts +46 -0
- package/node_modules/@spexcode/session-core/dist/session-timeline.js +216 -0
- package/node_modules/@spexcode/session-core/package.json +33 -0
- package/node_modules/@spexcode/spec-cli/bin/spex.mjs +77 -0
- package/node_modules/@spexcode/spec-cli/dist/attach.d.ts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/attach.js +48 -0
- package/node_modules/@spexcode/spec-cli/dist/claude-headless.d.ts +36 -0
- package/node_modules/@spexcode/spec-cli/dist/claude-headless.js +316 -0
- package/node_modules/@spexcode/spec-cli/dist/cli.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/cli.js +1908 -0
- package/node_modules/@spexcode/spec-cli/dist/client.d.ts +112 -0
- package/node_modules/@spexcode/spec-cli/dist/client.js +481 -0
- package/node_modules/@spexcode/spec-cli/dist/cockpit.d.ts +7 -0
- package/node_modules/@spexcode/spec-cli/dist/cockpit.js +26 -0
- package/node_modules/@spexcode/spec-cli/dist/codex-headless.d.ts +1 -0
- package/{spec-cli/src/codex-headless.ts → node_modules/@spexcode/spec-cli/dist/codex-headless.js} +3 -9
- package/node_modules/@spexcode/spec-cli/dist/codex-runtime-generations.d.ts +58 -0
- package/node_modules/@spexcode/spec-cli/dist/codex-runtime-generations.js +798 -0
- package/node_modules/@spexcode/spec-cli/dist/commit-surgery.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/commit-surgery.js +90 -0
- package/node_modules/@spexcode/spec-cli/dist/contract-filter.d.ts +14 -0
- package/node_modules/@spexcode/spec-cli/dist/contract-filter.js +219 -0
- package/node_modules/@spexcode/spec-cli/dist/dashboard-assets.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/dashboard-assets.js +50 -0
- package/node_modules/@spexcode/spec-cli/dist/doctor.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/doctor.js +553 -0
- package/node_modules/@spexcode/spec-cli/dist/eval-host.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/eval-host.js +19 -0
- package/node_modules/@spexcode/spec-cli/dist/execution-trace.d.ts +26 -0
- package/node_modules/@spexcode/spec-cli/dist/execution-trace.js +475 -0
- package/node_modules/@spexcode/spec-cli/dist/file-write.d.ts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/file-write.js +26 -0
- package/node_modules/@spexcode/spec-cli/dist/flat.d.ts +89 -0
- package/node_modules/@spexcode/spec-cli/dist/flat.js +1076 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-auth.d.ts +56 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-auth.js +168 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-hub.d.ts +28 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway-hub.js +363 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway.d.ts +38 -0
- package/node_modules/@spexcode/spec-cli/dist/gateway.js +527 -0
- package/node_modules/@spexcode/spec-cli/dist/graphCache.d.ts +27 -0
- package/node_modules/@spexcode/spec-cli/dist/graphCache.js +717 -0
- package/node_modules/@spexcode/spec-cli/dist/graphSnapshot.d.ts +14 -0
- package/node_modules/@spexcode/spec-cli/dist/graphSnapshot.js +36 -0
- package/node_modules/@spexcode/spec-cli/dist/graphStream.d.ts +85 -0
- package/node_modules/@spexcode/spec-cli/dist/graphStream.js +1195 -0
- package/node_modules/@spexcode/spec-cli/dist/guidance-catalog.d.ts +64 -0
- package/node_modules/@spexcode/spec-cli/dist/guidance-catalog.js +166 -0
- package/node_modules/@spexcode/spec-cli/dist/guide.d.ts +8 -0
- package/{spec-cli/src/guide.ts → node_modules/@spexcode/spec-cli/dist/guide.js} +36 -32
- package/node_modules/@spexcode/spec-cli/dist/harness-select.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/harness-select.js +62 -0
- package/node_modules/@spexcode/spec-cli/dist/harness.d.ts +338 -0
- package/node_modules/@spexcode/spec-cli/dist/harness.js +3146 -0
- package/node_modules/@spexcode/spec-cli/dist/headless-controller.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/headless-controller.js +47 -0
- package/node_modules/@spexcode/spec-cli/dist/help.d.ts +15 -0
- package/node_modules/@spexcode/spec-cli/dist/help.js +594 -0
- package/node_modules/@spexcode/spec-cli/dist/hook-prompts.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/hook-prompts.js +122 -0
- package/node_modules/@spexcode/spec-cli/dist/hooks.d.ts +1 -0
- package/{spec-cli/src/hooks.ts → node_modules/@spexcode/spec-cli/dist/hooks.js} +15 -15
- package/node_modules/@spexcode/spec-cli/dist/host-resources.d.ts +97 -0
- package/node_modules/@spexcode/spec-cli/dist/host-resources.js +795 -0
- package/node_modules/@spexcode/spec-cli/dist/host.d.ts +88 -0
- package/node_modules/@spexcode/spec-cli/dist/host.js +663 -0
- package/node_modules/@spexcode/spec-cli/dist/index.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/index.js +899 -0
- package/node_modules/@spexcode/spec-cli/dist/init.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/init.js +284 -0
- package/node_modules/@spexcode/spec-cli/dist/issues-cli.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/issues-cli.js +334 -0
- package/node_modules/@spexcode/spec-cli/dist/issues.d.ts +69 -0
- package/node_modules/@spexcode/spec-cli/dist/issues.js +189 -0
- package/node_modules/@spexcode/spec-cli/dist/lint.d.ts +34 -0
- package/node_modules/@spexcode/spec-cli/dist/lint.js +476 -0
- package/node_modules/@spexcode/spec-cli/dist/listen.d.ts +8 -0
- package/node_modules/@spexcode/spec-cli/dist/listen.js +24 -0
- package/node_modules/@spexcode/spec-cli/dist/localIssues.d.ts +65 -0
- package/node_modules/@spexcode/spec-cli/dist/localIssues.js +582 -0
- package/node_modules/@spexcode/spec-cli/dist/login-page.d.ts +5 -0
- package/{spec-cli/src/login-page.ts → node_modules/@spexcode/spec-cli/dist/login-page.js} +7 -7
- package/node_modules/@spexcode/spec-cli/dist/loop-in.d.ts +23 -0
- package/{spec-cli/src/loop-in.ts → node_modules/@spexcode/spec-cli/dist/loop-in.js} +35 -45
- package/node_modules/@spexcode/spec-cli/dist/machine-peer.d.ts +69 -0
- package/node_modules/@spexcode/spec-cli/dist/machine-peer.js +603 -0
- package/node_modules/@spexcode/spec-cli/dist/materialize.d.ts +18 -0
- package/node_modules/@spexcode/spec-cli/dist/materialize.js +468 -0
- package/node_modules/@spexcode/spec-cli/dist/mentions.d.ts +50 -0
- package/node_modules/@spexcode/spec-cli/dist/mentions.js +117 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode-headless.d.ts +5 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode-headless.js +215 -0
- package/node_modules/@spexcode/spec-cli/dist/opencode.d.ts +3 -0
- package/{spec-cli/src/opencode.ts → node_modules/@spexcode/spec-cli/dist/opencode.js} +9 -13
- package/node_modules/@spexcode/spec-cli/dist/pi-harness.d.ts +3 -0
- package/{spec-cli/src/pi-harness.ts → node_modules/@spexcode/spec-cli/dist/pi-harness.js} +45 -40
- package/node_modules/@spexcode/spec-cli/dist/pi-headless.d.ts +25 -0
- package/node_modules/@spexcode/spec-cli/dist/pi-headless.js +196 -0
- package/node_modules/@spexcode/spec-cli/dist/plugin-harness.d.ts +21 -0
- package/node_modules/@spexcode/spec-cli/dist/plugin-harness.js +146 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-bridge.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-bridge.js +404 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-helper.d.mts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-helper.mjs +101 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-native-helper.d.mts +2 -0
- package/node_modules/@spexcode/spec-cli/dist/pty-native-helper.mjs +23 -0
- package/node_modules/@spexcode/spec-cli/dist/public-graph.d.ts +46 -0
- package/node_modules/@spexcode/spec-cli/dist/public-graph.js +56 -0
- package/node_modules/@spexcode/spec-cli/dist/ranker.d.ts +15 -0
- package/node_modules/@spexcode/spec-cli/dist/ranker.js +188 -0
- package/node_modules/@spexcode/spec-cli/dist/reaper.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/reaper.js +81 -0
- package/node_modules/@spexcode/spec-cli/dist/reviews.d.ts +189 -0
- package/node_modules/@spexcode/spec-cli/dist/reviews.js +350 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-guard.d.ts +6 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-guard.js +37 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-ownership.d.ts +21 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-ownership.js +84 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-rotate.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/runtime-rotate.js +58 -0
- package/node_modules/@spexcode/spec-cli/dist/search.bench.d.mts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/search.bench.mjs +75 -0
- package/node_modules/@spexcode/spec-cli/dist/search.d.ts +20 -0
- package/node_modules/@spexcode/spec-cli/dist/search.js +61 -0
- package/node_modules/@spexcode/spec-cli/dist/session-declarations.d.ts +13 -0
- package/node_modules/@spexcode/spec-cli/dist/session-declarations.js +126 -0
- package/node_modules/@spexcode/spec-cli/dist/session-execution.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/session-execution.js +70 -0
- package/node_modules/@spexcode/spec-cli/dist/session-files.d.ts +28 -0
- package/node_modules/@spexcode/spec-cli/dist/session-files.js +130 -0
- package/node_modules/@spexcode/spec-cli/dist/session-follow.d.ts +31 -0
- package/node_modules/@spexcode/spec-cli/dist/session-follow.js +179 -0
- package/node_modules/@spexcode/spec-cli/dist/session-reparent.d.ts +10 -0
- package/node_modules/@spexcode/spec-cli/dist/session-reparent.js +33 -0
- package/node_modules/@spexcode/spec-cli/dist/session-timeline.d.ts +11 -0
- package/node_modules/@spexcode/spec-cli/dist/session-timeline.js +20 -0
- package/node_modules/@spexcode/spec-cli/dist/session-web.d.ts +24 -0
- package/node_modules/@spexcode/spec-cli/dist/session-web.js +141 -0
- package/node_modules/@spexcode/spec-cli/dist/sessions.d.ts +433 -0
- package/node_modules/@spexcode/spec-cli/dist/sessions.js +4667 -0
- package/node_modules/@spexcode/spec-cli/dist/sh.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/sh.js +3 -0
- package/node_modules/@spexcode/spec-cli/dist/shim-runtime.d.ts +1 -0
- package/{spec-cli/src/shim-runtime.ts → node_modules/@spexcode/spec-cli/dist/shim-runtime.js} +3 -4
- package/node_modules/@spexcode/spec-cli/dist/slash-commands.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/slash-commands.js +307 -0
- package/node_modules/@spexcode/spec-cli/dist/source-files.d.ts +9 -0
- package/node_modules/@spexcode/spec-cli/dist/source-files.js +113 -0
- package/node_modules/@spexcode/spec-cli/dist/supervise.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/supervise.js +308 -0
- package/node_modules/@spexcode/spec-cli/dist/tree.d.ts +25 -0
- package/node_modules/@spexcode/spec-cli/dist/tree.js +98 -0
- package/node_modules/@spexcode/spec-cli/dist/tsx-bin.d.ts +3 -0
- package/node_modules/@spexcode/spec-cli/dist/tsx-bin.js +41 -0
- package/node_modules/@spexcode/spec-cli/dist/uninstall.d.ts +3 -0
- package/node_modules/@spexcode/spec-cli/dist/uninstall.js +177 -0
- package/node_modules/@spexcode/spec-cli/dist/uploads.d.ts +36 -0
- package/node_modules/@spexcode/spec-cli/dist/uploads.js +243 -0
- package/node_modules/@spexcode/spec-cli/dist/worktree-sources.d.ts +1 -0
- package/node_modules/@spexcode/spec-cli/dist/worktree-sources.js +47 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/dispatch.sh +5 -5
- package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/harness.sh +1 -1
- package/node_modules/@spexcode/spec-cli/package.json +49 -0
- package/node_modules/@spexcode/spec-cli/templates/spec/project/.plugins/commands/supervisor/spec.md +8 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-first/spec-first.sh +1 -1
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-of-file/spec-of-file.sh +1 -0
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/stop-gate/spec.md +2 -2
- package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/stop-gate/stop-gate.sh +31 -29
- package/node_modules/@spexcode/spec-core/dist/anchors.d.ts +94 -0
- package/node_modules/@spexcode/spec-core/dist/anchors.js +730 -0
- package/node_modules/@spexcode/spec-core/dist/git.d.ts +170 -0
- package/node_modules/@spexcode/spec-core/dist/git.js +2768 -0
- package/node_modules/@spexcode/spec-core/dist/graph-delta.d.ts +44 -0
- package/node_modules/@spexcode/spec-core/dist/graph-delta.js +72 -0
- package/node_modules/@spexcode/spec-core/dist/graph.d.ts +34 -0
- package/node_modules/@spexcode/spec-core/dist/graph.js +237 -0
- package/node_modules/@spexcode/spec-core/dist/graphDelta.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/graphDelta.js +13 -0
- package/node_modules/@spexcode/spec-core/dist/harness-identity.d.ts +31 -0
- package/node_modules/@spexcode/spec-core/dist/harness-identity.js +20 -0
- package/node_modules/@spexcode/spec-core/dist/identity-presets.d.ts +152 -0
- package/node_modules/@spexcode/spec-core/dist/identity-presets.js +132 -0
- package/node_modules/@spexcode/spec-core/dist/index.d.ts +45 -0
- package/node_modules/@spexcode/spec-core/dist/index.js +19 -0
- package/node_modules/@spexcode/spec-core/dist/layout.d.ts +187 -0
- package/node_modules/@spexcode/spec-core/dist/layout.js +548 -0
- package/node_modules/@spexcode/spec-core/dist/process-identity.d.ts +37 -0
- package/node_modules/@spexcode/spec-core/dist/process-identity.js +214 -0
- package/node_modules/@spexcode/spec-core/dist/project-identity.d.ts +12 -0
- package/node_modules/@spexcode/spec-core/dist/project-identity.js +71 -0
- package/node_modules/@spexcode/spec-core/dist/project-store.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/project-store.js +14 -0
- package/node_modules/@spexcode/spec-core/dist/resilience.d.ts +2 -0
- package/node_modules/@spexcode/spec-core/dist/resilience.js +40 -0
- package/node_modules/@spexcode/spec-core/dist/review/index.d.ts +3 -0
- package/node_modules/@spexcode/spec-core/dist/review/index.js +5 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewFilters.d.ts +77 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewFilters.js +308 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewQuery.d.ts +66 -0
- package/node_modules/@spexcode/spec-core/dist/review/reviewQuery.js +180 -0
- package/node_modules/@spexcode/spec-core/dist/review/session.d.ts +4 -0
- package/node_modules/@spexcode/spec-core/dist/review/session.js +8 -0
- package/node_modules/@spexcode/spec-core/dist/reviewSnapshot.d.ts +15 -0
- package/node_modules/@spexcode/spec-core/dist/reviewSnapshot.js +12 -0
- package/node_modules/@spexcode/spec-core/dist/root-lru.d.ts +4 -0
- package/{spec-cli/src/root-lru.ts → node_modules/@spexcode/spec-core/dist/root-lru.js} +26 -30
- package/node_modules/@spexcode/spec-core/dist/specs.d.ts +117 -0
- package/node_modules/@spexcode/spec-core/dist/specs.js +489 -0
- package/node_modules/@spexcode/spec-core/package.json +28 -0
- package/node_modules/@spexcode/spec-eval/dist/cache.d.ts +10 -0
- package/node_modules/@spexcode/spec-eval/dist/cache.js +50 -0
- package/node_modules/@spexcode/spec-eval/dist/cli.d.ts +22 -0
- package/node_modules/@spexcode/spec-eval/dist/cli.js +981 -0
- package/node_modules/@spexcode/spec-eval/dist/evaltab.d.ts +98 -0
- package/node_modules/@spexcode/spec-eval/dist/evaltab.js +176 -0
- package/node_modules/@spexcode/spec-eval/dist/filing.d.ts +16 -0
- package/node_modules/@spexcode/spec-eval/dist/filing.js +36 -0
- package/node_modules/@spexcode/spec-eval/dist/freshness.d.ts +48 -0
- package/node_modules/@spexcode/spec-eval/dist/freshness.js +799 -0
- package/node_modules/@spexcode/spec-eval/dist/host.d.ts +46 -0
- package/node_modules/@spexcode/spec-eval/dist/host.js +53 -0
- package/node_modules/@spexcode/spec-eval/dist/humanok.d.ts +11 -0
- package/node_modules/@spexcode/spec-eval/dist/humanok.js +27 -0
- package/node_modules/@spexcode/spec-eval/dist/index.d.ts +4 -0
- package/node_modules/@spexcode/spec-eval/dist/index.js +4 -0
- package/node_modules/@spexcode/spec-eval/dist/remarks.d.ts +31 -0
- package/node_modules/@spexcode/spec-eval/dist/remarks.js +1 -0
- package/node_modules/@spexcode/spec-eval/dist/scenariofresh.d.ts +13 -0
- package/node_modules/@spexcode/spec-eval/dist/scenariofresh.js +303 -0
- package/node_modules/@spexcode/spec-eval/dist/scenarios.d.ts +99 -0
- package/node_modules/@spexcode/spec-eval/dist/scenarios.js +650 -0
- package/node_modules/@spexcode/spec-eval/dist/sessioneval.d.ts +307 -0
- package/node_modules/@spexcode/spec-eval/dist/sessioneval.js +1883 -0
- package/node_modules/@spexcode/spec-eval/dist/sidecar.d.ts +55 -0
- package/node_modules/@spexcode/spec-eval/dist/sidecar.js +82 -0
- package/node_modules/@spexcode/spec-eval/dist/timeline.d.ts +25 -0
- package/node_modules/@spexcode/spec-eval/dist/timeline.js +65 -0
- package/node_modules/@spexcode/spec-eval/dist/ui-path.d.ts +1 -0
- package/node_modules/@spexcode/spec-eval/dist/ui-path.js +2 -0
- package/node_modules/@spexcode/spec-eval/package.json +36 -0
- package/node_modules/@spexcode/spec-forge/dist/cache.d.ts +29 -0
- package/node_modules/@spexcode/spec-forge/dist/cache.js +59 -0
- package/node_modules/@spexcode/spec-forge/dist/cli.d.ts +1 -0
- package/node_modules/@spexcode/spec-forge/dist/cli.js +100 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/github.d.ts +2 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/github.js +116 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/gitlab.d.ts +7 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers/gitlab.js +144 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers.d.ts +10 -0
- package/node_modules/@spexcode/spec-forge/dist/drivers.js +83 -0
- package/node_modules/@spexcode/spec-forge/dist/index.d.ts +4 -0
- package/node_modules/@spexcode/spec-forge/dist/index.js +4 -0
- package/node_modules/@spexcode/spec-forge/dist/links.d.ts +15 -0
- package/node_modules/@spexcode/spec-forge/dist/links.js +65 -0
- package/node_modules/@spexcode/spec-forge/dist/needs-eval.d.ts +10 -0
- package/node_modules/@spexcode/spec-forge/dist/needs-eval.js +20 -0
- package/node_modules/@spexcode/spec-forge/dist/port.d.ts +53 -0
- package/node_modules/@spexcode/spec-forge/dist/port.js +1 -0
- package/node_modules/@spexcode/spec-forge/dist/resident.d.ts +7 -0
- package/node_modules/@spexcode/spec-forge/dist/resident.js +43 -0
- package/node_modules/@spexcode/spec-forge/package.json +32 -0
- package/package.json +33 -19
- package/spec-cli/bin/spex.mjs +0 -69
- package/spec-cli/src/anchors.ts +0 -728
- package/spec-cli/src/attach.ts +0 -43
- package/spec-cli/src/claude-headless.ts +0 -321
- package/spec-cli/src/cli.ts +0 -1258
- package/spec-cli/src/client.ts +0 -414
- package/spec-cli/src/cockpit.ts +0 -43
- package/spec-cli/src/codex-runtime-generations.ts +0 -646
- package/spec-cli/src/commit-surgery.ts +0 -68
- package/spec-cli/src/contract-filter.ts +0 -202
- package/spec-cli/src/delivery-queue.ts +0 -165
- package/spec-cli/src/doctor.ts +0 -516
- package/spec-cli/src/execution-trace.ts +0 -444
- package/spec-cli/src/file-write.ts +0 -22
- package/spec-cli/src/gateway-auth.ts +0 -181
- package/spec-cli/src/gateway-hub.ts +0 -358
- package/spec-cli/src/gateway.ts +0 -461
- package/spec-cli/src/git.ts +0 -2556
- package/spec-cli/src/graph.ts +0 -271
- package/spec-cli/src/graphCache.ts +0 -710
- package/spec-cli/src/graphDelta.ts +0 -77
- package/spec-cli/src/graphStream.ts +0 -1019
- package/spec-cli/src/harness-select.ts +0 -77
- package/spec-cli/src/harness.ts +0 -3025
- package/spec-cli/src/headless-controller.ts +0 -63
- package/spec-cli/src/help.ts +0 -492
- package/spec-cli/src/host-resources.ts +0 -762
- package/spec-cli/src/host.ts +0 -611
- package/spec-cli/src/identity-presets.d.ts +0 -13
- package/spec-cli/src/identity-presets.js +0 -138
- package/spec-cli/src/index.ts +0 -818
- package/spec-cli/src/init.ts +0 -258
- package/spec-cli/src/issues-cli.ts +0 -276
- package/spec-cli/src/issues.ts +0 -237
- package/spec-cli/src/layout.ts +0 -640
- package/spec-cli/src/lint.ts +0 -488
- package/spec-cli/src/listen.ts +0 -28
- package/spec-cli/src/localIssues.ts +0 -538
- package/spec-cli/src/materialize.ts +0 -417
- package/spec-cli/src/mentions.ts +0 -81
- package/spec-cli/src/opencode-headless.ts +0 -205
- package/spec-cli/src/pi-headless.ts +0 -153
- package/spec-cli/src/plugin-harness.ts +0 -157
- package/spec-cli/src/process-identity.ts +0 -207
- package/spec-cli/src/project-identity.ts +0 -73
- package/spec-cli/src/project-store.ts +0 -17
- package/spec-cli/src/pty-bridge.ts +0 -396
- package/spec-cli/src/pty-helper.mjs +0 -96
- package/spec-cli/src/pty-native-helper.mjs +0 -22
- package/spec-cli/src/ranker.ts +0 -191
- package/spec-cli/src/reaper.ts +0 -125
- package/spec-cli/src/resilience.ts +0 -41
- package/spec-cli/src/reviewSnapshot.ts +0 -28
- package/spec-cli/src/reviews.ts +0 -434
- package/spec-cli/src/runtime-guard.ts +0 -35
- package/spec-cli/src/runtime-ownership.ts +0 -88
- package/spec-cli/src/search.bench.mjs +0 -80
- package/spec-cli/src/search.ts +0 -63
- package/spec-cli/src/session-cursors.ts +0 -91
- package/spec-cli/src/session-execution.ts +0 -68
- package/spec-cli/src/session-files.ts +0 -121
- package/spec-cli/src/session-follow.ts +0 -182
- package/spec-cli/src/session-reparent.ts +0 -33
- package/spec-cli/src/session-timeline.ts +0 -247
- package/spec-cli/src/session-web.ts +0 -135
- package/spec-cli/src/sessions.ts +0 -3883
- package/spec-cli/src/sh.ts +0 -3
- package/spec-cli/src/slash-commands.ts +0 -318
- package/spec-cli/src/source-files.ts +0 -104
- package/spec-cli/src/specs.ts +0 -498
- package/spec-cli/src/supervise.ts +0 -245
- package/spec-cli/src/tree.ts +0 -118
- package/spec-cli/src/tsx-bin.ts +0 -18
- package/spec-cli/src/uninstall.ts +0 -171
- package/spec-cli/src/uploads.ts +0 -253
- package/spec-cli/src/worktree-sources.ts +0 -42
- package/spec-cli/templates/spec/project/.plugins/commands/supervisor/spec.md +0 -8
- package/spec-dashboard/dist/assets/App-B6IbFbGu.js +0 -2
- package/spec-dashboard/dist/assets/Dashboard-C5ap-Sga.css +0 -1
- package/spec-dashboard/dist/assets/Dashboard-_sDk7Rcg.js +0 -27
- package/spec-dashboard/dist/assets/EvalsPage-BT357Lyt.js +0 -2
- package/spec-dashboard/dist/assets/IssuesPage-BG9rNOgV.js +0 -1
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/spec-dashboard/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/spec-dashboard/dist/assets/MobileApp-D9yPMR3A.js +0 -2
- package/spec-dashboard/dist/assets/Modal-B3EcgeA3.js +0 -1
- package/spec-dashboard/dist/assets/PageScroll-CNZOugWV.js +0 -1
- package/spec-dashboard/dist/assets/ProjectsPage-C2CRHmvs.js +0 -1
- package/spec-dashboard/dist/assets/SessionInterface-6GBZ9nXN.css +0 -32
- package/spec-dashboard/dist/assets/SessionInterface-DOEjuT3l.js +0 -40
- package/spec-dashboard/dist/assets/SessionWindow-1nYgZ4CL.js +0 -1
- package/spec-dashboard/dist/assets/Settings-7WeTJn0V.js +0 -1
- package/spec-dashboard/dist/assets/Thread-CEbzAFQn.js +0 -13
- package/spec-dashboard/dist/assets/bindings-BC9vqpYU.js +0 -1
- package/spec-dashboard/dist/assets/data-SlvxNA2r.js +0 -1
- package/spec-dashboard/dist/assets/index-DLVeOHL-.js +0 -41
- package/spec-dashboard/dist/assets/index-DYLGfPjx.css +0 -1
- package/spec-dashboard/dist/assets/launch-Cp579UoJ.css +0 -1
- package/spec-dashboard/dist/assets/launch-yxCYr64x.js +0 -276
- package/spec-dashboard/dist/assets/sessionSurface--7l69h4F.js +0 -1
- package/spec-dashboard/dist/index.html +0 -29
- package/spec-dashboard/src/reviewFilters.js +0 -322
- package/spec-dashboard/src/reviewQuery.js +0 -174
- package/spec-dashboard/src/session.js +0 -199
- package/spec-eval/src/cache.ts +0 -57
- package/spec-eval/src/cli.ts +0 -894
- package/spec-eval/src/evaltab.ts +0 -264
- package/spec-eval/src/filing.ts +0 -39
- package/spec-eval/src/freshness.ts +0 -836
- package/spec-eval/src/humanok.ts +0 -28
- package/spec-eval/src/scenariofresh.ts +0 -244
- package/spec-eval/src/scenarios.ts +0 -672
- package/spec-eval/src/sessioneval.ts +0 -2220
- package/spec-eval/src/sidecar.ts +0 -93
- package/spec-eval/src/timeline.ts +0 -54
- package/spec-forge/src/__fixtures__/github-forge.json +0 -63
- package/spec-forge/src/cache.ts +0 -66
- package/spec-forge/src/cli.ts +0 -99
- package/spec-forge/src/drivers/github.ts +0 -132
- package/spec-forge/src/drivers/gitlab.ts +0 -153
- package/spec-forge/src/drivers.ts +0 -73
- package/spec-forge/src/links.ts +0 -72
- package/spec-forge/src/needs-eval.ts +0 -29
- package/spec-forge/src/port.ts +0 -36
- package/spec-forge/src/resident.ts +0 -46
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/README.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/compat/mark-active-0.5.2-eef1.fixture +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/hooks/compat/mark-active-sed-v0.fixture +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/commit-msg +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/post-checkout +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/post-merge +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/pre-commit +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/prepare-commit-msg +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/hooks/reference-transaction +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/extract/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/regroup/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/rename/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/commands/tidy/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/comment-altitude/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/idle/idle.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/idle/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/mark-active/mark-active.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/mark-active/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/session-fail/fail.sh +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/session-fail/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-first/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec-of-file/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/core/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/atomic-landing/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/forge-link/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/memory-hygiene/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/reproduce-before-fix/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/prompts/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/distill/digest.mjs +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/distill/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/skills/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/.plugins/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-cli}/templates/spec/project/spec.md +0 -0
- /package/{spec-cli → node_modules/@spexcode/spec-core}/templates/spexcode.json +0 -0
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionInterface-DOEjuT3l.js","assets/index-DLVeOHL-.js","assets/index-DYLGfPjx.css","assets/data-SlvxNA2r.js","assets/sessionSurface--7l69h4F.js","assets/launch-yxCYr64x.js","assets/Thread-CEbzAFQn.js","assets/PageScroll-CNZOugWV.js","assets/Modal-B3EcgeA3.js","assets/launch-Cp579UoJ.css","assets/SessionWindow-1nYgZ4CL.js","assets/bindings-BC9vqpYU.js","assets/SessionInterface-6GBZ9nXN.css","assets/EvalsPage-BT357Lyt.js","assets/IssuesPage-BG9rNOgV.js","assets/Settings-7WeTJn0V.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as _,l as Ka,R as qa,j as m,u as Ze,m as Ga,I as Ua,d as Za,f as Qa,n as He,o as Ja,T as ec,S as tc,_ as On}from"./index-DLVeOHL-.js";import{b as st,G as Es,l as br,A as nc,c as rc,L as oc}from"./SessionWindow-1nYgZ4CL.js";import{Y as sc,Z as ic,s as zr,_ as ac,X as _r,$ as cc,a0 as An,n as lo,a1 as lc,a2 as uc,E as dc,v as uo,a3 as fc,J as hc,w as gc,a4 as pc,a5 as mc,H as yc,a6 as xc}from"./Thread-CEbzAFQn.js";import{M as wc}from"./Modal-B3EcgeA3.js";import{A as vc,k as Ns,a as Er,f as fe}from"./bindings-BC9vqpYU.js";import{k as bc,X as _c,Y as Ec}from"./data-SlvxNA2r.js";function ge(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=ge(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Nc={value:()=>{}};function Vn(){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 Nn(n)}function Nn(e){this._=e}function Sc(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}})}Nn.prototype=Vn.prototype={constructor:Nn,on:function(e,t){var n=this._,r=Sc(e+"",n),o,s=-1,i=r.length;if(arguments.length<2){for(;++s<i;)if((o=(e=r[s]).type)&&(o=Mc(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]=fo(n[o],e.name,t);else if(t==null)for(o in n)n[o]=fo(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 Nn(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 Mc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function fo(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Nc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Nr="http://www.w3.org/1999/xhtml";const ho={svg:"http://www.w3.org/2000/svg",xhtml:Nr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ho.hasOwnProperty(t)?{space:ho[t],local:e}:e}function kc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Nr&&t.documentElement.namespaceURI===Nr?t.createElement(e):t.createElementNS(n,e)}}function Cc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ss(e){var t=Bn(e);return(t.local?Cc:kc)(t)}function Ac(){}function Hr(e){return e==null?Ac:function(){return this.querySelector(e)}}function $c(e){typeof e!="function"&&(e=Hr(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,l,d=0;d<i;++d)(c=s[d])&&(l=e.call(c,c.__data__,d,s))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new Me(r,this._parents)}function Ic(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Pc(){return[]}function Ms(e){return e==null?Pc:function(){return this.querySelectorAll(e)}}function jc(e){return function(){return Ic(e.apply(this,arguments))}}function Dc(e){typeof e=="function"?e=jc(e):e=Ms(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,l=0;l<a;++l)(c=i[l])&&(r.push(e.call(c,c.__data__,l,i)),o.push(c));return new Me(r,o)}function ks(e){return function(){return this.matches(e)}}function Cs(e){return function(t){return t.matches(e)}}var Tc=Array.prototype.find;function Rc(e){return function(){return Tc.call(this.children,e)}}function Lc(){return this.firstElementChild}function zc(e){return this.select(e==null?Lc:Rc(typeof e=="function"?e:Cs(e)))}var Hc=Array.prototype.filter;function Oc(){return Array.from(this.children)}function Vc(e){return function(){return Hc.call(this.children,e)}}function Bc(e){return this.selectAll(e==null?Oc:Vc(typeof e=="function"?e:Cs(e)))}function Fc(e){typeof e!="function"&&(e=ks(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,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new Me(r,this._parents)}function As(e){return new Array(e.length)}function Wc(){return new Me(this._enter||this._groups.map(As),this._parents)}function $n(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$n.prototype={constructor:$n,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 Yc(e){return function(){return e}}function Xc(e,t,n,r,o,s){for(var i=0,a,c=t.length,l=s.length;i<l;++i)(a=t[i])?(a.__data__=s[i],r[i]=a):n[i]=new $n(e,s[i]);for(;i<c;++i)(a=t[i])&&(o[i]=a)}function Kc(e,t,n,r,o,s,i){var a,c,l=new Map,d=t.length,u=s.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=i.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<u;++a)h=i.call(e,s[a],a,s)+"",(c=l.get(h))?(r[a]=c,c.__data__=s[a],l.delete(h)):n[a]=new $n(e,s[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function qc(e){return e.__data__}function Gc(e,t){if(!arguments.length)return Array.from(this,qc);var n=t?Kc:Xc,r=this._parents,o=this._groups;typeof e!="function"&&(e=Yc(e));for(var s=o.length,i=new Array(s),a=new Array(s),c=new Array(s),l=0;l<s;++l){var d=r[l],u=o[l],f=u.length,h=Uc(e.call(d,d&&d.__data__,l,r)),g=h.length,w=a[l]=new Array(g),x=i[l]=new Array(g),y=c[l]=new Array(f);n(d,u,w,x,y,h,t);for(var E=0,p=0,v,M;E<g;++E)if(v=w[E]){for(E>=p&&(p=E+1);!(M=x[p])&&++p<g;);v._next=M||null}}return i=new Me(i,r),i._enter=a,i._exit=c,i}function Uc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Zc(){return new Me(this._exit||this._groups.map(As),this._parents)}function Qc(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 Jc(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 l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new Me(a,this._parents)}function el(){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 tl(e){e||(e=nl);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!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),l,d=0;d<a;++d)(l=i[d])&&(c[d]=l);c.sort(t)}return new Me(o,this._parents).order()}function nl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function rl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function ol(){return Array.from(this)}function sl(){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 il(){let e=0;for(const t of this)++e;return e}function al(){return!this.node()}function cl(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 ll(e){return function(){this.removeAttribute(e)}}function ul(e){return function(){this.removeAttributeNS(e.space,e.local)}}function dl(e,t){return function(){this.setAttribute(e,t)}}function fl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function hl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function gl(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 pl(e,t){var n=Bn(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?ul:ll:typeof t=="function"?n.local?gl:hl:n.local?fl:dl)(n,t))}function $s(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ml(e){return function(){this.style.removeProperty(e)}}function yl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function xl(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function wl(e,t,n){return arguments.length>1?this.each((t==null?ml:typeof t=="function"?xl:yl)(e,t,n??"")):bt(this.node(),e)}function bt(e,t){return e.style.getPropertyValue(t)||$s(e).getComputedStyle(e,null).getPropertyValue(t)}function vl(e){return function(){delete this[e]}}function bl(e,t){return function(){this[e]=t}}function _l(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function El(e,t){return arguments.length>1?this.each((t==null?vl:typeof t=="function"?_l:bl)(e,t)):this.node()[e]}function Is(e){return e.trim().split(/^|\s+/)}function Or(e){return e.classList||new Ps(e)}function Ps(e){this._node=e,this._names=Is(e.getAttribute("class")||"")}Ps.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 js(e,t){for(var n=Or(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ds(e,t){for(var n=Or(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Nl(e){return function(){js(this,e)}}function Sl(e){return function(){Ds(this,e)}}function Ml(e,t){return function(){(t.apply(this,arguments)?js:Ds)(this,e)}}function kl(e,t){var n=Is(e+"");if(arguments.length<2){for(var r=Or(this.node()),o=-1,s=n.length;++o<s;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?Ml:t?Nl:Sl)(n,t))}function Cl(){this.textContent=""}function Al(e){return function(){this.textContent=e}}function $l(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Il(e){return arguments.length?this.each(e==null?Cl:(typeof e=="function"?$l:Al)(e)):this.node().textContent}function Pl(){this.innerHTML=""}function jl(e){return function(){this.innerHTML=e}}function Dl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Tl(e){return arguments.length?this.each(e==null?Pl:(typeof e=="function"?Dl:jl)(e)):this.node().innerHTML}function Rl(){this.nextSibling&&this.parentNode.appendChild(this)}function Ll(){return this.each(Rl)}function zl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Hl(){return this.each(zl)}function Ol(e){var t=typeof e=="function"?e:Ss(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Vl(){return null}function Bl(e,t){var n=typeof e=="function"?e:Ss(e),r=t==null?Vl:typeof t=="function"?t:Hr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Fl(){var e=this.parentNode;e&&e.removeChild(this)}function Wl(){return this.each(Fl)}function Yl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Xl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Kl(e){return this.select(e?Xl:Yl)}function ql(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Gl(e){return function(t){e.call(this,t,this.__data__)}}function Ul(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 Zl(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 Ql(e,t,n){return function(){var r=this.__on,o,s=Gl(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 Jl(e,t,n){var r=Ul(e+""),o,s=r.length,i;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<s;++o)if((i=r[o]).type===d.type&&i.name===d.name)return d.value}return}for(a=t?Ql:Zl,o=0;o<s;++o)this.each(a(r[o],t,n));return this}function Ts(e,t,n){var r=$s(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 eu(e,t){return function(){return Ts(this,e,t)}}function tu(e,t){return function(){return Ts(this,e,t.apply(this,arguments))}}function nu(e,t){return this.each((typeof t=="function"?tu:eu)(e,t))}function*ru(){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 Rs=[null];function Me(e,t){this._groups=e,this._parents=t}function Qt(){return new Me([[document.documentElement]],Rs)}function ou(){return this}Me.prototype=Qt.prototype={constructor:Me,select:$c,selectAll:Dc,selectChild:zc,selectChildren:Bc,filter:Fc,data:Gc,enter:Wc,exit:Zc,join:Qc,merge:Jc,selection:ou,order:el,sort:tl,call:rl,nodes:ol,node:sl,size:il,empty:al,each:cl,attr:pl,style:wl,property:El,classed:kl,text:Il,html:Tl,raise:Ll,lower:Hl,append:Ol,insert:Bl,remove:Wl,clone:Kl,datum:ql,on:Jl,dispatch:nu,[Symbol.iterator]:ru};function Se(e){return typeof e=="string"?new Me([[document.querySelector(e)]],[document.documentElement]):new Me([[e]],Rs)}function su(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Pe(e,t){if(e=su(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 iu={passive:!1},Bt={capture:!0,passive:!1};function ar(e){e.stopImmediatePropagation()}function wt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ls(e){var t=e.document.documentElement,n=Se(e).on("dragstart.drag",wt,Bt);"onselectstart"in t?n.on("selectstart.drag",wt,Bt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zs(e,t){var n=e.document.documentElement,r=Se(e).on("dragstart.drag",null);t&&(r.on("click.drag",wt,Bt),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 hn=e=>()=>e;function Sr(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:s,x:i,y:a,dx:c,dy:l,dispatch:d}){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:l,enumerable:!0,configurable:!0},_:{value:d}})}Sr.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function au(e){return!e.ctrlKey&&!e.button}function cu(){return this.parentNode}function lu(e,t){return t??{x:e.x,y:e.y}}function uu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Hs(){var e=au,t=cu,n=lu,r=uu,o={},s=Vn("start","drag","end"),i=0,a,c,l,d,u=0;function f(v){v.on("mousedown.drag",h).filter(r).on("touchstart.drag",x).on("touchmove.drag",y,iu).on("touchend.drag touchcancel.drag",E).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(v,M){if(!(d||!e.call(this,v,M))){var k=p(this,t.call(this,v,M),v,M,"mouse");k&&(Se(v.view).on("mousemove.drag",g,Bt).on("mouseup.drag",w,Bt),Ls(v.view),ar(v),l=!1,a=v.clientX,c=v.clientY,k("start",v))}}function g(v){if(wt(v),!l){var M=v.clientX-a,k=v.clientY-c;l=M*M+k*k>u}o.mouse("drag",v)}function w(v){Se(v.view).on("mousemove.drag mouseup.drag",null),zs(v.view,l),wt(v),o.mouse("end",v)}function x(v,M){if(e.call(this,v,M)){var k=v.changedTouches,I=t.call(this,v,M),$=k.length,T,F;for(T=0;T<$;++T)(F=p(this,I,v,M,k[T].identifier,k[T]))&&(ar(v),F("start",v,k[T]))}}function y(v){var M=v.changedTouches,k=M.length,I,$;for(I=0;I<k;++I)($=o[M[I].identifier])&&(wt(v),$("drag",v,M[I]))}function E(v){var M=v.changedTouches,k=M.length,I,$;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<k;++I)($=o[M[I].identifier])&&(ar(v),$("end",v,M[I]))}function p(v,M,k,I,$,T){var F=s.copy(),C=Pe(T||k,M),S,H,b;if((b=n.call(v,new Sr("beforestart",{sourceEvent:k,target:f,identifier:$,active:i,x:C[0],y:C[1],dx:0,dy:0,dispatch:F}),I))!=null)return S=b.x-C[0]||0,H=b.y-C[1]||0,function P(N,D,R){var A=C,B;switch(N){case"start":o[$]=P,B=i++;break;case"end":delete o[$],--i;case"drag":C=Pe(R||D,M),B=i;break}F.call(N,v,new Sr(N,{sourceEvent:D,subject:b,target:f,identifier:$,active:B,x:C[0]+S,y:C[1]+H,dx:C[0]-A[0],dy:C[1]-A[1],dispatch:F}),I)}}return f.filter=function(v){return arguments.length?(e=typeof v=="function"?v:hn(!!v),f):e},f.container=function(v){return arguments.length?(t=typeof v=="function"?v:hn(v),f):t},f.subject=function(v){return arguments.length?(n=typeof v=="function"?v:hn(v),f):n},f.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:hn(!!v),f):r},f.on=function(){var v=s.on.apply(s,arguments);return v===s?f:v},f.clickDistance=function(v){return arguments.length?(u=(v=+v)*v,f):Math.sqrt(u)},f}function Vr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Os(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Jt(){}var Ft=.7,In=1/Ft,vt="\\s*([+-]?\\d+)\\s*",Wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ve="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",du=/^#([0-9a-f]{3,8})$/,fu=new RegExp(`^rgb\\(${vt},${vt},${vt}\\)$`),hu=new RegExp(`^rgb\\(${Ve},${Ve},${Ve}\\)$`),gu=new RegExp(`^rgba\\(${vt},${vt},${vt},${Wt}\\)$`),pu=new RegExp(`^rgba\\(${Ve},${Ve},${Ve},${Wt}\\)$`),mu=new RegExp(`^hsl\\(${Wt},${Ve},${Ve}\\)$`),yu=new RegExp(`^hsla\\(${Wt},${Ve},${Ve},${Wt}\\)$`),go={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Vr(Jt,it,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:po,formatHex:po,formatHex8:xu,formatHsl:wu,formatRgb:mo,toString:mo});function po(){return this.rgb().formatHex()}function xu(){return this.rgb().formatHex8()}function wu(){return Vs(this).formatHsl()}function mo(){return this.rgb().formatRgb()}function it(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=du.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?yo(t):n===3?new we(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?gn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?gn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=fu.exec(e))?new we(t[1],t[2],t[3],1):(t=hu.exec(e))?new we(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=gu.exec(e))?gn(t[1],t[2],t[3],t[4]):(t=pu.exec(e))?gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=mu.exec(e))?vo(t[1],t[2]/100,t[3]/100,1):(t=yu.exec(e))?vo(t[1],t[2]/100,t[3]/100,t[4]):go.hasOwnProperty(e)?yo(go[e]):e==="transparent"?new we(NaN,NaN,NaN,0):null}function yo(e){return new we(e>>16&255,e>>8&255,e&255,1)}function gn(e,t,n,r){return r<=0&&(e=t=n=NaN),new we(e,t,n,r)}function vu(e){return e instanceof Jt||(e=it(e)),e?(e=e.rgb(),new we(e.r,e.g,e.b,e.opacity)):new we}function Mr(e,t,n,r){return arguments.length===1?vu(e):new we(e,t,n,r??1)}function we(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Vr(we,Mr,Os(Jt,{brighter(e){return e=e==null?In:Math.pow(In,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ft:Math.pow(Ft,e),new we(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new we(rt(this.r),rt(this.g),rt(this.b),Pn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:xo,formatHex:xo,formatHex8:bu,formatRgb:wo,toString:wo}));function xo(){return`#${nt(this.r)}${nt(this.g)}${nt(this.b)}`}function bu(){return`#${nt(this.r)}${nt(this.g)}${nt(this.b)}${nt((isNaN(this.opacity)?1:this.opacity)*255)}`}function wo(){const e=Pn(this.opacity);return`${e===1?"rgb(":"rgba("}${rt(this.r)}, ${rt(this.g)}, ${rt(this.b)}${e===1?")":`, ${e})`}`}function Pn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function nt(e){return e=rt(e),(e<16?"0":"")+e.toString(16)}function vo(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new je(e,t,n,r)}function Vs(e){if(e instanceof je)return new je(e.h,e.s,e.l,e.opacity);if(e instanceof Jt||(e=it(e)),!e)return new je;if(e instanceof je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),s=Math.max(t,n,r),i=NaN,a=s-o,c=(s+o)/2;return a?(t===s?i=(n-r)/a+(n<r)*6:n===s?i=(r-t)/a+2:i=(t-n)/a+4,a/=c<.5?s+o:2-s-o,i*=60):a=c>0&&c<1?0:i,new je(i,a,c,e.opacity)}function _u(e,t,n,r){return arguments.length===1?Vs(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Vr(je,_u,Os(Jt,{brighter(e){return e=e==null?In:Math.pow(In,e),new je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ft:Math.pow(Ft,e),new je(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new we(cr(e>=240?e-240:e+120,o,r),cr(e,o,r),cr(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new je(bo(this.h),pn(this.s),pn(this.l),Pn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Pn(this.opacity);return`${e===1?"hsl(":"hsla("}${bo(this.h)}, ${pn(this.s)*100}%, ${pn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function bo(e){return e=(e||0)%360,e<0?e+360:e}function pn(e){return Math.max(0,Math.min(1,e||0))}function cr(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Br=e=>()=>e;function Eu(e,t){return function(n){return e+n*t}}function Nu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Su(e){return(e=+e)==1?Bs:function(t,n){return n-t?Nu(t,n,e):Br(isNaN(t)?n:t)}}function Bs(e,t){var n=t-e;return n?Eu(e,n):Br(isNaN(e)?t:e)}const jn=function e(t){var n=Su(t);function r(o,s){var i=n((o=Mr(o)).r,(s=Mr(s)).r),a=n(o.g,s.g),c=n(o.b,s.b),l=Bs(o.opacity,s.opacity);return function(d){return o.r=i(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r}(1);function Mu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(s){for(o=0;o<n;++o)r[o]=e[o]*(1-s)+t[o]*s;return r}}function ku(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Cu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),s=new Array(n),i;for(i=0;i<r;++i)o[i]=Ot(e[i],t[i]);for(;i<n;++i)s[i]=t[i];return function(a){for(i=0;i<r;++i)s[i]=o[i](a);return s}}function Au(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Oe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function $u(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=Ot(e[o],t[o]):r[o]=t[o];return function(s){for(o in n)r[o]=n[o](s);return r}}var kr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,lr=new RegExp(kr.source,"g");function Iu(e){return function(){return e}}function Pu(e){return function(t){return e(t)+""}}function Fs(e,t){var n=kr.lastIndex=lr.lastIndex=0,r,o,s,i=-1,a=[],c=[];for(e=e+"",t=t+"";(r=kr.exec(e))&&(o=lr.exec(t));)(s=o.index)>n&&(s=t.slice(n,s),a[i]?a[i]+=s:a[++i]=s),(r=r[0])===(o=o[0])?a[i]?a[i]+=o:a[++i]=o:(a[++i]=null,c.push({i,x:Oe(r,o)})),n=lr.lastIndex;return n<t.length&&(s=t.slice(n),a[i]?a[i]+=s:a[++i]=s),a.length<2?c[0]?Pu(c[0].x):Iu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function Ot(e,t){var n=typeof t,r;return t==null||n==="boolean"?Br(t):(n==="number"?Oe:n==="string"?(r=it(t))?(t=r,jn):Fs:t instanceof it?jn:t instanceof Date?Au:ku(t)?Mu:Array.isArray(t)?Cu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?$u:Oe)(e,t)}var _o=180/Math.PI,Cr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ws(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)*_o,skewX:Math.atan(c)*_o,scaleX:i,scaleY:a}}var mn;function ju(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Cr:Ws(t.a,t.b,t.c,t.d,t.e,t.f)}function Du(e){return e==null||(mn||(mn=document.createElementNS("http://www.w3.org/2000/svg","g")),mn.setAttribute("transform",e),!(e=mn.transform.baseVal.consolidate()))?Cr:(e=e.matrix,Ws(e.a,e.b,e.c,e.d,e.e,e.f))}function Ys(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function s(l,d,u,f,h,g){if(l!==u||d!==f){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:Oe(l,u)},{i:w-2,x:Oe(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function i(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:Oe(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:Oe(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,h,g){if(l!==u||d!==f){var w=h.push(o(h)+"scale(",null,",",null,")");g.push({i:w-4,x:Oe(l,u)},{i:w-2,x:Oe(d,f)})}else(u!==1||f!==1)&&h.push(o(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),s(l.translateX,l.translateY,d.translateX,d.translateY,u,f),i(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var g=-1,w=f.length,x;++g<w;)u[(x=f[g]).i]=x.x(h);return u.join("")}}}var Tu=Ys(ju,"px, ","px)","deg)"),Ru=Ys(Du,", ",")",")"),Lu=1e-12;function Eo(e){return((e=Math.exp(e))+1/e)/2}function zu(e){return((e=Math.exp(e))-1/e)/2}function Hu(e){return((e=Math.exp(2*e))-1)/(e+1)}const Sn=function e(t,n,r){function o(s,i){var a=s[0],c=s[1],l=s[2],d=i[0],u=i[1],f=i[2],h=d-a,g=u-c,w=h*h+g*g,x,y;if(w<Lu)y=Math.log(f/l)/t,x=function(I){return[a+I*h,c+I*g,l*Math.exp(t*I*y)]};else{var E=Math.sqrt(w),p=(f*f-l*l+r*w)/(2*l*n*E),v=(f*f-l*l-r*w)/(2*f*n*E),M=Math.log(Math.sqrt(p*p+1)-p),k=Math.log(Math.sqrt(v*v+1)-v);y=(k-M)/t,x=function(I){var $=I*y,T=Eo(M),F=l/(n*E)*(T*Hu(t*$+M)-zu(M));return[a+F*h,c+F*g,l*T/Eo(t*$+M)]}}return x.duration=y*1e3*t/Math.SQRT2,x}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 _t=0,Lt=0,Dt=0,Xs=1e3,Dn,zt,Tn=0,at=0,Fn=0,Yt=typeof performance=="object"&&performance.now?performance:Date,Ks=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Fr(){return at||(Ks(Ou),at=Yt.now()+Fn)}function Ou(){at=0}function Rn(){this._call=this._time=this._next=null}Rn.prototype=qs.prototype={constructor:Rn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Fr():+n)+(t==null?0:+t),!this._next&&zt!==this&&(zt?zt._next=this:Dn=this,zt=this),this._call=e,this._time=n,Ar()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ar())}};function qs(e,t,n){var r=new Rn;return r.restart(e,t,n),r}function Vu(){Fr(),++_t;for(var e=Dn,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_t}function No(){at=(Tn=Yt.now())+Fn,_t=Lt=0;try{Vu()}finally{_t=0,Fu(),at=0}}function Bu(){var e=Yt.now(),t=e-Tn;t>Xs&&(Fn-=t,Tn=e)}function Fu(){for(var e,t=Dn,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:Dn=n);zt=e,Ar(r)}function Ar(e){if(!_t){Lt&&(Lt=clearTimeout(Lt));var t=e-at;t>24?(e<1/0&&(Lt=setTimeout(No,e-Yt.now()-Fn)),Dt&&(Dt=clearInterval(Dt))):(Dt||(Tn=Yt.now(),Dt=setInterval(Bu,Xs)),_t=1,Ks(No))}}function So(e,t,n){var r=new Rn;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var Wu=Vn("start","end","cancel","interrupt"),Yu=[],Gs=0,Mo=1,$r=2,Mn=3,ko=4,Ir=5,kn=6;function Wn(e,t,n,r,o,s){var i=e.__transition;if(!i)e.__transition={};else if(n in i)return;Xu(e,n,{name:t,index:r,group:o,on:Wu,tween:Yu,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Gs})}function Wr(e,t){var n=Le(e,t);if(n.state>Gs)throw new Error("too late; already scheduled");return n}function Be(e,t){var n=Le(e,t);if(n.state>Mn)throw new Error("too late; already running");return n}function Le(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Xu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=qs(s,0,n.time);function s(l){n.state=Mo,n.timer.restart(i,n.delay,n.time),n.delay<=l&&i(l-n.delay)}function i(l){var d,u,f,h;if(n.state!==Mo)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Mn)return So(i);h.state===ko?(h.state=kn,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=kn,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(So(function(){n.state===Mn&&(n.state=ko,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=$r,n.on.call("start",e,e.__data__,n.index,n.group),n.state===$r){for(n.state=Mn,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Ir,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===Ir&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=kn,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Cn(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>$r&&r.state<Ir,r.state=kn,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[i]}s&&delete e.__transition}}function Ku(e){return this.each(function(){Cn(this,e)})}function qu(e,t){var n,r;return function(){var o=Be(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 Gu(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var s=Be(this,e),i=s.tween;if(i!==r){o=(r=i).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}s.tween=o}}function Uu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Le(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?qu:Gu)(n,e,t))}function Yr(e,t,n){var r=e._id;return e.each(function(){var o=Be(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return Le(o,r).value[t]}}function Us(e,t){var n;return(typeof t=="number"?Oe:t instanceof it?jn:(n=it(t))?(t=n,jn):Fs)(e,t)}function Zu(e){return function(){this.removeAttribute(e)}}function Qu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ju(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 ed(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 td(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 nd(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 rd(e,t){var n=Bn(e),r=n==="transform"?Ru:Us;return this.attrTween(e,typeof t=="function"?(n.local?nd:td)(n,r,Yr(this,"attr."+e,t)):t==null?(n.local?Qu:Zu)(n):(n.local?ed:Ju)(n,r,t))}function od(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function sd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function id(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&sd(e,s)),n}return o._value=t,o}function ad(e,t){var n,r;function o(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&od(e,s)),n}return o._value=t,o}function cd(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=Bn(e);return this.tween(n,(r.local?id:ad)(r,t))}function ld(e,t){return function(){Wr(this,e).delay=+t.apply(this,arguments)}}function ud(e,t){return t=+t,function(){Wr(this,e).delay=t}}function dd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ld:ud)(t,e)):Le(this.node(),t).delay}function fd(e,t){return function(){Be(this,e).duration=+t.apply(this,arguments)}}function hd(e,t){return t=+t,function(){Be(this,e).duration=t}}function gd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fd:hd)(t,e)):Le(this.node(),t).duration}function pd(e,t){if(typeof t!="function")throw new Error;return function(){Be(this,e).ease=t}}function md(e){var t=this._id;return arguments.length?this.each(pd(t,e)):Le(this.node(),t).ease}function yd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Be(this,e).ease=n}}function xd(e){if(typeof e!="function")throw new Error;return this.each(yd(this._id,e))}function wd(e){typeof e!="function"&&(e=ks(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,l=0;l<i;++l)(c=s[l])&&e.call(c,c.__data__,l,s)&&a.push(c);return new Ye(r,this._parents,this._name,this._id)}function vd(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],l=n[a],d=c.length,u=i[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)i[a]=t[a];return new Ye(i,this._parents,this._name,this._id)}function bd(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 _d(e,t,n){var r,o,s=bd(t)?Wr:Be;return function(){var i=s(this,e),a=i.on;a!==r&&(o=(r=a).copy()).on(t,n),i.on=o}}function Ed(e,t){var n=this._id;return arguments.length<2?Le(this.node(),n).on.on(e):this.each(_d(n,e,t))}function Nd(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Sd(){return this.on("end.remove",Nd(this._id))}function Md(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Hr(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,l=s[i]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,Wn(l[f],t,n,f,l,Le(d,n)));return new Ye(s,this._parents,t,n)}function kd(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ms(e));for(var r=this._groups,o=r.length,s=[],i=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,g=Le(d,n),w=0,x=f.length;w<x;++w)(h=f[w])&&Wn(h,t,n,w,f,g);s.push(f),i.push(d)}return new Ye(s,i,t,n)}var Cd=Qt.prototype.constructor;function Ad(){return new Cd(this._groups,this._parents)}function $d(e,t){var n,r,o;return function(){var s=bt(this,e),i=(this.style.removeProperty(e),bt(this,e));return s===i?null:s===n&&i===r?o:o=t(n=s,r=i)}}function Zs(e){return function(){this.style.removeProperty(e)}}function Id(e,t,n){var r,o=n+"",s;return function(){var i=bt(this,e);return i===o?null:i===r?s:s=t(r=i,n)}}function Pd(e,t,n){var r,o,s;return function(){var i=bt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),bt(this,e))),i===c?null:i===r&&c===o?s:(o=c,s=t(r=i,a))}}function jd(e,t){var n,r,o,s="style."+t,i="end."+s,a;return function(){var c=Be(this,e),l=c.on,d=c.value[s]==null?a||(a=Zs(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(i,o=d),c.on=r}}function Dd(e,t,n){var r=(e+="")=="transform"?Tu:Us;return t==null?this.styleTween(e,$d(e,r)).on("end.style."+e,Zs(e)):typeof t=="function"?this.styleTween(e,Pd(e,r,Yr(this,"style."+e,t))).each(jd(this._id,e)):this.styleTween(e,Id(e,r,t),n).on("end.style."+e,null)}function Td(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Rd(e,t,n){var r,o;function s(){var i=t.apply(this,arguments);return i!==o&&(r=(o=i)&&Td(e,i,n)),r}return s._value=t,s}function Ld(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,Rd(e,t,n??""))}function zd(e){return function(){this.textContent=e}}function Hd(e){return function(){var t=e(this);this.textContent=t??""}}function Od(e){return this.tween("text",typeof e=="function"?Hd(Yr(this,"text",e)):zd(e==null?"":e+""))}function Vd(e){return function(t){this.textContent=e.call(this,t)}}function Bd(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Vd(o)),t}return r._value=e,r}function Fd(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,Bd(e))}function Wd(){for(var e=this._name,t=this._id,n=Qs(),r=this._groups,o=r.length,s=0;s<o;++s)for(var i=r[s],a=i.length,c,l=0;l<a;++l)if(c=i[l]){var d=Le(c,t);Wn(c,e,n,l,i,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ye(r,this._parents,e,n)}function Yd(){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 l=Be(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&s()})}var Xd=0;function Ye(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Qs(){return++Xd}var Fe=Qt.prototype;Ye.prototype={constructor:Ye,select:Md,selectAll:kd,selectChild:Fe.selectChild,selectChildren:Fe.selectChildren,filter:wd,merge:vd,selection:Ad,transition:Wd,call:Fe.call,nodes:Fe.nodes,node:Fe.node,size:Fe.size,empty:Fe.empty,each:Fe.each,on:Ed,attr:rd,attrTween:cd,style:Dd,styleTween:Ld,text:Od,textTween:Fd,remove:Sd,tween:Uu,delay:dd,duration:gd,ease:md,easeVarying:xd,end:Yd,[Symbol.iterator]:Fe[Symbol.iterator]};function Kd(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var qd={time:null,delay:0,duration:250,ease:Kd};function Gd(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 Ud(e){var t,n;e instanceof Ye?(t=e._id,e=e._name):(t=Qs(),(n=qd).time=Fr(),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,l=0;l<a;++l)(c=i[l])&&Wn(c,e,t,l,i,n||Gd(c,t));return new Ye(r,this._parents,e,t)}Qt.prototype.interrupt=Ku;Qt.prototype.transition=Ud;const yn=e=>()=>e;function Zd(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 We(e,t,n){this.k=e,this.x=t,this.y=n}We.prototype={constructor:We,scale:function(e){return e===1?this:new We(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new We(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 Yn=new We(1,0,0);Js.prototype=We.prototype;function Js(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Yn;return e.__zoom}function ur(e){e.stopImmediatePropagation()}function Tt(e){e.preventDefault(),e.stopImmediatePropagation()}function Qd(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Jd(){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 Co(){return this.__zoom||Yn}function ef(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function tf(){return navigator.maxTouchPoints||"ontouchstart"in this}function nf(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 ei(){var e=Qd,t=Jd,n=nf,r=ef,o=tf,s=[0,1/0],i=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Sn,l=Vn("start","zoom","end"),d,u,f,h=500,g=150,w=0,x=10;function y(b){b.property("__zoom",Co).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",F).filter(o).on("touchstart.zoom",C).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(b,P,N,D){var R=b.selection?b.selection():b;R.property("__zoom",Co),b!==R?M(b,P,N,D):R.interrupt().each(function(){k(this,arguments).event(D).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},y.scaleBy=function(b,P,N,D){y.scaleTo(b,function(){var R=this.__zoom.k,A=typeof P=="function"?P.apply(this,arguments):P;return R*A},N,D)},y.scaleTo=function(b,P,N,D){y.transform(b,function(){var R=t.apply(this,arguments),A=this.__zoom,B=N==null?v(R):typeof N=="function"?N.apply(this,arguments):N,O=A.invert(B),V=typeof P=="function"?P.apply(this,arguments):P;return n(p(E(A,V),B,O),R,i)},N,D)},y.translateBy=function(b,P,N,D){y.transform(b,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),i)},null,D)},y.translateTo=function(b,P,N,D,R){y.transform(b,function(){var A=t.apply(this,arguments),B=this.__zoom,O=D==null?v(A):typeof D=="function"?D.apply(this,arguments):D;return n(Yn.translate(O[0],O[1]).scale(B.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof N=="function"?-N.apply(this,arguments):-N),A,i)},D,R)};function E(b,P){return P=Math.max(s[0],Math.min(s[1],P)),P===b.k?b:new We(P,b.x,b.y)}function p(b,P,N){var D=P[0]-N[0]*b.k,R=P[1]-N[1]*b.k;return D===b.x&&R===b.y?b:new We(b.k,D,R)}function v(b){return[(+b[0][0]+ +b[1][0])/2,(+b[0][1]+ +b[1][1])/2]}function M(b,P,N,D){b.on("start.zoom",function(){k(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){k(this,arguments).event(D).end()}).tween("zoom",function(){var R=this,A=arguments,B=k(R,A).event(D),O=t.apply(R,A),V=N==null?v(O):typeof N=="function"?N.apply(R,A):N,K=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),q=R.__zoom,ee=typeof P=="function"?P.apply(R,A):P,re=c(q.invert(V).concat(K/q.k),ee.invert(V).concat(K/ee.k));return function(J){if(J===1)J=ee;else{var L=re(J),W=K/L[2];J=new We(W,V[0]-L[0]*W,V[1]-L[1]*W)}B.zoom(null,J)}})}function k(b,P,N){return!N&&b.__zooming||new I(b,P)}function I(b,P){this.that=b,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(b,P),this.taps=0}I.prototype={event:function(b){return b&&(this.sourceEvent=b),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(b,P){return this.mouse&&b!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&b!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&b!=="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(b){var P=Se(this.that).datum();l.call(b,this.that,new Zd(b,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:l}),P)}};function $(b,...P){if(!e.apply(this,arguments))return;var N=k(this,P).event(b),D=this.__zoom,R=Math.max(s[0],Math.min(s[1],D.k*Math.pow(2,r.apply(this,arguments)))),A=Pe(b);if(N.wheel)(N.mouse[0][0]!==A[0]||N.mouse[0][1]!==A[1])&&(N.mouse[1]=D.invert(N.mouse[0]=A)),clearTimeout(N.wheel);else{if(D.k===R)return;N.mouse=[A,D.invert(A)],Cn(this),N.start()}Tt(b),N.wheel=setTimeout(B,g),N.zoom("mouse",n(p(E(D,R),N.mouse[0],N.mouse[1]),N.extent,i));function B(){N.wheel=null,N.end()}}function T(b,...P){if(f||!e.apply(this,arguments))return;var N=b.currentTarget,D=k(this,P,!0).event(b),R=Se(b.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",K,!0),A=Pe(b,N),B=b.clientX,O=b.clientY;Ls(b.view),ur(b),D.mouse=[A,this.__zoom.invert(A)],Cn(this),D.start();function V(q){if(Tt(q),!D.moved){var ee=q.clientX-B,re=q.clientY-O;D.moved=ee*ee+re*re>w}D.event(q).zoom("mouse",n(p(D.that.__zoom,D.mouse[0]=Pe(q,N),D.mouse[1]),D.extent,i))}function K(q){R.on("mousemove.zoom mouseup.zoom",null),zs(q.view,D.moved),Tt(q),D.event(q).end()}}function F(b,...P){if(e.apply(this,arguments)){var N=this.__zoom,D=Pe(b.changedTouches?b.changedTouches[0]:b,this),R=N.invert(D),A=N.k*(b.shiftKey?.5:2),B=n(p(E(N,A),D,R),t.apply(this,P),i);Tt(b),a>0?Se(this).transition().duration(a).call(M,B,D,b):Se(this).call(y.transform,B,D,b)}}function C(b,...P){if(e.apply(this,arguments)){var N=b.touches,D=N.length,R=k(this,P,b.changedTouches.length===D).event(b),A,B,O,V;for(ur(b),B=0;B<D;++B)O=N[B],V=Pe(O,this),V=[V,this.__zoom.invert(V),O.identifier],R.touch0?!R.touch1&&R.touch0[2]!==V[2]&&(R.touch1=V,R.taps=0):(R.touch0=V,A=!0,R.taps=1+!!d);d&&(d=clearTimeout(d)),A&&(R.taps<2&&(u=V[0],d=setTimeout(function(){d=null},h)),Cn(this),R.start())}}function S(b,...P){if(this.__zooming){var N=k(this,P).event(b),D=b.changedTouches,R=D.length,A,B,O,V;for(Tt(b),A=0;A<R;++A)B=D[A],O=Pe(B,this),N.touch0&&N.touch0[2]===B.identifier?N.touch0[0]=O:N.touch1&&N.touch1[2]===B.identifier&&(N.touch1[0]=O);if(B=N.that.__zoom,N.touch1){var K=N.touch0[0],q=N.touch0[1],ee=N.touch1[0],re=N.touch1[1],J=(J=ee[0]-K[0])*J+(J=ee[1]-K[1])*J,L=(L=re[0]-q[0])*L+(L=re[1]-q[1])*L;B=E(B,Math.sqrt(J/L)),O=[(K[0]+ee[0])/2,(K[1]+ee[1])/2],V=[(q[0]+re[0])/2,(q[1]+re[1])/2]}else if(N.touch0)O=N.touch0[0],V=N.touch0[1];else return;N.zoom("touch",n(p(B,O,V),N.extent,i))}}function H(b,...P){if(this.__zooming){var N=k(this,P).event(b),D=b.changedTouches,R=D.length,A,B;for(ur(b),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),A=0;A<R;++A)B=D[A],N.touch0&&N.touch0[2]===B.identifier?delete N.touch0:N.touch1&&N.touch1[2]===B.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(B=Pe(B,this),Math.hypot(u[0]-B[0],u[1]-B[1])<x)){var O=Se(this).on("dblclick.zoom");O&&O.apply(this,arguments)}}}return y.wheelDelta=function(b){return arguments.length?(r=typeof b=="function"?b:yn(+b),y):r},y.filter=function(b){return arguments.length?(e=typeof b=="function"?b:yn(!!b),y):e},y.touchable=function(b){return arguments.length?(o=typeof b=="function"?b:yn(!!b),y):o},y.extent=function(b){return arguments.length?(t=typeof b=="function"?b:yn([[+b[0][0],+b[0][1]],[+b[1][0],+b[1][1]]]),y):t},y.scaleExtent=function(b){return arguments.length?(s[0]=+b[0],s[1]=+b[1],y):[s[0],s[1]]},y.translateExtent=function(b){return arguments.length?(i[0][0]=+b[0][0],i[1][0]=+b[1][0],i[0][1]=+b[0][1],i[1][1]=+b[1][1],y):[[i[0][0],i[0][1]],[i[1][0],i[1][1]]]},y.constrain=function(b){return arguments.length?(n=b,y):n},y.duration=function(b){return arguments.length?(a=+b,y):a},y.interpolate=function(b){return arguments.length?(c=b,y):c},y.on=function(){var b=l.on.apply(l,arguments);return b===l?y:b},y.clickDistance=function(b){return arguments.length?(w=(b=+b)*b,y):Math.sqrt(w)},y.tapDistance=function(b){return arguments.length?(x=+b,y):x},y}const Re={error001:(e="react")=>`Seems like you have not used zustand provider as an ancestor. Help: https://${e}flow.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 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.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},Xt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ti=["Enter"," ","Escape"],ni={"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 Et;(function(e){e.Strict="strict",e.Loose="loose"})(Et||(Et={}));var ot;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ot||(ot={}));var Kt;(function(e){e.Partial="partial",e.Full="full"})(Kt||(Kt={}));const ri={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ge;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ge||(Ge={}));var qt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(qt||(qt={}));var Q;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Q||(Q={}));const Ao={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top};function oi(e){return e===null?null:e?"valid":"invalid"}const si=e=>"id"in e&&"source"in e&&"target"in e,rf=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Xr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),en=(e,t=[0,0])=>{const{width:n,height:r}=Xe(e),o=e.origin??t,s=n*o[0],i=r*o[1];return{x:e.position.x-s,y:e.position.y-i}},of=(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):Xr(o)?o:t.nodeLookup.get(o.id));const a=i?Ln(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Xn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Kn(n)},tn=(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=Xn(n,Ln(o)),r=!0)}),r?Kn(n):{x:0,y:0,width:0,height:0}},Kr=(e,t,[n,r,o]=[0,0,1],s=!1,i=!1)=>{const a={...$t(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(i&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,w=Gt(a,St(l)),x=(h??0)*(g??0),y=s&&w>0;(!l.internals.handleBounds||y||w>=x||l.dragging)&&c.push(l)}return c},sf=(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 af(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 cf({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:s},i){if(e.size===0)return!0;const a=af(e,i),c=tn(a),l=Gr(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(l,{duration:i==null?void 0:i.duration,ease:i==null?void 0:i.ease,interpolate:i==null?void 0:i.interpolate}),!0}function ii({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:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=i.origin??r;let u=i.extent||o;if(i.extent==="parent"&&!i.expandParent)if(!a)s==null||s("005",Re.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&<(i.extent)&&(u=[[i.extent[0][0]+c,i.extent[0][1]+l],[i.extent[1][0]+c,i.extent[1][1]+l]]);const f=lt(u)?ct(t,u,i.measured):t;return(i.measured.width===void 0||i.measured.height===void 0)&&(s==null||s("015",Re.error015())),{position:{x:f.x-c+(i.measured.width??0)*d[0],y:f.y-l+(i.measured.height??0)*d[1]},positionAbsolute:f}}async function lf({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),g=!h&&f.parentId&&i.find(w=>w.id===f.parentId);(h||g)&&i.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=sf(i,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:i};const u=await o({nodes:i,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:i}:{edges:[],nodes:[]}:u}const Nt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ct=(e={x:0,y:0},t,n)=>({x:Nt(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Nt(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ai(e,t,n){const{width:r,height:o}=Xe(n),{x:s,y:i}=n.internals.positionAbsolute;return ct(e,[[s,i],[s+r,i+o]],t)}const $o=(e,t,n)=>e<t?Nt(Math.abs(e-t),1,t)/t:e>n?-Nt(Math.abs(e-n),1,t)/t:0,qr=(e,t,n=15,r=40)=>{const o=$o(e.x,r,t.width-r)*n,s=$o(e.y,r,t.height-r)*n;return[o,s]},Xn=(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)}),Pr=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Kn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),St=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Xr(e)?e.internals.positionAbsolute:en(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}},Ln=(e,t=[0,0])=>{var o,s;const{x:n,y:r}=Xr(e)?e.internals.positionAbsolute:en(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)}},ci=(e,t)=>Kn(Xn(Pr(e),Pr(t))),Gt=(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)},Io=e=>De(e.width)&&De(e.height)&&De(e.x)&&De(e.y),De=e=>!isNaN(e)&&isFinite(e),li=(e,t)=>(n,r)=>{},nn=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),$t=({x:e,y:t},[n,r,o],s=!1,i=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return s?nn(a,i):a},Mt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function pt(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(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function uf(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=pt(e,n),o=pt(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=pt(e.top??e.y??0,n),o=pt(e.bottom??e.y??0,n),s=pt(e.left??e.x??0,t),i=pt(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 df(e,t,n,r,o,s){const{x:i,y:a}=Mt(e,[t,n,r]),{x:c,y:l}=Mt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=s-l;return{left:Math.floor(i),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Gr=(e,t,n,r,o,s)=>{const i=uf(s,t,n),a=(t-i.x)/e.width,c=(n-i.y)/e.height,l=Math.min(a,c),d=Nt(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,g=n/2-f*d,w=df(e,h,g,d,t,n),x={left:Math.min(w.left-i.left,0),top:Math.min(w.top-i.top,0),right:Math.min(w.right-i.right,0),bottom:Math.min(w.bottom-i.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},Ut=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function lt(e){return e!=null&&e!=="parent"}function Xe(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 ui(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 di(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 Po(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ff(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function hf(e){return{...ni,...e||{}}}function Vt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:s,y:i}=Te(e),a=$t({x:s-((o==null?void 0:o.left)??0),y:i-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?nn(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Ur=e=>({width:e.offsetWidth,height:e.offsetHeight}),fi=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},gf=["INPUT","SELECT","TEXTAREA"];function hi(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:gf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const gi=e=>"clientX"in e,Te=(e,t)=>{var s,i;const n=gi(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)}},jo=(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,...Ur(i)}})};function pi({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,l=t*.125+s*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function xn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Do({pos:e,x1:t,y1:n,x2:r,y2:o,c:s}){switch(e){case Q.Left:return[t-xn(t-r,s),n];case Q.Right:return[t+xn(r-t,s),n];case Q.Top:return[t,n-xn(n-o,s)];case Q.Bottom:return[t,n+xn(o-n,s)]}}function mi({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:s=Q.Top,curvature:i=.25}){const[a,c]=Do({pos:n,x1:e,y1:t,x2:r,y2:o,c:i}),[l,d]=Do({pos:s,x1:r,y1:o,x2:e,y2:t,c:i}),[u,f,h,g]=pi({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,h,g]}function yi({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 pf({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 mf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const s=Xn(Ln(e),Ln(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 Gt(i,Kn(s))>0}const yf=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,xf=(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)),wf=(e,t,n={})=>{var s;if(!e.source||!e.target)return(s=n.onError)==null||s.call(n,"006",Re.error006()),t;const r=n.getEdgeId||yf;let o;return si(e)?o={...e}:o={...e,id:r(e)},xf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function xi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,s,i,a]=yi({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,s,i,a]}const To={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}},vf=({source:e,sourcePosition:t=Q.Bottom,target:n})=>t===Q.Left||t===Q.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},Ro=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function bf({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:r=Q.Top,center:o,offset:s,stepPosition:i}){const a=To[t],c=To[r],l={x:e.x+a.x*s,y:e.y+a.y*s},d={x:n.x+c.x*s,y:n.y+c.y*s},u=vf({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let g=[],w,x;const y={x:0,y:0},E={x:0,y:0},[,,p,v]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(w=o.x??l.x+(d.x-l.x)*i,x=o.y??(l.y+d.y)/2):(w=o.x??(l.x+d.x)/2,x=o.y??l.y+(d.y-l.y)*i);const $=[{x:w,y:l.y},{x:w,y:d.y}],T=[{x:l.x,y:x},{x:d.x,y:x}];a[f]===h?g=f==="x"?$:T:g=f==="x"?T:$}else{const $=[{x:l.x,y:d.y}],T=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===h?T:$:g=a.y===h?$:T,t===r){const b=Math.abs(e[f]-n[f]);if(b<=s){const P=Math.min(s-1,s-b);a[f]===h?y[f]=(l[f]>e[f]?-1:1)*P:E[f]=(d[f]>n[f]?-1:1)*P}}if(t!==r){const b=f==="x"?"y":"x",P=a[f]===c[b],N=l[b]>d[b],D=l[b]<d[b];(a[f]===1&&(!P&&N||P&&D)||a[f]!==1&&(!P&&D||P&&N))&&(g=f==="x"?$:T)}const F={x:l.x+y.x,y:l.y+y.y},C={x:d.x+E.x,y:d.y+E.y},S=Math.max(Math.abs(F.x-g[0].x),Math.abs(C.x-g[0].x)),H=Math.max(Math.abs(F.y-g[0].y),Math.abs(C.y-g[0].y));S>=H?(w=(F.x+C.x)/2,x=g[0].y):(w=g[0].x,x=(F.y+C.y)/2)}const M={x:l.x+y.x,y:l.y+y.y},k={x:d.x+E.x,y:d.y+E.y};return[[e,...M.x!==g[0].x||M.y!==g[0].y?[M]:[],...g,...k.x!==g[g.length-1].x||k.y!==g[g.length-1].y?[k]:[],n],w,x,p,v]}function _f(e,t,n,r){const o=Math.min(Ro(e,t)/2,Ro(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 l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${s+o*l},${i}Q ${s},${i} ${s},${i+o*d}`}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 jr({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:s=Q.Top,borderRadius:i=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,g,w]=bf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:s,center:{x:a,y:c},offset:l,stepPosition:d});let x=`M${u[0].x} ${u[0].y}`;for(let y=1;y<u.length-1;y++)x+=_f(u[y-1],u[y],u[y+1],i);return x+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[x,f,h,g,w]}function Lo(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ef(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Lo(t)||!Lo(n))return null;const r=t.internals.handleBounds||zo(t.handles),o=n.internals.handleBounds||zo(n.handles),s=Ho((r==null?void 0:r.source)??[],e.sourceHandle),i=Ho(e.connectionMode===Et.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(u=e.onError)==null||u.call(e,"008",Re.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(s==null?void 0:s.position)||Q.Bottom,c=(i==null?void 0:i.position)||Q.Top,l=ut(t,s,a),d=ut(n,i,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function zo(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 ut(e,t,n=Q.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??Xe(e);if(r)return{x:o+i/2,y:s+a/2};switch((t==null?void 0:t.position)??n){case Q.Top:return{x:o+i/2,y:s};case Q.Right:return{x:o+i,y:s+a/2};case Q.Bottom:return{x:o+i/2,y:s+a};case Q.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 Dr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Nf(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 l=Dr(c,t);s.has(l)||(i.push({id:l,color:c.color||n,...c}),s.add(l))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))}const wi=1e3,Sf=10,Zr={nodeOrigin:[0,0],nodeExtent:Xt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mf={...Zr,checkEquality:!0};function Qr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function kf(e,t,n){const r=Qr(Zr,n);for(const o of e.values())if(o.parentId)eo(o,e,t,r);else{const s=en(o,r.nodeOrigin),i=lt(o.extent)?o.extent:r.nodeExtent,a=ct(s,i,Xe(o));o.internals.positionAbsolute=a}}function Cf(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 Jr(e){return e==="manual"}function Tr(e,t,n,r={}){var d,u;const o=Qr(Mf,r),s={i:0},i=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Jr(o.zIndexMode)?wi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const f of e){let h=i.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=en(f,o.nodeOrigin),w=lt(f.extent)?f.extent:o.nodeExtent,x=ct(g,w,Xe(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(u=f.measured)==null?void 0:u.height},internals:{positionAbsolute:x,handleBounds:Cf(f,h),z:vi(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&eo(h,t,n,r,s),l||(l=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:l}}function Af(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 eo(e,t,n,r,o){const{elevateNodesOnSelect:s,nodeOrigin:i,nodeExtent:a,zIndexMode:c}=Qr(Zr,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Af(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*Sf),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=s&&!Jr(c)?wi:0,{x:f,y:h,z:g}=$f(e,d,i,a,u,c),{positionAbsolute:w}=e.internals,x=f!==w.x||h!==w.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:h}:w,z:g}})}function vi(e,t,n){const r=De(e.zIndex)?e.zIndex:0;return Jr(n)?r:r+(e.selected?t:0)}function $f(e,t,n,r,o,s){const{x:i,y:a}=t.internals.positionAbsolute,c=Xe(e),l=en(e,n),d=lt(e.extent)?ct(l,e.extent,c):l;let u=ct({x:i+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ai(u,c,t));const f=vi(e,o,s),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function to(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 l=((i=s.get(a.parentId))==null?void 0:i.expandedRect)??St(c),d=ci(l,a.rect);s.set(a.parentId,{expandedRect:d,parent:c})}return s.size>0&&s.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,u=Xe(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,w=Math.max(u.width,Math.round(a.width)),x=Math.max(u.height,Math.round(a.height)),y=(w-u.width)*f[0],E=(x-u.height)*f[1];(h>0||g>0||y||E)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+E}}),(p=n.get(l))==null||p.forEach(v=>{e.some(M=>M.id===v.id)||o.push({id:v.id,type:"position",position:{x:v.position.x+h,y:v.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:w+(h?f[0]*h-y:0),height:x+(g?f[1]*g-E:0)}})}),o}function If(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 l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const w=Ur(h.nodeElement),x=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(x||!g.internals.handleBounds||h.force))){const E=h.nodeElement.getBoundingClientRect(),p=lt(g.extent)?g.extent:s;let{positionAbsolute:v}=g.internals;g.parentId&&g.extent==="parent"?v=ai(v,w,t.get(g.parentId)):p&&(v=ct(v,p,w));const M={...g,measured:w,internals:{...g.internals,positionAbsolute:v,handleBounds:{source:jo("source",h.nodeElement,E,u,g.id),target:jo("target",h.nodeElement,E,u,g.id)}}};t.set(g.id,M),g.parentId&&eo(M,t,n,{nodeOrigin:o,zIndexMode:i}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:St(M,o)}))}}if(f.length>0){const h=to(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function Pf({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:s}){if(!t||!e.x&&!e.y)return!1;const i=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,s]],r);return!!i&&(i.x!==n[0]||i.y!==n[1]||i.k!==n[2])}function Oo(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 l=r.get(i)||new Map;r.set(i,l.set(n,t))}}function bi(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},l=`${o}-${i}--${s}-${a}`,d=`${s}-${a}--${o}-${i}`;Oo("source",c,d,e,o,i),Oo("target",c,l,e,s,a),t.set(r.id,r)}}function _i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_i(n,t):!1}function Vo(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 jf(e,t,n,r){const o=new Map;for(const[s,i]of e)if((i.selected||i.id===r)&&(!i.parentId||!_i(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 dr({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var i,a,c;const o=[];for(const[l,d]of t){const u=(i=n.get(l))==null?void 0:i.internals.userNode;u&&o.push({...u,position:d.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 Df({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=nn(s,t);return{x:i.x-s.x,y:i.y-s.y}}function Tf({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let s={x:null,y:null},i=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,g=!1,w=null;function x({noDragClassName:E,handleSelector:p,domNode:v,isSelectable:M,nodeId:k,nodeClickDistance:I=0}){f=Se(v);function $({x:S,y:H}){const{nodeLookup:b,nodeExtent:P,snapGrid:N,snapToGrid:D,nodeOrigin:R,onNodeDrag:A,onSelectionDrag:B,onError:O,updateNodePositions:V}=t();s={x:S,y:H};let K=!1;const q=a.size>1,ee=q&&P?Pr(tn(a)):null,re=q&&D?Df({dragItems:a,snapGrid:N,x:S,y:H}):null;for(const[J,L]of a){if(!b.has(J))continue;let W={x:S-L.distance.x,y:H-L.distance.y};D&&(W=re?{x:Math.round(W.x+re.x),y:Math.round(W.y+re.y)}:nn(W,N));let te=null;if(q&&P&&!L.extent&&ee){const{positionAbsolute:Z}=L.internals,Y=Z.x-ee.x+P[0][0],ie=Z.x+L.measured.width-ee.x2+P[1][0],ae=Z.y-ee.y+P[0][1],ce=Z.y+L.measured.height-ee.y2+P[1][1];te=[[Y,ae],[ie,ce]]}const{position:ne,positionAbsolute:X}=ii({nodeId:J,nextPosition:W,nodeLookup:b,nodeExtent:te||P,nodeOrigin:R,onError:O});K=K||L.position.x!==ne.x||L.position.y!==ne.y,L.position=ne,L.internals.positionAbsolute=X}if(g=g||K,!!K&&(V(a,!0),w&&(r||A||!k&&B))){const[J,L]=dr({nodeId:k,dragItems:a,nodeLookup:b});r==null||r(w,a,J,L),A==null||A(w,J,L),k||B==null||B(w,L)}}async function T(){if(!d)return;const{transform:S,panBy:H,autoPanSpeed:b,autoPanOnNodeDrag:P}=t();if(!P){c=!1,cancelAnimationFrame(i);return}const[N,D]=qr(l,d,b);(N!==0||D!==0)&&(s.x=(s.x??0)-N/S[2],s.y=(s.y??0)-D/S[2],await H({x:N,y:D})&&$(s)),i=requestAnimationFrame(T)}function F(S){var q;const{nodeLookup:H,multiSelectionActive:b,nodesDraggable:P,transform:N,snapGrid:D,snapToGrid:R,selectNodesOnDrag:A,onNodeDragStart:B,onSelectionDragStart:O,unselectNodesAndEdges:V}=t();u=!0,(!A||!M)&&!b&&k&&((q=H.get(k))!=null&&q.selected||V()),M&&A&&k&&(e==null||e(k));const K=Vt(S.sourceEvent,{transform:N,snapGrid:D,snapToGrid:R,containerBounds:d});if(s=K,a=jf(H,P,K,k),a.size>0&&(n||B||!k&&O)){const[ee,re]=dr({nodeId:k,dragItems:a,nodeLookup:H});n==null||n(S.sourceEvent,a,ee,re),B==null||B(S.sourceEvent,ee,re),k||O==null||O(S.sourceEvent,re)}}const C=Hs().clickDistance(I).on("start",S=>{const{domNode:H,nodeDragThreshold:b,transform:P,snapGrid:N,snapToGrid:D}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,w=S.sourceEvent,b===0&&F(S),s=Vt(S.sourceEvent,{transform:P,snapGrid:N,snapToGrid:D,containerBounds:d}),l=Te(S.sourceEvent,d)}).on("drag",S=>{const{autoPanOnNodeDrag:H,transform:b,snapGrid:P,snapToGrid:N,nodeDragThreshold:D,nodeLookup:R}=t(),A=Vt(S.sourceEvent,{transform:b,snapGrid:P,snapToGrid:N,containerBounds:d});if(w=S.sourceEvent,(S.sourceEvent.type==="touchmove"&&S.sourceEvent.touches.length>1||k&&!R.has(k))&&(h=!0),!h){if(!c&&H&&u&&(c=!0,T()),!u){const B=Te(S.sourceEvent,d),O=B.x-l.x,V=B.y-l.y;Math.sqrt(O*O+V*V)>D&&F(S)}(s.x!==A.xSnapped||s.y!==A.ySnapped)&&a&&u&&(l=Te(S.sourceEvent,d),$(A))}}).on("end",S=>{if(!u||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,u=!1,cancelAnimationFrame(i),a.size>0){const{nodeLookup:H,updateNodePositions:b,onNodeDragStop:P,onSelectionDragStop:N}=t();if(g&&(b(a,!1),g=!1),o||P||!k&&N){const[D,R]=dr({nodeId:k,dragItems:a,nodeLookup:H,dragging:!1});o==null||o(S.sourceEvent,a,D,R),P==null||P(S.sourceEvent,D,R),k||N==null||N(S.sourceEvent,R)}}}).filter(S=>{const H=S.target;return!S.button&&(!E||!Vo(H,`.${E}`,v))&&(!p||Vo(H,p,v))});f.call(C)}function y(){f==null||f.on(".drag",null)}return{update:x,destroy:y}}function Rf(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())Gt(o,St(s))>0&&r.push(s);return r}const Lf=250;function zf(e,t,n,r){var a,c;let o=[],s=1/0;const i=Rf(e,n,t+Lf);for(const l of i){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=ut(l,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<s?(o=[{...u,x:f,y:h}],s=g):g===s&&o.push({...u,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function Ei(e,t,n,r,o,s=!1){var l,d,u;const i=r.get(e);if(!i)return null;const a=o==="strict"?(l=i.internals.handleBounds)==null?void 0:l[t]:[...((d=i.internals.handleBounds)==null?void 0:d.source)??[],...((u=i.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&s?{...c,...ut(i,c,c.position,!0)}:c}function Ni(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Hf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Si=()=>!0;function Of(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:s,isTarget:i,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:x,isValidConnection:y=Si,onReconnectEnd:E,updateConnection:p,getTransform:v,getFromHandle:M,autoPanSpeed:k,dragThreshold:I=1,handleDomNode:$}){const T=fi(e.target);let F=0,C;const{x:S,y:H}=Te(e),b=Ni(s,$),P=a==null?void 0:a.getBoundingClientRect();let N=!1;if(!P||!b)return;const D=Ei(o,b,r,c,t);if(!D)return;let R=Te(e,P),A=!1,B=null,O=!1,V=null;function K(){if(!d||!P)return;const[ne,X]=qr(R,P,k);f({x:ne,y:X}),F=requestAnimationFrame(K)}const q={...D,nodeId:o,type:b,position:D.position},ee=c.get(o);let J={inProgress:!0,isValid:null,from:ut(ee,q,Q.Left,!0),fromHandle:q,fromPosition:q.position,fromNode:ee,to:R,toHandle:null,toPosition:Ao[q.position],toNode:null,pointer:R};function L(){N=!0,p(J),g==null||g(e,{nodeId:o,handleId:r,handleType:b})}I===0&&L();function W(ne){if(!N){const{x:ce,y:he}=Te(ne),ye=ce-S,ve=he-H;if(!(ye*ye+ve*ve>I*I))return;L()}if(!M()||!q){te(ne);return}const X=v();R=Te(ne,P),C=zf($t(R,X,!1,[1,1]),n,c,q),A||(K(),A=!0);const Z=Mi(ne,{handle:C,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:i?"target":"source",isValidConnection:y,doc:T,lib:l,flowId:u,nodeLookup:c});V=Z.handleDomNode,B=Z.connection,O=Hf(!!C,Z.isValid);const Y=c.get(o),ie=Y?ut(Y,q,Q.Left,!0):J.from,ae={...J,from:ie,isValid:O,to:Z.toHandle&&O?Mt({x:Z.toHandle.x,y:Z.toHandle.y},X):R,toHandle:Z.toHandle,toPosition:O&&Z.toHandle?Z.toHandle.position:Ao[q.position],toNode:Z.toHandle?c.get(Z.toHandle.nodeId):null,pointer:R};p(ae),J=ae}function te(ne){if(!("touches"in ne&&ne.touches.length>0)){if(N){(C||V)&&B&&O&&(w==null||w(B));const{inProgress:X,...Z}=J,Y={...Z,toPosition:J.toHandle?J.toPosition:null};x==null||x(ne,Y),s&&(E==null||E(ne,Y))}h(),cancelAnimationFrame(F),A=!1,O=!1,B=null,V=null,T.removeEventListener("mousemove",W),T.removeEventListener("mouseup",te),T.removeEventListener("touchmove",W),T.removeEventListener("touchend",te)}}T.addEventListener("mousemove",W),T.addEventListener("mouseup",te),T.addEventListener("touchmove",W),T.addEventListener("touchend",te)}function Mi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:s,doc:i,lib:a,flowId:c,isValidConnection:l=Si,nodeLookup:d}){const u=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:g}=Te(e),w=i.elementFromPoint(h,g),x=w!=null&&w.classList.contains(`${a}-flow__handle`)?w:f,y={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const E=Ni(void 0,x),p=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),M=x.classList.contains("connectable"),k=x.classList.contains("connectableend");if(!p||!E)return y;const I={source:u?p:r,sourceHandle:u?v:o,target:u?r:p,targetHandle:u?o:v};y.connection=I;const T=M&&k&&(n===Et.Strict?u&&E==="source"||!u&&E==="target":p!==r||v!==o);y.isValid=T&&l(I),y.toHandle=Ei(p,E,v,d,n,!0)}return y}const Rr={onPointerDown:Of,isValid:Mi};function Vf({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=Se(e);function s({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const v=n(),M=p.sourceEvent.ctrlKey&&Ut()?10:1,k=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,I=v[2]*Math.pow(2,k*M);t.scaleTo(I)};let w=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(w=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},y=p=>{const v=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const M=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],k=[M[0]-w[0],M[1]-w[1]];w=M;const I=r()*Math.max(v[2],Math.log(v[2]))*(h?-1:1),$={x:v[0]-k[0]*I,y:v[1]-k[1]*I},T=[[0,0],[c,l]];t.setViewportConstrained({x:$.x,y:$.y,zoom:v[2]},T,a)},E=ei().on("start",x).on("zoom",u?y:null).on("zoom.wheel",f?g:null);o.call(E,{})}function i(){o.on("zoom",null)}return{update:s,destroy:i,pointer:Pe}}const qn=e=>({x:e.x,y:e.y,zoom:e.k}),fr=({x:e,y:t,zoom:n})=>Yn.translate(e,t).scale(n),yt=(e,t)=>e.target.closest(`.${t}`),ki=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Bf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,hr=(e,t=0,n=Bf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Ci=e=>{const t=e.ctrlKey&&Ut()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ff({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:s,zoomOnPinch:i,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(yt(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&i){const x=Pe(d),y=Ci(d),E=u*Math.pow(2,y);r.scaleTo(n,E,x,d);return}const f=d.deltaMode===1?20:1;let h=o===ot.Vertical?0:d.deltaX*f,g=o===ot.Horizontal?0:d.deltaY*f;!Ut()&&d.shiftKey&&o!==ot.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/u)*s,-(g/u)*s,{internal:!0});const w=qn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,w),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,w))}}function Wf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const s=r.type==="wheel",i=!t&&s&&!r.ctrlKey,a=yt(r,e);if(r.ctrlKey&&s&&a&&r.preventDefault(),i||a)return null;r.preventDefault(),n.call(this,r,o)}}function Yf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,i,a;if((s=r.sourceEvent)!=null&&s.internal)return;const o=qn(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 Xf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return s=>{var i,a;e.usedRightMouseButton=!!(n&&ki(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,qn(s.transform)))}}function Kf({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&&ki(t,e.mouseButton??0)&&!e.usedRightMouseButton&&i.sourceEvent&&s(i.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=qn(i.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(i.sourceEvent,c)},n?150:0)}}}function qf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:s,userSelectionActive:i,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var x;const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(yt(u,`${l}-flow__node`)||yt(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!s&&!n||i||d&&!g||yt(u,a)&&g||yt(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((x=u.touches)==null?void 0:x.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&w}}function Gf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=ei().scaleExtent([t,n]).translateExtent(r),f=Se(e).call(u);E({x:o.x,y:o.y,zoom:Nt(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(Ci);async function w(C,S){return f?new Promise(H=>{u==null||u.interpolate((S==null?void 0:S.interpolate)==="linear"?Ot:Sn).transform(hr(f,S==null?void 0:S.duration,S==null?void 0:S.ease,()=>H(!0)),C)}):!1}function x({noWheelClassName:C,noPanClassName:S,onPaneContextMenu:H,userSelectionActive:b,panOnScroll:P,panOnDrag:N,panOnScrollMode:D,panOnScrollSpeed:R,preventScrolling:A,zoomOnPinch:B,zoomOnScroll:O,zoomOnDoubleClick:V,zoomActivationKeyPressed:K,lib:q,onTransformChange:ee,connectionInProgress:re,paneClickDistance:J,selectionOnDrag:L}){b&&!l.isZoomingOrPanning&&y();const W=P&&!K&&!b;u.clickDistance(L?1/0:!De(J)||J<0?0:J);const te=W?Ff({zoomPanValues:l,noWheelClassName:C,d3Selection:f,d3Zoom:u,panOnScrollMode:D,panOnScrollSpeed:R,zoomOnPinch:B,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:a}):Wf({noWheelClassName:C,preventScrolling:A,d3ZoomHandler:h});f.on("wheel.zoom",te,{passive:!1});const ne=Yf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:i});u.on("start",ne);const X=Xf({zoomPanValues:l,panOnDrag:N,onPaneContextMenu:!!H,onPanZoom:s,onTransformChange:ee});u.on("zoom",X);const Z=Kf({zoomPanValues:l,panOnDrag:N,panOnScroll:P,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});u.on("end",Z);const Y=qf({zoomActivationKeyPressed:K,panOnDrag:N,zoomOnScroll:O,panOnScroll:P,zoomOnDoubleClick:V,zoomOnPinch:B,userSelectionActive:b,noPanClassName:S,noWheelClassName:C,lib:q,connectionInProgress:re});u.filter(Y),V?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function y(){u.on("zoom",null)}async function E(C,S,H){const b=fr(C),P=u==null?void 0:u.constrain()(b,S,H);return P&&await w(P),P}async function p(C,S){const H=fr(C);return await w(H,S),H}function v(C){if(f){const S=fr(C),H=f.property("__zoom");(H.k!==C.zoom||H.x!==C.x||H.y!==C.y)&&(u==null||u.transform(f,S,null,{sync:!0}))}}function M(){const C=f?Js(f.node()):{x:0,y:0,k:1};return{x:C.x,y:C.y,zoom:C.k}}async function k(C,S){return f?new Promise(H=>{u==null||u.interpolate((S==null?void 0:S.interpolate)==="linear"?Ot:Sn).scaleTo(hr(f,S==null?void 0:S.duration,S==null?void 0:S.ease,()=>H(!0)),C)}):!1}async function I(C,S){return f?new Promise(H=>{u==null||u.interpolate((S==null?void 0:S.interpolate)==="linear"?Ot:Sn).scaleBy(hr(f,S==null?void 0:S.duration,S==null?void 0:S.ease,()=>H(!0)),C)}):!1}function $(C){u==null||u.scaleExtent(C)}function T(C){u==null||u.translateExtent(C)}function F(C){const S=!De(C)||C<0?0:C;u==null||u.clickDistance(S)}return{update:x,destroy:y,setViewport:p,setViewportConstrained:E,getViewport:M,scaleTo:k,scaleBy:I,setScaleExtent:$,setTranslateExtent:T,syncViewport:v,setClickDistance:F}}var kt;(function(e){e.Line="line",e.Handle="handle"})(kt||(kt={}));function Uf({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 Bo(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 Ke(e,t){return Math.max(0,t-e)}function qe(e,t){return Math.max(0,e-t)}function wn(e,t,n){return Math.max(0,t-e,e-n)}function Fo(e,t){return e?!t:t}function Zf(e,t,n,r,o,s,i,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:x,minHeight:y,maxHeight:E}=r,{x:p,y:v,width:M,height:k,aspectRatio:I}=e;let $=Math.floor(d?h-e.pointerX:0),T=Math.floor(u?g-e.pointerY:0);const F=M+(c?-$:$),C=k+(l?-T:T),S=-s[0]*M,H=-s[1]*k;let b=wn(F,w,x),P=wn(C,y,E);if(i){let R=0,A=0;c&&$<0?R=Ke(p+$+S,i[0][0]):!c&&$>0&&(R=qe(p+F+S,i[1][0])),l&&T<0?A=Ke(v+T+H,i[0][1]):!l&&T>0&&(A=qe(v+C+H,i[1][1])),b=Math.max(b,R),P=Math.max(P,A)}if(a){let R=0,A=0;c&&$>0?R=qe(p+$,a[0][0]):!c&&$<0&&(R=Ke(p+F,a[1][0])),l&&T>0?A=qe(v+T,a[0][1]):!l&&T<0&&(A=Ke(v+C,a[1][1])),b=Math.max(b,R),P=Math.max(P,A)}if(o){if(d){const R=wn(F/I,y,E)*I;if(b=Math.max(b,R),i){let A=0;!c&&!l||c&&!l&&f?A=qe(v+H+F/I,i[1][1])*I:A=Ke(v+H+(c?$:-$)/I,i[0][1])*I,b=Math.max(b,A)}if(a){let A=0;!c&&!l||c&&!l&&f?A=Ke(v+F/I,a[1][1])*I:A=qe(v+(c?$:-$)/I,a[0][1])*I,b=Math.max(b,A)}}if(u){const R=wn(C*I,w,x)/I;if(P=Math.max(P,R),i){let A=0;!c&&!l||l&&!c&&f?A=qe(p+C*I+S,i[1][0])/I:A=Ke(p+(l?T:-T)*I+S,i[0][0])/I,P=Math.max(P,A)}if(a){let A=0;!c&&!l||l&&!c&&f?A=Ke(p+C*I,a[1][0])/I:A=qe(p+(l?T:-T)*I,a[0][0])/I,P=Math.max(P,A)}}}T=T+(T<0?P:-P),$=$+($<0?b:-b),o&&(f?F>C*I?T=(Fo(c,l)?-$:$)/I:$=(Fo(c,l)?-T:T)*I:d?(T=$/I,l=c):($=T*I,c=l));const N=c?p+$:p,D=l?v+T:v;return{width:M+(c?-$:$),height:k+(l?-T:T),x:s[0]*$*(c?-1:1)+N,y:s[1]*T*(l?-1:1)+D}}const Ai={width:0,height:0,x:0,y:0},Qf={...Ai,pointerX:0,pointerY:0,aspectRatio:1};function Jf(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 eh({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const s=Se(e);let i={controlDirection:Bo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:x}){let y={...Ai},E={...Qf};i={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Bo(l)};let p,v=null,M=[],k,I,$,T=!1;const F=Hs().on("start",C=>{const{nodeLookup:S,transform:H,snapGrid:b,snapToGrid:P,nodeOrigin:N,paneDomNode:D}=n();if(p=S.get(t),!p)return;v=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:A}=Vt(C.sourceEvent,{transform:H,snapGrid:b,snapToGrid:P,containerBounds:v});y={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},E={...y,pointerX:R,pointerY:A,aspectRatio:y.width/y.height},k=void 0,I=lt(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(k=S.get(p.parentId)),k&&p.extent==="parent"&&(I=[[0,0],[k.measured.width,k.measured.height]]),M=[],$=void 0;for(const[B,O]of S)if(O.parentId===t&&(M.push({id:B,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const V=Jf(O,p,O.origin??N);$?$=[[Math.min(V[0][0],$[0][0]),Math.min(V[0][1],$[0][1])],[Math.max(V[1][0],$[1][0]),Math.max(V[1][1],$[1][1])]]:$=V}h==null||h(C,{...y})}).on("drag",C=>{const{transform:S,snapGrid:H,snapToGrid:b,nodeOrigin:P}=n(),N=Vt(C.sourceEvent,{transform:S,snapGrid:H,snapToGrid:b,containerBounds:v}),D=[];if(!p)return;const{x:R,y:A,width:B,height:O}=y,V={},K=p.origin??P,{width:q,height:ee,x:re,y:J}=Zf(E,i.controlDirection,N,i.boundaries,i.keepAspectRatio,K,I,$),L=q!==B,W=ee!==O,te=re!==R&&L,ne=J!==A&&W;if(!te&&!ne&&!L&&!W)return;if((te||ne||K[0]===1||K[1]===1)&&(V.x=te?re:y.x,V.y=ne?J:y.y,y.x=V.x,y.y=V.y,M.length>0)){const ie=re-R,ae=J-A;for(const ce of M)ce.position={x:ce.position.x-ie+K[0]*(q-B),y:ce.position.y-ae+K[1]*(ee-O)},D.push(ce)}if((L||W)&&(V.width=L&&(!i.resizeDirection||i.resizeDirection==="horizontal")?q:y.width,V.height=W&&(!i.resizeDirection||i.resizeDirection==="vertical")?ee:y.height,y.width=V.width,y.height=V.height),k&&p.expandParent){const ie=K[0]*(V.width??0);V.x&&V.x<ie&&(y.x=ie,E.x=E.x-(V.x-ie));const ae=K[1]*(V.height??0);V.y&&V.y<ae&&(y.y=ae,E.y=E.y-(V.y-ae))}const X=Uf({width:y.width,prevWidth:B,height:y.height,prevHeight:O,affectsX:i.controlDirection.affectsX,affectsY:i.controlDirection.affectsY}),Z={...y,direction:X};(x==null?void 0:x(C,Z))!==!1&&(T=!0,g==null||g(C,Z),r(V,D))}).on("end",C=>{T&&(w==null||w(C,{...y}),o==null||o({...y}),T=!1)});s.call(F)}function c(){s.on(".drag",null)}return{update:a,destroy:c}}var $i={exports:{}},Ii={},Pi={exports:{}},ji={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* use-sync-external-store-shim.production.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var Ct=_;function th(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nh=typeof Object.is=="function"?Object.is:th,rh=Ct.useState,oh=Ct.useEffect,sh=Ct.useLayoutEffect,ih=Ct.useDebugValue;function ah(e,t){var n=t(),r=rh({inst:{value:n,getSnapshot:t}}),o=r[0].inst,s=r[1];return sh(function(){o.value=n,o.getSnapshot=t,gr(o)&&s({inst:o})},[e,n,t]),oh(function(){return gr(o)&&s({inst:o}),e(function(){gr(o)&&s({inst:o})})},[e]),ih(n),n}function gr(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!nh(e,n)}catch{return!0}}function ch(e,t){return t()}var lh=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ch:ah;ji.useSyncExternalStore=Ct.useSyncExternalStore!==void 0?Ct.useSyncExternalStore:lh;Pi.exports=ji;var uh=Pi.exports;/**
|
|
11
|
-
* @license React
|
|
12
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var Gn=_,dh=uh;function fh(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hh=typeof Object.is=="function"?Object.is:fh,gh=dh.useSyncExternalStore,ph=Gn.useRef,mh=Gn.useEffect,yh=Gn.useMemo,xh=Gn.useDebugValue;Ii.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var s=ph(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=yh(function(){function c(h){if(!l){if(l=!0,d=h,h=r(h),o!==void 0&&i.hasValue){var g=i.value;if(o(g,h))return u=g}return u=h}if(g=u,hh(d,h))return g;var w=r(h);return o!==void 0&&o(g,w)?(d=h,g):(d=h,u=w)}var l=!1,d,u,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,o]);var a=gh(e,s[0],s[1]);return mh(function(){i.hasValue=!0,i.value=a},[a]),xh(a),a};$i.exports=Ii;var wh=$i.exports;const vh=Ka(wh),bh={},Wo=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(bh?"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()}},l=t=e(r,o,c);return c},_h=e=>e?Wo(e):Wo,{useDebugValue:Eh}=qa,{useSyncExternalStoreWithSelector:Nh}=vh,Sh=e=>e;function Di(e,t=Sh,n){const r=Nh(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Eh(r),r}const Yo=(e,t)=>{const n=_h(e),r=(o,s=t)=>Di(n,o,s);return Object.assign(r,n),r},Mh=(e,t)=>e?Yo(e,t):Yo;function le(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 Un=_.createContext(null),kh=Un.Provider,Ti=Re.error001("react");function se(e,t){const n=_.useContext(Un);if(n===null)throw new Error(Ti);return Di(n,e,t)}function ue(){const e=_.useContext(Un);if(e===null)throw new Error(Ti);return _.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Xo={display:"none"},Ch={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ri="react-flow__node-desc",Li="react-flow__edge-desc",Ah="react-flow__aria-live",$h=e=>e.ariaLiveMessage,Ih=e=>e.ariaLabelConfig;function Ph({rfId:e}){const t=se($h);return m.jsx("div",{id:`${Ah}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ch,children:t})}function jh({rfId:e,disableKeyboardA11y:t}){const n=se(Ih);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${Ri}-${e}`,style:Xo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${Li}-${e}`,style:Xo,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(Ph,{rfId:e})]})}const Zn=_.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},s)=>{const i=`${e}`.split("-");return m.jsx("div",{className:ge(["react-flow__panel",n,...i]),style:r,ref:s,...o,children:t})});Zn.displayName="Panel";function Dh({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Zn,{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 Th=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}},vn=e=>e.id;function Rh(e,t){return le(e.selectedNodes.map(vn),t.selectedNodes.map(vn))&&le(e.selectedEdges.map(vn),t.selectedEdges.map(vn))}function Lh({onSelectionChange:e}){const t=ue(),{selectedNodes:n,selectedEdges:r}=se(Th,Rh);return _.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(s=>s(o))},[n,r,e]),null}const zh=e=>!!e.onSelectionChangeHandlers;function Hh({onSelectionChange:e}){const t=se(zh);return e||t?m.jsx(Lh,{onSelectionChange:e}):null}const zi=[0,0],Oh={x:0,y:0,zoom:1},Vh=["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"],Ko=[...Vh,"rfId"],Bh=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}),qo={translateExtent:Xt,nodeOrigin:zi,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Fh(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:s,setNodeExtent:i,reset:a,setDefaultNodesAndEdges:c}=se(Bh,le),l=ue();_.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=qo,a()}),[]);const d=_.useRef(qo);return _.useEffect(()=>{for(const u of Ko){const f=e[u],h=d.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?r(f):u==="maxZoom"?o(f):u==="translateExtent"?s(f):u==="nodeExtent"?i(f):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:hf(f)}):u==="fitView"?l.setState({fitViewQueued:f}):u==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[u]:f})))}d.current=e},Ko.map(u=>e[u])),null}function Go(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Wh(e){var r;const[t,n]=_.useState(e==="system"?null:e);return _.useEffect(()=>{if(e!=="system"){n(e);return}const o=Go(),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=Go())!=null&&r.matches?"dark":"light"}const Uo=typeof document<"u"?document:null;function Zt(e=null,t={target:Uo,actInsideInputWithModifier:!0}){const[n,r]=_.useState(!1),o=_.useRef(!1),s=_.useRef(new Set([])),[i,a]=_.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
19
|
-
`).replace(`
|
|
20
|
-
|
|
21
|
-
`,`
|
|
22
|
-
+`).split(`
|
|
23
|
-
`)),d=l.reduce((u,f)=>u.concat(...f),[]);return[l,d]}return[[],[]]},[e]);return _.useEffect(()=>{const c=(t==null?void 0:t.target)??Uo,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=h=>{var x,y;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!l)&&hi(h))return!1;const w=Qo(h.code,a);if(s.current.add(h[w]),Zo(i,s.current,!1)){const E=((y=(x=h.composedPath)==null?void 0:x.call(h))==null?void 0:y[0])||h.target,p=(E==null?void 0:E.nodeName)==="BUTTON"||(E==null?void 0:E.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&h.preventDefault(),r(!0)}},u=h=>{const g=Qo(h.code,a);Zo(i,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[g]),h.key==="Meta"&&s.current.clear(),o.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function Zo(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function Qo(e,t){return t.includes(e)?"code":"key"}const Yh=()=>{const e=ue();return _.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!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),!0):!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=Gr(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}),!0):!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(),l={x:t.x-a,y:t.y-c},d=n.snapGrid??o,u=n.snapToGrid??s;return $t(l,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:s}=r.getBoundingClientRect(),i=Mt(t,n);return{x:i.x+o,y:i.y+s}}}),[])};function Hi(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)Xh(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 Xh(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 Kh(e,t){return Hi(e,t)}function qh(e,t){return Hi(e,t)}function tt(e,t){return{id:e,type:"select",selected:t}}function xt(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(tt(s.id,i)))}return r}function Jo({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 es(e){return{id:e.id,type:"remove"}}const Gh=li();function Uh(e,t,n={}){return wf(e,t,{...n,onError:n.onError??Gh})}const ts=e=>rf(e),Zh=e=>si(e);function Oi(e){return _.forwardRef(e)}const Qh=typeof window<"u"?_.useLayoutEffect:_.useEffect;function ns(e){const[t,n]=_.useState(BigInt(0)),[r]=_.useState(()=>Jh(()=>n(o=>o+BigInt(1))));return Qh(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Jh(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Vi=_.createContext(null);function eg({children:e}){const t=ue(),n=_.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let w=c;for(const y of a)w=typeof y=="function"?y(w):y;let x=Jo({items:w,lookup:f});for(const y of g.values())x=y(x);d&&l(w),x.length>0?u==null||u(x):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:E,setNodes:p}=t.getState();y&&p(E)})},[]),r=ns(n),o=_.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let h=c;for(const g of a)h=typeof g=="function"?g(h):g;d?l(h):u&&u(Jo({items:h,lookup:f}))},[]),s=ns(o),i=_.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return m.jsx(Vi.Provider,{value:i,children:e})}function tg(){const e=_.useContext(Vi);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const ng=e=>!!e.panZoom;function Qn(){const e=Yh(),t=ue(),n=tg(),r=se(ng),o=_.useMemo(()=>{const s=u=>t.getState().nodeLookup.get(u),i=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},c=u=>{var y,E;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=ts(u)?u:f.get(u.id),w=g.parentId?di(g.position,g.measured,g.parentId,f,h):g.position,x={...g,position:w,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((E=g.measured)==null?void 0:E.height)??g.height};return St(x)},l=(u,f,h={replace:!1})=>{i(g=>g.map(w=>{if(w.id===u){const x=typeof f=="function"?f(w):f;return h.replace&&ts(x)?x:{...w,...x}}return w}))},d=(u,f,h={replace:!1})=>{a(g=>g.map(w=>{if(w.id===u){const x=typeof f=="function"?f(w):f;return h.replace&&Zh(x)?x:{...w,...x}}return w}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var f;return(f=s(u))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:i,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(h=>[...h,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:h}=t.getState(),[g,w,x]=h;return{nodes:u.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:g,y:w,zoom:x}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:w,onEdgesDelete:x,triggerNodeChanges:y,triggerEdgeChanges:E,onDelete:p,onBeforeDelete:v}=t.getState(),{nodes:M,edges:k}=await lf({nodesToRemove:u,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:v}),I=k.length>0,$=M.length>0;if(I){const T=k.map(es);x==null||x(k),E(T)}if($){const T=M.map(es);w==null||w(M),y(T)}return($||I)&&(p==null||p({nodes:M,edges:k})),{deletedNodes:M,deletedEdges:k}},getIntersectingNodes:(u,f=!0,h)=>{const g=Io(u),w=g?u:c(u),x=h!==void 0;return w?(h||t.getState().nodes).filter(y=>{const E=t.getState().nodeLookup.get(y.id);if(E&&!g&&(y.id===u.id||!E.internals.positionAbsolute))return!1;const p=St(x?y:E),v=Gt(p,w);return f&&v>0||v>=p.width*p.height||v>=w.width*w.height}):[]},isNodeIntersecting:(u,f,h=!0)=>{const w=Io(u)?u:c(u);if(!w)return!1;const x=Gt(w,f);return h&&x>0||x>=f.width*f.height||x>=w.width*w.height},updateNode:l,updateNodeData:(u,f,h={replace:!1})=>{l(u,g=>{const w=typeof f=="function"?f(g):f;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},updateEdge:d,updateEdgeData:(u,f,h={replace:!1})=>{d(u,g=>{const w=typeof f=="function"?f(g):f;return h.replace?{...g,data:w}:{...g,data:{...g.data,...w}}},h)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return of(u,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:u,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${u}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${u?f?`-${u}-${f}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const f=t.getState().fitViewResolver??ff();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return _.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const rs=e=>e.selected,rg=typeof window<"u"?window:void 0;function og({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=ue(),{deleteElements:r}=Qn(),o=Zt(e,{actInsideInputWithModifier:!1}),s=Zt(t,{target:rg});_.useEffect(()=>{if(o){const{edges:i,nodes:a}=n.getState();r({nodes:a.filter(rs),edges:i.filter(rs)}),n.setState({nodesSelectionActive:!1})}},[o]),_.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function sg(e){const t=ue();_.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=Ur(e.current);(r.height===0||r.width===0)&&((a=(i=t.getState()).onError)==null||a.call(i,"004",Re.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 Jn={position:"absolute",width:"100%",height:"100%",top:0,left:0},ig=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ag({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:s=ot.Free,zoomOnDoubleClick:i=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:w,noPanClassName:x,onViewportChange:y,isControlledViewport:E,paneClickDistance:p,selectionOnDrag:v}){const M=ue(),k=_.useRef(null),{userSelectionActive:I,lib:$,connectionInProgress:T}=se(ig,le),F=Zt(f),C=_.useRef();sg(k);const S=_.useCallback(H=>{y==null||y({x:H[0],y:H[1],zoom:H[2]}),E||M.setState({transform:H})},[y,E]);return _.useEffect(()=>{if(k.current){C.current=Gf({domNode:k.current,minZoom:d,maxZoom:u,translateExtent:l,viewport:c,onDraggingChange:N=>M.setState(D=>D.paneDragging===N?D:{paneDragging:N}),onPanZoomStart:(N,D)=>{const{onViewportChangeStart:R,onMoveStart:A}=M.getState();A==null||A(N,D),R==null||R(D)},onPanZoom:(N,D)=>{const{onViewportChange:R,onMove:A}=M.getState();A==null||A(N,D),R==null||R(D)},onPanZoomEnd:(N,D)=>{const{onViewportChangeEnd:R,onMoveEnd:A}=M.getState();A==null||A(N,D),R==null||R(D)}});const{x:H,y:b,zoom:P}=C.current.getViewport();return M.setState({panZoom:C.current,transform:[H,b,P],domNode:k.current.closest(".react-flow")}),()=>{var N;(N=C.current)==null||N.destroy()}}},[]),_.useEffect(()=>{var H;(H=C.current)==null||H.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:s,zoomOnDoubleClick:i,panOnDrag:a,zoomActivationKeyPressed:F,preventScrolling:h,noPanClassName:x,userSelectionActive:I,noWheelClassName:w,lib:$,onTransformChange:S,connectionInProgress:T,selectionOnDrag:v,paneClickDistance:p})},[e,t,n,r,o,s,i,a,F,h,x,I,w,$,S,T,v,p]),m.jsx("div",{className:"react-flow__renderer",ref:k,style:Jn,children:g})}const cg=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function lg(){const{userSelectionActive:e,userSelectionRect:t}=se(cg,le);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 pr=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},ug=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function dg({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Kt.Full,panOnDrag:r,autoPanOnSelection:o,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:g,children:w}){const x=_.useRef(0),y=ue(),{userSelectionActive:E,elementsSelectable:p,dragging:v,connectionInProgress:M,panBy:k,autoPanSpeed:I}=se(ug,le),$=p&&(e||E),T=_.useRef(null),F=_.useRef(),C=_.useRef(new Set),S=_.useRef(new Set),H=_.useRef(!1),b=_.useRef({x:0,y:0}),P=_.useRef(!1),N=L=>{if(H.current||M){H.current=!1;return}l==null||l(L),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},D=L=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){L.preventDefault();return}d==null||d(L)},R=u?L=>u(L):void 0,A=L=>{H.current&&(L.stopPropagation(),H.current=!1)},B=L=>{var ce,he;const{domNode:W,transform:te}=y.getState();if(F.current=W==null?void 0:W.getBoundingClientRect(),!F.current)return;const ne=L.target===T.current;if(!ne&&!!L.target.closest(".nokey")||!e||!(i&&ne||t)||L.button!==0||!L.isPrimary)return;(he=(ce=L.target)==null?void 0:ce.setPointerCapture)==null||he.call(ce,L.pointerId),H.current=!1;const{x:Y,y:ie}=Te(L.nativeEvent,F.current),ae=$t({x:Y,y:ie},te);y.setState({userSelectionRect:{width:0,height:0,startX:ae.x,startY:ae.y,x:Y,y:ie}}),ne||(L.stopPropagation(),L.preventDefault())};function O(L,W){const{userSelectionRect:te}=y.getState();if(!te)return;const{transform:ne,nodeLookup:X,edgeLookup:Z,connectionLookup:Y,triggerNodeChanges:ie,triggerEdgeChanges:ae,defaultEdgeOptions:ce}=y.getState(),he={x:te.startX,y:te.startY},{x:ye,y:ve}=Mt(he,ne),ke={startX:he.x,startY:he.y,x:L<ye?L:ye,y:W<ve?W:ve,width:Math.abs(L-ye),height:Math.abs(W-ve)},be=C.current,xe=S.current;C.current=new Set(Kr(X,ke,ne,n===Kt.Partial,!0).map(_e=>_e.id)),S.current=new Set;const Ce=(ce==null?void 0:ce.selectable)??!0;for(const _e of C.current){const $e=Y.get(_e);if($e)for(const{edgeId:Ee}of $e.values()){const Ie=Z.get(Ee);Ie&&(Ie.selectable??Ce)&&S.current.add(Ee)}}if(!Po(be,C.current)){const _e=xt(X,C.current,!0);ie(_e)}if(!Po(xe,S.current)){const _e=xt(Z,S.current);ae(_e)}y.setState({userSelectionRect:ke,userSelectionActive:!0,nodesSelectionActive:!1})}function V(){if(!o||!F.current)return;const[L,W]=qr(b.current,F.current,I);k({x:L,y:W}).then(te=>{if(!H.current||!te){x.current=requestAnimationFrame(V);return}const{x:ne,y:X}=b.current;O(ne,X),x.current=requestAnimationFrame(V)})}const K=()=>{cancelAnimationFrame(x.current),x.current=0,P.current=!1};_.useEffect(()=>()=>K(),[]);const q=L=>{const{userSelectionRect:W,transform:te,resetSelectedElements:ne}=y.getState();if(!F.current||!W)return;const{x:X,y:Z}=Te(L.nativeEvent,F.current);b.current={x:X,y:Z};const Y=Mt({x:W.startX,y:W.startY},te);if(!H.current){const ie=t?0:s;if(Math.hypot(X-Y.x,Z-Y.y)<=ie)return;ne(),a==null||a(L)}H.current=!0,P.current||(V(),P.current=!0),O(X,Z)},ee=L=>{var W,te;L.button===0&&((te=(W=L.target)==null?void 0:W.releasePointerCapture)==null||te.call(W,L.pointerId),!E&&L.target===T.current&&y.getState().userSelectionRect&&(N==null||N(L)),y.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(c==null||c(L),y.setState({nodesSelectionActive:C.current.size>0})),K())},re=L=>{var W,te;(te=(W=L.target)==null?void 0:W.releasePointerCapture)==null||te.call(W,L.pointerId),K()},J=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:ge(["react-flow__pane",{draggable:J,dragging:v,selection:e}]),onClick:$?void 0:pr(N,T),onContextMenu:pr(D,T),onWheel:pr(R,T),onPointerEnter:$?void 0:f,onPointerMove:$?q:h,onPointerUp:$?ee:void 0,onPointerCancel:$?re:void 0,onPointerDownCapture:$?B:void 0,onClickCapture:$?A:void 0,onPointerLeave:g,ref:T,style:Jn,children:[w,m.jsx(lg,{})]})}function Lr({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:s,multiSelectionActive:i,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",Re.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&i)&&(s({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function Bi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:s,nodeClickDistance:i}){const a=ue(),[c,l]=_.useState(!1),d=_.useRef();return _.useEffect(()=>{d.current=Tf({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{Lr({id:u,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),_.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:o,nodeClickDistance:i}),()=>{var u;(u=d.current)==null||u.destroy()}},[n,r,t,s,e,o,i]),c}const fg=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Fi(){const e=ue();return _.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:s,nodesDraggable:i,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),u=new Map,f=fg(i),h=o?s[0]:5,g=o?s[1]:5,w=n.direction.x*h*n.factor,x=n.direction.y*g*n.factor;for(const[,y]of l){if(!f(y))continue;let E={x:y.internals.positionAbsolute.x+w,y:y.internals.positionAbsolute.y+x};o&&(E=nn(E,s));const{position:p,positionAbsolute:v}=ii({nodeId:y.id,nextPosition:E,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});y.position=p,y.internals.positionAbsolute=v,u.set(y.id,y)}c(u)},[])}const no=_.createContext(null),hg=no.Provider;no.Consumer;const Wi=()=>_.useContext(no),gg=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),pg=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:s,connection:i}=r,{fromHandle:a,toHandle:c,isValid:l}=i,d=(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:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:s===Et.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:d&&l}};function mg({type:e="source",position:t=Q.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:s=!0,id:i,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:u,...f},h){var P,N;const g=i||null,w=e==="target",x=ue(),y=Wi(),{connectOnClick:E,noPanClassName:p,rfId:v}=se(gg,le),{connectingFrom:M,connectingTo:k,clickConnecting:I,isPossibleEndHandle:$,connectionInProcess:T,clickConnectionInProcess:F,valid:C}=se(pg(y,g,e),le);y||(N=(P=x.getState()).onError)==null||N.call(P,"010",Re.error010());const S=D=>{const{defaultEdgeOptions:R,onConnect:A,hasDefaultEdges:B}=x.getState(),O={...R,...D};if(B){const{edges:V,setEdges:K,onError:q}=x.getState();K(Uh(O,V,{onError:q}))}A==null||A(O),a==null||a(O)},H=D=>{if(!y)return;const R=gi(D.nativeEvent);if(o&&(R&&D.button===0||!R)){const A=x.getState();Rr.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:A.autoPanOnConnect,connectionMode:A.connectionMode,connectionRadius:A.connectionRadius,domNode:A.domNode,nodeLookup:A.nodeLookup,lib:A.lib,isTarget:w,handleId:g,nodeId:y,flowId:A.rfId,panBy:A.panBy,cancelConnection:A.cancelConnection,onConnectStart:A.onConnectStart,onConnectEnd:(...B)=>{var O,V;return(V=(O=x.getState()).onConnectEnd)==null?void 0:V.call(O,...B)},updateConnection:A.updateConnection,onConnect:S,isValidConnection:n||((...B)=>{var O,V;return((V=(O=x.getState()).isValidConnection)==null?void 0:V.call(O,...B))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:A.autoPanSpeed,dragThreshold:A.connectionDragThreshold})}R?d==null||d(D):u==null||u(D)},b=D=>{const{onClickConnectStart:R,onClickConnectEnd:A,connectionClickStartHandle:B,connectionMode:O,isValidConnection:V,lib:K,rfId:q,nodeLookup:ee,connection:re}=x.getState();if(!y||!B&&!o)return;if(!B){R==null||R(D.nativeEvent,{nodeId:y,handleId:g,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const J=fi(D.target),L=n||V,{connection:W,isValid:te}=Rr.isValid(D.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:O,fromNodeId:B.nodeId,fromHandleId:B.id||null,fromType:B.type,isValidConnection:L,flowId:q,doc:J,lib:K,nodeLookup:ee});te&&W&&S(W);const ne=structuredClone(re);delete ne.inProgress,ne.toPosition=ne.toHandle?ne.toHandle.position:null,A==null||A(D,ne),x.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${v}-${y}-${g}-${e}`,className:ge(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,l,{source:!w,target:w,connectable:r,connectablestart:o,connectableend:s,clickconnecting:I,connectingfrom:M,connectingto:k,valid:C,connectionindicator:r&&(!T||$)&&(T||F?s:o)}]),onMouseDown:H,onTouchStart:H,onClick:E?b:void 0,ref:h,...f,children:c})}const At=_.memo(Oi(mg));function yg({data:e,isConnectable:t,sourcePosition:n=Q.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(At,{type:"source",position:n,isConnectable:t})]})}function xg({data:e,isConnectable:t,targetPosition:n=Q.Top,sourcePosition:r=Q.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(At,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(At,{type:"source",position:r,isConnectable:t})]})}function wg(){return null}function vg({data:e,isConnectable:t,targetPosition:n=Q.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(At,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const zn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},os={input:yg,default:xg,output:vg,group:wg};function bg(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 _g=e=>{const{width:t,height:n,x:r,y:o}=tn(e.nodeLookup,{filter:s=>!!s.selected});return{width:De(t)?t:null,height:De(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 Eg({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=ue(),{width:o,height:s,transformString:i,userSelectionActive:a}=se(_g,le),c=Fi(),l=_.useRef(null);_.useEffect(()=>{var h;n||(h=l.current)==null||h.focus({preventScroll:!0})},[n]);const d=!a&&o!==null&&s!==null;if(Bi({nodeRef:l,disabled:!d}),!d)return null;const u=e?h=>{const g=r.getState().nodes.filter(w=>w.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(zn,h.key)&&(h.preventDefault(),c({direction:zn[h.key],factor:h.shiftKey?4:1}))};return m.jsx("div",{className:ge(["react-flow__nodesselection","react-flow__container",t]),style:{transform:i},children:m.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:s}})})}const ss=typeof window<"u"?window:void 0,Ng=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Yi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:w,zoomActivationKeyCode:x,elementsSelectable:y,zoomOnScroll:E,zoomOnPinch:p,panOnScroll:v,panOnScrollSpeed:M,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:$,autoPanOnSelection:T,defaultViewport:F,translateExtent:C,minZoom:S,maxZoom:H,preventScrolling:b,onSelectionContextMenu:P,noWheelClassName:N,noPanClassName:D,disableKeyboardA11y:R,onViewportChange:A,isControlledViewport:B}){const{nodesSelectionActive:O,userSelectionActive:V}=se(Ng,le),K=Zt(l,{target:ss}),q=Zt(w,{target:ss}),ee=q||$,re=q||v,J=d&&ee!==!0,L=K||V||J;return og({deleteKeyCode:c,multiSelectionKeyCode:g}),m.jsx(ag,{onPaneContextMenu:s,elementsSelectable:y,zoomOnScroll:E,zoomOnPinch:p,panOnScroll:re,panOnScrollSpeed:M,panOnScrollMode:k,zoomOnDoubleClick:I,panOnDrag:!K&&ee,defaultViewport:F,translateExtent:C,minZoom:S,maxZoom:H,zoomActivationKeyCode:x,preventScrolling:b,noWheelClassName:N,noPanClassName:D,onViewportChange:A,isControlledViewport:B,paneClickDistance:a,selectionOnDrag:J,children:m.jsxs(dg,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:s,onPaneScroll:i,panOnDrag:ee,autoPanOnSelection:T,isSelecting:!!L,selectionMode:u,selectionKeyPressed:K,paneClickDistance:a,selectionOnDrag:J,children:[e,O&&m.jsx(Eg,{onSelectionContextMenu:P,noPanClassName:D,disableKeyboardA11y:R})]})})}Yi.displayName="FlowRenderer";const Sg=_.memo(Yi),Mg=e=>t=>e?Kr(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 kg(e){return se(_.useCallback(Mg(e),[e]),le)}const Cg=e=>e.updateNodeInternals;function Ag(){const e=se(Cg),[t]=_.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 _.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function $g({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=ue(),s=_.useRef(null),i=_.useRef(null),a=_.useRef(e.sourcePosition),c=_.useRef(e.targetPosition),l=_.useRef(t),d=n&&!!e.internals.handleBounds;return _.useEffect(()=>{s.current&&!e.hidden&&(!d||i.current!==s.current)&&(i.current&&(r==null||r.unobserve(i.current)),r==null||r.observe(s.current),i.current=s.current)},[d,e.hidden]),_.useEffect(()=>()=>{i.current&&(r==null||r.unobserve(i.current),i.current=null)},[]),_.useEffect(()=>{if(s.current){const u=l.current!==t,f=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(u||f||h)&&(l.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 Ig({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:s,onDoubleClick:i,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:w,nodeTypes:x,nodeClickDistance:y,onError:E}){const{node:p,internals:v,isParent:M}=se(L=>{const W=L.nodeLookup.get(e),te=L.parentLookup.has(e);return{node:W,internals:W.internals,isParent:te}},le);let k=p.type||"default",I=(x==null?void 0:x[k])||os[k];I===void 0&&(E==null||E("003",Re.error003(k)),k="default",I=(x==null?void 0:x.default)||os.default);const $=!!(p.draggable||a&&typeof p.draggable>"u"),T=!!(p.selectable||c&&typeof p.selectable>"u"),F=!!(p.connectable||l&&typeof p.connectable>"u"),C=!!(p.focusable||d&&typeof p.focusable>"u"),S=ue(),H=ui(p),b=$g({node:p,nodeType:k,hasDimensions:H,resizeObserver:u}),P=Bi({nodeRef:b,disabled:p.hidden||!$,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:y}),N=Fi();if(p.hidden)return null;const D=Xe(p),R=bg(p),A=T||$||t||n||r||o,B=n?L=>n(L,{...v.userNode}):void 0,O=r?L=>r(L,{...v.userNode}):void 0,V=o?L=>o(L,{...v.userNode}):void 0,K=s?L=>s(L,{...v.userNode}):void 0,q=i?L=>i(L,{...v.userNode}):void 0,ee=L=>{const{selectNodesOnDrag:W,nodeDragThreshold:te}=S.getState();T&&(!W||!$||te>0)&&Lr({id:e,store:S,nodeRef:b}),t&&t(L,{...v.userNode})},re=L=>{if(!(hi(L.nativeEvent)||g)){if(ti.includes(L.key)&&T){const W=L.key==="Escape";Lr({id:e,store:S,unselect:W,nodeRef:b})}else if($&&p.selected&&Object.prototype.hasOwnProperty.call(zn,L.key)){L.preventDefault();const{ariaLabelConfig:W}=S.getState();S.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:L.key.replace("Arrow","").toLowerCase(),x:~~v.positionAbsolute.x,y:~~v.positionAbsolute.y})}),N({direction:zn[L.key],factor:L.shiftKey?4:1})}}},J=()=>{var Y;if(g||!((Y=b.current)!=null&&Y.matches(":focus-visible")))return;const{transform:L,width:W,height:te,autoPanOnNodeFocus:ne,setCenter:X}=S.getState();if(!ne)return;Kr(new Map([[e,p]]),{x:0,y:0,width:W,height:te},L,!0).length>0||X(p.position.x+D.width/2,p.position.y+D.height/2,{zoom:L[2]})};return m.jsx("div",{className:ge(["react-flow__node",`react-flow__node-${k}`,{[h]:$},p.className,{selected:p.selected,selectable:T,parent:M,draggable:$,dragging:P}]),ref:b,style:{zIndex:v.z,transform:`translate(${v.positionAbsolute.x}px,${v.positionAbsolute.y}px)`,pointerEvents:A?"all":"none",visibility:H?"visible":"hidden",...p.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:O,onMouseLeave:V,onContextMenu:K,onClick:ee,onDoubleClick:q,onKeyDown:C?re:void 0,tabIndex:C?0:void 0,onFocus:C?J:void 0,role:p.ariaRole??(C?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Ri}-${w}`,"aria-label":p.ariaLabel,...p.domAttributes,children:m.jsx(hg,{value:e,children:m.jsx(I,{id:e,data:p.data,type:k,positionAbsoluteX:v.positionAbsolute.x,positionAbsoluteY:v.positionAbsolute.y,selected:p.selected??!1,selectable:T,draggable:$,deletable:p.deletable??!0,isConnectable:F,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:P,dragHandle:p.dragHandle,zIndex:v.z,parentId:p.parentId,...D})})})}var Pg=_.memo(Ig);const jg=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Xi(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:s}=se(jg,le),i=kg(e.onlyRenderVisibleElements),a=Ag();return m.jsx("div",{className:"react-flow__nodes",style:Jn,children:i.map(c=>m.jsx(Pg,{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))})}Xi.displayName="NodeRenderer";const Dg=_.memo(Xi);function Tg(e){return se(_.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&&mf({sourceNode:s,targetNode:i,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),le)}const Rg=({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"})},Lg=({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"})},is={[qt.Arrow]:Rg,[qt.ArrowClosed]:Lg};function zg(e){const t=ue();return _.useMemo(()=>{var o,s;return Object.prototype.hasOwnProperty.call(is,e)?is[e]:((s=(o=t.getState()).onError)==null||s.call(o,"009",Re.error009(e)),null)},[e])}const Hg=({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=zg(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},Ki=({defaultColor:e,rfId:t})=>{const n=se(s=>s.edges),r=se(s=>s.defaultEdgeOptions),o=_.useMemo(()=>Nf(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(Hg,{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};Ki.displayName="MarkerDefinitions";var Og=_.memo(Ki);function qi({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:s,labelBgPadding:i=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[u,f]=_.useState({x:1,y:0,width:0,height:0}),h=ge(["react-flow__edge-textwrapper",l]),g=_.useRef(null);return _.useEffect(()=>{if(g.current){const w=g.current.getBBox();f({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:h,visibility:u.width?"visible":"hidden",...d,children:[o&&m.jsx("rect",{width:u.width+2*i[0],x:-i[0],y:-i[1],height:u.height+2*i[1],className:"react-flow__edge-textbg",style:s,rx:a,ry:a}),m.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}qi.displayName="EdgeText";const Vg=_.memo(qi);function er({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...d,d:e,fill:"none",className:ge(["react-flow__edge-path",d.className])}),l?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&De(t)&&De(n)?m.jsx(Vg,{x:t,y:n,label:r,labelStyle:o,labelShowBg:s,labelBgStyle:i,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function as({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===Q.Left||e===Q.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function Gi({sourceX:e,sourceY:t,sourcePosition:n=Q.Bottom,targetX:r,targetY:o,targetPosition:s=Q.Top}){const[i,a]=as({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,l]=as({pos:s,x1:r,y1:o,x2:e,y2:t}),[d,u,f,h]=pi({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:i,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${i},${a} ${c},${l} ${r},${o}`,d,u,f,h]}function Ui(e){return _.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i,targetPosition:a,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:x,interactionWidth:y})=>{const[E,p,v]=Gi({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a}),M=e.isInternal?void 0:t;return m.jsx(er,{id:M,path:E,labelX:p,labelY:v,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:x,interactionWidth:y})})}const Bg=Ui({isInternal:!1}),Zi=Ui({isInternal:!0});Bg.displayName="SimpleBezierEdge";Zi.displayName="SimpleBezierEdgeInternal";function Qi(e){return _.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:h=Q.Bottom,targetPosition:g=Q.Top,markerEnd:w,markerStart:x,pathOptions:y,interactionWidth:E})=>{const[p,v,M]=jr({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:s,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),k=e.isInternal?void 0:t;return m.jsx(er,{id:k,path:p,labelX:v,labelY:M,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:w,markerStart:x,interactionWidth:E})})}const Ji=Qi({isInternal:!1}),ea=Qi({isInternal:!0});Ji.displayName="SmoothStepEdge";ea.displayName="SmoothStepEdgeInternal";function ta(e){return _.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return m.jsx(Ji,{...n,id:r,pathOptions:_.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const Fg=ta({isInternal:!1}),na=ta({isInternal:!0});Fg.displayName="StepEdge";na.displayName="StepEdgeInternal";function ra(e){return _.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:w})=>{const[x,y,E]=xi({sourceX:n,sourceY:r,targetX:o,targetY:s}),p=e.isInternal?void 0:t;return m.jsx(er,{id:p,path:x,labelX:y,labelY:E,label:i,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:w})})}const Wg=ra({isInternal:!1}),oa=ra({isInternal:!0});Wg.displayName="StraightEdge";oa.displayName="StraightEdgeInternal";function sa(e){return _.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:s,sourcePosition:i=Q.Bottom,targetPosition:a=Q.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:x,pathOptions:y,interactionWidth:E})=>{const[p,v,M]=mi({sourceX:n,sourceY:r,sourcePosition:i,targetX:o,targetY:s,targetPosition:a,curvature:y==null?void 0:y.curvature}),k=e.isInternal?void 0:t;return m.jsx(er,{id:k,path:p,labelX:v,labelY:M,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:w,markerStart:x,interactionWidth:E})})}const Yg=sa({isInternal:!1}),ia=sa({isInternal:!0});Yg.displayName="BezierEdge";ia.displayName="BezierEdgeInternal";const cs={default:ia,straight:oa,step:na,smoothstep:ea,simplebezier:Zi},ls={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Xg=(e,t,n)=>n===Q.Left?e-t:n===Q.Right?e+t:e,Kg=(e,t,n)=>n===Q.Top?e-t:n===Q.Bottom?e+t:e,us="react-flow__edgeupdater";function ds({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:ge([us,`${us}-${a}`]),cx:Xg(t,r,e),cy:Kg(n,r,e),r,stroke:"transparent",fill:"transparent"})}function qg({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:s,targetY:i,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:h}){const g=ue(),w=(v,M)=>{if(v.button!==0)return;const{autoPanOnConnect:k,domNode:I,connectionMode:$,connectionRadius:T,lib:F,onConnectStart:C,cancelConnection:S,nodeLookup:H,rfId:b,panBy:P,updateConnection:N}=g.getState(),D=M.type==="target",R=(O,V)=>{f(!1),u==null||u(O,n,M.type,V)},A=O=>l==null?void 0:l(n,O),B=(O,V)=>{f(!0),d==null||d(v,n,M.type),C==null||C(O,V)};Rr.onPointerDown(v.nativeEvent,{autoPanOnConnect:k,connectionMode:$,connectionRadius:T,domNode:I,handleId:M.id,nodeId:M.nodeId,nodeLookup:H,isTarget:D,edgeUpdaterType:M.type,lib:F,flowId:b,cancelConnection:S,panBy:P,isValidConnection:(...O)=>{var V,K;return((K=(V=g.getState()).isValidConnection)==null?void 0:K.call(V,...O))??!0},onConnect:A,onConnectStart:B,onConnectEnd:(...O)=>{var V,K;return(K=(V=g.getState()).onConnectEnd)==null?void 0:K.call(V,...O)},onReconnectEnd:R,updateConnection:N,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:v.currentTarget})},x=v=>w(v,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=v=>w(v,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),E=()=>h(!0),p=()=>h(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(ds,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:E,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&m.jsx(ds,{position:c,centerX:s,centerY:i,radius:t,onMouseDown:y,onMouseEnter:E,onMouseOut:p,type:"target"})]})}function Gg({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:w,noPanClassName:x,onError:y,disableKeyboardA11y:E}){let p=se(X=>X.edgeLookup.get(e));const v=se(X=>X.defaultEdgeOptions);p=v?{...v,...p}:p;let M=p.type||"default",k=(w==null?void 0:w[M])||cs[M];k===void 0&&(y==null||y("011",Re.error011(M)),M="default",k=(w==null?void 0:w.default)||cs.default);const I=!!(p.focusable||t&&typeof p.focusable>"u"),$=typeof u<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),T=!!(p.selectable||r&&typeof p.selectable>"u"),F=_.useRef(null),[C,S]=_.useState(!1),[H,b]=_.useState(!1),P=ue(),{zIndex:N,sourceX:D,sourceY:R,targetX:A,targetY:B,sourcePosition:O,targetPosition:V}=se(_.useCallback(X=>{const Z=X.nodeLookup.get(p.source),Y=X.nodeLookup.get(p.target);if(!Z||!Y)return{zIndex:p.zIndex,...ls};const ie=Ef({id:e,sourceNode:Z,targetNode:Y,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:X.connectionMode,onError:y});return{zIndex:pf({selected:p.selected,zIndex:p.zIndex,sourceNode:Z,targetNode:Y,elevateOnSelect:X.elevateEdgesOnSelect,zIndexMode:X.zIndexMode}),...ie||ls}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),le),K=_.useMemo(()=>p.markerStart?`url('#${Dr(p.markerStart,g)}')`:void 0,[p.markerStart,g]),q=_.useMemo(()=>p.markerEnd?`url('#${Dr(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||D===null||R===null||A===null||B===null)return null;const ee=X=>{var ae;const{addSelectedEdges:Z,unselectNodesAndEdges:Y,multiSelectionActive:ie}=P.getState();T&&(P.setState({nodesSelectionActive:!1}),p.selected&&ie?(Y({nodes:[],edges:[p]}),(ae=F.current)==null||ae.blur()):Z([e])),o&&o(X,p)},re=s?X=>{s(X,{...p})}:void 0,J=i?X=>{i(X,{...p})}:void 0,L=a?X=>{a(X,{...p})}:void 0,W=c?X=>{c(X,{...p})}:void 0,te=l?X=>{l(X,{...p})}:void 0,ne=X=>{var Z;if(!E&&ti.includes(X.key)&&T){const{unselectNodesAndEdges:Y,addSelectedEdges:ie}=P.getState();X.key==="Escape"?((Z=F.current)==null||Z.blur(),Y({edges:[p]})):ie([e])}};return m.jsx("svg",{style:{zIndex:N},children:m.jsxs("g",{className:ge(["react-flow__edge",`react-flow__edge-${M}`,p.className,x,{selected:p.selected,animated:p.animated,inactive:!T&&!o,updating:C,selectable:T}]),onClick:ee,onDoubleClick:re,onContextMenu:J,onMouseEnter:L,onMouseMove:W,onMouseLeave:te,onKeyDown:I?ne:void 0,tabIndex:I?0:void 0,role:p.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":I?`${Li}-${g}`:void 0,ref:F,...p.domAttributes,children:[!H&&m.jsx(k,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:T,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:D,sourceY:R,targetX:A,targetY:B,sourcePosition:O,targetPosition:V,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:K,markerEnd:q,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),$&&m.jsx(qg,{edge:p,isReconnectable:$,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,sourceX:D,sourceY:R,targetX:A,targetY:B,sourcePosition:O,targetPosition:V,setUpdateHover:S,setReconnecting:b})]})})}var Ug=_.memo(Gg);const Zg=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function aa({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:s,onEdgeContextMenu:i,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:w}){const{edgesFocusable:x,edgesReconnectable:y,elementsSelectable:E,onError:p}=se(Zg,le),v=Tg(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(Og,{defaultColor:e,rfId:n}),v.map(M=>m.jsx(Ug,{id:M,edgesFocusable:x,edgesReconnectable:y,elementsSelectable:E,noPanClassName:o,onReconnect:s,onContextMenu:i,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:w},M))]})}aa.displayName="EdgeRenderer";const Qg=_.memo(aa),Jg=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function ep({children:e}){const t=se(Jg);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function tp(e){const t=Qn(),n=_.useRef(!1);_.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const np=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function rp(e){const t=se(np),n=ue();return _.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function op(e){return e.connection.inProgress?{...e.connection,to:$t(e.connection.to,e.transform)}:{...e.connection}}function sp(e){return op}function ip(e){const t=sp();return se(t,le)}const ap=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function cp({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:s,height:i,isValid:a,inProgress:c}=se(ap,le);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:ge(["react-flow__connection",oi(a)]),children:m.jsx(ca,{style:t,type:n,CustomComponent:r,isValid:a})})})}const ca=({style:e,type:t=Ge.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:s,fromNode:i,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:u,toPosition:f,pointer:h}=ip();if(!o)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:i,fromHandle:a,fromX:s.x,fromY:s.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:oi(r),toNode:d,toHandle:u,pointer:h});let g="";const w={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ge.Bezier:[g]=mi(w);break;case Ge.SimpleBezier:[g]=Gi(w);break;case Ge.Step:[g]=jr({...w,borderRadius:0});break;case Ge.SmoothStep:[g]=jr(w);break;default:[g]=xi(w)}return m.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};ca.displayName="ConnectionLine";const lp={};function fs(e=lp){_.useRef(e),ue(),_.useEffect(()=>{},[e])}function up(){ue(),_.useRef(!1),_.useEffect(()=>{},[])}function la({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:s,onEdgeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:w,connectionLineComponent:x,connectionLineContainerStyle:y,selectionKeyCode:E,selectionOnDrag:p,selectionMode:v,multiSelectionKeyCode:M,panActivationKeyCode:k,zoomActivationKeyCode:I,deleteKeyCode:$,onlyRenderVisibleElements:T,elementsSelectable:F,defaultViewport:C,translateExtent:S,minZoom:H,maxZoom:b,preventScrolling:P,defaultMarkerColor:N,zoomOnScroll:D,zoomOnPinch:R,panOnScroll:A,panOnScrollSpeed:B,panOnScrollMode:O,zoomOnDoubleClick:V,panOnDrag:K,autoPanOnSelection:q,onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:J,onPaneMouseLeave:L,onPaneScroll:W,onPaneContextMenu:te,paneClickDistance:ne,nodeClickDistance:X,onEdgeContextMenu:Z,onEdgeMouseEnter:Y,onEdgeMouseMove:ie,onEdgeMouseLeave:ae,reconnectRadius:ce,onReconnect:he,onReconnectStart:ye,onReconnectEnd:ve,noDragClassName:ke,noWheelClassName:be,noPanClassName:xe,disableKeyboardA11y:Ce,nodeExtent:_e,rfId:$e,viewport:Ee,onViewportChange:Ie}){return fs(e),fs(t),up(),tp(n),rp(Ee),m.jsx(Sg,{onPaneClick:ee,onPaneMouseEnter:re,onPaneMouseMove:J,onPaneMouseLeave:L,onPaneContextMenu:te,onPaneScroll:W,paneClickDistance:ne,deleteKeyCode:$,selectionKeyCode:E,selectionOnDrag:p,selectionMode:v,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:M,panActivationKeyCode:k,zoomActivationKeyCode:I,elementsSelectable:F,zoomOnScroll:D,zoomOnPinch:R,zoomOnDoubleClick:V,panOnScroll:A,panOnScrollSpeed:B,panOnScrollMode:O,panOnDrag:K,autoPanOnSelection:q,defaultViewport:C,translateExtent:S,minZoom:H,maxZoom:b,onSelectionContextMenu:u,preventScrolling:P,noDragClassName:ke,noWheelClassName:be,noPanClassName:xe,disableKeyboardA11y:Ce,onViewportChange:Ie,isControlledViewport:!!Ee,children:m.jsxs(ep,{children:[m.jsx(Qg,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:i,onReconnect:he,onReconnectStart:ye,onReconnectEnd:ve,onlyRenderVisibleElements:T,onEdgeContextMenu:Z,onEdgeMouseEnter:Y,onEdgeMouseMove:ie,onEdgeMouseLeave:ae,reconnectRadius:ce,defaultMarkerColor:N,noPanClassName:xe,disableKeyboardA11y:Ce,rfId:$e}),m.jsx(cp,{style:w,type:g,component:x,containerStyle:y}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(Dg,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:X,onlyRenderVisibleElements:T,noPanClassName:xe,noDragClassName:ke,disableKeyboardA11y:Ce,nodeExtent:_e,rfId:$e}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}la.displayName="GraphView";const dp=_.memo(la),fp=li(),hs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,w=new Map,x=new Map,y=r??t??[],E=n??e??[],p=d??[0,0],v=u??Xt;bi(w,x,y);const{nodesInitialized:M}=Tr(E,h,g,{nodeOrigin:p,nodeExtent:v,zIndexMode:f});let k=[0,0,1];if(i&&o&&s){const I=tn(h,{filter:C=>!!((C.width||C.initialWidth)&&(C.height||C.initialHeight))}),{x:$,y:T,zoom:F}=Gr(I,o,s,c,l,(a==null?void 0:a.padding)??.1);k=[$,T,F]}return{rfId:"1",width:o??0,height:s??0,transform:k,nodes:E,nodesInitialized:M,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:x,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:Xt,nodeExtent:v,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Et.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,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:{...ri},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:fp,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:ni,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},hp=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>Mh((h,g)=>{async function w(){const{nodeLookup:x,panZoom:y,fitViewOptions:E,fitViewResolver:p,width:v,height:M,minZoom:k,maxZoom:I}=g();y&&(await cf({nodes:x,width:v,height:M,panZoom:y,minZoom:k,maxZoom:I},E),p==null||p.resolve(!0),h({fitViewResolver:null}))}return{...hs({nodes:e,edges:t,width:o,height:s,fitView:i,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:x=>{const{nodeLookup:y,parentLookup:E,nodeOrigin:p,elevateNodesOnSelect:v,fitViewQueued:M,zIndexMode:k,nodesSelectionActive:I}=g(),{nodesInitialized:$,hasSelectedNodes:T}=Tr(x,y,E,{nodeOrigin:p,nodeExtent:u,elevateNodesOnSelect:v,checkEquality:!0,zIndexMode:k}),F=I&&T;M&&$?(w(),h({nodes:x,nodesInitialized:$,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:F})):h({nodes:x,nodesInitialized:$,nodesSelectionActive:F})},setEdges:x=>{const{connectionLookup:y,edgeLookup:E}=g();bi(y,E,x),h({edges:x})},setDefaultNodesAndEdges:(x,y)=>{if(x){const{setNodes:E}=g();E(x),h({hasDefaultNodes:!0})}if(y){const{setEdges:E}=g();E(y),h({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:y,nodeLookup:E,parentLookup:p,domNode:v,nodeOrigin:M,nodeExtent:k,debug:I,fitViewQueued:$,zIndexMode:T}=g(),{changes:F,updatedInternals:C}=If(x,E,p,v,M,k,T);C&&(kf(E,p,{nodeOrigin:M,nodeExtent:k,zIndexMode:T}),$?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(F==null?void 0:F.length)>0&&(I&&console.log("React Flow: trigger node changes",F),y==null||y(F)))},updateNodePositions:(x,y=!1)=>{const E=[];let p=[];const{nodeLookup:v,triggerNodeChanges:M,connection:k,updateConnection:I,onNodesChangeMiddlewareMap:$}=g();for(const[T,F]of x){const C=v.get(T),S=!!(C!=null&&C.expandParent&&(C!=null&&C.parentId)&&(F!=null&&F.position)),H={id:T,type:"position",position:S?{x:Math.max(0,F.position.x),y:Math.max(0,F.position.y)}:F.position,dragging:y};if(C&&k.inProgress&&k.fromNode.id===C.id){const b=ut(C,k.fromHandle,Q.Left,!0);I({...k,from:b})}S&&C.parentId&&E.push({id:T,parentId:C.parentId,rect:{...F.internals.positionAbsolute,width:F.measured.width??0,height:F.measured.height??0}}),p.push(H)}if(E.length>0){const{parentLookup:T,nodeOrigin:F}=g(),C=to(E,v,T,F);p.push(...C)}for(const T of $.values())p=T(p);M(p)},triggerNodeChanges:x=>{const{onNodesChange:y,setNodes:E,nodes:p,hasDefaultNodes:v,debug:M}=g();if(x!=null&&x.length){if(v){const k=Kh(x,p);E(k)}M&&console.log("React Flow: trigger node changes",x),y==null||y(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:y,setEdges:E,edges:p,hasDefaultEdges:v,debug:M}=g();if(x!=null&&x.length){if(v){const k=qh(x,p);E(k)}M&&console.log("React Flow: trigger edge changes",x),y==null||y(x)}},addSelectedNodes:x=>{const{multiSelectionActive:y,edgeLookup:E,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:M}=g();if(y){const k=x.map(I=>tt(I,!0));v(k);return}v(xt(p,new Set([...x]),!0)),M(xt(E))},addSelectedEdges:x=>{const{multiSelectionActive:y,edgeLookup:E,nodeLookup:p,triggerNodeChanges:v,triggerEdgeChanges:M}=g();if(y){const k=x.map(I=>tt(I,!0));M(k);return}M(xt(E,new Set([...x]))),v(xt(p,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:y}={})=>{const{edges:E,nodes:p,nodeLookup:v,triggerNodeChanges:M,triggerEdgeChanges:k}=g(),I=x||p,$=y||E,T=[];for(const C of I){if(!C.selected)continue;const S=v.get(C.id);S&&(S.selected=!1),T.push(tt(C.id,!1))}const F=[];for(const C of $)C.selected&&F.push(tt(C.id,!1));M(T),k(F)},setMinZoom:x=>{const{panZoom:y,maxZoom:E}=g();y==null||y.setScaleExtent([x,E]),h({minZoom:x})},setMaxZoom:x=>{const{panZoom:y,minZoom:E}=g();y==null||y.setScaleExtent([E,x]),h({maxZoom:x})},setTranslateExtent:x=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(x),h({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:y,triggerNodeChanges:E,triggerEdgeChanges:p,elementsSelectable:v}=g();if(!v)return;const M=y.reduce((I,$)=>$.selected?[...I,tt($.id,!1)]:I,[]),k=x.reduce((I,$)=>$.selected?[...I,tt($.id,!1)]:I,[]);E(M),p(k)},setNodeExtent:x=>{const{nodes:y,nodeLookup:E,parentLookup:p,nodeOrigin:v,elevateNodesOnSelect:M,nodeExtent:k,zIndexMode:I}=g();x[0][0]===k[0][0]&&x[0][1]===k[0][1]&&x[1][0]===k[1][0]&&x[1][1]===k[1][1]||(Tr(y,E,p,{nodeOrigin:v,nodeExtent:x,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:I}),h({nodeExtent:x}))},panBy:x=>{const{transform:y,width:E,height:p,panZoom:v,translateExtent:M}=g();return Pf({delta:x,panZoom:v,transform:y,translateExtent:M,width:E,height:p})},setCenter:async(x,y,E)=>{const{width:p,height:v,maxZoom:M,panZoom:k}=g();if(!k)return!1;const I=typeof(E==null?void 0:E.zoom)<"u"?E.zoom:M;return await k.setViewport({x:p/2-x*I,y:v/2-y*I,zoom:I},{duration:E==null?void 0:E.duration,ease:E==null?void 0:E.ease,interpolate:E==null?void 0:E.interpolate}),!0},cancelConnection:()=>{h({connection:{...ri}})},updateConnection:x=>{h({connection:x})},reset:()=>h({...hs()})}},Object.is);function ua({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:s,initialMinZoom:i,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:h}){const[g]=_.useState(()=>hp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:s,fitView:l,minZoom:i,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return m.jsx(kh,{value:g,children:m.jsx(eg,{children:h})})}function gp({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:s,height:i,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h}){return _.useContext(Un)?m.jsx(m.Fragment,{children:e}):m.jsx(ua,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:s,initialHeight:i,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h,children:e})}const pp={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function mp({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:s,edgeTypes:i,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:y,onNodeMouseEnter:E,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:M,onNodeDoubleClick:k,onNodeDragStart:I,onNodeDrag:$,onNodeDragStop:T,onNodesDelete:F,onEdgesDelete:C,onDelete:S,onSelectionChange:H,onSelectionDragStart:b,onSelectionDrag:P,onSelectionDragStop:N,onSelectionContextMenu:D,onSelectionStart:R,onSelectionEnd:A,onBeforeDelete:B,connectionMode:O,connectionLineType:V=Ge.Bezier,connectionLineStyle:K,connectionLineComponent:q,connectionLineContainerStyle:ee,deleteKeyCode:re="Backspace",selectionKeyCode:J="Shift",selectionOnDrag:L=!1,selectionMode:W=Kt.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ne=Ut()?"Meta":"Control",zoomActivationKeyCode:X=Ut()?"Meta":"Control",snapToGrid:Z,snapGrid:Y,onlyRenderVisibleElements:ie=!1,selectNodesOnDrag:ae,nodesDraggable:ce,autoPanOnNodeFocus:he,nodesConnectable:ye,nodesFocusable:ve,nodeOrigin:ke=zi,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Ce=!0,defaultViewport:_e=Oh,minZoom:$e=.5,maxZoom:Ee=2,translateExtent:Ie=Xt,preventScrolling:It=!0,nodeExtent:Qe,defaultMarkerColor:dt="#b1b1b7",zoomOnScroll:Pt=!0,zoomOnPinch:jt=!0,panOnScroll:tr=!1,panOnScrollSpeed:nr=.5,panOnScrollMode:rn=ot.Free,zoomOnDoubleClick:ze=!0,panOnDrag:on=!0,onPaneClick:Je,onPaneMouseEnter:sn,onPaneMouseMove:an,onPaneMouseLeave:et,onPaneScroll:ft,onPaneContextMenu:ht,paneClickDistance:cn=1,nodeClickDistance:rr=0,children:or,onReconnect:sr,onReconnectStart:ln,onReconnectEnd:z,onEdgeContextMenu:G,onEdgeDoubleClick:U,onEdgeMouseEnter:oe,onEdgeMouseMove:de,onEdgeMouseLeave:j,reconnectRadius:me=10,onNodesChange:pe,onEdgesChange:gt,noDragClassName:un="nodrag",noWheelClassName:Ne="nowheel",noPanClassName:Ae="nopan",fitView:dn,fitViewOptions:oo,connectOnClick:va,attributionPosition:ba,proOptions:_a,defaultEdgeOptions:Ea,elevateNodesOnSelect:Na=!0,elevateEdgesOnSelect:Sa=!1,disableKeyboardA11y:so=!1,autoPanOnConnect:Ma,autoPanOnNodeDrag:ka,autoPanOnSelection:Ca=!0,autoPanSpeed:Aa,connectionRadius:$a,isValidConnection:Ia,onError:Pa,style:ja,id:io,nodeDragThreshold:Da,connectionDragThreshold:Ta,viewport:Ra,onViewportChange:La,width:za,height:Ha,colorMode:Oa="light",debug:Va,onScroll:fn,ariaLabelConfig:Ba,zIndexMode:ao="basic",...Fa},Wa){const ir=io||"1",Ya=Wh(Oa),Xa=_.useCallback(co=>{co.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),fn==null||fn(co)},[fn]);return m.jsx("div",{"data-testid":"rf__wrapper",...Fa,onScroll:Xa,style:{...ja,...pp},ref:Wa,className:ge(["react-flow",o,Ya]),id:io,role:"application",children:m.jsxs(gp,{nodes:e,edges:t,width:za,height:Ha,fitView:dn,fitViewOptions:oo,minZoom:$e,maxZoom:Ee,nodeOrigin:ke,nodeExtent:Qe,zIndexMode:ao,children:[m.jsx(Fh,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:y,nodesDraggable:ce,autoPanOnNodeFocus:he,nodesConnectable:ye,nodesFocusable:ve,edgesFocusable:be,edgesReconnectable:xe,elementsSelectable:Ce,elevateNodesOnSelect:Na,elevateEdgesOnSelect:Sa,minZoom:$e,maxZoom:Ee,nodeExtent:Qe,onNodesChange:pe,onEdgesChange:gt,snapToGrid:Z,snapGrid:Y,connectionMode:O,translateExtent:Ie,connectOnClick:va,defaultEdgeOptions:Ea,fitView:dn,fitViewOptions:oo,onNodesDelete:F,onEdgesDelete:C,onDelete:S,onNodeDragStart:I,onNodeDrag:$,onNodeDragStop:T,onSelectionDrag:P,onSelectionDragStart:b,onSelectionDragStop:N,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:Ae,nodeOrigin:ke,rfId:ir,autoPanOnConnect:Ma,autoPanOnNodeDrag:ka,autoPanSpeed:Aa,onError:Pa,connectionRadius:$a,isValidConnection:Ia,selectNodesOnDrag:ae,nodeDragThreshold:Da,connectionDragThreshold:Ta,onBeforeDelete:B,debug:Va,ariaLabelConfig:Ba,zIndexMode:ao}),m.jsx(dp,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:E,onNodeMouseMove:p,onNodeMouseLeave:v,onNodeContextMenu:M,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:i,connectionLineType:V,connectionLineStyle:K,connectionLineComponent:q,connectionLineContainerStyle:ee,selectionKeyCode:J,selectionOnDrag:L,selectionMode:W,deleteKeyCode:re,multiSelectionKeyCode:ne,panActivationKeyCode:te,zoomActivationKeyCode:X,onlyRenderVisibleElements:ie,defaultViewport:_e,translateExtent:Ie,minZoom:$e,maxZoom:Ee,preventScrolling:It,zoomOnScroll:Pt,zoomOnPinch:jt,zoomOnDoubleClick:ze,panOnScroll:tr,panOnScrollSpeed:nr,panOnScrollMode:rn,panOnDrag:on,autoPanOnSelection:Ca,onPaneClick:Je,onPaneMouseEnter:sn,onPaneMouseMove:an,onPaneMouseLeave:et,onPaneScroll:ft,onPaneContextMenu:ht,paneClickDistance:cn,nodeClickDistance:rr,onSelectionContextMenu:D,onSelectionStart:R,onSelectionEnd:A,onReconnect:sr,onReconnectStart:ln,onReconnectEnd:z,onEdgeContextMenu:G,onEdgeDoubleClick:U,onEdgeMouseEnter:oe,onEdgeMouseMove:de,onEdgeMouseLeave:j,reconnectRadius:me,defaultMarkerColor:dt,noDragClassName:un,noWheelClassName:Ne,noPanClassName:Ae,rfId:ir,disableKeyboardA11y:so,nodeExtent:Qe,viewport:Ra,onViewportChange:La}),m.jsx(Hh,{onSelectionChange:H}),or,m.jsx(Dh,{proOptions:_a,position:ba}),m.jsx(jh,{rfId:ir,disableKeyboardA11y:so})]})})}var yp=Oi(mp);function xp({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:ge(["react-flow__background-pattern",n,r])})}function wp({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:ge(["react-flow__background-pattern","dots",t])})}var Ue;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ue||(Ue={}));const vp={[Ue.Dots]:1,[Ue.Lines]:1,[Ue.Cross]:6},bp=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function da({id:e,variant:t=Ue.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=0,color:i,bgColor:a,style:c,className:l,patternClassName:d}){const u=_.useRef(null),{transform:f,patternId:h}=se(bp,le),g=r||vp[t],w=t===Ue.Dots,x=t===Ue.Cross,y=Array.isArray(n)?n:[n,n],E=[y[0]*f[2]||1,y[1]*f[2]||1],p=g*f[2],v=Array.isArray(s)?s:[s,s],M=x?[p,p]:E,k=[v[0]*f[2]||1+M[0]/2,v[1]*f[2]||1+M[1]/2],I=`${h}${e||""}`;return m.jsxs("svg",{className:ge(["react-flow__background",l]),style:{...c,...Jn,"--xy-background-color-props":a,"--xy-background-pattern-color-props":i},ref:u,"data-testid":"rf__background",children:[m.jsx("pattern",{id:I,x:f[0]%E[0],y:f[1]%E[1],width:E[0],height:E[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:w?m.jsx(wp,{radius:p/2,className:d}):m.jsx(xp,{dimensions:M,lineWidth:o,variant:t,className:d})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}da.displayName="Background";_.memo(da);function _p(){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 Ep(){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 Np(){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 Sp(){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 Mp(){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 bn({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:ge(["react-flow__controls-button",t]),...n,children:e})}const kp=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function fa({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:s,onZoomOut:i,onFitView:a,onInteractiveChange:c,className:l,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":h}){const g=ue(),{isInteractive:w,minZoomReached:x,maxZoomReached:y,ariaLabelConfig:E}=se(kp,le),{zoomIn:p,zoomOut:v,fitView:M}=Qn(),k=()=>{p(),s==null||s()},I=()=>{v(),i==null||i()},$=()=>{M(o),a==null||a()},T=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c==null||c(!w)},F=f==="horizontal"?"horizontal":"vertical";return m.jsxs(Zn,{className:ge(["react-flow__controls",F,l]),position:u,style:e,"data-testid":"rf__controls","aria-label":h??E["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(bn,{onClick:k,className:"react-flow__controls-zoomin",title:E["controls.zoomIn.ariaLabel"],"aria-label":E["controls.zoomIn.ariaLabel"],disabled:y,children:m.jsx(_p,{})}),m.jsx(bn,{onClick:I,className:"react-flow__controls-zoomout",title:E["controls.zoomOut.ariaLabel"],"aria-label":E["controls.zoomOut.ariaLabel"],disabled:x,children:m.jsx(Ep,{})})]}),n&&m.jsx(bn,{className:"react-flow__controls-fitview",onClick:$,title:E["controls.fitView.ariaLabel"],"aria-label":E["controls.fitView.ariaLabel"],children:m.jsx(Np,{})}),r&&m.jsx(bn,{className:"react-flow__controls-interactive",onClick:T,title:E["controls.interactive.ariaLabel"],"aria-label":E["controls.interactive.ariaLabel"],children:w?m.jsx(Mp,{}):m.jsx(Sp,{})}),d]})}fa.displayName="Controls";_.memo(fa);function Cp({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:u,selected:f,onClick:h}){const{background:g,backgroundColor:w}=s||{},x=i||g||w;return m.jsx("rect",{className:ge(["react-flow__minimap-node",{selected:f},l]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:x,stroke:a,strokeWidth:c},shapeRendering:u,onClick:h?y=>h(y,e):void 0})}const Ap=_.memo(Cp),$p=e=>e.nodes.map(t=>t.id),mr=e=>e instanceof Function?e:()=>e;function Ip({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:s=Ap,onClick:i}){const a=se($p,le),c=mr(t),l=mr(e),d=mr(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:a.map(f=>m.jsx(jp,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:s,onClick:i,shapeRendering:u},f))})}function Pp({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:s,shapeRendering:i,NodeComponent:a,onClick:c}){const{node:l,x:d,y:u,width:f,height:h}=se(g=>{const w=g.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const x=w.internals.userNode,{x:y,y:E}=w.internals.positionAbsolute,{width:p,height:v}=Xe(x);return{node:x,x:y,y:E,width:p,height:v}},le);return!l||l.hidden||!ui(l)?null:m.jsx(a,{x:d,y:u,width:f,height:h,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:o,strokeColor:n(l),strokeWidth:s,shapeRendering:i,onClick:c,id:l.id})}const jp=_.memo(Pp);var Dp=_.memo(Ip);const Tp=200,Rp=150,Lp=e=>!e.hidden,zp=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?ci(tn(e.nodeLookup,{filter:Lp}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Hp="react-flow__minimap-desc";function ha({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:w=!1,zoomable:x=!1,ariaLabel:y,inversePan:E,zoomStep:p=1,offsetScale:v=5}){const M=ue(),k=_.useRef(null),{boundingRect:I,viewBB:$,rfId:T,panZoom:F,translateExtent:C,flowWidth:S,flowHeight:H,ariaLabelConfig:b}=se(zp,le),P=(e==null?void 0:e.width)??Tp,N=(e==null?void 0:e.height)??Rp,D=I.width/P,R=I.height/N,A=Math.max(D,R),B=A*P,O=A*N,V=v*A,K=I.x-(B-I.width)/2-V,q=I.y-(O-I.height)/2-V,ee=B+V*2,re=O+V*2,J=`${Hp}-${T}`,L=_.useRef(0),W=_.useRef();L.current=A,_.useEffect(()=>{if(k.current&&F)return W.current=Vf({domNode:k.current,panZoom:F,getTransform:()=>M.getState().transform,getViewScale:()=>L.current}),()=>{var Z;(Z=W.current)==null||Z.destroy()}},[F]),_.useEffect(()=>{var Z;(Z=W.current)==null||Z.update({translateExtent:C,width:S,height:H,inversePan:E,pannable:w,zoomStep:p,zoomable:x})},[w,x,E,p,C,S,H]);const te=h?Z=>{var ae;const[Y,ie]=((ae=W.current)==null?void 0:ae.pointer(Z))||[0,0];h(Z,{x:Y,y:ie})}:void 0,ne=g?_.useCallback((Z,Y)=>{const ie=M.getState().nodeLookup.get(Y).internals.userNode;g(Z,ie)},[]):void 0,X=y??b["minimap.ariaLabel"];return m.jsx(Zn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*A: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:ge(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:P,height:N,viewBox:`${K} ${q} ${ee} ${re}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":J,ref:k,onClick:te,children:[X&&m.jsx("title",{id:J,children:X}),m.jsx(Dp,{onClick:ne,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:a}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${K-V},${q-V}h${ee+V*2}v${re+V*2}h${-ee-V*2}z
|
|
24
|
-
M${$.x},${$.y}h${$.width}v${$.height}h${-$.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}ha.displayName="MiniMap";_.memo(ha);const Op=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Vp={[kt.Line]:"right",[kt.Handle]:"bottom-right"};function Bp({nodeId:e,position:t,variant:n=kt.Handle,className:r,style:o=void 0,children:s,color:i,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:w,onResize:x,onResizeEnd:y}){const E=Wi(),p=typeof e=="string"?e:E,v=ue(),M=_.useRef(null),k=n===kt.Handle,I=se(_.useCallback(Op(k&&h),[k,h]),le),$=_.useRef(null),T=t??Vp[n];_.useEffect(()=>{if(!(!M.current||!p))return $.current||($.current=eh({domNode:M.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:C,transform:S,snapGrid:H,snapToGrid:b,nodeOrigin:P,domNode:N}=v.getState();return{nodeLookup:C,transform:S,snapGrid:H,snapToGrid:b,nodeOrigin:P,paneDomNode:N}},onChange:(C,S)=>{const{triggerNodeChanges:H,nodeLookup:b,parentLookup:P,nodeOrigin:N}=v.getState(),D=[],R={x:C.x,y:C.y},A=b.get(p);if(A&&A.expandParent&&A.parentId){const B=A.origin??N,O=C.width??A.measured.width??0,V=C.height??A.measured.height??0,K={id:A.id,parentId:A.parentId,rect:{width:O,height:V,...di({x:C.x??A.position.x,y:C.y??A.position.y},{width:O,height:V},A.parentId,b,B)}},q=to([K],b,P,N);D.push(...q),R.x=C.x?Math.max(B[0]*O,C.x):void 0,R.y=C.y?Math.max(B[1]*V,C.y):void 0}if(R.x!==void 0&&R.y!==void 0){const B={id:p,type:"position",position:{...R}};D.push(B)}if(C.width!==void 0&&C.height!==void 0){const O={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:C.width,height:C.height}};D.push(O)}for(const B of S){const O={...B,type:"position"};D.push(O)}H(D)},onEnd:({width:C,height:S})=>{const H={id:p,type:"dimensions",resizing:!1,dimensions:{width:C,height:S}};v.getState().triggerNodeChanges([H])}})),$.current.update({controlPosition:T,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:w,onResize:x,onResizeEnd:y,shouldResize:g}),()=>{var C;(C=$.current)==null||C.destroy()}},[T,a,c,l,d,u,w,x,y,g]);const F=T.split("-");return m.jsx("div",{className:ge(["react-flow__resize-control","nodrag",...F,n,r]),ref:M,style:{...o,scale:I,...i&&{[k?"backgroundColor":"borderColor"]:i}},children:s})}_.memo(Bp);function Fp(e,t){if(!e)return null;const n=Date.parse(e);if(Number.isNaN(n))return null;const r=Math.max(0,(Date.now()-n)/1e3);if(r<45)return t("time.justNow");const o=r/60,s=o/60,i=s/24;return o<45?t("time.minutes",{n:Math.round(o)}):s<22?t("time.hours",{n:Math.round(s)}):i<7?t("time.days",{n:Math.round(i)}):t("time.weeks",{n:Math.round(i/7)})}const Wp=4,gs={isConnectable:!1,isConnectableStart:!1,isConnectableEnd:!1,style:{pointerEvents:"none"},"aria-hidden":!0};function Yp({data:e}){const t=Ze(),n=[...new Map((e.editors||[]).map(s=>[s.id,s])).values()];if(n.length===0)return null;const r=n.slice(0,Wp),o=n.length-r.length;return m.jsxs("span",{className:"node-editors","data-tip":t("specNode.liveEditors",{n:n.length}),children:[r.map(s=>m.jsx(nc,{seed:s.id,status:s.status,title:t("specNode.editorTitle",{node:s.node||t("common.session"),status:t(`status.${s.status}`),id:s.id.slice(0,8)})},s.id)),o>0&&m.jsxs("span",{className:"av-more","data-tip":t("specNode.more",{n:o}),children:["+",o]})]})}function Xp({summary:e,t}){return e!=null&&e.open?m.jsxs("span",{className:"issue-badge","data-tip":t("specNode.openIssues",{n:e.open}),children:["◆",e.open]}):null}function Kp({data:e,selected:t}){var u,f;const n=Ze(),r=st[e.status]||st.pending,o=Fp(e.lastEdited,n),s=e.overlays||[],i=s[0],a=s.some(h=>h.op==="deleted"),c=i&&!i.committed,l=[...new Set(s.map(h=>h.op))],d=["spec-node",e.status,t?"focused":"",e.ghost?"ghost":"",a?"deleted":"",s.length?"has-overlay":"",c?"ov-dirty":""].filter(Boolean).join(" ");return m.jsxs("div",{className:d,style:i?{"--ov":br(i.seed)}:void 0,children:[m.jsx(At,{type:"target",position:Q.Left,...gs}),m.jsxs("div",{className:"node-row1",children:[m.jsx("span",{className:"node-dot",style:{background:r.color},children:e.status==="active"&&m.jsx("span",{className:"pulse",style:{background:r.color}})}),m.jsx("span",{className:"node-title",children:e.title}),l.length>0?m.jsx("span",{className:"ov-marks","data-tip":s.map(h=>n("specNode.opTitle",{op:n(`legend.opRows.${h.op}`),label:h.label,uncommitted:!h.committed})).join(`
|
|
25
|
-
`),children:l.map(h=>m.jsx("span",{className:`ov-mark ov-${h}`,children:Es[h]},h))}):o?m.jsx("span",{className:"node-ago",children:o}):null]}),m.jsxs("div",{className:"node-row2",children:[m.jsx("span",{className:"node-ver",children:e.version?`v${e.version}`:""}),e.drift>0&&m.jsxs("span",{className:"drift-badge","data-tip":(e.driftFiles||[]).map(h=>`${h.file}: ${n("specNode.driftAhead",{n:h.behind})}`).join(`
|
|
26
|
-
`),children:["⚠",e.drift]}),m.jsx(Xp,{summary:(u=e.reviewSummary)==null?void 0:u.issues,t:n}),m.jsx(sc,{summary:(f=e.reviewSummary)==null?void 0:f.evals}),m.jsx(Yp,{data:e})]}),e.collapsed&&m.jsxs("span",{className:"node-expand","data-tip":n("specNode.expandable",{n:e.childCount}),children:["▸",e.childCount]}),m.jsx(At,{type:"source",position:Q.Right,...gs})]})}const _n=8;function qp({x:e,y:t,anchorKey:n,label:r,children:o}){const s=_.useRef(null),[i,a]=_.useState({left:e,top:t,visibility:"hidden"});return _.useLayoutEffect(()=>{var l;const c=(l=s.current)==null?void 0:l.getBoundingClientRect();c&&a({left:Math.max(_n,Math.min(e,window.innerWidth-c.width-_n)),top:Math.max(_n,Math.min(t,window.innerHeight-c.height-_n)),visibility:"visible"})},[e,t,n]),m.jsx("div",{ref:s,className:"sess-menu",role:"menu","aria-label":r,style:i,onClick:c=>c.stopPropagation(),onMouseDownCapture:Ga,children:o})}function yr({children:e}){return m.jsx("div",{className:"sess-menu-group",role:"group",children:e})}function ps(){return m.jsx("div",{className:"sess-menu-sep",role:"separator"})}function mt({icon:e,leading:t,danger:n=!1,className:r="",children:o,...s}){if(!e&&!t)throw new Error("context menu item requires an icon or leading glyph");const i=["sess-menu-item",n&&"danger",r].filter(Boolean).join(" ");return m.jsxs("button",{type:"button",role:"menuitem",className:i,...s,children:[m.jsx("span",{className:"sess-menu-icon",children:t??m.jsx(Ua,{name:e,size:14,className:"sess-menu-svg"})}),m.jsx("span",{className:"sess-menu-label",children:o})]})}function Gp({menu:e,onClose:t,onInfo:n,onFresh:r,onNewChild:o,onDelete:s,sessions:i=[],onOpenSession:a}){const c=Ze(),[l,d]=_.useState(null);if(_.useEffect(()=>{if(e)return window.addEventListener("click",t),window.addEventListener("contextmenu",t,!0),()=>{window.removeEventListener("click",t),window.removeEventListener("contextmenu",t,!0)}},[e,t]),ic(!!e,t),_.useEffect(()=>{d(null)},[e]),_.useEffect(()=>{if(!l)return;const g=setTimeout(t,900);return()=>clearTimeout(g)},[l,t]),!e)return null;const u=g=>w=>{w.stopPropagation(),t(),g(e.id)},f=g=>w=>{w.stopPropagation(),t(),a==null||a(g)},h=async g=>{g.stopPropagation(),d(await cc(An(e.id))?"copied":"failed")};return m.jsxs(qp,{x:e.x,y:e.y,anchorKey:e.id,label:c("nodeMenu.menuLabel"),children:[m.jsxs(yr,{children:[m.jsx(mt,{icon:"info",onClick:u(n),children:c("nodeMenu.info")}),m.jsx(mt,{icon:"copy",onClick:h,children:c(l?`nodeMenu.${l}`:"nodeMenu.copyUrl")}),m.jsx(mt,{icon:"sessions",onClick:u(r),children:c("nodeMenu.newSession")}),m.jsx(mt,{icon:"plus",onClick:u(o),children:c("nodeMenu.newChild")})]}),m.jsx(ps,{}),m.jsx(yr,{children:m.jsx(mt,{icon:"trash",danger:!0,onClick:u(s),children:c("nodeMenu.del")})}),i.length>0&&m.jsxs(m.Fragment,{children:[m.jsx(ps,{}),m.jsx(yr,{children:i.map(g=>m.jsx(mt,{className:"sess-menu-sess",leading:m.jsx("span",{className:"sess-glyph",style:{color:_r[g.status]},"aria-hidden":"true",children:ac[g.status]}),onClick:f(g.id),children:zr(g)},g.id))})]})]})}const Up=new Set(["=","_","I","H","J","K","L"]),Zp=(()=>{const e=[];for(const t of vc){const n=Ns(t.id).filter(o=>!Up.has(o)).map(Er),r=e[e.length-1];r&&r.desc===t.desc?r.keys.push(...n):e.push({desc:t.desc,keys:n})}return e})(),Qp=[[["←","→","h","l","⇥","1","2"],"legend.popup.switch"],[["j","k","↑","↓"],"legend.popup.scroll"],[["⇧h","⇧j","⇧k","⇧l","⇧←↑↓→"],"legend.popup.lens"],[["⏎"],"legend.popup.enter"],[["esc"],"legend.popup.esc"]],Jp=["merged","active","drift","pending"],em=["added","edited","deleted","moved"];function tm({t:e}){return m.jsxs("section",{className:"legend-sec",children:[m.jsx("div",{className:"legend-h",children:e("legend.secBoard")}),Zp.map(t=>m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"keymap-keys",children:t.keys.map((n,r)=>m.jsx("kbd",{children:n},r))}),m.jsx("span",{className:"legend-desc",children:e(t.desc)})]},t.desc))]})}function nm({title:e,rows:t,t:n}){return m.jsxs("section",{className:"legend-sec",children:[m.jsx("div",{className:"legend-h",children:e}),t.map(([r,o])=>m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"keymap-keys",children:r.map((s,i)=>m.jsx("kbd",{children:s},i))}),m.jsx("span",{className:"legend-desc",children:n(o)})]},o))]})}function rm({onClose:e}){const t=Ze();return m.jsxs(wc,{title:t("legend.title"),closeLabel:t("legend.close"),onClose:e,children:[m.jsx(tm,{t}),m.jsx(nm,{title:t("legend.secPopup"),rows:Qp,t}),m.jsxs("section",{className:"legend-sec",children:[m.jsx("div",{className:"legend-h",children:t("legend.secStatus")}),Jp.map(n=>m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"node-dot",style:{background:st[n].color},children:n==="active"&&m.jsx("span",{className:"pulse",style:{background:st[n].color}})}),m.jsx("span",{className:"legend-name",children:t(`status.${n}`)}),m.jsx("span",{className:"legend-desc",children:t(`legend.statusRows.${n}`)})]},n))]}),m.jsxs("section",{className:"legend-sec",children:[m.jsxs("div",{className:"legend-h",children:[t("legend.secOp")," ",m.jsx("span",{className:"legend-sub",children:t("legend.secOpSub")})]}),em.map(n=>m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:`ov-mark ov-${n}`,children:Es[n]}),m.jsx("span",{className:"legend-desc",children:t(`legend.opRows.${n}`)})]},n))]}),m.jsxs("section",{className:"legend-sec",children:[m.jsx("div",{className:"legend-h",children:t("legend.secBadges")}),m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"drift-badge",children:"⚠N"}),m.jsx("span",{className:"legend-desc",children:t("legend.badgeDrift")})]}),m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"legend-glyph legend-ver",children:"vN"}),m.jsx("span",{className:"legend-desc",children:t("legend.badgeVer")})]})]}),m.jsxs("section",{className:"legend-sec",children:[m.jsx("div",{className:"legend-h",children:t("legend.secRing")}),m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"legend-ring ring-dashed"}),m.jsx("span",{className:"legend-desc",children:t("legend.ringDashed")})]}),m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"legend-ring ring-solid"}),m.jsx("span",{className:"legend-desc",children:t("legend.ringSolid")})]}),m.jsxs("div",{className:"legend-row",children:[m.jsx("span",{className:"legend-ring ring-ghost"}),m.jsx("span",{className:"legend-desc",children:t("legend.ringGhost")})]})]})]})}const ga=8,om=5,sm=2.2,im=1,am=new Set(["the","a","an","and","or","of","to","in","on","is","it","its","as","at","by","for","how","does","do","what","which","that","this","these","those","with","from","into","are","be","can","just","them","they","their","so","if","not","no","but","vs","us","we","you"]),pa="\\u3400-\\u4dbf\\u4e00-\\u9fff\\uf900-\\ufaff\\u3040-\\u30ff",cm=new RegExp(`[a-z0-9]+|[${pa}]`,"g"),lm=new RegExp(`[${pa}]`);function ma(e){return lm.test(e)}function ya(e){return e.toLowerCase().match(cm)??[]}function um(e){const t=new Set;for(const n of ya(e))(ma(n)||n.length>1&&!am.has(n))&&t.add(n);return[...t]}function xr(e){return ya(e)}function ro(e){let t=e;return t.length>=4&&t.endsWith("s")&&!t.endsWith("ss")&&(t=t.slice(0,-1)),t.length>=5&&t.endsWith("e")&&(t=t.slice(0,-1)),t}function dm(e,t){return t.startsWith(ro(e))}function Hn(e,t){return t.startsWith(ro(e))||t.length>=3&&e.startsWith(t)}const fm=.5;function hm(e,t){const n=ro(e);let r=0;for(const o of t.nameWords)if(o.startsWith(n)){const s=n.length/o.length;s>r&&(r=s)}return r>0?Math.max(fm,r):0}const ms=1.2,ys=.4;function xs(e,t,n){return e<=0?0:e*(ms+1)/(e+ms*(1-ys+ys*t/(n||1)))}function gm(e,t,n,r){const o=hm(e,t);if(o>0)return ga*o;if(t.name.includes(e))return om;if(t.descWords.some(i=>Hn(e,i)))return sm*xs(1,t.descWords.length,r);const s=t.bodyWords.reduce((i,a)=>i+(Hn(e,a)?1:0),0);return im*xs(s,t.bodyWords.length,n)}function pm(e,t,n,r=140){const o=e.replace(/\s+/g," ").trim(),s=o.toLowerCase();let i=-1;for(const l of n){const d=ma(l)?s.indexOf(l):s.search(new RegExp("\\b"+l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")));d>=0&&(i<0||d<i)&&(i=d)}if(i<0){const l=(t||o).replace(/\s+/g," ").trim();return l.length>r?l.slice(0,r).trimEnd()+"…":l}const a=Math.max(0,i-Math.floor(r/3));let c=o.slice(a,a+r).trim();return a>0&&(c="…"+c),a+r<o.length&&(c=c+"…"),c}function mm(e,t,n={}){const r=n.limit??10,o=um(e);if(!o.length)return[];const s=t.map(u=>{const f=u.name.toLowerCase();return{ref:u.ref,name:f,nameWords:xr(f),desc:u.desc.toLowerCase(),descWords:xr(u.desc),bodyWords:xr(u.body),snippetText:`${u.desc}
|
|
27
|
-
${u.body}`}}),i=s.length,a=s.reduce((u,f)=>u+f.bodyWords.length,0)/(i||1),c=s.reduce((u,f)=>u+f.descWords.length,0)/(i||1),l={};for(const u of o){let f=0;for(const h of s)(h.nameWords.some(g=>dm(u,g))||h.descWords.some(g=>Hn(u,g))||h.bodyWords.some(g=>Hn(u,g)))&&f++;l[u]=f>0?Math.log(i/f):0}const d=[];for(const u of s){let f=0;for(const h of o)f+=Math.min(gm(h,u,a,c)*l[h],ga);f<=0||d.push({ref:u.ref,score:Math.round(f*100)/100,snippet:pm(u.snippetText,u.desc,o)})}return d.sort((u,f)=>f.score-u.score),d.slice(0,r)}let wr=null;function ym(e=!0){const[t,n]=_.useState(wr),r=_.useRef(!1);return _.useEffect(()=>{!e||r.current||(r.current=!0,fetch(Za("/api/specs/lite")).then(o=>o.ok?o.json():[]).then(o=>{wr={bodies:Object.fromEntries((o||[]).map(s=>[s.id,s.body||""]))},n(wr)}).catch(()=>{}))},[e]),t}const xm={pass:"var(--green)",fail:"var(--red)",stalePass:"var(--muted)",staleFail:"var(--muted)",empty:"var(--muted)",missing:"var(--muted)"},vr=e=>(e||"").replace(/^\.spec\//,"").replace(/\/spec\.md$/,""),ws=["spec","session","issue","scenario"],wm=e=>e?[e,...ws.filter(t=>t!==e)]:ws,vm=new Set(["issue","scenario"]);function bm(e,t,n,r=[],o=[]){var c,l;const s=n==null?void 0:n.bodies,i=[],a=Object.fromEntries(e.map(d=>[d.id,d]));for(const d of e){const u=vr(d.path);i.push({kind:"spec",key:`spec:${d.id}`,target:d.id,address:An(d.id),color:(st[d.status]||st.pending).color,title:d.title||d.id,sub:u,name:`${d.title||d.id} ${d.id}`,desc:d.desc||"",body:(s==null?void 0:s[d.id])??d.body??""})}for(const d of r){const u=((c=d.nodes)==null?void 0:c[0])||null,f=vr((l=a[u])==null?void 0:l.path);i.push({kind:"issue",key:`issue:${d.id}`,target:d.id,nodeId:u,address:uc(d.id),color:d.status==="open"?"var(--green)":"var(--muted)",title:d.concern,sub:[d.id,f].filter(Boolean).join(" · "),name:d.concern||"",desc:d.id,body:""})}for(const d of o){const u=a[d.node],f=d.filterKind===dc.RESULT;i.push({kind:"scenario",key:`scenario:${d.node}:${d.scenario}`,target:d.scenario,nodeId:d.node,address:f?uo(d.node,d.scenario):uo(d.node),color:xm[d.state||"missing"]||"var(--cyan)",title:d.scenario,sub:vr(u==null?void 0:u.path),tags:d.tags,name:d.scenario||"",desc:"",body:d.expected||""})}for(const d of fc(t)){const u=zr(d),f=hc(d),h=d.status||d.promptPreview||d.note||"";i.push({kind:"session",key:`session:${d.id}`,target:d.id,address:gc(d.id),color:_r[d.status]||_r.offline,title:u,sub:h,name:u||"",desc:d.status||"",body:`${d.promptPreview||d.note||""} ${f}`.trim()})}return i}function _m(e,t,n){const r=Object.fromEntries(n.map((a,c)=>[a,c])),o=(a,c)=>r[a.kind]-r[c.kind];if(!t.trim())return e.slice().sort(o).slice(0,15);const s={};for(const a of n){const c=e.filter(l=>l.kind===a);s[a]=vm.has(a)?c.slice(0,15):mm(t,c.sort((l,d)=>l.name.length-d.name.length||l.key.localeCompare(d.key)).map(l=>({ref:l,name:l.name,desc:l.desc,body:l.body})),{limit:15}).map(l=>l.ref)}const i=[];for(let a=0;i.length<15;a++){let c=!1;for(const l of n)s[l][a]&&i.length<15&&(i.push(s[l][a]),c=!0);if(!c)break}return i}function Em({specs:e,sessions:t,onPick:n,onClose:r,boost:o=null}){var F,C;const s=Ze(),i=ym(),[a,c]=_.useState(""),[l,d]=_.useState("");_.useEffect(()=>{if(!a.trim()){d(a);return}const S=setTimeout(()=>d(a),120);return()=>clearTimeout(S)},[a]);const[u,f]=_.useState(0),h=_.useRef(null),g=_.useRef(null),w=_.useMemo(()=>wm(o),[o]),x=`is:issue${l.trim()?` ${l.trim()}`:""}`,y=`is:eval${l.trim()?` ${l.trim()}`:""}`,E=lo("issues",x,1,{pollMs:0}),p=lo("evals",y,1,{pollMs:0}),v=((F=E.data)==null?void 0:F.items)||[],M=((C=p.data)==null?void 0:C.items)||[],k=_.useMemo(()=>bm(e,t,i,v,M),[e,t,i,E.data,p.data]),I=_.useMemo(()=>_m(k,l,w),[k,l,w]);_.useEffect(()=>{var S;(S=h.current)==null||S.focus()},[]),_.useEffect(()=>{f(0)},[a]),_.useEffect(()=>{var S,H;(H=(S=g.current)==null?void 0:S.querySelector(".search-item.on"))==null||H.scrollIntoView({block:"nearest"})},[u,I]);const $=S=>{S&&(n(S),r())},T=S=>{S.key==="ArrowDown"?(S.preventDefault(),f(H=>Math.min(I.length-1,H+1))):S.key==="ArrowUp"?(S.preventDefault(),f(H=>Math.max(0,H-1))):S.key==="Enter"?(S.preventDefault(),$(I[u])):S.key==="Escape"&&(S.preventDefault(),r())};return m.jsx("div",{className:"search-backdrop","data-focus-overlay":!0,onClick:r,children:m.jsxs("div",{className:"search-panel",role:"dialog","aria-modal":"true","aria-label":s("search.title"),onClick:S=>S.stopPropagation(),children:[m.jsxs("div",{className:"search-bar",children:[m.jsx("span",{className:"search-icon",children:"⌕"}),m.jsx("input",{ref:h,className:"search-input",value:a,placeholder:s("search.placeholder"),onChange:S=>c(S.target.value),onKeyDown:T})]}),m.jsxs("ul",{className:"search-results",ref:g,children:[I.length===0&&m.jsx("li",{className:"search-empty",children:s("search.empty")}),I.map((S,H)=>m.jsxs("li",{className:`search-item${H===u?" on":""}`,"data-kind":S.kind,"data-target":S.target,onMouseEnter:()=>f(H),onClick:()=>$(S),children:[m.jsx("span",{className:"node-dot",style:{background:S.color}}),m.jsx("span",{className:`search-kind k-${S.kind}`,children:s(`search.kind.${S.kind}`)}),m.jsx("span",{className:"search-title",children:S.title||S.target}),m.jsx(lc,{tags:S.tags}),m.jsx("span",{className:"search-path",children:S.sub})]},S.key))]}),m.jsx("div",{className:"search-foot",children:s("search.hint")})]})})}function xa(e,t,n=1,r=o=>o){if(!e.length)return null;const o=e.findIndex(s=>r(s)===t);return o===-1?n>0?e[0]:e[e.length-1]:e[(o+n+e.length)%e.length]}const Nm=["merged","active","drift","pending"],Sm=[{state:"pass",always:!0,titleKey:"scorePass"},{state:"fail",always:!0,titleKey:"scoreFail"},{state:"stalePass",always:!1,titleKey:"scoreStalePass"},{state:"staleFail",always:!1,titleKey:"scoreStaleFail"},{state:"empty",always:!1,titleKey:"scoreEmpty"}];function Mm(e){var a,c;const t={merged:[],active:[],drift:[],pending:[]},n=[],r=[],o=new Set,s={pass:0,fail:0,stalePass:0,staleFail:0,empty:0},i={pass:[],fail:[],stalePass:[],staleFail:[],empty:[]};for(const l of e){t[l.status]&&t[l.status].push(l.id),l.drift>0&&n.push(l.id);const d=(a=l.reviewSummary)==null?void 0:a.issues;if(d!=null&&d.open){r.push(l.id);for(const f of d.openIds||[])o.add(f)}const u=(c=l.reviewSummary)==null?void 0:c.evals;if(u)for(const f of Object.keys(s)){const h=u[f]||0;s[f]+=h,h>0&&i[f].push(l.id)}}return{total:e.length,status:t,driftIds:n,issueIds:r,issueCount:o.size,scoreCount:s,scoreNodes:i}}function En({count:e,ids:t,focusId:n,onJump:r,title:o,cls:s="",children:i}){const a=t.length>0;return m.jsxs("button",{type:"button",className:`bstat ${s}`.trim(),disabled:!a,"data-tip":o,"aria-label":o,onClick:a?()=>r(xa(t,n)):void 0,children:[i,e]})}function km({specs:e,focusId:t,onJump:n}){const r=Ze(),o=_.useMemo(()=>Mm(e),[e]),s=i=>i&&(n==null?void 0:n(i));return m.jsxs("div",{className:"graph-stats",role:"group","aria-label":r("stats.aria"),children:[m.jsx("span",{className:"bstat-total","data-tip":r("stats.totalTitle",{n:o.total}),children:o.total}),Nm.map(i=>m.jsx(En,{count:o.status[i].length,ids:o.status[i],focusId:t,onJump:s,title:r("stats.statusTitle",{n:o.status[i].length,status:r(`status.${i}`)}),children:m.jsx("span",{className:"bstat-dot",style:{background:st[i].color}})},i)),m.jsx("span",{className:"bstat-sep"}),m.jsx(En,{count:o.driftIds.length,ids:o.driftIds,focusId:t,onJump:s,cls:"bstat-drift",title:r("stats.driftTitle",{n:o.driftIds.length}),children:"⚠"}),m.jsx(En,{count:o.issueCount,ids:o.issueIds,focusId:t,onJump:s,cls:"bstat-issue",title:r("stats.issueTitle",{n:o.issueCount}),children:"◆"}),m.jsx("span",{className:"bstat-sep"}),Sm.map(({state:i,always:a,titleKey:c})=>{const l=o.scoreCount[i],d=o.scoreNodes[i];return!l&&!a?null:m.jsx(En,{count:l,ids:d,focusId:t,onJump:s,title:r(`stats.${c}`,{n:l}),children:m.jsx(pc,{state:i})},i)})]})}function vs(){let e=0,t=null,n=null,r=null;return function(s,i){if(!s)return;const a=r!=null&&Math.abs(s.scrollTop-r)>1;(s!==n||a)&&(n=s,t=null,r=null);const c=s.scrollHeight-s.clientHeight,l=t??s.scrollTop;t=Math.max(0,Math.min(c,l+i)),cancelAnimationFrame(e);const d=()=>{if(r!=null&&Math.abs(s.scrollTop-r)>1){cancelAnimationFrame(e),t=null,r=null;return}const u=t-s.scrollTop;if(Math.abs(u)<.5){s.scrollTop=t,r=s.scrollTop;return}s.scrollTop+=u*.2,r=s.scrollTop,e=requestAnimationFrame(d)};e=requestAnimationFrame(d)}}function Cm(e){return e>1}function Am(e){return{next:Er((e("graph.cycle")||[])[0]||"o"),prev:Er((e("graph.cycleRev")||[])[0]||"O")}}const $m=_.lazy(()=>On(()=>import("./SessionInterface-DOEjuT3l.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Im=_.lazy(()=>On(()=>import("./EvalsPage-BT357Lyt.js"),__vite__mapDeps([13,1,2,6,7,3]))),Pm=_.lazy(()=>On(()=>import("./IssuesPage-BG9rNOgV.js"),__vite__mapDeps([14,1,2,3,6,7]))),jm=_.lazy(()=>On(()=>import("./Settings-7WeTJn0V.js"),__vite__mapDeps([15,1,2,11,7,4]))),Dm={spec:Kp},Tm=[.5,.5],bs={width:176,height:50},Rm=[{type:"target",position:Q.Left,x:-1.5,y:22.5,width:5,height:5},{type:"source",position:Q.Right,x:172.5,y:22.5,width:5,height:5}],_s=e=>Math.max(.4,Math.min(1.6,e)),Ht={nn:e=>`Create a new spec node under [[${e}]] — choose a kebab-case id, write its spec.md at contract altitude with a code: list, implement it, then propose merge. What it should be: `,dd:e=>`Delete the [[${e}]] spec node — remove its dir, repoint or fold its governed code, fix any [[…]] refs, recover its intent from git history, then propose merge. Why: `},wa=Object.keys(Ht),Lm=new Set(wa.map(e=>e[0]));function Rt({active:e,warm:t=!1,className:n,children:r}){const o=Ze();return!t&&!e?null:m.jsx("div",{className:n?`page-pane ${n}`:"page-pane",style:e?void 0:{display:"none"},children:m.jsx(_.Suspense,{fallback:m.jsx("div",{className:"loading",children:o("hud.loading")}),children:r})})}function zm({specs:e,sessions:t,issuesStamp:n,reload:r,identity:o,catalog:s,boardLive:i}){const a=(o==null?void 0:o.title)||"",{page:c,param:l}=Qa(),[d,u]=_.useState(()=>c==="sessions");_.useEffect(()=>{c==="sessions"&&u(!0)},[c]);const[f,h]=_.useState(()=>{var G;let z=null;try{z=sessionStorage.getItem("spex.focus")}catch{}return(z&&e.some(U=>U.id===z)?z:null)||((G=e.find(U=>!U.parent))==null?void 0:G.id)});_.useEffect(()=>{try{f&&sessionStorage.setItem("spex.focus",f)}catch{}},[f]);const[g,w]=_.useState(!1),[x,y]=_.useState("spec"),[E,p]=_.useState(!1),[v,M]=_.useState(null),[k,I]=_.useState("new"),[$,T]=_.useState(null),[F,C]=_.useState(null),[S,H]=_.useState(null),{getViewport:b,setViewport:P}=Qn(),N=Ze(),D=_.useRef(null),R=_.useRef(0),A=_.useRef({buf:"",timer:0}),[B,O]=_.useState(!1),V=_.useRef(!1);V.current=B;const K=_.useRef({x:-1,y:-1}),q=_.useMemo(()=>vs(),[]),ee=_.useMemo(()=>vs(),[]),re=_.useMemo(()=>Object.fromEntries(e.map(z=>[z.id,z])),[e]),J=_.useRef(null);_.useLayoutEffect(()=>{c!=="graph"||J.current===l||(J.current=l,l&&re[l]&&h(l))},[c,l,re]);const L=_.useCallback(z=>{z&&h(z)},[]),W=re[f]||e.find(z=>!z.parent)||e[0],te=_.useMemo(()=>{const z=new Set;for(let G=W;G;G=G.parent?re[G.parent]:null)z.add(G.id);return z},[W,re]),ne=_.useMemo(()=>bc(e,te),[e,te]),X=_.useMemo(()=>e.filter(z=>ne[z.id]).map(z=>({...z,...ne[z.id]})),[e,ne]),Z=_.useMemo(()=>Object.fromEntries(X.map(z=>[z.id,z])),[X]),Y=Z[W.id],ie=_.useMemo(()=>{const z={};return e.forEach(G=>{G.parent&&(z[G.parent]=(z[G.parent]||0)+1)}),z},[e]),ae=_.useMemo(()=>e.filter(z=>{var G;return(G=z.overlays)==null?void 0:G.length}),[e]),ce=_.useMemo(()=>$?t.find(z=>z.source===$):null,[t,$]),he=_.useMemo(()=>$?e.filter(z=>(z.overlays||[]).some(G=>G.source===$)):[],[e,$]),ye=_.useMemo(()=>$?he:ae,[$,he,ae]),ve=Am(Ns),ke=_.useCallback(z=>z?t.filter(G=>{var U;return(U=G.ops)==null?void 0:U.some(oe=>oe.nodeId===z.id)}):[],[t]),be=_.useCallback(z=>{I(z),He("sessions",z)},[]),xe=_.useCallback(z=>{I("new"),C(z),He("sessions","new")},[]),Ce=_.useCallback(z=>{mc(z,{onOpenSession:be})},[be]),_e=_.useMemo(()=>{var U;if(!S)return[];const z=e.find(oe=>oe.id===S.id);return(U=z==null?void 0:z.overlays)!=null&&U.length?[...new Set(z.overlays.map(oe=>oe.source))].map(oe=>t.find(de=>de.source===oe)).filter(Boolean):[]},[S,e,t]),$e=_.useCallback(z=>{Ce(z.address)},[Ce]);_.useLayoutEffect(()=>{if(c!=="sessions"||!l)return;const z=l.split("/")[0];z&&z!==k&&I(z)},[c,l]),_.useEffect(()=>{c==="sessions"&&He("sessions",k,{replace:!0})},[c,k]),_.useEffect(()=>{c!=="graph"&&(w(!1),p(!1),M(null),H(null))},[c]);const Ee=_.useMemo(()=>X.filter(z=>z.parent===Y.id),[X,Y]),Ie=Y.parent?Z[Y.parent]:null,It=_.useMemo(()=>Ee.length?Ee.reduce((z,G)=>Math.abs(G.y-Y.y)<Math.abs(z.y-Y.y)?G:z):null,[Ee,Y]),Qe=_.useMemo(()=>{if(It)return It;let z=null,G=1/0;for(const U of X){const oe=U.x-Y.x;if(oe<=0)continue;const de=U.y-Y.y,j=(oe/_c)**2+(de/Ec)**2;j<G&&(G=j,z=U)}return z},[It,X,Y]),dt=_.useCallback(z=>{let G=null;for(const U of X){if(U.id===Y.id||U.x!==Y.x)continue;const oe=U.y-Y.y;(z==="down"?oe<=0:oe>=0)||(!G||Math.abs(oe)<Math.abs(G.y-Y.y))&&(G=U)}return G},[X,Y]),Pt=_.useMemo(()=>dt("down"),[dt]),jt=_.useMemo(()=>dt("up"),[dt]),tr=_.useMemo(()=>X.map(z=>{const G=z.id===f||z.id===Y.parent||z.parent===f||z.parent===Y.parent;let U;$&&he.length?U=(z.overlays||[]).some(pe=>pe.source===$)?"ov-hot":"ov-dim":U=G?void 0:"is-far";const de=ke(z).map(pe=>({id:pe.id,status:pe.status,node:pe.node})),j=ie[z.id]||0,me={editors:de,collapsed:j>0&&!te.has(z.id),childCount:j};return{id:z.id,type:"spec",position:{x:z.x,y:z.y},data:{...z,...me},initialWidth:bs.width,initialHeight:bs.height,handles:Rm,draggable:!1,selected:z.id===f,className:U}}),[f,Y.parent,$,he,X,ke,ie,te]),nr=_.useMemo(()=>{const z=X.filter(U=>U.parent).map(U=>{const oe=U.id===f||U.parent===f;return{id:`${U.parent}-${U.id}`,source:U.parent,target:U.id,type:"smoothstep",style:{stroke:oe?"var(--blue)":"var(--line)",strokeWidth:oe?2:1},zIndex:oe?1:0}}),G=[];for(const U of X){const oe=(U.overlays||[]).find(j=>j.op==="moved"&&j.toParent&&Z[j.toParent]);if(!oe)continue;const de=br(oe.seed);G.push({id:`move-${U.id}-${oe.toParent}`,source:U.id,target:oe.toParent,type:"smoothstep",animated:!0,zIndex:2,className:"move-edge",style:{stroke:de,strokeWidth:1.5,strokeDasharray:"4 4",opacity:.6},markerEnd:{type:qt.ArrowClosed,color:de,width:14,height:14}})}return[...z,...G]},[f,X,Z]),rn=_.useCallback((z,G)=>{const U=b(),oe=performance.now();cancelAnimationFrame(R.current);const de=j=>{const me=G?Math.min(1,(j-oe)/G):1,pe=1-Math.pow(1-me,3);P({x:U.x+(z.x-U.x)*pe,y:U.y+(z.y-U.y)*pe,zoom:U.zoom+(z.zoom-U.zoom)*pe}),me<1&&(R.current=requestAnimationFrame(de))};R.current=requestAnimationFrame(de)},[b,P]),ze=_.useCallback((z,G,U=300)=>{const oe=D.current;if(!oe)return;const de=G??b().zoom;rn({x:oe.clientWidth/2-z.x*de,y:oe.clientHeight/2-z.y*de,zoom:de},U)},[rn,b]),on=_.useRef(!1);_.useEffect(()=>{if(on.current||c!=="graph")return;const z=requestAnimationFrame(()=>{on.current=!0,ze(Y,void 0,0)});return()=>cancelAnimationFrame(z)},[ze,Y,c]);const Je=_.useRef(Y);Je.current=Y;const sn=_.useRef(ze);sn.current=ze;const an=_.useRef(!1),et=_.useRef(!1),ft=_.useRef(null);_.useEffect(()=>{if(c==="graph"){if(!an.current){an.current=!0,ft.current=f;return}if(et.current){et.current=!1,ft.current=f;return}ft.current!==f&&(ft.current=f,sn.current(Je.current))}},[f,c]);const ht=g||E||!!v,cn=_.useRef(ht);_.useEffect(()=>{cn.current&&!ht&&Ja(),cn.current=ht},[ht]),_.useEffect(()=>{const z=yc(Y).map(j=>j.key),G=j=>y(me=>{const pe=z.indexOf(me);return z[((pe<0?0:pe)+j+z.length)%z.length]}),U=(j,me)=>{j&&(me.preventDefault(),me.stopPropagation(),O(!0),L(j.id))},oe=j=>q(document.querySelector(".ov-body .pane-doc, .ov-body .pane-hist, .ov-body .pane-issues, .ov-body .pane-eval, .ov-body .pane-edit"),j),de=j=>{var me,pe,gt,un;if(j.altKey&&!j.metaKey&&!j.ctrlKey){const Ae={Digit1:"graph",Digit2:"sessions",Digit3:"evals",Digit4:"issues",Digit5:"settings"}[j.code];if(Ae){j.preventDefault(),j.stopPropagation(),M(null),He(Ae);return}if(j.code==="KeyN"){j.preventDefault(),j.stopPropagation(),M(null),I("new"),He("sessions","new");return}if(j.code==="KeyF"){j.preventDefault(),j.stopPropagation(),M(null),He("evals");return}}if(v){j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),M(null));return}if(j.altKey&&!j.metaKey&&!j.ctrlKey&&j.code==="Slash"){j.preventDefault(),j.stopPropagation(),M("sessions");return}if(!(j.metaKey||j.ctrlKey||j.altKey)&&!((j.key==="Enter"||j.key===" ")&&((pe=(me=j.target)==null?void 0:me.closest)!=null&&pe.call(me,"button, a[href], input, select, textarea, summary")))&&c!=="sessions"&&!(c==="evals"||c==="issues")){if(c==="settings"){fe("graph.settings",j.key)&&(j.preventDefault(),j.stopPropagation(),He("graph"));return}if(g){const Ne=j.key==="Escape"?null:(un=(gt=j.target)==null?void 0:gt.closest)==null?void 0:un.call(gt,'input, textarea, select, [role="menu"], [role="menuitemradio"], [aria-haspopup="menu"]');if(Ne!=null&&Ne.closest("[data-focus-overlay]"))return;if(j.key==="Escape"){j.preventDefault(),w(!1);return}if(j.shiftKey){if(fe("nav.up",j.key))return U(jt,j);if(fe("nav.down",j.key))return U(Pt,j);if(fe("nav.parent",j.key))return U(Ie,j);if(fe("nav.child",j.key))return U(Qe,j)}if(j.key==="Tab"){j.preventDefault(),j.stopPropagation(),G(j.shiftKey?-1:1);return}if(j.key==="ArrowLeft"||j.key==="h"){j.preventDefault(),j.stopPropagation(),G(-1);return}if(j.key==="ArrowRight"||j.key==="l"){j.preventDefault(),j.stopPropagation(),G(1);return}if(/^[1-9]$/.test(j.key)&&+j.key<=z.length){j.preventDefault(),j.stopPropagation(),y(z[+j.key-1]);return}if(j.key==="j"||j.key==="k"||j.key==="ArrowDown"||j.key==="ArrowUp"){j.preventDefault(),j.stopPropagation(),oe(j.key==="j"||j.key==="ArrowDown"?120:-120);return}return}if(E){if(j.key==="Escape"||j.key==="?"){j.preventDefault(),p(!1);return}if(j.key==="j"||j.key==="k"||j.key==="ArrowDown"||j.key==="ArrowUp"){j.preventDefault(),j.stopPropagation(),ee(document.querySelector(".legend"),j.key==="j"||j.key==="ArrowDown"?120:-120);return}return}if(fe("graph.help",j.key)){j.preventDefault(),p(!0);return}if(j.key==="Escape"&&$){j.preventDefault(),j.stopPropagation(),T(null);return}if(fe("graph.settings",j.key)){j.preventDefault(),He("settings");return}if(fe("graph.search",j.key)){j.preventDefault(),j.stopPropagation(),M("nodes");return}if(!j.metaKey&&!j.ctrlKey&&!j.altKey&&/^[a-zA-Z]$/.test(j.key)){const Ne=A.current;if(Ne.buf||Lm.has(j.key)){clearTimeout(Ne.timer);const Ae=Ne.buf+j.key;if(Ht[Ae]){j.preventDefault(),j.stopPropagation(),A.current={buf:"",timer:0},xe(Ht[Ae](Y.id));return}if(wa.some(dn=>dn.startsWith(Ae))){j.preventDefault(),j.stopPropagation(),A.current={buf:Ae,timer:setTimeout(()=>{A.current={buf:"",timer:0}},700)};return}A.current={buf:"",timer:0}}}if(fe("nav.up",j.key))return U(jt,j);if(fe("nav.down",j.key))return U(Pt,j);if(fe("nav.parent",j.key))return U(Ie,j);if(fe("nav.child",j.key))return U(Qe,j);if(fe("graph.zoomIn",j.key))j.preventDefault(),O(!0),ze(Y,_s(b().zoom*1.2),160);else if(fe("graph.zoomOut",j.key))j.preventDefault(),O(!0),ze(Y,_s(b().zoom/1.2),160);else if(fe("graph.zoomReset",j.key))j.preventDefault(),O(!0),ze(Y,.85,200);else if(fe("graph.info",j.key))j.preventDefault(),w(!0);else if(fe("graph.cycle",j.key)||fe("graph.cycleRev",j.key)){if(j.preventDefault(),!ye.length)return;O(!0);const Ne=xa(ye,Y.id,fe("graph.cycleRev",j.key)?-1:1,Ae=>Ae.id);Ne&&L(Ne.id)}else fe("graph.fresh",j.key)?(j.preventDefault(),xe(`[[${Y.id}]] `)):fe("graph.evals",j.key)&&(j.preventDefault(),He("evals"))}};return window.addEventListener("keydown",de,!0),()=>window.removeEventListener("keydown",de,!0)},[g,c,E,v,$,Y,ye,jt,Pt,Qe,Ie,ze,b,be,xe,L,q,ee]),_.useEffect(()=>{const z=G=>{const U=K.current,oe=G.clientX!==U.x||G.clientY!==U.y;U.x=G.clientX,U.y=G.clientY,oe&&V.current&&O(!1)};return window.addEventListener("mousemove",z,!0),()=>window.removeEventListener("mousemove",z,!0)},[]);const rr=_.useCallback((z,G)=>{G.id!==Je.current.id&&(et.current=!0),L(G.id)},[L]),or=_.useCallback((z,G)=>{G.id!==Je.current.id&&(et.current=!0),L(G.id),w(!0)},[L]),sr=_.useCallback((z,G)=>{z.preventDefault(),G.id!==Je.current.id&&(et.current=!0),L(G.id),H({x:z.clientX,y:z.clientY,id:G.id})},[L]),ln=_.useCallback((z,G=!0)=>{const U=G&&$===z.source;if(T(U?null:z.source),U)return;const oe=new Set((z.ops||[]).map(j=>j.nodeId)),de=e.find(j=>oe.has(j.id));de&&L(de.id)},[$,e,L]);return m.jsxs("div",{className:B?"app kbd-mode":"app",children:[m.jsx(ec,{}),m.jsx(tc,{page:c,identity:o,catalog:s}),m.jsxs("div",{className:"app-main",children:[m.jsx(Rt,{active:c==="graph",warm:!0,className:"page-graph",children:m.jsxs("div",{className:"graph",ref:D,children:[m.jsx(yp,{nodes:tr,edges:nr,nodeTypes:Dm,onNodeClick:rr,onNodeDoubleClick:or,onNodeContextMenu:sr,nodeOrigin:Tm,zoomOnDoubleClick:!1,nodesDraggable:!1,nodesFocusable:!1,disableKeyboardA11y:!0,defaultViewport:{x:0,y:0,zoom:.85},minZoom:.4,maxZoom:1.6,proOptions:{hideAttribution:!0}}),m.jsxs("div",{className:"hud",children:[m.jsxs("span",{className:"brand",children:["$ ",a||"spec-dashboard"]}),m.jsx("button",{className:"hud-help",onClick:()=>p(z=>!z),"data-tip":N("hud.helpTitle"),children:"?"})]}),m.jsx(rc,{sessions:t,activeId:$,onPick:ln,onOpenSession:be}),m.jsx(km,{specs:e,focusId:f,onJump:L}),m.jsx(Gp,{menu:S,onClose:()=>H(null),onInfo:()=>w(!0),onFresh:z=>xe(`[[${z}]] `),onNewChild:z=>xe(Ht.nn(z)),onDelete:z=>xe(Ht.dd(z)),sessions:_e,onOpenSession:be}),ce&&m.jsxs("div",{className:"lock-hint",style:{"--ov":br(ce.id)},children:[m.jsxs("span",{className:"lock-hint-lead",children:[m.jsx(oc,{})," ",zr(ce)]}),he.length?m.jsx("span",{className:"lock-hint-body",children:Cm(he.length)?m.jsxs(m.Fragment,{children:[N("lockHint.cycleBefore"),m.jsx("kbd",{children:ve.next}),N("lockHint.cycleNext"),m.jsx("span",{className:"lock-hint-sep",children:" / "}),m.jsx("kbd",{children:ve.prev}),N("lockHint.cyclePrev"),N("lockHint.cycleAfter",{n:he.length})]}):N("lockHint.singleChanged")}):m.jsx("span",{className:"lock-hint-body",children:N("lockHint.empty")}),m.jsx("button",{className:"lock-hint-release",onClick:()=>T(null),"data-tip":N("lockHint.releaseTitle"),children:N("lockHint.release")})]}),E&&m.jsx(rm,{onClose:()=>p(!1)})]})}),g&&m.jsx(xc,{node:Y,pane:x,setPane:y,sessions:t,onClose:()=>w(!1)},Y.id),m.jsx(Rt,{active:c==="sessions",warm:d,className:"page-sessions",children:m.jsx($m,{sessions:t,specs:e,focusNode:Y,open:c==="sessions",searchOpen:!!v,sel:k,setSel:I,seed:F,onSeedConsumed:()=>C(null),onClose:()=>He("graph"),onPickSession:ln,onOpenSearch:()=>M("sessions"),boardLive:i,reload:r})}),m.jsx(Rt,{active:c==="evals",className:"page-evals",children:m.jsx(Im,{specs:e,sessions:t,issuesStamp:n,reloadBoard:r,onOpenSession:be,onFocusNode:z=>Ce(An(z))})}),m.jsx(Rt,{active:c==="issues",className:"page-issues",children:m.jsx(Pm,{specs:e,sessions:t,issuesStamp:n,onOpenSession:be,onFocusNode:z=>Ce(An(z))})}),m.jsx(Rt,{active:c==="settings",className:"page-settings",children:m.jsx(jm,{})}),v&&m.jsx(Em,{specs:e,sessions:t,onPick:$e,onClose:()=>M(null),boost:v==="sessions"?"session":null})]})]})}function Hm(e){return m.jsx(ua,{children:m.jsx(zm,{...e})})}const Xm=Object.freeze(Object.defineProperty({__proto__:null,default:Hm},Symbol.toStringTag,{value:"Module"}));export{qp as C,Xm as D,yr as a,mt as b,ps as c};
|