@xopcai/xopc 0.0.231 → 0.0.233
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/README.zh-CN.md +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +3 -3
- package/dist/extensions/telegram/src/config-schema.d.ts +4 -4
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/gateway/static/root/assets/{activity-store-M0nAY5XB.js → activity-store-DQ5L3PTi.js} +1 -1
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-Bps8fvBp.js +1 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-JrK80PvP.js +1 -0
- package/dist/gateway/static/root/assets/agents-CJYEnz94.js +1 -0
- package/dist/gateway/static/root/assets/api-DE6tZKG0.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DP7YVRPn.js → app-management-settings-panel-BryzDVod.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CVQ5n7y6.js → appearance-settings-BoweLBDm.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Bt8_sWtU.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-7_DXaMTP.js → archive-plugin-DyujzZNu.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-mmr_mHRr.js → attachment-load-DmXGUWve.js} +1 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-BDTD8YUe.js +12 -0
- package/dist/gateway/static/root/assets/{automations-page-DfY-T6Ga.js → automations-page-DrTVSK7o.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-86UTesz3.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CO9QMEh2.js → binary-plugins-mFyeC74W.js} +2 -2
- package/dist/gateway/static/root/assets/{block-editor-CE14CVOy.js → block-editor-D5yMFrgH.js} +4 -4
- package/dist/gateway/static/root/assets/browser-settings-page-DfMU7yXv.js +8 -0
- package/dist/gateway/static/root/assets/browser-workflow-inputs-B6rLBtua.js +1 -0
- package/dist/gateway/static/root/assets/{browser-workflows-page-1wgXyoSO.js → browser-workflows-page-C74sg50f.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-lsHRuBlX.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-CxR_clkO.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-C5ABr73b.js → channels-status-swr-DowVNjNw.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdRW6Euc.js → chat-terminal-dock-BO6_BgjE.js} +2 -2
- package/dist/gateway/static/root/assets/{code-editor-dFzqyDXS.js → code-editor-D4_k-6QN.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CpNLyKB4.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CYMXfk4M.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DIM_OkQP.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-Cp8I6rsL.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-MmOR4A3u.js → desktop-pet-settings-NjPiz3M_.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CMO-J3cG.js → desktop-pet-wzSzZ6S8.js} +1 -1
- package/dist/gateway/static/root/assets/dist-DqPZM2MH2.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DdH0dG2_.js → extension-debug-page-CoMl13ET.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Clg-KktN.js → extension-page-CXc1Lc8x.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CfEWpgjl.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DEHnF4Wm.js → gateway-config-api-yH4KAEkK.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-YyZJKvFf.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-DKkEXXj9.js → gateway-settings-BmjJIiKh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B_zrtccP.js → gateway-startup-retry-Dnrl91pU.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DGq9q4b6.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Dj4B1wb3.js +1 -0
- package/dist/gateway/static/root/assets/html-workspace-editor-C3DKAkMc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-YKP2me5Z.js → image-generation-api-BNzAAw4Y.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGf-TiZj.js +70 -0
- package/dist/gateway/static/root/assets/index-BTUuTnc9.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BvpEeHnm.js → keyboard-shortcuts-settings-CfNV1ysF.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-IJg75WaN.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Bzvn99eH.js → local-apps-page-MPd4Fl_l.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-D_dq_0LV.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-NsfoazgK.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-DeIjN4e0.js +1 -0
- package/dist/gateway/static/root/assets/markdown-editor-nDLmA_LF.js +2 -0
- package/dist/gateway/static/root/assets/markdown-split-BUAVv6Gu.js +1 -0
- package/dist/gateway/static/root/assets/markdown-view-CPkBOY3h.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-D8I7OGnT.js → media-plugins-DFsVnOY-.js} +1 -1
- package/dist/gateway/static/root/assets/messages-D4qOHT4D.js +3 -0
- package/dist/gateway/static/root/assets/mobile-device-api-D9JevyCE.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-C5y2gzMU.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-EpgG-OQc.js → notes-api-BWSfTP1w.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CCvjGMhN.js → notes-page-CV8UJj7g.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DrjMVgEI.js +4 -0
- package/dist/gateway/static/root/assets/{oauth-api-BwNLwbI8.js → oauth-api-DnanEBsf.js} +1 -1
- package/dist/gateway/static/root/assets/popover-select-3E24E65N.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-MmMswmOU.js → product-open-page-zNg1KOy2.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-tfcGYL-O.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BkjnXLdJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BFZrVYfy.js → registry-api-BeVzfRvs.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BXn-3n2d.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Dx6o7sLu.js → runtime-tools-settings-panel-BxoioSvT.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-Cdd9c4vt.js → schema-form-vzbmscrE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-MLNjrOkw.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByNLBY2q.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-D0YxMnhm.js → settings-form-section-x9k7MWD3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-BLFOD9h9.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-CwgTooar.js +1 -0
- package/dist/gateway/static/root/assets/settings-shell-layer-context-DCp6ykjQ.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-bnueBZg8.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DiqBn-oE.js → share-preview-page-COTrPAd-.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-D-v_psqL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DJICr4wh.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-CZwhWiRl.js → skills-page-D9wM6_Jn.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-kBGr8opZ.js → skills-page.utils-PtlQLM5a.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CPBs6lWi.js → system-settings-panel-BR74mNEK.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-B-rmeE8t.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Qgvo0Ga7.js → theme-store-Bud54q9e.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-C4YcEiP9.js → use-autosave-DH47MH7s.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-B6eyxxOT.js +1 -0
- package/dist/gateway/static/root/assets/{vendor-codemirror-DRr7hFaD.js → vendor-codemirror--gTq3YAI.js} +16 -16
- package/dist/gateway/static/root/assets/voice-api-key-field-B59GaqRa.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-C0ahrZ0e.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CKIdPEen.js → work-discovery-overlay-DTn4RCcx.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BK44Vm5W.js → workflow-run-setup-panel-yDFoEX06.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BOwSbfWm.js +5 -0
- package/dist/gateway/static/root/index.html +16 -16
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +162 -2
- package/dist/packages/gateway-contract/src/product-delivery.js +6 -2
- package/dist/packages/gateway-contract/src/turn-outcome.js +77 -1
- package/dist/src/agent/agent-manager.d.ts +1 -2
- package/dist/src/agent/agent-manager.js +29 -44
- package/dist/src/agent/background-review/run-background-review.js +10 -15
- package/dist/src/agent/capabilities/definitions.d.ts +1 -1
- package/dist/src/agent/capabilities/definitions.js +2 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +5 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -13
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +13 -14
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -9
- package/dist/src/agent/mcp/bundle-mcp-policy.js +1 -13
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
- package/dist/src/agent/media-generation/runtime-shared.js +1 -1
- package/dist/src/agent/memory/create-memory-manager.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +1 -1
- package/dist/src/{agent-runtime/memory-runtime.d.ts → agent/memory/runtime.d.ts} +1 -1
- package/dist/src/{agent-runtime/memory-runtime.js → agent/memory/runtime.js} +2 -3
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -3
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
- package/dist/src/agent/prompt/sections/tooling.js +5 -0
- package/dist/src/agent/service.js +0 -1
- package/dist/src/agent/starter-agents.js +1 -8
- package/dist/src/agent/tools/create-share-tool.js +2 -1
- package/dist/src/agent/tools/exec-command.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +1 -1
- package/dist/src/agent/tools/factory.js +2 -0
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/publish-artifacts.d.ts +2 -0
- package/dist/src/agent/tools/publish-artifacts.js +82 -0
- package/dist/src/agent/tools/send-media.js +2 -1
- package/dist/src/agent/tools/workflow-tool.js +1 -5
- package/dist/src/agent-config/index.d.ts +2 -0
- package/dist/src/agent-config/index.js +11 -0
- package/dist/src/agent-config/resolver.d.ts +11 -0
- package/dist/src/agent-config/resolver.js +113 -0
- package/dist/src/agent-config/schema.d.ts +491 -0
- package/dist/src/agent-config/schema.js +172 -0
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/config-paths.js +1 -1
- package/dist/src/cli/command-catalog.js +4 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/agents.js +2 -1
- package/dist/src/cli/commands/auth.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +12 -4
- package/dist/src/cli/commands/image.js +3 -4
- package/dist/src/cli/commands/models.js +9 -3
- package/dist/src/cli/commands/onboard/model.js +13 -12
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/providers.js +1 -1
- package/dist/src/cli/commands/support.d.ts +1 -0
- package/dist/src/cli/commands/support.js +51 -0
- package/dist/src/cli/commands/tunnel.js +3 -18
- package/dist/src/cli/utils/init-workspace-core.d.ts +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/commands/agents.config.d.ts +1 -3
- package/dist/src/commands/agents.config.js +9 -26
- package/dist/src/config/agent-model-intents.d.ts +10 -0
- package/dist/src/config/agent-model-intents.js +39 -0
- package/dist/src/config/agent-profile.d.ts +7 -9
- package/dist/src/config/agent-profile.js +30 -28
- package/dist/src/config/default-model.d.ts +1 -11
- package/dist/src/config/default-model.js +3 -11
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/integration.d.ts +1 -1
- package/dist/src/config/reload.js +1 -1
- package/dist/src/config/rules.js +3 -3
- package/dist/src/config/schema.d.ts +187 -452
- package/dist/src/config/schema.js +53 -131
- package/dist/src/endpoint-tools/binding-service.d.ts +22 -0
- package/dist/src/endpoint-tools/binding-service.js +45 -0
- package/dist/src/endpoint-tools/index.d.ts +1 -0
- package/dist/src/endpoint-tools/index.js +2 -1
- package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
- package/dist/src/endpoint-tools/invocation-service.js +8 -0
- package/dist/src/endpoint-tools/policy.d.ts +4 -1
- package/dist/src/endpoint-tools/policy.js +68 -5
- package/dist/src/endpoint-tools/registry.js +1 -1
- package/dist/src/endpoint-tools/runtime.d.ts +2 -0
- package/dist/src/endpoint-tools/runtime.js +8 -0
- package/dist/src/extensions/activation-context.js +7 -11
- package/dist/src/files/file-service.js +14 -5
- package/dist/src/gateway/agent-builtin-tools.d.ts +250 -6
- package/dist/src/gateway/agent-builtin-tools.js +284 -46
- package/dist/src/gateway/agents-admin.d.ts +20 -62
- package/dist/src/gateway/agents-admin.js +36 -228
- package/dist/src/gateway/chat-stream/turn-outcome-collector.js +41 -6
- package/dist/src/gateway/device-routes.d.ts +3 -0
- package/dist/src/gateway/device-routes.js +47 -0
- package/dist/src/gateway/global-defaults-admin.d.ts +6 -20
- package/dist/src/gateway/global-defaults-admin.js +20 -120
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +54 -137
- package/dist/src/gateway/hono/lib/config-payload.js +2 -4
- package/dist/src/gateway/hono/middleware/auth.js +36 -3
- package/dist/src/gateway/hono/middleware/scopes.d.ts +2 -12
- package/dist/src/gateway/hono/middleware/scopes.js +9 -18
- package/dist/src/gateway/hono/routes/agents.js +64 -100
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/device-push.d.ts +2 -0
- package/dist/src/gateway/hono/routes/{mobile.js → device-push.js} +40 -18
- package/dist/src/gateway/hono/routes/devices.d.ts +4 -0
- package/dist/src/gateway/hono/routes/devices.js +214 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +68 -1
- package/dist/src/gateway/hono/routes/files.js +12 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +5 -9
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +12 -20
- package/dist/src/gateway/hono/routes/media.js +46 -2
- package/dist/src/gateway/hono/routes/models.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.js +8 -1
- package/dist/src/gateway/hono/routes/status.js +9 -16
- package/dist/src/gateway/hono/routes/support.d.ts +3 -0
- package/dist/src/gateway/hono/routes/support.js +28 -0
- package/dist/src/gateway/hono/routes/tunnel.d.ts +0 -2
- package/dist/src/gateway/hono/routes/tunnel.js +10 -199
- package/dist/src/gateway/hono/routes/you.js +24 -0
- package/dist/src/gateway/image-generation-setup.d.ts +2 -2
- package/dist/src/gateway/image-generation-setup.js +8 -7
- package/dist/src/gateway/public-url.d.ts +1 -1
- package/dist/src/gateway/security/gateway-principal.d.ts +11 -0
- package/dist/src/gateway/security/gateway-principal.js +12 -0
- package/dist/src/gateway/security/gateway-scopes.d.ts +7 -0
- package/dist/src/gateway/security/gateway-scopes.js +66 -0
- package/dist/src/gateway/security/index.d.ts +2 -1
- package/dist/src/gateway/security/index.js +3 -2
- package/dist/src/gateway/service.js +7 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +19 -21
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/media/store.js +9 -0
- package/dist/src/migrations/index.d.ts +0 -1
- package/dist/src/migrations/index.js +1 -2
- package/dist/src/migrations/runner.js +1 -2
- package/dist/src/notifications/device-store.d.ts +1 -1
- package/dist/src/notifications/device-store.js +11 -11
- package/dist/src/notifications/store.js +3 -3
- package/dist/src/providers/index.js +1 -1
- package/dist/src/providers/model-reference-auditor.js +14 -9
- package/dist/src/realtime/runtime.d.ts +2 -0
- package/dist/src/realtime/runtime.js +27 -3
- package/dist/src/realtime/tickets.d.ts +6 -1
- package/dist/src/realtime/tickets.js +2 -1
- package/dist/src/remote-access/exposure-manager.js +3 -3
- package/dist/src/share/share-url.js +2 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +54 -0
- package/dist/src/storage/sqlite/device-access-repository.js +194 -0
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +22 -0
- package/dist/src/storage/sqlite/device-pairing-repository.js +86 -0
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +32 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.d.ts +10 -0
- package/dist/src/storage/sqlite/gateway-identity-repository.js +50 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -0
- package/dist/src/storage/sqlite/index.js +5 -1
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +96 -0
- package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +231 -0
- package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/support/build-support-investigation-prompt.d.ts +2 -0
- package/dist/src/support/build-support-investigation-prompt.js +29 -0
- package/dist/src/support/collect-support-report.d.ts +16 -0
- package/dist/src/support/collect-support-report.js +216 -0
- package/dist/src/support/redact-support-report.d.ts +16 -0
- package/dist/src/support/redact-support-report.js +89 -0
- package/dist/src/support/types.d.ts +76 -0
- package/dist/src/support/types.js +18 -0
- package/dist/src/tunnel/consent.d.ts +1 -1
- package/dist/src/tunnel/consent.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/tunnel/index.d.ts +1 -4
- package/dist/src/tunnel/index.js +3 -5
- package/dist/src/tunnel/tunnel-audit.d.ts +1 -1
- package/dist/src/tunnel/tunnel-config.js +1 -1
- package/dist/src/tunnel/tunnel-service.d.ts +2 -3
- package/dist/src/tunnel/tunnel-service.js +1 -20
- package/dist/src/tunnel/tunnel-types.d.ts +0 -6
- package/dist/src/user-context/user-avatar.d.ts +17 -0
- package/dist/src/user-context/user-avatar.js +116 -0
- package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +3 -3
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-avatar-dicebear-CBqUnlvL.js +0 -1
- package/dist/gateway/static/root/assets/agents-7YO6znTT.js +0 -68
- package/dist/gateway/static/root/assets/api-BywYxpaS.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DSCia0DT.js +0 -1
- package/dist/gateway/static/root/assets/attachment-preview-renderer-Cmo-5BP5.js +0 -11
- package/dist/gateway/static/root/assets/automations-workspace-BpvD54D6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CeESA4Oj.js +0 -8
- package/dist/gateway/static/root/assets/browser-workflow-inputs-8NC2qDRF.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B_OXTojB.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-o0y9WgAI.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D5nZecxV.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-BzmnWx6X.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DX6OkwFQ.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DYSMZsms.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-DGCfX4tK.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-DHDa4ht1.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-B9qoxDcn.js +0 -1
- package/dist/gateway/static/root/assets/dist-J_ySZvz0.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-eP3fJ2M6.js +0 -1
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-swr-BWGjnmDl.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DlBPNubY.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BnOrLRfs.js +0 -1
- package/dist/gateway/static/root/assets/html-workspace-editor-bXK5tq64.js +0 -1
- package/dist/gateway/static/root/assets/index-0xQO5B_Q.js +0 -70
- package/dist/gateway/static/root/assets/index-CCyIdGuQ.css +0 -2
- package/dist/gateway/static/root/assets/local-app-workbench-page-Ch1rdUo8.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-CXhjfe4q.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-zxx2ExlY.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BQaeyOYm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-editor-TWGaF7Xa.js +0 -2
- package/dist/gateway/static/root/assets/markdown-split-D9tmIiEm.js +0 -1
- package/dist/gateway/static/root/assets/markdown-view-RxNHwlNo.js +0 -201
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-0RjEwafI.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-9cgh77VH.js +0 -4
- package/dist/gateway/static/root/assets/popover-select-CccGri5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-hf6pmH4p.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-By2U-Wdh.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CUcpp7CQ.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-ByI82xS1.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCoI5IJ8.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-y53gEKsF.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BoE_tToG.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BQmyb5KC.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bf3VpZ-R.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CXHlbuGS.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-Bo0KSZ2v.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnj7gMX2.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BML8zCwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-CB98MTwG.js +0 -5
- package/dist/src/agent-manifest/index.d.ts +0 -5
- package/dist/src/agent-manifest/index.js +0 -10
- package/dist/src/agent-manifest/preset-chain.d.ts +0 -10
- package/dist/src/agent-manifest/preset-chain.js +0 -30
- package/dist/src/agent-manifest/prompt.d.ts +0 -2
- package/dist/src/agent-manifest/prompt.js +0 -49
- package/dist/src/agent-manifest/resolver.d.ts +0 -32
- package/dist/src/agent-manifest/resolver.js +0 -114
- package/dist/src/agent-manifest/schema.d.ts +0 -695
- package/dist/src/agent-manifest/schema.js +0 -226
- package/dist/src/agent-manifest/validator.d.ts +0 -25
- package/dist/src/agent-manifest/validator.js +0 -74
- package/dist/src/agent-runtime/boundary-guard.d.ts +0 -12
- package/dist/src/agent-runtime/boundary-guard.js +0 -21
- package/dist/src/agent-runtime/index.d.ts +0 -7
- package/dist/src/agent-runtime/index.js +0 -8
- package/dist/src/agent-runtime/model-router.d.ts +0 -11
- package/dist/src/agent-runtime/model-router.js +0 -14
- package/dist/src/agent-runtime/run-trace.d.ts +0 -27
- package/dist/src/agent-runtime/run-trace.js +0 -51
- package/dist/src/agent-runtime/runtime-profile.d.ts +0 -26
- package/dist/src/agent-runtime/runtime-profile.js +0 -42
- package/dist/src/agent-runtime/tool-registry.d.ts +0 -28
- package/dist/src/agent-runtime/tool-registry.js +0 -50
- package/dist/src/agent-runtime/workflow-runtime.d.ts +0 -31
- package/dist/src/agent-runtime/workflow-runtime.js +0 -32
- package/dist/src/config/agent-typed-models.d.ts +0 -13
- package/dist/src/config/agent-typed-models.js +0 -48
- package/dist/src/gateway/capability-presets-admin.d.ts +0 -88
- package/dist/src/gateway/capability-presets-admin.js +0 -303
- package/dist/src/gateway/hono/lib/agent-model.d.ts +0 -35
- package/dist/src/gateway/hono/lib/agent-model.js +0 -97
- package/dist/src/gateway/hono/routes/capability-presets.d.ts +0 -3
- package/dist/src/gateway/hono/routes/capability-presets.js +0 -187
- package/dist/src/gateway/hono/routes/mobile.d.ts +0 -3
- package/dist/src/gateway/security/operator-scopes.d.ts +0 -37
- package/dist/src/gateway/security/operator-scopes.js +0 -147
- package/dist/src/migrations/config/default-capability-preset.d.ts +0 -10
- package/dist/src/migrations/config/default-capability-preset.js +0 -133
- package/dist/src/tunnel/enable-lan-pairing.d.ts +0 -8
- package/dist/src/tunnel/enable-lan-pairing.js +0 -41
- package/dist/src/tunnel/pair-context.d.ts +0 -36
- package/dist/src/tunnel/pair-context.js +0 -77
- package/dist/src/tunnel/pair-url.d.ts +0 -43
- package/dist/src/tunnel/pair-url.js +0 -117
- package/dist/src/tunnel/pairing-rate-limit.d.ts +0 -12
- package/dist/src/tunnel/pairing-rate-limit.js +0 -28
- package/dist/src/tunnel/pairing.d.ts +0 -21
- package/dist/src/tunnel/pairing.js +0 -103
- package/dist/src/tunnel/tunnel-qr.d.ts +0 -9
- package/dist/src/tunnel/tunnel-qr.js +0 -29
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,p as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as o}from"./check-DUBLcKHA.js";import{n as s,r as c,t as l}from"./popover-select-3E24E65N.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./search-DA7gz22f.js";import{t as m}from"./x-B_N4OPjy.js";import{t as h}from"./cn-JdwAhgNB.js";import{t as g}from"./button-CSEbl4zT.js";import{s as _}from"./form-field-width-DJw_jULe.js";import{n as v}from"./interaction-BmQogeqz.js";import{n as y}from"./copy-to-clipboard-HOJ79TWv.js";import{t as b}from"./messages-D4qOHT4D.js";import{a as x,n as S,r as C,s as w}from"./locale-store-D_dq_0LV.js";import{i as T,o as E}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as D}from"./electron-env-DH5wF8X8.js";import{a as O,i as k,n as A,o as j,r as M,s as N,t as P}from"./dist-BPoKqzeH.js";import{n as F,r as I}from"./gateway-config-swr-YyZJKvFf.js";import{a as L,i as R,n as z,r as B,t as V}from"./dist-DqPZM2MH2.js";import{$s as H,Aa as U,At as ee,Bc as W,Bo as G,Bt as te,Cs as K,Ct as ne,Do as re,Dt as ie,Et as ae,Ft as oe,Gt as se,Ht as ce,It as le,Ko as ue,Lo as de,Lt as fe,Ms as pe,Mt as me,Nc as he,Nt as ge,Oc as _e,Ot as q,Pt as J,Qc as Y,Rt as ve,St as ye,Ti as be,Tt as xe,Ut as Se,Vc as Ce,Vt as we,Wt as Te,Yo as Ee,_t as De,ar as Oe,as as ke,bt as Ae,fs as je,ft as Me,gt as Ne,ht as Pe,ir as Fe,jt as Ie,kt as Le,lr as Re,ls as ze,ms as Be,mt as X,nl as Ve,oc as He,or as Ue,pt as We,sr as Ge,us as Ke,vt as qe,wt as Je,xs as Ye,xt as Xe,yt as Ze,zt as Qe}from"./index-BGf-TiZj.js";import{t as $e}from"./page-tabs-BaEQMYm_.js";import{n as et,r as tt,t as nt}from"./oauth-authorization-window-Cdolr2wE.js";var Z=e(t(),1),Q=n(),$=r();function rt(e){let t=(0,Q.c)(74),{connector:n,installed:r,onInstall:i,onOpenDetails:a,t:o}=e,s,c,l,d,f,p,m,_,v,y;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==a||t[4]!==o.connect||t[5]!==o.connectedBadge||t[6]!==o.connectorBeta||t[7]!==o.connectorCapabilityLabels||t[8]!==o.connectorExperimental||t[9]!==o.connectorVerified){let e=n.capabilities.filter(it),b=e.slice(0,3),x=Math.max(0,e.length-b.length),S=o.connect,C=n.verificationLevel===`verified`?o.connectorVerified:n.verificationLevel===`beta`?o.connectorBeta:n.verificationLevel===`experimental`?o.connectorExperimental:null,w;t[20]!==S||t[21]!==n||t[22]!==i?(w=e=>(0,$.jsxs)(g,{type:`button`,variant:`primary`,className:h(`h-8 justify-center px-2.5 text-xs font-medium`,e),onClick:e=>{e.stopPropagation(),i(n)},children:[(0,$.jsx)(pe,{className:`size-4`}),S]}),t[20]=S,t[21]=n,t[22]=i,t[23]=w):w=t[23],s=w;let T;t[24]!==n||t[25]!==a?(T=e=>{!a||e.currentTarget!==e.target||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),a(n))},t[24]=n,t[25]=a,t[26]=T):T=t[26];let E=T,D=a?`cursor-pointer`:null;t[27]===D?p=t[28]:(p=h(`group flex min-h-[9.5rem] flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45 focus-within:ring-2 focus-within:ring-accent/30`,D),t[27]=D,t[28]=p),m=a?`button`:void 0,_=a?0:void 0,t[29]!==n||t[30]!==a?(v=()=>a?.(n),t[29]=n,t[30]=a,t[31]=v):v=t[31],y=E,c=`flex min-w-0 flex-1 flex-col`;let O;t[32]===n?O=t[33]:(O=(0,$.jsx)(Pe,{connector:n}),t[32]=n,t[33]=O);let k;t[34]===n.displayName?k=t[35]:(k=(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.displayName}),t[34]=n.displayName,t[35]=k);let A;t[36]===C?A=t[37]:(A=C?(0,$.jsx)(`span`,{className:`mt-1 inline-flex rounded-full border border-edge px-1.5 py-0.5 text-[10px] font-medium text-fg-subtle`,children:C}):null,t[36]=C,t[37]=A);let j;t[38]!==k||t[39]!==A?(j=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[38]=k,t[39]=A,t[40]=j):j=t[40];let M;t[41]!==O||t[42]!==j?(M=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[O,j]}),t[41]=O,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==r||t[45]!==s?(N=r?null:(0,$.jsx)(`div`,{className:`hidden shrink-0 items-center gap-1 transition-opacity sm:pointer-events-none sm:flex sm:opacity-0 sm:group-hover:pointer-events-auto sm:group-hover:opacity-100 sm:group-focus-within:pointer-events-auto sm:group-focus-within:opacity-100`,children:s()}),t[44]=r,t[45]=s,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==o.connectedBadge?(P=r?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(u,{className:`size-3`,"aria-hidden":!0}),o.connectedBadge]}):null,t[47]=r,t[48]=o.connectedBadge,t[49]=P):P=t[49];let F;t[50]!==N||t[51]!==P?(F=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-2`,children:[N,P]}),t[50]=N,t[51]=P,t[52]=F):F=t[52],t[53]!==M||t[54]!==F?(l=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[M,F]}),t[53]=M,t[54]=F,t[55]=l):l=t[55],t[56]===n.description?d=t[57]:(d=(0,$.jsx)(`p`,{className:`mt-4 line-clamp-2 text-sm leading-6 text-fg-muted`,title:n.description,children:n.description}),t[56]=n.description,t[57]=d),f=b.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-1.5`,children:[b.map(e=>(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:o.connectorCapabilityLabels[e]??e},e)),x>0?(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-0.5 text-[11px] text-fg-subtle`,children:[`+`,x]}):null]}):null,t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o.connect,t[5]=o.connectedBadge,t[6]=o.connectorBeta,t[7]=o.connectorCapabilityLabels,t[8]=o.connectorExperimental,t[9]=o.connectorVerified,t[10]=s,t[11]=c,t[12]=l,t[13]=d,t[14]=f,t[15]=p,t[16]=m,t[17]=_,t[18]=v,t[19]=y}else s=t[10],c=t[11],l=t[12],d=t[13],f=t[14],p=t[15],m=t[16],_=t[17],v=t[18],y=t[19];let b;t[58]!==c||t[59]!==l||t[60]!==d||t[61]!==f?(b=(0,$.jsxs)(`div`,{className:c,children:[l,d,f]}),t[58]=c,t[59]=l,t[60]=d,t[61]=f,t[62]=b):b=t[62];let x;t[63]!==r||t[64]!==s?(x=r?null:(0,$.jsx)(`div`,{className:`mt-4 flex flex-col gap-2 border-t border-edge pt-3 sm:hidden`,children:s(`w-full`)}),t[63]=r,t[64]=s,t[65]=x):x=t[65];let S;return t[66]!==b||t[67]!==x||t[68]!==p||t[69]!==m||t[70]!==_||t[71]!==v||t[72]!==y?(S=(0,$.jsxs)(`div`,{className:p,role:m,tabIndex:_,onClick:v,onKeyDown:y,children:[b,x]}),t[66]=b,t[67]=x,t[68]=p,t[69]=m,t[70]=_,t[71]=v,t[72]=y,t[73]=S):S=t[73],S}function it(e){return!e.startsWith(`runtime.`)&&!e.startsWith(`auth.`)}var at=[`c0`,`c1`,`c2`,`c3`,`c4`,`c5`];function ot(e,t){return t.some(t=>t.connectorId===e.id)}var st=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ct(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:h(`size-10 shrink-0 rounded-xl`,st)}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`div`,{className:`flex h-full min-h-[9.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsx)(`div`,{className:h(`h-4 min-w-0 flex-1`,st)}),(0,$.jsx)(`div`,{className:h(`h-8 w-[4.5rem] shrink-0 rounded-lg`,st)})]}),(0,$.jsx)(`div`,{className:h(`h-3 w-full`,st)}),(0,$.jsx)(`div`,{className:h(`h-3 w-[88%]`,st)})]})]})}),e[1]=n):n=e[1],n}var lt=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function ut(){let e=(0,Q.c)(4),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:h(`size-10 shrink-0 rounded-xl`,lt)}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,$.jsx)(`div`,{className:h(`h-4 w-48 max-w-full`,lt)}),(0,$.jsx)(`div`,{className:h(`h-3 w-72 max-w-full`,lt)})]}),e[1]=n):n=e[1];let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[t,(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-start justify-between gap-3`,children:[n,(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsx)(`div`,{className:h(`h-9 w-20 rounded-lg`,lt)}),(0,$.jsx)(`div`,{className:h(`h-9 w-20 rounded-lg`,lt)})]})]})]}),e[2]=r):r=e[2];let i;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(`div`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:[r,(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsx)(`div`,{className:h(`h-8 w-20 rounded-md`,lt)}),(0,$.jsx)(`div`,{className:h(`h-8 w-24 rounded-md`,lt)}),(0,$.jsx)(`div`,{className:h(`h-8 w-28 rounded-md`,lt)})]}),(0,$.jsx)(`div`,{className:h(`mt-3 h-20 rounded-xl`,lt)})]}),e[3]=i):i=e[3],i}function dt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replaceAll(`{{${t}}}`,String(n)),e)}function ft(e,t){return t.connectorCapabilityLabels[e]??e}function pt(e,t){if(e.runtime.type===`mcp`)return dt(t.connectorRuntimeMcp,{serverId:e.runtime.serverId});let n=e.runtime.type===`composio`?e.runtime.toolkit:e.runtime.type===`channel`?e.runtime.channelId:e.runtime.type===`nativeTool`?e.runtime.toolsetId:e.runtime.sourceKind;return dt(t.connectorRuntimeGeneric,{runtime:e.runtime.type,id:n??e.runtime.type})}function mt(e,t){return e.auth.mode===`oauth`?t.connectorAuthOAuth:e.auth.mode===`apiKey`?t.connectorAuthApiKey:t.connectorAuthNone}function ht(e){return(e.setup.secrets??[]).filter(e=>e.required).length+(e.setup.config??[]).filter(e=>e.required).length}function gt(e){let t=(0,Q.c)(12),{title:n,items:r}=e;if(r.length===0)return null;let i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`div`,{className:`border-b border-edge px-3 py-2 text-xs font-semibold text-fg`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,16).map(_t),t[2]=r,t[3]=a);let o;t[4]===r.length?o=t[5]:(o=r.length>16?(0,$.jsxs)(`div`,{className:`px-3 py-2 text-xs text-fg-subtle`,children:[`+`,r.length-16]}):null,t[4]=r.length,t[5]=o);let s;t[6]!==a||t[7]!==o?(s=(0,$.jsxs)(`div`,{className:`max-h-48 overflow-y-auto`,children:[a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==s?(c=(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base`,children:[i,s]}),t[9]=i,t[10]=s,t[11]=c):c=t[11],c}function _t(e){return(0,$.jsxs)(`div`,{className:`border-b border-edge-subtle px-3 py-2 last:border-b-0`,children:[(0,$.jsx)(`div`,{className:`break-words font-mono text-xs font-medium text-fg`,children:e.title}),e.description?(0,$.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.id)}function vt({connector:e,installed:t,onClose:n,onInstall:r,t:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[l,f]=(0,Z.useState)(null),p=ht(e),_=e.capabilities.slice(0,8),y=Math.max(0,e.capabilities.length-_.length),b=[...(e.setup.secrets??[]).map(e=>({key:`secret:${e.key}`,label:e.label,description:e.description,required:e.required,kind:i.connectorSetupSecret})),...(e.setup.config??[]).map(e=>({key:`config:${e.key}`,label:e.label,description:e.description,required:!!e.required,kind:i.connectorSetupConfig}))],x=async()=>{o(!0),f(null);try{c(await Ie(e))}catch(e){c(null),f(e instanceof Error?e.message:String(e))}finally{o(!1)}};return(0,$.jsx)(P,{open:!0,onOpenChange:e=>{e||n()},children:(0,$.jsxs)(j,{children:[(0,$.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(M,{className:h(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,52rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Pe,{connector:e,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[t?(0,$.jsx)(`div`,{className:`mb-2 flex flex-wrap items-center gap-2`,children:(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,$.jsx)(u,{className:`size-3`,"aria-hidden":!0}),i.connectedBadge]})}):null,(0,$.jsx)(N,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(k,{className:`mt-1 line-clamp-3 text-sm leading-6 text-fg-muted`,children:e.description})]})]}),(0,$.jsx)(A,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:h(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,v.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(m,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),i.detailTools]}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:s?dt(i.connectorPreviewToolsCount,{count:s.toolCount}):i.connectorPreviewUnknown})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(He,{className:`size-3.5`,"aria-hidden":!0}),i.detailPermissions]}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:mt(e,i)})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(he,{className:`size-3.5`,"aria-hidden":!0}),i.connectorRequiredInputs]}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-semibold text-fg`,children:dt(i.connectorRequiredInputsCount,{count:p})})]})]}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 space-y-5`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorCapabilitiesTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,children:[_.map(e=>(0,$.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-muted`,children:ft(e,i)},e)),y>0?(0,$.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-base px-2 py-1 text-xs text-fg-subtle`,children:[`+`,y]}):null]})]}),l?(0,$.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l}):null,s?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.connectorPreviewTitle}),(0,$.jsx)(`span`,{className:h(`rounded-full px-2 py-0.5 text-xs font-medium`,s.ok?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:s.ok?i.healthStatusHealthy:i.healthStatusLabels[s.status]??s.status})]}),(0,$.jsxs)(`div`,{className:`mb-3 grid gap-2 text-xs sm:grid-cols-3`,children:[(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,$.jsx)(`div`,{className:`font-semibold text-fg`,children:s.toolCount}),(0,$.jsx)(`div`,{className:`text-fg-muted`,children:i.toolsMetric})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,$.jsx)(`div`,{className:`font-semibold text-fg`,children:s.resourceCount}),(0,$.jsx)(`div`,{className:`text-fg-muted`,children:i.resourcesMetric})]}),(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base px-3 py-2`,children:[(0,$.jsx)(`div`,{className:`font-semibold text-fg`,children:s.promptCount}),(0,$.jsx)(`div`,{className:`text-fg-muted`,children:i.promptsMetric})]})]}),(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(gt,{title:i.detailTools,items:s.tools.map(e=>({id:e.name,title:e.shortName??e.name,description:e.description}))}),(0,$.jsx)(gt,{title:i.detailResources,items:s.resources.map(e=>({id:e.uri,title:e.title??e.name??e.uri,description:e.description??e.uri}))}),(0,$.jsx)(gt,{title:i.detailPrompts,items:s.prompts.map(e=>({id:e.name,title:e.title??e.name,description:e.description??dt(i.promptArgumentCount,{count:e.argumentCount})}))})]}),s.error?(0,$.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-subtle`,children:s.error}):null,s.action?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:s.action}):null]}):null]}),(0,$.jsxs)(`aside`,{className:`space-y-3`,children:[(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(He,{className:`size-4 text-accent`,"aria-hidden":!0}),i.detailPermissions]}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium text-fg`,children:mt(e,i)})]}),(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(he,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorSetupTitle]}),b.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-lg border border-edge`,children:b.map(e=>(0,$.jsxs)(`div`,{className:`bg-surface-panel px-3 py-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] text-fg-muted`,children:e.kind}),e.required?(0,$.jsx)(`span`,{className:`rounded-md bg-amber-500/10 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 dark:text-amber-300`,children:i.connectorSetupRequired}):null]}),e.description?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.description}):null]},e.key))}):(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.connectorSetupNone})]}),(0,$.jsxs)(`section`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Ke,{className:`size-4 text-accent`,"aria-hidden":!0}),i.connectorRuntimeTitle]}),(0,$.jsx)(`p`,{className:`mt-2 break-words text-xs leading-5 text-fg-muted`,children:pt(e,i)})]})]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(g,{variant:`secondary`,children:i.modalClose})}),(0,$.jsxs)(g,{variant:`secondary`,disabled:a,onClick:()=>void x(),children:[a?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(re,{className:`size-4`}),i.connectorPreviewButton]}),t?(0,$.jsxs)(g,{variant:`secondary`,disabled:!0,children:[(0,$.jsx)(K,{className:`size-4`}),i.connectedBadge]}):(0,$.jsxs)(g,{variant:`primary`,onClick:()=>{r(e),n()},children:[(0,$.jsx)(pe,{className:`size-4`}),i.connect]})]})]})]})})}var yt=h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function bt(e){let t=(0,Q.c)(58),{open:n,sessionIdleTtlMinutes:r,saving:i,onChange:a,onSave:o,onClose:s,t:c,mcp:l}=e,u;t[0]===s?u=t[1]:(u=e=>{e||s()},t[0]=s,t[1]=u);let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[2]=f):f=t[2];let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=h(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(32rem,calc(100vh-2rem))] w-[min(100%-2rem,38rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[3]=p):p=t[3];let _;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(Ye,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0})}),t[4]=_):_=t[4];let y;t[5]===c.runtimeSettingsTitle?y=t[6]:(y=(0,$.jsx)(N,{className:`text-base font-semibold text-fg`,children:c.runtimeSettingsTitle}),t[5]=c.runtimeSettingsTitle,t[6]=y);let b;t[7]===c.runtimeSettingsHint?b=t[8]:(b=(0,$.jsx)(k,{className:`mt-1 text-sm text-fg-muted`,children:c.runtimeSettingsHint}),t[7]=c.runtimeSettingsHint,t[8]=b);let x;t[9]!==y||t[10]!==b?(x=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[_,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,b]})]}),t[9]=y,t[10]=b,t[11]=x):x=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=h(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,v.focusRingPanel),t[12]=S):S=t[12];let C;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(m,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[13]=C):C=t[13];let w;t[14]===c.modalClose?w=t[15]:(w=(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:S,"aria-label":c.modalClose,children:C})}),t[14]=c.modalClose,t[15]=w);let T;t[16]!==w||t[17]!==x?(T=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[x,w]}),t[16]=w,t[17]=x,t[18]=T):T=t[18];let E;t[19]===l.idleTtlLabel?E=t[20]:(E=(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:l.idleTtlLabel}),t[19]=l.idleTtlLabel,t[20]=E);let D;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=h(yt,`w-40 flex-none`),t[21]=D):D=t[21];let F=r??``,I;t[22]===a?I=t[23]:(I=e=>{let t=e.currentTarget.value.trim();a(t===``?void 0:Number.parseInt(t,10))},t[22]=a,t[23]=I);let L;t[24]!==l.idleTtlPlaceholder||t[25]!==F||t[26]!==I?(L=(0,$.jsx)(`input`,{type:`number`,min:0,className:D,value:F,placeholder:l.idleTtlPlaceholder,onChange:I}),t[24]=l.idleTtlPlaceholder,t[25]=F,t[26]=I,t[27]=L):L=t[27];let R;t[28]===l.idleTtlHint?R=t[29]:(R=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:l.idleTtlHint}),t[28]=l.idleTtlHint,t[29]=R);let z;t[30]!==E||t[31]!==L||t[32]!==R?(z=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,$.jsxs)(`label`,{className:`flex max-w-xl flex-col gap-1.5`,children:[E,L,R]})}),t[30]=E,t[31]=L,t[32]=R,t[33]=z):z=t[33];let B;t[34]!==s||t[35]!==i||t[36]!==c.modalCancel?(B=(0,$.jsx)(g,{type:`button`,variant:`secondary`,disabled:i,onClick:s,children:c.modalCancel}),t[34]=s,t[35]=i,t[36]=c.modalCancel,t[37]=B):B=t[37];let V;t[38]===o?V=t[39]:(V=()=>void o(),t[38]=o,t[39]=V);let H;t[40]===i?H=t[41]:(H=i?(0,$.jsx)(d,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,t[40]=i,t[41]=H);let U;t[42]!==l.save||t[43]!==i||t[44]!==V||t[45]!==H?(U=(0,$.jsxs)(g,{type:`button`,variant:`primary`,disabled:i,onClick:V,children:[H,l.save]}),t[42]=l.save,t[43]=i,t[44]=V,t[45]=H,t[46]=U):U=t[46];let ee;t[47]!==B||t[48]!==U?(ee=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[B,U]}),t[47]=B,t[48]=U,t[49]=ee):ee=t[49];let W;t[50]!==T||t[51]!==z||t[52]!==ee?(W=(0,$.jsxs)(j,{children:[f,(0,$.jsxs)(M,{className:p,children:[T,z,ee]})]}),t[50]=T,t[51]=z,t[52]=ee,t[53]=W):W=t[53];let G;return t[54]!==n||t[55]!==u||t[56]!==W?(G=(0,$.jsx)(P,{open:n,onOpenChange:u,children:W}),t[54]=n,t[55]=u,t[56]=W,t[57]=G):G=t[57],G}var xt=(0,Z.memo)(function(e){let t=(0,Q.c)(12),{value:n,onChange:r,placeholder:i,className:a}=e,o;t[0]===a?o=t[1]:(o=h(`relative flex min-h-9 min-w-0 flex-1 cursor-text items-center rounded-pill border border-edge bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface`,a),t[0]=a,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(p,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[2]=s):s=t[2];let c;t[3]===r?c=t[4]:(c=e=>r(e.currentTarget.value),t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c||t[7]!==n?(l=(0,$.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:n,onChange:c,placeholder:i,autoComplete:`off`,spellCheck:!1,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`}),t[5]=i,t[6]=c,t[7]=n,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,$.jsxs)(`label`,{className:o,children:[s,l]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}),St=(0,Z.memo)(function(e){let t=(0,Q.c)(30),{onBrowseCatalog:n,onAddCustomServer:r,onOpenRuntimeSettings:i,addLabel:a,browseLabel:o,customLabel:s,settingsLabel:c}=e,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,$.jsx)(ze,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=l):l=t[0];let u;t[1]===c?u=t[2]:(u=(0,$.jsx)(`span`,{className:`hidden sm:inline`,children:c}),t[1]=c,t[2]=u);let d;t[3]!==i||t[4]!==c||t[5]!==u?(d=(0,$.jsxs)(g,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":c,title:c,onClick:i,children:[l,u]}),t[3]=i,t[4]=c,t[5]=u,t[6]=d):d=t[6];let p;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(f,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=p):p=t[7];let m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(Ve,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[8]=m):m=t[8];let _;t[9]===a?_=t[10]:(_=(0,$.jsx)(Re,{asChild:!0,children:(0,$.jsxs)(g,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,children:[p,a,m]})}),t[9]=a,t[10]=_);let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=h(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,v.transition),t[11]=y):y=t[11];let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(ue,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[12]=b):b=t[12];let x;t[13]!==o||t[14]!==n?(x=(0,$.jsxs)(Oe,{className:y,onSelect:n,children:[b,o]}),t[13]=o,t[14]=n,t[15]=x):x=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=h(`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,v.transition),t[16]=S):S=t[16];let C;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(re,{className:`size-4 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[17]=C):C=t[17];let w;t[18]!==s||t[19]!==r?(w=(0,$.jsxs)(Oe,{className:S,onSelect:r,children:[C,s]}),t[18]=s,t[19]=r,t[20]=w):w=t[20];let T;t[21]!==w||t[22]!==x?(T=(0,$.jsx)(Ue,{children:(0,$.jsxs)(Fe,{className:`z-50 min-w-[14rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[x,w]})}),t[21]=w,t[22]=x,t[23]=T):T=t[23];let E;t[24]!==T||t[25]!==_?(E=(0,$.jsxs)(Ge,{children:[_,T]}),t[24]=T,t[25]=_,t[26]=E):E=t[26];let D;return t[27]!==E||t[28]!==d?(D=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[d,E]}),t[27]=E,t[28]=d,t[29]=D):D=t[29],D}),Ct=/^([^:=]+)[:=](.*)$/;function wt(e){let t=e.trim();if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}))}catch{}let n=[];for(let e of t.split(/\r?\n/)){let t=e.trim();if(!t)continue;let r=Ct.exec(t);r&&n.push({key:r[1].trim(),value:r[2].trim()})}return n.length>0?n:null}function Tt(e){let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return Object.keys(t).length>0?t:void 0}function Et(e){if(!e||typeof e!=`object`)return[{key:``,value:``}];let t=Object.entries(e).map(([e,t])=>({key:e,value:t==null?``:String(t)}));return t.length>0?t:[{key:``,value:``}]}function Dt(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e.xopcConnector;return!!(t&&typeof t==`object`&&!Array.isArray(t)&&t.managed===!0)}function Ot(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=(t&&typeof t==`object`?t:{}).servers,r={};if(!n||typeof n!=`object`||Array.isArray(n))return r;for(let[e,t]of Object.entries(n))!t||typeof t!=`object`||Array.isArray(t)||Dt(t)&&(r[e]=t);return r}function kt(e){let t=e.trim();if(t)return t.split(/\s+/).filter(Boolean)}function At(e){let t=e.trim();if(!t)return;let n=JSON.parse(t);if(!n||typeof n!=`object`||Array.isArray(n))throw Error(`Expected a JSON object`);return n}function jt(e){if(e.transport===`stdio`){let t={command:e.command.trim()},n=kt(e.argsText);return n?.length&&(t.args=n),e.cwd.trim()&&(t.cwd=e.cwd.trim()),e.envJson.trim()&&(t.env=At(e.envJson)),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}let t={url:e.url.trim(),transport:e.transport},n=Tt(e.headers);return n&&(t.headers=n),e.transport===`streamable-http`&&e.auth===`oauth`&&(t.auth={type:`oauth`,...e.oauthClientId.trim()?{clientId:e.oauthClientId.trim()}:{}}),e.connectionTimeoutMs!=null&&Number.isFinite(e.connectionTimeoutMs)&&(t.connectionTimeoutMs=e.connectionTimeoutMs),e.requestTimeoutMs!=null&&Number.isFinite(e.requestTimeoutMs)&&(t.requestTimeoutMs=e.requestTimeoutMs),t}function Mt(e,t){let n=typeof t.url==`string`&&t.url.trim().length>0,r=typeof t.transport==`string`?t.transport.trim().toLowerCase():``,i=n?r===`sse`?`sse`:`streamable-http`:`stdio`,a=t.headers&&typeof t.headers==`object`&&!Array.isArray(t.headers)?t.headers:void 0,o=t.auth&&typeof t.auth==`object`&&!Array.isArray(t.auth)?t.auth:void 0,s=o?.type===`oauth`?`oauth`:`none`;return{clientKey:e,id:e,transport:i,command:typeof t.command==`string`?t.command:``,argsText:Array.isArray(t.args)?t.args.map(String).join(` `):``,envJson:t.env&&typeof t.env==`object`?JSON.stringify(t.env,null,2):``,cwd:typeof t.cwd==`string`?t.cwd:typeof t.workingDirectory==`string`?t.workingDirectory:``,url:typeof t.url==`string`?t.url:``,headers:Et(a),auth:s,oauthClientId:typeof o?.clientId==`string`?o.clientId:``,connectionTimeoutMs:typeof t.connectionTimeoutMs==`number`&&Number.isFinite(t.connectionTimeoutMs)?t.connectionTimeoutMs:void 0,requestTimeoutMs:typeof t.requestTimeoutMs==`number`&&Number.isFinite(t.requestTimeoutMs)?t.requestTimeoutMs:void 0}}function Nt(e=``){return{clientKey:crypto.randomUUID(),id:e,transport:`stdio`,command:``,argsText:``,envJson:``,cwd:``,url:``,headers:[{key:`Authorization`,value:``}],auth:`none`,oauthClientId:``,connectionTimeoutMs:void 0,requestTimeoutMs:void 0}}function Pt(e){let t=e&&typeof e==`object`&&`mcp`in e?e.mcp:void 0,n=t&&typeof t==`object`?t:{},r=n.servers,i=r&&typeof r==`object`&&!Array.isArray(r)?Object.entries(r).flatMap(([e,t])=>!t||typeof t!=`object`||Array.isArray(t)||Dt(t)?[]:[Mt(e,t)]).sort((e,t)=>e.id.localeCompare(t.id)):[],a=typeof n.sessionIdleTtlMs==`number`?n.sessionIdleTtlMs:void 0;return{sessionIdleTtlMinutes:a==null?void 0:a===0?0:Math.round(a/6e4),servers:i}}function Ft(e){return jt(e)}async function It(e,t={}){let n={};for(let r of e.servers){let e=r.id.trim();if(e){if(t[e])throw Error(`Server id "${e}" is reserved by an installed connector.`);n[e]=jt(r)}}let r={servers:{...t,...n}};e.sessionIdleTtlMinutes!=null&&Number.isFinite(e.sessionIdleTtlMinutes)&&(r.sessionIdleTtlMs=e.sessionIdleTtlMinutes===0?0:Math.round(e.sessionIdleTtlMinutes*6e4)),await x(C(`/api/config`),{method:`PATCH`,body:JSON.stringify({mcp:r})}),F()}async function Lt(e,t,n=``){let r=await x(C(`/api/mcp/servers/${encodeURIComponent(e)}/oauth${n}`),{method:t});if(!r.payload)throw Error(r.error??`MCP OAuth request failed`);return r.payload}function Rt(e){return Lt(e,`GET`)}function zt(e){return Lt(e,`POST`,`/start`)}function Bt(e){return Lt(e,`DELETE`)}function Vt(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();if(!r)continue;let i=typeof e.shortName==`string`&&e.shortName.trim()?e.shortName.trim():void 0,a=typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0;t.push({name:r,shortName:i,description:a})}return t}function Ht(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.uri!=`string`||typeof e.name!=`string`)continue;let r=e.uri.trim(),i=e.name.trim();!r||!i||t.push({uri:r,name:i,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,mimeType:typeof e.mimeType==`string`&&e.mimeType.trim()?e.mimeType.trim():void 0})}return t}function Ut(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(typeof e.name!=`string`)continue;let r=e.name.trim();r&&t.push({name:r,title:typeof e.title==`string`&&e.title.trim()?e.title.trim():void 0,description:typeof e.description==`string`&&e.description.trim()?e.description.trim():void 0,argumentCount:typeof e.argumentCount==`number`?e.argumentCount:0})}return t}async function Wt(e,t){let n=await x(C(`/api/mcp/servers/${encodeURIComponent(e)}/test`),{method:`POST`,body:t?JSON.stringify({server:t}):void 0});if(!n.payload)throw Error(n.error??`MCP test failed`);let r=Vt(n.payload.tools),i=Ht(n.payload.resources),a=Ut(n.payload.prompts);return{serverId:n.payload.serverId??e,toolCount:typeof n.payload.toolCount==`number`?n.payload.toolCount:r.length,resourceCount:typeof n.payload.resourceCount==`number`?n.payload.resourceCount:i.length,promptCount:typeof n.payload.promptCount==`number`?n.payload.promptCount:a.length,tools:r,resources:i,prompts:a}}function Gt(e){return e.connectionTimeoutMs==null||!Number.isFinite(e.connectionTimeoutMs)?``:String(Math.round(e.connectionTimeoutMs/1e3))}function Kt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>600))return n*1e3}function qt(e){return e.requestTimeoutMs==null||!Number.isFinite(e.requestTimeoutMs)?``:String(Math.round(e.requestTimeoutMs/1e3))}function Jt(e){let t=e.trim();if(!t)return;let n=Number.parseInt(t,10);if(!(!Number.isFinite(n)||n<1||n>14400))return n*1e3}function Yt(e){if(e.transport===`stdio`){let t=e.command.trim();if(!t)return``;let n=e.argsText.trim();return n?`${t} ${n}`:t}return e.url.trim()}function Xt({row:e,t,cs:n,onEdit:r,onRemove:i}){let[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(!1),y=Yt(e),b=e.transport===`streamable-http`&&e.auth===`oauth`;(0,Z.useEffect)(()=>{if(!b){h(null);return}let t=!1,n=async()=>{try{let n=await Rt(e.id.trim());t||(h(n),n.status===`error`&&n.session?.error&&p(n.session.error),n.status===`connected`&&p(null))}catch(e){t||p(e instanceof Error?e.message:String(e))}};n();let r=window.setInterval(()=>{m?.status===`authorizing`&&n()},1e3);return()=>{t=!0,window.clearInterval(r)}},[m?.status,e.id,b]);let x=(0,Z.useCallback)(async()=>{v(!0),p(null);let n=tt();try{let r=await zt(e.id.trim());h(r),r.status===`error`&&r.session?.error&&p(r.session.error),r.status===`connected`&&p(null);let i=r.session?.authorizationUrl;i?await et(i,n)||p(t.oauthOpenFailed):nt(n)}catch(e){nt(n),p(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e.id,t.oauthOpenFailed]),S=(0,Z.useCallback)(async()=>{v(!0),p(null);try{h(await Bt(e.id.trim()))}catch(e){p(e instanceof Error?e.message:String(e))}finally{v(!1)}},[e.id]),C=(0,Z.useCallback)(async()=>{o(!0),p(null);try{let t=await Wt(e.id.trim());u({toolCount:t.toolCount,resourceCount:t.resourceCount,promptCount:t.promptCount})}catch(e){p(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e.id]),w=(0,Z.useCallback)(async()=>{c(!0),p(null);try{await i()}catch(e){p(e instanceof Error?e.message:String(e)),c(!1)}},[i]);return(0,$.jsxs)(`div`,{className:`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,onClick:r,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.id.trim()||t.cardUntitled}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:n.customBadge}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:t.transportLabels[e.transport]}),b&&m?(0,$.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:t.oauthStatus[m.status===`not_configured`?`disconnected`:m.status]}):null]}),y?(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 break-all font-mono text-xs leading-5 text-fg-subtle`,title:y,children:y}):null,f?(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:f}):null,l?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:X(n.customCapabilitySummary,{tools:String(l.toolCount),resources:String(l.resourceCount),prompts:String(l.promptCount)})}):null]}),(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n.connectorDetails}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[b&&m?.status!==`connected`?(0,$.jsxs)(g,{variant:`secondary`,disabled:_,onClick:()=>void x(),children:[_?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(H,{className:`size-4`}),m?.status===`authorizing`?t.oauthOpenAuthorization:t.oauthConnect]}):(0,$.jsxs)(g,{variant:`secondary`,disabled:a,onClick:()=>void C(),children:[a?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),t.testConnection]}),b&&m?.status===`connected`?(0,$.jsxs)(g,{variant:`ghost`,disabled:_,onClick:()=>void S(),children:[_?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(de,{className:`size-4`}),t.oauthDisconnect]}):null,(0,$.jsxs)(g,{variant:`ghost`,disabled:s,onClick:()=>void w(),children:[s?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),t.removeServer]})]})]})]})}function Zt(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function Qt(e,t,n){let r=t.trim().toLowerCase();if(!r)return!0;let i=e.shortName||Zt(e.name,n);return[e.name,i,e.description].filter(Boolean).join(`
|
|
2
|
+
`).toLowerCase().includes(r)}function $t(e,t){return e?t&&e.startsWith(t)?e.slice(t.length):e:``}function en(e){let t=(0,Q.c)(29),{tools:n,stripPrefix:r,searchPlaceholder:i,searchEmptyLabel:a}=e,[o,s]=(0,Z.useState)(``),c;if(t[0]!==o||t[1]!==r||t[2]!==n){let e;t[4]!==o||t[5]!==r?(e=e=>Qt(e,o,r),t[4]=o,t[5]=r,t[6]=e):e=t[6],c=n.filter(e),t[0]=o,t[1]=r,t[2]=n,t[3]=c}else c=t[3];let l=c,u;t[7]===o?u=t[8]:(u=o.trim(),t[7]=o,t[8]=u);let d=u.length>0,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(p,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[9]=f):f=t[9];let m,g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(m=h(`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg`,`placeholder:text-fg-subtle`,_),g=e=>s(e.target.value),t[10]=m,t[11]=g):(m=t[10],g=t[11]);let v;t[12]!==o||t[13]!==i?(v=(0,$.jsxs)(`div`,{className:`relative`,children:[f,(0,$.jsx)(`input`,{type:`search`,value:o,placeholder:i,"aria-label":i,className:m,onChange:g})]}),t[12]=o,t[13]=i,t[14]=v):v=t[14];let y;t[15]!==l.length||t[16]!==d||t[17]!==n.length?(y=d?(0,$.jsxs)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:[l.length,` / `,n.length]}):null,t[15]=l.length,t[16]=d,t[17]=n.length,t[18]=y):y=t[18];let b;t[19]!==v||t[20]!==y?(b=(0,$.jsxs)(`div`,{className:`border-b border-edge px-5 py-3`,children:[v,y]}),t[19]=v,t[20]=y,t[21]=b):b=t[21];let x;t[22]!==l||t[23]!==a||t[24]!==r?(x=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map((e,t)=>{let n=e.shortName||$t(e.name,r)||e.name||`?`,i=e.name||`tool-${t}`;return(0,$.jsxs)(`li`,{className:`min-w-0 rounded-lg border border-edge bg-surface-base px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`truncate font-mono text-sm font-medium text-fg`,title:e.name===n?n:e.name,children:n}),e.description?(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs leading-relaxed text-fg-muted`,title:e.description,children:e.description}):null]},i)})})}),t[22]=l,t[23]=a,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==b||t[27]!==x?(S=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[b,x]}),t[26]=b,t[27]=x,t[28]=S):S=t[28],S}function tn(e){let t=(0,Q.c)(38),{open:n,onOpenChange:r,serverId:i,title:a,subtitle:o,searchPlaceholder:s,searchEmptyLabel:c,emptyLabel:l,closeLabel:u,tools:d,stripPrefix:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(O,{className:h(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,E)}),t[0]=p):p=t[0];let _;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=h(`fixed left-1/2 top-1/2 flex max-h-[min(88vh,40rem)] w-[min(100%-2rem,min(92vw,36rem))] -translate-x-1/2 -translate-y-1/2 flex-col`,T,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none dark:border-edge`),t[1]=_):_=t[1];let v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(re,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[2]=v):v=t[2];let y;t[3]===a?y=t[4]:(y=(0,$.jsxs)(N,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[v,a]}),t[3]=a,t[4]=y);let b;t[5]!==i||t[6]!==o||t[7]!==d.length?(b=o.replace(`{{serverId}}`,i).replace(`{{count}}`,String(d.length)),t[5]=i,t[6]=o,t[7]=d.length,t[8]=b):b=t[8];let x;t[9]===b?x=t[10]:(x=(0,$.jsx)(k,{className:`mt-1 text-sm text-fg-muted`,children:b}),t[9]=b,t[10]=x);let S;t[11]!==y||t[12]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,x]}),t[11]=y,t[12]=x,t[13]=S):S=t[13];let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(m,{className:`size-4`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===u?w=t[16]:(w=(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 px-0`,"aria-label":u,children:C})}),t[15]=u,t[16]=w);let D;t[17]!==S||t[18]!==w?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[S,w]}),t[17]=S,t[18]=w,t[19]=D):D=t[19];let F;t[20]!==l||t[21]!==n||t[22]!==c||t[23]!==s||t[24]!==i||t[25]!==f||t[26]!==d?(F=d.length>0?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,$.jsx)(en,{tools:d,stripPrefix:f,searchPlaceholder:s,searchEmptyLabel:c},`${i}-${n?`open`:`closed`}`)}):(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:l})}),t[20]=l,t[21]=n,t[22]=c,t[23]=s,t[24]=i,t[25]=f,t[26]=d,t[27]=F):F=t[27];let I;t[28]===u?I=t[29]:(I=(0,$.jsx)(`div`,{className:`flex justify-end border-t border-edge px-5 py-3`,children:(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(g,{type:`button`,variant:`secondary`,children:u})})}),t[28]=u,t[29]=I);let L;t[30]!==D||t[31]!==F||t[32]!==I?(L=(0,$.jsxs)(j,{children:[p,(0,$.jsxs)(M,{className:_,children:[D,F,I]})]}),t[30]=D,t[31]=F,t[32]=I,t[33]=L):L=t[33];let R;return t[34]!==r||t[35]!==n||t[36]!==L?(R=(0,$.jsx)(P,{open:n,onOpenChange:r,children:L}),t[34]=r,t[35]=n,t[36]=L,t[37]=R):R=t[37],R}function nn(e){let t=e.connectedAt?Date.parse(e.connectedAt):0;return Number.isFinite(t)?t:0}function rn(e,t){return e.status===`active`&&t.status!==`active`?-1:e.status!==`active`&&t.status===`active`?1:e.isCurrentAuthorization===t.isCurrentAuthorization?e.isDefault===t.isDefault?nn(t)-nn(e):e.isDefault?-1:1:e.isCurrentAuthorization?-1:1}function an(e){let t=new Map;for(let n of e){let e=n.accountId??n.identityKey??`authorization:${n.id}`;t.set(e,[...t.get(e)??[],n])}return[...t.entries()].map(([e,t])=>{let n=[...t].sort(rn);return{key:e,primary:n[0],authorizations:n}}).sort((e,t)=>rn(e.primary,t.primary))}var on=h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function sn(e){return e.materialized.type===`composio`?e.materialized.toolkit:null}function cn(e,t){return e===`write`?t.composioScopeWrite:e===`admin`?t.composioScopeAdmin:t.composioScopeRead}function ln(e,t){return e.errorCode===`missing_credential`?t.composioHealthMissingCredential:e.errorCode===`unauthorized`?t.composioHealthUnauthorized:e.errorCode===`forbidden`?t.composioHealthForbidden:e.errorCode===`network`?t.composioHealthNetwork:e.errorCode===`timeout`?t.composioHealthTimeout:t.composioHealthDegraded}function un(e,t){return e===`active`?t.composioConnectionHealthy:e===`pending`?t.composioConnectionPending:e===`expired`?t.composioConnectionExpired:e===`failed`?t.composioConnectionFailed:e===`revoked`||e===`disabled`?t.composioConnectionRevoked:t.composioConnectionUnknown}function dn(e,t,n){return e.status===`paused`?t?.scanEnabled===!1?n.connectorLearningPausedByPolicy:n.connectorLearningPausedByFailure:e.status===`queued`?n.connectorLearningQueued:e.status===`running`?n.connectorLearningRunning:e.status===`completed`?n.connectorLearningCompleted:n.connectorLearningFailed}function fn({instance:e,t,onChanged:n}){let r=sn(e),[i,a]=(0,Z.useState)([]),[l,u]=(0,Z.useState)([]),[f,p]=(0,Z.useState)([]),[_,v]=(0,Z.useState)([]),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)([]),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(null),[O,k]=(0,Z.useState)([]),[A,j]=(0,Z.useState)({}),[M,N]=(0,Z.useState)(`read`),[P,F]=(0,Z.useState)(!1),[I,L]=(0,Z.useState)(null),R=(0,Z.useMemo)(()=>an(i),[i]),z=(0,Z.useCallback)(async()=>{if(!(!r||e.materialized.type!==`composio`||e.materialized.role===`credential`)){F(!0),L(null);try{let[t,n,i,o,s,c,l,d,f]=await Promise.all([ae().catch(()=>[]),ie(r).catch(()=>[]),q(20).catch(()=>[]),ne(r).catch(()=>`read`),Le().catch(()=>[]),ye(r).catch(()=>null),Xe(r).catch(()=>null),ee().catch(()=>[]),Je(r).catch(()=>null)]);a(t.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())),u(n),p(i.filter(e=>!e.toolkit||e.toolkit.toLowerCase()===r.toLowerCase())),N(o),v(s.filter(t=>t.connectorId===e.connectorId)),b(c?.policy??null),S(c?.agents??[]),w(l),k(d),E(f);let m=an(t.filter(e=>e.toolkit.toLowerCase()===r.toLowerCase())).map(e=>e.primary).filter(e=>!!e.accountId),h=await Promise.all(m.map(async e=>[e.accountId,await xe(e.accountId)]).map(e=>e.catch(()=>null)));j(Object.fromEntries(h.filter(e=>e!==null)))}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[e.connectorId,e.materialized,r]);(0,Z.useEffect)(()=>{z()},[z]);let B=(0,Z.useCallback)(async()=>{if(r){F(!0),L(null);try{let t=await ve(e.connectorId);if(!t.authorizationUrl)throw Error(`The authorization provider did not return an authorization URL.`);if(D()){let e=await window.electronAPI?.shell?.openExternalUrl(t.authorizationUrl);if(!e?.ok)throw Error(e?.error??`Could not open the system browser.`)}else window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`);let i=await se(r,t.connectionId);if(!i.accountId)throw Error(`Connector account is unavailable.`);await fe(i.accountId),await n?.(),await z()}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}}},[e.connectorId,z,n,r]),V=(0,Z.useCallback)(async t=>{F(!0),L(null);try{await Se(e.instanceId,{config:{...e.config??{},...t?{authConfigId:t}:{authConfigId:void 0}}}),await n?.(),await z()}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}},[e.config,e.instanceId,z,n]),H=(0,Z.useCallback)(async e=>{if(r){N(e);try{await le(r,e),await z()}catch(e){L(e instanceof Error?e.message:String(e))}}},[z,r]),U=(0,Z.useCallback)(async(e,t)=>{F(!0),L(null);try{await J(e,t),await z()}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}},[z]),W=(0,Z.useCallback)(async e=>{if(r){L(null);try{b(await ce(r,e))}catch(e){L(e instanceof Error?e.message:String(e))}}},[e.connectorId,r]),te=(0,Z.useCallback)(e=>{y&&W({allowedAgentIds:y.allowedAgentIds.includes(e)?y.allowedAgentIds.filter(t=>t!==e):[...y.allowedAgentIds,e]})},[W,y]),K=(0,Z.useCallback)(async e=>{F(!0),L(null);try{await e(),await z()}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}},[z]);return r?e.materialized.type===`composio`&&e.materialized.role===`credential`?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:t.composioApiKeyStored}):(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:X(t.composioToolkitTitle,{toolkit:r})}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:t.composioScopeHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(g,{variant:`secondary`,disabled:P,onClick:()=>void B(),children:[P?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(He,{className:`size-4`}),t.connectOAuth]}),(0,$.jsx)(g,{variant:`ghost`,disabled:P,onClick:()=>void z(),children:t.refresh})]})]}),I?(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:I}):null,T?(0,$.jsxs)(`div`,{className:`mt-3 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:t.composioAuthConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:T.requiresCustomAuthConfig?t.composioAuthConfigRequiredHint:t.composioAuthConfigOptionalHint})]}),(0,$.jsx)(`a`,{className:`text-xs font-medium text-accent-fg hover:underline`,href:`https://app.composio.dev`,target:`_blank`,rel:`noreferrer`,children:t.composioAuthConfigManage})]}),(0,$.jsxs)(s,{className:h(on,`mt-2 h-9 py-1`),value:typeof e.config?.authConfigId==`string`?e.config.authConfigId:``,disabled:P,onChange:e=>void V(e.currentTarget.value),children:[T.requiresCustomAuthConfig?null:(0,$.jsx)(c,{value:``,children:t.composioAuthConfigManaged}),T.requiresCustomAuthConfig&&typeof e.config?.authConfigId!=`string`?(0,$.jsx)(c,{value:``,disabled:!0,children:t.composioAuthConfigSelect}):null,T.authConfigs.filter(e=>e.status===`ENABLED`&&e.isEnabledForToolRouter).map(e=>(0,$.jsxs)(c,{value:e.id,children:[e.name,` · `,e.authScheme??`OAuth`,` · `,e.id]},e.id))]}),T.requiresCustomAuthConfig&&T.authConfigs.every(e=>e.status!==`ENABLED`||!e.isEnabledForToolRouter)?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-amber-700 dark:text-amber-300`,children:t.composioAuthConfigEmpty}):null]}):null,C?(0,$.jsxs)(`div`,{className:h(`mt-3 flex flex-wrap items-center justify-between gap-2 rounded-lg border px-3 py-2 text-xs`,C.status===`connected`?`border-emerald-500/30 bg-emerald-500/5 text-emerald-700`:`border-amber-500/30 bg-amber-500/5 text-amber-700`),children:[(0,$.jsx)(`span`,{children:C.status===`connected`?X(t.composioHealthConnected,{count:String(R.filter(e=>e.primary.status===`active`).length)}):C.status===`reauthorization_required`?t.composioHealthReconnect:C.status===`degraded`?ln(C,t):t.composioHealthDisconnected}),C.recovery===`none`?null:(0,$.jsx)(g,{variant:`ghost`,disabled:P,onClick:()=>void(C.recovery===`retry`?z():B()),children:C.recovery===`retry`?t.composioRetry:t.connectOAuth}),C.status===`degraded`&&C.message?(0,$.jsx)(`p`,{className:`basis-full break-words text-[11px] opacity-80`,children:C.message}):null]}):null,y?(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg border border-edge bg-surface-panel p-3 md:grid-cols-3`,children:[(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioAccessTitle,(0,$.jsxs)(s,{className:h(on,`mt-1 h-9 py-1`),value:M,onChange:e=>void H(e.currentTarget.value),children:[(0,$.jsx)(c,{value:`read`,children:t.composioAccessReadOnly}),(0,$.jsx)(c,{value:`write`,children:t.composioAccessReadWrite}),M===`admin`?(0,$.jsx)(c,{value:`admin`,children:t.composioAccessAdminCurrent}):null]}),(0,$.jsx)(`span`,{className:`mt-1 block font-normal leading-4 text-fg-muted`,children:M===`read`?t.composioAccessReadHint:M===`admin`?t.composioAccessAdminHint:t.composioAccessWriteHint})]}),(0,$.jsxs)(`label`,{className:`text-xs font-medium text-fg-subtle`,children:[t.composioConfirmationPolicy,(0,$.jsxs)(s,{className:h(on,`mt-1 h-9 py-1`),value:y.confirmationPolicy,onChange:e=>void W({confirmationPolicy:e.currentTarget.value}),children:[(0,$.jsx)(c,{value:`writes`,children:t.composioConfirmWrites}),(0,$.jsx)(c,{value:`always`,children:t.composioConfirmAlways}),y.confirmationPolicy===`never`?(0,$.jsx)(c,{value:`never`,children:t.composioConfirmNever}):null]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.composioAllowedAgents}),(0,$.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:y.allowedAgentIds.length?t.composioAllowedAgentsSelected:t.composioAllowedAgentsAll}),(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:x.map(e=>(0,$.jsx)(`button`,{type:`button`,className:h(`rounded-full border px-2.5 py-1 text-xs transition-colors`,y.allowedAgentIds.includes(e.id)?`border-accent bg-accent/10 text-accent`:`border-edge text-fg-muted hover:text-fg`),onClick:()=>te(e.id),children:e.name},e.id))})]})]}):null,_.length?(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioPendingApprovals}),_.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/5 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs font-medium text-fg`,children:e.actionId}),(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs text-fg-subtle`,children:JSON.stringify(e.argumentsPreview)}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:X(t.composioApprovalExpires,{time:new Date(e.expiresAt).toLocaleTimeString()})})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,$.jsxs)(g,{variant:`secondary`,disabled:P,onClick:()=>void U(e.id,`denied`),children:[(0,$.jsx)(m,{className:`size-4`}),t.composioDeny]}),(0,$.jsxs)(g,{disabled:P,onClick:()=>void U(e.id,`approved`),children:[(0,$.jsx)(o,{className:`size-4`}),t.approve]})]})]},e.id))]}):null,(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioConnections}),R.length?[{title:t.composioConnectedAccounts,items:R.filter(e=>e.primary.status===`active`)},{title:t.composioNeedsAttention,items:R.filter(e=>e.primary.status!==`active`)}].filter(e=>e.items.length>0).map(e=>(0,$.jsxs)(`section`,{className:`mb-3 space-y-2`,children:[(0,$.jsxs)(`h4`,{className:`text-xs font-medium text-fg-muted`,children:[e.title,` · `,e.items.length]}),e.items.map(e=>{let i=e.primary,a=O.find(e=>i.accountId?e.accountId===i.accountId:e.connectionId===i.id),o=i.accountId?A[i.accountId]:void 0;return(0,$.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-panel p-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i.alias??i.workspace??i.accountEmail??i.username??t.composioUnnamedAuthorization}),i.connectedAt?(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:X(t.composioAuthorizedAt,{time:new Date(i.connectedAt).toLocaleString()})}):null,(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[X(t.composioAuthorizationCount,{count:String(e.authorizations.length)}),e.authorizations.length>1?` · ${X(t.composioDuplicateAuthorizations,{count:String(e.authorizations.length-1)})}`:``]})]}),(0,$.jsxs)(`span`,{className:h(`shrink-0 rounded-full px-2 py-0.5 text-xs font-medium`,i.status===`active`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-700 dark:text-amber-300`),children:[un(i.status,t),i.isDefault?` · ${t.composioDefaultAccount}`:``]})]}),a||i.status===`active`?(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-3`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:t.connectorLearningTitle}),(0,$.jsx)(`p`,{className:h(`mt-1 text-xs`,a?.status===`failed`?`text-red-600`:`text-fg-subtle`),children:a?X(t.connectorLearningStatus,{status:dn(a,o,t),count:String(a.candidatesCreated)}):t.connectorLearningEmpty}),o?(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o.scanEnabled,disabled:P,onChange:e=>void K(()=>Te(i.accountId,{scanEnabled:e.currentTarget.checked}))}),t.connectorScheduledScan]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:o.proactiveEnabled,disabled:P||!o.scanEnabled,onChange:e=>void K(()=>Te(i.accountId,{proactiveEnabled:e.currentTarget.checked}))}),t.connectorProactiveUse]}),o.scanEnabled?(0,$.jsxs)(`label`,{className:`text-xs text-fg-subtle sm:col-span-2`,children:[t.connectorScanInterval,(0,$.jsxs)(s,{className:h(on,`mt-1 h-8 py-1 text-xs`),value:String(o.intervalMinutes??30),disabled:P,onChange:e=>void K(()=>Te(i.accountId,{intervalMinutes:Number(e.currentTarget.value)})),children:[(0,$.jsxs)(c,{value:`5`,children:[`5 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`15`,children:[`15 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`30`,children:[`30 `,t.connectorMinutes]}),(0,$.jsxs)(c,{value:`60`,children:[`60 `,t.connectorMinutes]})]})]}):null]}):null]}):null,(0,$.jsxs)(`details`,{className:`text-xs text-fg-subtle`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 rounded-lg bg-surface-base p-2`,children:[e.authorizations.map(e=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`p`,{className:`min-w-0 break-all font-mono`,children:[t.composioAuthorizationId,`: `,e.providerConnectionId]}),(0,$.jsx)(g,{variant:`ghost`,className:`size-7 shrink-0 p-0`,title:t.composioRevoke,disabled:P,onClick:()=>{window.confirm(t.composioRevokeConfirm)&&K(()=>oe(e.id))},children:(0,$.jsx)(G,{className:`size-3.5 text-red-500`})})]},e.id)),(0,$.jsx)(`input`,{className:h(on,`h-8 py-1 text-xs`),defaultValue:i.alias??``,placeholder:t.composioAccountAlias,onBlur:e=>{e.currentTarget.value!==(i.alias??``)&&K(()=>we(i.id,{alias:e.currentTarget.value}))}})]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(g,{variant:`ghost`,className:`size-8 p-0`,title:t.composioMakeDefault,disabled:P||i.isDefault||i.status!==`active`,onClick:()=>void K(async()=>{await we(i.id,{isDefault:!0}),r&&await ce(r,{selectedConnectionIds:[i.id]})}),children:(0,$.jsx)(Ee,{className:h(`size-4`,i.isDefault&&`fill-current`)})}),(0,$.jsx)(g,{variant:`ghost`,className:`size-8 p-0`,title:t.refresh,disabled:P,onClick:()=>void K(()=>me(i.id)),children:(0,$.jsx)(Be,{className:`size-4`})}),i.status===`active`?(0,$.jsxs)(g,{variant:`secondary`,disabled:P,onClick:()=>void K(async()=>{if(!i.accountId)throw Error(`Connector account is unavailable.`);await fe(i.accountId),await n?.()}),children:[P?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(Be,{className:`size-4`}),t.composioSyncNow]}):null]})]},e.key)})]},e.title)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioConnectionsEmpty})]})}),(0,$.jsxs)(`details`,{className:`mt-4 rounded-lg border border-edge bg-surface-panel p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:t.composioAdvancedSettings}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(`div`,{className:`space-y-3`,children:(0,$.jsxs)(`label`,{className:`block text-xs text-fg-subtle`,children:[t.composioAdvancedScope,(0,$.jsxs)(s,{className:h(on,`mt-1 h-9 py-1`),value:M,onChange:e=>void H(e.currentTarget.value),children:[(0,$.jsx)(c,{value:`read`,children:t.composioScopeRead}),(0,$.jsx)(c,{value:`write`,children:t.composioScopeWrite}),(0,$.jsx)(c,{value:`admin`,children:t.composioScopeAdmin})]})]})}),(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioAgentTools}),l.length?l.slice(0,8).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,$.jsx)(`p`,{className:`truncate font-mono text-xs text-fg`,children:e.slug}),(0,$.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[cn(e.scope,t),e.curated?``:` ${t.composioUncuratedSuffix}`]})]},e.slug)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioToolsEmpty})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`mb-2 text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:t.composioRecentTriggers}),f.length?f.slice(0,5).map(e=>(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-base p-2`,children:[(0,$.jsx)(`p`,{className:`truncate text-xs text-fg`,children:e.trigger??e.id}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:new Date(e.at).toLocaleString()})]},`${e.id}-${e.at}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.composioTriggersEmpty})]})]})]})]})]}):null}var pn=h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_);function mn(e,t){return e?t.healthStatusLabels[e]??e:t.healthNotTested}function hn(e,t){let n={};for(let r of e?.setup.config??[]){let e=t.config?.[r.key]??r.defaultValue??``;n[r.key]=typeof e==`string`?e:JSON.stringify(e,null,2)}return n}function gn(e,t){let n=t.trim();return e===`json`?n?JSON.parse(n):void 0:e===`number`?n?Number(n):void 0:e===`boolean`?n===`true`:n||void 0}function _n(e){let t=(0,Q.c)(12),{title:n,description:r,meta:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,$.jsx)(B,{delayDuration:300,skipDelayDuration:100,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,title:r,className:h(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:r})}),(0,$.jsx)(z,{children:(0,$.jsx)(V,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:r})})})]})}):null,t[0]=r,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=(0,$.jsx)(`p`,{className:`min-w-0 break-all font-mono text-xs font-medium leading-5 text-fg`,children:n}),t[2]=n,t[3]=s);let c;t[4]===i?c=t[5]:(c=i?(0,$.jsx)(`span`,{className:`shrink-0 rounded-md bg-surface-hover px-1.5 py-0.5 text-[11px] leading-4 text-fg-subtle`,children:i}):null,t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==o||t[10]!==l?(u=(0,$.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,o]}),t[9]=o,t[10]=l,t[11]=u):u=t[11],u}function vn({instance:e,definition:t,onClose:n,onChanged:r,t:i,mcp:a}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[u,f]=(0,Z.useState)(!1),[p,_]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(e.materialized.type===`mcp`?`health`:`permissions`),[T,E]=(0,Z.useState)(!1),[D,F]=(0,Z.useState)(()=>hn(t,e)),[I,L]=(0,Z.useState)(null),R=t?.setup.config??[],z=(e.materialized.type===`mcp`||e.materialized.type===`memorySource`)&&R.length>0&&(t?.setup.secrets??[]).length===0,B=x?x.toolCount:e.usage.lastToolCount,V=(0,Z.useMemo)(()=>{let t=e.materialized.type===`mcp`?[[`health`,ke,i.detailHealth],[`tools`,re,`${i.detailTools} ${x?x.toolCount:e.usage.lastToolCount??``}`],[`resources`,he,`${i.detailResources} ${x?x.resourceCount:e.usage.lastResourceCount??``}`],[`prompts`,_e,`${i.detailPrompts} ${x?x.promptCount:e.usage.lastPromptCount??``}`],[`permissions`,He,i.detailPermissions]]:[[`permissions`,He,i.detailPermissions]];return z?[...t,[`config`,he,i.connectorConfigLabel]]:t},[x,e.materialized.type,e.usage.lastPromptCount,e.usage.lastResourceCount,e.usage.lastToolCount,z,i]),H=(0,Z.useCallback)(async()=>{s(!0),L(null);try{let t=await te(e.instanceId);S(t),t.toolCount>0&&w(`tools`),r()}catch(e){L(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e.instanceId,r]),U=(0,Z.useCallback)(async()=>{l(!0),L(null);try{await ge(e.instanceId),await r(),n()}catch(e){L(e instanceof Error?e.message:String(e)),l(!1)}},[e.instanceId,r,n]),ee=(0,Z.useCallback)(async()=>{if(!(!t||!z)){f(!0),L(null);try{let n={};for(let e of t.setup.config??[]){let t=gn(e.type,D[e.key]??``);t!==void 0&&(n[e.key]=t)}await Se(e.instanceId,{config:n}),await r(),w(`health`)}catch(e){L(e instanceof Error?e.message:String(e))}finally{f(!1)}}},[D,t,e.instanceId,r,z]),W=(0,Z.useCallback)(async()=>{_(!0),b(null),L(null);try{b((await Qe(e.connectorId)).recordIds.length),await r()}catch(e){L(e instanceof Error?e.message:String(e))}finally{_(!1)}},[e.connectorId,r]);return(0,$.jsxs)(P,{open:!0,onOpenChange:e=>{e||n()},children:[(0,$.jsxs)(j,{children:[(0,$.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(M,{className:h(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,54rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float outline-none dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(Pe,{connector:t,size:`lg`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(N,{className:`text-base font-semibold text-fg`,children:e.displayName}),(0,$.jsx)(k,{className:`mt-1 text-sm text-fg-muted`,children:t?.description??(e.materialized.type===`mcp`?X(i.mcpServerRuntime,{serverId:e.materialized.serverId}):X(i.runtimeLabel,{runtime:e.materialized.type}))})]})]}),(0,$.jsx)(A,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:h(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,v.focusRingPanel),"aria-label":i.modalClose,children:[(0,$.jsx)(m,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:i.modalClose})]})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:[I?(0,$.jsx)(`p`,{className:`mb-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:I}):null,(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:V.map(([e,t,n])=>(0,$.jsxs)(`button`,{type:`button`,className:h(`inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-xs`,C===e?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:text-fg`),onClick:()=>w(e),children:[(0,$.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),n]},e))}),(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[C===`health`?(0,$.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,$.jsxs)(`p`,{children:[i.statusLabel,` `,(0,$.jsx)(`span`,{className:x?.ok?`font-medium text-emerald-700 dark:text-emerald-300`:`font-medium text-fg`,children:mn(x?.status??e.usage.lastHealthStatus,i)})]}),(0,$.jsxs)(`p`,{children:[i.lastCheckLabel,` `,e.usage.lastHealthCheckAt?new Date(e.usage.lastHealthCheckAt).toLocaleString():i.never]}),x?.action?(0,$.jsx)(`p`,{children:x.action}):null]}):null,C===`tools`?x?.tools.length?(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:X(i.toolsAvailable,{count:String(x.tools.length)})}),(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`h-7 text-xs`,onClick:()=>E(!0),children:a.viewAllTools})]}),(0,$.jsx)(`div`,{className:`grid gap-2`,children:x.tools.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.shortName??e.name,description:e.description},e.name))})]}):(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`p`,{className:`text-fg-muted`,children:B?X(i.toolsLastCheckSummary,{count:String(B)}):i.toolsRunTestHint}),(0,$.jsxs)(g,{type:`button`,variant:`secondary`,disabled:o,onClick:()=>void H(),children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),i.test]})]}):null,C===`resources`?x?.resources.length?(0,$.jsx)(`div`,{className:`grid gap-2`,children:x.resources.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.title??e.name,description:e.uri,meta:e.mimeType},e.uri))}):(0,$.jsx)(`p`,{className:`text-fg-muted`,children:i.resourcesRunTestHint}):null,C===`prompts`?x?.prompts.length?(0,$.jsx)(`div`,{className:`grid gap-2`,children:x.prompts.slice(0,8).map(e=>(0,$.jsx)(_n,{title:e.title??e.name,description:e.description,meta:e.argumentCount?X(i.promptArgumentCount,{count:String(e.argumentCount)}):void 0},e.name))}):(0,$.jsx)(`p`,{className:`text-fg-muted`,children:i.promptsRunTestHint}):null,C===`permissions`?(0,$.jsxs)(`div`,{className:`space-y-1 text-fg-muted`,children:[(0,$.jsx)(`p`,{children:X(i.secretsConfigured,{count:String(Object.values(e.secretStatus).filter(Boolean).length)})}),(0,$.jsx)(`p`,{children:e.materialized.type===`mcp`?X(i.runtimeServerLabel,{runtime:e.materialized.type.toUpperCase(),serverId:e.materialized.serverId}):X(i.runtimeLabel,{runtime:e.materialized.type.toUpperCase()})}),(0,$.jsx)(`p`,{children:e.materialized.type===`mcp`?i.mcpPolicyHint:i.connectorPolicyHint})]}):null,C===`config`&&z?(0,$.jsx)(`div`,{className:`grid gap-3`,children:R.map(e=>(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.label}),e.description?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.description}):null,(0,$.jsx)(`input`,{className:pn,value:D[e.key]??``,placeholder:e.placeholder,onChange:t=>F(n=>({...n,[e.key]:t.currentTarget.value}))})]},e.key))}):null]}),e.materialized.type===`composio`?(0,$.jsx)(fn,{instance:e,t:i,onChanged:r}):null,e.materialized.type===`memorySource`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge bg-surface-base p-3 text-sm`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i.connectedSourceSync}),(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?.description}),y===null?null:(0,$.jsx)(`p`,{className:`mt-1 text-xs text-emerald-600`,children:X(i.connectedSourceSynced,{count:String(y)})})]}),(0,$.jsxs)(g,{disabled:p,onClick:()=>void W(),children:[p?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(he,{className:`size-4`}),i.composioSyncNow]})]}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsx)(g,{variant:`secondary`,onClick:n,children:i.modalClose}),C===`config`&&z?(0,$.jsxs)(g,{variant:`primary`,disabled:u,onClick:()=>void ee(),children:[u?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(je,{className:`size-4`}),i.modalSave]}):null,e.materialized.type===`mcp`?(0,$.jsxs)(g,{variant:`secondary`,disabled:o,onClick:()=>void H(),children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),i.test]}):null,(0,$.jsxs)(g,{variant:`ghost`,disabled:c,onClick:()=>void U(),children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),i.remove]})]})]})]}),e.materialized.type===`mcp`?(0,$.jsx)(tn,{open:T,onOpenChange:E,serverId:e.materialized.serverId,title:X(i.installedToolsDialogTitle,{name:e.displayName}),subtitle:i.installedToolsDialogSubtitle,searchPlaceholder:a.toolsDialogSearchPlaceholder,searchEmptyLabel:a.toolsDialogSearchEmpty,emptyLabel:i.toolsRunTestHint,closeLabel:a.toolsDialogClose,tools:x?.tools??[],stripPrefix:`${e.materialized.serverId}__`}):null]})}var yn=[`understand`,`act`,`reach`];function bn(e){if(e.benefits?.length)return[...new Set(e.benefits)];let t=new Set(e.capabilities),n=[e.id,e.displayName,...e.tags??[]].join(` `).toLowerCase(),r=[];return(t.has(`context`)||t.has(`memory_source`)||t.has(`resources`)||e.category===`docs`||e.category===`data`||/notion|drive|document|confluence|airtable|database|knowledge|wiki/.test(n))&&r.push(`understand`),t.has(`tools`)&&r.push(`act`),(t.has(`channel`)||/slack|telegram|discord|teams|mail|message|wechat|weixin/.test(n))&&r.push(`reach`),r.length?[...new Set(r)]:[`act`]}function xn(e){return bn(e)[0]??`act`}function Sn(e,t){let n=t?xn(t):`act`,r=e.connectionStatus===`connected`||e.status===`connected`||e.usage.lastHealthStatus===`ok`,i=e.status===`not_configured`||e.status===`failed`||e.status===`degraded`||e.status===`unauthorized`||e.connectionStatus===`unauthorized`||e.connectionStatus===`error`,a=n===`understand`?e.usage.lastResourceCount:n===`act`?e.usage.lastToolCount:void 0;return{benefit:n,state:r?`ready`:i?`needs_setup`:`checking`,availableCount:a}}function Cn({instance:e,definition:t,highlighted:n=!1,onOpenDetails:r,onChanged:i,t:a}){let[o,s]=(0,Z.useState)(!1),[c,l]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(null),m=(0,Z.useCallback)(async()=>{s(!0),p(null);try{await te(e.instanceId),await i()}catch(e){p(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e.instanceId,i]),_=(0,Z.useCallback)(async()=>{l(!0),p(null);try{await ge(e.instanceId),await i()}catch(e){p(e instanceof Error?e.message:String(e)),l(!1)}},[e.instanceId,i]),v=e.usage.lastHealthStatus?a.healthStatusLabels[e.usage.lastHealthStatus]??e.usage.lastHealthStatus:a.healthNotTested,y=e.usage.lastToolCount??0,b=!!(t?.setup.config?.length&&!t.setup.secrets?.length&&e.materialized.type===`mcp`),x=Sn(e,t).state,S=x===`ready`?{label:a.connectionReady,Icon:u,className:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`}:x===`needs_setup`?{label:a.connectionNeedsSetup,Icon:Y,className:`border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300`}:{label:a.connectionChecking,Icon:W,className:`border-edge bg-surface-base text-fg-muted`};return(0,$.jsxs)(`div`,{className:h(`flex h-full min-h-[10.5rem] cursor-pointer flex-col rounded-lg bg-surface-panel p-4 shadow-surface transition-colors hover:bg-surface-hover/45`,n&&`ring-2 ring-accent/45 ring-offset-2 ring-offset-surface-panel`),onClick:()=>r(e),children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[(0,$.jsx)(Pe,{connector:t}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:e.displayName}),(0,$.jsxs)(`span`,{className:h(`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] font-medium`,S.className),children:[(0,$.jsx)(S.Icon,{className:`size-3`,"aria-hidden":!0}),S.label]}),b?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-base px-2 py-0.5 text-[11px] text-fg-muted`,children:a.connectorConfigLabel}):null]}),t?.description?(0,$.jsx)(`p`,{className:`mt-3 line-clamp-2 text-sm leading-5 text-fg-muted`,children:t.description}):null,(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:[a.statusLabel,` `,v]}),(0,$.jsx)(`span`,{className:`rounded-md bg-surface-base px-2 py-1`,children:X(a.toolsAvailable,{count:String(y)})})]}),f?(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:f}):null]})]}),(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-2 border-t border-edge pt-3`,onClick:e=>e.stopPropagation(),children:[(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:a.connectorDetails}),(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[x===`needs_setup`?(0,$.jsxs)(g,{variant:`primary`,onClick:()=>r(e),children:[(0,$.jsx)(Y,{className:`size-4`}),a.connectionResolveAction]}):null,e.materialized.type===`mcp`?(0,$.jsxs)(g,{variant:`secondary`,disabled:o,onClick:()=>void m(),children:[o?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),a.test]}):null,(0,$.jsxs)(g,{variant:`ghost`,disabled:c,onClick:()=>void _(),children:[c?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(G,{className:`size-4`}),a.remove]})]})]})]})}function wn(e,t){let n=e.length+1,r=`server-${n}`,i=new Set([...e.map(e=>e.id.trim()),...t]);for(;i.has(r);)n+=1,r=`server-${n}`;return Nt(r)}function Tn(e,t,n){let r=e.key.trim();if(r)return`key:${r}`;let i=e.value.trim();return i?`value:${i}`:`empty:${n.slice(0,t).filter(e=>!e.key.trim()&&!e.value.trim()).length}`}function En(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_)}function Dn({label:e,optionalLabel:t,addLabel:n,removeHeaderAria:r,pasteLabel:i,pasteFailed:a,keyPlaceholder:o,valuePlaceholder:s,headers:c,onChange:l}){let u=(e,t)=>{l(c.map((n,r)=>r===e?{...n,...t}:n))},d=()=>{l([...c,{key:``,value:``}])},f=e=>{let t=c.filter((t,n)=>n!==e);l(t.length>0?t:[{key:``,value:``}])},p=async()=>{try{let e=await y();if(!e){window.alert(a);return}let t=wt(e);if(!t?.length){window.alert(a);return}l(t)}catch{window.alert(a)}};return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 md:col-span-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:e}),t?(0,$.jsx)(`span`,{className:`font-normal text-fg-subtle`,children:t}):null]}),(0,$.jsxs)(g,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2 text-xs`,onClick:()=>void p(),children:[(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0}),i]})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:c.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{className:h(En(),`min-w-0 flex-1 font-mono text-xs`),value:e.key,placeholder:o,onChange:e=>u(t,{key:e.target.value})}),(0,$.jsx)(`input`,{className:h(En(),`min-w-0 flex-[1.4] font-mono text-xs`),value:e.value,placeholder:s,onChange:e=>u(t,{value:e.target.value})}),(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 px-0`,disabled:c.length<=1&&!e.key&&!e.value,onClick:()=>f(t),"aria-label":r,children:(0,$.jsx)(G,{className:`size-4 text-fg-subtle`,"aria-hidden":!0})})]},Tn(e,t,c)))}),(0,$.jsxs)(`button`,{type:`button`,className:h(`self-start text-sm text-accent hover:underline`,v.press),onClick:d,children:[`+ `,n]})]})}var On=[`stdio`,`sse`,`streamable-http`],kn=[`none`,`oauth`];function An(e){let t=(0,Q.c)(11),{label:n,description:r,required:i,children:a}=e,o;t[0]===i?o=t[1]:(o=i?(0,$.jsx)(`span`,{className:`ml-0.5 text-danger`,children:`*`}):null,t[0]=i,t[1]=o);let s;t[2]!==n||t[3]!==o?(s=(0,$.jsxs)(`div`,{className:`text-sm font-medium text-fg`,children:[n,o]}),t[2]=n,t[3]=o,t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=r?(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:r}):null,t[5]=r,t[6]=c);let l;return t[7]!==a||t[8]!==s||t[9]!==c?(l=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,a,c]}),t[7]=a,t[8]=s,t[9]=c,t[10]=l):l=t[10],l}function jn(){return h(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_)}function Mn(e){let t=(0,Q.c)(37),{row:n,t:r,onUpdate:i,idConflictMessage:a,variant:o}=e,l=o===void 0?`all`:o,u=l===`all`||l===`basic`,d=l===`all`||l===`advanced`,f;t[0]!==a||t[1]!==i||t[2]!==n.id||t[3]!==n.transport||t[4]!==u||t[5]!==r?(f=u?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{label:r.transportLabel,required:!0,children:(0,$.jsx)(s,{className:jn(),value:n.transport,onChange:e=>i({transport:e.target.value}),children:On.map(e=>(0,$.jsx)(c,{value:e,children:r.transportLabels[e]},e))})}),(0,$.jsxs)(An,{label:r.serverIdLabel,required:!0,children:[(0,$.jsx)(`input`,{className:jn(),value:n.id,placeholder:r.serverIdPlaceholder,onChange:e=>i({id:e.target.value})}),a?(0,$.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-300`,children:a}):null]})]}):null,t[0]=a,t[1]=i,t[2]=n.id,t[3]=n.transport,t[4]=u,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==i||t[8]!==n.argsText||t[9]!==n.auth||t[10]!==n.command||t[11]!==n.cwd||t[12]!==n.envJson||t[13]!==n.headers||t[14]!==n.oauthClientId||t[15]!==n.transport||t[16]!==n.url||t[17]!==d||t[18]!==u||t[19]!==r||t[20]!==l?(p=n.transport===`stdio`?(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(`div`,{className:l===`basic`?`md:col-span-2`:void 0,children:(0,$.jsx)(An,{label:r.commandLabel,required:!0,children:(0,$.jsx)(`input`,{className:jn(),value:n.command,onChange:e=>i({command:e.target.value})})})}):null,d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{label:r.argsLabel,description:r.argsHint,children:(0,$.jsx)(`input`,{className:jn(),value:n.argsText,onChange:e=>i({argsText:e.target.value})})}),(0,$.jsx)(An,{label:r.cwdLabel,children:(0,$.jsx)(`input`,{className:jn(),value:n.cwd,onChange:e=>i({cwd:e.target.value})})}),(0,$.jsx)(An,{label:r.envLabel,description:r.envHint,children:(0,$.jsx)(`textarea`,{className:h(jn(),`min-h-[4rem] font-mono text-xs`),value:n.envJson,onChange:e=>i({envJson:e.target.value})})})]}):null]}):(0,$.jsxs)($.Fragment,{children:[u?(0,$.jsx)(`div`,{className:`md:col-span-2`,children:(0,$.jsx)(An,{label:r.urlLabel,required:!0,children:(0,$.jsx)(`input`,{className:h(jn(),`font-mono text-xs`),value:n.url,placeholder:`https://example.com/mcp`,onChange:e=>i({url:e.target.value})})})}):null,u&&n.transport===`streamable-http`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(An,{label:r.authLabel,description:r.authHint,children:(0,$.jsx)(s,{className:jn(),value:n.auth,onChange:e=>{let t=e.target.value;i({auth:t,headers:t===`oauth`?n.headers.filter(Pn):n.headers})},children:kn.map(e=>(0,$.jsx)(c,{value:e,children:r.authLabels[e]},e))})}),n.auth===`oauth`?(0,$.jsx)(An,{label:r.oauthClientIdLabel,description:r.oauthClientIdHint,children:(0,$.jsx)(`input`,{className:h(jn(),`font-mono text-xs`),value:n.oauthClientId,placeholder:r.oauthClientIdPlaceholder,onChange:e=>i({oauthClientId:e.target.value})})}):null]}):null,d?(0,$.jsx)(Dn,{label:r.headersLabel,optionalLabel:r.optionalSuffix,addLabel:r.addHeader,removeHeaderAria:r.removeHeader,pasteLabel:r.pasteHeaders,pasteFailed:r.pasteHeadersFailed,keyPlaceholder:r.headerKeyPlaceholder,valuePlaceholder:r.headerValuePlaceholder,headers:n.headers,onChange:e=>i({headers:n.auth===`oauth`?e.filter(Nn):e})}):null]}),t[7]=i,t[8]=n.argsText,t[9]=n.auth,t[10]=n.command,t[11]=n.cwd,t[12]=n.envJson,t[13]=n.headers,t[14]=n.oauthClientId,t[15]=n.transport,t[16]=n.url,t[17]=d,t[18]=u,t[19]=r,t[20]=l,t[21]=p):p=t[21];let m;t[22]!==i||t[23]!==n||t[24]!==d||t[25]!==r?(m=d?(0,$.jsx)(An,{label:r.timeoutLabel,description:r.timeoutHint,children:(0,$.jsx)(`input`,{type:`number`,min:1,max:600,className:jn(),value:Gt(n),placeholder:r.timeoutPlaceholder,onChange:e=>i({connectionTimeoutMs:Kt(e.target.value)})})}):null,t[22]=i,t[23]=n,t[24]=d,t[25]=r,t[26]=m):m=t[26];let g;t[27]!==i||t[28]!==n||t[29]!==d||t[30]!==r?(g=d?(0,$.jsx)(An,{label:r.requestTimeoutLabel,description:r.requestTimeoutHint,children:(0,$.jsx)(`input`,{type:`number`,min:1,max:14400,className:jn(),value:qt(n),placeholder:r.requestTimeoutPlaceholder,onChange:e=>i({requestTimeoutMs:Jt(e.target.value)})})}):null,t[27]=i,t[28]=n,t[29]=d,t[30]=r,t[31]=g):g=t[31];let _;return t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==g?(_=(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[f,p,m,g]}),t[32]=f,t[33]=p,t[34]=m,t[35]=g,t[36]=_):_=t[36],_}function Nn(e){return e.key.trim().toLowerCase()!==`authorization`}function Pn(e){return e.key.trim().toLowerCase()!==`authorization`}function Fn(e,t){if(e.shortName)return e.shortName;let n=`${t.trim()}__`;return n&&e.name.startsWith(n)?e.name.slice(n.length):e.name}function In(e){let t=(0,Q.c)(13),{tool:n,serverId:r}=e,i;t[0]!==r||t[1]!==n?(i=Fn(n,r),t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o=n.name===a?a:n.name,s;t[3]===n.description?s=t[4]:(s=n.description?.trim(),t[3]=n.description,t[4]=s);let c=s,l;t[5]!==a||t[6]!==o?(l=(0,$.jsx)(`p`,{className:`break-all font-mono text-xs font-medium leading-5 text-fg`,title:o,children:a}),t[5]=a,t[6]=o,t[7]=l):l=t[7];let u;t[8]===c?u=t[9]:(u=c?(0,$.jsx)(B,{delayDuration:300,skipDelayDuration:100,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(`p`,{tabIndex:0,title:c,className:h(`mt-1 line-clamp-3 cursor-help text-xs leading-5 text-fg-muted`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`),children:c})}),(0,$.jsx)(z,{children:(0,$.jsx)(V,{side:`top`,align:`start`,sideOffset:6,collisionPadding:12,className:`!z-[10000] max-h-[min(16rem,45vh)] max-w-[min(32rem,calc(100vw-2rem))] overflow-y-auto rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-5 text-fg shadow-popover`,children:(0,$.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:c})})})]})}):null,t[8]=c,t[9]=u);let d;return t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge bg-surface-panel px-3 py-2.5`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function Ln({open:e,mode:t,initialRow:n,existingCustomServers:r,sessionIdleTtlMinutes:i,config:a,managedServerIds:o,t:s,cs:c,onClose:l,onSaved:f}){let[p,_]=(0,Z.useState)(n),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,E]=(0,Z.useState)(!1),[D,F]=(0,Z.useState)({status:`idle`}),[I,L]=(0,Z.useState)(null),R=n.id.trim(),z=p.id.trim()!==R&&o.has(p.id.trim())||o.has(p.id.trim())&&t===`add`?s.reservedServerId:void 0,B=p.id.trim()&&r.some(e=>e.clientKey!==n.clientKey&&e.id.trim()===p.id.trim())?c.duplicateServerId:void 0,V=p.id.trim().length>0&&!z&&!B&&(p.transport===`stdio`?p.command.trim().length>0:p.url.trim().length>0),H=!(p.transport===`streamable-http`&&p.auth===`oauth`),U=Yt(p),ee=(0,Z.useCallback)(async()=>{if(p.id.trim()){S(!0),w(null),F({status:`loading`});try{F({status:`ok`,tools:(await Wt(p.id.trim(),Ft(p))).tools})}catch(e){F({status:`error`,message:e instanceof Error?e.message:String(e)})}finally{S(!1)}}},[p]),W=(0,Z.useCallback)(async()=>{if(!(!V||y)){b(!0),w(null);try{let e=r.filter(e=>!(t===`edit`&&e.clientKey===n.clientKey));e.push(p),await It({sessionIdleTtlMinutes:i,servers:e.sort((e,t)=>e.id.localeCompare(t.id))},Ot(a)),await f(),l()}catch(e){w(e instanceof Error?e.message:String(e))}finally{b(!1)}}},[V,a,r,n.clientKey,t,l,f,R,p,y,i]);return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{open:e,onOpenChange:e=>{e||l()},children:(0,$.jsxs)(j,{children:[(0,$.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),(0,$.jsxs)(M,{className:h(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,`rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-6 py-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(N,{className:`text-base font-semibold text-fg`,children:t===`add`?c.addCustomServerTitle:c.editCustomServerTitle}),(0,$.jsx)(k,{className:`mt-1 text-sm text-fg-muted`,children:t===`add`?c.addCustomServerHint:c.editCustomServerHint})]}),(0,$.jsx)(A,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,className:h(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,v.focusRingPanel),"aria-label":c.modalClose,children:[(0,$.jsx)(m,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`sr-only`,children:c.modalClose})]})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Ke,{className:`size-4 text-accent`,"aria-hidden":!0}),p.id.trim()||s.cardUntitled]}),(0,$.jsx)(`p`,{className:`mt-1 break-all font-mono text-xs leading-5 text-fg-muted`,children:U||(p.transport===`stdio`?s.commandLabel:s.urlLabel)})]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:s.transportLabels[p.transport]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`mb-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c.connectorBasicConfigTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.connectorBasicConfigHint})]}),(0,$.jsx)(Mn,{row:p,t:s,variant:`basic`,onUpdate:e=>{_(t=>({...t,...e})),w(null)},idConflictMessage:z??B})]}),D.status===`ok`?(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base p-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(re,{className:`size-4 text-accent`,"aria-hidden":!0}),D.tools.length===0?s.toolsEmpty:s.toolsTitle.replace(`{{count}}`,String(D.tools.length))]}),D.tools.length>0?(0,$.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:()=>L(D.tools),children:s.viewAllTools}):null]}),D.tools.length>0?(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:D.tools.slice(0,6).map((e,t)=>(0,$.jsx)(In,{tool:e,serverId:p.id},e.name||`tool-${t}`))}):null]}):null,D.status===`error`?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:D.message}):null,C?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:C}):null,(0,$.jsxs)(`details`,{open:T,onToggle:e=>E(e.currentTarget.open),className:`group rounded-xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 px-4 py-3 text-sm font-medium text-fg hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,$.jsx)(Ve,{className:`size-4 text-fg-muted transition-transform group-open:rotate-180`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`group-open:hidden`,children:c.connectorShowAdvancedConfig}),(0,$.jsx)(`span`,{className:`hidden group-open:inline`,children:c.connectorHideAdvancedConfig})]}),(0,$.jsx)(`div`,{className:`border-t border-edge p-4`,children:(0,$.jsx)(Mn,{row:p,t:s,variant:`advanced`,onUpdate:e=>{_(t=>({...t,...e})),w(null)}})})]})]})}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge-subtle px-6 py-4`,children:[(0,$.jsxs)(g,{variant:`secondary`,disabled:!p.id.trim()||x||!H,title:H?void 0:s.oauthSaveBeforeTest,onClick:()=>void ee(),children:[x?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(K,{className:`size-4`}),s.testConnection]}),(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(g,{variant:`secondary`,children:c.modalCancel})}),(0,$.jsxs)(g,{variant:`primary`,disabled:!V||y,onClick:()=>void W(),children:[y?(0,$.jsx)(d,{className:`size-4 animate-spin`}):(0,$.jsx)(u,{className:`size-4`}),y?s.saving:c.modalSave]})]})]})]})}),I?(0,$.jsx)(tn,{open:!0,onOpenChange:e=>{e||L(null)},serverId:p.id,title:s.toolsDialogTitle,subtitle:s.toolsDialogSubtitle,searchPlaceholder:s.toolsDialogSearchPlaceholder,searchEmptyLabel:s.toolsDialogSearchEmpty,emptyLabel:s.toolsEmpty,closeLabel:s.toolsDialogClose,tools:I,stripPrefix:`${p.id.trim()}__`}):null]}):null}var Rn=`builtin`,zn=`composio`,Bn=`xopc-store`;function Vn(e){return Rn}function Hn(e){return!(e.runtime.type===`composio`&&e.runtime.role===`credential`)}function Un(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.description,e.category,e.kind,e.source,...e.tags??[]].some(e=>e.toLowerCase().includes(n)):!0}function Wn(e,t,n){return e.filter(e=>Un(e,t)).toSorted((e,t)=>n===`source`&&e.source!==t.source?e.source.localeCompare(t.source):e.displayName.localeCompare(t.displayName))}function Gn(e,t){let n=t.trim().toLowerCase();return n?[e.displayName,e.connectorId,e.instanceId,e.status,e.connectionStatus??``,e.materialized.type,e.materialized.type===`mcp`?e.materialized.serverId:e.materialized.id].some(e=>e.toLowerCase().includes(n)):!0}function Kn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.command??``,e.url??``,e.transport].some(e=>e.toLowerCase().includes(n)):!0}function qn(e){let t=e.connectorManifest;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(n.contractVersion!==1||n.id!==e.name)return null;let r=n.runtime,i=n.auth;if(!r||typeof r!=`object`||Array.isArray(r)||!i||typeof i!=`object`||Array.isArray(i))return null;let a=r,o=i;if(a.type!==`mcp`||typeof a.serverId!=`string`)return null;let s=[`code`,`docs`,`browser`,`data`,`automation`,`custom`].includes(String(n.category??``))?n.category:`custom`,c=o.mode===`oauth`?{mode:`oauth`,...typeof o.clientId==`string`?{clientId:o.clientId}:{}}:o.mode===`apiKey`?{mode:`apiKey`}:{mode:`none`};return{id:e.name,version:e.latestVersion??`store`,displayName:typeof n.displayName==`string`?n.displayName:e.name,description:typeof n.description==`string`?n.description:e.description,category:s,kind:`mcp`,source:`store`,capabilities:Array.isArray(n.capabilities)?n.capabilities.filter(e=>typeof e==`string`):[],tags:Array.isArray(n.tags)?n.tags.filter(e=>typeof e==`string`):[`store`],auth:c,setup:n.setup&&typeof n.setup==`object`&&!Array.isArray(n.setup)?n.setup:{},runtime:{type:`mcp`,serverId:a.serverId}}}function Jn(e){return e.filter((e,t,n)=>n.findIndex(t=>t.id===e.id)===t)}function Yn(e){return e?.startsWith(`/`)&&!e.startsWith(`//`)?e:`/you?tab=sources`}function Xn(){let e=b(S(e=>e.language)),t=e.connectorsSettings,n=e.mcpSettings,r=w(e=>e.token),o=!!r,s=i(),[c,u]=a(),f=c.get(`understanding`)===`1`,p=Yn(c.get(`returnTo`)),m=c.get(`tab`),[_,v]=(0,Z.useState)(!f&&m===`connected`?`connected`:`discover`),y=(0,Z.useRef)(!1),[x,C]=(0,Z.useState)({catalog:[],registryCatalog:[],instances:[],loading:!0,error:null}),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(!1),[k,A]=(0,Z.useState)(1),[j,M]=(0,Z.useState)(void 0),[N,P]=(0,Z.useState)(``),[F,L]=(0,Z.useState)(f?c.get(`connector`)??``:``),[R,z]=(0,Z.useState)(Vn(f?`understanding`:`default`)),[B,V]=(0,Z.useState)(`name`),[H,ee]=(0,Z.useState)(f?`understand`:`all`),[W,G]=(0,Z.useState)(null),[te,K]=(0,Z.useState)(null),[ne,re]=(0,Z.useState)(null),[ie,ae]=(0,Z.useState)(null),[oe,se]=(0,Z.useState)(null),[ce,le]=(0,Z.useState)(null),[ue,de]=(0,Z.useState)(!1),[fe,pe]=(0,Z.useState)(void 0),[me,he]=(0,Z.useState)(!1),{data:ge,mutate:_e}=I(o),q=ge?.payload?.config,J=(0,Z.useMemo)(()=>q===void 0?null:Pt(q),[q]),Y=J?.servers??[],ve=x.instances.length+Y.length;(0,Z.useEffect)(()=>{J&&pe(J.sessionIdleTtlMinutes)},[J]);let ye=(0,Z.useCallback)(async()=>{if(!r){C({catalog:[],registryCatalog:[],instances:[],loading:!1,error:null});return}C(e=>({...e,loading:!0,error:null}));try{let[e,t]=await Promise.all([De(),qe()]);C(n=>({catalog:e,registryCatalog:n.registryCatalog,instances:t,loading:!1,error:null}))}catch(e){C({catalog:[],registryCatalog:[],instances:[],loading:!1,error:e instanceof Error?e.message:String(e)})}},[r]);(0,Z.useEffect)(()=>{ye()},[ye]),(0,Z.useEffect)(()=>{y.current||x.loading||o&&!J||(v(f?`discover`:ve>0?`connected`:`discover`),y.current=!0)},[o,ve,J,f,x.loading]);let xe=(0,Z.useCallback)(e=>{y.current=!0,v(e)},[]),Se=(0,Z.useMemo)(()=>[{id:zn,displayName:t.composioSourceName},{id:Bn,displayName:t.storeSourceName}],[t.composioSourceName,t.storeSourceName]),Ce=(0,Z.useCallback)(async e=>{if(!o||R===`builtin`){C(e=>({...e,registryCatalog:[]})),A(1),M(void 0);return}let t=F.trim(),n=Math.max(e?.page??1,1),r=e?.append??!1,i=R===`all`?Se:Se.filter(e=>e.id===R);if(i.length!==0){E(!0),r?C(e=>({...e,error:null})):(A(1),M(void 0),C(e=>({...e,registryCatalog:[],error:null})));try{let e=await Promise.all(i.map(async e=>{if(e.id===`composio`){let e=await Ne({q:t||void 0,page:n,pageSize:24,verification:`experimental`});return{connectors:e.connectors,totalPages:e.meta.totalPages}}let r=await Ze({q:t||void 0,page:n,pageSize:24,sort:B===`source`?`newest`:`downloads`});return{connectors:r.items.flatMap(e=>{let t=qn(e);return t?[t]:[]}),totalPages:r.meta.totalPages}})),a=Jn(e.flatMap(e=>e.connectors)),o=Math.max(1,...e.map(e=>e.totalPages??1));A(n),M(o),C(e=>({...e,registryCatalog:r?Jn([...e.registryCatalog,...a]):a}))}catch(e){C(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{E(!1)}}},[B,F,R,o,Se]);(0,Z.useEffect)(()=>{if(_!==`discover`||x.loading)return;if(R===`builtin`){C(e=>({...e,registryCatalog:[]})),A(1),M(void 0);return}let e=window.setTimeout(()=>{Ce()},F.trim()?350:0);return()=>window.clearTimeout(e)},[F,R,Ce,x.loading,_]);let we=(0,Z.useMemo)(()=>new Set(x.instances.map(e=>e.connectorId)),[x.instances]),Te=(0,Z.useMemo)(()=>new Map([...x.catalog,...x.registryCatalog].map(e=>[e.id,e])),[x.catalog,x.registryCatalog]);(0,Z.useEffect)(()=>{if(x.loading)return;let e=c.get(`connector`),t=c.get(`instance`);if(!e&&!t)return;let n=x.instances.find(n=>t?n.instanceId===t:n.connectorId===e);if(n)y.current=!0,P(``),re(n.instanceId),ae(n),v(`connected`);else if(e){let t=Te.get(e);if(!t)return;y.current=!0,z(Vn(f?`understanding`:`default`)),L(``),K(t),v(`discover`)}let r=new URLSearchParams(c);r.delete(`connector`),r.delete(`instance`),r.set(`tab`,n?`connected`:`discover`),u(r,{replace:!0})},[Te,f,c,u,x.instances,x.loading]);let Ee=(0,Z.useCallback)(async e=>{O(!0),C(e=>({...e,error:null}));try{let t=await Ae(e);G(Me(t.definition,{packageName:t.packageName,version:t.version,permissions:t.permissions}))}catch(e){C(t=>({...t,error:e instanceof Error?e.message:String(e)}))}finally{O(!1)}},[]),Oe=(0,Z.useMemo)(()=>new Set(x.instances.flatMap(e=>e.materialized.type===`mcp`?[e.materialized.serverId]:[])),[x.instances]),ke=(0,Z.useCallback)(async e=>{if(!J||q===void 0)return;let t=Y.filter(t=>t.clientKey!==e.clientKey);await It({sessionIdleTtlMinutes:J.sessionIdleTtlMinutes,servers:t},Ot(q)),await _e(),await ye()},[q,Y,ye,J,_e]),je=(0,Z.useCallback)(()=>{le({mode:`add`,row:wn(Y,Oe)})},[Y,Oe]),Pe=(0,Z.useCallback)(async()=>{if(!(!J||q===void 0||me)){he(!0);try{await It({sessionIdleTtlMinutes:fe,servers:Y},Ot(q)),await _e(),de(!1)}finally{he(!1)}}},[q,Y,n.saved,J,_e,fe,me]),Fe=U(e=>e.setPageHeader),Ie=U(e=>e.clearPageHeader),Le=(0,Z.useMemo)(()=>(0,$.jsx)(St,{onBrowseCatalog:()=>xe(`discover`),onAddCustomServer:je,onOpenRuntimeSettings:()=>de(!0),addLabel:t.addConnection,browseLabel:t.addFromCatalog,customLabel:t.addCustomServerAdvanced,settingsLabel:t.runtimeSettings}),[t,je,xe]);(0,Z.useLayoutEffect)(()=>(Fe({startExtra:null,main:(0,$.jsx)(`div`,{className:`min-w-0`,children:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title})}),end:Le}),()=>Ie()),[Ie,t.title,Le,Fe]);let Re=(0,Z.useMemo)(()=>x.instances.map(e=>({instance:e,value:Sn(e,Te.get(e.connectorId))})),[Te,x.instances]),ze=(0,Z.useMemo)(()=>new Map(Re.map(({instance:e,value:t})=>[e.instanceId,t])),[Re]),Be=(0,Z.useMemo)(()=>x.instances.filter(e=>Gn(e,N)).sort((e,t)=>{let n={needs_setup:0,checking:1,ready:2},r=ze.get(e.instanceId)?.state??`checking`,i=ze.get(t.instanceId)?.state??`checking`;return n[r]-n[i]||e.displayName.localeCompare(t.displayName)}),[N,ze,x.instances]),X=(0,Z.useMemo)(()=>Y.filter(e=>Kn(e,N)),[N,Y]),Ve=Be.length+X.length,He=(0,Z.useMemo)(()=>x.catalog.filter(e=>e.source===`builtin`&&e.integrationStrategy?.preferred!==!1&&Hn(e)),[x.catalog]),Ue=(0,Z.useMemo)(()=>R===`builtin`?He:R===`all`?Jn([...He,...x.registryCatalog]):x.registryCatalog,[He,R,x.registryCatalog]),Ge=(0,Z.useMemo)(()=>{let e=f?Ue.filter(e=>e.understanding?.mode===`activity`):Ue;return Wn(H===`all`?e:e.filter(e=>bn(e).includes(H)),F,B)},[B,F,Ue,f,H]),Ke=(0,Z.useMemo)(()=>yn.filter(e=>Ue.some(t=>bn(t).includes(e))),[Ue]);(0,Z.useEffect)(()=>{H!==`all`&&!Ke.includes(H)&&ee(`all`)},[Ke,H]);let Je=_===`discover`&&R!==`builtin`&&!!(j&&k<j),Ye=(0,Z.useMemo)(()=>x.instances.find(e=>e.instanceId===ne)??ie,[ne,ie,x.instances]),Xe=(0,Z.useMemo)(()=>[{value:`all`,label:t.discoverSourceAll},{value:Rn,label:t.discoverSourceBuiltin},...Se.map(e=>({value:e.id,label:e.displayName}))],[t.discoverSourceAll,t.discoverSourceBuiltin,Se]),Qe=[{id:`connected`,label:t.tabConnected,count:ve},{id:`discover`,label:t.tabDiscover}];return(0,$.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[o?null:(0,$.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel px-4 py-3 text-sm text-fg-muted`,children:t.tokenHint}),f?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl border border-accent/25 bg-accent-soft px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:t.understandingSetupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.understandingSetupHint})]}),(0,$.jsx)(g,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>s(p),children:t.understandingSetupDone})]}):null,(0,$.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,$.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,$.jsx)($e,{items:Qe,activeTab:_,onChange:xe,ariaLabel:t.navAria,tabIdPrefix:`connectors-tab`,panelIdPrefix:`connectors-panel`,className:`flex-wrap`})}),x.error?(0,$.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:x.error}):null,_===`connected`&&o?(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,$.jsx)(xt,{value:N,onChange:P,placeholder:t.connectedSearchPlaceholder,className:`max-w-xl`}),(0,$.jsx)(be,{className:`size-9 shrink-0 p-0`,loading:x.loading,label:t.refreshConnections,title:t.refreshConnections,onClick:ye})]}),(0,$.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-2xl border border-edge bg-surface-base px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.relationshipsEntryTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.relationshipsEntryHint})]}),(0,$.jsx)(g,{type:`button`,className:`shrink-0`,onClick:()=>s(`/you?tab=relationships`),children:t.relationshipsEntryAction})]}),x.loading?(0,$.jsx)(`div`,{className:`grid gap-3`,"aria-busy":`true`,"aria-label":t.loading,children:at.slice(0,3).map(e=>(0,$.jsx)(ut,{},e))}):ve===0?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t.connectionsEmpty}),(0,$.jsx)(g,{type:`button`,variant:`primary`,className:`mt-4`,onClick:()=>xe(`discover`),children:t.addFromCatalog})]}):Ve===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.connectionsSearchEmpty}):(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:[Be.map(e=>(0,$.jsx)(Cn,{instance:e,definition:Te.get(e.connectorId),highlighted:e.instanceId===oe,onOpenDetails:e=>{se(null),re(e.instanceId),ae(e)},onChanged:ye,t},e.instanceId)),X.map(e=>(0,$.jsx)(Xt,{row:e,t:n,cs:t,onEdit:()=>le({mode:`edit`,row:structuredClone(e)}),onRemove:async()=>ke(e)},e.clientKey))]})]}):null,_===`discover`&&o?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[f?null:(0,$.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t.taskFilterAria,children:[`all`,...Ke].map(e=>(0,$.jsx)(`button`,{type:`button`,className:h(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,H===e?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-panel text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":H===e,onClick:()=>ee(e),children:e===`all`?t.taskAll:t.connectorBenefitHeadings[e]},e))}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[(0,$.jsx)(xt,{value:F,onChange:L,placeholder:t.discoverSearchPlaceholder,className:`max-w-xl`}),(0,$.jsxs)(`div`,{className:h(`grid min-w-0 grid-cols-1 gap-2 lg:ml-auto`,f?`lg:w-52`:`sm:grid-cols-2 lg:w-[26rem]`),children:[f?null:(0,$.jsx)(l,{value:R,options:Xe,placeholder:t.discoverSourceAll,allowEmpty:!1,ariaLabel:t.registrySourceAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:z}),(0,$.jsx)(l,{value:B,options:[{value:`name`,label:t.sortName},{value:`source`,label:t.sortSource}],placeholder:t.sortName,allowEmpty:!1,ariaLabel:t.sortAria,triggerClassName:`h-9 bg-surface-panel text-xs`,onChange:e=>V(e)})]})]}),(x.loading||T)&&Ge.length===0?(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,"aria-busy":`true`,"aria-label":t.loading,children:at.map(e=>(0,$.jsx)(ct,{},e))}):Ge.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center text-sm text-fg-muted`,children:t.discoverEmpty}):(0,$.jsxs)(`div`,{className:`relative`,children:[T?(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":t.loading,children:(0,$.jsx)(d,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,(0,$.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 xl:grid-cols-3`,children:Ge.map(e=>(0,$.jsx)(rt,{connector:e,installed:we.has(e.id)||ot(e,x.instances),onInstall:e=>{if(e.source===`store`){Ee(e.id);return}G(Me(e))},onOpenDetails:e.source===`store`?void 0:K,t},e.id))}),Je?(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsxs)(g,{type:`button`,variant:`secondary`,disabled:T||D,onClick:()=>void Ce({page:k+1,append:!0}),children:[T?(0,$.jsx)(d,{className:`size-4 animate-spin`}):null,t.loadMore]})}):null]})]}):null]}),W?(0,$.jsx)(We,{draft:W,onChange:G,onClose:()=>G(null),t,onInstalled:async e=>{await ye(),await _e(),se(e.instanceId),xe(`connected`)}}):null,te?(0,$.jsx)(vt,{connector:te,installed:we.has(te.id)||ot(te,x.instances),onClose:()=>K(null),onInstall:e=>G(Me(e)),t}):null,Ye?(0,$.jsx)(vn,{instance:Ye,definition:Te.get(Ye.connectorId),onClose:()=>{re(null),ae(null)},onChanged:ye,t,mcp:n}):null,ce?(0,$.jsx)(Ln,{open:!0,mode:ce.mode,initialRow:ce.row,existingCustomServers:Y,sessionIdleTtlMinutes:fe,config:q,managedServerIds:Oe,t:n,cs:t,onClose:()=>le(null),onSaved:async()=>{await _e(),await ye(),xe(`connected`)}},`${ce.mode}-${ce.row.clientKey}`):null,(0,$.jsx)(bt,{open:ue,sessionIdleTtlMinutes:fe,saving:me,onChange:pe,onSave:Pe,onClose:()=>de(!1),t,mcp:n})]})})}export{Xn as ConnectorsPage};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./check-DUBLcKHA.js";import{d as o,i as s,u as c}from"./popover-select-3E24E65N.js";import{t as l}from"./x-B_N4OPjy.js";import{t as u}from"./cn-JdwAhgNB.js";import{n as d,r as f}from"./settings-shell-layer-context-DCp6ykjQ.js";import{Bc as p}from"./index-BGf-TiZj.js";var m=r(),h=e(n(),1),g=i(),_=Array.from({length:24},(e,t)=>t);function v(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function y(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function ee(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function te(e){let t=(0,m.c)(80),{value:n,onChange:r,disabled:i,allowEmpty:te,clearLabel:b,ariaLabel:x,ariaLabelledBy:ie,className:ae,triggerClassName:oe,id:se,name:ce,minuteStep:le}=e,ue=te===void 0?!1:te,de=le===void 0?1:le,S=v(n),fe=S??y(),[pe,me]=(0,h.useState)(!1),[C,he]=(0,h.useState)(fe.hour),[w,ge]=(0,h.useState)(fe.minute),_e=(0,h.useRef)([]),T=(0,h.useRef)([]),E=d(),ve=f(),ye=s(E,ve!==null),be=Math.max(1,Math.min(60,Math.round(de))),xe=Array.from({length:Math.ceil(60/be)},(e,t)=>t*be).filter(re),Se;t[0]===r?Se=t[1]:(Se=(e,t,n)=>{let i=n===void 0?!1:n;he(e),ge(t),r(ee(e,t)),i&&me(!1)},t[0]=r,t[1]=Se);let Ce=Se,we=ne,D;t[2]===ae?D=t[3]:(D=u(`relative min-w-0`,ae),t[2]=ae,t[3]=D);let Te=o,O;t[4]===n?O=t[5]:(O=e=>{if(e){let e=v(n)??y();he(e.hour),ge(e.minute)}me(e)},t[4]=n,t[5]=O);let Ee=ue&&n&&`pr-9`,De=i&&`cursor-not-allowed opacity-50 hover:border-edge`,Oe;t[6]!==Ee||t[7]!==De||t[8]!==oe?(Oe=u(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,Ee,De,oe),t[6]=Ee,t[7]=De,t[8]=oe,t[9]=Oe):Oe=t[9];let ke;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,g.jsx)(p,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=ke):ke=t[10];let Ae=!S&&`text-fg-subtle`,je;t[11]===Ae?je=t[12]:(je=u(`tabular-nums`,Ae),t[11]=Ae,t[12]=je);let Me=S?ee(S.hour,S.minute):`--:--`,k;t[13]!==je||t[14]!==Me?(k=(0,g.jsx)(`span`,{className:je,children:Me}),t[13]=je,t[14]=Me,t[15]=k):k=t[15];let Ne;t[16]!==x||t[17]!==ie||t[18]!==i||t[19]!==se||t[20]!==k||t[21]!==Oe?(Ne=(0,g.jsx)(c,{asChild:!0,children:(0,g.jsxs)(`button`,{id:se,type:`button`,disabled:i,"aria-label":x,"aria-labelledby":ie,"aria-haspopup":`listbox`,className:Oe,children:[ke,k]})}),t[16]=x,t[17]=ie,t[18]=i,t[19]=se,t[20]=k,t[21]=Oe,t[22]=Ne):Ne=t[22];let Pe=o,Fe=ve??void 0,Ie=o,Le=u(ye,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),A=e=>{e.preventDefault(),requestAnimationFrame(()=>_e.current[C]?.focus())},Re;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,g.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=Re):Re=t[23];let j=x??`HH:mm`,M;t[24]===j?M=t[25]:(M=(0,g.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[Re,j]}),t[24]=j,t[25]=M);let N;t[26]!==C||t[27]!==w?(N=ee(C,w),t[26]=C,t[27]=w,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,g.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,g.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let ze;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=ze):ze=t[34];let Be=`${x??`HH:mm`} HH`,Ve=_.map((e,t)=>(0,g.jsx)(`button`,{ref:e=>{_e.current[t]=e},type:`button`,role:`option`,"aria-selected":C===e,tabIndex:C===e?0:-1,className:u(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,C===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(e,w),onKeyDown:e=>we(e,_,C,e=>Ce(e,w),_e),children:String(e).padStart(2,`0`)},e)),He;t[35]!==Be||t[36]!==Ve?(He=(0,g.jsxs)(`div`,{className:`pr-2`,children:[ze,(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Be,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ve})]}),t[35]=Be,t[36]=Ve,t[37]=He):He=t[37];let I;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=I):I=t[38];let Ue=`${x??`HH:mm`} MM`,We=xe.map((e,t)=>(0,g.jsxs)(`button`,{ref:e=>{T.current[t]=e},type:`button`,role:`option`,"aria-selected":w===e,tabIndex:w===e?0:-1,className:u(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,w===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(C,e,!0),onKeyDown:e=>we(e,xe,w,e=>Ce(C,e),T),children:[(0,g.jsx)(a,{className:u(`absolute left-0.5 size-3`,w!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),L;t[39]!==Ue||t[40]!==We?(L=(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Ue,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:We}),t[39]=Ue,t[40]=We,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,g.jsxs)(`div`,{className:`pl-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==He||t[46]!==R?(z=(0,g.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[He,R]}),t[45]=He,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==Ie.Content||t[49]!==Le||t[50]!==A||t[51]!==F||t[52]!==z?(B=(0,g.jsxs)(Ie.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Le,onOpenAutoFocus:A,children:[F,z]}),t[48]=Ie.Content,t[49]=Le,t[50]=A,t[51]=F,t[52]=z,t[53]=B):B=t[53];let Ge;t[54]!==Pe.Portal||t[55]!==Fe||t[56]!==B?(Ge=(0,g.jsx)(Pe.Portal,{container:Fe,children:B}),t[54]=Pe.Portal,t[55]=Fe,t[56]=B,t[57]=Ge):Ge=t[57];let Ke;t[58]!==pe||t[59]!==Ne||t[60]!==Ge||t[61]!==Te.Root||t[62]!==O?(Ke=(0,g.jsxs)(Te.Root,{open:pe,onOpenChange:O,children:[Ne,Ge]}),t[58]=pe,t[59]=Ne,t[60]=Ge,t[61]=Te.Root,t[62]=O,t[63]=Ke):Ke=t[63];let V;t[64]!==ue||t[65]!==x||t[66]!==b||t[67]!==i||t[68]!==r||t[69]!==n?(V=ue&&n?(0,g.jsx)(`button`,{type:`button`,disabled:i,"aria-label":b??x,title:b,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,g.jsx)(l,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=ue,t[65]=x,t[66]=b,t[67]=i,t[68]=r,t[69]=n,t[70]=V):V=t[70];let H;t[71]!==i||t[72]!==ce||t[73]!==n?(H=ce?(0,g.jsx)(`input`,{type:`hidden`,name:ce,value:n,disabled:i}):null,t[71]=i,t[72]=ce,t[73]=n,t[74]=H):H=t[74];let qe;return t[75]!==D||t[76]!==Ke||t[77]!==V||t[78]!==H?(qe=(0,g.jsxs)(`div`,{className:D,children:[Ke,V,H]}),t[75]=D,t[76]=Ke,t[77]=V,t[78]=H,t[79]=qe):qe=t[79],qe}function ne(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function re(e){return e<60}var b=t((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),x=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronField=void 0,e.CronField=class e{#e=!1;#t=!1;#n=!1;#r=[];options={rawValue:``};static get min(){throw Error(`min must be overridden`)}static get max(){throw Error(`max must be overridden`)}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(t,n={rawValue:``}){if(!Array.isArray(t))throw Error(`${this.constructor.name} Validation error, values is not an array`);if(!(t.length>0))throw Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...n,rawValue:n.rawValue??``},this.#r=t.sort(e.sorter),this.#n=this.options.wildcard===void 0?this.#i():this.options.wildcard,this.#e=this.options.rawValue.includes(`L`)||t.includes(`L`),this.#t=this.options.rawValue.includes(`?`)||t.includes(`?`)}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#r}static sorter(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?e-t:!n&&!r?e.localeCompare(t):n?-1:1}static findNearestValueInList(e,t,n=!1){if(n){for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}for(let n=0;n<e.length;n++)if(e[n]>t)return e[n];return null}findNearestValue(e,t=!1){return this.constructor.findNearestValueInList(this.values,e,t)}serialize(){return{wildcard:this.#n,values:this.#r}}validate(){let e,t=this.chars.length>0?` or chars ${this.chars.join(``)}`:``,n=e=>t=>RegExp(`^\\d{0,2}${t}$`).test(e);if(!this.#r.every(t=>(e=t,typeof t==`number`?t>=this.min&&t<=this.max:this.chars.some(n(t)))))throw Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${t}`);let r=this.#r.find((e,t)=>this.#r.indexOf(e)!==t);if(r)throw Error(`${this.constructor.name} Validation error, duplicate values found: ${r}`)}#i(){return this.options.rawValue.length>0?[`*`,`?`].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,t)=>t+this.min).every(e=>this.#r.includes(e))}}})),ie=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfMonth=void 0;var t=x(),n=1,r=31,i=Object.freeze([`L`]);e.CronDayOfMonth=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ae=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfWeek=void 0;var t=x(),n=0,r=7,i=Object.freeze([`L`]);e.CronDayOfWeek=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}}})),oe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronHour=void 0;var t=x(),n=0,r=23,i=Object.freeze([]);e.CronHour=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),se=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMinute=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronMinute=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ce=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{},n=class extends t{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},r=class extends t{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},i=class extends t{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},a=class extends t{},o=class extends t{constructor(e){super(`Invalid unit ${e}`)}},s=class extends t{},c=class extends t{constructor(){super(`Zone is an abstract class`)}},l=`numeric`,u=`short`,d=`long`,f={year:l,month:l,day:l},p={year:l,month:u,day:l},m={year:l,month:u,day:l,weekday:u},h={year:l,month:d,day:l},g={year:l,month:d,day:l,weekday:d},_={hour:l,minute:l},v={hour:l,minute:l,second:l},y={hour:l,minute:l,second:l,timeZoneName:u},ee={hour:l,minute:l,second:l,timeZoneName:d},te={hour:l,minute:l,hourCycle:`h23`},ne={hour:l,minute:l,second:l,hourCycle:`h23`},re={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:u},b={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:d},x={year:l,month:l,day:l,hour:l,minute:l},ie={year:l,month:l,day:l,hour:l,minute:l,second:l},ae={year:l,month:u,day:l,hour:l,minute:l},oe={year:l,month:u,day:l,hour:l,minute:l,second:l},se={year:l,month:u,day:l,weekday:u,hour:l,minute:l},ce={year:l,month:d,day:l,hour:l,minute:l,timeZoneName:u},le={year:l,month:d,day:l,hour:l,minute:l,second:l,timeZoneName:u},ue={year:l,month:d,day:l,weekday:d,hour:l,minute:l,timeZoneName:d},de={year:l,month:d,day:l,weekday:d,hour:l,minute:l,second:l,timeZoneName:d},S=class{get type(){throw new c}get name(){throw new c}get ianaName(){return this.name}get isUniversal(){throw new c}offsetName(e,t){throw new c}formatOffset(e,t){throw new c}offset(e){throw new c}equals(e){throw new c}get isValid(){throw new c}},fe=null,pe=class e extends S{static get instance(){return fe===null&&(fe=new e),fe}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}},me=new Map;function C(e){let t=me.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),me.set(e,t)),t}var he={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function w(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function ge(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=he[t];t===`era`?r[a]=i:W(a)||(r[a]=parseInt(i,10))}return r}var _e=new Map,T=class e extends S{static create(t){let n=_e.get(t);return n===void 0&&_e.set(t,n=new e(t)),n}static resetCache(){_e.clear(),me.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n,this.name)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=C(this.name),[r,i,a,o,s,c,l]=n.formatToParts?ge(n,t):w(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=Dt({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}},E={};function ve(e,t={}){let n=JSON.stringify([e,t]),r=E[n];return r||(r=new Intl.ListFormat(e,t),E[n]=r),r}var ye=new Map;function be(e,t={}){let n=JSON.stringify([e,t]),r=ye.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),ye.set(n,r)),r}var xe=new Map;function Se(e,t={}){let n=JSON.stringify([e,t]),r=xe.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),xe.set(n,r)),r}var Ce=new Map;function we(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=Ce.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),Ce.set(i,a)),a}var D=null;function Te(){return D||(D=new Intl.DateTimeFormat().resolvedOptions().locale,D)}var O=new Map;function Ee(e){let t=O.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),O.set(e,t)),t}var De=new Map;function Oe(e){let t=De.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Le,...t}),De.set(e,t)}return t}function ke(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=be(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=be(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function Ae(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function je(e){let t=[];for(let n=1;n<=12;n++){let r=$.utc(2009,n,1);t.push(e(r))}return t}function Me(e){let t=[];for(let n=1;n<=7;n++){let r=$.utc(2016,11,13+n);t.push(e(r))}return t}function k(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function Ne(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||Ee(e.locale).numberingSystem===`latn`}var Pe=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=Se(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return K(this.floor?Math.floor(e):Ct(e,3),this.padTo)}},Fe=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&T.create(n).valid?(r=n,this.dt=e):(r=`UTC`,this.dt=e.offset===0?e:e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type===`system`?this.dt=e:e.zone.type===`iana`?(this.dt=e,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=be(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(``):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Ie=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&ft()&&(this.rtf=we(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):en(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Le={firstDay:1,minimalDays:4,weekend:[6,7]},A=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||V.defaultLocale;return new e(o||(a?`en-US`:Te()),n||V.defaultNumberingSystem,r||V.defaultOutputCalendar,vt(i)||V.defaultWeekSettings,o)}static resetCache(){D=null,ye.clear(),xe.clear(),Ce.clear(),O.clear(),De.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=ke(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=Ae(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??=Ne(this),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,vt(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return k(this,e,Bt,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=je(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return k(this,e,Wt,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=Me(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return k(this,void 0,()=>Gt,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[$.utc(2016,11,13,9),$.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return k(this,e,Yt,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[$.utc(-40,1,1),$.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Pe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Fe(e,this.intl,t)}relFormatter(e={}){return new Ie(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ve(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||Ee(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:pt()?Oe(this.locale):Le}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Re=null,j=class e extends S{static get utcInstance(){return Re===null&&(Re=new e(0)),Re}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Mt(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${Ft(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${Ft(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return Ft(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},M=class extends S{constructor(e){super(),this.zoneName=e}get type(){return`invalid`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return``}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function N(e,t){if(W(e)||e===null)return t;if(e instanceof S)return e;if(ut(e)){let n=e.toLowerCase();return n==="default"?t:n===`local`||n===`system`?pe.instance:n===`utc`||n===`gmt`?j.utcInstance:j.parseSpecifier(n)||T.create(e)}else if(ct(e))return j.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new M(e)}var P={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},F={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ze=P.hanidec.replace(/[\[|\]]/g,``).split(``);function Be(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(P.hanidec)!==-1)t+=ze.indexOf(e[n]);else for(let e in F){let[n,i]=F[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}var Ve=new Map;function He(){Ve.clear()}function I({numberingSystem:e},t=``){let n=e||`latn`,r=Ve.get(n);r===void 0&&(r=new Map,Ve.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${P[n]}${t}`),r.set(t,i)),i}var Ue=()=>Date.now(),We=`system`,L=null,R=null,z=null,B=60,Ge,Ke=null,V=class{static get now(){return Ue}static set now(e){Ue=e}static set defaultZone(e){We=e}static get defaultZone(){return N(We,pe.instance)}static get defaultLocale(){return L}static set defaultLocale(e){L=e}static get defaultNumberingSystem(){return R}static set defaultNumberingSystem(e){R=e}static get defaultOutputCalendar(){return z}static set defaultOutputCalendar(e){z=e}static get defaultWeekSettings(){return Ke}static set defaultWeekSettings(e){Ke=vt(e)}static get twoDigitCutoffYear(){return B}static set twoDigitCutoffYear(e){B=e%100}static get throwOnInvalid(){return Ge}static set throwOnInvalid(e){Ge=e}static resetCaches(){A.resetCache(),T.resetCache(),$.resetCache(),He()}},H=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},qe=[0,31,59,90,120,151,181,212,243,273,304,334],Je=[0,31,60,91,121,152,182,213,244,274,305,335];function U(e,t){return new H(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Ye(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Xe(e,t,n){return n+(wt(e)?Je:qe)[t-1]}function Ze(e,t){let n=wt(e)?Je:qe,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function Qe(e,t){return(e-t+7)%7+1}function $e(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=Xe(r,i,a),s=Qe(Ye(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=kt(l,t,n)):c>kt(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...It(e)}}function et(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=Qe(Ye(r,1,t),n),s=Tt(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=Tt(l)):c>s?(l=r+1,c-=Tt(r)):l=r;let{month:u,day:d}=Ze(l,c);return{year:l,month:u,day:d,...It(e)}}function tt(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:Xe(t,n,r),...It(e)}}function nt(e){let{year:t,ordinal:n}=e,{month:r,day:i}=Ze(t,n);return{year:t,month:r,day:i,...It(e)}}function rt(e,t){if(!W(e.localWeekday)||!W(e.localWeekNumber)||!W(e.localWeekYear)){if(!W(e.weekday)||!W(e.weekNumber)||!W(e.weekYear))throw new a(`Cannot mix locale-based week fields with ISO-based week fields`);return W(e.localWeekday)||(e.weekday=e.localWeekday),W(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),W(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function it(e,t=4,n=1){let r=lt(e.weekYear),i=G(e.weekNumber,1,kt(e.weekYear,t,n)),a=G(e.weekday,1,7);return r?i?a?!1:U(`weekday`,e.weekday):U(`week`,e.weekNumber):U(`weekYear`,e.weekYear)}function at(e){let t=lt(e.year),n=G(e.ordinal,1,Tt(e.year));return t?n?!1:U(`ordinal`,e.ordinal):U(`year`,e.year)}function ot(e){let t=lt(e.year),n=G(e.month,1,12),r=G(e.day,1,Et(e.year,e.month));return t?n?r?!1:U(`day`,e.day):U(`month`,e.month):U(`year`,e.year)}function st(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=G(t,0,23)||t===24&&n===0&&r===0&&i===0,o=G(n,0,59),s=G(r,0,59),c=G(i,0,999);return a?o?s?c?!1:U(`millisecond`,i):U(`second`,r):U(`minute`,n):U(`hour`,t)}function W(e){return e===void 0}function ct(e){return typeof e==`number`}function lt(e){return typeof e==`number`&&e%1==0}function ut(e){return typeof e==`string`}function dt(e){return Object.prototype.toString.call(e)===`[object Date]`}function ft(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function pt(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function mt(e){return Array.isArray(e)?e:[e]}function ht(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function gt(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function _t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vt(e){if(e==null)return null;if(typeof e!=`object`)throw new s(`Week settings must be an object`);if(!G(e.firstDay,1,7)||!G(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!G(e,1,7)))throw new s(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function G(e,t,n){return lt(e)&&e>=t&&e<=n}function yt(e,t){return e-t*Math.floor(e/t)}function K(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function bt(e){if(!(W(e)||e===null||e===``))return parseInt(e,10)}function xt(e){if(!(W(e)||e===null||e===``))return parseFloat(e)}function St(e){if(!(W(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function Ct(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function wt(e){return e%4==0&&(e%100!=0||e%400==0)}function Tt(e){return wt(e)?366:365}function Et(e,t){let n=yt(t-1,12)+1,r=e+(t-n)/12;return n===2?wt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Dt(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Ot(e,t,n){return-Qe(Ye(e,1,t),n)+t-1}function kt(e,t=4,n=1){let r=Ot(e,t,n),i=Ot(e+1,t,n);return(Tt(e)-r+i)/7}function At(e){return e>99?e:e>V.twoDigitCutoffYear?1900+e:2e3+e}function jt(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Mt(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Nt(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new s(`Invalid unit value ${e}`);return t}function Pt(e,t){let n={};for(let r in e)if(_t(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=Nt(i)}return n}function Ft(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${K(n,2)}:${K(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${K(n,2)}${K(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function It(e){return gt(e,[`hour`,`minute`,`second`,`millisecond`])}var Lt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Rt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],zt=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function Bt(e){switch(e){case`narrow`:return[...zt];case`short`:return[...Rt];case`long`:return[...Lt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`];case`2-digit`:return[`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`12`];default:return null}}var Vt=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],Ht=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Ut=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Wt(e){switch(e){case`narrow`:return[...Ut];case`short`:return[...Ht];case`long`:return[...Vt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}var Gt=[`AM`,`PM`],Kt=[`Before Christ`,`Anno Domini`],qt=[`BC`,`AD`],Jt=[`B`,`A`];function Yt(e){switch(e){case`narrow`:return[...Jt];case`short`:return[...qt];case`long`:return[...Kt];default:return null}}function Xt(e){return Gt[e.hour<12?0:1]}function Zt(e,t){return Wt(t)[e.weekday-1]}function Qt(e,t){return Bt(t)[e.month-1]}function $t(e,t){return Yt(t)[e.year<0?0:1]}function en(e,t,n=`always`,r=!1){let i={years:[`year`,`yr.`],quarters:[`quarter`,`qtr.`],months:[`month`,`mo.`],weeks:[`week`,`wk.`],days:[`day`,`day`,`days`],hours:[`hour`,`hr.`],minutes:[`minute`,`min.`],seconds:[`second`,`sec.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function tn(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}var nn={D:f,DD:p,DDD:h,DDDD:g,t:_,tt:v,ttt:y,tttt:ee,T:te,TT:ne,TTT:re,TTTT:b,f:x,ff:ae,fff:ce,ffff:ue,F:ie,FF:oe,FFF:le,FFFF:de},q=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return nn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return K(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?Xt(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?Qt(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?Zt(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?$t(t,e):a({era:e},`era`);return tn(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return tn(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}},rn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function an(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function on(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function sn(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function cn(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=bt(t[n+i]);return[r,null,n+i]}}var ln=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,un=`(?:${ln.source}?(?:\\[(${rn.source})\\])?)?`,dn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,fn=RegExp(`${dn.source}${un}`),pn=RegExp(`(?:[Tt]${fn.source})?`),mn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,gn=/(\d{4})-?(\d{3})/,_n=cn(`weekYear`,`weekNumber`,`weekDay`),vn=cn(`year`,`ordinal`),yn=/(\d{4})-(\d\d)-(\d\d)/,bn=RegExp(`${dn.source} ?(?:${ln.source}|(${rn.source}))?`),xn=RegExp(`(?: ${bn.source})?`);function Sn(e,t,n){let r=e[t];return W(r)?n:bt(r)}function Cn(e,t){return[{year:Sn(e,t),month:Sn(e,t+1,1),day:Sn(e,t+2,1)},null,t+3]}function wn(e,t){return[{hours:Sn(e,t,0),minutes:Sn(e,t+1,0),seconds:Sn(e,t+2,0),milliseconds:St(e[t+3])},null,t+4]}function Tn(e,t){let n=!e[t]&&!e[t+1],r=Mt(e[t+1],e[t+2]);return[{},n?null:j.instance(r),t+3]}function En(e,t){return[{},e[t]?T.create(e[t]):null,t+1]}var Dn=RegExp(`^T?${dn.source}$`),On=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function kn(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(xt(n)),months:f(xt(r)),weeks:f(xt(i)),days:f(xt(a)),hours:f(xt(o)),minutes:f(xt(s)),seconds:f(xt(c),c===`-0`),milliseconds:f(St(l),d)}]}var An={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function jn(e,t,n,r,i,a,o){let s={year:t.length===2?At(bt(t)):bt(t),month:Rt.indexOf(n)+1,day:bt(r),hour:bt(i),minute:bt(a)};return o&&(s.second=bt(o)),e&&(s.weekday=e.length>3?Vt.indexOf(e)+1:Ht.indexOf(e)+1),s}var Mn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Nn(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=jn(t,i,r,n,a,o,s),p;return p=c?An[c]:l?0:Mt(u,d),[f,new j(p)]}function Pn(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}var Fn=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,In=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ln=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Rn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,i,r,n,a,o,s),j.utcInstance]}function zn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,s,n,r,i,a,o),j.utcInstance]}var Bn=an(mn,pn),Vn=an(hn,pn),Hn=an(gn,pn),Un=an(fn),Wn=on(Cn,wn,Tn,En),Gn=on(_n,wn,Tn,En),Kn=on(vn,wn,Tn,En),qn=on(wn,Tn,En);function Jn(e){return sn(e,[Bn,Wn],[Vn,Gn],[Hn,Kn],[Un,qn])}function Yn(e){return sn(Pn(e),[Mn,Nn])}function Xn(e){return sn(e,[Fn,Rn],[In,Rn],[Ln,zn])}function Zn(e){return sn(e,[On,kn])}var Qn=on(wn);function $n(e){return sn(e,[Dn,Qn])}var er=an(yn,xn),tr=an(bn),nr=on(wn,Tn,En);function rr(e){return sn(e,[er,Wn],[tr,nr])}var ir=`Invalid Duration`,ar={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},or={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ar},J=146097/400,sr=146097/4800,cr={years:{quarters:4,months:12,weeks:J/7,days:J,hours:J*24,minutes:J*24*60,seconds:J*24*60*60,milliseconds:J*24*60*60*1e3},quarters:{months:3,weeks:J/28,days:J/4,hours:J*24/4,minutes:J*24*60/4,seconds:J*24*60*60/4,milliseconds:J*24*60*60*1e3/4},months:{weeks:sr/7,days:sr,hours:sr*24,minutes:sr*24*60,seconds:sr*24*60*60,milliseconds:sr*24*60*60*1e3},...ar},lr=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],ur=lr.slice(0).reverse();function Y(e,t,n=!1){return new X({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function dr(e,t){let n=t.milliseconds??0;for(let r of ur.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function fr(e,t){let n=dr(e,t)<0?-1:1;lr.reduceRight((r,i)=>{if(W(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),lr.reduce((n,r)=>{if(W(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function pr(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var X=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?cr:or;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||A.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new s(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Pt(t,e.normalizeUnit),loc:A.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(ct(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new s(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=Zn(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=$n(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Duration is invalid`);let r=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new i(r);return new e({invalid:r})}static normalizeUnit(e){let t={year:`years`,years:`years`,quarter:`quarters`,quarters:`quarters`,month:`months`,months:`months`,week:`weeks`,weeks:`weeks`,day:`days`,days:`days`,hour:`hours`,hours:`hours`,minute:`minutes`,minutes:`minutes`,second:`seconds`,seconds:`seconds`,millisecond:`milliseconds`,milliseconds:`milliseconds`}[e&&e.toLowerCase()];if(!t)throw new o(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?q.create(this.loc,n).formatDurationFromString(this,e):ir}toHuman(e={}){if(!this.isValid)return ir;let t=e.showZeros!==!1,n=lr.map(n=>{let r=this.values[n];return W(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e=`P`;return this.years!==0&&(e+=this.years+`Y`),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+`M`),this.weeks!==0&&(e+=this.weeks+`W`),this.days!==0&&(e+=this.days+`D`),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+=`T`),this.hours!==0&&(e+=this.hours+`H`),this.minutes!==0&&(e+=this.minutes+`M`),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ct(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},$.fromMillis(t,{zone:`UTC`}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?dr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of lr)(_t(n.values,e)||_t(this.values,e))&&(r[e]=n.get(e)+this.get(e));return Y(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=Nt(e(this.values[n],n));return Y(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Pt(t,e.normalizeUnit)};return Y(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return Y(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return fr(this.matrix,e),Y(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=pr(this.normalize().shiftToAll().toObject());return Y(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of lr)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;ct(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else ct(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return fr(this.matrix,n),Y(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo(`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Y(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=pr(this.values);return Y(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of lr)if(!t(this.values[n],e.values[n]))return!1;return!0}},mr=`Invalid Interval`;function hr(e,t){return!e||!e.isValid?gr.invalid(`missing or invalid start`):!t||!t.isValid?gr.invalid(`missing or invalid end`):t<e?gr.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var gr=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Interval is invalid`);let i=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new r(i);return new e({invalid:i})}static fromDateTimes(t,n){let r=_i(t),i=_i(n);return hr(r,i)??new e({start:r,end:i})}static after(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=$.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=$.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=X.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=X.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e=`milliseconds`){return this.isValid?this.toDuration(e).get(e):NaN}count(e=`milliseconds`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t!=null&&t.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(_i).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=X.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:mr}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=f,t={}){return this.isValid?q.create(this.s.loc.clone(t),e).formatInterval(this):mr}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:mr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:mr}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:mr}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:mr}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):X.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},_r=class{static hasDST(e=V.defaultZone){let t=$.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return T.isValidZone(e)}static normalizeZone(e){return N(e,V.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return A.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return A.create(t,null,`gregory`).eras(e)}static features(){return{relative:ft(),localeWeek:pt()}}};function vr(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(X.fromMillis(r).as(`days`))}function yr(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=vr(e,t);return(n-n%7)/7}],[`days`,vr]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function br(e,t,n,r){let[i,a,o,s]=yr(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=X.fromObject(a,r);return l.length>0?X.fromMillis(c,r).shiftTo(...l).plus(u):u}var xr=`missing Intl.DateTimeFormat.formatToParts support`;function Z(e,t=e=>e){return{regex:e,deser:([e])=>t(Be(e))}}var Sr=`[ \xA0]`,Cr=new RegExp(Sr,`g`);function wr(e){return e.replace(/\./g,`\\.?`).replace(Cr,Sr)}function Tr(e){return e.replace(/\./g,``).replace(Cr,` `).toLowerCase()}function Q(e,t){return e===null?null:{regex:RegExp(e.map(wr).join(`|`)),deser:([n])=>e.findIndex(e=>Tr(n)===Tr(e))+t}}function Er(e,t){return{regex:e,deser:([,e,t])=>Mt(e,t),groups:t}}function Dr(e){return{regex:e,deser:([e])=>e}}function Or(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function kr(e,t){let n=I(t),r=I(t,`{2}`),i=I(t,`{3}`),a=I(t,`{4}`),o=I(t,`{6}`),s=I(t,`{1,2}`),c=I(t,`{1,3}`),l=I(t,`{1,6}`),u=I(t,`{1,9}`),d=I(t,`{2,4}`),f=I(t,`{4,6}`),p=e=>({regex:RegExp(Or(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return Q(t.eras(`short`),0);case`GG`:return Q(t.eras(`long`),0);case`y`:return Z(l);case`yy`:return Z(d,At);case`yyyy`:return Z(a);case`yyyyy`:return Z(f);case`yyyyyy`:return Z(o);case`M`:return Z(s);case`MM`:return Z(r);case`MMM`:return Q(t.months(`short`,!0),1);case`MMMM`:return Q(t.months(`long`,!0),1);case`L`:return Z(s);case`LL`:return Z(r);case`LLL`:return Q(t.months(`short`,!1),1);case`LLLL`:return Q(t.months(`long`,!1),1);case`d`:return Z(s);case`dd`:return Z(r);case`o`:return Z(c);case`ooo`:return Z(i);case`HH`:return Z(r);case`H`:return Z(s);case`hh`:return Z(r);case`h`:return Z(s);case`mm`:return Z(r);case`m`:return Z(s);case`q`:return Z(s);case`qq`:return Z(r);case`s`:return Z(s);case`ss`:return Z(r);case`S`:return Z(c);case`SSS`:return Z(i);case`u`:return Dr(u);case`uu`:return Dr(s);case`uuu`:return Z(n);case`a`:return Q(t.meridiems(),0);case`kkkk`:return Z(a);case`kk`:return Z(d,At);case`W`:return Z(s);case`WW`:return Z(r);case`E`:case`c`:return Z(n);case`EEE`:return Q(t.weekdays(`short`,!1),1);case`EEEE`:return Q(t.weekdays(`long`,!1),1);case`ccc`:return Q(t.weekdays(`short`,!0),1);case`cccc`:return Q(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return Er(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return Er(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return Dr(/[a-z_+-/]{1,256}?/i);case` `:return Dr(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:xr};return m.token=e,m}var Ar={year:{"2-digit":`yy`,numeric:`yyyyy`},month:{numeric:`M`,"2-digit":`MM`,short:`MMM`,long:`MMMM`},day:{numeric:`d`,"2-digit":`dd`},weekday:{short:`EEE`,long:`EEEE`},dayperiod:`a`,dayPeriod:`a`,hour12:{numeric:`h`,"2-digit":`hh`},hour24:{numeric:`H`,"2-digit":`HH`},minute:{numeric:`m`,"2-digit":`mm`},second:{numeric:`s`,"2-digit":`ss`},timeZoneName:{long:`ZZZZZ`,short:`ZZZ`}};function jr(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=Ar[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function Mr(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Nr(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(_t(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function Pr(e){let t=e=>{switch(e){case`S`:return`millisecond`;case`s`:return`second`;case`m`:return`minute`;case`h`:case`H`:return`hour`;case`d`:return`day`;case`o`:return`ordinal`;case`L`:case`M`:return`month`;case`y`:return`year`;case`E`:case`c`:return`weekday`;case`W`:return`weekNumber`;case`k`:return`weekYear`;case`q`:return`quarter`;default:return null}},n=null,r;return W(e.z)||(n=T.create(e.z)),W(e.Z)||(n||=new j(e.Z),r=e.Z),W(e.q)||(e.M=(e.q-1)*3+1),W(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),W(e.u)||(e.S=St(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}var Fr=null;function Ir(){return Fr||=$.fromMillis(1555555555555),Fr}function Lr(e,t){if(e.literal)return e;let n=Hr(q.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function Rr(e,t){return Array.prototype.concat(...e.map(e=>Lr(e,t)))}var zr=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Rr(q.parseFormat(t),e),this.units=this.tokens.map(t=>kr(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=Mr(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Nr(e,this.regex,this.handlers),[r,i,o]=n?Pr(n):[null,null,void 0];if(_t(n,`a`)&&_t(n,`H`))throw new a(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Br(e,t,n){return new zr(e,n).explainFromTokens(t)}function Vr(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=Br(e,t,n);return[r,i,a,o]}function Hr(e,t){if(!e)return null;let n=q.create(t,e).dtFormatter(Ir()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>jr(t,e,i))}var Ur=`Invalid DateTime`,Wr=864e13;function Gr(e){return new H(`unsupported zone`,`the zone "${e.name}" is not supported`)}function Kr(e){return e.weekData===null&&(e.weekData=$e(e.c)),e.weekData}function qr(e){return e.localWeekData===null&&(e.localWeekData=$e(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Jr(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new $({...n,...t,old:n})}function Yr(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Xr(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Zr(e,t,n){return Yr(Dt(e),t,n)}function Qr(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,Et(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=X.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=Yr(Dt(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function $r(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=$.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return $.invalid(new H(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function ei(e,t,n=!0){return e.isValid?q.create(A.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function ti(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=K(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=K(e.c.month),n===`month`)return i;i+=`-`}else if(i+=K(e.c.month),n===`month`)return i;return i+=K(e.c.day),i}function ni(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=K(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=K(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=K(e.c.second))}else{if(c+=K(e.c.minute),o===`minute`)break;s&&(c+=K(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=K(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=K(Math.trunc(-e.o/60)),c+=`:`,c+=K(Math.trunc(-e.o%60))):(c+=`+`,c+=K(Math.trunc(e.o/60)),c+=`:`,c+=K(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}var ri={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ii={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ai={ordinal:1,hour:0,minute:0,second:0,millisecond:0},oi=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],si=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],ci=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function li(e){let t={year:`year`,years:`year`,month:`month`,months:`month`,day:`day`,days:`day`,hour:`hour`,hours:`hour`,minute:`minute`,minutes:`minute`,quarter:`quarter`,quarters:`quarter`,second:`second`,seconds:`second`,millisecond:`millisecond`,milliseconds:`millisecond`,weekday:`weekday`,weekdays:`weekday`,weeknumber:`weekNumber`,weeksnumber:`weekNumber`,weeknumbers:`weekNumber`,weekyear:`weekYear`,weekyears:`weekYear`,ordinal:`ordinal`}[e.toLowerCase()];if(!t)throw new o(e);return t}function ui(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return li(e)}}function di(e){if(hi===void 0&&(hi=V.now()),e.type!==`iana`)return e.offset(hi);let t=e.name,n=gi.get(t);return n===void 0&&(n=e.offset(hi),gi.set(t,n)),n}function fi(e,t){let n=N(t.zone,V.defaultZone);if(!n.isValid)return $.invalid(Gr(n));let r=A.fromObject(t),i,a;if(W(e.year))i=V.now();else{for(let t of oi)W(e[t])&&(e[t]=ri[t]);let t=ot(e)||st(e);if(t)return $.invalid(t);let r=di(n);[i,a]=Zr(e,r,n)}return new $({ts:i,zone:n,loc:r,o:a})}function pi(e,t,n){let r=W(n.round)?!0:n.round,i=W(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=Ct(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function mi(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}var hi,gi=new Map,$=class e{constructor(e){let t=e.zone||V.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new H(`invalid input`):null)||(t.isValid?null:Gr(t));this.ts=W(e.ts)?V.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=ct(e.o)&&!e.old?e.o:t.offset(this.ts);r=Xr(this.ts,a),n=Number.isNaN(r.year)?new H(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||A.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return e.zone=j.utcInstance,fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=dt(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=N(n.zone,V.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:A.fromObject(n)}):e.invalid(Gr(i))}static fromMillis(t,n={}){if(!ct(t))throw new s(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-864e13||t>Wr?e.invalid(`Timestamp out of range`):new e({ts:t,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)})}static fromSeconds(t,n={}){if(ct(t))return new e({ts:t*1e3,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)});throw new s(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t||={};let r=N(n.zone,V.defaultZone);if(!r.isValid)return e.invalid(Gr(r));let i=A.fromObject(n),o=Pt(t,ui),{minDaysInFirstWeek:s,startOfWeek:c}=rt(o,i),l=V.now(),u=W(n.specificOffset)?r.offset(l):n.specificOffset,d=!W(o.ordinal),f=!W(o.year),p=!W(o.month)||!W(o.day),m=f||p,h=o.weekYear||o.weekNumber;if((m||d)&&h)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(p&&d)throw new a(`Can't mix ordinal dates with month/day`);let g=h||o.weekday&&!m,_,v,y=Xr(l,u);g?(_=si,v=ii,y=$e(y,s,c)):d?(_=ci,v=ai,y=tt(y)):(_=oi,v=ri);let ee=!1;for(let e of _){let t=o[e];W(t)?ee?o[e]=v[e]:o[e]=y[e]:ee=!0}let te=(g?it(o,s,c):d?at(o):ot(o))||st(o);if(te)return e.invalid(te);let[ne,re]=Zr(g?et(o,s,c):d?nt(o):o,u,r),b=new e({ts:ne,zone:r,o:re,loc:i});return o.weekday&&m&&t.weekday!==b.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${o.weekday} and a date of ${b.toISO()}`):b.isValid?b:e.invalid(b.invalid)}static fromISO(e,t={}){let[n,r]=Jn(e);return $r(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=Yn(e);return $r(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=Xn(e);return $r(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,c,l,u]=Vr(A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return u?e.invalid(u):$r(o,c,r,`format ${n}`,t,l)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=rr(e);return $r(n,r,t,`SQL`,e)}static invalid(t,r=null){if(!t)throw new s(`need to specify a reason the DateTime is invalid`);let i=t instanceof H?t:new H(t,r);if(V.throwOnInvalid)throw new n(i);return new e({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Hr(e,A.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return Rr(q.parseFormat(e),A.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){hi=void 0,gi.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Kr(this).weekYear:NaN}get weekNumber(){return this.isValid?Kr(this).weekNumber:NaN}get weekday(){return this.isValid?Kr(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?qr(this).weekday:NaN}get localWeekNumber(){return this.isValid?qr(this).weekNumber:NaN}get localWeekYear(){return this.isValid?qr(this).weekYear:NaN}get ordinal(){return this.isValid?tt(this.c).ordinal:NaN}get monthShort(){return this.isValid?_r.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?_r.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?_r.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?_r.weekdays(`long`,{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:`short`,locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:`long`,locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=Dt(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=Xr(s,a),u=Xr(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[Jr(this,{ts:s}),Jr(this,{ts:c})]:[this]}get isInLeapYear(){return wt(this.year)}get daysInMonth(){return Et(this.year,this.month)}get daysInYear(){return this.isValid?Tt(this.year):NaN}get weeksInWeekYear(){return this.isValid?kt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?kt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=q.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(j.instance(e),t)}toLocal(){return this.setZone(V.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=N(t,V.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=Zr(r,n,t)}return Jr(this,{ts:e,zone:t})}else return e.invalid(Gr(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Jr(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Pt(e,ui),{minDaysInFirstWeek:n,startOfWeek:r}=rt(t,this.loc),i=!W(t.weekYear)||!W(t.weekNumber)||!W(t.weekday),o=!W(t.ordinal),s=!W(t.year),c=!W(t.month)||!W(t.day),l=s||c,u=t.weekYear||t.weekNumber;if((l||o)&&u)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(c&&o)throw new a(`Can't mix ordinal dates with month/day`);let d;i?d=et({...$e(this.c,n,r),...t},n,r):W(t.ordinal)?(d={...this.toObject(),...t},W(t.day)&&(d.day=Math.min(Et(d.year,d.month),d.day))):d=nt({...tt(this.c),...t});let[f,p]=Zr(d,this.o,this.zone);return Jr(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e);return Jr(this,Qr(this,t))}minus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e).negate();return Jr(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=X.normalizeUnit(e);switch(r){case`years`:n.month=1;case`quarters`:case`months`:n.day=1;case`weeks`:case`days`:n.hour=0;case`hours`:n.minute=0;case`minutes`:n.second=0;case`seconds`:n.millisecond=0;break}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?q.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ur}toLocaleString(e=f,t={}){return this.isValid?q.create(this.loc.clone(t),e).formatDateTime(this):Ur}toLocaleParts(e={}){return this.isValid?q.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=li(a);let o=e===`extended`,s=ti(this,o,a);return oi.indexOf(a)>=3&&(s+=`T`),s+=ni(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?ti(this,e===`extended`,li(t)):null}toISOWeekDate(){return ei(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=li(o),(r&&oi.indexOf(o)>=3?`T`:``)+ni(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return ei(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return ei(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?ti(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),ei(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ur}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return X.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=mt(t).map(X.normalizeUnit),a=e.valueOf()>this.valueOf(),o=br(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?gr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),pi(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?pi(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new s(`min requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new s(`max requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return Br(A.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new zr(A.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new s(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:c,zone:l,specificOffset:u,invalidReason:d}=n.explainFromTokens(t);return d?e.invalid(d):$r(c,l,r,`format ${n.format}`,t,u)}static get DATE_SHORT(){return f}static get DATE_MED(){return p}static get DATE_MED_WITH_WEEKDAY(){return m}static get DATE_FULL(){return h}static get DATE_HUGE(){return g}static get TIME_SIMPLE(){return _}static get TIME_WITH_SECONDS(){return v}static get TIME_WITH_SHORT_OFFSET(){return y}static get TIME_WITH_LONG_OFFSET(){return ee}static get TIME_24_SIMPLE(){return te}static get TIME_24_WITH_SECONDS(){return ne}static get TIME_24_WITH_SHORT_OFFSET(){return re}static get TIME_24_WITH_LONG_OFFSET(){return b}static get DATETIME_SHORT(){return x}static get DATETIME_SHORT_WITH_SECONDS(){return ie}static get DATETIME_MED(){return ae}static get DATETIME_MED_WITH_SECONDS(){return oe}static get DATETIME_MED_WITH_WEEKDAY(){return se}static get DATETIME_FULL(){return ce}static get DATETIME_FULL_WITH_SECONDS(){return le}static get DATETIME_HUGE(){return ue}static get DATETIME_HUGE_WITH_SECONDS(){return de}};function _i(e){if($.isDateTime(e))return e;if(e&&e.valueOf&&ct(e.valueOf()))return $.fromJSDate(e);if(e&&typeof e==`object`)return $.fromObject(e);throw new s(`Unknown datetime argument: ${e}, of type ${typeof e}`)}e.DateTime=$,e.Duration=X,e.FixedOffsetZone=j,e.IANAZone=T,e.Info=_r,e.Interval=gr,e.InvalidZone=M,e.Settings=V,e.SystemZone=pe,e.VERSION=`3.7.2`,e.Zone=S})),le=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;var t=ce(),n;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.Day=`Day`,e.Month=`Month`,e.Year=`Year`})(n||(e.TimeUnit=n={}));var r;(function(e){e.Add=`Add`,e.Subtract=`Subtract`})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var i=class i{#e;#t=null;#n=null;#r={add:{[n.Year]:this.addYear.bind(this),[n.Month]:this.addMonth.bind(this),[n.Day]:this.addDay.bind(this),[n.Hour]:this.addHour.bind(this),[n.Minute]:this.addMinute.bind(this),[n.Second]:this.addSecond.bind(this)},subtract:{[n.Year]:this.subtractYear.bind(this),[n.Month]:this.subtractMonth.bind(this),[n.Day]:this.subtractDay.bind(this),[n.Hour]:this.subtractHour.bind(this),[n.Minute]:this.subtractMinute.bind(this),[n.Second]:this.subtractSecond.bind(this)}};constructor(e,n){let r={zone:n};if(e?e instanceof i?(this.#e=e.#e,this.#t=e.#t,this.#n=e.#n):e instanceof Date?this.#e=t.DateTime.fromJSDate(e,r):typeof e==`number`?this.#e=t.DateTime.fromMillis(e,r):(this.#e=t.DateTime.fromISO(e,r),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(e,`EEE, d MMM yyyy HH:mm:ss`,r))):this.#e=t.DateTime.local(),!this.#e.isValid)throw Error(`CronDate: unhandled timestamp: ${e}`);n&&n!==this.#e.zoneName&&(this.#e=this.#e.setZone(n))}static#i(e){return e%4==0&&e%100!=0||e%400==0}get dstStart(){return this.#t}set dstStart(e){this.#t=e}get dstEnd(){return this.#n}set dstEnd(e){this.#n=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf(`month`)}addDay(){this.#e=this.#e.plus({days:1}).startOf(`day`)}addHour(){this.#e=this.#e.plus({hours:1}).startOf(`hour`)}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf(`minute`)}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf(`month`).startOf(`second`)}subtractDay(){this.#e=this.#e.minus({days:1}).endOf(`day`).startOf(`second`)}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf(`hour`).startOf(`second`)}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf(`minute`).startOf(`second`)}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){this.#r.add[e]()}subtractUnit(e){this.#r.subtract[e]()}invokeDateOperation(e,t){if(e===r.Add){this.addUnit(t);return}if(e===r.Subtract){this.subtractUnit(t);return}throw Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf(`day`)}setEndOfDay(){this.#e=this.#e.endOf(`day`)}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#a().day}getUTCFullYear(){return this.#a().year}getUTCDay(){let e=this.#a().weekday;return e===7?0:e}getUTCMonth(){return this.#a().month-1}getUTCHours(){return this.#a().hour}getUTCMinutes(){return this.#a().minute}getUTCSeconds(){return this.#a().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:t,month:n}=this.#e;if(n===2){let r=i.#i(this.#e.year);return t===e.DAYS_IN_MONTH[n-1]-+!r}return t===e.DAYS_IN_MONTH[n-1]}isLastWeekdayOfMonth(){let{day:t,month:n}=this.#e,r;return r=n===2?e.DAYS_IN_MONTH[n-1]-+!i.#i(this.#e.year):e.DAYS_IN_MONTH[n-1],t>r-7}applyDateOperation(e,t,r){if(t===n.Month||t===n.Day){this.invokeDateOperation(e,t);return}let i=this.getHours();this.invokeDateOperation(e,t);let a=this.getHours(),o=a-i;o===2?r!==24&&(this.dstStart=a):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&r!==24&&(this.dstEnd=a)}#a(){return this.#e.toUTC()}};e.CronDate=i,e.default=i})),ue=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMonth=void 0;var t=le(),n=x(),r=1,i=12,a=Object.freeze([]);e.CronMonth=class extends n.CronField{static get min(){return r}static get max(){return i}static get chars(){return a}static get daysInMonth(){return t.DAYS_IN_MONTH}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),de=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronSecond=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronSecond=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),S=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(b(),e),n(ie(),e),n(ae(),e),n(x(),e),n(oe(),e),n(se(),e),n(ue(),e),n(de(),e)})),fe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronFieldCollection=void 0;var t=S();e.CronFieldCollection=class e{#e;#t;#n;#r;#i;#a;static from(n,r){return new e({second:this.resolveField(t.CronSecond,n.second,r.second),minute:this.resolveField(t.CronMinute,n.minute,r.minute),hour:this.resolveField(t.CronHour,n.hour,r.hour),dayOfMonth:this.resolveField(t.CronDayOfMonth,n.dayOfMonth,r.dayOfMonth),month:this.resolveField(t.CronMonth,n.month,r.month),dayOfWeek:this.resolveField(t.CronDayOfWeek,n.dayOfWeek,r.dayOfWeek)})}static resolveField(e,n,r){return r?r instanceof t.CronField?r:new e(r):n}constructor({second:e,minute:n,hour:r,dayOfMonth:i,month:a,dayOfWeek:o}){if(!e)throw Error(`Validation error, Field second is missing`);if(!n)throw Error(`Validation error, Field minute is missing`);if(!r)throw Error(`Validation error, Field hour is missing`);if(!i)throw Error(`Validation error, Field dayOfMonth is missing`);if(!a)throw Error(`Validation error, Field month is missing`);if(!o)throw Error(`Validation error, Field dayOfWeek is missing`);if(a.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=t.CronMonth.daysInMonth[a.values[0]-1]))throw Error(`Invalid explicit day of month definition`);this.#e=e,this.#t=n,this.#n=r,this.#i=a,this.#a=o,this.#r=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#r}get month(){return this.#i}get dayOfWeek(){return this.#a}static compactField(e){if(e.length===0)return[];let t=[],n;return e.forEach((e,r,i)=>{if(n===void 0){n={start:e,count:1};return}let a=i[r-1]||n.start,o=i[r+1];if(e===`L`||e===`W`){t.push(n),t.push({start:e,count:1}),n=void 0;return}if(n.step===void 0&&o!==void 0){let t=e-a;if(t<=o-e){n={...n,count:2,end:e,step:t};return}n.step=1}e-(n.end??0)===n.step?(n.count++,n.end=e):(n.count===1?t.push({start:n.start,count:1}):n.count===2?(t.push({start:n.start,count:1}),t.push({start:n.end??a,count:1})):t.push(n),n={start:e,count:1})}),n&&t.push(n),t}static#o(e,t,n){let r=t.step;return r?r===1&&t.start===e.min&&t.end&&t.end>=n?e.hasQuestionMarkChar?`?`:`*`:r!==1&&t.start===e.min&&t.end&&t.end>=n-r+1?`*/${r}`:null:null}static#s(e,t){let n=e.step;if(n===1)return`${e.start}-${e.end}`;let r=e.start===0?e.count-1:e.count;if(!n)throw Error(`Unexpected range step`);if(!e.end)throw Error(`Unexpected range end`);if(n*r>e.end){let t=(t,r)=>{if(typeof e.start!=`number`)throw Error(`Unexpected range start`);return r%n===0?e.start+r:null};if(typeof e.start!=`number`)throw Error(`Unexpected range start`);let r={length:e.end-e.start+1};return Array.from(r,t).filter(e=>e!==null).join(`,`)}return e.end===t-n+1?`${e.start}/${n}`:`${e.start}-${e.end}/${n}`}stringifyField(n){let r=n.max,i=n.values;if(n instanceof t.CronDayOfWeek){r=6;let e=this.#a.values;i=e[e.length-1]===7?e.slice(0,-1):e}n instanceof t.CronDayOfMonth&&(r=this.#i.values.length===1?t.CronMonth.daysInMonth[this.#i.values[0]-1]:n.max);let a=e.compactField(i);if(a.length===1){let t=e.#o(n,a[0],r);if(t)return t}return a.map(i=>{let a=i.count===1?i.start.toString():e.#s(i,r);return n instanceof t.CronDayOfWeek&&n.nthDay>0?`${a}#${n.nthDay}`:a}).join(`,`)}stringify(e=!1){let t=[];return e&&t.push(this.stringifyField(this.#e)),t.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#a)),t.join(` `)}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#r.serialize(),month:this.#i.serialize(),dayOfWeek:this.#a.serialize()}}}})),pe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var t=le();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=`Out of the time span range`,e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=`Invalid expression, loop limit exceeded`;var n=1e4,r=class r{#e;#t;#n;#r;#i;#a;#o=null;#s=!1;constructor(e,n){this.#e=n,this.#t=n.tz,this.#r=n.startDate?new t.CronDate(n.startDate,this.#t):null,this.#i=n.endDate?new t.CronDate(n.endDate,this.#t):null;let r=n.currentDate??n.startDate;if(r){let e=new t.CronDate(r,this.#t);this.#r&&e.getTime()<this.#r.getTime()?r=this.#r:this.#i&&e.getTime()>this.#i.getTime()&&(r=this.#i)}this.#n=new t.CronDate(r,this.#t),this.#a=e}get fields(){return this.#a}static fieldsToExpression(e,t){return new r(e,t||{})}static#c(e,t){return t.some(t=>t===e)}#l(e,t){return e[t?e.length-1:0]}#u(e){let n=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#o===n)return this.#s;let r=new t.CronDate(e);r.setStartOfDay();let i=new t.CronDate(e);return i.setEndOfDay(),this.#o=n,this.#s=r.getUTCOffset()!==i.getUTCOffset(),this.#s}#d(e,n,r){let i=this.#a.second.values,a=e.getSeconds(),o=this.#a.second.findNearestValue(a,r);if(o!==null){e.setSeconds(o);return}e.applyDateOperation(n,t.TimeUnit.Minute,this.#a.hour.values.length),e.setSeconds(this.#l(i,r))}#f(e,n,r){let i=this.#a.minute.values,a=this.#a.second.values,o=e.getMinutes(),s=this.#a.minute.findNearestValue(o,r);if(s!==null){e.setMinutes(s),e.setSeconds(this.#l(a,r));return}e.applyDateOperation(n,t.TimeUnit.Hour,this.#a.hour.values.length),e.setMinutes(this.#l(i,r)),e.setSeconds(this.#l(a,r))}static#p(e,t){let n=t.isLastWeekdayOfMonth();return e.some(e=>{let r=parseInt(e.toString().charAt(0),10)%7;if(Number.isNaN(r))throw Error(`Invalid last weekday of the month expression: ${e}`);return t.getDay()===r&&n})}next(){return this.#_()}prev(){return this.#_(!0)}hasNext(){let e=this.#n;try{return this.#_(),!0}catch{return!1}finally{this.#n=e}}hasPrev(){let e=this.#n;try{return this.#_(!0),!0}catch{return!1}finally{this.#n=e}}take(e){let t=[];if(e>=0)for(let n=0;n<e;n++)try{t.push(this.next())}catch{return t}else for(let n=0;n>e;n--)try{t.push(this.prev())}catch{return t}return t}reset(e){this.#n=new t.CronDate(e||this.#e.currentDate)}stringify(e=!1){return this.#a.stringify(e)}includesDate(e){let{second:n,minute:r,hour:i,month:a}=this.#a,o=new t.CronDate(e,this.#t);return!(!n.values.includes(o.getSeconds())||!r.values.includes(o.getMinutes())||!i.values.includes(o.getHours())||!a.values.includes(o.getMonth()+1)||!this.#m(o)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(o.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(e){let t=this.#a.dayOfMonth.isWildcard,n=!t,i=this.#a.dayOfWeek.isWildcard,a=!i,o=r.#c(e.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),s=r.#c(e.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#p(this.#a.dayOfWeek.values,e);return!!(n&&a&&(o||s)||o&&!a||t&&!i&&s)}#h(e,n,i){let a=this.#a.hour.values,o=a,s=e.getHours(),c=r.#c(s,a),l=e.dstStart===s,u=e.dstEnd===s;if(l)return r.#c(s-1,a)?!0:(e.invokeDateOperation(n,t.TimeUnit.Hour),!1);if(u&&!i)return e.dstEnd=null,e.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,o.length),!1;if(c)return!0;e.dstStart=null;let d=this.#a.hour.findNearestValue(s,i);if(d===null)return e.applyDateOperation(n,t.TimeUnit.Day,o.length),!1;if(this.#u(e)){let r=i?s-d:d-s;for(let i=0;i<r;i++)e.applyDateOperation(n,t.TimeUnit.Hour,o.length)}else e.setHours(d);return e.setMinutes(this.#l(this.#a.minute.values,i)),e.setSeconds(this.#l(this.#a.second.values,i)),!1}#g(t){if(!this.#r&&!this.#i)return;let n=t.getTime();if(this.#r&&n<this.#r.getTime()||this.#i&&n>this.#i.getTime())throw Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#_(i=!1){let a=i?t.DateMathOp.Subtract:t.DateMathOp.Add,o=new t.CronDate(this.#n),s=o.getTime(),c=0;for(;++c<n;){if(this.#g(o),!this.#m(o)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(o.getDate()/7)===this.#a.dayOfWeek.nthDay)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(o.getMonth()+1,this.#a.month.values)){o.applyDateOperation(a,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#h(o,a,i)){if(!r.#c(o.getMinutes(),this.#a.minute.values)){this.#f(o,a,i);continue}if(!r.#c(o.getSeconds(),this.#a.second.values)){this.#d(o,a,i);continue}if(s===o.getTime()){(a===`Add`||o.getMilliseconds()===0)&&o.applyDateOperation(a,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(c>n)throw Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return o.getMilliseconds()!==0&&o.setMilliseconds(0),this.#n=o,o}[Symbol.iterator](){return{next:()=>({value:this.#_(),done:!this.hasNext()})}}};e.CronExpression=r,e.default=r})),me=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.seededRandom=r;function t(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>t>>>0}function n(e){return()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function r(e){return n(e?t(e)():Math.floor(Math.random()*1e10))}})),C=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpressionParser=e.DayOfWeek=e.Months=e.CronUnit=e.PredefinedExpressions=void 0;var t=fe(),n=pe(),r=me(),i=S(),a;(function(e){e[`@yearly`]=`0 0 0 1 1 *`,e[`@annually`]=`0 0 0 1 1 *`,e[`@monthly`]=`0 0 0 1 * *`,e[`@weekly`]=`0 0 0 * * 0`,e[`@daily`]=`0 0 0 * * *`,e[`@hourly`]=`0 0 * * * *`,e[`@minutely`]=`0 * * * * *`,e[`@secondly`]=`* * * * * *`,e[`@weekdays`]=`0 0 0 * * 1-5`,e[`@weekends`]=`0 0 0 * * 0,6`})(a||(e.PredefinedExpressions=a={}));var o;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.DayOfMonth=`DayOfMonth`,e.Month=`Month`,e.DayOfWeek=`DayOfWeek`})(o||(e.CronUnit=o={}));var s;(function(e){e[e.jan=1]=`jan`,e[e.feb=2]=`feb`,e[e.mar=3]=`mar`,e[e.apr=4]=`apr`,e[e.may=5]=`may`,e[e.jun=6]=`jun`,e[e.jul=7]=`jul`,e[e.aug=8]=`aug`,e[e.sep=9]=`sep`,e[e.oct=10]=`oct`,e[e.nov=11]=`nov`,e[e.dec=12]=`dec`})(s||(e.Months=s={}));var c;(function(e){e[e.sun=0]=`sun`,e[e.mon=1]=`mon`,e[e.tue=2]=`tue`,e[e.wed=3]=`wed`,e[e.thu=4]=`thu`,e[e.fri=5]=`fri`,e[e.sat=6]=`sat`})(c||(e.DayOfWeek=c={})),e.CronExpressionParser=class e{static parse(s,c={}){let{strict:l=!1,hashSeed:u}=c,d=(0,r.seededRandom)(u);s=a[s]||s;let f=e.#e(s,l);if(!(f.dayOfMonth===`*`||f.dayOfWeek===`*`||!l))throw Error(`Cannot use both dayOfMonth and dayOfWeek together in strict mode!`);let p=e.#t(o.Second,f.second,i.CronSecond.constraints,d),m=e.#t(o.Minute,f.minute,i.CronMinute.constraints,d),h=e.#t(o.Hour,f.hour,i.CronHour.constraints,d),g=e.#t(o.Month,f.month,i.CronMonth.constraints,d),_=e.#t(o.DayOfMonth,f.dayOfMonth,i.CronDayOfMonth.constraints,d),{dayOfWeek:v,nthDayOfWeek:y}=e.#u(f.dayOfWeek),ee=e.#t(o.DayOfWeek,v,i.CronDayOfWeek.constraints,d),te=new t.CronFieldCollection({second:new i.CronSecond(p,{rawValue:f.second}),minute:new i.CronMinute(m,{rawValue:f.minute}),hour:new i.CronHour(h,{rawValue:f.hour}),dayOfMonth:new i.CronDayOfMonth(_,{rawValue:f.dayOfMonth}),month:new i.CronMonth(g,{rawValue:f.month}),dayOfWeek:new i.CronDayOfWeek(ee,{rawValue:f.dayOfWeek,nthDayOfWeek:y})});return new n.CronExpression(te,{...c,expression:s})}static#e(e,t){if(t&&!e.length)throw Error(`Invalid cron expression`);e||=`0 * * * * *`;let n=e.trim().split(/\s+/);if(t&&n.length<6)throw Error(`Invalid cron expression, expected 6 fields`);if(n.length>6)throw Error(`Invalid cron expression, too many fields`);let r=[`*`,`*`,`*`,`*`,`*`,`0`];n.length<r.length&&n.unshift(...r.slice(n.length));let[i,a,o,s,c,l]=n;return{second:i,minute:a,hour:o,dayOfMonth:s,month:c,dayOfWeek:l}}static#t(e,t,n,r){if((e===o.Month||e===o.DayOfWeek)&&(t=t.replace(/[a-z]{3}/gi,e=>{e=e.toLowerCase();let t=s[e]||c[e];if(t===void 0)throw Error(`Validation error, cannot resolve alias "${e}"`);return t.toString()})),!n.validChars.test(t))throw Error(`Invalid characters, got value: ${t}`);return t=this.#n(t,n),t=this.#r(t,n,r),this.#i(e,t,n)}static#n(e,t){return e.replace(/[*?]/g,t.min+`-`+t.max)}static#r(e,t,n){let r=n();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(e,n,i,a)=>{if(n&&i&&a){let e=parseInt(n,10),o=parseInt(i,10),s=parseInt(a,10);if(e>o)throw Error(`Invalid range: ${e}-${o}, min > max`);if(s<=0)throw Error(`Invalid step: ${s}, must be positive`);let c=Math.max(e,t.min),l=Math.floor(r*s),u=[];for(let e=Math.floor(c/s)*s+l;e<=o;e+=s)e>=c&&u.push(e);return u.join(`,`)}else if(n&&i){let e=parseInt(n,10),t=parseInt(i,10);if(e>t)throw Error(`Invalid range: ${e}-${t}, min > max`);return String(Math.floor(r*(t-e+1))+e)}else if(a){let e=parseInt(a,10);if(e<=0)throw Error(`Invalid step: ${e}, must be positive`);let n=Math.floor(r*e),i=[];for(let r=Math.floor(t.min/e)*e+n;r<=t.max;r+=e)r>=t.min&&i.push(r);return i.join(`,`)}else return String(Math.floor(r*(t.max-t.min+1)+t.min))})}static#i(t,n,r){let i=[];function a(n,r){if(Array.isArray(n))i.push(...n);else if(e.#d(r,n))i.push(n);else{let e=parseInt(n.toString(),10);if(!(e>=r.min&&e<=r.max))throw Error(`Constraint error, got value ${n} expected range ${r.min}-${r.max}`);i.push(t===o.DayOfWeek?e%7:n)}}return n.split(`,`).forEach(n=>{if(!(n.length>0))throw Error(`Invalid list value format`);a(e.#a(t,n,r),r)}),i}static#a(t,n,r){let i=n.split(`/`);if(i.length>2)throw Error(`Invalid repeat: ${n}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${r.max}`),e.#l(t,i[0],parseInt(i[1],10),r)):e.#l(t,n,1,r)}static#o(e,t,n){if(!(!isNaN(e)&&!isNaN(t)&&e>=n.min&&t<=n.max))throw Error(`Constraint error, got range ${e}-${t} expected range ${n.min}-${n.max}`);if(e>t)throw Error(`Invalid range: ${e}-${t}, min(${e}) > max(${t})`)}static#s(e){if(!(!isNaN(e)&&e>0))throw Error(`Constraint error, cannot repeat at every ${e} time.`)}static#c(e,t,n,r){let i=[];e===o.DayOfWeek&&n%7==0&&i.push(0);for(let e=t;e<=n;e+=r)i.indexOf(e)===-1&&i.push(e);return i}static#l(e,t,n,r){let i=t.split(`-`);if(i.length<=1)return isNaN(+t)?t:+t;let[a,o]=i.map(e=>parseInt(e,10));return this.#o(a,o,r),this.#s(n),this.#c(e,a,o,n)}static#u(e){let t=e.split(`#`);if(t.length<=1)return{dayOfWeek:t[0]};let n=+t[t.length-1],r=e.match(/([,-/])/);if(r!==null)throw Error(`Constraint error, invalid dayOfWeek \`#\` and \`${r?.[0]}\` special characters are incompatible`);if(!(t.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw Error(`Constraint error, invalid dayOfWeek occurrence number (#)`);return{dayOfWeek:t[0],nthDayOfWeek:n}}static#d(e,t){return e.chars.some(e=>t.toString().includes(e))}}})),he=t(((e,t)=>{t.exports={}})),w=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})();Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=void 0;var i=C();e.CronFileParser=class e{static async parseFile(t){let{readFile:n}=await Promise.resolve().then(()=>r(he())),i=await n(t,`utf8`);return e.#e(i)}static parseFileSync(t){let{readFileSync:n}=he(),r=n(t,`utf8`);return e.#e(r)}static#e(t){let n=t.split(`
|
|
2
|
+
`),r={variables:{},expressions:[],errors:{}};for(let t of n){let n=t.trim();if(n.length===0||n.startsWith(`#`))continue;let i=n.match(/^(.*)=(.*)$/);if(i){let[,e,t]=i;r.variables[e]=t.replace(/["']/g,``);continue}try{let t=e.#t(n);r.expressions.push(t.interval)}catch(e){r.errors[n]=e}}return r}static#t(e){let t=e.split(` `);return{interval:i.CronExpressionParser.parse(t.slice(0,5).join(` `)),command:t.slice(5,t.length)}}}})),ge=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;var r=C(),i=le();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return i.CronDate}});var a=fe();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var o=pe();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return o.CronExpression}});var s=C();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var c=w();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return c.CronFileParser}}),n(S(),e),e.default=r.CronExpressionParser})),_e=ge();function T(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function E(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function ve(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function ye(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function be(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function xe(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:T(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=_e.CronExpressionParser.parse(t).fields,r=E(e.minute.values),i=E(e.hour.values),a=E(e.dayOfMonth.values),o=E(e.month.values),s=E(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=ve(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=ve(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],c=a[0],l=`${e}-${String(s).padStart(2,`0`)}-${String(c).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:l,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:be(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function Se(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${ye(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}export{ge as a,ve as i,xe as n,te as o,E as r,Se as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{a as i,d as a,i as ee,u as te}from"./popover-select-3E24E65N.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as ne}from"./locale-store-D_dq_0LV.js";import{n as re,r as ie}from"./settings-shell-layer-context-DCp6ykjQ.js";import{el as ae,il as oe,tl as se}from"./index-BGf-TiZj.js";var ce=e(t(),1),le=n();function s(e){return String(e).padStart(2,`0`)}function ue(e){return`${e.getFullYear()}-${s(e.getMonth()+1)}-${s(e.getDate())}`}function de(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2])-1,i=Number(t[3]),a=new Date(n,r,i,12);return a.getFullYear()===n&&a.getMonth()===r&&a.getDate()===i?a:null}function fe(e,t){let n=de(e);return n?t===`zh`?`${n.getFullYear()}/${s(n.getMonth()+1)}/${s(n.getDate())}`:new Intl.DateTimeFormat(`en`,{year:`numeric`,month:`short`,day:`numeric`}).format(n):``}var c=r();function pe(e,t){let n=new Date(e.getFullYear(),e.getMonth(),1,12),r=(n.getDay()-t+7)%7;return Array.from({length:42},(e,t)=>new Date(n.getFullYear(),n.getMonth(),1-r+t,12))}function l(e){let t=(0,le.c)(103),{value:n,onChange:r,disabled:s,className:l,ariaLabel:ve,placeholder:ye}=e,u=ne(_e),d=u===`zh`?`zh-CN`:`en`,f;t[0]===n?f=t[1]:(f=de(n),t[0]=n,t[1]=f);let p=f,[m,be]=(0,ce.useState)(!1),h;t[2]===p?h=t[3]:(h=()=>p??new Date,t[2]=p,t[3]=h);let[g,xe]=(0,ce.useState)(h),Se=ie(),Ce=ee(re(),Se!==null),_=+(u===`zh`),v,y;t[4]!==m||t[5]!==n?(v=()=>{if(!m)return;let e=de(n);e&&xe(e)},y=[m,n],t[4]=m,t[5]=n,t[6]=v,t[7]=y):(v=t[6],y=t[7]),(0,ce.useEffect)(v,y);let b;t[8]!==g||t[9]!==_?(b=pe(g,_),t[8]=g,t[9]=_,t[10]=b):b=t[10];let we=b,x;if(t[11]!==d||t[12]!==_){let e=new Date(2026,7,23,12);x=Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+_+n),new Intl.DateTimeFormat(d,{weekday:`narrow`}).format(r)}),t[11]=d,t[12]=_,t[13]=x}else x=t[13];let Te=x,S;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(S=ue(new Date),t[14]=S):S=t[14];let C=S,w;t[15]===p?w=t[16]:(w=p?ue(p):``,t[15]=p,t[16]=w);let T=w,E;t[17]!==d||t[18]!==g?(E=new Intl.DateTimeFormat(d,{year:`numeric`,month:`long`}).format(g),t[17]=d,t[18]=g,t[19]=E):E=t[19];let Ee=E,D;t[20]===r?D=t[21]:(D=e=>{r(e),be(!1)},t[20]=r,t[21]=D);let O=D,De=a,Oe=s&&`cursor-not-allowed opacity-50`,k;t[22]!==l||t[23]!==Oe?(k=o(`flex h-10 w-full min-w-0 items-center justify-between gap-3 rounded-lg bg-surface-hover px-3 text-left text-sm text-fg outline-none transition-colors`,`hover:bg-surface-active focus-visible:ring-2 focus-visible:ring-accent/40`,Oe,l),t[22]=l,t[23]=Oe,t[24]=k):k=t[24];let ke=!n&&`text-fg-subtle`,A;t[25]===ke?A=t[26]:(A=o(`min-w-0 truncate tabular-nums`,ke),t[25]=ke,t[26]=A);let j;t[27]!==u||t[28]!==ye||t[29]!==n?(j=fe(n,u)||ye||(u===`zh`?`选择日期`:`Select date`),t[27]=u,t[28]=ye,t[29]=n,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,c.jsx)(`span`,{className:A,children:j}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,c.jsx)(oe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[34]=N):N=t[34];let P;t[35]!==ve||t[36]!==s||t[37]!==k||t[38]!==M?(P=(0,c.jsx)(te,{asChild:!0,children:(0,c.jsxs)(`button`,{type:`button`,disabled:s,"aria-label":ve,className:k,children:[M,N]})}),t[35]=ve,t[36]=s,t[37]=k,t[38]=M,t[39]=P):P=t[39];let Ae=a,je=Se??void 0,Me=a,Ne=o(Ce,`w-[19rem] rounded-2xl bg-surface-panel p-3 shadow-float outline-none`),Pe=u===`zh`?`上个月`:`Previous month`,F,I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>xe(ge),I=(0,c.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t[40]=F,t[41]=I):(F=t[40],I=t[41]);let L;t[42]===Pe?L=t[43]:(L=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Pe,onClick:F,children:I}),t[42]=Pe,t[43]=L);let R;t[44]===Ee?R=t[45]:(R=(0,c.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:Ee}),t[44]=Ee,t[45]=R);let Fe=u===`zh`?`下个月`:`Next month`,z,B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>xe(he),B=(0,c.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[46]=z,t[47]=B):(z=t[46],B=t[47]);let V;t[48]===Fe?V=t[49]:(V=(0,c.jsx)(`button`,{type:`button`,className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":Fe,onClick:z,children:B}),t[48]=Fe,t[49]=V);let H;t[50]!==L||t[51]!==R||t[52]!==V?(H=(0,c.jsxs)(`div`,{className:`flex h-10 items-center justify-between gap-2 px-1`,children:[L,R,V]}),t[50]=L,t[51]=R,t[52]=V,t[53]=H):H=t[53];let U;t[54]===Te?U=t[55]:(U=(0,c.jsx)(`div`,{className:`mt-2 grid grid-cols-7`,"aria-hidden":!0,children:Te.map(me)}),t[54]=Te,t[55]=U);let W;if(t[56]!==we||t[57]!==d||t[58]!==O||t[59]!==T||t[60]!==C||t[61]!==g){let e;t[63]!==d||t[64]!==O||t[65]!==T||t[66]!==C||t[67]!==g?(e=e=>{let t=ue(e),n=t===T,r=t===C,i=e.getMonth()!==g.getMonth();return(0,c.jsx)(`button`,{type:`button`,role:`gridcell`,"aria-selected":n,"aria-label":new Intl.DateTimeFormat(d,{dateStyle:`full`}).format(e),className:o(`mx-auto flex size-9 items-center justify-center rounded-xl text-sm tabular-nums text-fg transition-colors`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,i&&`text-fg-disabled`,r&&!n&&`bg-accent-soft font-semibold text-accent-fg`,n&&`bg-accent font-semibold text-white hover:bg-accent-hover`),onClick:()=>O(t),children:e.getDate()},t)},t[63]=d,t[64]=O,t[65]=T,t[66]=C,t[67]=g,t[68]=e):e=t[68],W=we.map(e),t[56]=we,t[57]=d,t[58]=O,t[59]=T,t[60]=C,t[61]=g,t[62]=W}else W=t[62];let G;t[69]===W?G=t[70]:(G=(0,c.jsx)(`div`,{className:`grid grid-cols-7 gap-y-1`,role:`grid`,children:W}),t[69]=W,t[70]=G);let Ie=!n,K;t[71]===O?K=t[72]:(K=()=>O(``),t[71]=O,t[72]=K);let Le=u===`zh`?`清除`:`Clear`,q;t[73]!==Ie||t[74]!==K||t[75]!==Le?(q=(0,c.jsx)(`button`,{type:`button`,disabled:Ie,className:`rounded-lg px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg disabled:pointer-events-none disabled:opacity-35`,onClick:K,children:Le}),t[73]=Ie,t[74]=K,t[75]=Le,t[76]=q):q=t[76];let J;t[77]!==O||t[78]!==C?(J=()=>O(C),t[77]=O,t[78]=C,t[79]=J):J=t[79];let Re=u===`zh`?`今天`:`Today`,Y;t[80]!==J||t[81]!==Re?(Y=(0,c.jsx)(`button`,{type:`button`,className:`rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs font-medium text-accent-fg hover:bg-accent-soft/80`,onClick:J,children:Re}),t[80]=J,t[81]=Re,t[82]=Y):Y=t[82];let X;t[83]!==q||t[84]!==Y?(X=(0,c.jsxs)(`div`,{className:`mt-2 flex items-center justify-between px-1 pt-1`,children:[q,Y]}),t[83]=q,t[84]=Y,t[85]=X):X=t[85];let Z;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,c.jsx)(i,{className:`fill-surface-panel`}),t[86]=Z):Z=t[86];let Q;t[87]!==Me.Content||t[88]!==Ne||t[89]!==H||t[90]!==U||t[91]!==G||t[92]!==X?(Q=(0,c.jsxs)(Me.Content,{align:`start`,sideOffset:6,collisionPadding:12,className:Ne,children:[H,U,G,X,Z]}),t[87]=Me.Content,t[88]=Ne,t[89]=H,t[90]=U,t[91]=G,t[92]=X,t[93]=Q):Q=t[93];let $;t[94]!==Ae.Portal||t[95]!==je||t[96]!==Q?($=(0,c.jsx)(Ae.Portal,{container:je,children:Q}),t[94]=Ae.Portal,t[95]=je,t[96]=Q,t[97]=$):$=t[97];let ze;return t[98]!==m||t[99]!==De.Root||t[100]!==P||t[101]!==$?(ze=(0,c.jsxs)(De.Root,{open:m,onOpenChange:be,children:[P,$]}),t[98]=m,t[99]=De.Root,t[100]=P,t[101]=$,t[102]=ze):ze=t[102],ze}function me(e,t){return(0,c.jsx)(`div`,{className:`flex h-8 items-center justify-center text-[11px] font-medium text-fg-subtle`,children:e},`${e}-${t}`)}function he(e){return new Date(e.getFullYear(),e.getMonth()+1,1,12)}function ge(e){return new Date(e.getFullYear(),e.getMonth()-1,1,12)}function _e(e){return e.language}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./search-DA7gz22f.js";import{t as o}from"./x-B_N4OPjy.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./button-CSEbl4zT.js";import{a as l,i as u,n as d,r as f,t as p}from"./dist-DqPZM2MH2.js";import{$s as m,nl as h}from"./index-BGf-TiZj.js";var g=n(),_=e(t(),1),v=r(),y=`!z-[10000] max-w-[min(28rem,90vw)] rounded-md border border-edge bg-surface-panel px-2.5 py-2 text-left text-xs leading-relaxed text-fg shadow-lg`;function b(e){let t=(0,g.c)(30),{candidates:n,selectedIds:r,labels:b,disabled:S,borderless:C,onChange:w}=e,T=C===void 0?!1:C,[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(``),A;t[0]===O?A=t[1]:(A=O.trim().toLocaleLowerCase(),t[0]=O,t[1]=A);let j=A,M;if(t[2]!==n||t[3]!==j){let e;t[5]===j?e=t[6]:(e=e=>!j||e.title.toLocaleLowerCase().includes(j),t[5]=j,t[6]=e),M=n.filter(e).slice(0,20),t[2]=n,t[3]=j,t[4]=M}else M=t[4];let N=M,P;t[7]!==n||t[8]!==S||t[9]!==b.remove||t[10]!==w||t[11]!==r?(P=r.length>0?(0,v.jsx)(`div`,{className:`flex min-w-0 flex-wrap gap-2`,children:r.map(e=>{let t=n.find(t=>t.id===e);return t?(0,v.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-lg bg-accent-soft px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,v.jsxs)(u,{children:[(0,v.jsx)(l,{asChild:!0,children:(0,v.jsx)(`span`,{className:`min-w-0 truncate`,children:t.title})}),(0,v.jsx)(d,{children:(0,v.jsx)(p,{side:`top`,sideOffset:6,collisionPadding:12,className:y,children:(0,v.jsx)(`span`,{className:`break-words`,children:t.title})})})]}),(0,v.jsx)(`button`,{type:`button`,className:`shrink-0 rounded text-accent-fg/70 hover:text-accent-fg`,"aria-label":b.remove.replace(`{{task}}`,t.title),disabled:S,onClick:()=>w(r.filter(e=>e!==t.id)),children:(0,v.jsx)(o,{className:`size-3.5`,"aria-hidden":!0})})]},t.id):null})}):null,t[7]=n,t[8]=S,t[9]=b.remove,t[10]=w,t[11]=r,t[12]=P):P=t[12];let F;t[13]!==T||t[14]!==n.length||t[15]!==S||t[16]!==b.link||t[17]!==b.linked||t[18]!==b.noCandidates||t[19]!==b.noMatches||t[20]!==b.searchPlaceholder||t[21]!==N||t[22]!==w||t[23]!==E||t[24]!==O||t[25]!==r?(F=n.length>0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(c,{type:`button`,variant:`secondary`,className:s(`w-fit rounded-lg`,T&&`border-0 bg-surface-hover shadow-none`),disabled:S,"aria-expanded":E,onClick:()=>D(x),children:[(0,v.jsx)(m,{className:`size-4`,"aria-hidden":!0}),r.length>0?b.linked.replace(`{{count}}`,String(r.length)):b.link,(0,v.jsx)(h,{className:s(`size-3.5 transition-transform`,E&&`rotate-180`),"aria-hidden":!0})]}),E?(0,v.jsxs)(`div`,{className:s(`grid gap-2 rounded-lg p-2`,T?`bg-surface-hover`:`border border-edge bg-surface-base`),children:[(0,v.jsxs)(`label`,{className:`relative block`,children:[(0,v.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,v.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:b.searchPlaceholder,className:s(`h-9 w-full rounded-md bg-surface-panel pl-8 pr-3 text-sm text-fg outline-none placeholder:text-fg-subtle`,T?`focus:ring-2 focus:ring-accent/30`:`border border-edge focus:border-accent`),autoFocus:!0})]}),N.length>0?(0,v.jsx)(`div`,{className:`grid max-h-52 gap-1 overflow-y-auto`,children:N.map(e=>{let t=r.includes(e.id);return(0,v.jsxs)(`button`,{type:`button`,"aria-pressed":t,disabled:S,onClick:()=>w(t?r.filter(t=>t!==e.id):[...r,e.id]),className:s(`flex items-center gap-2 rounded-md px-2.5 py-2 text-left text-sm transition-colors`,t?`bg-accent-soft text-accent-fg`:`text-fg hover:bg-surface-hover`),children:[(0,v.jsx)(`span`,{className:s(`flex size-4 shrink-0 items-center justify-center rounded`,T?t?`bg-accent text-white`:`bg-surface-active`:t?`border border-accent bg-accent text-white`:`border border-edge`),children:t?(0,v.jsx)(i,{className:`size-3`,"aria-hidden":!0}):null}),(0,v.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title})]},e.id)})}):(0,v.jsx)(`p`,{className:`px-2 py-3 text-center text-sm text-fg-subtle`,children:b.noMatches})]}):null]}):(0,v.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:b.noCandidates}),t[13]=T,t[14]=n.length,t[15]=S,t[16]=b.link,t[17]=b.linked,t[18]=b.noCandidates,t[19]=b.noMatches,t[20]=b.searchPlaceholder,t[21]=N,t[22]=w,t[23]=E,t[24]=O,t[25]=r,t[26]=F):F=t[26];let I;return t[27]!==P||t[28]!==F?(I=(0,v.jsx)(f,{delayDuration:300,children:(0,v.jsxs)(`div`,{className:`min-w-0 grid gap-2`,children:[P,F]})}),t[27]=P,t[28]=F,t[29]=I):I=t[29],I}function x(e){return!e}export{b as t};
|