okengine 0.22.0 → 0.23.1
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/AGENTS.md +7 -0
- package/manifest.v1.schema.json +44 -0
- package/package.json +32 -19
- package/site/content/docs/ai/mcp.mdx +14 -10
- package/site/content/docs/ai/skills.mdx +1 -1
- package/site/content/docs/elements/ai/agents.mdx +61 -13
- package/site/content/docs/elements/ai/decide.mdx +536 -0
- package/site/content/docs/elements/ai/events.mdx +373 -0
- package/site/content/docs/elements/ai/index.mdx +9 -3
- package/site/content/docs/elements/ai/meta.json +1 -1
- package/site/content/docs/elements/ai/prompts.mdx +4 -2
- package/site/content/docs/elements/channel/index.mdx +4 -4
- package/site/content/docs/elements/channel/receipts.mdx +7 -5
- package/site/content/docs/elements/channel/sms.mdx +2 -1
- package/site/content/docs/elements/flow/index.mdx +22 -18
- package/site/content/docs/elements/gate/auth.mdx +4 -1
- package/site/content/docs/elements/signal/index.mdx +15 -14
- package/site/content/docs/elements/store/index.mdx +1 -1
- package/site/content/docs/elements/store/kv.mdx +5 -5
- package/site/content/docs/plugins/otp.mdx +3 -3
- package/site/content/docs/recipes/dragonfly.mdx +5 -5
- package/site/content/docs/recipes/index.mdx +6 -6
- package/site/content/docs/recipes/postgres.mdx +12 -8
- package/site/content/docs/recipes/redis.mdx +4 -4
- package/site/content/docs/reference/cli.mdx +2 -1
- package/site/content/docs/reference/configuration.mdx +9 -7
- package/site/content/docs/reference/fx.mdx +19 -10
- package/src/auth/api-key-sql.test.ts +44 -0
- package/src/auth/api-key-sql.ts +1 -0
- package/src/auth/api-keys.ts +30 -12
- package/src/auth/config.ts +6 -2
- package/src/auth/gate-auth.test.ts +20 -0
- package/src/auth/tenants.ts +17 -0
- package/src/cli/agents-md.test.ts +25 -0
- package/src/cli/ask-vault-gaps.test.ts +38 -1
- package/src/cli/ask-vault-gaps.ts +35 -2
- package/src/cli/decide.ts +174 -0
- package/src/cli/decision-lock-watch.test.ts +45 -0
- package/src/cli/decision-lock-watch.ts +51 -0
- package/src/cli/dev-app-runner.ts +34 -8
- package/src/cli/dev-auth-secret.test.ts +49 -0
- package/src/cli/dev-auth-secret.ts +49 -0
- package/src/cli/dev-hot.test.ts +41 -0
- package/src/cli/dev-hot.ts +48 -0
- package/src/cli/dev.test.ts +1 -1
- package/src/cli/dev.ts +24 -6
- package/src/cli/doctor-diff.test.ts +29 -1
- package/src/cli/doctor-diff.ts +35 -0
- package/src/cli/eval.ts +142 -1
- package/src/cli/index.ts +5 -0
- package/src/cli/load-config.images.test.ts +2 -2
- package/src/cli/load-config.ts +1 -1
- package/src/cli/manifest-pr-diff.ts +16 -0
- package/src/cli/mcp-from-console.ts +48 -0
- package/src/cli/registry.ts +35 -1
- package/src/client/agent.ts +307 -0
- package/src/client/transport.test.ts +20 -0
- package/src/client/transport.ts +2 -1
- package/src/client/types.ts +1 -1
- package/src/client-react/index.ts +7 -1
- package/src/client-react/use-agent-run.test.ts +271 -0
- package/src/client-react/use-agent-run.ts +193 -0
- package/src/compiler/ai-approval.test.ts +36 -0
- package/src/compiler/ai-repair.test.ts +22 -0
- package/src/compiler/decisions.extract.test.ts +164 -0
- package/src/compiler/effects-fetch.test.ts +77 -0
- package/src/compiler/effects-infer.ts +114 -17
- package/src/compiler/effects-join.test.ts +48 -0
- package/src/compiler/extract.test.ts +28 -0
- package/src/compiler/extract.ts +279 -13
- package/src/compiler/fx-index.ts +58 -4
- package/src/compiler/response.ts +35 -2
- package/src/config/index.ts +21 -3
- package/src/console/index.ts +1 -1
- package/src/console/server/ai-runs-flows.ts +269 -0
- package/src/console/server/ai-runs.test.ts +323 -0
- package/src/console/server/ai-runs.ts +562 -0
- package/src/console/server/ai.ts +12 -1
- package/src/console/server/app.ts +10 -1
- package/src/console/server/decisions-flows.ts +157 -0
- package/src/console/server/decisions.test.ts +66 -0
- package/src/console/server/decisions.ts +229 -0
- package/src/console/server/flows.ts +50 -2
- package/src/console/server/invoke-user-flow.ts +9 -0
- package/src/console/server/runs-ingest.ts +16 -0
- package/src/console/server/serve.ts +5 -0
- package/src/console/server/state.ts +25 -1
- package/src/console/server/store-stats.test.ts +47 -0
- package/src/console/server/store-stats.ts +92 -18
- package/src/console/ui-next/dist/assets/access-page-C_N4qvai.js +4 -0
- package/src/console/ui-next/dist/assets/{agent-disclosure-Bkohc_8X.js → agent-disclosure-Cq1TxniW.js} +1 -1
- package/src/console/ui-next/dist/assets/{cache-glyph-rL0lHxat.js → cache-glyph-BaI4uxZz.js} +1 -1
- package/src/console/ui-next/dist/assets/{call-pii-button-Deo4PP18.js → call-pii-button-DNyK7IIY.js} +1 -1
- package/src/console/ui-next/dist/assets/{collapsible-CoJ6amHf.js → collapsible-CRhBJMZR.js} +1 -1
- package/src/console/ui-next/dist/assets/confirm-sheet-DZfuJXP4.js +1 -0
- package/src/console/ui-next/dist/assets/copy-inline-button-BTjPVjRT.js +1 -0
- package/src/console/ui-next/dist/assets/decisions-page-D9twj8Xy.js +1 -0
- package/src/console/ui-next/dist/assets/detail-header-Dk5LipF6.js +1 -0
- package/src/console/ui-next/dist/assets/dropdown-menu-CRGrj5JU.js +1 -0
- package/src/console/ui-next/dist/assets/duration-tone-CsHWlVPU.js +9 -0
- package/src/console/ui-next/dist/assets/element-icons-C6t8Vlml.js +1 -0
- package/src/console/ui-next/dist/assets/explorer-chrome-Dslh2yE8.js +1 -0
- package/src/console/ui-next/dist/assets/explorer-empty-CIVg7Jgb.js +1 -0
- package/src/console/ui-next/dist/assets/flows-page-ZaTJAhR9.js +1 -0
- package/src/console/ui-next/dist/assets/{highlighted-json-CPYBzDh0.js → highlighted-json-DQ-EMAfz.js} +1 -1
- package/src/console/ui-next/dist/assets/{http-method-DTPevKmM.js → http-method-Cn_Fl79s.js} +1 -1
- package/src/console/ui-next/dist/assets/index-BlrN49Hs.css +2 -0
- package/src/console/ui-next/dist/assets/index-CmRFeWdT.js +58 -0
- package/src/console/ui-next/dist/assets/observability-page-Cn6R_dXz.js +8 -0
- package/src/console/ui-next/dist/assets/{replica-lag-BM27lXld.js → replica-lag-Bx6EZhSe.js} +7 -7
- package/src/console/ui-next/dist/assets/request-meta-DmdiUrfh.js +1 -0
- package/src/console/ui-next/dist/assets/shortcut-keys-DTE1sjTC.js +1 -0
- package/src/console/ui-next/dist/assets/store-page-8P6vGXnn.js +41 -0
- package/src/console/ui-next/dist/assets/trace-detail-sheet-BfGvpFSv.js +2 -0
- package/src/console/ui-next/dist/assets/tree-expand-toggle-CWdUHbc0.js +55 -0
- package/src/console/ui-next/dist/assets/units-page-CZOFZzay.js +1 -0
- package/src/console/ui-next/dist/assets/use-vault-list-BAyQG8Re.js +1 -0
- package/src/console/ui-next/dist/assets/vault-page-ki_ishmX.js +2 -0
- package/src/console/ui-next/dist/index.html +4 -3
- package/src/console/ui-next/seed-parked-approval.ts +126 -0
- package/src/console/ui-next/src/client.ts +224 -1
- package/src/console/ui-next/src/components/explorer/detail-header.tsx +9 -0
- package/src/console/ui-next/src/components/explorer/explorer-start-toggle.tsx +5 -1
- package/src/console/ui-next/src/components/ui/sheet-form.tsx +21 -12
- package/src/console/ui-next/src/features/flows/decisions/decisions-page.tsx +216 -0
- package/src/console/ui-next/src/features/flows/decisions/resolve.test.ts +48 -0
- package/src/console/ui-next/src/features/flows/decisions/resolve.ts +111 -0
- package/src/console/ui-next/src/features/flows/flows-page.tsx +10 -0
- package/src/console/ui-next/src/features/flows/graph/element-map.ts +1 -0
- package/src/console/ui-next/src/features/flows/traces/effect-kind.ts +6 -0
- package/src/console/ui-next/src/features/flows/traces/effect-summary.test.ts +24 -0
- package/src/console/ui-next/src/features/flows/traces/effect-summary.ts +24 -0
- package/src/console/ui-next/src/features/flows/traces/http-status.ts +58 -0
- package/src/console/ui-next/src/features/flows/traces/request-client-card.tsx +355 -0
- package/src/console/ui-next/src/features/flows/traces/request-client.test.ts +114 -0
- package/src/console/ui-next/src/features/flows/traces/request-client.ts +423 -0
- package/src/console/ui-next/src/features/flows/traces/request-input-view.test.ts +52 -6
- package/src/console/ui-next/src/features/flows/traces/request-input-view.ts +85 -19
- package/src/console/ui-next/src/features/flows/traces/trace-detail-sheet.tsx +505 -80
- package/src/console/ui-next/src/features/flows/traces/trace-lanes.test.ts +61 -0
- package/src/console/ui-next/src/features/flows/traces/trace-lanes.ts +78 -0
- package/src/console/ui-next/src/features/flows/traces/trace-nav.test.ts +48 -0
- package/src/console/ui-next/src/features/flows/traces/trace-nav.ts +57 -0
- package/src/console/ui-next/src/features/flows/traces/trace-request-section.tsx +275 -96
- package/src/console/ui-next/src/features/flows/traces/traces-pane.tsx +16 -2
- package/src/console/ui-next/src/features/observability/detail/ai-runs.tsx +369 -0
- package/src/console/ui-next/src/features/observability/observability-page.tsx +31 -1
- package/src/console/ui-next/src/features/observability/state/observability-selection.ts +18 -3
- package/src/console/ui-next/src/features/store/performance/kv-performance-panel.tsx +12 -1
- package/src/console/ui-next/src/features/store/performance/performance-panel.tsx +14 -1
- package/src/console/ui-next/src/features/units/call/call-api-panel.tsx +1 -1
- package/src/console/ui-next/src/features/units/detail/flow-contract-panel.tsx +6 -2
- package/src/console/ui-next/src/features/units/explorer/units-tree.tsx +73 -18
- package/src/console/ui-next/src/features/units/lib/unit-tree.test.ts +21 -0
- package/src/console/ui-next/src/features/units/lib/unit-tree.ts +82 -0
- package/src/console/ui-next/src/features/units/units-page.tsx +25 -7
- package/src/console/ui-next/src/router.tsx +17 -0
- package/src/console/ui-next/ui-next-seed-runs.ts +23 -0
- package/src/console/ui-next/vite-console-kernel-plugin.ts +43 -3
- package/src/console/ui-next/vite.config.ts +9 -0
- package/src/docker/recipes/dragonfly.ts +3 -2
- package/src/docker/recipes/redis.ts +1 -1
- package/src/drivers/ai-anthropic.ts +212 -21
- package/src/drivers/ai-mock.ts +34 -1
- package/src/drivers/ai-openai-compatible.ts +67 -26
- package/src/drivers/ai-preconnect.ts +18 -0
- package/src/drivers/ai-stream.test.ts +62 -0
- package/src/drivers/ai-types.ts +20 -0
- package/src/drivers/journal-postgres.test.ts +22 -1
- package/src/drivers/journal-postgres.ts +511 -13
- package/src/drivers/memory-ddl.test.ts +18 -0
- package/src/drivers/memory.ts +21 -1
- package/src/drivers/pg-rls.test.ts +31 -0
- package/src/drivers/pg-rls.ts +15 -0
- package/src/drivers/postgres.test.ts +9 -0
- package/src/drivers/postgres.ts +49 -11
- package/src/drivers/signal-compete.test.ts +234 -0
- package/src/drivers/signal-postgres.ts +39 -19
- package/src/drivers/signal-redis.ts +167 -11
- package/src/drivers/signal-types.ts +12 -0
- package/src/elements/ai/agent-event-slot.ts +27 -0
- package/src/elements/ai/approval-http.ts +207 -0
- package/src/elements/ai/approval.test.ts +741 -0
- package/src/elements/ai/approval.ts +228 -0
- package/src/elements/ai/decisions/bind.ts +163 -0
- package/src/elements/ai/decisions/certificate.test.ts +291 -0
- package/src/elements/ai/decisions/certificate.ts +377 -0
- package/src/elements/ai/decisions/certify.ts +314 -0
- package/src/elements/ai/decisions/decide.test.ts +953 -0
- package/src/elements/ai/decisions/e2e.test.ts +399 -0
- package/src/elements/ai/decisions/export.test.ts +120 -0
- package/src/elements/ai/decisions/export.ts +146 -0
- package/src/elements/ai/decisions/fixtures/openrouter-request.json +24 -0
- package/src/elements/ai/decisions/fixtures/openrouter-response.json +22 -0
- package/src/elements/ai/decisions/fixtures/typesafe-request.json +19 -0
- package/src/elements/ai/decisions/fixtures/typesafe-response.json +13 -0
- package/src/elements/ai/decisions/http.test.ts +154 -0
- package/src/elements/ai/decisions/http.ts +240 -0
- package/src/elements/ai/decisions/labels.test.ts +282 -0
- package/src/elements/ai/decisions/labels.ts +257 -0
- package/src/elements/ai/decisions/openrouter.live.test.ts +136 -0
- package/src/elements/ai/decisions/openrouter.ts +36 -0
- package/src/elements/ai/decisions/provider.ts +102 -0
- package/src/elements/ai/decisions/typesafe.ts +36 -0
- package/src/elements/ai/declare.ts +252 -1
- package/src/elements/ai/events.test.ts +379 -0
- package/src/elements/ai/events.ts +138 -0
- package/src/elements/ai/mcp-protocol.ts +5 -6
- package/src/elements/ai/run-events.test.ts +461 -0
- package/src/elements/ai/run-events.ts +522 -0
- package/src/elements/ai/runtime.ts +1187 -105
- package/src/elements/ai/stream-turn.ts +214 -0
- package/src/elements/ai/stream.live.test.ts +76 -0
- package/src/elements/ai/subagent.test.ts +136 -0
- package/src/elements/ai.test.ts +497 -3
- package/src/elements/ai.ts +16 -1
- package/src/elements/channel/runtime.ts +11 -0
- package/src/elements/channel/sql-ledger.ts +251 -0
- package/src/elements/clock/durable.ts +27 -1
- package/src/elements/signal/runtime.ts +9 -0
- package/src/elements/signal.test.ts +1 -0
- package/src/elements/store/cache.test.ts +120 -15
- package/src/elements/store/cache.ts +200 -39
- package/src/elements/store/prepare-row.test.ts +6 -2
- package/src/elements/store/sql-session.test.ts +53 -0
- package/src/elements/store/sql-session.ts +206 -10
- package/src/elements/store.ts +1 -0
- package/src/i18n/catalogs/ar.ts +5 -0
- package/src/i18n/catalogs/en.ts +5 -0
- package/src/index.ts +2 -0
- package/src/kernel/agent-event-store.ts +448 -0
- package/src/kernel/app.ts +135 -17
- package/src/kernel/auto-cache.test.ts +228 -0
- package/src/kernel/boot-bind/ai.ts +3 -0
- package/src/kernel/boot-bind/channel.ts +63 -2
- package/src/kernel/boot-bind/honor-config.test.ts +40 -10
- package/src/kernel/boot-bind/signal.ts +61 -25
- package/src/kernel/boot-bind/store.test.ts +26 -0
- package/src/kernel/boot-bind/store.ts +82 -6
- package/src/kernel/boot.ts +31 -6
- package/src/kernel/builtin-errors.ts +2 -0
- package/src/kernel/capability.ts +3 -0
- package/src/kernel/decision-label-store.ts +441 -0
- package/src/kernel/effects.test.ts +2 -1
- package/src/kernel/effects.ts +13 -1
- package/src/kernel/element-registries.ts +3 -0
- package/src/kernel/errors-compiler.ts +11 -0
- package/src/kernel/errors-text.ts +20 -0
- package/src/kernel/errors.ts +10 -0
- package/src/kernel/flow.test.ts +2 -3
- package/src/kernel/flow.ts +33 -3
- package/src/kernel/fx-call-types.test.ts +32 -0
- package/src/kernel/fx-decide.ts +765 -0
- package/src/kernel/fx-sql-handle.ts +46 -7
- package/src/kernel/fx.test.ts +13 -8
- package/src/kernel/fx.ts +339 -45
- package/src/kernel/http-frame.test.ts +94 -0
- package/src/kernel/http-frame.ts +203 -0
- package/src/kernel/idempotency.test.ts +2 -1
- package/src/kernel/journal.test.ts +114 -0
- package/src/kernel/journal.ts +471 -51
- package/src/kernel/json-result.ts +10 -0
- package/src/kernel/pipeline-tenant.ts +5 -1
- package/src/kernel/pipeline.test.ts +45 -0
- package/src/kernel/pipeline.ts +5 -0
- package/src/kernel/signal-tx.ts +28 -0
- package/src/kernel/sse-id.ts +32 -0
- package/src/kernel/store-transaction.test.ts +95 -0
- package/src/manifest/diff.ts +1 -0
- package/src/manifest/types.ts +29 -2
- package/src/mcp/ai-tools.test.ts +202 -0
- package/src/mcp/authorization.ts +66 -0
- package/src/mcp/docs-server.ts +19 -2
- package/src/mcp/mcp.test.ts +83 -0
- package/src/mcp/protocol.ts +8 -2
- package/src/mcp/server.ts +23 -2
- package/src/mcp/session.ts +3 -0
- package/src/mcp/tools.ts +168 -0
- package/src/mcp/versions.ts +60 -0
- package/src/plugins/index.ts +1 -0
- package/src/plugins/mena.ts +56 -0
- package/src/release/http-graph.test.ts +2 -0
- package/src/release/http-graph.ts +5 -0
- package/src/release/measure.ts +39 -14
- package/src/runs/collect.ts +4 -1
- package/src/runs/parquet.test.ts +27 -1
- package/src/runs/parquet.ts +19 -0
- package/src/runs/types.ts +31 -0
- package/src/runtime/json-code-block.test.ts +106 -47
- package/src/runtime/json-code-block.ts +1209 -46
- package/src/term.test.ts +13 -0
- package/src/term.ts +81 -49
- package/src/console/ui-next/dist/assets/PlusSignIcon-CwG3nxfu.js +0 -1
- package/src/console/ui-next/dist/assets/access-page-Ze6ckjdd.js +0 -4
- package/src/console/ui-next/dist/assets/copy-inline-button-CWG5_ZOh.js +0 -1
- package/src/console/ui-next/dist/assets/detail-header-b_ZzIsmU.js +0 -1
- package/src/console/ui-next/dist/assets/dropdown-menu-nwXEO1Ac.js +0 -1
- package/src/console/ui-next/dist/assets/duration-tone-BbQ_8z50.js +0 -9
- package/src/console/ui-next/dist/assets/element-icons-CwyLpVXz.js +0 -1
- package/src/console/ui-next/dist/assets/explorer-empty-C8sSCqYT.js +0 -1
- package/src/console/ui-next/dist/assets/flows-page-D2E7BtKK.js +0 -1
- package/src/console/ui-next/dist/assets/index-VxoEz295.css +0 -2
- package/src/console/ui-next/dist/assets/index-vTuwmeQz.js +0 -58
- package/src/console/ui-next/dist/assets/observability-page-SJTSzHFJ.js +0 -4
- package/src/console/ui-next/dist/assets/request-meta-BjFT7DNl.js +0 -1
- package/src/console/ui-next/dist/assets/shortcut-keys-CUNegEV4.js +0 -1
- package/src/console/ui-next/dist/assets/store-page-Qj9ThRE-.js +0 -41
- package/src/console/ui-next/dist/assets/trace-detail-sheet-Cmitq3da.js +0 -2
- package/src/console/ui-next/dist/assets/tree-expand-toggle-CbDIB-7x.js +0 -55
- package/src/console/ui-next/dist/assets/units-page-_PuYqFty.js +0 -1
- package/src/console/ui-next/dist/assets/use-vault-list-Cs45Czkt.js +0 -1
- package/src/console/ui-next/dist/assets/vault-page-BOMr0go9.js +0 -2
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
assertAdviseQuery,
|
|
10
10
|
classifyPgStatStatementsError,
|
|
11
11
|
computeStatsKpis,
|
|
12
|
+
engineErrorText,
|
|
12
13
|
maskLockActivityQuery,
|
|
13
14
|
PG_STAT_STATEMENTS_NOT_CREATED,
|
|
14
15
|
PG_STAT_STATEMENTS_NOT_PRELOADED,
|
|
@@ -63,6 +64,52 @@ describe("classifyPgStatStatementsError", () => {
|
|
|
63
64
|
classifyPgStatStatementsError(new Error('relation "pg_stat_statements" does not exist')).code,
|
|
64
65
|
).toBe(PG_STAT_STATEMENTS_NOT_CREATED);
|
|
65
66
|
});
|
|
67
|
+
|
|
68
|
+
test("Bun.SQL plain object keeps the relation message (not [object Object])", () => {
|
|
69
|
+
const err = classifyPgStatStatementsError({
|
|
70
|
+
message: 'relation "pg_stat_statements" does not exist',
|
|
71
|
+
code: "42P01",
|
|
72
|
+
});
|
|
73
|
+
expect(err.code).toBe(PG_STAT_STATEMENTS_NOT_CREATED);
|
|
74
|
+
expect(err.message).toBe('relation "pg_stat_statements" does not exist');
|
|
75
|
+
expect(err.message).not.toBe("[object Object]");
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("SQLSTATE 42P01 on errno is not-created", () => {
|
|
79
|
+
expect(
|
|
80
|
+
classifyPgStatStatementsError({
|
|
81
|
+
name: "PostgresError",
|
|
82
|
+
code: "ERR_POSTGRES_SERVER_ERROR",
|
|
83
|
+
errno: "42P01",
|
|
84
|
+
message: "",
|
|
85
|
+
}).code,
|
|
86
|
+
).toBe(PG_STAT_STATEMENTS_NOT_CREATED);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
test("a thrown DatabaseError flow failure with sqlstate 42P01 is not-created", () => {
|
|
90
|
+
const err = classifyPgStatStatementsError({
|
|
91
|
+
data: null,
|
|
92
|
+
error: { code: "DatabaseError", data: { reason: "unknown", sqlstate: "42P01" } },
|
|
93
|
+
});
|
|
94
|
+
expect(err.code).toBe(PG_STAT_STATEMENTS_NOT_CREATED);
|
|
95
|
+
expect(err.message).not.toBe("[object Object]");
|
|
96
|
+
expect(err.message.length).toBeGreaterThan(0);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("plain object with only a code does not stringify the object", () => {
|
|
100
|
+
const err = classifyPgStatStatementsError({ code: "ERR_POSTGRES_CONNECTION_CLOSED" });
|
|
101
|
+
expect(err.code).toBe(PG_STAT_STATEMENTS_UNSUPPORTED);
|
|
102
|
+
expect(err.message).toBe("ERR_POSTGRES_CONNECTION_CLOSED");
|
|
103
|
+
expect(engineErrorText({})).toBe("");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("preload wording on a plain object stays not-preloaded", () => {
|
|
107
|
+
expect(
|
|
108
|
+
classifyPgStatStatementsError({
|
|
109
|
+
message: "pg_stat_statements must be loaded via shared_preload_libraries",
|
|
110
|
+
}).code,
|
|
111
|
+
).toBe(PG_STAT_STATEMENTS_NOT_PRELOADED);
|
|
112
|
+
});
|
|
66
113
|
});
|
|
67
114
|
|
|
68
115
|
describe("maskLockActivityQuery", () => {
|
|
@@ -200,6 +200,74 @@ export interface StoreSqlAdviseResult {
|
|
|
200
200
|
readonly errors: readonly string[];
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Readable text from an `Error` or a Bun.SQL plain-object throw.
|
|
205
|
+
*
|
|
206
|
+
* Objects without `message` / `code` stay empty — `String(object)` is
|
|
207
|
+
* `"[object Object]"` and hides the real failure from the Performance pane.
|
|
208
|
+
*
|
|
209
|
+
* @param err - Driver / SQL failure
|
|
210
|
+
*/
|
|
211
|
+
export function engineErrorText(err: unknown): string {
|
|
212
|
+
if (err instanceof Error) return err.message;
|
|
213
|
+
if (typeof err === "string") return err;
|
|
214
|
+
if (err && typeof err === "object") {
|
|
215
|
+
const record = err as {
|
|
216
|
+
message?: unknown;
|
|
217
|
+
code?: unknown;
|
|
218
|
+
errno?: unknown;
|
|
219
|
+
error?: unknown;
|
|
220
|
+
};
|
|
221
|
+
if (typeof record.message === "string" && record.message.trim().length > 0) {
|
|
222
|
+
return record.message;
|
|
223
|
+
}
|
|
224
|
+
const nested = record.error;
|
|
225
|
+
if (nested && typeof nested === "object") {
|
|
226
|
+
const inner = nested as { message?: unknown; data?: unknown };
|
|
227
|
+
if (typeof inner.message === "string" && inner.message.trim().length > 0) {
|
|
228
|
+
return inner.message;
|
|
229
|
+
}
|
|
230
|
+
if (inner.data && typeof inner.data === "object" && "sqlstate" in inner.data) {
|
|
231
|
+
const sqlstate = (inner.data as { sqlstate?: unknown }).sqlstate;
|
|
232
|
+
if (typeof sqlstate === "string" && sqlstate.length > 0) return sqlstate;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
if (typeof record.errno === "string" && /^[0-9A-Z]{5}$/.test(record.errno)) {
|
|
236
|
+
return record.errno;
|
|
237
|
+
}
|
|
238
|
+
if (typeof record.code === "string" && record.code.trim().length > 0) {
|
|
239
|
+
return record.code;
|
|
240
|
+
}
|
|
241
|
+
return "";
|
|
242
|
+
}
|
|
243
|
+
if (err == null) return "";
|
|
244
|
+
return String(err);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* SQLSTATE from a Bun.SQL error, a plain object, or a thrown flow failure.
|
|
249
|
+
*
|
|
250
|
+
* @param err - Driver / SQL failure
|
|
251
|
+
*/
|
|
252
|
+
function sqlStateOf(err: unknown): string {
|
|
253
|
+
if (!err || typeof err !== "object") return "";
|
|
254
|
+
const record = err as { code?: unknown; errno?: unknown; error?: unknown };
|
|
255
|
+
if (typeof record.code === "string" && /^[0-9A-Z]{5}$/.test(record.code)) return record.code;
|
|
256
|
+
if (typeof record.errno === "string" && /^[0-9A-Z]{5}$/.test(record.errno)) return record.errno;
|
|
257
|
+
const nested = record.error;
|
|
258
|
+
if (nested && typeof nested === "object" && "data" in nested) {
|
|
259
|
+
const data = (nested as { data?: unknown }).data;
|
|
260
|
+
if (data && typeof data === "object" && "sqlstate" in data) {
|
|
261
|
+
const sqlstate = (data as { sqlstate?: unknown }).sqlstate;
|
|
262
|
+
if (typeof sqlstate === "string") return sqlstate;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (err instanceof Error && typeof err.cause === "object" && err.cause) {
|
|
266
|
+
return sqlStateOf(err.cause);
|
|
267
|
+
}
|
|
268
|
+
return "";
|
|
269
|
+
}
|
|
270
|
+
|
|
203
271
|
/**
|
|
204
272
|
* Map an engine error to a structured stats code.
|
|
205
273
|
*
|
|
@@ -207,7 +275,7 @@ export interface StoreSqlAdviseResult {
|
|
|
207
275
|
*/
|
|
208
276
|
export function classifyPgStatStatementsError(err: unknown): StoreSqlStatsError {
|
|
209
277
|
if (err instanceof StoreSqlStatsError) return err;
|
|
210
|
-
const message =
|
|
278
|
+
const message = engineErrorText(err);
|
|
211
279
|
const lower = message.toLowerCase();
|
|
212
280
|
if (
|
|
213
281
|
lower.includes("shared_preload") ||
|
|
@@ -223,13 +291,22 @@ export function classifyPgStatStatementsError(err: unknown): StoreSqlStatsError
|
|
|
223
291
|
) {
|
|
224
292
|
return new StoreSqlStatsError(PG_STAT_STATEMENTS_UNSUPPORTED, message);
|
|
225
293
|
}
|
|
294
|
+
const state = sqlStateOf(err);
|
|
295
|
+
// 42P01 undefined_table — the view is missing until CREATE EXTENSION.
|
|
296
|
+
// Domain DDL off rewrites that into OKE1110 before this classifier runs.
|
|
226
297
|
if (
|
|
298
|
+
state === "42P01" ||
|
|
299
|
+
(err instanceof Error && err.name === "OkeError" && "code" in err && err.code === 1110) ||
|
|
227
300
|
lower.includes("does not exist") ||
|
|
228
301
|
lower.includes("undefined_table") ||
|
|
302
|
+
lower.includes("domain table not found") ||
|
|
229
303
|
lower.includes("unknown function") ||
|
|
230
304
|
lower.includes("index_advisor")
|
|
231
305
|
) {
|
|
232
|
-
return new StoreSqlStatsError(
|
|
306
|
+
return new StoreSqlStatsError(
|
|
307
|
+
PG_STAT_STATEMENTS_NOT_CREATED,
|
|
308
|
+
message.length > 0 ? message : "relation pg_stat_statements does not exist",
|
|
309
|
+
);
|
|
233
310
|
}
|
|
234
311
|
return new StoreSqlStatsError(PG_STAT_STATEMENTS_UNSUPPORTED, message);
|
|
235
312
|
}
|
|
@@ -401,28 +478,25 @@ async function readStatStatements(
|
|
|
401
478
|
if (classified.code === PG_STAT_STATEMENTS_UNSUPPORTED) {
|
|
402
479
|
try {
|
|
403
480
|
return await handle.raw(STATS_SQL_LEGACY);
|
|
404
|
-
} catch
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
await tryCreateStatStatements(handle);
|
|
408
|
-
try {
|
|
409
|
-
return await handle.raw(STATS_SQL);
|
|
410
|
-
} catch {
|
|
411
|
-
return await handle.raw(STATS_SQL_LEGACY);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
throw legacy;
|
|
481
|
+
} catch {
|
|
482
|
+
// Missing view often arrives as a wrapped flow failure with no
|
|
483
|
+
// "does not exist" text. Create the extension, then read again.
|
|
415
484
|
}
|
|
416
485
|
}
|
|
417
|
-
|
|
418
|
-
|
|
486
|
+
await tryCreateStatStatements(handle);
|
|
487
|
+
try {
|
|
488
|
+
return await handle.raw(STATS_SQL);
|
|
489
|
+
} catch (retry) {
|
|
490
|
+
const again = classifyPgStatStatementsError(retry);
|
|
491
|
+
if (again.code === PG_STAT_STATEMENTS_NOT_PRELOADED) throw again;
|
|
419
492
|
try {
|
|
420
|
-
return await handle.raw(STATS_SQL);
|
|
421
|
-
} catch {
|
|
422
493
|
return await handle.raw(STATS_SQL_LEGACY);
|
|
494
|
+
} catch (legacyErr) {
|
|
495
|
+
const legacy = classifyPgStatStatementsError(legacyErr);
|
|
496
|
+
if (legacy.code === PG_STAT_STATEMENTS_NOT_PRELOADED) throw legacy;
|
|
497
|
+
throw legacy.message.length > 0 ? legacy : classified;
|
|
423
498
|
}
|
|
424
499
|
}
|
|
425
|
-
throw classified;
|
|
426
500
|
}
|
|
427
501
|
}
|
|
428
502
|
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{$n as r,Cr as i,E as a,F as o,I as s,Qn as c,R as l,c as u,i as d,l as f,o as p,rr as m,s as h,tr as g,u as _,x as v}from"./shortcut-keys-DTE1sjTC.js";import{C as y,D as b,E as x,F as S,I as C,L as w,M as ee,N as T,O as E,P as D,T as O,W as k,_ as A,a as j,b as M,c as N,d as P,f as F,g as I,i as L,m as R,o as z,p as te,u as B,w as V,x as H}from"./explorer-chrome-Dslh2yE8.js";import{i as ne,t as re}from"./http-method-Cn_Fl79s.js";import{a as ie,c as ae,h as oe,i as se,n as ce,o as le,r as ue,s as U,t as de}from"./element-icons-C6t8Vlml.js";import{t as fe}from"./UserIcon-DaE2PB5_.js";import{n as pe,t as W}from"./copy-inline-button-BTjPVjRT.js";import{Mt as G,bt as me,ht as he}from"./index-CmRFeWdT.js";import{t as ge}from"./explorer-empty-CIVg7Jgb.js";import{a as K,c as _e,l as q,n as J,o as ve,r as ye,s as be,t as xe}from"./detail-header-Dk5LipF6.js";import{t as Se}from"./confirm-sheet-DZfuJXP4.js";var Ce=[[`path`,{d:`M5 21H19`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12.125 12.75H12M12.25 12.75C12.25 12.8881 12.1381 13 12 13C11.8619 13 11.75 12.8881 11.75 12.75C11.75 12.6119 11.8619 12.5 12 12.5C12.1381 12.5 12.25 12.6119 12.25 12.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.9152 7.61089L13.8078 5.38179C13.019 3.79393 12.6246 3 12 3C11.3754 3 10.981 3.79393 10.1922 5.38179L9.08483 7.61089C8.58107 8.62494 8.32919 9.13197 7.87976 9.24608C7.8485 9.25401 7.81689 9.26043 7.78503 9.26533C7.32682 9.3357 6.89919 8.96678 6.04393 8.22895C4.0124 6.47635 2.99663 5.60004 2.38034 5.94899C2.34045 5.97157 2.30213 5.99686 2.26565 6.02467C1.70197 6.45439 2.09541 7.74136 2.88229 10.3153L4.04783 14.1279C4.47098 15.5121 4.68255 16.2042 5.21787 16.6021C5.75318 17 6.47261 17 7.91147 17L16.0886 16.9999C17.5274 16.9999 18.2468 16.9999 18.7821 16.602C19.3175 16.2041 19.529 15.512 19.9522 14.1279L21.1177 10.3153C21.9046 7.74137 22.298 6.4544 21.7344 6.02468C21.6979 5.99687 21.6595 5.97158 21.6197 5.94899C21.0034 5.60006 19.9876 6.47636 17.9561 8.22896C17.1008 8.96679 16.6732 9.3357 16.215 9.26533C16.1831 9.26043 16.1515 9.25401 16.1202 9.24607C15.6708 9.13197 15.4189 8.62494 14.9152 7.61089Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],Y=e(t(),1);function we(e,t){if(e==null)return`never`;let n=e-t;if(Math.abs(n)<6e4)return`just now`;let r=Ee(Math.abs(n));return n<0?`${r} ago`:`in ${r}`}function Te(e,t){return e==null?`never`:e<=t?`expired`:we(e,t)}function Ee(e){if(e<36e5)return`${Math.floor(e/6e4)}m`;if(e<864e5)return`${Math.floor(e/36e5)}h`;let t=Math.floor(e/864e5);return t<100?`${t}d`:`${Math.floor(t/30)}mo`}var X=864e5;function De(e){let t=/^(\d+)(ms|s|m|h|d)$/.exec(e.trim());if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`ms`:return n;case`s`:return n*1e3;case`m`:return n*6e4;case`h`:return n*36e5;case`d`:return n*X;default:return 0}}function Oe(e,t,n=``){if(e===`never`)return null;if(e===`30d`)return t+30*X;if(e===`90d`)return t+90*X;let r=De(n);return r>0?t+r:null}var Z=36e5;function ke(e,t){if(e==null)return{choice:`never`,custom:``};let n=e-t;return n<=0?{choice:`never`,custom:``}:Math.abs(n-30*X)<Z?{choice:`30d`,custom:``}:Math.abs(n-90*X)<Z?{choice:`90d`,custom:``}:{choice:`custom`,custom:Me(n)}}var Ae=7*X;function je(e,t){if(e==null||e<=t)return{choice:`90d`,custom:``};let n=e-t;return Math.abs(n-30*X)<=Ae?{choice:`30d`,custom:``}:Math.abs(n-90*X)<=Ae?{choice:`90d`,custom:``}:{choice:`custom`,custom:Me(n)}}function Me(e){return e<=0?``:e>=X&&e%X===0?`${e/X}d`:e>=Z&&e%Z===0?`${e/Z}h`:e>=6e4&&e%6e4==0?`${e/6e4}m`:e>=X?`${Math.max(1,Math.round(e/X))}d`:e>=Z?`${Math.max(1,Math.round(e/Z))}h`:`${Math.max(1,Math.round(e/6e4))}m`}var Ne=[`s`,`m`,`h`,`d`,`ms`],Pe={s:`Seconds`,m:`Minutes`,h:`Hours`,d:`Days`,ms:`Milliseconds`};function Fe(e,t,n){let r=e.trim(),i=t.trim();if(r.length===0&&i.length===0)return null;if(r.length===0||i.length===0||!/^\d+$/.test(r)||!/^\d+$/.test(i))return;let a=Number(r),o=Number(i);if(a<=0||o<=0)return;let s=`${o}${n}`;if(!(De(s)<=0))return{max:a,per:s}}function Ie(e){let t=/^(\d+)(ms|s|m|h|d)$/.exec(e.trim());return t?{count:t[1],unit:t[2]}:{count:``,unit:`m`}}function Le(e){let t=ze(e);return t.length===0?null:Be(t)?`ip`:Ve(t)?`host`:null}function Re(e){let t=new Set,n=[];for(let r of e.split(/[\s,]+/)){let e=ze(r);e.length===0||t.has(e)||Le(e)!=null&&(t.add(e),n.push(e))}return n}function ze(e){let t=e.trim().toLowerCase();if(t=t.replace(/^https?:\/\//,``),t.startsWith(`[`)&&t.includes(`]`)){let e=t.indexOf(`]`),n=t.slice(1,e),r=t.slice(e+1);t=r.startsWith(`:`)||r.startsWith(`/`)?n:`${n}${r}`}let n=t.indexOf(`/`);return n>=0&&(t=t.slice(0,n)),t.endsWith(`.`)&&(t=t.slice(0,-1)),t}function Be(e){return/^\d{1,3}(?:\.\d{1,3}){3}$/.test(e)?e.split(`.`).every(e=>Number(e)<=255):!e.includes(`:`)||!/^[0-9a-f:]+$/.test(e)||e.split(`::`).length>2?!1:e.split(`:`).filter(e=>e.length>0).length>=1}function Ve(e){if(e===`localhost`)return!0;if(e.length>253||e.includes(`:`))return!1;let t=e.split(`.`);return t.length<2?!1:t.every((e,n)=>!(e.length===0||e.length>63||!/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e)||n===t.length-1&&!/^[a-z]{2,63}$/.test(e)))}function He(e){let t=[],n=new Map;for(let r of e){let e=r.indexOf(`:`),i=e<=0?r:r.slice(0,e),a=e<=0?r:r.slice(e+1),o=n.get(i);if(o){o.push({scope:r,action:a});continue}t.push(i),n.set(i,[{scope:r,action:a}])}return t.map(e=>({group:e,items:n.get(e)??[]}))}var Q=n(),Ue=`GET /secure
|
|
2
|
+
Authorization: Bearer <secret>`,We=`{ "ok": true }`;function Ge({keyRow:e,blast:t,now:n,leading:i,onEdit:a,onRefresh:o,onRevoke:s,onRotate:l,rotatePending:u}){let d=e.revokedAt!==null,f=e.expiresAt!==null&&e.expiresAt<=n,p=t?.lastUsedAt??e.lastUsedAt,m=t?.callVolume??0,h=Te(e.expiresAt,n),g=we(p,n),_=e.rateLimit?`${e.rateLimit.max} / ${e.rateLimit.per}`:`none`,y=(0,Y.useMemo)(()=>He(e.scopes),[e.scopes]),x=e.creatorScopes.length,S=x>0&&e.scopes.length<x;return(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,"data-slot":`access-detail`,"aria-label":`Access key detail`,"aria-live":`polite`,children:[(0,Q.jsx)(xe,{dataSlot:`access-detail-header`,leading:i,icon:(0,Q.jsx)(r,{icon:oe,className:`size-4`}),title:e.name,badge:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-mono text-[10px] font-medium tracking-[0.08em] text-muted-foreground uppercase`,children:[(0,Q.jsx)(r,{icon:e.plane===`operator`?Ce:fe,className:`size-3`,"aria-hidden":!0}),e.plane]}),d?(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-destructive`,children:`revoked`}):null,f&&!d?(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-amber-700 dark:text-amber-400`,children:`expired`}):null,e.unused90d&&!d&&!f?(0,Q.jsx)(`span`,{className:`font-mono text-[10px] text-amber-700 dark:text-amber-400`,children:`unused`}):null]}),subtitle:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`code`,{className:`min-w-0 truncate font-mono text-[11px] leading-none text-foreground/80`,children:e.id}),(0,Q.jsx)(W,{value:e.id,label:`Copy ${e.id}`})]}),actions:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{label:`Rename or re-attenuate scopes`,className:`flex self-stretch`,children:(0,Q.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`h-full rounded-none`,disabled:d,onClick:a,children:`Edit`})}),(0,Q.jsx)(U,{label:`Reset expiry from now. The secret stays the same.`,className:`flex self-stretch`,children:(0,Q.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`h-full rounded-none`,"data-slot":`access-refresh`,disabled:d,onClick:o,children:`Refresh`})}),(0,Q.jsx)(U,{label:`Mint a new secret. The current secret stops working after residual TTL.`,className:`flex self-stretch`,children:(0,Q.jsx)(v,{type:`button`,variant:`ghost`,size:`sm`,className:`h-full rounded-none`,disabled:u||d,onClick:l,children:`Rotate`})}),(0,Q.jsx)(U,{label:`Irreversible. Residual sessions may continue for the access TTL.`,className:`flex self-stretch`,children:(0,Q.jsx)(v,{type:`button`,variant:`destructive`,size:`sm`,className:`h-full rounded-none`,disabled:d,onClick:s,children:`Revoke`})})]})}),(0,Q.jsx)(Ke,{revoked:d,expired:f,unused:e.unused90d,residual:t?.residualAccessNote}),(0,Q.jsxs)(`div`,{className:H,"data-slot":`access-briefing`,role:`group`,"aria-label":`Usage`,children:[(0,Q.jsx)(Xe,{label:`calls`,value:String(m)}),(0,Q.jsx)(Xe,{label:`used`,value:g,hint:p?new Date(p).toISOString():`No recorded call`,warn:p==null&&!d}),(0,Q.jsx)(Xe,{label:`expires`,value:h,hint:e.expiresAt?new Date(e.expiresAt).toISOString():`No expiry`,warn:f&&!d}),(0,Q.jsx)(Xe,{label:`rate`,value:_})]}),(0,Q.jsxs)(`section`,{className:`shrink-0 border-b border-border/60`,"aria-label":`Scopes`,children:[(0,Q.jsx)($,{title:`Scopes`,meta:S?`${e.scopes.length} of ${x}`:String(e.scopes.length),children:e.scopes.length>0?(0,Q.jsx)(W,{value:e.scopes.join(`
|
|
3
|
+
`),label:`Copy scopes`}):null}),y.length===0?(0,Q.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground`,children:`No scopes granted.`}):(0,Q.jsx)(`ul`,{"data-slot":`access-scopes`,children:y.map(e=>(0,Q.jsxs)(`li`,{className:A,"aria-label":e.group,children:[(0,Q.jsx)(`span`,{className:c(b,`w-[5.5rem] shrink-0`),children:e.group}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2`,children:e.items.map(e=>(0,Q.jsx)(`span`,{title:e.scope,className:`font-mono text-[11px] text-foreground`,children:e.action},e.scope))}),(0,Q.jsx)(Ze,{value:e.items.map(e=>e.scope).join(`
|
|
4
|
+
`),label:`Copy ${e.group} scopes`})]},e.group))})]}),(0,Q.jsxs)(`section`,{className:`shrink-0 border-b border-border/60`,"aria-label":`Key`,children:[(0,Q.jsx)($,{title:`Key`}),(0,Q.jsxs)(`dl`,{"data-slot":`access-key-facts`,children:[(0,Q.jsx)(Qe,{label:`Issuer`,value:e.creatorId,copy:e.creatorId,copyLabel:`Copy ${e.creatorId}`}),(0,Q.jsx)(Qe,{label:`Created`,value:we(e.createdAt,n),hint:new Date(e.createdAt).toISOString()}),(0,Q.jsx)(Qe,{label:`Expires`,value:h,hint:e.expiresAt?new Date(e.expiresAt).toISOString():void 0,warn:f&&!d}),(0,Q.jsx)(Qe,{label:`Rate`,value:_})]})]}),(0,Q.jsx)(qe,{entries:e.ipAllowlist}),(0,Q.jsx)(Je,{sourceAddresses:t?.sourceAddresses??[],residual:t?.residualAccessNote,lastUsed:p,now:n}),(0,Q.jsx)(Ye,{scopes:e.scopes})]})}function Ke({revoked:e,expired:t,unused:n,residual:r}){return e?(0,Q.jsx)(`section`,{className:c(H,`border-destructive/25 bg-destructive/5`),"aria-label":`Revoked`,role:`status`,children:(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center px-2 text-[12px] text-destructive`,children:[`Revoked`,(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` `,`· `,r??`This secret no longer authenticates.`]})]})}):t?(0,Q.jsx)(`section`,{className:c(H,`border-amber-500/25 bg-amber-500/5`),"aria-label":`Expired`,role:`status`,children:(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center px-2 text-[12px] text-amber-900 dark:text-amber-300`,children:[`Expired`,r?(0,Q.jsxs)(`span`,{className:`text-muted-foreground`,children:[` · `,r]}):null]})}):n?(0,Q.jsx)(`section`,{className:c(H,`border-amber-500/25 bg-amber-500/5`),"aria-label":`Unused`,role:`status`,children:(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center px-2 text-[12px] text-amber-900 dark:text-amber-300`,children:[`No calls in 90 days`,(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` · rotate or revoke`})]})}):null}function qe({entries:e}){return(0,Q.jsxs)(`section`,{className:`shrink-0 border-b border-border/60`,"aria-label":`Allow`,children:[(0,Q.jsx)($,{title:`Allow`,meta:e.length>0?String(e.length):`any`}),e.length===0?(0,Q.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground`,children:`Any origin.`}):(0,Q.jsx)(`ul`,{"data-slot":`access-allow`,children:e.map(e=>{let t=Le(e);return(0,Q.jsxs)(`li`,{className:A,children:[(0,Q.jsx)(`span`,{className:c(b,`w-[5.5rem] shrink-0`),children:t===`ip`?`IP`:t===`host`?`Host`:`—`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px]`,children:e}),(0,Q.jsx)(Ze,{value:e,label:`Copy ${e}`})]},e)})})]})}function Je({sourceAddresses:e,residual:t,lastUsed:n,now:r}){return(0,Q.jsxs)(`section`,{className:`shrink-0 border-b border-border/60`,"aria-label":`Usage`,children:[(0,Q.jsx)($,{title:`Usage`,meta:n?we(n,r):`never`}),e.length===0?(0,Q.jsx)(`p`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground`,children:`No observed source IPs.`}):(0,Q.jsx)(`ul`,{"data-slot":`access-sources`,children:e.map(e=>(0,Q.jsxs)(`li`,{className:A,children:[(0,Q.jsx)(`span`,{className:c(b,`w-[5.5rem] shrink-0`),children:`IP`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px]`,children:e}),(0,Q.jsx)(Ze,{value:e,label:`Copy ${e}`})]},e))}),t?(0,Q.jsx)(`p`,{className:`border-t border-border/60 px-2 py-1.5 text-[11px] text-muted-foreground`,children:t}):null]})}function Ye({scopes:e}){return(0,Q.jsxs)(`section`,{"data-slot":`access-call-example`,children:[(0,Q.jsx)($,{title:`Request`,children:(0,Q.jsx)(W,{value:Ue,label:`Copy request`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 border-b border-border/60`,children:[(0,Q.jsx)(`div`,{className:c(`w-1 shrink-0 self-stretch`,ne(`GET`)),"aria-hidden":!0}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 px-2.5 py-2`,children:[(0,Q.jsx)(`span`,{className:c(`shrink-0 font-mono text-[10px] font-semibold tracking-[0.08em] uppercase`,E(re(`GET`))),children:`GET`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-xs text-foreground select-all`,children:`/secure`})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 border-t border-border/60 px-2.5 py-2`,children:[(0,Q.jsx)(`span`,{className:`w-[7.5rem] shrink-0 truncate font-mono text-[11px] font-medium text-sky-600 dark:text-sky-400`,children:`Authorization`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground`,children:`Bearer <secret>`})]})]})]}),(0,Q.jsx)($,{title:`Response`,children:(0,Q.jsx)(W,{value:We,label:`Copy response`})}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 border-b border-border/60`,children:[(0,Q.jsx)(`div`,{className:`w-1 shrink-0 self-stretch bg-emerald-500`,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 px-2.5 py-2 font-mono text-[11px] text-foreground/80 select-all`,children:We})]}),(0,Q.jsxs)(`p`,{className:`px-2 py-1.5 text-[11px] text-muted-foreground`,children:[`Seed the Bearer secret from create / rotate. The key is the issuer; gates see`,` `,e.join(`, `)||`its scopes`,`.`]})]})}function $({title:e,meta:t,children:n}){return(0,Q.jsxs)(`header`,{className:c(H,`items-center gap-2 px-2`),children:[(0,Q.jsx)(`h3`,{className:c(b,`shrink-0 leading-none`),children:e}),t?(0,Q.jsx)(`span`,{className:c(N,!n&&`ml-auto`),children:t}):null,n?(0,Q.jsx)(`div`,{className:`ml-auto flex items-center`,children:n}):null]})}function Xe({label:e,value:t,hint:n,warn:r=!1}){return(0,Q.jsxs)(`span`,{title:n,className:c(y,V,`gap-1.5`),children:[(0,Q.jsx)(`span`,{className:`tracking-[0.08em] uppercase`,children:e}),(0,Q.jsx)(`span`,{className:c(`font-mono tabular-nums text-foreground`,r&&`text-amber-800 dark:text-amber-400`),children:t})]})}function Ze({value:e,label:t}){return(0,Q.jsx)(`div`,{className:`opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100`,children:(0,Q.jsx)(W,{value:e,label:t})})}function Qe({label:e,value:t,hint:n,copy:r,copyLabel:i,warn:a=!1}){return(0,Q.jsxs)(`div`,{className:A,children:[(0,Q.jsx)(`dt`,{className:c(b,`w-[5.5rem] shrink-0`),children:e}),(0,Q.jsx)(`dd`,{className:c(`min-w-0 flex-1 truncate font-mono text-[11px]`,a&&`text-amber-800 dark:text-amber-400`),title:n,children:t}),r?(0,Q.jsx)(Ze,{value:r,label:i??`Copy ${e}`}):null]})}var $e=[`console.access.list`];function et(){return m({queryKey:$e,queryFn:async()=>{let e=await D();if(e.error||!e.data)throw Error(e.error?.message??`Empty access list`);return e.data}})}function tt({rows:e,selectedKey:t,query:n,loading:r=!1,onSelect:i}){let a=e.filter(e=>e.plane===`user`),o=e.filter(e=>e.plane===`operator`);return(0,Q.jsxs)(`div`,{id:`access-list`,"data-slot":`access-list`,className:`min-h-0 flex-1 overflow-y-auto`,children:[r&&e.length===0?(0,Q.jsx)(`p`,{className:te,children:`Loading…`}):null,!r&&e.length===0&&n.trim().length>0?(0,Q.jsx)(`p`,{className:te,children:`No keys match.`}):null,(0,Q.jsx)(nt,{label:`User`,icon:fe,rows:a,selectedKey:t,onSelect:i}),(0,Q.jsx)(nt,{label:`Operator`,icon:Ce,rows:o,selectedKey:t,onSelect:i})]})}function nt(e){return(0,Q.jsxs)(`section`,{className:L,"aria-label":e.label,children:[(0,Q.jsxs)(`div`,{className:j,children:[(0,Q.jsx)(r,{icon:e.icon,className:c(F,`text-muted-foreground`),"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:c(z,`flex-1`),children:e.label}),(0,Q.jsx)(`span`,{className:N,children:e.rows.length})]}),e.rows.map(t=>{let n=t.id===e.selectedKey,i=t.revokedAt!==null;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`access-key-row`,className:c(A,n&&`bg-muted/70 text-foreground`),onClick:()=>e.onSelect(t.id),children:[(0,Q.jsx)(`span`,{className:c(I,n&&`bg-sky-500`)}),(0,Q.jsx)(r,{icon:oe,className:c(F,`text-muted-foreground`)}),(0,Q.jsx)(`span`,{className:c(`min-w-0 truncate`,i&&`text-muted-foreground line-through`),children:t.name}),i?(0,Q.jsx)(`span`,{className:`ml-auto text-[10px] text-muted-foreground`,children:`revoked`}):t.unused90d?(0,Q.jsx)(`span`,{className:`ml-auto text-[10px] text-amber-700 dark:text-amber-400`,children:`unused`}):(0,Q.jsx)(`span`,{className:c(`ml-auto tabular-nums text-[10px] text-muted-foreground`),children:t.scopes.length})]},t.id)})]})}function rt({entries:e,rateMax:t,rateCount:n,rateUnit:i,onEntries:u,onRateMax:d,onRateCount:f,onRateUnit:p}){let[m,h]=(0,Y.useState)(``),_=Re(m),v=m.trim().length>0&&_.length===0,x=()=>{if(_.length===0)return;let t=new Set(e),n=[...e];for(let e of _)t.has(e)||(t.add(e),n.push(e));u(n),h(``)};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`border-b border-border/50`,"data-slot":`access-allow-field`,children:[(0,Q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Allow`}),(0,Q.jsx)(a,{value:m,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())},placeholder:`203.0.113.4 or ci.example.com`,autoComplete:`off`,"aria-label":`Add allow entry`,"aria-invalid":v,flat:!0,className:c(J,`min-w-0 flex-1 font-mono`)}),e.length>0?(0,Q.jsx)(`span`,{className:c(N,`flex h-8 items-center pr-2`),children:e.length}):null,(0,Q.jsx)(`button`,{type:`button`,className:c(P,`h-8`),"aria-label":`Add allow entry`,disabled:_.length===0,onClick:x,children:(0,Q.jsx)(r,{icon:pe,className:`size-3.5`,"aria-hidden":!0})})]}),v?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-2 text-[11px] text-destructive`,children:`Need an IP or host — 203.0.113.4, ::1, localhost, or ci.example.com.`}):e.length===0?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-2 text-[11px] text-muted-foreground`,children:`Any client. Add an IP or host.`}):(0,Q.jsx)(`div`,{role:`list`,"aria-label":`Allow list`,children:e.map(t=>{let n=Le(t);return(0,Q.jsxs)(`div`,{role:`listitem`,"data-slot":`access-allow-entry`,"data-kind":n??`invalid`,className:c(A,`last:border-b-0`),children:[(0,Q.jsx)(`span`,{className:c(b,`w-[5.5rem] shrink-0 px-1.5`,n==null&&`text-destructive`),children:n===`ip`?`IP`:n===`host`?`Host`:`Bad`}),(0,Q.jsx)(`span`,{className:c(`min-w-0 truncate font-mono text-[11px]`,n==null&&`text-destructive`),children:t}),(0,Q.jsx)(`button`,{type:`button`,className:c(B,`ml-auto opacity-0 group-hover:opacity-100 focus-visible:opacity-100`),"aria-label":`Remove ${t}`,onClick:()=>u(e.filter(e=>e!==t)),children:(0,Q.jsx)(r,{icon:g,className:`size-3`,"aria-hidden":!0})})]},t)})})]}),(0,Q.jsxs)(`div`,{className:`flex items-stretch border-b border-border/50`,"data-slot":`access-rate-field`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Rate`}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-stretch border-r border-border/50`,children:[(0,Q.jsx)(`span`,{className:`flex h-8 shrink-0 items-center pl-1 text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Max`}),(0,Q.jsx)(a,{value:t,onChange:e=>d(e.target.value),placeholder:`none`,inputMode:`numeric`,autoComplete:`off`,"aria-label":`Rate max`,flat:!0,className:c(J,`min-w-0 flex-1 px-2 font-mono tabular-nums`)})]}),(0,Q.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-stretch`,children:[(0,Q.jsx)(`span`,{className:`flex h-8 shrink-0 items-center pl-2 text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:`Every`}),(0,Q.jsx)(a,{value:n,onChange:e=>f(e.target.value),placeholder:`1`,inputMode:`numeric`,autoComplete:`off`,"aria-label":`Rate window`,flat:!0,className:c(J,`min-w-0 flex-1 px-2 font-mono tabular-nums`)})]}),(0,Q.jsx)(`div`,{className:`flex h-8 shrink-0 items-stretch`,role:`group`,"aria-label":`Rate unit`,children:Ne.map(e=>(0,Q.jsxs)(o,{children:[(0,Q.jsx)(l,{render:t=>(0,Q.jsx)(`button`,{...t,type:`button`,"aria-pressed":i===e,"aria-label":Pe[e],onClick:n=>{t.onClick?.(n),p(e)},className:c(y,`h-8 px-1.5 font-mono font-semibold`,i===e?O:V),children:e})}),(0,Q.jsx)(s,{side:`bottom`,className:`text-[11px]`,children:Pe[e]})]},e))})]})]})}function it({expires:e,customExpires:t,onExpires:n,onCustomExpires:r}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(ve,{label:`Expires`,children:[(0,Q.jsx)(K,{active:e===`never`,onClick:()=>n(`never`),children:`never`}),(0,Q.jsx)(K,{active:e===`30d`,onClick:()=>n(`30d`),children:`30d`}),(0,Q.jsx)(K,{active:e===`90d`,onClick:()=>n(`90d`),children:`90d`}),(0,Q.jsx)(K,{active:e===`custom`,onClick:()=>n(`custom`),children:`custom`})]}),e===`custom`?(0,Q.jsx)(_e,{label:`Duration`,hint:`7d · 12h · 30m`,children:(0,Q.jsx)(a,{value:t,onChange:e=>r(e.target.value),placeholder:`7d`,autoComplete:`off`,"aria-label":`Custom expiry duration`,flat:!0,className:c(J,`font-mono`)})}):null]})}function at({value:e,placeholder:t,label:n,onChange:i}){return(0,Q.jsxs)(`label`,{className:`relative min-w-0 flex-1`,children:[(0,Q.jsx)(r,{icon:he,className:`pointer-events-none absolute top-1/2 left-3 size-3.5 -translate-y-1/2 text-muted-foreground`,"aria-hidden":!0}),(0,Q.jsx)(a,{value:e,onChange:e=>i(e.target.value),placeholder:t,"aria-label":n,autoComplete:`off`,flat:!0,className:c(ye)})]})}function ot({scopes:e,selected:t,empty:n,onChange:r}){let[i,a]=(0,Y.useState)(``),o=new Set(t),s=(0,Y.useMemo)(()=>st(e,i),[e,i]),l=(0,Y.useMemo)(()=>He(s),[s]),u=e.join(`\0`);return(0,Y.useEffect)(()=>{a(``)},[u]),(0,Q.jsxs)(`div`,{className:`border-b border-border/50`,"data-slot":`access-scope-field`,children:[(0,Q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Scopes`}),e.length>0?(0,Q.jsx)(at,{value:i,placeholder:`Search scopes`,label:`Search scopes`,onChange:a}):null]}),e.length===0?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-3 text-[11px] text-muted-foreground`,children:n}):s.length===0?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-3 text-[11px] text-muted-foreground`,children:`No scopes match.`}):(0,Q.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,role:`group`,"aria-label":`Scopes`,children:l.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-stretch border-t border-border/50`,role:`group`,"aria-label":e.group,children:[(0,Q.jsx)(`p`,{className:`flex w-[5.5rem] shrink-0 items-center px-4 font-mono text-[10px] font-semibold tracking-[0.08em] text-muted-foreground uppercase`,children:e.group}),(0,Q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-stretch`,children:e.items.map(e=>{let n=o.has(e.scope);return(0,Q.jsx)(`button`,{type:`button`,"aria-pressed":n,"aria-label":e.scope,"data-slot":`access-scope-chip`,title:e.scope,onClick:()=>{r(n?t.filter(t=>t!==e.scope):[...t,e.scope])},className:c(`inline-flex h-8 min-w-0 items-center px-2 font-mono text-[10px] font-semibold outline-none select-none`,`focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset`,n?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:e.action},e.scope)})})]},e.group))})]})}function st(e,t){let n=t.trim().toLowerCase();return n.length===0?e:e.filter(e=>e.toLowerCase().includes(n))}function ct({open:e,users:t,userScopes:n,operatorScopes:r,pending:i,error:o,onOpenChange:s,onSubmit:l}){let[m,g]=(0,Y.useState)(`user`),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(``),[S,C]=(0,Y.useState)([]),[w,ee]=(0,Y.useState)(`never`),[T,E]=(0,Y.useState)(``),[D,O]=(0,Y.useState)([]),[k,j]=(0,Y.useState)(``),[M,N]=(0,Y.useState)(``),[P,F]=(0,Y.useState)(`m`),[L,R]=(0,Y.useState)(``),z=t.find(e=>e.id===b)??null,te=(0,Y.useMemo)(()=>{let e=L.trim().toLowerCase(),n=e.length===0?t:t.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.email.toLowerCase().includes(e));return z&&!n.some(e=>e.id===z.id)?[z,...n]:n},[t,L,z]),B=(0,Y.useMemo)(()=>m===`operator`?r:z==null?[]:z.scopes.length>0?z.scopes:n,[m,n,r,z]);(0,Y.useEffect)(()=>{e||(g(`user`),y(``),x(``),C([]),ee(`never`),E(``),O([]),j(``),N(``),F(`m`),R(``))},[e]),(0,Y.useEffect)(()=>{C(e=>{let t=e.filter(e=>B.includes(e));if(t.length>0)return t;let n=B[0];return n?[n]:[]})},[B]);let V=De(T),H=Fe(k,M,P),ne=v.trim().length>0&&S.length>0&&!i&&H!==void 0&&(m===`operator`||b.length>0)&&(w!==`custom`||V>0);return(0,Q.jsx)(d,{open:e,modal:!1,disablePointerDismissal:!0,onOpenChange:s,children:(0,Q.jsxs)(p,{side:`right`,showOverlay:!1,className:`gap-0 p-0 data-[side=right]:sm:max-w-md`,"data-slot":`access-create-sheet`,children:[(0,Q.jsxs)(f,{className:`gap-1 border-b border-border/50`,children:[(0,Q.jsx)(_,{className:`text-sm`,children:`Create API key`}),(0,Q.jsx)(h,{className:`text-[11px]`,children:m===`user`?`User-plane keys require an issuer. The key cannot exceed that user's grants.`:`Operator keys inherit the actor ceiling. Absence is impossible — only grantable scopes appear.`})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex items-stretch border-b border-border/50`,"data-slot":`access-name-field`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Name`}),(0,Q.jsx)(a,{value:v,onChange:e=>y(e.target.value),placeholder:`CI deploy`,autoComplete:`off`,"aria-label":`Key name`,flat:!0,className:c(J,`min-w-0 flex-1`)})]}),(0,Q.jsxs)(ve,{label:`Plane`,children:[(0,Q.jsx)(K,{active:m===`user`,icon:fe,onClick:()=>{g(`user`)},children:`user`}),(0,Q.jsx)(K,{active:m===`operator`,icon:Ce,onClick:()=>{g(`operator`),x(``),R(``)},children:`operator`})]}),(0,Q.jsx)(it,{expires:w,customExpires:T,onExpires:ee,onCustomExpires:E}),(0,Q.jsx)(rt,{entries:D,rateMax:k,rateCount:M,rateUnit:P,onEntries:O,onRateMax:j,onRateCount:N,onRateUnit:F}),m===`user`?(0,Q.jsxs)(`div`,{className:`border-b border-border/50`,"data-slot":`access-issuer-field`,children:[(0,Q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Issuer`}),t.length>0?(0,Q.jsx)(at,{value:L,placeholder:`Search users`,label:`Search users`,onChange:R}):null]}),t.length===0?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-3 text-[11px] text-muted-foreground`,children:`No users on this plane.`}):te.length===0?(0,Q.jsx)(`p`,{className:`border-t border-border/50 px-4 py-3 text-[11px] text-muted-foreground`,children:`No users match.`}):(0,Q.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:te.map(e=>{let t=e.id===b;return(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`access-creator-user`,"aria-pressed":t,className:c(A,t&&`bg-muted/70 text-foreground`),onClick:()=>x(e.id),children:[(0,Q.jsx)(`span`,{className:c(I,t&&`bg-sky-500`)}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 font-mono text-[10px] text-muted-foreground`,children:e.id})]},e.id)})})]}):null,(0,Q.jsx)(ot,{scopes:B,selected:S,empty:m===`user`&&b.length===0?`Select an issuer to see grantable scopes.`:m===`user`?`This user has no grants.`:`No grantable scopes on this plane.`,onChange:C}),o?(0,Q.jsx)(be,{slot:`access-create-error`,children:o}):null]}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(q,{split:!0,onClick:()=>s(!1),disabled:i,children:`Cancel`}),(0,Q.jsx)(q,{variant:`default`,disabled:!ne,"data-slot":`access-create-submit`,onClick:()=>{if(H===void 0)return;let e=Oe(w,Date.now(),T);l({plane:m,name:v.trim(),scopes:S,...m===`user`?{creatorUserId:b}:{},...e==null?{}:{expiresAt:e},...H==null?{}:{rateLimit:H},...D.length>0?{ipAllowlist:D}:{}})},children:i?`Creating…`:`Create`})]})]})})}function lt({open:e,keyRow:t,users:n,operators:i,operatorScopes:o,pending:s,error:l,now:m=Date.now(),onOpenChange:g,onSubmit:v}){let y=ke(t.expiresAt,m),[b,x]=(0,Y.useState)(t.name),[S,C]=(0,Y.useState)(t.scopes),[w,ee]=(0,Y.useState)(y.choice),[T,E]=(0,Y.useState)(y.custom),[D,O]=(0,Y.useState)(t.ipAllowlist),k=Ie(t.rateLimit?.per??``),[A,j]=(0,Y.useState)(t.rateLimit?String(t.rateLimit.max):``),[M,N]=(0,Y.useState)(k.count),[P,F]=(0,Y.useState)(k.unit);(0,Y.useEffect)(()=>{if(!e)return;let n=ke(t.expiresAt,m);x(t.name),C(t.scopes),ee(n.choice),E(n.custom),O(t.ipAllowlist);let r=Ie(t.rateLimit?.per??``);j(t.rateLimit?String(t.rateLimit.max):``),N(r.count),F(r.unit)},[e,t.id]);let I=t.creatorId??``,L=(0,Y.useMemo)(()=>I.length===0?null:n.find(e=>e.id===I)??i.find(e=>e.id===I)??null,[I,i,n]),R=L?L.name.trim()||L.email.trim()||L.id:I||`Unknown`,z=(0,Y.useMemo)(()=>{let e=t.creatorScopes??[];return e.length>0?e:t.plane===`operator`?L&&L.scopes.length>0?L.scopes:o:L?.scopes??[]},[L,t.creatorScopes,t.plane,o]),te=Array.from(new Set([...z,...t.scopes])),B=De(T),V=Fe(A,M,P),H=b.trim().length>0&&S.length>0&&!s&&V!==void 0&&(w!==`custom`||B>0);return(0,Q.jsx)(d,{open:e,modal:!1,disablePointerDismissal:!0,onOpenChange:g,children:(0,Q.jsxs)(p,{side:`right`,showOverlay:!1,className:`gap-0 p-0 data-[side=right]:sm:max-w-md`,"data-slot":`access-edit-sheet`,children:[(0,Q.jsxs)(f,{className:`gap-1 border-b border-border/50`,children:[(0,Q.jsx)(_,{className:`text-sm`,children:`Edit key`}),(0,Q.jsx)(h,{className:`text-[11px]`,children:`Change name, expiry, allow, rate, and scopes. Issuer stays frozen.`})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,Q.jsxs)(`div`,{className:`flex items-stretch border-b border-border/50`,"data-slot":`access-name-field`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Name`}),(0,Q.jsx)(a,{value:b,onChange:e=>x(e.target.value),placeholder:`CI deploy`,autoComplete:`off`,"aria-label":`Key name`,flat:!0,className:c(J,`min-w-0 flex-1`)})]}),(0,Q.jsxs)(`div`,{className:`flex items-stretch border-b border-border/50`,"data-slot":`access-issuer-field`,children:[(0,Q.jsx)(`p`,{className:`flex h-8 w-[5.5rem] shrink-0 items-center px-4 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:`Issuer`}),(0,Q.jsxs)(`p`,{className:`flex min-w-0 flex-1 items-center gap-1.5 px-4 text-[12px] text-muted-foreground`,"aria-label":`Issuer ${R}`,children:[(0,Q.jsx)(r,{icon:t.plane===`operator`?Ce:fe,className:`size-3 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:R})]}),I.length>0&&I!==R?(0,Q.jsx)(`span`,{className:`flex h-8 shrink-0 items-center pr-4 font-mono text-[10px] text-muted-foreground`,children:I}):null]}),(0,Q.jsx)(it,{expires:w,customExpires:T,onExpires:ee,onCustomExpires:E}),(0,Q.jsx)(rt,{entries:D,rateMax:A,rateCount:M,rateUnit:P,onEntries:O,onRateMax:j,onRateCount:N,onRateUnit:F}),(0,Q.jsx)(ot,{scopes:te,selected:S,empty:t.plane===`user`&&L==null?`Issuer is gone. Only scopes already on this key remain.`:t.plane===`user`?`This issuer has no grants.`:`No grantable scopes on this plane.`,onChange:C}),l?(0,Q.jsx)(be,{slot:`access-edit-error`,children:l}):null]}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(q,{split:!0,onClick:()=>g(!1),disabled:s,children:`Cancel`}),(0,Q.jsx)(q,{variant:`default`,disabled:!H,"data-slot":`access-edit-submit`,onClick:()=>{V!==void 0&&v({name:b.trim(),scopes:S,expiresAt:Oe(w,Date.now(),T),rateLimit:V,ipAllowlist:D})},children:s?`Saving…`:`Save`})]})]})})}function ut({open:e,keyRow:t,pending:n,error:r,now:i=Date.now(),onOpenChange:a,onSubmit:o}){let s=je(t.expiresAt,i),[c,l]=(0,Y.useState)(s.choice),[m,g]=(0,Y.useState)(s.custom);(0,Y.useEffect)(()=>{if(!e)return;let n=je(t.expiresAt,i);l(n.choice),g(n.custom)},[e,t.id]);let v=De(m);return(0,Q.jsx)(d,{open:e,modal:!1,disablePointerDismissal:!0,onOpenChange:a,children:(0,Q.jsxs)(p,{side:`right`,showOverlay:!1,className:`gap-0 p-0 data-[side=right]:sm:max-w-md`,"data-slot":`access-refresh-sheet`,children:[(0,Q.jsxs)(f,{className:`gap-1 border-b border-border/50`,children:[(0,Q.jsx)(_,{className:`text-sm`,children:`Refresh expiry`}),(0,Q.jsx)(h,{className:`text-[11px]`,children:`Reset the deadline from now. The secret does not change.`})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,Q.jsx)(it,{expires:c,customExpires:m,onExpires:l,onCustomExpires:g}),r?(0,Q.jsx)(be,{slot:`access-refresh-error`,children:r}):null]}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(q,{split:!0,onClick:()=>a(!1),disabled:n,children:`Cancel`}),(0,Q.jsx)(q,{variant:`default`,disabled:!(!n&&(c!==`custom`||v>0)),"data-slot":`access-refresh-submit`,onClick:()=>{o(Oe(c,Date.now(),m))},children:n?`Refreshing…`:`Refresh`})]})]})})}function dt({secret:e,title:t=`New API key`,onDismiss:n}){let[r,i]=(0,Y.useState)(!1);return(0,Q.jsx)(d,{open:e!==null,onOpenChange:e=>{e||n()},children:(0,Q.jsxs)(p,{side:`right`,showOverlay:!1,className:`gap-0 p-0 data-[side=right]:sm:max-w-md`,"data-slot":`access-secret-sheet`,children:[(0,Q.jsxs)(f,{className:`gap-1 border-b border-border/50`,children:[(0,Q.jsx)(_,{className:`text-sm`,children:t}),(0,Q.jsx)(h,{className:`text-[11px]`,children:`Shown once. Store it offline. This Console process does not keep it for you.`})]}),(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[(0,Q.jsx)(`p`,{className:`border-b border-border/50 px-4 py-3 font-mono text-[11px] break-all`,children:e}),(0,Q.jsx)(`p`,{className:`px-4 py-3 text-[11px] text-muted-foreground`,role:`status`,children:`Copying puts the secret on the clipboard. Anyone with this device can read it until you clear it.`})]}),(0,Q.jsxs)(u,{children:[(0,Q.jsx)(q,{split:!0,disabled:!e,onClick:()=>{e&&(navigator.clipboard?.writeText(e),i(!0))},children:r?`Copied`:`Copy (clipboard warning)`}),(0,Q.jsx)(q,{variant:`destructive`,onClick:()=>{i(!1),n()},children:`I have stored this key`})]})]})})}function ft(){let e=et(),t=i(),{query:n,selectedKey:a,action:o,setQuery:s,setSelectedKey:c,setAction:l}=me(),u=ce(),[d]=(0,Y.useState)(()=>Date.now()),[f,p]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(`New API key`),_=(0,Y.useMemo)(()=>{let t=e.data?.userPlane.keys??[],n=e.data?.operatorPlane.keys??[];return[...t,...n]},[e.data]),v=(0,Y.useMemo)(()=>{let e=n.trim().toLowerCase();return e?_.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.scopes.some(t=>t.toLowerCase().includes(e))):_},[_,n]),y=v.find(e=>e.id===a)??_.find(e=>e.id===a),b=m({queryKey:[`console.access.blast`,y?.id],queryFn:async()=>{if(!y)throw Error(`no key`);let e=await T(y.id);if(e.error||!e.data)throw Error(e.error?.message??`blast failed`);return e.data},enabled:y!==void 0});(0,Y.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=e.target;if(t instanceof HTMLElement){let e=t.tagName;if(e===`INPUT`||e===`TEXTAREA`||t.isContentEditable)return}e.preventDefault(),document.querySelector(`[data-slot='access-search-input']`)?.focus()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let E=()=>{t.invalidateQueries({queryKey:$e})},D=G({mutationFn:ee,onSuccess:e=>{if(e.error||!e.data)throw Error(e.error?k(e.error):`create failed`);g(`New API key`),p(e.data.secret),c(e.data.key.id),l(null),E()}}),O=G({mutationFn:e=>C({keyId:y.id,confirmation:e.confirmation,reason:e.reason}),onSuccess:e=>{if(e.error||!e.data)throw Error(e.error?k(e.error):`rotate failed`);g(`Rotated API key`),p(e.data.secret),l(null),E()}}),A=G({mutationFn:e=>S({keyId:y.id,confirmation:e.confirmation,reason:e.reason}),onSuccess:e=>{if(e.error||!e.data)throw Error(e.error?k(e.error):`revoke failed`);l(null),E()}}),j=G({mutationFn:w,onSuccess:e=>{if(e.error||!e.data)throw Error(e.error?k(e.error):`update failed`);l(null),E()}}),N=G({mutationFn:e=>w({keyId:y.id,expiresAt:e}),onSuccess:e=>{if(e.error||!e.data)throw Error(e.error?k(e.error):`refresh failed`);l(null),E()}}),F=(0,Q.jsx)(le,{open:u.open,onToggle:u.toggle,noun:`keys`,controlsId:`access-list`,dataSlot:`access-list-toggle`});return(0,Q.jsxs)(`div`,{className:R,"data-slot":`access-page`,children:[(0,Q.jsxs)(ie,{orientation:`horizontal`,className:`min-h-0 flex-1`,children:[(0,Q.jsx)(se,{panelRef:u.panelRef,collapsible:!0,collapsedSize:0,defaultSize:M.start.defaultSize,minSize:M.start.minSize,onResize:u.onResize,className:`min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:x,children:[(0,Q.jsx)(ae,{"data-slot":`access-search-input`,placeholder:`Search keys`,"aria-label":`Search keys`,value:n,onChange:e=>s(e.target.value)}),(0,Q.jsx)(U,{label:`Create key`,className:`flex self-stretch`,children:(0,Q.jsx)(`button`,{type:`button`,className:P,"data-slot":`access-create`,"aria-label":`Create key`,onClick:()=>l(`create`),children:(0,Q.jsx)(r,{icon:pe,className:`size-3.5`})})})]}),(0,Q.jsx)(tt,{rows:v,selectedKey:a,query:n,loading:e.isLoading,onSelect:c})]})}),u.open?(0,Q.jsx)(ue,{withHandle:!0}):null,(0,Q.jsx)(se,{defaultSize:M.end.defaultSize,minSize:M.end.minSize,className:`min-h-0 overflow-hidden`,children:y?(0,Q.jsx)(Ge,{keyRow:y,blast:b.data,now:d,leading:F,onEdit:()=>l(`edit`),onRefresh:()=>l(`refresh`),onRevoke:()=>l(`revoke`),onRotate:()=>l(`rotate`),rotatePending:O.isPending}):(0,Q.jsx)(ge,{icon:de.gate.icon,iconClassName:`border-border/70`,title:e.isLoading?`Loading keys…`:_.length>0?`Select a key`:`No keys yet`,leading:F,description:e.isLoading?`Reading planes and grantable scopes.`:_.length>0&&n.trim().length>0?(0,Q.jsxs)(Q.Fragment,{children:[`Nothing matches `,(0,Q.jsx)(`span`,{className:`font-mono`,children:n}),`.`,` `,(0,Q.jsx)(`button`,{type:`button`,className:`underline underline-offset-2 hover:text-foreground`,onClick:()=>s(``),children:`Clear search`})]}):`Create one to mint a secret once.`})})]}),(0,Q.jsx)(ct,{open:o===`create`,users:e.data?.userPlane.users??[],userScopes:e.data?.userPlane.grantableScopes??[],operatorScopes:e.data?.operatorPlane.grantableScopes??[],pending:D.isPending,error:D.error instanceof Error?D.error.message:null,onOpenChange:e=>{e||l(null)},onSubmit:e=>D.mutate(e)}),y?(0,Q.jsx)(lt,{open:o===`edit`,keyRow:y,users:e.data?.userPlane.users??[],operators:e.data?.operatorPlane.operators??[],operatorScopes:e.data?.operatorPlane.grantableScopes??[],pending:j.isPending,error:j.error instanceof Error?j.error.message:null,onOpenChange:e=>{e||l(null)},onSubmit:e=>j.mutate({keyId:y.id,...e})}):null,y?(0,Q.jsx)(ut,{open:o===`refresh`,keyRow:y,pending:N.isPending,error:N.error instanceof Error?N.error.message:null,onOpenChange:e=>{e||l(null)},onSubmit:e=>N.mutate(e)}):null,y?(0,Q.jsx)(Se,{open:o===`revoke`,onOpenChange:e=>{e||l(null)},phrase:`REVOKE`,title:`Revoke ${y.name}`,description:`Irreversible. Residual sessions may continue for the access TTL.`,pending:A.isPending,error:A.error instanceof Error?A.error.message:null,confirmLabel:`Revoke key`,slot:`access-revoke-sheet`,onConfirm:e=>A.mutate({confirmation:`REVOKE`,reason:e.reason})}):null,y?(0,Q.jsx)(Se,{open:o===`rotate`,onOpenChange:e=>{e||l(null)},phrase:`ROTATE`,title:`Rotate ${y.name}`,description:`Mints a new secret once. The current secret stops after residual TTL.`,pending:O.isPending,error:O.error instanceof Error?O.error.message:null,confirmLabel:`Rotate key`,confirmVariant:`ghost`,slot:`access-rotate-sheet`,onConfirm:e=>O.mutate({confirmation:`ROTATE`,reason:e.reason})}):null,(0,Q.jsx)(dt,{secret:f,title:h,onDismiss:()=>p(null)})]})}export{ft as AccessPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e}from"./xyflow-yApv7D4e.js";import{
|
|
1
|
+
import{A as e}from"./xyflow-yApv7D4e.js";import{Qn as t}from"./shortcut-keys-DTE1sjTC.js";import{c as n,l as r,st as i}from"./index-CmRFeWdT.js";var a=e();function o({open:e,openHeight:o=`auto`,className:s,style:c,transition:l,...u}){let d=r()??!1;return(0,a.jsx)(n.div,{...u,"aria-hidden":!e,inert:!e||void 0,initial:!1,animate:d?{opacity:+!!e}:{opacity:+!!e,clipPath:e?`inset(0 0 0% 0)`:`inset(0 0 100% 0)`,y:e?0:-4},transition:l??{duration:d?0:e?.22:.14,ease:i},className:t(`overflow-hidden`,s),style:{...c,height:e?o:0,pointerEvents:e?void 0:`none`,transformOrigin:`top`}})}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,f as t}from"./xyflow-yApv7D4e.js";import{
|
|
1
|
+
import{A as e,f as t}from"./xyflow-yApv7D4e.js";import{$n as n,F as r,I as i,Qn as a,R as o}from"./shortcut-keys-DTE1sjTC.js";import{C as s,S as c,_ as l,g as u,n as d,w as f,x as p}from"./request-meta-DmdiUrfh.js";import{t as m}from"./dagre.esm-B1_XeuLP.js";function h(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(0,t)}function g(e){let t=e.indexOf(`.`);return t===-1?e:e.slice(t+1)}function _(e){let t=e?.flows??{},n=new Map;for(let e of Object.keys(t)){let r=t[e]?.effects?.calls??[];for(let t of r){let r=n.get(t)??[];r.push(e),n.set(t,r)}}for(let[e,t]of n)t.sort((e,t)=>e.localeCompare(t)),n.set(e,t);return n}function v(e,t){return _(e).get(t)??[]}function y(e){return e.startsWith(`sql:`)?{id:e,kind:`store`,label:e.slice(4),facet:`sql`}:e.startsWith(`kv:`)?{id:e,kind:`store`,label:e.slice(3),facet:`kv`}:e.startsWith(`files:`)?{id:e,kind:`store`,label:e.slice(6),facet:`files`}:e.startsWith(`index:`)?{id:e,kind:`store`,label:e.slice(6),facet:`index`}:e.startsWith(`signal:`)?{id:e,kind:`signal`,label:e.slice(7)}:e.startsWith(`ai:`)?{id:e,kind:`ai`,label:e.slice(3)}:e.startsWith(`vault:`)?{id:e,kind:`vault`,label:e.slice(6)}:e.startsWith(`channel:`)?{id:e,kind:`channel`,label:e.slice(8)}:e.startsWith(`gate:`)?{id:e,kind:`gate`,label:e.slice(5)}:e.startsWith(`clock:`)?{id:e,kind:`clock`,label:e.slice(6)}:null}function b(e,n,r,i,a=!1){let o=u[i];return{id:e,source:n,target:r,type:`smoothstep`,animated:a,data:{kind:i},style:{stroke:o,strokeWidth:i===`calls`?2.5:2.25},pathOptions:{borderRadius:28},zIndex:l.edge,markerEnd:{type:t.ArrowClosed,width:14,height:14,color:o}}}function x(e){let t=e?.flows??{},n=new Set(Object.keys(t)),r=[],i=new Map;for(let e of[...n].sort()){let t=h(e),n=i.get(t)??[];n.push(e),i.set(t,n)}let a=new Map,o=new Map;for(let e of n){let n=t[e];if(!n)continue;if(n.trigger?.signal){let t=`signal:${n.trigger.signal}`,i=y(t);i&&a.set(t,i),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}if(n.trigger?.cron||n.trigger?.every){let t=`clock:${e}`,i=n.trigger.cron??n.trigger.every??e;a.set(t,{id:t,kind:`clock`,label:i,facet:n.trigger.cron?`cron`:`every`}),r.push(b(`e:${t}->flow:${e}`,t,`flow:${e}`,`trigger`))}for(let t of n.gates??[]){let n=`gate:${t}`;a.set(n,{id:n,kind:`gate`,label:t}),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}-gates->${n}`,`flow:${e}`,n,`gates`))}let i=n.effects;if(i){for(let t of i.reads??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-reads->${t}`,`flow:${e}`,t,`reads`)))}for(let t of i.writes??[]){let n=y(t);n&&(a.set(t,n),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}-writes->${t}`,`flow:${e}`,t,`writes`)))}for(let t of i.emits??[]){let n=`signal:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`emits`)))}for(let t of i.asks??[]){let n=`ai:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`asks`)))}for(let t of i.sends??[]){let n=`channel:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`sends`)))}for(let t of i.secrets??[]){let n=`vault:${t}`,i=y(n);i&&(a.set(n,i),o.set(n,(o.get(n)??0)+1),r.push(b(`e:flow:${e}->${n}`,`flow:${e}`,n,`secrets`)))}for(let t of i.calls??[]){let n=f(t);if(n){let t=s(n.server);a.set(t,{id:t,kind:`ai`,label:n.server}),o.set(t,(o.get(t)??0)+1),r.push(b(`e:flow:${e}->${t}`,`flow:${e}`,t,`calls`,!0));continue}r.push(b(`e:flow:${e}->flow:${t}`,`flow:${e}`,`flow:${t}`,`calls`,!0))}}}return{nodes:S(i,t,a,o),edges:r,flowIds:n}}function S(e,t,n,r){let i=new m.graphlib.Graph({compound:!0});i.setGraph({rankdir:`LR`,align:`UL`,nodesep:16,ranksep:88,edgesep:12,marginx:8,marginy:8}),i.setDefaultEdgeLabel(()=>({}));for(let[t,n]of[...e.entries()].sort()){i.setNode(`unit:${t}`,{});for(let e of n)i.setNode(`flow:${e}`,{...p.flow}),i.setParent(`flow:${e}`,`unit:${t}`)}for(let e of n.values())i.setNode(e.id,{...p[e.kind]});let a=new Set;for(let n of e.values())for(let e of n){let n=t[e];if(!n)continue;let r=(e,t)=>{let n=`${e}->${t}`;a.has(n)||i.hasNode(e)&&i.hasNode(t)&&(a.add(n),i.setEdge(e,t))};n.trigger?.signal&&r(`signal:${n.trigger.signal}`,`flow:${e}`),(n.trigger?.cron||n.trigger?.every)&&r(`clock:${e}`,`flow:${e}`);for(let t of n.gates??[])r(`flow:${e}`,`gate:${t}`);let o=n.effects;if(o){for(let t of o.reads??[])r(`flow:${e}`,t);for(let t of o.writes??[])r(`flow:${e}`,t);for(let t of o.emits??[])r(`flow:${e}`,`signal:${t}`);for(let t of o.asks??[])r(`flow:${e}`,`ai:${t}`);for(let t of o.sends??[])r(`flow:${e}`,`channel:${t}`);for(let t of o.secrets??[])r(`flow:${e}`,`vault:${t}`);for(let t of o.calls??[]){let n=f(t);n?r(`flow:${e}`,s(n.server)):r(`flow:${e}`,`flow:${t}`)}}}m.layout(i);let o=[],{headerH:u,padX:d,padBottom:h}=c;for(let[n,r]of[...e.entries()].sort()){let e=`unit:${n}`,a=i.node(e);if(!a)continue;let s=a.x??0,c=a.y??0,f=r.length*p.flow.height+Math.max(0,r.length-1)*10,m=p.flow.width+d*2,_=u+f+h,v=s-m/2,y=c-_/2;o.push({id:e,type:`unit`,position:{x:v,y},data:{kind:`unit`,label:n,refId:e,badge:String(r.length)},selectable:!1,draggable:!1,zIndex:l.unit,width:m,height:_,style:{width:m,height:_}}),r.forEach((r,i)=>{let a=t[r];a&&o.push({id:`flow:${r}`,type:`flow`,position:{x:d,y:u+i*(p.flow.height+10)},parentId:e,extent:`parent`,zIndex:l.leaf,data:{kind:`flow`,label:g(r),refId:r,unit:n,plane:a.plane??`user`,badge:a.plane??`user`},draggable:!1,width:p.flow.width,height:p.flow.height,style:{width:p.flow.width,height:p.flow.height}})})}let _=[...n.values()].sort((e,t)=>e.kind.localeCompare(t.kind)||e.label.localeCompare(t.label));for(let e of _){let t=i.node(e.id),n=p[e.kind],a=r.get(e.id)??0;o.push({id:e.id,type:e.kind,position:{x:(t?.x??0)-n.width/2,y:(t?.y??0)-n.height/2},data:{kind:e.kind,label:e.label,refId:e.id,...e.facet===void 0?{}:{facet:e.facet},badge:e.facet??(a>0?String(a):e.kind)},draggable:!1,zIndex:l.leaf,width:n.width,height:n.height,style:{width:n.width,height:n.height}})}return o}function C(e,t,n,r={}){let i=t.size>0||n.size>0;return e.map(e=>{if(e.data.kind===`unit`||e.data.kind===`law`)return e;let a=e.data.kind===`flow`?t.has(e.data.refId):n.has(e.id);return{...e,data:{...e.data,highlighted:a,dimmed:i&&!a,active:r.activeNodeId!=null&&e.id===r.activeNodeId,focused:r.focusedNodeId!=null&&e.id===r.focusedNodeId}}})}function w(e,t){let n=new Map(t.map(e=>[e.id,e]));return t.some(e=>e.data.highlighted===!0)?e.map(e=>{let t=n.get(e.source),r=n.get(e.target),i=t?.data.highlighted===!0&&r?.data.highlighted===!0,a=u[e.data?.kind??`reads`];return{...e,animated:i?!0:e.animated,style:{...e.style,stroke:a,opacity:i?1:.32,strokeWidth:i?2.75:1.75},markerEnd:e.markerEnd&&typeof e.markerEnd==`object`?{...e.markerEnd,color:a}:e.markerEnd}}):e.map(e=>({...e,style:{...e.style,opacity:1}}))}var T=100;function E(e,t){return e.filter(e=>t.has(e.flow)).sort((e,t)=>t.startedAt-e.startedAt).slice(0,T)}var D=e();function O({cache:e,dataSlot:t}){let s=d(e);return(0,D.jsxs)(r,{children:[(0,D.jsx)(o,{render:r=>(0,D.jsx)(`span`,{...r,className:a(`flex w-4 shrink-0 items-center justify-center`,s.className),"data-slot":t,"data-cache":e,"aria-label":s.label,children:(0,D.jsx)(n,{icon:s.icon,className:`size-3`,"aria-hidden":!0})})}),(0,D.jsx)(i,{side:`top`,children:s.label})]})}export{w as a,h as c,C as i,E as n,x as o,g as r,v as s,O as t};
|
package/src/console/ui-next/dist/assets/{call-pii-button-Deo4PP18.js → call-pii-button-DNyK7IIY.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e}from"./xyflow-yApv7D4e.js";import{
|
|
1
|
+
import{A as e}from"./xyflow-yApv7D4e.js";import{$n as t,Qn as n,x as r}from"./shortcut-keys-DTE1sjTC.js";import{h as i,s as a}from"./element-icons-C6t8Vlml.js";import{ft as o,pt as s,vt as c}from"./index-CmRFeWdT.js";var l=[[`path`,{d:`M4.31802 19.682C3 18.364 3 16.2426 3 12C3 7.75736 3 5.63604 4.31802 4.31802C5.63604 3 7.75736 3 12 3C16.2426 3 18.364 3 19.682 4.31802C21 5.63604 21 7.75736 21 12C21 16.2426 21 18.364 19.682 19.682C18.364 21 16.2426 21 12 21C7.75736 21 5.63604 21 4.31802 19.682Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M6 12H8.5L10.5 8L13.5 16L15.5 12H18`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],u=[[`path`,{d:`M5.92089 5.92089C8.15836 3.68342 9.2771 2.56468 10.5857 2.19562C11.5105 1.93479 12.4895 1.93479 13.4143 2.19562C14.7229 2.56468 15.8416 3.68342 18.0791 5.92089C20.3166 8.15836 21.4353 9.2771 21.8044 10.5857C22.0652 11.5105 22.0652 12.4895 21.8044 13.4143C21.4353 14.7229 20.3166 15.8416 18.0791 18.0791C15.8416 20.3166 14.7229 21.4353 13.4143 21.8044C12.4895 22.0652 11.5105 22.0652 10.5857 21.8044C9.2771 21.4353 8.15836 20.3166 5.92089 18.0791C3.68342 15.8416 2.56468 14.7229 2.19562 13.4143C1.93479 12.4895 1.93479 11.5105 2.19562 10.5857C2.56468 9.2771 3.68342 8.15836 5.92089 5.92089Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],d=[[`path`,{d:`M14.9961 17H16.9961C19.7575 17 21.9961 14.7614 21.9961 12C21.9961 9.23858 19.7575 7 16.9961 7H14.9961M8.99609 17H6.99609C4.23467 17 1.99609 14.7614 1.99609 12C1.99609 9.23858 4.23467 7 6.99609 7H8.99609`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M8.49609 12H15.4961`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}]],f=[[`path`,{d:`M18.8906 12.846C18.5371 14.189 16.8667 15.138 13.5257 17.0361C10.296 18.8709 8.6812 19.7884 7.37983 19.4196C6.8418 19.2671 6.35159 18.9776 5.95624 18.5787C5 17.6139 5 15.7426 5 12C5 8.2574 5 6.3861 5.95624 5.42132C6.35159 5.02245 6.8418 4.73288 7.37983 4.58042C8.6812 4.21165 10.296 5.12907 13.5257 6.96393C16.8667 8.86197 18.5371 9.811 18.8906 11.154C19.0365 11.7084 19.0365 12.2916 18.8906 12.846Z`,stroke:`currentColor`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],p=e();function m({kind:e,className:r,hex:a,inferred:o}){return e===`pk`?(0,p.jsx)(t,{icon:i,className:n(`size-3 shrink-0 text-amber-500`,r),"aria-label":`Primary key`}):e===`unique`?(0,p.jsx)(t,{icon:u,className:n(`size-3 shrink-0 text-violet-500`,r),"aria-label":`Unique`}):e===`none`?(0,p.jsx)(t,{icon:c,className:n(`size-3 shrink-0 text-muted-foreground/35`,r),"aria-label":`No key`}):(0,p.jsx)(t,{icon:d,className:n(`size-3 shrink-0`,!a&&`text-sky-500`,r),style:a?{color:a}:void 0,"aria-label":o?`Inferred foreign key`:`Foreign key`})}function h({primaryKey:e,foreignKey:t,unique:n,inferred:r,hex:i,empty:a=`spacer`}){let o=n===!0&&e!==!0;return!e&&!t&&!o?a===`none`?(0,p.jsx)(`span`,{className:`inline-flex shrink-0 items-center`,title:`None`,children:(0,p.jsx)(m,{kind:`none`})}):(0,p.jsx)(`span`,{className:`inline-flex w-3 shrink-0`,"aria-hidden":!0}):(0,p.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-px`,children:[e?(0,p.jsx)(m,{kind:`pk`}):null,t?(0,p.jsx)(m,{kind:`fk`,hex:i,inferred:r}):null,o?(0,p.jsx)(m,{kind:`unique`}):null]})}var g=`[redacted]`;function _(e){let t=[e],n=x(e),r=S(e);return n!==e&&t.push(n),r!==e&&t.push(r),t}function v(e,t){for(let n of _(t))e.add(n)}function y(e){let t=new Set;for(let n of e)v(t,n);return t}function b(e){let t=new Set;for(let n of e)t.add(x(n));return t.size}function x(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1_$2`).replace(/([A-Z])([A-Z][a-z])/g,`$1_$2`).toLowerCase()}function S(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}function C({piiMasked:e,disabled:i,onToggle:c}){return(0,p.jsx)(a,{label:e?`PII hidden. Click to include cleartext (audited).`:`PII included. Click to remask.`,className:`flex self-stretch`,children:(0,p.jsxs)(r,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,className:n(`h-full rounded-none px-2 text-[11px]`,!e&&`text-amber-800 dark:text-amber-300`),"aria-pressed":!e,"aria-label":e?`Include PII: disabled`:`Include PII: enabled`,onClick:c,"data-slot":`call-api-pii`,children:[(0,p.jsx)(t,{icon:e?s:o,"data-icon":`inline-start`,className:`size-3.5`}),`PII`]})})}export{b as a,f as c,y as i,l,g as n,h as o,v as r,m as s,C as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{Dt as r,
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{Dt as r,Et as i,Gn as a,Gt as o,Jt as s,Qn as c,S as l,Sn as u,T as d,Tt as f,W as p,Wn as m,Xt as h,Yt as g,Zt as _,bn as v,ct as y,in as b,jn as x,k as S,ln as C,lt as w,qt as T,st as E}from"./shortcut-keys-DTE1sjTC.js";import{i as D}from"./index-CmRFeWdT.js";var O=[[`path`,{d:`M13.9248 21H10.0752C5.44476 21 3.12955 21 2.27636 19.4939C1.42317 17.9879 2.60736 15.9914 4.97574 11.9985L6.90057 8.75333C9.17559 4.91778 10.3131 3 12 3C13.6869 3 14.8244 4.91777 17.0994 8.75332L19.0243 11.9985C21.3926 15.9914 22.5768 17.9879 21.7236 19.4939C20.8704 21 18.5552 21 13.9248 21Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 9V13`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M12.125 16.75H12M12.25 16.75C12.25 16.8881 12.1381 17 12 17C11.8619 17 11.75 16.8881 11.75 16.75C11.75 16.6119 11.8619 16.5 12 16.5C12.1381 16.5 12.25 16.6119 12.25 16.75Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],k=[[`path`,{d:`M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],A=[[`path`,{d:`M17 8L18.8398 9.85008C19.6133 10.6279 20 11.0168 20 11.5C20 11.9832 19.6133 12.3721 18.8398 13.1499L17 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M7 8L5.16019 9.85008C4.38673 10.6279 4 11.0168 4 11.5C4 11.9832 4.38673 12.3721 5.16019 13.1499L7 15`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M14.5 4L9.5 20`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],j=d(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function M({className:e,variant:t=`default`,render:n,...r}){return D({defaultTagName:`span`,props:i({className:c(j({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var N=e(t(),1);function P(e){let{open:t,defaultOpen:n=!1,onOpenChange:r,disabled:i}=e,[a,o]=S({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:s,setMounted:c,transitionStatus:l}=w(a,!0,!0),u=p(),[d,f]=N.useState(),m=d===null?void 0:d??u,h=T(e=>{let t=!a,n=_(C,e.nativeEvent);r(t,n),!n.isCanceled&&o(t)});return N.useMemo(()=>({defaultPanelId:u,disabled:i,handleTrigger:h,mounted:s,open:a,panelId:m,setMounted:c,setOpen:o,setPanelIdState:f,transitionStatus:l}),[u,i,h,s,a,m,c,o,f,l])}var F=N.createContext(void 0);function I(){let e=N.useContext(F);if(e===void 0)throw Error(m(15));return e}var L=`data-open`,R=`data-closed`,z=u,B=`data-panel-open`,V={[L]:``},H={[R]:``},U={open(e){return e?{[B]:``}:null}},W={open(e){return e?V:H},...v},G=n(),K=N.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=T(o),d=P({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),p=N.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),m=N.useMemo(()=>({...d,onOpenChange:u,state:p}),[d,u,p]),h=f(`div`,e,{state:p,ref:t,props:l,stateAttributesMapping:W});return(0,G.jsx)(F.Provider,{value:m,children:h})}),q={...U,...v},J=N.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=I(),{className:s,disabled:c=o,render:u,nativeButton:d=!0,style:p,...m}=e,{getButtonProps:h,buttonRef:g}=l({disabled:c,focusableWhenDisabled:!0,native:d});return f(`button`,e,{state:a,ref:[t,g],props:[{"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i},m,h],stateAttributesMapping:q})}),Y={height:void 0,width:void 0};function X(e){let{externalRef:t,hiddenUntilFound:n,id:r,keepMounted:i,mounted:c,onOpenChange:l,open:u,setMounted:d,setOpen:f,transitionStatus:p}=e,m=N.useRef(null),v=N.useRef(null),[x,S]=N.useState(Y),C=N.useRef(Y),w=N.useRef(!1),D=N.useRef(u),O=N.useRef(!1),[k,A]=N.useState(!1),j=N.useRef(null),M=g(t,m),P=s(u),F=y(m),I=!u&&!c,L=k?`idle`:p,R=u&&(D.current||O.current),B=!u&&c&&v.current===`css-animation`&&x.height===void 0&&x.width===void 0?C.current:x,V=n&&I&&v.current!==`css-animation`,H=T((e,t=!0)=>{t&&(C.current=e),S(e)}),U=T(()=>{j.current?.(),j.current=null}),W=T(e=>{U(),j.current=()=>{j.current=null,e()}}),G=T(()=>{u&&c&&v.current===`css-animation`&&(O.current=!0)});a(()=>{k&&p!==`starting`&&A(!1)},[k,p]),N.useEffect(()=>()=>{G(),U()},[G,U]),a(()=>{let e=m.current;if(!e)return;!u&&j.current&&U();let t=ee(e,R);if(v.current=t,u&&p===`idle`&&D.current&&t===`css-animation`){C.current=Z(e);return}if(u&&p===`starting`){let n=w.current;if(w.current=!1,t===`none`){H(Z(e)),A(!0);return}if(t===`css-transition`){let t=te(e);if(H(Z(e)),!n)return t;let r=$(e,`transition-duration`,`0s`);return W(r),A(!0),t}H(Z(e));let r=$(e,`animation-name`,`none`);if(!n){r();return}let i=$(e,`animation-duration`,`0s`);r(),W(i),A(!0);return}if(!u&&c&&(p===`idle`||p===`starting`)){if(D.current=!1,O.current=!1,t===`none`){H(Y,!1),d(!1);return}H(Z(e));return}if(p!==`ending`)return;if(t===`none`){d(!1);return}let n=Z(e);if(!(n.height>0||n.width>0)){d(!1);return}H(n),t===`css-animation`&&$(e,`animation-name`,`none`)()},[c,u,U,H,d,W,R,p]),E({enabled:u&&c&&L===`idle`,open:!0,ref:m,onComplete(){u&&H(Y,!1)}}),N.useEffect(()=>{if(u||!c||L!==`ending`||!m.current)return;let e=new AbortController,t=-1;function n(){P.current||(d(!1),H(Y,!1))}return t=o.request(()=>{F(n,e.signal)}),()=>{o.cancel(t),e.abort()}},[P,c,u,L,F,H,d]),a(()=>{let e=m.current;e&&n&&I&&e.setAttribute(`hidden`,`until-found`)},[I,n]),N.useEffect(function(){let e=m.current;if(!e)return;function t(e){let t=_(b,e);l(!0,t),!t.isCanceled&&(w.current=!0,f(!0))}return h(e,`beforematch`,t)},[l,f]);let K=i||n||c||u;return{height:B.height,props:{...V?{[z]:``}:void 0,hidden:I,id:r},ref:M,shouldPreventOpenAnimation:R,shouldRender:K,transitionStatus:L,width:B.width}}function Z(e){return{height:e.scrollHeight,width:e.scrollWidth}}function ee(e,t){let n=x(e).getComputedStyle(e),r=(n.animationName.split(`,`).map(e=>e.trim()).some(e=>e!==``&&e!==`none`)||t)&&Q(n.animationDuration),i=Q(n.transitionDuration);return r&&i||i?`css-transition`:r?`css-animation`:`none`}function Q(e){return e.split(`,`).map(e=>e.trim()).some(e=>e!==``&&Number.parseFloat(e)>0)}function $(e,t,n){let r=e.style.getPropertyValue(t),i=e.style.getPropertyPriority(t);return e.style.setProperty(t,n),()=>{if(r===``){e.style.removeProperty(t);return}e.style.setProperty(t,r,i)}}function te(e){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)});function n(){Object.entries(t).forEach(([t,n])=>{if(n===``){e.style.removeProperty(t);return}e.style.setProperty(t,n)})}let r=o.request(n);return()=>{o.cancel(r),n()}}var ne=`--collapsible-panel-height`,re=`--collapsible-panel-width`,ie=N.forwardRef(function(e,t){let{className:n,hiddenUntilFound:i,keepMounted:o,render:s,id:c,style:l,...u}=e,{defaultPanelId:d,mounted:p,onOpenChange:m,open:h,setMounted:g,setPanelIdState:_,setOpen:v,state:y,transitionStatus:b}=I(),x=i??!1,S=o??!1,C=c||void 0,w=C??d;a(()=>(_(e=>C??(e===null?void 0:e)),()=>{_(e=>e===C?null:e)}),[C,_]);let{height:T,props:E,ref:D,shouldPreventOpenAnimation:O,shouldRender:k,transitionStatus:A,width:j}=X({externalRef:t,hiddenUntilFound:x,id:w,keepMounted:S,mounted:p,onOpenChange:m,open:h,setMounted:g,setOpen:v,transitionStatus:b}),M={...y,transitionStatus:A},N=r(l,M),P=f(`div`,{...e,style:void 0},{state:M,ref:D,props:[E,{style:{[ne]:T===void 0?`auto`:`${T}px`,[re]:j===void 0?`auto`:`${j}px`}},u,N?{style:N}:void 0,O?{style:{animationName:`none`}}:void 0],stateAttributesMapping:W});return k?P:null});function ae({...e}){return(0,G.jsx)(K,{"data-slot":`collapsible`,...e})}function oe({...e}){return(0,G.jsx)(J,{"data-slot":`collapsible-trigger`,...e})}function se({...e}){return(0,G.jsx)(ie,{"data-slot":`collapsible-content`,...e})}export{A as a,M as i,se as n,k as o,oe as r,O as s,ae as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{E as r,Qn as i,c as a,i as o,l as s,o as c,s as l,u}from"./shortcut-keys-DTE1sjTC.js";import{c as d,l as f,n as p,s as m}from"./detail-header-Dk5LipF6.js";var h=e(t(),1);function g(e){let t={};return e.typed.trim()!==e.phrase&&(t.typed=`Type ${e.phrase} to confirm`),e.reason.trim().length<3&&(t.reason=`Reason is required (min 3 characters)`),Object.keys(t).length>0?t:null}var _=n();function v({open:e,onOpenChange:t,phrase:n,title:v,description:y,children:b,pending:x=!1,error:S,confirmLabel:C,confirmVariant:w=`destructive`,slot:T=`confirm-sheet`,onConfirm:E}){let[D,O]=(0,h.useState)(``),[k,A]=(0,h.useState)(``),[j,M]=(0,h.useState)(!1);(0,h.useEffect)(()=>{e||(O(``),A(``),M(!1))},[e]);let N=j?g({typed:D,reason:k,phrase:n}):null,P=g({typed:D,reason:k,phrase:n})===null;return(0,_.jsx)(o,{open:e,onOpenChange:t,children:(0,_.jsxs)(c,{side:`right`,showOverlay:!1,className:`sm:max-w-md`,"data-slot":T,children:[(0,_.jsxs)(s,{children:[(0,_.jsx)(u,{children:v}),(0,_.jsx)(l,{children:y})]}),(0,_.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[b,(0,_.jsxs)(d,{label:`Type ${n} to confirm`,children:[(0,_.jsx)(r,{value:D,onChange:e=>O(e.target.value),onBlur:()=>M(!0),placeholder:n,"aria-label":`Type ${n} to confirm`,"aria-invalid":N?.typed?!0:void 0,flat:!0,className:i(p,`font-mono`),autoComplete:`off`}),N?.typed?(0,_.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.typed}):null]}),(0,_.jsxs)(d,{label:`Reason`,children:[(0,_.jsx)(r,{value:k,onChange:e=>A(e.target.value),onBlur:()=>M(!0),placeholder:`Why is this change needed?`,"aria-label":`Reason`,"aria-invalid":N?.reason?!0:void 0,flat:!0,className:p}),N?.reason?(0,_.jsx)(`span`,{className:`block px-4 pb-2 text-[10px] text-destructive`,role:`alert`,children:N.reason}):null]}),S?(0,_.jsx)(m,{children:S}):null]}),(0,_.jsxs)(a,{children:[(0,_.jsx)(f,{split:!0,onClick:()=>t(!1),disabled:x,children:`Cancel`}),(0,_.jsx)(f,{variant:w,disabled:!P||x,onClick:()=>{M(!0),P&&E({confirmation:D.trim(),reason:k.trim()})},"data-slot":`confirm-action`,children:x?`Working…`:C??`Confirm ${n.toLowerCase()}`})]})]})})}export{v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{$n as r,Qn as i,er as a}from"./shortcut-keys-DTE1sjTC.js";import{u as o}from"./explorer-chrome-Dslh2yE8.js";import{b as s,s as c}from"./element-icons-C6t8Vlml.js";var l=[[`path`,{d:`M12 4V20M20 12H4`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}]],u=e(t(),1),d=n();function f({value:e,label:t}){let[n,l]=(0,u.useState)(!1),f=(0,u.useRef)(null);return(0,u.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]),(0,d.jsx)(c,{label:n?`Copied`:t,children:(0,d.jsx)(`button`,{type:`button`,"aria-label":t,className:i(o,`size-4`),onClick:()=>{navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{l(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>l(!1),1200)})},children:(0,d.jsx)(r,{icon:n?a:s,className:n?`size-3 text-emerald-600 dark:text-emerald-400`:`size-3`,"aria-hidden":!0})})})}export{l as n,f as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{D as r,J as i,Mt as a,Y as o,_ as s,c,m as l,q as u,x as d}from"./explorer-chrome-Dslh2yE8.js";import{jt as f}from"./index-CmRFeWdT.js";var p=e(t(),1);function m(e,t){if(Object.keys(t).length!==e.length)return!1;for(let n of e){let e=t[n.id];if(n.kind===`boolean`){if(typeof e!=`boolean`)return!1;continue}if(typeof e!=`string`)return!1;if(n.kind===`choice`){if(!n.options?.includes(e))return!1;continue}if(!n.levels?.includes(e))return!1}return!0}async function h(e,t,n=5){let r={};for(let i=0;i<n;i++){if(r=await e(t),r.error?.code!==`JournalLeaseBusy`)return r;let n=v(_(r.error?.data));n>0&&await new Promise(e=>setTimeout(e,n))}return r}function g(e){return e===`candidate`?`candidate ready`:e}function _(e){if(!e||typeof e!=`object`||!(`retryAfter`in e))return;let t=e.retryAfter;return typeof t==`number`||typeof t==`string`?t:void 0}function v(e){if(typeof e==`number`&&Number.isFinite(e))return Math.max(0,e)*1e3;if(typeof e!=`string`||e.length===0)return 0;let t=Number(e);if(Number.isFinite(t))return Math.max(0,t)*1e3;let n=Date.parse(e);return Number.isNaN(n)?0:Math.max(0,n-Date.now())}var y=n();function b(e){let t=Math.max(0,Math.round(e/1e3));return t<60?`${t}s`:`${Math.floor(t/60)}m`}function x(){let[e,t]=(0,p.useState)([]),[n,_]=(0,p.useState)([]),[v,x]=(0,p.useState)([]),[S,C]=(0,p.useState)(null),w=a({strict:!1}).decision,[T,E]=(0,p.useState)({}),D=(0,p.useCallback)(async()=>{let e=await u();e.data&&(t(e.data.decisions),_(e.data.failures??[]));let n=await i();n.data&&x(n.data.rows)},[]);(0,p.useEffect)(()=>{D()},[D]);async function O(e){let t=T[e.id]??{},n={};for(let r of e.questions){let e=t[r.id];if(r.kind===`boolean`){if(e!==`true`&&e!==`false`)continue;n[r.id]=e===`true`}else e!==void 0&&(n[r.id]=e)}if(!m(e.questions,n)){C(`ValidationError`);return}let r=await h(o,{id:e.id,values:n,...e.labelOnly?{labelOnly:!0}:{}});r.error?.code===`Conflict`?C(`Conflict`):r.error?.code===`JournalLeaseBusy`?C(`JournalLeaseBusy`):r.error?C(r.error.code):C(null),await D()}return(0,y.jsxs)(`div`,{className:l,"data-slot":`decisions-page`,children:[(0,y.jsxs)(`div`,{className:d,children:[(0,y.jsx)(f,{to:`/flows`,className:`${r} px-2.5`,children:`Flows`}),(0,y.jsx)(`span`,{className:`${r} px-2.5`,children:`Decisions`})]}),n.length>0?(0,y.jsx)(`ul`,{children:n.map(e=>(0,y.jsxs)(`li`,{className:s,"data-slot":`decision-label-error`,children:[(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.decision,` · `,e.question]}),(0,y.jsx)(`span`,{className:c,children:e.message})]},`${e.at}:${e.decision}:${e.question}`))}):null,(0,y.jsx)(`ul`,{children:e.map(e=>(0,y.jsxs)(`li`,{className:s,"data-state":g(e.state),"data-decision":e.name,"data-selected":w===e.name?`true`:`false`,children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,y.jsx)(`span`,{className:c,children:g(e.state)}),e.metrics?(0,y.jsx)(`span`,{className:c,"data-slot":`decision-metrics`,children:Object.entries(e.metrics).map(([e,t])=>`${e} ${t}`).join(` · `)}):null,e.promote?(0,y.jsx)(`code`,{className:`text-xs`,"data-slot":`decision-promote`,children:e.promote}):null]},e.name))}),(0,y.jsx)(`div`,{className:d,children:(0,y.jsx)(`span`,{className:`${r} px-2.5`,children:`Review queue`})}),S?(0,y.jsx)(`p`,{className:`px-2.5 py-1 text-xs`,"data-slot":`decision-notice`,children:S}):null,(0,y.jsx)(`ul`,{children:v.map(e=>(0,y.jsxs)(`li`,{className:s,"data-label-only":e.labelOnly?`true`:`false`,children:[(0,y.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[e.decision,e.labelOnly?` · label`:``]}),(0,y.jsx)(`span`,{className:c,"data-slot":`decision-age`,children:b(e.ageMs)}),(0,y.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:t=>{t.preventDefault(),O(e)},children:[e.questions.map(t=>t.kind===`boolean`?(0,y.jsxs)(`select`,{"aria-label":t.id,value:T[e.id]?.[t.id]??``,onChange:n=>{let r=n.target.value;E(n=>({...n,[e.id]:{...n[e.id],[t.id]:r}}))},children:[(0,y.jsx)(`option`,{value:``,children:`Select`}),(0,y.jsx)(`option`,{value:`true`,children:`true`}),(0,y.jsx)(`option`,{value:`false`,children:`false`})]},t.id):(0,y.jsxs)(`select`,{"aria-label":t.id,value:T[e.id]?.[t.id]??``,onChange:n=>{let r=n.target.value;E(n=>({...n,[e.id]:{...n[e.id],[t.id]:r}}))},children:[(0,y.jsx)(`option`,{value:``,children:`Select`}),(t.kind===`choice`?t.options:t.levels)?.map(e=>(0,y.jsx)(`option`,{value:e,children:e},e))]},t.id)),(0,y.jsx)(`button`,{type:`submit`,className:`text-xs`,disabled:e.status!==`pending`,children:`Approve`})]})]},`${e.labelOnly?`label`:`park`}:${e.id}`))})]})}export{x as DecisionsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{r as t}from"./react-dom-Ddte4I-Q.js";import{A as n}from"./xyflow-yApv7D4e.js";import{$n as r,Qn as i,x as a}from"./shortcut-keys-DTE1sjTC.js";import{O as o,f as s,n as c,t as l}from"./explorer-chrome-Dslh2yE8.js";var u=e(t(),1),d=n(),f=`h-8 rounded-none border-0 bg-transparent px-4 text-[12px] shadow-none focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent`,p=`h-8 rounded-none border-0 bg-transparent pr-4 pl-9 text-[12px] shadow-none focus-visible:border-0 focus-visible:ring-0 dark:bg-transparent`,m=`h-11 flex-1 rounded-none border-0 shadow-none focus-visible:ring-0`;function h({label:e,hint:t,className:n,split:r,dense:a=!1,children:o}){return(0,d.jsxs)(`label`,{className:i(`block min-w-0 border-b border-border/50`,r===`start`&&`border-r border-b-0`,r===`end`&&`border-b-0`,n),children:[a?(0,d.jsxs)(`span`,{className:`flex items-baseline justify-between gap-2 px-2 pt-1`,children:[(0,d.jsx)(`span`,{className:`min-w-0 truncate text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:e}),t?(0,d.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[9px] text-muted-foreground/70`,children:t}):null]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`span`,{className:`block truncate px-3 pt-1.5 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:e}),t?(0,d.jsx)(`span`,{className:`block truncate px-3 font-mono text-[10px] text-muted-foreground/70`,children:t}):null]}),o]})}function g({label:e,className:t,children:n}){return(0,d.jsxs)(`label`,{className:i(`flex items-center justify-between gap-3 border-b border-border/50 px-4 py-3`,t),children:[(0,d.jsx)(`span`,{className:`text-[12px] text-foreground`,children:e}),n]})}function _({active:e,extraCount:t=0,className:n,children:r,type:a=`button`,...o}){return(0,d.jsxs)(`button`,{type:a,className:i(`inline-flex items-center gap-1 rounded-none border-0 bg-transparent px-2 py-1 text-[10px] font-semibold tracking-[0.08em] uppercase shadow-none transition-colors hover:bg-muted/50`,e?`text-foreground`:`text-muted-foreground hover:text-foreground`,n),...o,children:[r,t>0?(0,d.jsx)(`span`,{className:`flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-foreground/10 px-1 text-[9px] font-semibold tabular-nums`,children:t}):null]})}function v({label:e,hint:t,className:n,children:r}){return(0,d.jsxs)(`div`,{className:i(`border-b border-border/50`,n),children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3 px-4`,children:[(0,d.jsx)(`p`,{className:`shrink-0 text-[10px] font-semibold tracking-[0.12em] text-muted-foreground uppercase`,children:e}),(0,d.jsx)(`div`,{className:`flex min-w-0 flex-1 items-stretch`,role:`group`,"aria-label":e,children:r})]}),t?(0,d.jsx)(`p`,{className:`px-4 pb-2 text-[10px] text-muted-foreground`,children:t}):null]})}function y({active:e,onClick:t,icon:n,children:a}){return(0,d.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:i(`inline-flex h-8 min-w-0 flex-1 items-center justify-center gap-1.5 px-2 font-mono text-[10px] font-semibold outline-none select-none`,`focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset`,e?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:[n?(0,d.jsx)(r,{icon:n,className:`size-3 shrink-0`,"aria-hidden":!0}):null,a]})}function b({split:e=!1,className:t,variant:n=`ghost`,...r}){return(0,d.jsx)(a,{variant:n,className:i(m,e&&`border-r border-border/50`,t),...r})}function x({children:e,slot:t}){return(0,d.jsx)(`p`,{className:`border-b border-border/50 px-4 py-3 text-[11px] text-destructive`,role:`alert`,"data-slot":t,children:e})}function S({label:e,hint:t,children:n}){return(0,d.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-border/50 bg-muted/25 px-4 py-1.5`,children:[(0,d.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,d.jsx)(`p`,{className:`text-[10px] font-semibold tracking-[0.12em] text-foreground uppercase`,children:e}),t?(0,d.jsx)(`p`,{className:`truncate text-[10px] text-muted-foreground`,children:t}):null]}),n]})}function C({children:e}){return(0,d.jsx)(`div`,{className:`grid grid-cols-2 border-b border-border/50`,children:e})}var w=`17rem`;function T(e){return`repeat(auto-fit, minmax(min(100%, max(${w}, ${`${100/e}%`})), 1fr))`}function E({columns:e=4,children:t}){let n=u.Children.count(t),r=Math.min(e,n);return(0,d.jsx)(`div`,{className:`w-full min-w-0 max-w-full overflow-hidden`,children:(0,d.jsx)(`div`,{className:i(`grid w-full min-w-0 grid-cols-1`,r>=2&&`-mr-px w-[calc(100%+1px)]`,`[&>*]:min-w-0`,r>=2&&`[&>*]:border-r [&>*]:border-border/50`),style:r>=2?{gridTemplateColumns:T(r)}:void 0,children:t})})}function D({icon:e,wellClassName:t,wellStyle:n,title:r,badge:a,subtitle:u,leading:f,trailing:p,actions:m,sticky:h=!1,className:g,dataSlot:_=`detail-header`}){return(0,d.jsxs)(`header`,{className:i(l,h&&`sticky top-0 z-10`,g),"data-slot":_,children:[f?(0,d.jsxs)(`div`,{className:`-ml-2 flex h-full shrink-0 items-stretch`,children:[f,(0,d.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0})]}):null,(0,d.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,d.jsx)(`span`,{className:i(s,`flex shrink-0 items-center justify-center`,o(t??`text-muted-foreground`)),style:n?.color?{color:n.color}:void 0,"aria-hidden":!0,children:e}),(0,d.jsx)(`h2`,{className:i(c,`leading-none`),children:r}),a?(0,d.jsx)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-2 leading-none`,children:a}):null,u?(0,d.jsx)(`div`,{className:`flex min-w-0 items-center gap-1.5 leading-none`,children:u}):null]}),m?(0,d.jsx)(`div`,{className:`flex h-full shrink-0 items-stretch`,children:m}):null,p?(0,d.jsxs)(`div`,{className:`-mr-2 flex h-full shrink-0 items-stretch`,children:[(0,d.jsx)(`span`,{className:`w-px shrink-0 self-stretch bg-border/60`,"aria-hidden":!0}),p]}):null]})}export{y as a,h as c,C as d,g as f,S as i,b as l,f as n,v as o,_ as p,p as r,x as s,D as t,E as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,r as n}from"./react-dom-Ddte4I-Q.js";import{A as r}from"./xyflow-yApv7D4e.js";import{$ as i,$n as a,An as o,At as s,B as c,Bn as l,C as u,Cn as d,Ct as f,D as p,Dn as m,En as h,Et as g,Fn as _,Ft as v,G as y,Gn as b,H as x,Hn as S,In as C,It as w,J as T,Jn as E,Jt as D,K as ee,Kn as O,Kt as k,Ln as A,Lt as j,Mt as M,Nn as N,Nt as P,On as te,Ot as ne,Pn as F,Pt as re,Q as I,Qn as L,Qt as ie,Rn as R,Rt as ae,S as z,St as B,Tn as V,Tt as H,U,Un as W,V as G,Vn as oe,Vt as K,W as q,Wn as J,Wt as se,X as ce,Xn as Y,Y as le,Yn as ue,Yt as de,Z as fe,Zn as pe,Zt as X,_t as me,at as he,bn as ge,bt as _e,ct as ve,dn as ye,en as be,er as xe,et as Se,fn as Ce,ft as we,g as Te,gn as Ee,gt as De,hn as Oe,ht as ke,it as Ae,jn as je,jt as Me,k as Ne,kn as Pe,kt as Fe,ln as Ie,lt as Le,m as Re,mt as ze,nn as Be,nt as Ve,on as He,ot as Ue,pn as We,q as Ge,qn as Ke,qt as Z,rn as qe,rt as Je,st as Ye,tn as Xe,tt as Ze,ut as Qe,v as $e,vt as et,w as tt,wn as nt,wt as rt,xt as it,yt as at,z as ot,zn as st,zt as ct}from"./shortcut-keys-DTE1sjTC.js";var Q=e(n(),1);function lt(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Ie}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=Q.useRef(void 0),f=k(),p=W(),m=Q.useMemo(()=>{function e(e,t,n,r){let i=X(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=_(e.pointerType,!0)&&A(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||_(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=Pe(o);if(We(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}_(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return Q.useMemo(()=>n?{reference:m}:Ke,[n,m])}var ut=`Escape`;function dt(e){return l&&e.movementX===0&&e.movementY===0}function ft(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function pt(e,t){return ft(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function mt(e,t,n){return ft(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function ht(e,t,n){return ft(t,n?e===nt:e===V,e===d)}function gt(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===ut:ft(t,n?e===V:e===nt,e===h)}function _t(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:h=!0,disabledIndices:g=void 0,orientation:_=`vertical`,parentOrientation:y,id:x,resetOnPointerLeave:S=!0,externalTree:T,grid:E}=t,ee=E!=null,O=`rootStore`in e?e.rootStore:e,j=O.useState(`open`),M=O.useState(`floatingElement`),P=O.useState(`domReferenceElement`),ne=O.context.dataRef,F=ye(M),I=Ce(P),L=D(F),ie=at(),z=_e(T),B=Q.useRef(f),V=Q.useRef(o??-1),H=Q.useRef(null),U=Q.useRef(!0),W=Z(e=>{i(V.current===-1?null:V.current,e)}),G=Q.useRef(!!M),oe=Q.useRef(j),K=Q.useRef(!1),q=Q.useRef(!1),J=Q.useRef(null),ce=D(g),Y=D(j),le=D(o),ue=D(S),de=k(),fe=k(),pe=Z(()=>{function e(e){d?z?.events.emit(`virtualfocus`,e):J.current=Fe(e,{sync:K.current,preventScroll:!0})}let t=n.current[V.current],r=q.current;t&&e(t),(K.current?e=>e():e=>de.request(e))(()=>{let i=n.current[V.current]||t;i&&(t||e(i),Se&&(r||!U.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});b(()=>{ne.current.orientation=_},[ne,_]),b(()=>{a&&(j&&M?(V.current=o??-1,B.current&&o!=null&&(q.current=!0,W())):G.current&&(V.current=-1,W()))},[a,j,M,o,W]),b(()=>{if(a){if(!j){K.current=!1;return}if(M){if(r==null){if(K.current=!1,le.current!=null)return;if(G.current&&(V.current=-1,pe()),(!oe.current||!G.current)&&B.current&&(H.current!=null||B.current===!0&&H.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>fe.request(e):queueMicrotask)(t),e+=1):(V.current=H.current==null||mt(H.current,_,u)||l?w(n):v(n),H.current=null,W())};t()}}else ae(n.current,r)||(V.current=r,pe(),q.current=!1)}}},[a,j,M,r,le,l,n,_,u,W,pe,fe]),b(()=>{if(!a||M||!z||d||!G.current)return;let e=z.nodesRef.current,t=e.find(e=>e.id===ie)?.context?.elements.floating,n=m(se(P??t??null)),r=e.some(e=>e.context&&te(e.context.elements.floating,n));t&&!r&&U.current&&t.focus({preventScroll:!0})},[a,M,P,z,ie,d]),b(()=>{oe.current=j,G.current=!!M}),b(()=>{j||(H.current=null,B.current=f)},[j,f]);let me=r!=null,he=Z(e=>{if(!Y.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(V.current!==t||r!==t)&&(V.current=t,W(e))}),ge=Z(()=>y??z?.nodesRef.current.find(e=>e.id===ie)?.context?.dataRef?.current.orientation),ve=Z(()=>w(n,ce.current)),xe=Z(e=>{if(U.current=!1,K.current=!0,e.which===229||!Y.current&&e.currentTarget===L.current)return;if(l&>(e.key,_,u,ee)){pt(e.key,ge())||R(e),O.setOpen(!1,X(qe,e.nativeEvent)),N(P)&&(d?z?.events.emit(`virtualfocus`,P):P.focus());return}let t=V.current,r=w(n,g),i=v(n,g);if(I||(e.key===`Home`&&(R(e),V.current=r,W(e)),e.key===`End`&&(R(e),V.current=i,W(e))),E!=null){let t=E(e,V.current,n,_,c,u,g,r,i);if(t!=null&&(V.current=t,W(e)),_===`both`)return}if(pt(e.key,_)){if(R(e),j&&!d&&m(e.currentTarget.ownerDocument)===e.currentTarget){V.current=mt(e.key,_,u)?r:i,W(e);return}mt(e.key,_,u)?c?t>=i?s&&t!==n.current.length?V.current=-1:(K.current=!1,V.current=r):V.current=re(n.current,{startingIndex:t,disabledIndices:g}):V.current=Math.min(i,re(n.current,{startingIndex:t,disabledIndices:g})):c?t<=r?s&&t!==-1?V.current=n.current.length:(K.current=!1,V.current=i):V.current=re(n.current,{startingIndex:t,decrement:!0,disabledIndices:g}):V.current=Math.max(r,re(n.current,{startingIndex:t,decrement:!0,disabledIndices:g})),ae(n.current,V.current)&&(V.current=-1),W(e)}}),Se=Q.useMemo(()=>({onFocus(e){K.current=!0,he(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){dt(e)||(K.current=!0,q.current=!1,p&&he(e))},onPointerLeave(e){if(!Y.current||!U.current||e.pointerType===`touch`)return;K.current=!0;let t=e.relatedTarget;if(p&&!n.current.includes(t)&&ue.current&&(J.current?.(),J.current=null,V.current=-1,W(e),!d)){let e=L.current,t=m(se(e));e&&te(e,t)&&e.focus({preventScroll:!0})}}}),[he,Y,L,p,n,W,ue,d]),we=Q.useMemo(()=>d&&j&&me&&{"aria-activedescendant":`${x}-${r}`},[d,j,me,x,r]),Te=Q.useMemo(()=>({...I?{}:we,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&j&&!d){let t=Pe(e.nativeEvent);if(t&&!te(L.current,t))return;R(e),O.setOpen(!1,X(be,e.nativeEvent)),N(P)&&P.focus();return}xe(e)},onPointerMove(e){dt(e)||(U.current=!0)}}),[we,xe,L,I,O,j,d,P]),Ee=Q.useMemo(()=>{function e(e){O.setOpen(!0,X(qe,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&C(e.nativeEvent)&&(B.current=!d)}function n(e){B.current=f,f===`auto`&&A(e.nativeEvent)&&(B.current=!0)}return{onKeyDown(t){let n=O.select(`open`);U.current=!1;let r=t.key.startsWith(`Arrow`),i=ht(t.key,ge(),u),a=pt(t.key,_),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return xe(t);if(n||h||!r){if(o){let e=pt(t.key,ge());H.current=l&&e?null:t.key}if(l){i&&(R(t),n?(V.current=ve(),W(t)):e(t));return}a&&(le.current!=null&&(V.current=le.current),R(t),!n&&h?e(t):xe(t),n&&W(t))}},onFocus(e){O.select(`open`)&&!d&&(V.current=-1,W(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[xe,f,ve,l,W,O,h,_,ge,u,le,d]),De=Q.useMemo(()=>({...we,...Ee}),[we,Ee]);return Q.useMemo(()=>a?{reference:De,floating:Te,item:Se,trigger:Ee}:{},[a,De,Te,Ee,Se])}function vt(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,disabledIndices:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,d=`rootStore`in e?e.rootStore:e,f=d.useState(`open`),p=W(),m=Q.useRef(``),h=Q.useRef(u??i??-1),g=Q.useRef(null),_=Z(e=>{function t(e){return r?.current[e]}function c(e){let n=t(e);return n&&!j(n)||n?.matches(`:disabled`)?!1:o==null||!ct(O,e,o)}function d(e,t,n=0){if(e.length===0)return-1;let r=(n%e.length+e.length)%e.length,i=t.toLowerCase();for(let t=0;t<e.length;t+=1){let n=(r+t)%e.length;if(e[n]?.toLowerCase().startsWith(i)&&c(n))return n}return-1}let _=n.current;if(m.current.length>0&&e.key===` `&&(R(e),s?.(!0)),m.current.length>0&&m.current[0]!==` `&&d(_,m.current)===-1&&e.key!==` `&&s?.(!1),_==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;f&&e.key!==` `&&(R(e),s?.(!0));let v=m.current===``;v&&(h.current=u??i??-1),_.every((e,t)=>e&&c(t)?e[0]?.toLowerCase()!==e[1]?.toLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(l,()=>{m.current=``,h.current=g.current,s?.(!1)});let y=((v?u??i??-1:h.current)??0)+1,b=d(_,m.current,y);b===-1?e.key!==` `&&(m.current=``,s?.(!1)):(a?.(b),g.current=b)}),v=Z(e=>{let t=e.relatedTarget,n=d.select(`domReferenceElement`),r=d.select(`floatingElement`);te(n,t)||te(r,t)||(p.clear(),m.current=``,h.current=g.current,s?.(!1))});b(()=>{(f||u===null)&&(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[f,u,p]);let y=Q.useMemo(()=>({onKeyDown:_,onBlur:v}),[_,v]);return Q.useMemo(()=>c?{reference:y,floating:y}:{},[c,y])}var yt=Q.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return H(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),$=r();function bt(e){let t=Q.useRef(``),n=Q.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:Q.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function xt(e,t){let{onClick:n,onPointerDown:r}=bt(Z((n,r)=>{(typeof e==`function`?e():e)||t(r||(oe?`touch`:``))}));return Q.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function St(e){let[t,n]=Q.useState(null),r=xt(e,n);return p(e,t=>{t&&!e&&n(null)}),Q.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}var Ct=Q.createContext(void 0);function wt(e){let t=Q.useContext(Ct);if(t===void 0&&!e)throw Error(J(33));return t}var Tt=Q.createContext(void 0);function Et(e){let t=Q.useContext(Tt);if(t===void 0&&!e)throw Error(J(36));return t}var Dt=Q.createContext(void 0);function Ot(e=!0){let t=Q.useContext(Dt);if(t===void 0&&!e)throw Error(J(25));return t}var kt=Q.createContext(void 0);function At(){let e=Q.useContext(kt);if(e===void 0)throw Error(J(30));return e}function jt(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),d=a.useState(`open`),f=Ot(!0),p=f!==void 0;return Q.useMemo(()=>({id:r,role:`menuitem`,tabIndex:d&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:Be})},onMouseUp(e){if(f){let t=f.initialCursorPointRef.current;if(f.initialCursorPointRef.current=null,p&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||p&&!S&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!p||e.button===2)&&c.type===`regular-item`&&u(s.current,e,{detail:1})}}),[t,n,r,l,i,d,a,o,s,f,p,c])}var Mt={type:`regular-item`};function Nt(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Q.useRef(null),{getButtonProps:d,buttonRef:f}=z({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=jt({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Q.useCallback(e=>g(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=de(u,f);return Q.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var Pt=Q.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Ft(){return Q.useContext(Pt)}function It(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Ft(),u=Q.useRef(-1),[d,f]=Q.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Q.useRef(null),h=Q.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return b(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var Lt=`data-checked`,Rt=`data-unchecked`,zt={checked(e){return e?{[Lt]:``}:{[Rt]:``}},...ge},Bt=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,checked:l,defaultChecked:u,onCheckedChange:d,style:f,...p}=e,m=It({guess:!0,label:a}),h=wt(!0),g=q(i),{store:_}=Et(),v=_.useState(`disabled`),y=s||v,b=_.useState(`isActive`,m.index),x=_.useState(`itemProps`),[S,C]=Ne({controlled:l,default:u??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:w,itemRef:T}=Nt({closeOnClick:c,disabled:y,highlighted:b,id:g,store:_,nativeButton:o,nodeId:h?.context.nodeId,itemMetadata:Mt}),D=Q.useMemo(()=>({disabled:y,highlighted:b,checked:S}),[y,b,S]);function ee(e){let t=X(Be,e.nativeEvent,void 0,{preventUnmountOnClose:E});d?.(!S,t),!t.isCanceled&&C(e=>!e)}let O=H(`div`,e,{state:D,stateAttributesMapping:zt,props:[x,{role:`menuitemcheckbox`,"aria-checked":S,onClick:ee},p,w],ref:[T,t,m.ref]});return(0,$.jsx)(kt.Provider,{value:D,children:O})}),Vt=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=At(),c=Q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Le(s.checked);Ye({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return H(`span`,e,{state:f,ref:[t,c],stateAttributesMapping:zt,props:{"aria-hidden":!0,...o},enabled:a||u})}),Ht=Q.createContext(void 0);function Ut(){let e=Q.useContext(Ht);if(e===void 0)throw Error(J(31));return e}var Wt=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Q.useState(void 0),c=H(`div`,e,{ref:t,props:{role:`group`,"aria-labelledby":o,...a}});return(0,$.jsx)(Ht.Provider,{value:s,children:c})}),Gt=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,s=q(a),c=Ut();return b(()=>(c(s),()=>{c(e=>e===s?void 0:e)}),[c,s]),H(`div`,e,{ref:t,props:{id:s,"aria-hidden":!0,...o}})}),Kt=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=It({guess:!0,label:a}),f=wt(!0),p=q(i),{store:m}=Et(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=Nt({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:Mt});return H(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),qt=Q.createContext(void 0);function Jt(e){let t=Q.useContext(qt);if(t===void 0&&!e)throw Error(J(69));return t}var Yt=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=Et(),{side:c,align:l}=wt(),u=Jt(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;Ye({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Q.useEffect(()=>{function e(e){s.setOpen(!1,X(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),Ge(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),ee={transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},O=H(`div`,e,{state:ee,ref:[t,s.context.popupRef,D],stateAttributesMapping:Oe,props:[p,{onKeyDown(e){u&&$e.has(e.key)&&e.stopPropagation()}},G(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,$.jsx)(ke,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),Xt=Q.createContext(void 0);function Zt(){let e=Q.useContext(Xt);if(e===void 0)throw Error(J(32));return e}var Qt=Q.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i,parent:a}=Et();if(!(i.useState(`mounted`)||n))return null;let o=a.type===`menu`||a.type===`menubar`?`group`:void 0;return(0,$.jsx)(Xt.Provider,{value:n,children:(0,$.jsx)(B,{ref:t,...r,portalOwnerRole:o})})});function $t(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),[,o]=Q.useState(!1),s=pe(tn).current,c=pe(en).current,l=Q.useRef(0),u=Q.useRef(!0),d=Q.useRef(null),f=Q.useRef(null),p=Z(()=>{u.current||(u.current=!0,o(e=>!e))}),m=Z((e,t)=>{c.set(e,t),p()}),h=Z(e=>{c.delete(e),p()}),g=Z(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!an(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&on(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=rn(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=Z(()=>{let[e,t]=nn(c),n=g(e),r=d.current,i=!r||r.length!==e.length||e.some((e,t)=>{let n=r[t];return e.index!==n.index||e.element!==n.element||e.registration.index!==n.registration.index||e.registration.metadata!==n.registration.metadata});_(t),d.current=e,u.current=!1,i&&(s.forEach(e=>e(n)),a(n))});b(()=>(!u.current&&d.current&&g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),b(()=>{u.current&&v()}),b(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=Z(e=>(s.add(e),()=>{s.delete(e)})),x=Q.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,$.jsx)(Pt.Provider,{value:x,children:t})}function en(){return new Map}function tn(){return new Set}function nn(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>on(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function rn(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function an(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function on(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var sn=20;function cn(e,t,n,r){let[i,a]=Q.useState(!1);b(()=>{if(!e||!t||n==null){a(!1);return}let r=se(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-sn)},[e,t,n]),Re(e&&(!t||i),r)}var ln=Q.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:l=0,alignOffset:u=0,collisionBoundary:d=`clipping-ancestors`,collisionPadding:p=5,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g=!1,collisionAvoidance:_=f,style:v,...y}=e,{store:S}=Et(),C=Zt(),w=Ot(!0),T=S.useState(`parent`),E=S.useState(`floatingRootContext`),D=S.useState(`floatingTreeRoot`),ee=S.useState(`mounted`),O=S.useState(`open`),k=S.useState(`modal`),A=S.useState(`openMethod`),j=S.useState(`activeTriggerElement`),M=S.useState(`transitionStatus`),N=S.useState(`positionerElement`),P=S.useState(`instantType`),te=S.useState(`adaptiveOrigin`),ne=S.useState(`lastOpenChangeReason`),F=S.useState(`floatingNodeId`),re=S.useState(`floatingParentNodeId`),I=E.useState(`domReferenceElement`),L=Q.useRef(null),ie=ve(N),R=n,ae=l,z=u,B=s,V=_;T.type===`context-menu`&&(R=n??T.context?.anchor,B??=`start`,!o&&B!==`center`&&(z=e.alignOffset??2,ae=e.sideOffset??-5));let H=o,U=B;T.type===`menu`?(H??=`inline-end`,U??=`start`,V=e.collisionAvoidance??rt):T.type===`menubar`&&(H??=T.context.orientation===`vertical`?`inline-end`:`bottom`,U??=`start`);let G=T.type===`context-menu`,oe=x({anchor:R,floatingRootContext:E,positionMethod:w?`fixed`:r,mounted:ee,side:H,sideOffset:ae,align:U,alignOffset:z,arrowPadding:G?0:m,collisionBoundary:d,collisionPadding:p,sticky:h,nodeId:F,keepMounted:C,disableAnchorTracking:g,collisionAvoidance:V,shift:G?{crossAxis:!(`side`in V&&V.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:D,adaptiveOrigin:te});Q.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===F&&S.set(`hoverEnabled`,!1),e.nodeId!==F&&e.parentNodeId===S.select(`floatingParentNodeId`)&&S.setOpen(!1,X(He)))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[S,D.events,F]),Q.useEffect(()=>{if(S.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==S.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;S.setOpen(!1,X(t))}return D.events.on(`menuopenchange`,e),()=>{D.events.off(`menuopenchange`,e)}},[D.events,S]);let K=W();Q.useEffect(()=>{O||K.clear()},[O,K]),Q.useEffect(()=>{function e(e){if(O&&e.nodeId===S.select(`floatingParentNodeId`)){if(e.target&&j&&j!==e.target){let e=S.select(`closeDelay`);e>0?K.isStarted()||K.start(e,()=>{S.setOpen(!1,X(He))}):S.setOpen(!1,X(He))}else K.clear()}}return D.events.on(`itemhover`,e),()=>{D.events.off(`itemhover`,e)}},[D.events,O,j,S,K]),Q.useEffect(()=>{let e={open:O,nodeId:F,parentNodeId:re,reason:S.select(`lastOpenChangeReason`)};D.events.emit(`menuopenchange`,e)},[D.events,O,S,F,re]),b(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){S.set(`instantType`,void 0);let e=new AbortController;return ie(()=>{S.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,ie,S]);let q={open:O,side:oe.side,align:oe.align,anchorHidden:oe.anchorHidden,nested:T.type===`menu`,instant:P},J=T.type===`menubar`&&T.context.modal;cn(O&&(J||k&&ne!==`trigger-hover`),A===`touch`,N,j);let se=c(e,q,{styles:oe.positionerStyles,transitionStatus:M,props:y,refs:[t,S.useStateSetter(`positionerElement`)],hidden:!ee,inert:!O}),ce=ee&&T.type!==`menu`&&(T.type!==`menubar`&&k&&ne!==`trigger-hover`||T.type===`menubar`&&T.context.modal),Y=null;return T.type===`menubar`?Y=T.context.contentElement:T.type===void 0&&(Y=j),(0,$.jsxs)(Ct.Provider,{value:oe,children:[ce&&(0,$.jsx)(Te,{ref:T.type===`context-menu`||T.type===`nested-context-menu`?T.context.internalBackdropRef:null,inert:ot(!O),cutout:Y}),(0,$.jsx)(De,{id:F,children:(0,$.jsx)($t,{elementsRef:S.context.itemDomElements,labelsRef:S.context.itemLabels,children:se})})]})}),un=Q.createContext(void 0);function dn(){let e=Q.useContext(un);if(e===void 0)throw Error(J(34));return e}var fn=Q.memo(Q.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Q.useState(void 0),[p,m]=Ne({controlled:i,default:a,name:`MenuRadioGroup`}),h=Z((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=H(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Q.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,$.jsx)(Ht.Provider,{value:f,children:(0,$.jsx)(un.Provider,{value:_,children:g})})})),pn=Q.createContext(void 0);function mn(){let e=Q.useContext(pn);if(e===void 0)throw Error(J(35));return e}var hn=Q.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=It({guess:!0,label:a}),p=wt(!0),m=q(i),{store:h}=Et(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=dn(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=Nt({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:Mt}),D=Q.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function ee(e){let t=X(Be,e.nativeEvent,void 0,{preventUnmountOnClose:E});y(l,t)}let O=H(`div`,e,{state:D,stateAttributesMapping:zt,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:ee},d,w],ref:[T,t,f.ref]});return(0,$.jsx)(pn.Provider,{value:D,children:O})}),gn=Q.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=mn(),c=Q.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=Le(s.checked);Ye({batch:!0,enabled:!s.checked,open:s.checked,ref:c,onComplete(){s.checked||d(!1)}});let f={checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l};return H(`span`,e,{state:f,stateAttributesMapping:zt,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),_n=Q.createContext(null);function vn(e){let t=Q.useContext(_n);if(t===null&&!e)throw Error(J(5));return t}var yn={...fe,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},bn=class extends we{constructor(e,t,n=!1){let r=new I,i=Sn(r,t,n,e);super(i,xn(r),yn),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function xn(e){return{positionerRef:Q.createRef(),popupRef:Q.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Q.createRef(),beforeContentFocusGuardRef:Q.createRef(),onOpenChangeComplete:void 0,triggerElements:e}}function Sn(e,t,n=!1,r){return{...ce(e,t,n),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new it,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Ke,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0,...r}}var Cn=Q.createContext(void 0);function wn(){return Q.useContext(Cn)}var Tn=ue(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:a,defaultOpen:o=!1,disabled:s=!1,modal:c,loopFocus:l=!0,orientation:u=`vertical`,actionsRef:d,closeParentOnEsc:f=!1,handle:p,triggerId:m,defaultTriggerId:h=null,highlightItemOnHover:_=!0}=e,v=Ot(!0),y=Et(!0),x=vn(!0),S=wn(),C=Q.useMemo(()=>S&&y?{type:`menu`,store:y.store}:x?{type:`menubar`,context:x}:v&&!y?{type:`context-menu`,context:v}:{type:void 0},[v,y,x,S]),w=ne(),T=ne(),E=at(),D=C.type===`menu`?C.store:void 0,ee=(n??o)&&D?.state.transitionStatus===`starting`,k=pe(()=>ee?D?.state.instantType:void 0).current,A=En({open:o,openProp:n,activeTriggerId:h,triggerIdProp:m,parent:C,disabled:s,highlightItemOnHover:_,modal:C.type===void 0?c:void 0,rootId:w,instantType:k},T,E!=null);A.useControlledProp(`openProp`,n),A.useControlledProp(`triggerIdProp`,m),A.useContextCallback(`onOpenChangeComplete`,a);let j=A.useState(`floatingTreeRoot`),M=et(j),N=A.useState(`open`),P=A.useState(`activeTriggerElement`),te=A.useState(`positionerElement`),F=A.useState(`hoverEnabled`),re=A.useState(`disabled`),I=A.useState(`lastOpenChangeReason`),L=A.useState(`parent`),ie=A.useState(`activeIndex`),R=A.useState(`payload`),ae=A.useState(`floatingParentNodeId`),z=Q.useRef(null),B=Q.useRef(L.type!==`context-menu`),V=W(),H=Q.useRef(!0),G=W(),oe=ae!=null,{openMethod:K,triggerProps:q}=St(N);A.useSyncedValues({disabled:s,highlightItemOnHover:_,modal:L.type===void 0?c:void 0,openMethod:K,rootId:w}),Je(A);let{forceUnmount:J,transitionStatus:se}=Ae(N,A,()=>{A.set(`allowMouseEnter`,!1)},ee),ce=ve(A.context.popupRef);Q.useEffect(()=>{if(k===void 0)return;let e=()=>{A.state.instantType===k&&A.set(`instantType`,void 0)};if(!N){e();return}if(se!==void 0)return;if(A.context.popupRef.current==null){e();return}let t=new AbortController;return ce(e,t.signal),()=>{t.abort()}},[k,N,se,ce,A]),b(()=>{v&&!y?A.update({parent:{type:`context-menu`,context:v},floatingNodeId:M,floatingParentNodeId:E}):y&&A.update({floatingNodeId:M,floatingParentNodeId:E})},[v,y,M,E,A]),Q.useEffect(()=>{if(N||(z.current=null),L.type===`context-menu`){if(!N){V.clear(),B.current=!1;return}V.start(500,()=>{B.current=!0})}},[V,N,L.type]),b(()=>{!N&&!F&&A.set(`hoverEnabled`,!0)},[N,F,A]);let Y=Z((e,t)=>{let n=t.reason;if(!e&&!A.select(`open`)||N===e&&t.trigger===P&&I===n)return;let i=Ze(t);if(!e&&t.trigger==null&&(t.trigger=P??void 0),r?.(e,t),t.isCanceled)return;A.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!H.current)return;e&&n===`trigger-focus`?(H.current=!1,G.start(300,()=>{H.current=!0})):(H.current=!0,G.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null);z.current=t.event;let c=Ve(A.state,e,t.trigger,i());c.openChangeReason=n,c.instantType=L.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?`group`:o||s?o?`click`:`dismiss`:void 0,A.update(c)}),le=Qe({popupStore:A,floatingRootContext:A.state.floatingRootContext,floatingId:T,nested:E!=null,onOpenChange:Y}),ue=le.context.events;b(()=>{let e=({open:e,eventDetails:t})=>Y(e,t);return ue.on(`setOpen`,e),()=>{ue?.off(`setOpen`,e)}},[ue,Y]);let de=Q.useCallback(()=>{A.setOpen(!1,X(Xe))},[A]);Q.useImperativeHandle(d,()=>({unmount:J,close:de}),[J,de]);let fe;L.type===`context-menu`&&(fe=L.context),Q.useImperativeHandle(fe?.positionerRef,()=>te,[te]),Q.useImperativeHandle(fe?.actionsRef,()=>({setOpen:Y}),[Y]);let ge=ze(le,{enabled:!re,bubbles:{escapeKey:f&&L.type===`menu`},outsidePress(){return L.type!==`context-menu`||z.current?.type===`contextmenu`||B.current},externalTree:oe?j:void 0}),_e=U(),ye=Q.useCallback(e=>{A.select(`activeIndex`)!==e&&A.set(`activeIndex`,e)},[A]),be=_t(le,{enabled:!re,listRef:A.context.itemDomElements,activeIndex:ie,nested:L.type!==void 0,loopFocus:l,orientation:u,parentOrientation:L.type===`menubar`?L.context.orientation:void 0,rtl:_e===`rtl`,disabledIndices:O,onNavigate:ye,openOnArrowKeyDown:L.type!==`context-menu`,externalTree:oe?j:void 0,focusItemOnHover:_}),xe=Q.useCallback(e=>{A.context.typingRef.current=e},[A]),Ce=vt(le,{enabled:!re,listRef:A.context.itemLabels,elementsRef:A.context.itemDomElements,activeIndex:ie,resetMs:500,onMatch:e=>{N&&e!==ie&&A.set(`activeIndex`,e)},onTyping:xe}),we=Q.useMemo(()=>{let e=g(Ce.reference,be.reference,ge.reference,{onMouseMove(){A.set(`allowMouseEnter`,!0)}},q);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=N,e},[A,Ce.reference,be.reference,ge.reference,q,N]),Te=Q.useMemo(()=>{let e=g(be.trigger,ge.trigger,q);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[be.trigger,ge.trigger,q]);pe(()=>(A.update({inactiveTriggerProps:Te}),null));let Ee=Q.useMemo(()=>g(i,{id:T,role:`menu`,"aria-orientation":u===`horizontal`?`horizontal`:void 0,"aria-labelledby":P?.id,onMouseMove(){A.set(`allowMouseEnter`,!0),L.type===`menu`&&A.set(`hoverEnabled`,!1)},onClick(){A.select(`hoverEnabled`)&&A.set(`hoverEnabled`,!1)},onKeyDown(e){let t=A.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},Ce.floating,be.floating,ge.floating),[P,T,u,L.type,A,Ce.floating,be.floating,ge.floating]),De=be.item??Ke;he(A,{floatingRootContext:le,activeTriggerProps:we,inactiveTriggerProps:Te,popupProps:Ee,itemProps:De});let Oe=Q.useMemo(()=>({store:A,parent:C}),[A,C]),ke=(0,$.jsxs)(Tt.Provider,{value:Oe,children:[p&&(0,$.jsx)(Se,{handle:p,store:A}),typeof t==`function`?t({payload:R}):t]});return L.type===void 0||L.type===`context-menu`?(0,$.jsx)(me,{externalTree:j,children:ke}):ke});function En(e,t,n){return pe(()=>new bn(e,t,n)).current}var Dn=5;function On(e,t){let n=kn(t);return e.clientX>=n.left-Dn&&e.clientX<=n.right+Dn&&e.clientY>=n.top-Dn&&e.clientY<=n.bottom+Dn}function kn(e){let t=e.getBoundingClientRect(),n=je(e);if(st)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}function An(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=tt(),{ref:i,index:a}=It(e),o=n===a,s=Q.useRef(null),c=de(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function jn(e){let{render:t,className:n,style:r,state:i=Ke,props:a=O,refs:o=O,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=An({metadata:s});return H(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function Mn(e){if(N(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!F(e))return Mn(o(e))}var Nn=e(t(),1);function Pn(e,t){let n=Q.useRef(null);function r(t){Nn.flushSync(()=>{e.setOpen(!1,X(be,t.nativeEvent,t.currentTarget))}),M(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&P(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Nn.flushSync(()=>{e.setOpen(!1,X(be,n.nativeEvent,n.currentTarget))});let i=Me(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&te(r,i);){let e=i;if(i=s(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Fn(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Q.useRef(!1);return Q.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,se(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:Ke,[t,n,r])}var In=Y(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=Et(!0),h=le(d)??m?.store;if(!h)throw Error(J(85));let _=q(s),v=h.useState(`isTriggerActive`,_),b=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,_),S=h.useState(`triggerPopupId`,_),C=Q.useRef(null),w=Rn(),E=tt(!0),D=_e(),O=Q.useMemo(()=>D??new it,[D]),k=et(O),A=at(),{registerTrigger:j,isMountedByThisTrigger:M}=Ue(_,C,h,{payload:f,closeDelay:u,parent:w,floatingTreeRoot:O,floatingNodeId:k,floatingParentNodeId:A,keyboardEventRelay:E?.relayKeyboardEvent}),N=w.type===`menubar`,P=h.useState(`disabled`),ne=a||P||N&&w.context.disabled,{getButtonProps:F,buttonRef:re}=z({disabled:ne,native:o});Q.useEffect(()=>{!x&&w.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,x,w.type]);let I=Q.useRef(null),L=W(),R=Z(e=>{if(!I.current)return;L.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;te(I.current,t)||te(h.select(`positionerElement`),t)||t===I.current||(t==null||Mn(t)!==h.select(`rootId`))&&(On(e,I.current)||O.events.emit(`close`,{domEvent:e,reason:ie}))});Q.useEffect(()=>{x&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&se(I.current).addEventListener(`mouseup`,R,{once:!0})},[x,R,h]);let ae=N&&w.context.hasSubmenuOpen,B=ee(b,{enabled:(c??ae)&&!ne&&(!N||ae&&!M),handleClose:y({blockPointerEvents:!N}),mouseOnly:!0,move:!1,restMs:w.type===void 0?l:void 0,delay:{close:u},triggerElementRef:C,externalTree:O,isActiveTrigger:v,isClosing:()=>h.select(`transitionStatus`)===`ending`}),V=Ln(x,h.select(`lastOpenChangeReason`)),U=lt(b,{enabled:!ne,event:x&&N?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:w.type===void 0&&V}),G=T(b,{enabled:!ne&&ae}),oe=Fn({open:x,enabled:N,mouseDownAction:`open`}),ce=Q.useMemo(()=>g(G.reference,U.reference),[G.reference,U.reference]),Y=h.useState(`triggerProps`,M),{preFocusGuardRef:ue,handlePreFocusGuardFocus:de,handleFocusTargetFocus:fe}=Pn(h,C),pe={disabled:ne,open:x},X=[I,t,re,j,C],me=[ce,B??Ke,Y,{"aria-haspopup":`menu`,"aria-controls":S,id:_,onMouseDown:e=>{h.select(`open`)||(L.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),se(e.currentTarget).addEventListener(`mouseup`,R,{once:!0}))}},N?{role:`menuitem`}:{},oe,p,F],he=H(`button`,e,{enabled:!N,stateAttributesMapping:Ee,state:pe,ref:X,props:me});return N?(0,$.jsx)(jn,{tag:`button`,render:n,className:r,style:i,state:pe,refs:X,props:me,stateAttributesMapping:Ee}):x?(0,$.jsxs)(Q.Fragment,{children:[(0,$.jsx)(K,{ref:ue,onFocus:de},`${_}-pre-focus-guard`),(0,$.jsx)(Q.Fragment,{children:he},_),(0,$.jsx)(K,{ref:h.context.triggerFocusTargetRef,onFocus:fe},`${_}-post-focus-guard`)]}):(0,$.jsx)(Q.Fragment,{children:he},_)});function Ln(e,t){let n=W(),[r,i]=Q.useState(!1);return b(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Rn(){let e=vn(!0);return Q.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}function zn({...e}){return(0,$.jsx)(Tn,{"data-slot":`dropdown-menu`,...e})}function Bn({...e}){return(0,$.jsx)(In,{"data-slot":`dropdown-menu-trigger`,...e})}function Vn({align:e=`start`,alignOffset:t=0,side:n=`bottom`,sideOffset:r=4,className:i,...a}){return(0,$.jsx)(Qt,{children:(0,$.jsx)(ln,{className:`isolate z-50 outline-none`,align:e,alignOffset:t,side:n,sideOffset:r,children:(0,$.jsx)(Yt,{"data-slot":`dropdown-menu-content`,className:L(`cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95`,i),...a})})})}function Hn({...e}){return(0,$.jsx)(Wt,{"data-slot":`dropdown-menu-group`,...e})}function Un({className:e,inset:t,...n}){return(0,$.jsx)(Gt,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:L(`px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7`,e),...n})}function Wn({className:e,inset:t,variant:n=`default`,...r}){return(0,$.jsx)(Kt,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:L(`group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive`,e),...r})}function Gn({className:e,children:t,checked:n,inset:r,...i}){return(0,$.jsxs)(Bt,{"data-slot":`dropdown-menu-checkbox-item`,"data-inset":r,className:L(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...i,children:[(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-checkbox-item-indicator`,children:(0,$.jsx)(Vt,{children:(0,$.jsx)(a,{icon:xe,size:16,color:`currentColor`,strokeWidth:1.5})})}),t]})}function Kn({...e}){return(0,$.jsx)(fn,{"data-slot":`dropdown-menu-radio-group`,...e})}function qn({className:e,children:t,inset:n,...r}){return(0,$.jsxs)(hn,{"data-slot":`dropdown-menu-radio-item`,"data-inset":n,className:L(`relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[(0,$.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex items-center justify-center`,"data-slot":`dropdown-menu-radio-item-indicator`,children:(0,$.jsx)(gn,{children:(0,$.jsx)(a,{icon:xe,size:16,color:`currentColor`,strokeWidth:1.5})})}),t]})}function Jn({className:e,...t}){return(0,$.jsx)(yt,{"data-slot":`dropdown-menu-separator`,className:L(`-mx-1 my-1 h-px bg-border`,e),...t})}function Yn({className:e,...t}){return(0,$.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:L(`ml-auto text-xs tracking-widest text-muted-foreground group-focus/dropdown-menu-item:text-accent-foreground`,e),...t})}export{St as _,Wn as a,_t as b,qn as c,Bn as d,On as f,It as g,Jt as h,Hn as i,Jn as l,$t as m,Gn as n,Un as o,cn as p,Vn as r,Kn as s,zn as t,Yn as u,yt as v,lt as x,vt as y};
|