cartethyia 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +3 -3
- package/dist/dashboard/assets/{BannedPage-Cc0vKpMG.js → BannedPage-Dq530awD.js} +1 -1
- package/dist/dashboard/assets/BannedPage-Dq530awD.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolDetailPage-Bqj2aa1T.js → CliToolDetailPage-DZzaS-7S.js} +1 -1
- package/dist/dashboard/assets/CliToolDetailPage-DZzaS-7S.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolsPage-CXsaOAO2.js → CliToolsPage-DaZZ3cqP.js} +1 -1
- package/dist/dashboard/assets/CliToolsPage-DaZZ3cqP.js.gz +0 -0
- package/dist/dashboard/assets/{CombosPage-BeLpJ4ma.js → CombosPage-BlC_xdkX.js} +1 -1
- package/dist/dashboard/assets/CombosPage-BlC_xdkX.js.gz +0 -0
- package/dist/dashboard/assets/{ConsoleLogPage-DnV0uZ3m.js → ConsoleLogPage-D-rqeVtG.js} +1 -1
- package/dist/dashboard/assets/ConsoleLogPage-D-rqeVtG.js.gz +0 -0
- package/dist/dashboard/assets/{CustomizationPage-CBxAjo63.js → CustomizationPage-7xT5yg2E.js} +1 -1
- package/dist/dashboard/assets/CustomizationPage-7xT5yg2E.js.gz +0 -0
- package/dist/dashboard/assets/{HealthEventsModal-B5yEE0k6.js → HealthEventsModal-Clq8E9cW.js} +1 -1
- package/dist/dashboard/assets/HealthEventsModal-Clq8E9cW.js.gz +0 -0
- package/dist/dashboard/assets/{InjectSystemPromptPanel-BWFLECmz.js → InjectSystemPromptPanel-6Teoq9Se.js} +1 -1
- package/dist/dashboard/assets/InjectSystemPromptPanel-6Teoq9Se.js.gz +0 -0
- package/dist/dashboard/assets/{LoginPage-CgoPc5B9.js → LoginPage-CZuI0MAR.js} +1 -1
- package/dist/dashboard/assets/LoginPage-CZuI0MAR.js.gz +0 -0
- package/dist/dashboard/assets/{ModelPicker-D9bFQern.js → ModelPicker-C1hNTlkr.js} +1 -1
- package/dist/dashboard/assets/ModelPicker-C1hNTlkr.js.gz +0 -0
- package/dist/dashboard/assets/{OverviewPage-B_p4tL8k.js → OverviewPage-0yfhSI1C.js} +1 -1
- package/dist/dashboard/assets/OverviewPage-0yfhSI1C.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage-xqTxdQ4c.js +8 -0
- package/dist/dashboard/assets/ProviderDetailPage-xqTxdQ4c.js.gz +0 -0
- package/dist/dashboard/assets/{ProviderIcon-D_0PiZtg.js → ProviderIcon-Ddhm1InL.js} +1 -1
- package/dist/dashboard/assets/ProviderIcon-Ddhm1InL.js.gz +0 -0
- package/dist/dashboard/assets/{ProvidersPage-CLI2bJTK.js → ProvidersPage-C3fYuu6i.js} +1 -1
- package/dist/dashboard/assets/ProvidersPage-C3fYuu6i.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-CHtJtZ3u.js +9 -0
- package/dist/dashboard/assets/ProxyPage-CHtJtZ3u.js.gz +0 -0
- package/dist/dashboard/assets/{QuotaPage-DA-a1iSN.js → QuotaPage-D1RV_2BX.js} +1 -1
- package/dist/dashboard/assets/QuotaPage-D1RV_2BX.js.gz +0 -0
- package/dist/dashboard/assets/{SettingsPage-CctTga2C.js → SettingsPage-BzZAvYSX.js} +1 -1
- package/dist/dashboard/assets/SettingsPage-BzZAvYSX.js.gz +0 -0
- package/dist/dashboard/assets/{SetupPage-febLU4r1.js → SetupPage--s-EfEIL.js} +1 -1
- package/dist/dashboard/assets/SetupPage--s-EfEIL.js.gz +0 -0
- package/dist/dashboard/assets/{StudioPage-M6fvR5Wz.js → StudioPage-BjXFGSK4.js} +1 -1
- package/dist/dashboard/assets/StudioPage-BjXFGSK4.js.gz +0 -0
- package/dist/dashboard/assets/{UsagePage-nyeuRqz9.js → UsagePage-CP8F8BN7.js} +1 -1
- package/dist/dashboard/assets/UsagePage-CP8F8BN7.js.gz +0 -0
- package/dist/dashboard/assets/{api-keys-BFOlvrJC.js → api-keys-2hc12Uz2.js} +1 -1
- package/dist/dashboard/assets/api-keys-2hc12Uz2.js.gz +0 -0
- package/dist/dashboard/assets/app-DGXbNfAR.css +2 -0
- package/dist/dashboard/assets/app-DGXbNfAR.css.gz +0 -0
- package/dist/dashboard/assets/{assert-CqTLw5e7.js → assert-BMcj1xZE.js} +1 -1
- package/dist/dashboard/assets/assert-BMcj1xZE.js.gz +0 -0
- package/dist/dashboard/assets/{badge-C83EqLB0.js → badge-DkRUuVfz.js} +1 -1
- package/dist/dashboard/assets/badge-DkRUuVfz.js.gz +0 -0
- package/dist/dashboard/assets/{banner-D1xn7pIe.js → banner-CDjW841Q.js} +1 -1
- package/dist/dashboard/assets/banner-CDjW841Q.js.gz +0 -0
- package/dist/dashboard/assets/{card-DU3Lq5Lm.js → card-Bto5UlL9.js} +1 -1
- package/dist/dashboard/assets/card-Bto5UlL9.js.gz +0 -0
- package/dist/dashboard/assets/{cli-tools-Dw1U_drK.js → cli-tools-DaH6g9hL.js} +1 -1
- package/dist/dashboard/assets/cli-tools-DaH6g9hL.js.gz +0 -0
- package/dist/dashboard/assets/{clipboard-button-CEL5Sg_J.js → clipboard-button-BYKBCzjk.js} +1 -1
- package/dist/dashboard/assets/clipboard-button-BYKBCzjk.js.gz +0 -0
- package/dist/dashboard/assets/{dialog-BjFR5UHy.js → dialog-DL0Zftwv.js} +1 -1
- package/dist/dashboard/assets/dialog-DL0Zftwv.js.gz +0 -0
- package/dist/dashboard/assets/{drawer-HvBW0AjI.js → drawer-Dpx_UXaS.js} +1 -1
- package/dist/dashboard/assets/drawer-Dpx_UXaS.js.gz +0 -0
- package/dist/dashboard/assets/{entry-CECVELyy.js → entry-BV7-1NoM.js} +1 -1
- package/dist/dashboard/assets/entry-BV7-1NoM.js.gz +0 -0
- package/dist/dashboard/assets/{entry-DYYofQ7W.js → entry-CGvdNU6r.js} +1 -1
- package/dist/dashboard/assets/entry-CGvdNU6r.js.gz +0 -0
- package/dist/dashboard/assets/{entry-BSu3gFlt.js → entry-DScKYvZj.js} +3 -3
- package/dist/dashboard/assets/entry-DScKYvZj.js.gz +0 -0
- package/dist/dashboard/assets/{formatters-DLW4i8zK.js → formatters-BS3DZlZj.js} +1 -1
- package/dist/dashboard/assets/formatters-BS3DZlZj.js.gz +0 -0
- package/dist/dashboard/assets/{index-1-fCqe64.js → index-SQnvvTWX.js} +2 -2
- package/dist/dashboard/assets/index-SQnvvTWX.js.gz +0 -0
- package/dist/dashboard/assets/{inline-DGvU2oLK.js → inline-Dl-cuLK0.js} +1 -1
- package/dist/dashboard/assets/inline-Dl-cuLK0.js.gz +0 -0
- package/dist/dashboard/assets/{input-iNnO1X2K.js → input-Bfx0EzRc.js} +1 -1
- package/dist/dashboard/assets/input-Bfx0EzRc.js.gz +0 -0
- package/dist/dashboard/assets/{layout-0q8UGypb.js → layout-BxhbQ_JS.js} +1 -1
- package/dist/dashboard/assets/layout-BxhbQ_JS.js.gz +0 -0
- package/dist/dashboard/assets/{list-row-C0w2bQjJ.js → list-row-D49Y4ptn.js} +1 -1
- package/dist/dashboard/assets/list-row-D49Y4ptn.js.gz +0 -0
- package/dist/dashboard/assets/{live-M5aJ_xCa.js → live-CbVTdX9V.js} +1 -1
- package/dist/dashboard/assets/live-CbVTdX9V.js.gz +0 -0
- package/dist/dashboard/assets/{network-BKeQGT3K.js → network-JGvDveof.js} +1 -1
- package/dist/dashboard/assets/network-JGvDveof.js.gz +0 -0
- package/dist/dashboard/assets/{numbers-CivAk3da.js → numbers-Dw6kiew-.js} +1 -1
- package/dist/dashboard/assets/numbers-Dw6kiew-.js.gz +0 -0
- package/dist/dashboard/assets/{pagination-CpzvI5ep.js → pagination-iUoI8GeE.js} +1 -1
- package/dist/dashboard/assets/pagination-iUoI8GeE.js.gz +0 -0
- package/dist/dashboard/assets/providers/sensenova-intl.png +0 -0
- package/dist/dashboard/assets/providers/sensenova.png +0 -0
- package/dist/dashboard/assets/{routing-BFQX2VBc.js → routing-8jZr-3WE.js} +1 -1
- package/dist/dashboard/assets/routing-8jZr-3WE.js.gz +0 -0
- package/dist/dashboard/assets/{select-CXbck0jG.js → select-oO1FxMVb.js} +1 -1
- package/dist/dashboard/assets/select-oO1FxMVb.js.gz +0 -0
- package/dist/dashboard/assets/{settings-C_XvMHh9.js → settings-CLr3kdIx.js} +1 -1
- package/dist/dashboard/assets/settings-CLr3kdIx.js.gz +0 -0
- package/dist/dashboard/assets/{stack-DggRiCxE.js → stack-Y3pDteZr.js} +1 -1
- package/dist/dashboard/assets/stack-Y3pDteZr.js.gz +0 -0
- package/dist/dashboard/assets/{state-ClFzfbYp.js → state-CArX_Iak.js} +1 -1
- package/dist/dashboard/assets/state-CArX_Iak.js.gz +0 -0
- package/dist/dashboard/assets/{switch-CTIFxKqS.js → switch-DwlwmDO-.js} +1 -1
- package/dist/dashboard/assets/switch-DwlwmDO-.js.gz +0 -0
- package/dist/dashboard/assets/{useMutation-BClG3yWj.js → useMutation-DJ9GYEgf.js} +1 -1
- package/dist/dashboard/assets/useMutation-DJ9GYEgf.js.gz +0 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/dashboard/index.html.gz +0 -0
- package/dist/dashboard/precompressed-assets.json +51 -51
- package/migrations/full-postgres/0047_add_provider_device_flow_proxy.sql +17 -0
- package/migrations/lite-sqlite3/0047_add_provider_device_flow_proxy.sql +19 -0
- package/package.json +1 -1
- package/src/boot/app.ts +1 -1
- package/src/boot/dependencies.ts +4 -6
- package/src/config/providers.ts +6 -5
- package/src/config/spec.ts +8 -8
- package/src/console/backup/nine-router.ts +71 -10
- package/src/console/backup/service.ts +8 -1
- package/src/console/console-router.ts +1 -1
- package/src/console/domain-registration.ts +7 -2
- package/src/console/inferhub/client.ts +1 -1
- package/src/console/observability/live.ts +2 -2
- package/src/console/providers/catalog/contracts.ts +9 -3
- package/src/console/providers/catalog/model-operations.ts +2 -3
- package/src/console/providers/catalog/provider-operations.ts +1 -1
- package/src/console/providers/catalog/routes.ts +2 -2
- package/src/console/providers/catalog/store.ts +1914 -1907
- package/src/console/providers/detail/routes.ts +1 -0
- package/src/console/providers/detail/store.ts +4 -0
- package/src/console/providers/oauth/callback-listener.ts +30 -11
- package/src/console/providers/oauth/device-egress.ts +123 -0
- package/src/console/providers/oauth/routes.ts +123 -16
- package/src/console/quota/account-quota-tenant.ts +5 -5
- package/src/console/quota/account-test-egress.ts +2 -2
- package/src/console/quota/daily-growth-job.ts +1 -1
- package/src/console/routing/pools/contracts.ts +1 -1
- package/src/console/routing/pools/operations.ts +1 -1
- package/src/console/routing/pools/probe-verdict.ts +2 -2
- package/src/console/routing/pools/relay-deploy.ts +1 -1
- package/src/console/routing/pools/store.ts +4 -4
- package/src/network/client.ts +67 -0
- package/src/network/egress/bidi-session.ts +322 -0
- package/src/network/egress/dial.ts +201 -0
- package/src/network/egress/factory.ts +191 -0
- package/src/network/{outbound-fetch.ts → egress/fetch.ts} +195 -29
- package/src/network/egress/tls-profile.ts +123 -0
- package/src/network/egress/ws.ts +175 -0
- package/src/network/{types.ts → pool/agent-config.ts} +1 -1
- package/src/network/pool/agent.ts +2 -2
- package/src/network/{pool-cooldown-store.ts → pool/cooldown-store.ts} +7 -7
- package/src/network/{pool-health-machine.ts → pool/health.ts} +205 -6
- package/src/network/pool/resolver.ts +10 -849
- package/src/network/pool/selector.ts +2 -2
- package/src/network/ssrf.ts +1 -1
- package/src/network/{retry.ts → util/retry.ts} +1 -1
- package/src/observability/telemetry-buffer.ts +1 -1
- package/src/persistence/schema.ts +9 -0
- package/src/persistence/ttl-cache.ts +1 -1
- package/src/protocol/codecs.ts +58 -1
- package/src/protocol/request/messages.ts +31 -18
- package/src/protocol/response/messages.ts +34 -7
- package/src/protocol/translation/quirks.ts +15 -0
- package/src/protocol/upstream/send-claude-messages.ts +2 -2
- package/src/providers/adapters/compatible-adapter.ts +5 -0
- package/src/providers/authentication/oauth-client.ts +40 -6
- package/src/providers/authentication/oauth-device-flow.ts +7 -3
- package/src/providers/authentication/oauth-flow-store.ts +82 -1
- package/src/providers/authentication/oauth-refresh-service.ts +766 -739
- package/src/providers/default-registry.ts +76 -0
- package/src/providers/discovery/discovery-types.ts +7 -0
- package/src/providers/discovery/probe-phases.ts +6 -2
- package/src/providers/discovery/probing-service.ts +7 -0
- package/src/providers/integrations/antigravity/antigravity-protocol.ts +11 -0
- package/src/providers/integrations/buddy/account.ts +969 -0
- package/src/providers/integrations/buddy/capabilities.ts +10 -10
- package/src/providers/integrations/buddy/{buddy-catalog-shared.ts → catalog.ts} +198 -136
- package/src/providers/integrations/buddy/{buddy-chat-shared.ts → chat.ts} +5 -5
- package/src/providers/integrations/buddy/codebuddy/index.ts +429 -0
- package/src/providers/integrations/buddy/codebuddy/shared.ts +4 -4
- package/src/providers/integrations/buddy/{buddy-identity.ts → headers.ts} +138 -140
- package/src/providers/integrations/buddy/lifecycle.ts +1018 -0
- package/src/providers/integrations/buddy/{buddy-media.ts → media.ts} +1 -1
- package/src/providers/integrations/cline/cline-oauth.ts +10 -5
- package/src/providers/integrations/cline/cline.ts +3 -4
- package/src/providers/integrations/clixad/clixad-oauth.ts +98 -0
- package/src/providers/integrations/clixad/clixad-quota.ts +132 -0
- package/src/providers/integrations/clixad/provider.ts +145 -0
- package/src/providers/integrations/codex/codex-oauth.ts +8 -5
- package/src/providers/integrations/cursor/cursor-auth.ts +1 -1
- package/src/providers/integrations/cursor/cursor-hardening.ts +279 -0
- package/src/providers/integrations/cursor/cursor-http2.ts +605 -6
- package/src/providers/integrations/cursor/cursor-shared.ts +1 -1
- package/src/providers/integrations/cursor/cursor.ts +485 -70
- package/src/providers/integrations/deepai/deepai-catalog.ts +149 -0
- package/src/providers/integrations/deepai/deepai-common.ts +145 -0
- package/src/providers/integrations/deepai/deepai-oauth.ts +129 -0
- package/src/providers/integrations/deepai/deepai-quota.ts +97 -0
- package/src/providers/integrations/deepai/provider.ts +42 -0
- package/src/providers/integrations/devin/devin-auth.ts +7 -0
- package/src/providers/integrations/factory/factory-oauth.ts +16 -7
- package/src/providers/integrations/freebuff/freebuff.ts +2 -2
- package/src/providers/integrations/freepi/freepi-catalog.ts +5 -0
- package/src/providers/integrations/freepi/freepi-discovery.ts +2 -2
- package/src/providers/integrations/freepi/freepi-headers.ts +2 -2
- package/src/providers/integrations/freepi/freepi-protocol.ts +11 -2
- package/src/providers/integrations/freepi/freepi-realm.ts +0 -3
- package/src/providers/integrations/freepi/freepi-session.ts +158 -0
- package/src/providers/integrations/freepi/freepi.ts +80 -54
- package/src/providers/integrations/github/github-discovery.ts +30 -13
- package/src/providers/integrations/github/github-oauth.ts +217 -44
- package/src/providers/integrations/github/github-quota.ts +22 -5
- package/src/providers/integrations/github/github.ts +40 -32
- package/src/providers/integrations/grok/grok-oauth.ts +4 -4
- package/src/providers/integrations/hermes/hermes-oauth.ts +3 -3
- package/src/providers/integrations/hermes/hermes.ts +34 -5
- package/src/providers/integrations/kilo/kilo-oauth.ts +4 -4
- package/src/providers/integrations/kilo/kilo.ts +1 -1
- package/src/providers/integrations/kimi/kimi-oauth.ts +3 -3
- package/src/providers/integrations/kiro/kiro-oauth.ts +2 -2
- package/src/providers/integrations/muse/muse-oauth.ts +5 -5
- package/src/providers/integrations/opencode/fingerprint.ts +1 -1
- package/src/providers/integrations/openrouter/provider.ts +1 -1
- package/src/providers/integrations/perch/perch-protocol.ts +0 -3
- package/src/providers/integrations/perch/perch.ts +3 -3
- package/src/providers/integrations/qoder/claim-qoder-credits.ts +1 -1
- package/src/providers/integrations/qoder/qoder-adapter.ts +19 -113
- package/src/providers/integrations/qoder/qoder-auth.ts +8 -1
- package/src/providers/integrations/qoder/qoder-catalog.ts +1 -1
- package/src/providers/integrations/qoder/qoder-chat.ts +25 -8
- package/src/providers/integrations/qoder/qoder-checkin.ts +1 -1
- package/src/providers/integrations/qoder/qoder-cosy.ts +37 -9
- package/src/providers/integrations/qoder/qoder-oauth.ts +9 -2
- package/src/providers/integrations/qoder/qoder-realm.ts +13 -36
- package/src/providers/integrations/qoder/qoder-sse.ts +447 -68
- package/src/providers/integrations/qoder/qoder-types.ts +9 -0
- package/src/providers/integrations/qoder/qoder.ts +3 -25
- package/src/providers/integrations/sensenova/provider.ts +144 -0
- package/src/providers/integrations/trae/trae-quota.ts +15 -1
- package/src/providers/integrations/vercel/provider.ts +117 -0
- package/src/providers/integrations/vercel/vercel-quota.ts +96 -0
- package/src/providers/integrations/xai/xai-oauth.ts +5 -5
- package/src/providers/integrations/zcode-start-plan/gifts.ts +1 -1
- package/src/providers/integrations/zcode-start-plan/oauth.ts +3 -3
- package/src/providers/integrations/zro/zro.ts +2 -1
- package/src/providers/operations/account-refresh-status.ts +14 -0
- package/src/providers/operations/client-versions.ts +95 -30
- package/src/providers/operations/oauth-refresh-lead.ts +46 -22
- package/src/providers/operations/provider-caches.ts +1 -1
- package/src/providers/operations/provider-credential-service.ts +22 -25
- package/src/providers/operations/session-resolution.ts +17 -1
- package/src/providers/provider-contracts.ts +2 -2
- package/src/providers/provider-metadata.ts +30 -0
- package/src/providers/quota/quota-contracts.ts +2 -0
- package/src/providers/quota/refresh.ts +25 -3
- package/src/security/ip-boundary.ts +1 -1
- package/src/transport/dispatch/attempt-finalize.ts +1 -1
- package/src/transport/dispatch/attempt-loop.ts +3 -3
- package/src/transport/dispatch/handler-deps.ts +1 -1
- package/src/transport/dispatch/leases.ts +1 -1
- package/src/transport/dispatch/retry-policy.ts +1 -1
- package/src/transport/dispatch/streaming/finalize.ts +2 -2
- package/src/transport/dispatch/streaming/stream.ts +1 -1
- package/src/transport/dispatch/upstream.ts +1 -1
- package/src/transport/shutdown-notice.ts +1 -1
- package/src/workers/buddy-growth-tasks.ts +8 -8
- package/src/workers/daily-checkin.ts +4 -4
- package/src/workers/quota-refresh-sweep.ts +1 -1
- package/src/workers/zcode-gift-claim.ts +1 -1
- package/dist/dashboard/assets/BannedPage-Cc0vKpMG.js.gz +0 -0
- package/dist/dashboard/assets/CliToolDetailPage-Bqj2aa1T.js.gz +0 -0
- package/dist/dashboard/assets/CliToolsPage-CXsaOAO2.js.gz +0 -0
- package/dist/dashboard/assets/CombosPage-BeLpJ4ma.js.gz +0 -0
- package/dist/dashboard/assets/ConsoleLogPage-DnV0uZ3m.js.gz +0 -0
- package/dist/dashboard/assets/CustomizationPage-CBxAjo63.js.gz +0 -0
- package/dist/dashboard/assets/HealthEventsModal-B5yEE0k6.js.gz +0 -0
- package/dist/dashboard/assets/InjectSystemPromptPanel-BWFLECmz.js.gz +0 -0
- package/dist/dashboard/assets/LoginPage-CgoPc5B9.js.gz +0 -0
- package/dist/dashboard/assets/ModelPicker-D9bFQern.js.gz +0 -0
- package/dist/dashboard/assets/OverviewPage-B_p4tL8k.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage-rs5E2rxv.js +0 -8
- package/dist/dashboard/assets/ProviderDetailPage-rs5E2rxv.js.gz +0 -0
- package/dist/dashboard/assets/ProviderIcon-D_0PiZtg.js.gz +0 -0
- package/dist/dashboard/assets/ProvidersPage-CLI2bJTK.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-BwNC_-Cx.js +0 -9
- package/dist/dashboard/assets/ProxyPage-BwNC_-Cx.js.gz +0 -0
- package/dist/dashboard/assets/QuotaPage-DA-a1iSN.js.gz +0 -0
- package/dist/dashboard/assets/SettingsPage-CctTga2C.js.gz +0 -0
- package/dist/dashboard/assets/SetupPage-febLU4r1.js.gz +0 -0
- package/dist/dashboard/assets/StudioPage-M6fvR5Wz.js.gz +0 -0
- package/dist/dashboard/assets/UsagePage-nyeuRqz9.js.gz +0 -0
- package/dist/dashboard/assets/api-keys-BFOlvrJC.js.gz +0 -0
- package/dist/dashboard/assets/app-Dx2QgsNj.css +0 -2
- package/dist/dashboard/assets/app-Dx2QgsNj.css.gz +0 -0
- package/dist/dashboard/assets/assert-CqTLw5e7.js.gz +0 -0
- package/dist/dashboard/assets/badge-C83EqLB0.js.gz +0 -0
- package/dist/dashboard/assets/banner-D1xn7pIe.js.gz +0 -0
- package/dist/dashboard/assets/card-DU3Lq5Lm.js.gz +0 -0
- package/dist/dashboard/assets/cli-tools-Dw1U_drK.js.gz +0 -0
- package/dist/dashboard/assets/clipboard-button-CEL5Sg_J.js.gz +0 -0
- package/dist/dashboard/assets/dialog-BjFR5UHy.js.gz +0 -0
- package/dist/dashboard/assets/drawer-HvBW0AjI.js.gz +0 -0
- package/dist/dashboard/assets/entry-BSu3gFlt.js.gz +0 -0
- package/dist/dashboard/assets/entry-CECVELyy.js.gz +0 -0
- package/dist/dashboard/assets/entry-DYYofQ7W.js.gz +0 -0
- package/dist/dashboard/assets/formatters-DLW4i8zK.js.gz +0 -0
- package/dist/dashboard/assets/index-1-fCqe64.js.gz +0 -0
- package/dist/dashboard/assets/inline-DGvU2oLK.js.gz +0 -0
- package/dist/dashboard/assets/input-iNnO1X2K.js.gz +0 -0
- package/dist/dashboard/assets/layout-0q8UGypb.js.gz +0 -0
- package/dist/dashboard/assets/list-row-C0w2bQjJ.js.gz +0 -0
- package/dist/dashboard/assets/live-M5aJ_xCa.js.gz +0 -0
- package/dist/dashboard/assets/network-BKeQGT3K.js.gz +0 -0
- package/dist/dashboard/assets/numbers-CivAk3da.js.gz +0 -0
- package/dist/dashboard/assets/pagination-CpzvI5ep.js.gz +0 -0
- package/dist/dashboard/assets/routing-BFQX2VBc.js.gz +0 -0
- package/dist/dashboard/assets/select-CXbck0jG.js.gz +0 -0
- package/dist/dashboard/assets/settings-C_XvMHh9.js.gz +0 -0
- package/dist/dashboard/assets/stack-DggRiCxE.js.gz +0 -0
- package/dist/dashboard/assets/state-ClFzfbYp.js.gz +0 -0
- package/dist/dashboard/assets/switch-CTIFxKqS.js.gz +0 -0
- package/dist/dashboard/assets/useMutation-BClG3yWj.js.gz +0 -0
- package/src/console/providers/catalog/discover-constants.ts +0 -6
- package/src/network/pool-health.ts +0 -198
- package/src/providers/integrations/buddy/buddy-checkin.ts +0 -521
- package/src/providers/integrations/buddy/buddy-cli-headers.ts +0 -76
- package/src/providers/integrations/buddy/buddy-conversation-headers.ts +0 -130
- package/src/providers/integrations/buddy/buddy-discovery-shared.ts +0 -234
- package/src/providers/integrations/buddy/buddy-growth-shared.ts +0 -496
- package/src/providers/integrations/buddy/buddy-oauth-shared.ts +0 -341
- package/src/providers/integrations/buddy/buddy-quota-shared.ts +0 -417
- package/src/providers/integrations/buddy/buddy-server-tools.ts +0 -240
- package/src/providers/integrations/buddy/buddy-usage-shared.ts +0 -221
- package/src/providers/integrations/buddy/buddy-usage-store.ts +0 -181
- package/src/providers/integrations/buddy/codebuddy/cn-catalog.ts +0 -37
- package/src/providers/integrations/buddy/codebuddy/cn-provider.ts +0 -188
- package/src/providers/integrations/buddy/codebuddy/oauth.ts +0 -47
- package/src/providers/integrations/buddy/codebuddy/provider.ts +0 -179
- package/src/providers/integrations/buddy/codebuddy/quota.ts +0 -154
- package/src/providers/integrations/qoder/chat-proto.ts +0 -328
- package/src/providers/integrations/qoder/qoder-grpc.ts +0 -870
- package/src/providers/integrations/qoder/qoder-ide.ts +0 -481
- /package/dist/dashboard/assets/{app-DIXLjojg.js → app-C0gTXEoN.js} +0 -0
- /package/dist/dashboard/assets/{app-DIXLjojg.js.gz → app-C0gTXEoN.js.gz} +0 -0
- /package/src/network/{http2-bidi.ts → bidi.ts} +0 -0
- /package/src/network/pool/{byte-accounting.ts → accounting.ts} +0 -0
- /package/src/network/pool/{pool-scripts.ts → scripts.ts} +0 -0
- /package/src/network/pool/{pool-state.ts → state.ts} +0 -0
- /package/src/network/{backoff.ts → util/backoff.ts} +0 -0
- /package/src/network/{deduplication.ts → util/dedupe.ts} +0 -0
- /package/src/network/{ip-utils.ts → util/ip.ts} +0 -0
- /package/src/network/{rate-limit-verdict.ts → verdict.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginPage-
|
|
2
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{t as i}from"./index-1-fCqe64.js";import{a,c as o,d as s,f as c,l,o as u,r as d,u as f}from"./app-DIXLjojg.js";import{i as p,n as m,r as h,t as g}from"./terminal-0_IjPWTk.js";import{C as _,D as v,E as y,O as b,S as x,T as S,_ as C,b as ee,c as w,d as te,f as ne,g as T,k as E,m as re,o as ie,p as ae,s as oe,u as se,w as ce,x as le,y as ue}from"./numbers-CivAk3da.js";import{r as de}from"./use-modal-focus-By7oJoGd.js";import{t as fe}from"./dialog-BjFR5UHy.js";import{E as D,T as pe,_ as me,c as he,f as ge,g as _e,h as ve,i as ye,m as be,n as xe,p as Se,r as Ce,s as we,t as Te,u as Ee,v as De,w as O,y as k}from"./assert-CqTLw5e7.js";import{C as Oe,D as ke,E as Ae,O as A,P as je,S as Me,_ as Ne,a as Pe,b as Fe,c as Ie,d as Le,f as Re,g as ze,i as j,j as Be,k as Ve,l as M,o as N,r as He,t as P,v as F,w as Ue,y as We}from"./query-keys-IKLh0YFd.js";import{t as Ge}from"./mutation-BQ0ccH_A.js";import{t as I}from"./useMutation-BClG3yWj.js";import{t as Ke}from"./dialog-actions-B1axpEg7.js";var qe=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Je=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ye=e(`coffee`,[[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M14 2v2`,key:`6buw04`}],[`path`,{d:`M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1`,key:`pwadti`}],[`path`,{d:`M6 2v2`,key:`colzsn`}]]),Xe=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ze=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Qe=e(`hand-heart`,[[`path`,{d:`M11 14h2a2 2 0 0 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16`,key:`1v1a37`}],[`path`,{d:`m14.45 13.39 5.05-4.694C20.196 8 21 6.85 21 5.75a2.75 2.75 0 0 0-4.797-1.837.276.276 0 0 1-.406 0A2.75 2.75 0 0 0 11 5.75c0 1.2.802 2.248 1.5 2.946L16 11.95`,key:`fhfbnt`}],[`path`,{d:`m2 15 6 6`,key:`10dquu`}],[`path`,{d:`m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a1 1 0 0 0-2.75-2.91`,key:`1x6kdw`}]]),$e=e(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),et=e(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),tt=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),nt=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),rt=e(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),it=e(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),at=e(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ot=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),st=e(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),ct=e(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),lt=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ut=e(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),dt=e(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ft=e(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),pt=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),mt=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]);function ht(e){let t;if(e.then(e=>(t=e,e),A)?.catch?.(A),t!==void 0)return{data:t}}function gt(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function _t(e,t,n){let r=e.promise?.then(t).catch(e=>n?.(e)===!1?Promise.reject(e):Promise.reject(Error(`redacted`)));return r?.catch(A),r}function vt(e,t,n){return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t?t(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:_t(e,t,n)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function yt(e){return e.state.isPaused}function bt(e){return e.state.status===`success`}function xt(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??yt,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[gt(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??bt,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[vt(e,o,a)]:[])}}function St(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?ht(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(A)})}var Ct=class extends Fe{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Ge({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=wt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ae(t,e))}findAll(e={}){return this.getAll().filter(t=>Ae(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(A))))}};function wt(e){return e.options.scope?.id}var Tt=class extends Fe{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ue(r,t),a=this.get(i);return a||(a=new Re({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ke(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Et=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Tt,this.#t=e.mutationCache||new Ct,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=We.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ne.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Be(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Me(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(A).catch(A)}invalidateQueries(e,t={}){return F.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(A)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(A)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Be(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Be(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(A).catch(A)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(A).catch(A)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ne.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Oe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ve(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Oe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ve(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ue(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===je&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},L=t(n(),1),Dt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ot=/^[\\/]{2}/;function kt(e,t){return t+e.replace(/\\/g,`/`)}var At=`popstate`;function jt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Mt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Ft(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:B(t)}return Lt(t,n,null,e)}function R(e,t){if(e===!1||e==null)throw Error(t)}function z(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Nt(){return Math.random().toString(36).substring(2,10)}function Pt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ft(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?It(t):t,state:n,key:t&&t.key||r||Nt(),mask:i}}function B({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function It(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Lt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=jt(e)?e:Ft(h.location,e,t);n&&n(r,e),l=u()+1;let d=Pt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=jt(e)?e:Ft(h.location,e,t);n&&n(r,e),l=u();let i=Pt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Rt(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(At,d),c=e,()=>{i.removeEventListener(At,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Rt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),R(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:B(t);return i=i.replace(/ $/,`%20`),!n&&Ot.test(i)&&(i=r+i),new URL(i,r)}function zt(e,t,n=`/`){return Bt(e,t,n,!1)}function Bt(e,t,n,r,i){let a=V((typeof t==`string`?It(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Vt(e),s=null,c=an(a);for(let e=0;s==null&&e<o.length;++e)s=en(o[e],c,r);return s}function Vt(e){let t=Ht(e);return Wt(t),t}function Ht(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;R(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=H([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(R(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ht(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Qt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=rn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Ut(e.path))a(e,t,!0,n)}),t}function Ut(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Ut(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Wt(e){e.sort((e,t)=>e.score===t.score?$t(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Gt=/^:[\w-]+$/,Kt=3,qt=2,Jt=1,Yt=10,Xt=-2,Zt=e=>e===`*`;function Qt(e,t){let n=e.split(`/`),r=n.length;return n.some(Zt)&&(r+=Xt),t&&(r+=qt),n.filter(e=>!Zt(e)).reduce((e,t)=>e+(Gt.test(t)?Kt:t===``?Jt:Yt),r)}function $t(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function en(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?nn(u,l,s.matcher,s.compiledParams):tn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=tn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:H([a,d.pathname]),pathnameBase:mn(H([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=H([a,d.pathnameBase]))}return o}function tn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=rn(e.path,e.caseSensitive,e.end);return nn(e,t,n,r)}function nn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=pn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=pn(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function rn(e,t=!1,n=!0){z(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function an(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return z(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function on(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?It(e):e,a;return n?(n=fn(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?sn(n.substring(1),`/`):sn(n,t)):a=t,{pathname:a,search:hn(r),hash:gn(i)}}function sn(e,t){let n=pn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function cn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ln(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function un(e){let t=ln(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function dn(e,t,n,r=!1){let i;typeof e==`string`?i=It(e):(i={...e},R(!i.pathname||!i.pathname.includes(`?`),cn(`?`,`pathname`,`search`,i)),R(!i.pathname||!i.pathname.includes(`#`),cn(`#`,`pathname`,`hash`,i)),R(!i.search||!i.search.includes(`#`),cn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=on(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var fn=e=>e.replace(/[\\/]{2,}/g,`/`),H=e=>fn(e.join(`/`));function pn(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var mn=e=>pn(e).replace(/^\/*/,`/`),hn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,gn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_n=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function vn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function yn(e){return H(e.map(e=>e.route.path).filter(Boolean))||`/`}var bn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function xn(e,t){let n=e;if(typeof n!=`string`||!Dt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(bn)try{let e=new URL(window.location.href),r=Ot.test(n)?new URL(kt(n,e.protocol)):new URL(n),a=V(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{z(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Sn=new URL(`http://localhost`);function Cn(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Sn)}catch{return Sn}}function wn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Tn(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function En(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!wn(i,n),s=!wn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Tn(e,i)||!wn(i,a)))throw Error(`External navigation is not allowed`)}var Dn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Dn);var On=[`GET`,...Dn];new Set(On);var kn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function An(e){try{return kn.includes(new URL(e).protocol)}catch{return!1}}var jn=L.createContext(null);jn.displayName=`DataRouter`;var Mn=L.createContext(null);Mn.displayName=`DataRouterState`;var Nn=L.createContext(!1);function Pn(){return L.useContext(Nn)}var Fn=L.createContext({isTransitioning:!1});Fn.displayName=`ViewTransition`;var In=L.createContext(new Map);In.displayName=`Fetchers`;var Ln=L.createContext(null);Ln.displayName=`Await`;var U=L.createContext(null);U.displayName=`Navigation`;var Rn=L.createContext(null);Rn.displayName=`Location`;var W=L.createContext({outlet:null,matches:[],isDataRoute:!1});W.displayName=`Route`;var zn=L.createContext(null);zn.displayName=`RouteError`;var Bn=`REACT_ROUTER_ERROR`,Vn=`REDIRECT`,Hn=`ROUTE_ERROR_RESPONSE`;function Un(e){if(e.startsWith(`${Bn}:${Vn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Wn(e){if(e.startsWith(`${Bn}:${Hn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new _n(t.status,t.statusText,t.data)}catch{}}function Gn(e,{relative:t}={}){R(Kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=L.useContext(U),{hash:i,pathname:a,search:o}=Qn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:H([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Kn(){return L.useContext(Rn)!=null}function G(){return R(Kn(),`useLocation() may be used only in the context of a <Router> component.`),L.useContext(Rn).location}var qn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Jn(e){L.useContext(U).static||L.useLayoutEffect(e)}function Yn(){let{isDataRoute:e}=L.useContext(W);return e?hr():Xn()}function Xn(){R(Kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=L.useContext(jn),{basename:t,navigator:n}=L.useContext(U),{matches:r}=L.useContext(W),{pathname:i}=G(),a=JSON.stringify(un(r)),o=L.useRef(!1);return Jn(()=>{o.current=!0}),L.useCallback((r,s={})=>{if(z(o.current,qn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=dn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:H([t,c.pathname])),En(typeof r==`string`?r:B(r),n.createHref(c),Cn(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}L.createContext(null);function Zn(){let{matches:e}=L.useContext(W);return e[e.length-1]?.params??{}}function Qn(e,{relative:t}={}){let{matches:n}=L.useContext(W),{pathname:r}=G(),i=JSON.stringify(un(n));return L.useMemo(()=>dn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function $n(e,t){return er(e,t)}function er(e,t,n){R(Kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=L.useContext(U),{matches:i}=L.useContext(W),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;_r(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginPage-CZuI0MAR.js","assets/jsx-runtime-CXUMngI_.js","assets/numbers-Dw6kiew-.js","assets/app-C0gTXEoN.js","assets/app-DGXbNfAR.css","assets/log-in-BmRjy60c.js","assets/query-keys-IKLh0YFd.js","assets/input-Bfx0EzRc.js","assets/eye-off-Bk5g2luF.js","assets/eye-C_hawfH4.js","assets/SetupPage--s-EfEIL.js","assets/layout-BxhbQ_JS.js","assets/backup-file-gdKIlg8U.js","assets/BannedPage-Dq530awD.js","assets/OverviewPage-0yfhSI1C.js","assets/terminal-0_IjPWTk.js","assets/arrow-up-59ms1iiT.js","assets/ban-durations-B58FyRxC.js","assets/fingerprint-pattern-BWuHtbW4.js","assets/chevron-right-BXIy5l3h.js","assets/InjectSystemPromptPanel-6Teoq9Se.js","assets/state-CArX_Iak.js","assets/layers-2-glBbjl.js","assets/dialog-DL0Zftwv.js","assets/use-modal-focus-By7oJoGd.js","assets/pencil-768ysRAr.js","assets/plus-DIdX_g-x.js","assets/search-JOKus9rb.js","assets/settings-2-Ds9DQp0t.js","assets/trash-Cppn5c3R.js","assets/assert-BMcj1xZE.js","assets/useMutation-DJ9GYEgf.js","assets/mutation-BQ0ccH_A.js","assets/card-Bto5UlL9.js","assets/switch-DwlwmDO-.js","assets/badge-DkRUuVfz.js","assets/select-oO1FxMVb.js","assets/ProviderIcon-Ddhm1InL.js","assets/stack-Y3pDteZr.js","assets/inline-Dl-cuLK0.js","assets/banner-CDjW841Q.js","assets/pagination-iUoI8GeE.js","assets/chevron-left-Bf6CaTSJ.js","assets/routing-8jZr-3WE.js","assets/database-Dz9N3zGd.js","assets/gauge-BbIMy7MB.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-BYKBCzjk.js","assets/use-clipboard-B0Sy03fE.js","assets/power-off-Yjw9GMJh.js","assets/refresh-cw-BqJFk4sU.js","assets/route-CNSNj9Zm.js","assets/shield-check-DVS0Foqh.js","assets/shield-BMQNxORh.js","assets/download-dRFo5_Wu.js","assets/tokens-COzario9.js","assets/ModelPicker-C1hNTlkr.js","assets/api-keys-2hc12Uz2.js","assets/cli-tools-DaH6g9hL.js","assets/quota-DiPD6UKH.js","assets/settings-CLr3kdIx.js","assets/UsagePage-CP8F8BN7.js","assets/circle-check-BU3v_mFW.js","assets/formatters-BS3DZlZj.js","assets/image-BPaouViG.js","assets/drawer-Dpx_UXaS.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/use-reduced-motion-C4B0R6Sz.js","assets/privacy-mode-GM8bej85.js","assets/use-timeout-BwcBBRrT.js","assets/live-CbVTdX9V.js","assets/ProviderDetailPage-xqTxdQ4c.js","assets/arrow-left-CpBxkoxI.js","assets/brain-Cwed_72z.js","assets/circle-alert-CntYHV5v.js","assets/circle-question-mark-Cz4un8sH.js","assets/rotate-ccw-CufcqITi.js","assets/list-row-D49Y4ptn.js","assets/network-JGvDveof.js","assets/HealthEventsModal-Clq8E9cW.js","assets/ProvidersPage-C3fYuu6i.js","assets/dialog-actions-B1axpEg7.js","assets/CombosPage-BlC_xdkX.js","assets/arrow-right-Dl5yKnp8.js","assets/QuotaPage-D1RV_2BX.js","assets/zap-C4EeVW4q.js","assets/ProxyPage-CHtJtZ3u.js","assets/SettingsPage-BzZAvYSX.js","assets/CliToolsPage-DaZZ3cqP.js","assets/ToolIcon-CfeLA-Z_.js","assets/CliToolDetailPage-DZzaS-7S.js","assets/ConsoleLogPage-D-rqeVtG.js","assets/CustomizationPage-7xT5yg2E.js","assets/StudioPage-BjXFGSK4.js","assets/message-circle-CCxGwRvv.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{t as i}from"./index-SQnvvTWX.js";import{a,c as o,d as s,f as c,l,o as u,r as d,u as f}from"./app-C0gTXEoN.js";import{i as p,n as m,r as h,t as g}from"./terminal-0_IjPWTk.js";import{C as _,D as v,E as y,O as b,S as x,T as S,_ as C,b as ee,c as w,d as te,f as ne,g as T,k as E,m as re,o as ie,p as ae,s as oe,u as se,w as ce,x as le,y as ue}from"./numbers-Dw6kiew-.js";import{r as de}from"./use-modal-focus-By7oJoGd.js";import{t as fe}from"./dialog-DL0Zftwv.js";import{E as D,T as pe,_ as me,c as he,f as ge,g as _e,h as ve,i as ye,m as be,n as xe,p as Se,r as Ce,s as we,t as Te,u as Ee,v as De,w as O,y as k}from"./assert-BMcj1xZE.js";import{C as Oe,D as ke,E as Ae,O as A,P as je,S as Me,_ as Ne,a as Pe,b as Fe,c as Ie,d as Le,f as Re,g as ze,i as j,j as Be,k as Ve,l as M,o as N,r as He,t as P,v as F,w as Ue,y as We}from"./query-keys-IKLh0YFd.js";import{t as Ge}from"./mutation-BQ0ccH_A.js";import{t as I}from"./useMutation-DJ9GYEgf.js";import{t as Ke}from"./dialog-actions-B1axpEg7.js";var qe=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Je=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Ye=e(`coffee`,[[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M14 2v2`,key:`6buw04`}],[`path`,{d:`M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1`,key:`pwadti`}],[`path`,{d:`M6 2v2`,key:`colzsn`}]]),Xe=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ze=e(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Qe=e(`hand-heart`,[[`path`,{d:`M11 14h2a2 2 0 0 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16`,key:`1v1a37`}],[`path`,{d:`m14.45 13.39 5.05-4.694C20.196 8 21 6.85 21 5.75a2.75 2.75 0 0 0-4.797-1.837.276.276 0 0 1-.406 0A2.75 2.75 0 0 0 11 5.75c0 1.2.802 2.248 1.5 2.946L16 11.95`,key:`fhfbnt`}],[`path`,{d:`m2 15 6 6`,key:`10dquu`}],[`path`,{d:`m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a1 1 0 0 0-2.75-2.91`,key:`1x6kdw`}]]),$e=e(`languages`,[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]),et=e(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),tt=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),nt=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),rt=e(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),it=e(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),at=e(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),ot=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),st=e(`qr-code`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),ct=e(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),lt=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),ut=e(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),dt=e(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ft=e(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),pt=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),mt=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]);function ht(e){let t;if(e.then(e=>(t=e,e),A)?.catch?.(A),t!==void 0)return{data:t}}function gt(e){return{mutationKey:e.options.mutationKey,state:e.state,...e.options.scope&&{scope:e.options.scope},...e.meta&&{meta:e.meta}}}function _t(e,t,n){let r=e.promise?.then(t).catch(e=>n?.(e)===!1?Promise.reject(e):Promise.reject(Error(`redacted`)));return r?.catch(A),r}function vt(e,t,n){return{dehydratedAt:Date.now(),state:{...e.state,...e.state.data!==void 0&&{data:t?t(e.state.data):e.state.data}},queryKey:e.queryKey,queryHash:e.queryHash,...e.state.status===`pending`&&{promise:_t(e,t,n)},...e.meta&&{meta:e.meta},...e.queryType&&{queryType:e.queryType}}}function yt(e){return e.state.isPaused}function bt(e){return e.state.status===`success`}function xt(e,t={}){let n=t.shouldDehydrateMutation??e.getDefaultOptions().dehydrate?.shouldDehydrateMutation??yt,r=e.getMutationCache().getAll().flatMap(e=>n(e)?[gt(e)]:[]),i=t.shouldDehydrateQuery??e.getDefaultOptions().dehydrate?.shouldDehydrateQuery??bt,a=t.shouldRedactErrors??e.getDefaultOptions().dehydrate?.shouldRedactErrors,o=t.serializeData??e.getDefaultOptions().dehydrate?.serializeData;return{mutations:r,queries:e.getQueryCache().getAll().flatMap(e=>i(e)?[vt(e,o,a)]:[])}}function St(e,t,n){let r=e.getMutationCache(),i=e.getQueryCache(),a=n?.defaultOptions?.deserializeData??e.getDefaultOptions().hydrate?.deserializeData;t.mutations?.forEach(({state:t,...i})=>{r.build(e,{...e.getDefaultOptions().hydrate?.mutations,...n?.defaultOptions?.mutations,...i},t)}),t.queries?.forEach(({queryKey:t,state:r,queryHash:o,meta:s,promise:c,dehydratedAt:l,queryType:u})=>{let d=c?ht(c):void 0,f=r.data===void 0?d?.data:r.data,p=f===void 0?f:a?a(f):f,m=i.get(o),h=m?.state.status===`pending`,g=m?.state.fetchStatus===`fetching`;if(m){let e=d&&l!==void 0&&l>m.state.dataUpdatedAt;if(r.dataUpdatedAt>m.state.dataUpdatedAt||e){let{fetchStatus:e,...t}=r;m.setState({...t,data:p,...r.status===`pending`&&p!==void 0&&{status:`success`,dataUpdatedAt:l??Date.now(),...!g&&{fetchStatus:`idle`}}})}}else m=i.build(e,{...e.getDefaultOptions().hydrate?.queries,...n?.defaultOptions?.queries,queryKey:t,queryHash:o,meta:s,_type:u},{...r,data:p,fetchStatus:`idle`,status:r.status===`pending`&&p!==void 0?`success`:r.status,...r.status===`pending`&&p!==void 0&&{dataUpdatedAt:l??Date.now()}});c&&!d&&!h&&!g&&(l===void 0||l>m.state.dataUpdatedAt)&&m.fetch(void 0,{initialPromise:Promise.resolve(c).then(a)}).catch(A)})}var Ct=class extends Fe{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Ge({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=wt(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=wt(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){F.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ae(t,e))}findAll(e={}){return this.getAll().filter(t=>Ae(e,t))}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return F.batch(()=>Promise.all(e.map(e=>e.continue().catch(A))))}};function wt(e){return e.options.scope?.id}var Tt=class extends Fe{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Ue(r,t),a=this.get(i);return a||(a=new Re({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){F.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>ke(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ke(e,t)):t}notify(e){F.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){F.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){F.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Et=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Tt,this.#t=e.mutationCache||new Ct,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=We.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ne.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Be(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Me(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return F.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;F.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return F.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=F.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(A).catch(A)}invalidateQueries(e,t={}){return F.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=F.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(A)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(A)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(Be(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Be(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(A).catch(A)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(A).catch(A)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ne.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(Oe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ve(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Oe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ve(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=Ue(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===je&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},L=t(n(),1),Dt=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ot=/^[\\/]{2}/;function kt(e,t){return t+e.replace(/\\/g,`/`)}var At=`popstate`;function jt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Mt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return Ft(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:B(t)}return Lt(t,n,null,e)}function R(e,t){if(e===!1||e==null)throw Error(t)}function z(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Nt(){return Math.random().toString(36).substring(2,10)}function Pt(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function Ft(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?It(t):t,state:n,key:t&&t.key||r||Nt(),mask:i}}function B({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function It(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function Lt(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=jt(e)?e:Ft(h.location,e,t);n&&n(r,e),l=u()+1;let d=Pt(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=jt(e)?e:Ft(h.location,e,t);n&&n(r,e),l=u();let i=Pt(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return Rt(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(At,d),c=e,()=>{i.removeEventListener(At,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function Rt(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),R(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:B(t);return i=i.replace(/ $/,`%20`),!n&&Ot.test(i)&&(i=r+i),new URL(i,r)}function zt(e,t,n=`/`){return Bt(e,t,n,!1)}function Bt(e,t,n,r,i){let a=V((typeof t==`string`?It(t):t).pathname||`/`,n);if(a==null)return null;let o=i??Vt(e),s=null,c=an(a);for(let e=0;s==null&&e<o.length;++e)s=en(o[e],c,r);return s}function Vt(e){let t=Ht(e);return Wt(t),t}function Ht(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;R(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=H([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(R(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),Ht(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:Qt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=rn(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of Ut(e.path))a(e,t,!0,n)}),t}function Ut(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=Ut(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function Wt(e){e.sort((e,t)=>e.score===t.score?$t(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var Gt=/^:[\w-]+$/,Kt=3,qt=2,Jt=1,Yt=10,Xt=-2,Zt=e=>e===`*`;function Qt(e,t){let n=e.split(`/`),r=n.length;return n.some(Zt)&&(r+=Xt),t&&(r+=qt),n.filter(e=>!Zt(e)).reduce((e,t)=>e+(Gt.test(t)?Kt:t===``?Jt:Yt),r)}function $t(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function en(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?nn(u,l,s.matcher,s.compiledParams):tn(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=tn({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:H([a,d.pathname]),pathnameBase:mn(H([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=H([a,d.pathnameBase]))}return o}function tn(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=rn(e.path,e.caseSensitive,e.end);return nn(e,t,n,r)}function nn(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=pn(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=pn(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function rn(e,t=!1,n=!0){z(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function an(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return z(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function V(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function on(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?It(e):e,a;return n?(n=fn(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?sn(n.substring(1),`/`):sn(n,t)):a=t,{pathname:a,search:hn(r),hash:gn(i)}}function sn(e,t){let n=pn(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function cn(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function ln(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function un(e){let t=ln(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function dn(e,t,n,r=!1){let i;typeof e==`string`?i=It(e):(i={...e},R(!i.pathname||!i.pathname.includes(`?`),cn(`?`,`pathname`,`search`,i)),R(!i.pathname||!i.pathname.includes(`#`),cn(`#`,`pathname`,`hash`,i)),R(!i.search||!i.search.includes(`#`),cn(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=on(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var fn=e=>e.replace(/[\\/]{2,}/g,`/`),H=e=>fn(e.join(`/`));function pn(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var mn=e=>pn(e).replace(/^\/*/,`/`),hn=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,gn=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,_n=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function vn(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function yn(e){return H(e.map(e=>e.route.path).filter(Boolean))||`/`}var bn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function xn(e,t){let n=e;if(typeof n!=`string`||!Dt.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(bn)try{let e=new URL(window.location.href),r=Ot.test(n)?new URL(kt(n,e.protocol)):new URL(n),a=V(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{z(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Sn=new URL(`http://localhost`);function Cn(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Sn)}catch{return Sn}}function wn(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Tn(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function En(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!wn(i,n),s=!wn(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Tn(e,i)||!wn(i,a)))throw Error(`External navigation is not allowed`)}var Dn=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Dn);var On=[`GET`,...Dn];new Set(On);var kn=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function An(e){try{return kn.includes(new URL(e).protocol)}catch{return!1}}var jn=L.createContext(null);jn.displayName=`DataRouter`;var Mn=L.createContext(null);Mn.displayName=`DataRouterState`;var Nn=L.createContext(!1);function Pn(){return L.useContext(Nn)}var Fn=L.createContext({isTransitioning:!1});Fn.displayName=`ViewTransition`;var In=L.createContext(new Map);In.displayName=`Fetchers`;var Ln=L.createContext(null);Ln.displayName=`Await`;var U=L.createContext(null);U.displayName=`Navigation`;var Rn=L.createContext(null);Rn.displayName=`Location`;var W=L.createContext({outlet:null,matches:[],isDataRoute:!1});W.displayName=`Route`;var zn=L.createContext(null);zn.displayName=`RouteError`;var Bn=`REACT_ROUTER_ERROR`,Vn=`REDIRECT`,Hn=`ROUTE_ERROR_RESPONSE`;function Un(e){if(e.startsWith(`${Bn}:${Vn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function Wn(e){if(e.startsWith(`${Bn}:${Hn}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new _n(t.status,t.statusText,t.data)}catch{}}function Gn(e,{relative:t}={}){R(Kn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=L.useContext(U),{hash:i,pathname:a,search:o}=Qn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:H([n,a])),r.createHref({pathname:s,search:o,hash:i})}function Kn(){return L.useContext(Rn)!=null}function G(){return R(Kn(),`useLocation() may be used only in the context of a <Router> component.`),L.useContext(Rn).location}var qn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Jn(e){L.useContext(U).static||L.useLayoutEffect(e)}function Yn(){let{isDataRoute:e}=L.useContext(W);return e?hr():Xn()}function Xn(){R(Kn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=L.useContext(jn),{basename:t,navigator:n}=L.useContext(U),{matches:r}=L.useContext(W),{pathname:i}=G(),a=JSON.stringify(un(r)),o=L.useRef(!1);return Jn(()=>{o.current=!0}),L.useCallback((r,s={})=>{if(z(o.current,qn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=dn(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:H([t,c.pathname])),En(typeof r==`string`?r:B(r),n.createHref(c),Cn(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}L.createContext(null);function Zn(){let{matches:e}=L.useContext(W);return e[e.length-1]?.params??{}}function Qn(e,{relative:t}={}){let{matches:n}=L.useContext(W),{pathname:r}=G(),i=JSON.stringify(un(n));return L.useMemo(()=>dn(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function $n(e,t){return er(e,t)}function er(e,t,n){R(Kn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=L.useContext(U),{matches:i}=L.useContext(W),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;_r(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=G(),d;if(t){let e=typeof t==`string`?It(t):t;R(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):zt(e,{pathname:p});z(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),z(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=sr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:H([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:H([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?L.createElement(Rn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function tr(){let e=mr(),t=vn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=L.createElement(L.Fragment,null,L.createElement(`p`,null,`💿 Hey developer 👋`),L.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,L.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,L.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),L.createElement(L.Fragment,null,L.createElement(`h2`,null,`Unexpected Application Error!`),L.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?L.createElement(`pre`,{style:i},n):null,o)}var nr=L.createElement(tr,null),rr=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Wn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:L.createElement(W.Provider,{value:this.props.routeContext},L.createElement(zn.Provider,{value:e,children:this.props.component}));return this.context?L.createElement(ar,{error:e},t):t}};rr.contextType=Nn;var ir=new WeakMap;function ar({children:e,error:t}){let{basename:n,navigator:r}=L.useContext(U);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Un(t.digest);if(e){let i=ir.get(t);if(i)throw i;let a=xn(e.location,n),o=a.absoluteURL||a.to;if(En(e.location,o,Cn(r),`allow-explicit`),An(o))throw Error(`Invalid redirect location`);if(bn&&!ir.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw ir.set(t,n),n}}return L.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function or({routeContext:e,match:t,children:n}){let r=L.useContext(jn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(W.Provider,{value:e},n)}function sr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);R(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:yn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||nr,o&&(s<0&&c===0?(_r(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?L.createElement(n.route.Component,null):n.route.element?n.route.element:e,L.createElement(or,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?L.createElement(rr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function cr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lr(e){let t=L.useContext(jn);return R(t,cr(e)),t}function ur(e){let t=L.useContext(Mn);return R(t,cr(e)),t}function dr(e){let t=L.useContext(W);return R(t,cr(e)),t}function fr(e){let t=dr(e),n=t.matches[t.matches.length-1];return R(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pr(){return fr(`useRouteId`)}function mr(){let e=L.useContext(zn),t=ur(`useRouteError`),n=fr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function hr(){let{router:e}=lr(`useNavigate`),t=fr(`useNavigate`),n=L.useRef(!1);return Jn(()=>{n.current=!0}),L.useCallback(async(r,i={})=>{z(n.current,qn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var gr={};function _r(e,t,n){!t&&!gr[e]&&(gr[e]=!0,z(!1,n))}L.memo(vr);function vr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return er(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function yr({to:e,replace:t,state:n,relative:r}){R(Kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=L.useContext(U);z(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=L.useContext(W),{pathname:s}=G(),c=Yn(),l=dn(e,un(o),s,r===`path`);En(typeof e==`string`?e:B(e),a.createHref(l),Cn(a),`reject`);let u=JSON.stringify(l);return L.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function K(e){R(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function br({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){R(!Kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=L.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=It(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=L.useMemo(()=>{let e=V(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return z(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:L.createElement(U.Provider,{value:c},L.createElement(Rn.Provider,{children:t,value:h}))}function xr({children:e,location:t}){return $n(Sr(e),t)}L.Component;function Sr(e,t=[]){let n=[];return L.Children.forEach(e,(e,r)=>{if(!L.isValidElement(e))return;let i=[...t,r];if(e.type===L.Fragment){n.push.apply(n,Sr(e.props.children,i));return}R(e.type===K,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),R(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Sr(e.props.children,i)),n.push(a)}),n}var Cr=`get`,wr=`application/x-www-form-urlencoded`;function Tr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Er(e){return Tr(e)&&e.tagName.toLowerCase()===`button`}function Dr(e){return Tr(e)&&e.tagName.toLowerCase()===`form`}function Or(e){return Tr(e)&&e.tagName.toLowerCase()===`input`}function kr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ar(e,t){return e.button===0&&(!t||t===`_self`)&&!kr(e)}function jr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Mr(e,t){let n=jr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Nr=null;function Pr(){if(Nr===null)try{new FormData(document.createElement(`form`),0),Nr=!1}catch{Nr=!0}return Nr}var Fr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ir(e){return e!=null&&!Fr.has(e)?(z(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wr}"`),null):e}function Lr(e,t){let n,r,i,a,o;if(Dr(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||Cr,i=Ir(e.getAttribute(`enctype`))||wr,a=new FormData(e)}else if(Er(e)||Or(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?V(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Cr,i=Ir(e.getAttribute(`formenctype`))||Ir(o.getAttribute(`enctype`))||wr,a=new FormData(o,e),!Pr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Cr,r=null,i=wr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Rr(e,t){if(e===!1||e==null)throw Error(t)}function zr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&V(i.pathname,t)===`/`?`${pn(t)}/_root.${r}`:`${pn(i.pathname)}.${r}`,i}async function Br(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Vr(e){return e!=null&&typeof e.page==`string`}function Hr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ur(e,t,n){return Jr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Br(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Hr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Wr(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Gr(e,t,{includeHydrateFallback:n}={}){return Kr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Kr(e){return[...new Set(e)]}function qr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Jr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Vr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(qr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Yr(){let e=L.useContext(jn);return Rr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Xr(){let e=L.useContext(Mn);return Rr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Zr=L.createContext(void 0);Zr.displayName=`FrameworkContext`;function Qr(){let e=L.useContext(Zr);return Rr(e,`You must render this element inside a <HydratedRouter> element`),e}function $r(e,t){let n=L.useContext(Zr),[r,i]=L.useState(!1),[a,o]=L.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=L.useRef(null);L.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),L.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:ei(s,p),onBlur:ei(c,m),onMouseEnter:ei(l,p),onMouseLeave:ei(u,m),onTouchStart:ei(d,p)}]:[a,f,{}]:[!1,f,{}]}function ei(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ti({page:e,...t}){let n=Pn(),{nonce:r}=Qr(),{router:i}=Yr(),a=L.useMemo(()=>zt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?L.createElement(ri,{page:e,matches:a,...t}):L.createElement(ii,{page:e,matches:a,...t})):null}function ni(e){let{manifest:t,routeModules:n}=Qr(),[r,i]=L.useState([]);return L.useEffect(()=>{let r=!1;return Ur(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ri({page:e,matches:t,...n}){let r=G(),{future:i}=Qr(),{basename:a}=Yr(),o=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=zr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return L.createElement(L.Fragment,null,o.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ii({page:e,matches:t,...n}){let r=G(),{future:i,manifest:a,routeModules:o}=Qr(),{basename:s}=Yr(),{loaderData:c,matches:l}=Xr(),u=L.useMemo(()=>Wr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=L.useMemo(()=>Wr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=zr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=L.useMemo(()=>Gr(d,a),[d,a]),m=ni(d);return L.createElement(L.Fragment,null,f.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>L.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>L.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ai(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}L.Component;var oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{oi&&(window.__reactRouterVersion=`7.18.3`)}catch{}function si({basename:e,children:t,useTransitions:n,window:r}){let i=L.useRef();i.current??=Mt({window:r,v5Compat:!0});let a=i.current,[o,s]=L.useState({action:a.action,location:a.location}),c=L.useCallback(e=>{n===!1?s(e):L.startTransition(()=>s(e))},[n]);return L.useLayoutEffect(()=>a.listen(c),[a,c]),L.createElement(br,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ci=L.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=L.useContext(U),v=typeof l==`string`&&Dt.test(l),y=xn(l,h);l=y.to;let b=Gn(l,{relative:r}),x=G(),S=null;if(o){let e=dn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:H([h,e.pathname])),S=g.createHref(e)}let[C,ee,w]=$r(n,p),te=pi(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let T=!(y.isExternal||i),E=L.createElement(`a`,{...p,...w,href:(T?S:void 0)||y.absoluteURL||b,onClick:T?ne:e,ref:ai(m,ee),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?L.createElement(L.Fragment,null,E,L.createElement(ti,{page:b})):E});ci.displayName=`Link`;var li=L.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Qn(a,{relative:c.relative}),d=G(),f=L.useContext(Mn),{navigator:p,basename:m}=L.useContext(U),h=f!=null&&yi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=V(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,ee;ee=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let w=typeof i==`function`?i(S):i;return L.createElement(ci,{...c,"aria-current":C,className:ee,ref:l,style:w,to:a,viewTransition:o},typeof s==`function`?s(S):s)});li.displayName=`NavLink`;var ui=L.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Cr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=L.useContext(U),g=_i(),_=vi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Dt.test(s);return L.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?L.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ui.displayName=`Form`;function di(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fi(e){let t=L.useContext(jn);return R(t,di(e)),t}function pi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Yn(),d=G(),f=Qn(e,{relative:o});return L.useCallback(p=>{if(Ar(p,t)){p.preventDefault();let t=n===void 0?B(d)===B(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?L.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function mi(e){z(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=L.useRef(jr(e)),n=L.useRef(!1),r=G(),i=L.useMemo(()=>Mr(r.search,n.current?null:t.current),[r.search]),a=Yn();return[i,L.useCallback((e,t)=>{let r=jr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var hi=0,gi=()=>`__${String(++hi)}__`;function _i(){let{router:e}=fi(`useSubmit`),{basename:t}=L.useContext(U),n=pr(),r=e.fetch,i=e.navigate;return L.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Lr(e,t);if(a.navigate===!1){let e=a.fetcherKey||gi();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function vi(e,{relative:t}={}){let{basename:n}=L.useContext(U),r=L.useContext(W);R(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Qn(e||`.`,{relative:t})},o=G();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:H([n,a.pathname])),B(a)}function yi(e,{relative:t}={}){let n=L.useContext(Fn);R(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=fi(`useViewTransitionState`),i=Qn(e,{relative:t});if(!n.isTransitioning)return!1;let a=V(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=V(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tn(i.pathname,o)!=null||tn(i.pathname,a)!=null}var bi=s(),q=r(),xi=`https://saweria.co/risuncode`,Si=`/donation/qris-risun-marke.webp`,Ci=[{id:`en`,label:`EN`,name:`English`},{id:`id`,label:`ID`,name:`Bahasa Indonesia`},{id:`zh`,label:`中文`,name:`简体中文`},{id:`ja`,label:`日本語`,name:`日本語`}];function wi(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(`en`),i=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!e)return;let n=e=>{i.current?.contains(e.target)||t(!1)},r=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,n),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`keydown`,r)}},[e]);let a=Ci.find(e=>e.id===n)??Ci[0];return(0,q.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,q.jsx)(`button`,{type:`button`,className:`topbar-icon-button`,"aria-haspopup":`menu`,"aria-expanded":e,"aria-label":`Change language — ${a.name}`,title:`Change language (coming soon)`,onClick:()=>t(e=>!e),children:(0,q.jsx)($e,{size:14,"aria-hidden":`true`})}),e?(0,q.jsxs)(`div`,{role:`menu`,className:`app-topbar-popover popout-enter glass absolute right-0 top-full z-popover mt-2 min-w-44 rounded-sidebar border border-inner-border bg-popover-bg p-2 shadow-popout`,children:[Ci.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center justify-between gap-3 rounded-inset px-3 py-2 text-left text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,onClick:()=>{r(e.id),t(!1)},children:[(0,q.jsx)(`span`,{children:e.name}),e.id===n?(0,q.jsx)(`span`,{className:`text-accent-text`,children:`✓`}):null]},e.id)),(0,q.jsx)(`p`,{className:`px-3 pb-1 pt-2 text-badge leading-snug text-text-tertiary`,children:`Translations are not wired up yet — the console stays in English for now.`})]}):null]})}function Ti({open:e,onClose:t}){return(0,q.jsx)(fe,{open:e,onClose:t,title:`Buy me a coffee`,description:`Support Cartethyia development via QRIS or Saweria.`,size:`lg`,footer:(0,q.jsxs)(Ke,{children:[(0,q.jsxs)(`a`,{href:Si,download:`qris-risun-marke.webp`,className:`flex items-center gap-1.5 rounded-inset border border-inner-border px-3 py-2 text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[(0,q.jsx)(y,{size:14,"aria-hidden":`true`}),`Save QR`]}),(0,q.jsxs)(`a`,{href:xi,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-1.5 rounded-inset bg-accent-bg px-4 py-2 text-body font-semibold text-accent-text hover:opacity-90`,children:[(0,q.jsx)(Ye,{size:14,"aria-hidden":`true`}),`Donate via Saweria`,(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`})]})]}),children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 gap-5 sm:gap-6 donate-qr-grid`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,q.jsx)(`img`,{src:Si,alt:`QRIS payment code for RISUN`,className:`aspect-square w-full donate-qr-image rounded-inset border border-inner-border bg-white object-contain p-2`}),(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-badge text-text-tertiary`,children:[(0,q.jsx)(st,{size:12,"aria-hidden":`true`}),`Scan with any QRIS app`]})]}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-body leading-relaxed text-text-secondary`,children:`Cartethyia is built in the spare hours between everything else — late nights, weekends, and a suspicious number of energy drinks. If it saved you an afternoon of fighting with rate limits, or made your proxy pool behave, a coffee genuinely helps keep the lights on and the commits coming.`}),(0,q.jsxs)(`ul`,{className:`mt-3 flex flex-col gap-1.5 text-caption text-text-secondary`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(m,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Keeps late-night debugging sessions fuelled.`})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(_,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Funds the coffee that funds the next release.`})]})]}),(0,q.jsxs)(`div`,{className:`mt-4 border-t border-inner-border pt-3`,children:[(0,q.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-label text-text-tertiary`,children:`Other ways to support`}),(0,q.jsx)(`ul`,{className:`mt-2 grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:f.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-2 rounded-inset border border-inner-border px-3 py-2 text-caption text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[e.id===`github-alt`?(0,q.jsx)(pt,{size:12,className:`shrink-0 text-accent-text`,"aria-hidden":`true`}):(0,q.jsx)(Ze,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-micro text-text-tertiary`,children:e.hint})]})},e.id))})]}),(0,q.jsx)(`p`,{className:`mt-3 text-badge leading-relaxed text-text-tertiary`,children:`No obligation, no paywall, no nagging — the project stays free either way. Thank you for using it. 💙`})]})]})})}function Ei(){let[e,t]=(0,L.useState)(!1);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`topbar-donate-button`,"aria-label":`Support the project`,title:`Buy me a coffee`,onClick:()=>t(!0),children:[(0,q.jsx)(`span`,{className:`text-badge font-bold tracking-wide`,children:`Donate`}),(0,q.jsx)(Qe,{size:14,"aria-hidden":`true`})]}),(0,q.jsx)(wi,{}),(0,q.jsx)(Ti,{open:e,onClose:()=>t(!1)})]})}var Di=t(c(),1),Oi=`cartethyia.customization`,J=`media`,ki=`background`,Ai=1,ji=`/console-backgrounds.webp`;function Mi(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(Oi,Ai);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(J)||e.createObjectStore(J)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the media database.`)),e}function Ni(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The media database rejected the request.`)),t}function Pi(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}async function Fi(){let e=await Mi();try{let t=await Ni(e.transaction(J,`readonly`).objectStore(J).get(ki));if(!t||!t.blob)return null;let n=t;return{blob:n.blob,kind:n.kind,url:URL.createObjectURL(n.blob)}}finally{e.close()}}async function Ii(e,t){let n=await Mi();try{let r=n.transaction(J,`readwrite`);r.objectStore(J).put({blob:e,kind:t},ki),await Pi(r,`Could not store the background.`)}finally{n.close()}}async function Li(){let e=await Mi();try{let t=e.transaction(J,`readwrite`);t.objectStore(J).delete(ki),await Pi(t,`Could not remove the background.`)}finally{e.close()}}var Ri=2560,zi=.85;async function Bi(e){let t=await createImageBitmap(e).catch(()=>null);if(!t)return e;try{let n=Math.max(t.width,t.height),r=Math.min(1,Ri/n),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t.width*r)),i.height=Math.max(1,Math.round(t.height*r));let a=i.getContext(`2d`);return a?(a.drawImage(t,0,0,i.width,i.height),await Ui(i)??e):e}finally{t.close()}}var Vi=4294967296,Hi=268435456;function Ui(e){let{promise:t,resolve:n}=Promise.withResolvers();return e.toBlob(e=>n(e),`image/webp`,zi),t}function Wi(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:null}var Gi=[`none`,`frosted`,`vibrancy`,`heavy`],Ki=[`off`,`pretty`,`extreme`];function qi(e){return typeof e==`string`&&Ki.includes(e)}var Y={backgroundSet:!1,backgroundEnabled:!0,backgroundRevision:0,backgroundOpacity:20,backgroundScale:100,backgroundX:0,backgroundY:0,backgroundBlur:5,blurCards:`frosted`,blurChrome:`frosted`,blurCardsAmount:45,blurCardsDepth:20,blurChromeAmount:25,blurChromeDepth:10,blurCardsEnabled:!0,blurChromeEnabled:!0,renderMode:`off`,emptyOutline:!1},Ji=`cartethyia.customization`,Yi=`cartethyia-customization-change`,Xi={pretty:{cards:{amount:90,depth:0},chrome:{amount:80,depth:80}},extreme:{cards:{amount:90,depth:0},chrome:{amount:90,depth:0}}},Zi=[`cards`,`chrome`];function Qi(e){return typeof e==`string`&&Gi.includes(e)}function X(e,t,n,r){let i=typeof e==`number`?e:Number(e);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function $i(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{backgroundSet:t.backgroundSet===!0,backgroundRevision:X(t.backgroundRevision,0,2**53-1,0),backgroundEnabled:typeof t.backgroundEnabled==`boolean`?t.backgroundEnabled:Y.backgroundEnabled,backgroundOpacity:X(t.backgroundOpacity,0,100,Y.backgroundOpacity),backgroundScale:X(t.backgroundScale,100,180,Y.backgroundScale),backgroundX:X(t.backgroundX,-100,100,Y.backgroundX),backgroundY:X(t.backgroundY,-100,100,Y.backgroundY),backgroundBlur:X(t.backgroundBlur,0,100,Y.backgroundBlur),blurCards:Qi(t.blurCards)?t.blurCards:Y.blurCards,blurChrome:Qi(t.blurChrome)?t.blurChrome:Y.blurChrome,blurCardsAmount:X(t.blurCardsAmount,0,100,Y.blurCardsAmount),blurChromeAmount:X(t.blurChromeAmount,0,100,Y.blurChromeAmount),blurCardsDepth:X(t.blurCardsDepth,0,100,Y.blurCardsDepth),blurChromeDepth:X(t.blurChromeDepth,0,100,Y.blurChromeDepth),blurCardsEnabled:t.blurCardsEnabled!==!1,blurChromeEnabled:t.blurChromeEnabled!==!1,renderMode:qi(t.renderMode)?t.renderMode:`off`,emptyOutline:t.emptyOutline===!0}}var ea=null;function ta(){if(ea)return ea;if(typeof window>`u`)return Y;try{ea=$i(JSON.parse(window.localStorage.getItem(Ji)??`null`))}catch{ea={...Y}}return ea}function na(e){if(typeof document>`u`)return;let t=document.documentElement;t.dataset.blurCards=e.blurCards,t.dataset.blurChrome=e.blurChrome;let n=t=>{let n=t===`chrome`,r=n?{amount:e.blurChromeAmount,depth:e.blurChromeDepth}:{amount:e.blurCardsAmount,depth:e.blurCardsDepth};return e.renderMode===`off`?r:Xi[e.renderMode][n?`chrome`:`cards`]},r=n(`cards`),i=n(`chrome`);t.style.setProperty(`--blur-cards`,`${r.amount}`),t.style.setProperty(`--blur-chrome`,`${i.amount}`),t.style.setProperty(`--blur-cards-depth`,`${r.depth}`),t.style.setProperty(`--blur-chrome-depth`,`${i.depth}`),t.dataset.blurCardsOn=e.blurCardsEnabled||e.renderMode===`extreme`?`true`:e.renderMode===`pretty`?`false`:`true`,t.dataset.renderMode=e.renderMode,t.dataset.emptyOutline=e.emptyOutline?`true`:`false`,t.dataset.bgActive=e.backgroundEnabled?`true`:`false`,t.style.setProperty(`--bg-opacity`,(e.backgroundOpacity/100).toFixed(2)),t.style.setProperty(`--bg-scale`,(e.backgroundScale/100).toFixed(2)),t.style.setProperty(`--bg-x`,`${e.backgroundX}%`),t.style.setProperty(`--bg-y`,`${e.backgroundY}%`),t.style.setProperty(`--bg-blur`,`${Math.round(e.backgroundBlur*.4)}px`)}function ra(e){try{window.localStorage.setItem(Ji,JSON.stringify(e))}catch{}}function ia(e){let t=$i({...ta(),...e});return ea=t,typeof window<`u`&&(ra(t),na(t),window.dispatchEvent(new CustomEvent(Yi))),t}function aa(){let[e,t]=(0,L.useState)(ta);return(0,L.useEffect)(()=>{let e=()=>t(ta());return window.addEventListener(Yi,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Yi,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>t(ia(e))]}var oa=Zi,sa=`(max-width: 767px)`,ca=`(prefers-reduced-motion: reduce)`;function la(e){let[t,n]=(0,L.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,L.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ua(){let[e,t]=(0,L.useState)(()=>typeof document>`u`||!document.hidden);return(0,L.useEffect)(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function da(){let[e]=aa(),[t,n]=(0,L.useState)(null),r=la(sa),i=la(ca),a=ua();(0,L.useEffect)(()=>{if(!e.backgroundSet){n(e=>(e&&URL.revokeObjectURL(e.url),{blob:new Blob,kind:`image`,url:ji}));return}let t=!1,r=null;return Fi().then(e=>{if(t){e&&URL.revokeObjectURL(e.url);return}r=e,n(e)}).catch(()=>{t||n(null)}),()=>{t=!0,r&&URL.revokeObjectURL(r.url)}},[e.backgroundSet,e.backgroundRevision]);let o=(0,L.useRef)(null),s=t?.kind===`video`&&!r&&!i&&a;return(0,L.useEffect)(()=>{let e=o.current;if(e){if(s){e.play().catch(()=>{});return}e.pause()}},[s]),!t||!e.backgroundEnabled?null:(0,q.jsx)(`div`,{className:`custom-background`,"data-kind":t.kind,"data-playing":s?`true`:`false`,"aria-hidden":`true`,children:t.kind===`video`?(0,q.jsx)(`video`,{ref:o,className:`custom-background-media`,src:t.url,autoPlay:s,loop:!0,muted:!0,playsInline:!0,preload:r?`metadata`:`auto`}):(0,q.jsx)(`img`,{className:`custom-background-media`,src:t.url,alt:``})})}function fa({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:a=`Confirm`,cancelLabel:o=`Cancel`,danger:s,children:c}){let[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{e&&(u(null),f(!1))},[e]),(0,q.jsx)(fe,{open:e,onClose:t,title:r,description:i,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsx)(`p`,{className:`text-body text-text-secondary leading-normal`,children:i}),c,l?(0,q.jsx)(`p`,{role:`alert`,className:`text-caption text-red`,children:l}):null,(0,q.jsxs)(Ke,{children:[(0,q.jsx)(w,{variant:`secondary`,size:`sm`,onClick:t,disabled:d,children:o}),(0,q.jsx)(w,{variant:s?`danger`:`primary`,size:`sm`,onClick:()=>{d||(u(null),f(!0),Promise.resolve().then(()=>n()).then(()=>t()).catch(e=>{u(M(e,`Action failed. Please try again.`)),f(!1)}))},disabled:d,children:d?`Working…`:a})]})]})})}var pa={plain:`code-chip-plain`,muted:`code-chip-muted text-text-secondary bg-surface-muted border border-inner-border px-4 py-1 rounded-chip`,accent:`code-chip-accent text-accent bg-accent-soft px-4 py-1.5 rounded-chip font-bold`};function ma({value:e,tone:t=`muted`,action:n,className:r=``,children:i,...a}){return(0,q.jsxs)(`span`,{className:re(`code-chip inline-flex items-center gap-3 min-w-0 max-w-full font-mono text-caption tabular-nums`,pa[t],r),...a,children:[(0,q.jsx)(`code`,{className:`code-chip-value min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,title:a.title??e,children:e}),n?(0,q.jsx)(`span`,{className:`code-chip-action inline-flex shrink-0`,children:n}):null,i]})}var ha=`cartethyia:update-dismissed`;function ga(){try{return window.localStorage.getItem(ha)}catch{return null}}function _a(e){try{window.localStorage.setItem(ha,e)}catch{}}function va(){let[e,t]=(0,L.useState)(!1);return{copied:e,copy:e=>{navigator.clipboard?.writeText(e),t(!0),window.setTimeout(()=>t(!1),1500)}}}function ya({open:e,onClose:t,currentVersion:n,latestVersion:r,releaseUrl:i,onDismissVersion:s,onUpdateNow:c,updating:u=!1,error:d}){let{copied:f,copy:p}=va(),m=r??`the latest release`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(fe,{open:e,onClose:t,title:`Update available`,description:`Cartethyia ${m} is available; this install runs ${n}.`,size:`md`,footer:(0,q.jsxs)(Ke,{children:[s===void 0?(0,q.jsx)(w,{variant:`ghost`,onClick:t,children:`Later`}):(0,q.jsxs)(w,{variant:`ghost`,onClick:()=>{s?.(),t()},children:[`Don’t show for v`,m]}),c!==void 0&&!d?(0,q.jsxs)(w,{onClick:c,disabled:u,children:[u?(0,q.jsx)(x,{size:14,className:`animate-spin`,"aria-hidden":`true`}):null,u?`Updating…`:`Update now`]}):null,(0,q.jsxs)(w,{onClick:()=>p(l),disabled:u,children:[f?(0,q.jsx)(E,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`}),f?`Copied`:`Copy update command`]})]}),children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-6`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid size-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(at,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`p`,{className:`font-semibold text-caption`,children:[n,` → `,m]}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`Stop the gateway, run the command, then start again.`})]})]}),(0,q.jsxs)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`p`,{className:`text-badge text-text-tertiary`,children:`Run this in a terminal`}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center gap-4 min-w-0`,children:[(0,q.jsx)(ma,{value:l,tone:`muted`,title:l,className:`min-w-0 flex-1 truncate`}),(0,q.jsx)(w,{variant:`ghost`,size:`sm`,className:`shrink-0`,onClick:()=>p(l),"aria-label":`Copy the update command`,children:f?(0,q.jsx)(E,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`})})]})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-6 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-text-secondary`,children:(0,q.jsx)(ue,{size:14,"aria-hidden":`true`})}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary min-w-0`,children:`npm cannot replace the package while Cartethyia is running from it, so this cannot update itself the way a single-binary tool can. That is why the console gives you the command instead of a button that installs.`})]}),d?(0,q.jsxs)(`div`,{className:`flex items-start gap-6 rounded-card border border-inner-border bg-surface-2 p-4 text-red-500`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,q.jsx)(ue,{size:14,"aria-hidden":`true`})}),(0,q.jsxs)(`p`,{className:`text-badge min-w-0 break-words`,children:[`Update failed — `,d]})]}):null,(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsxs)(`a`,{href:i??a,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`}),`What’s new on GitHub`]}),(0,q.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`}),`Package on npm`]})]})]})}),u?(0,q.jsx)(`div`,{className:`fixed inset-0 z-toast grid place-items-center bg-black/70 backdrop-blur-sm`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-white`,children:[(0,q.jsx)(x,{size:40,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-lg font-semibold`,children:`Updating Cartethyia…`}),(0,q.jsx)(`p`,{className:`text-sm opacity-80`,children:`Do not refresh or close this page.`})]})}):null]})}var ba=`cartethyia.query-cache`,Z=`client`,xa=`default`,Sa=1;function Ca(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(ba,Sa);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(Z)||e.createObjectStore(Z)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the query cache.`)),e}function wa(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The query cache rejected the request.`)),t}function Ta(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}function Ea(e){if(typeof e!=`object`||!e||!(`version`in e)||!(`state`in e))return!1;let{version:t,state:n}=e;return t===1&&typeof n==`object`&&!!n}async function Da(e){try{let t=await Ca();try{let n=t.transaction(Z,`readwrite`);n.objectStore(Z).put({version:1,state:e},xa),await Ta(n,`Could not store the query cache.`)}finally{t.close()}}catch{}}async function Oa(){try{let e=await Ca();try{let t=await wa(e.transaction(Z,`readonly`).objectStore(Z).get(xa));return Ea(t)?t.state:void 0}finally{e.close()}}catch{return}}async function ka(){try{let e=await Ca();try{let t=e.transaction(Z,`readwrite`);t.objectStore(Z).delete(xa),await Ta(t,`Could not remove the query cache.`)}finally{e.close()}}catch{}}var Q=new Et({defaultOptions:{queries:j,mutations:He}});function Aa(e){let[t,n,r]=e.queryKey;return t===`console`?n===`session`?!0:n===`providers`?r===void 0||e.queryKey[3]===`models`:n===`settings`?r===`runtime`:n===`cli-tools`&&r===`registry`:!1}async function ja(){let e=await Oa();e!==void 0&&St(Q,e)}function Ma(){ka()}function Na(){let e,t=Q.getQueryCache().subscribe(t=>{t.type===`updated`&&(t.action.type===`success`||t.action.type===`error`)&&e===void 0&&(e=setTimeout(()=>{e=void 0,Da(xt(Q,{shouldDehydrateQuery:Aa}))},2e3))});return()=>{e!==void 0&&clearTimeout(e),t()}}function Pa(e){let[t,n]=(e.trim().replace(/^v/i,``).split(`+`,1)[0]??``).split(`-`,2);if(t===void 0||!/^\d+\.\d+\.\d+$/.test(t))return null;let r=t.split(`.`).map(Number);if(r.length!==3||r.some(e=>!Number.isSafeInteger(e)||e<0))return null;let i=n===void 0||n.length===0?[]:n.split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e);return i.some(e=>typeof e==`number`&&(!Number.isSafeInteger(e)||e<0))?null:{core:[r[0]??0,r[1]??0,r[2]??0],prerelease:i}}function Fa(e,t){if(e===void 0||t===void 0)return!1;let n=Pa(e),r=Pa(t);return n===null||r===null?t.trim()!==e.trim():Ia(r,n)>0}function Ia(e,t){for(let n=0;n<e.core.length;n+=1){let r=e.core[n]??0,i=t.core[n]??0;if(r!==i)return r>i?1:-1}if(e.prerelease.length===0&&t.prerelease.length>0)return 1;if(e.prerelease.length>0&&t.prerelease.length===0)return-1;for(let n=0;n<Math.max(e.prerelease.length,t.prerelease.length);n+=1){let r=e.prerelease[n],i=t.prerelease[n];if(r===void 0)return-1;if(i===void 0)return 1;if(r!==i)return typeof r==`number`&&typeof i==`string`?-1:typeof r==`string`&&typeof i==`number`||r>i?1:-1}return 0}var La=5e3,Ra=new WeakMap,za={"/":[{queryKey:P.settings.runtime,read:e=>N(`/settings/runtime`,{signal:e})},{queryKey:P.apiKeys.all,read:e=>N(`/api-keys`,{signal:e}).then(Te)}],"/providers":[{queryKey:P.providers.all,read:e=>N(`/providers`,{signal:e}).then(ge)}],"/proxy":[{queryKey:P.network.pools,read:e=>N(`/network/pools`,{signal:e}).then(he)}]};function Ba(e,t){let n=za[t];if(n===void 0)return Promise.resolve();let r=Date.now(),i=Ra.get(e);if(i!==void 0){if(i>r)return Promise.resolve();Ra.delete(e)}return Promise.allSettled(n.map(t=>e.fetchQuery({queryKey:t.queryKey,queryFn:e=>t.read(k(e)),...j}))).then(t=>{if(t.some(e=>e.status===`rejected`&&!ze(e.reason))){Ra.set(e,Date.now()+La);return}Ra.delete(e)})}var Va=20;function Ha(e){if(typeof e!=`object`||!e)return;let t=e;if(!(typeof t.id!=`string`||typeof t.title!=`string`||typeof t.message!=`string`||typeof t.createdAt!=`string`||t.kind!==`memory-high`&&t.kind!==`memory-growth`&&t.kind!==`update-available`||t.level!==`warning`&&t.level!==`info`))return{id:t.id,kind:t.kind,title:t.title,message:t.message,createdAt:t.createdAt,level:t.level,...t.href===u?{href:t.href}:{},...typeof t.version==`string`&&t.version.length>0?{version:t.version.replace(/^v/,``)}:{}}}function Ua(){let[e,t]=(0,L.useState)([]);return oe({url:`/console/api/notifications/stream`,events:[`notification`],onEvent:(e,n)=>{if(e!==`notification`)return;let r;try{r=JSON.parse(n)}catch{return}let i=Ha(r);i&&t(e=>[i,...e.filter(e=>e.id!==i.id)].slice(0,Va))}}),e}function Wa(){return O({queryKey:P.session.current,queryFn:()=>Ie(),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1})}function Ga(e){return O({queryKey:P.system.health,queryFn:e=>N(`/system/health`,{signal:k(e)}).then(Se),...j,enabled:e?.enabled??!0,refetchInterval:e?.refetchInterval??!1})}function Ka(){return O({queryKey:P.releases.githubLatest,queryFn:e=>N(`/updates/release`,{signal:k(e)}).then(ye),...j,staleTime:18e5,retry:!1})}function qa(e){return O({queryKey:P.usageAnalytics.summary(e),queryFn:t=>N(`/system/usage/summary?period=${encodeURIComponent(e)}`,{signal:k(t)}).then(De),...j,refetchInterval:Pe.status})}function Ja(e){return O({queryKey:P.usageAnalytics.chart(e),queryFn:t=>N(`/system/usage/chart?period=${encodeURIComponent(e)}`,{signal:k(t)}).then(ve),...j,refetchInterval:Pe.status})}function Ya(e,t){return O({queryKey:P.usageAnalytics.by(e,t),queryFn:n=>N(`/system/usage/by-${t}?period=${encodeURIComponent(e)}`,{signal:k(n)}).then(be),...j,refetchInterval:Pe.status})}function Xa(e,t=50,n){let r=n==null?``:`&httpStatus=${encodeURIComponent(String(n))}`;return O({queryKey:P.usageAnalytics.requests(e,t,n),queryFn:n=>N(`/system/usage/requests?period=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${r}`,{signal:k(n)}).then(me),...j,placeholderData:e=>e,refetchInterval:Pe.live})}function Za(e){return O({queryKey:P.usageAnalytics.requestDetail(e??`_`),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Request is required`};return N(`/system/usage/requests/${encodeURIComponent(e)}`,{signal:k(t)}).then(_e)},enabled:e!==null,...j})}function Qa(e){return O({queryKey:P.audit.list(e??{}),queryFn:t=>{let n=new URLSearchParams;e?.action&&n.set(`action`,e.action),e?.actor&&n.set(`actor`,e.actor),e?.cursor&&n.set(`cursor`,e.cursor),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString()?`?${n.toString()}`:``;return N(`/audit${r}`,{signal:k(t)}).then(xe)},...j})}function $a(e=!0){return O({queryKey:P.providers.all,queryFn:e=>N(`/providers`,{signal:k(e)}).then(ge),...j,enabled:e,gcTime:6e5,refetchInterval:e?Pe.catalog:!1})}function eo(e){return O({queryKey:P.providers.detail(e??``),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}`,{signal:k(t)}).then(Ee),enabled:!!e,...j})}function to(e){return O({queryKey:P.providers.models(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return N(`/providers/${encodeURIComponent(e)}/models`,{signal:k(t)}).then(we)},...j,staleTime:3e5,gcTime:6e5,enabled:!!e})}function no(){let e=D();return I({mutationFn:({providerId:e,modelIds:t,wireFamily:n,metadata:r})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`POST`,body:JSON.stringify({modelIds:t,...n?{wireFamily:n}:{},...r?{metadata:r}:{}})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),T.success(`Models registered`,`${n.modelIds.length} model(s) added to ${n.providerId}`)},onError:e=>{T.error(`Failed to register models`,M(e))}})}function ro(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}function io(){return I({mutationFn:e=>N(`/providers/connection-test`,{method:`POST`,body:JSON.stringify(e)})})}function ao(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}function oo(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)})}})}function so(){let e=D();return I({mutationFn:({providerId:e,modelId:t,route:n,metadata:r})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify({modelId:t,route:n,enabled:!0,metadata:r})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),T.success(`Model updated`,`${n.modelId} limits and capabilities saved`)},onError:e=>{T.error(`Failed to update model`,M(e))}})}function co(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`DELETE`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)})}})}function lo(e){return O({queryKey:P.providers.accounts(e),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}/accounts`,{signal:k(t)}),enabled:!!e,...j,staleTime:12e4,refetchOnMount:!1,gcTime:6e5})}function uo(e){let t=e,n=Array.isArray(t.rows)?t.rows:[],r=e=>{let t=Number(e??0);return Number.isFinite(t)?t:0};return{days:Math.max(1,Math.trunc(r(t.days))||30),rows:n.map(e=>({day:typeof e.day==`string`?e.day:``,model:typeof e.model==`string`?e.model:null,requests:r(e.requests),inputTokens:r(e.inputTokens),cachedInputTokens:r(e.cachedInputTokens),outputTokens:r(e.outputTokens),costUsd:r(e.costUsd)}))}}function fo(e,t){return O({queryKey:P.providers.usageMatrix(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return N(`/providers/${encodeURIComponent(e)}/usage/matrix`,{signal:k(t)}).then(uo)},...j,enabled:!!e&&t})}function po(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/accounts`,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function mo(){let e=D();return I({mutationFn:({providerId:e,accounts:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/batch`,{method:`POST`,body:JSON.stringify({accounts:t})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function ho(){let e=D();return I({mutationFn:({providerId:e,accountId:t,request:n})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function go(e,t){return O({queryKey:P.providers.healthEvents(e,t),queryFn:n=>N(`/providers/${encodeURIComponent(e??``)}/accounts/${encodeURIComponent(t??``)}/health-events`,{signal:k(n)}),enabled:!!e&&!!t,...j,refetchInterval:Pe.status})}async function _o(e,t){await e.invalidateQueries({predicate:e=>{let n=e.queryKey;return n[0]===`console`&&n[1]===`providers`&&n[2]===t&&n[3]===`accounts`&&n[5]===`health-events`}})}async function vo(e,t){await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(t)}),_o(e,t),e.invalidateQueries({queryKey:P.providers.all})])}function yo(){let e=D();return I({mutationFn:({providerId:e,accountId:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/recover`,{method:`POST`,body:`{}`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:P.providers.all})]),T.success(`Account recovered`)},onError:e=>{T.error(`Could not recover the account.`,M(e))}})}function bo(){let e=D();return I({mutationFn:({providerId:e,accountId:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/health-events`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:P.settings.diskUsage})]),T.success(t.deleted===0?`Health log was already empty`:`Purged ${t.deleted} health events`,n.title)},onError:e=>{T.error(`Could not purge the health log.`,M(e))}})}function xo(){return I({mutationFn:({providerId:e,accountIds:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/export`,{method:`POST`,body:JSON.stringify({accountIds:t})})})}function So(){return I({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function Co(){let e=D();return I({mutationFn:({providerId:e,code:t,state:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/callback?${new URLSearchParams({code:t,state:n}).toString()}`),onSuccess:async(t,n)=>{await vo(e,n.providerId)}})}function wo(){return I({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/device/start`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function To(){let e=D();return I({mutationFn:({providerId:e,credential:t,fields:n,accountLabel:r})=>N(`/providers/${encodeURIComponent(e)}/oauth/import`,{method:`POST`,body:JSON.stringify({credential:t,...n&&Object.keys(n).length>0?{fields:n}:{},...r?{accountLabel:r}:{}})}),onSuccess:async(t,n)=>{await vo(e,n.providerId),await e.invalidateQueries({queryKey:P.quota.all})}})}function Eo(){let e=D();return I({mutationFn:({providerId:e,deviceAuthId:t})=>N(`/providers/${encodeURIComponent(e)}/oauth/device/poll`,{method:`POST`,body:JSON.stringify({deviceAuthId:t})}),onSuccess:async(t,n)=>{t.status===`complete`&&await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,t.accountId)}),e.invalidateQueries({queryKey:P.quota.all}),vo(e,n.providerId)])}})}function Do(){let e=D();return I({mutationFn:e=>N(`/providers`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.modelRouting.all})]),T.success(`Provider created`,t.label??t.providerId)},onError:e=>{T.error(`Failed to create provider`,M(e))}})}function Oo(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.providers.detail(n)})]),T.success(`Provider updated`,n)},onError:e=>{T.error(`Failed to update provider`,M(e))}})}function ko(){let e=D();return I({mutationFn:({providerId:e,enabled:t})=>N(`/providers/platform/global/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.providers.detail(n)})])}})}function Ao(e={}){let t=D();return I({mutationFn:e=>N(`/providers/${encodeURIComponent(e)}/models/sync`,{method:`POST`,body:`{}`}),onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:P.providers.models(r)}),e.silent||T.success(`Models fetched`,n.synced>0?`${n.synced} new model${n.synced===1?``:`s`} added`:`No new models found`)},onError:t=>{e.silent||T.error(`Failed to fetch models`,M(t))}})}function jo(){let e=D();return I({mutationFn:e=>N(`/providers/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.quota.all}),e.invalidateQueries({queryKey:P.modelRouting.all})]),T.success(`Provider deleted`,n)},onError:e=>{T.error(`Failed to delete provider`,M(e))}})}function Mo(e,t){let n=D();return I({mutationFn:({providerId:t})=>N(`/providers/${encodeURIComponent(t)}/accounts/actions/${e}`,{method:`POST`,body:`{}`}),onSuccess:async(e,r)=>{let i=e.deleted??[];for(let e of i)n.removeQueries({queryKey:P.quota.account(e),exact:!0});await Promise.all([vo(n,r.providerId),n.invalidateQueries({queryKey:P.quota.all})]);let a=i.length>0?i.length:e.updated;T.success(t,`${a} account${a===1?``:`s`}${e.globalSkipped>0?` · ${e.globalSkipped} shared skipped`:``}`)},onError:e=>{T.error(`${t} failed`,M(e))}})}function No(){return Mo(`disable-cooldowns`,`Cooldown accounts disabled`)}function Po(){return Mo(`delete-banned`,`Banned accounts deleted`)}function Fo(e){return O({queryKey:P.providers.modelDiscovery(e),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}/models/discover`,{signal:k(t)}).then(Ce),enabled:!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})}function Io(){let e=D();return I({mutationFn:({providerId:e,modelIds:t})=>N(`/providers/${encodeURIComponent(e)}/models/discover/commit`,{method:`POST`,body:JSON.stringify({modelIds:[...t]})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),e.invalidateQueries({queryKey:P.providers.modelDiscovery(n.providerId)})]),T.success(`Models added`,`${t.committed.length} model(s) registered from ${n.providerId}${t.skipped.length>0?` · ${t.skipped.length} skipped`:``}`)},onError:e=>{T.error(`Failed to add models`,M(e))}})}function Lo(){let e=D();return I({mutationFn:({providerId:e,mode:t})=>N(`/providers/${encodeURIComponent(e)}/models/test-models`,{method:`POST`,body:JSON.stringify({mode:t})}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}var Ro={name:`cartethyia`,version:`2.8.0`,description:`A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.`,license:`GPL-3.0-only`,type:`module`,packageManager:`bun@1.4.0`,repository:{type:`git`,url:`git+https://github.com/risunCodex/Cartethyia.git`},homepage:`https://github.com/risunCodex/Cartethyia#readme`,bugs:{url:`https://github.com/risunCodex/Cartethyia/issues`},keywords:[`ai`,`gateway`,`llm`,`bun`,`self-hosted`],bin:{cartethyia:`scripts/cli/bin/cartethyia.cjs`,carte:`scripts/cli/bin/carte.cjs`},files:[`scripts/cli/`,`src/`,`migrations/`,`dist/dashboard/`,`.env.example`,`README.md`],workspaces:[`dashboard`],engines:{bun:`>=1.4.0`},scripts:{dev:`bun run dev:watch`,"dev:watch":`bun run scripts/dev/supervisor.ts`,test:`bun run scripts/test/run.ts`,build:`bun run scripts/build/build.ts`,prepack:`bun run dashboard:build`,setup:`bun run scripts/cli/setup.ts`,start:`bun run scripts/cli/main.ts start`,doctor:`bun run scripts/cli/doctor.ts`,restart:`bun run scripts/build/restart.ts`,"build:aot":`bun run scripts/build/aot.ts`,"dev:stack":`concurrently -n BACKEND,DASHBOARD -c cyan,magenta --kill-others-on-fail "bun run dev:backend" "bun run dashboard:dev"`,typecheck:`tsc --noEmit`,"test:watch":`bun run scripts/test/run.ts --watch`,"test-db:up":`docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dev:backend":`bun run src/main.ts`,"dev:console-auth":`bun run scripts/test/console-session.ts`,"dev:visual-baseline":`bun run scripts/test/visual-baseline.ts`,"build:binary":`bun run scripts/build/compile.ts`,"test:backend":`bun run scripts/test/run.ts --scope backend`,"test:integration":`bun run scripts/test/run.ts --scope integration`,"test-db:down":`docker compose -f docker-compose.test.yml down`,"dashboard:dev":`bun run --cwd dashboard dev`,"test-db:check":`bun run scripts/test/check-db.ts`,"dashboard:test":`bun run scripts/test/run.ts --scope dashboard`,"test-db:reset":`docker compose -f docker-compose.test.yml down -v && docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dashboard:build":`bun run --cwd dashboard build`,"dashboard:typecheck":`bun run --cwd dashboard typecheck`,"check:migrations":`bun run scripts/test/check-migrations.ts`},dependencies:{"@grpc/grpc-js":`^1.14.7`,"@grpc/proto-loader":`^0.8.1`,"drizzle-orm":`0.45.2`,elysia:`2.0.0-beta.16`,enquirer:`^2.4.1`,ioredis:`6.0.0`,jose:`^6.2.12`,jsonrepair:`^3.15.0`,pg:`8.23.0`,pino:`^10.3.1`,protobufjs:`^7.6.5`,"socks-proxy-agent":`^10.1.0`,systray2:`2.1.4`,typebox:`1.3.27`,ws:`8.22.0`},devDependencies:{"@types/pg":`8.11.10`,"@types/ws":`8.18.1`,"bun-types":`1.4.0`,concurrently:`^10.0.5`,"drizzle-kit":`^0.31.11`,"pino-pretty":`^13.1.3`,typescript:`5.9.2`}}.version,zo=`v${Ro.replace(/\.0$/,``)} (Jinhsi)`,Bo={title:`Console`,sub:`Cartethyia AI Gateway Administration`,icon:et},Vo=[{key:`overview`,path:`/`,navGroup:`Main`,navLabel:`Overview`,title:`Overview`,sub:`Gateway health, capacity, and live metrics`,icon:et},{key:`usage`,path:`/usage`,navGroup:`Main`,navLabel:`Usage`,title:`Usage & Metrics`,sub:`Token economics, requests, and cost breakdown`,icon:p},{key:`providers`,path:`/providers`,navGroup:`Main`,navLabel:`Providers`,title:`Provider Catalog`,sub:`Upstream credentials, models, and latency`,icon:ut},{key:`provider-detail`,path:`/providers/:providerId`,title:`Provider`,sub:`Routing, accounts, models, and health`,icon:ut},{key:`model-lab`,path:`/model-lab`,navGroup:`Main`,navLabel:`Model Lab`,title:`Model Lab`,sub:`Chat a routed model without leaving the console`,icon:S},{key:`combos`,path:`/combos`,navGroup:`Control`,navLabel:`Combos & Routes`,title:`Combos & Routing`,sub:`Failover policies, model aliases, and weighted routes`,icon:Xe},{key:`quota`,path:`/quota`,navGroup:`Control`,navLabel:`Quota Management`,title:`Quota Management`,sub:`Rate limits, leases, and tenant quotas`,icon:ft},{key:`proxy`,path:`/proxy`,navGroup:`Control`,navLabel:`Proxy & Requests`,title:`Proxy & Requests`,sub:`Network pools, SOCKS5/HTTP egress, and dispatch`,icon:h},{key:`cli-tools`,path:`/cli-tools`,navGroup:`Control`,navLabel:`CLI Tools`,title:`CLI Tools`,sub:`Claude Code CLI, OpenCode, and local developer tool integrations`,icon:g},{key:`cli-tool-detail`,path:`/cli-tools/:toolId`,title:`CLI Tool`,sub:`Mappings, endpoints, and downloadable config`,icon:g},{key:`customization`,path:`/customization`,navGroup:`System`,navLabel:`Customization`,title:`Customization`,sub:`Background, transparency, and blur`,icon:ot},{key:`console-log`,path:`/console-log`,navGroup:`System`,navLabel:`Console Log`,title:`Console Log`,sub:`Live server logs and audit trail`,icon:lt},{key:`settings`,path:`/settings`,navGroup:`System`,navLabel:`Settings`,title:`Settings`,sub:`Account security, runtime preferences, and state recovery`,icon:dt}],Ho=new Map(Vo.filter(e=>!e.path.includes(`:`)).map(e=>[e.path,{title:e.title,sub:e.sub,icon:e.icon}])),Uo=Array.from(Vo.reduce((e,t)=>{if(!t.navGroup||!t.navLabel)return e;let n=e.get(t.navGroup)??[];return n.push({label:t.navLabel,path:t.path,icon:t.icon}),e.set(t.navGroup,n),e},new Map),([e,t])=>({label:e,items:t}));function Wo(e,t=[]){let n=/^\/providers\/([^/]+)\/?$/.exec(e);if(n?.[1]){let e=decodeURIComponent(n[1]),r=t.find(t=>t.providerId===e);return{title:r?.label||r?.displayName||e,sub:`Routing, accounts, models, and health`,icon:ut}}let r=/^\/cli-tools\/([^/]+)\/?$/.exec(e);return r?.[1]?{title:`CLI Tool`,sub:`${decodeURIComponent(r[1])} — mappings, endpoints, and downloadable config`,icon:g}:Ho.get(e)??Bo}function Go(){try{return Ga()}catch{return{data:void 0,isError:!1,isFetching:!1,isPending:!1}}}function Ko(){let[e,t]=(0,L.useState)(()=>ne()),n=te(e);return(0,L.useEffect)(()=>{let e=()=>t(ne());return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,L.useEffect)(()=>{se(e)},[e]),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?`light`:`dark`;t(e),ae(e)},"aria-label":`Toggle theme`,"aria-pressed":n,className:`topbar-icon-button`,title:n?`Switch to light mode`:`Switch to dark mode`,children:(0,q.jsx)(`span`,{className:`grid place-items-center`,children:n?(0,q.jsx)(ee,{size:17}):(0,q.jsx)(le,{size:17})},n?`sun`:`moon`)})}var qo=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Jo=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,timeZone:`UTC`});function Yo(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=e>=1024**3?{divisor:1024**3,label:`GiB`}:{divisor:1024**2,label:`MiB`};return`${(e/t.divisor).toFixed(1)} ${t.label}`}function Xo({icon:e,label:t,value:n,detail:r,title:i}){return(0,q.jsxs)(`div`,{className:`min-w-0 rounded-control border border-inner-border bg-surface-2 p-3`,title:i,children:[(0,q.jsxs)(`dt`,{className:`flex items-center gap-2 text-micro font-medium text-text-tertiary`,children:[(0,q.jsx)(e,{size:13,strokeWidth:1.8,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:t})]}),(0,q.jsx)(`dd`,{className:`mt-1 truncate font-mono text-caption font-semibold tabular-nums text-text-primary`,children:n}),r?(0,q.jsx)(`dd`,{className:`mt-1 text-micro text-text-secondary`,children:r}):null]})}function Zo({notifications:e,onOpenUpdate:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(()=>new Date),o=(0,L.useRef)(null),s=(0,L.useRef)(null),{data:c}=Ga({enabled:n,refetchInterval:n?Pe.status:!1});(0,L.useEffect)(()=>{if(!n)return;a(new Date);let e=window.setInterval(()=>a(new Date),1e3);return()=>window.clearInterval(e)},[n]),(0,L.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;s.current&&!s.current.contains(t)&&o.current&&!o.current.contains(t)&&r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let l=[c?c.database_in_process?c.database_healthy?`SQLite in-process, connected.`:`SQLite in-process is not answering.`:c.database_healthy?`Postgres connected.`:`Postgres unreachable.`:void 0,c?c.redis_configured?c.redis_healthy?`Redis connected.`:`Redis unreachable.`:`Redis not configured.`:void 0].filter(Boolean).join(` · `),u=c?c.status===`healthy`?`All systems operational`:c.status===`degraded`?`Gateway degraded`:`Gateway unhealthy`:`System health unavailable`,d=c?c.status===`healthy`?l||`Gateway reported healthy.`:[l,`Check connection logs.`].filter(Boolean).join(` — `):`Live gateway metrics are not available.`,f=c&&[Number.isFinite(c.memory_percent)?`${c.memory_percent.toFixed(1)}% of system RAM`:void 0,c.database_in_process?`In-process DB included`:void 0].filter(Boolean).join(` · `)||void 0,p=c?.cpu_percent??void 0,m=p!==void 0&&Number.isFinite(p),h=c?m?Number.isFinite(c.cpu_cores)&&c.cpu_cores>0?`1-min load · ${c.cpu_cores} cores`:`Normalized 1-min load`:`Not reported on this platform`:void 0;return(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsxs)(`button`,{ref:o,type:`button`,className:`topbar-icon-button`,"aria-label":`Notifications`,"aria-expanded":n,"aria-haspopup":`dialog`,onClick:()=>r(e=>!e),children:[(0,q.jsx)(qe,{size:17}),e.length>0?(0,q.jsx)(`span`,{"aria-label":`${e.length} notifications`,className:`absolute right-1.5 top-1.5 size-2 rounded-full bg-accent`}):null]}),n?(0,Di.createPortal)((0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-floating bg-overlay backdrop-blur-dialog`,onClick:()=>r(!1)}),(0,q.jsxs)(`div`,{ref:s,role:`dialog`,"aria-label":`Notifications`,className:`app-topbar-popover popout-enter glass rounded-sidebar border border-inner-border bg-popover-bg p-5 shadow-popout z-popover`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 font-bold text-body-lg`,children:[(0,q.jsx)(`span`,{className:`w-13 h-13 rounded-pill bg-accent-soft text-accent grid place-items-center`,children:(0,q.jsx)(qe,{size:13})}),(0,q.jsx)(`span`,{children:`Notifications`})]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Close notifications`,onClick:()=>r(!1),className:`cursor-pointer border-none bg-transparent p-2 text-caption text-text-tertiary`,children:(0,q.jsx)(de,{size:14})})]}),(0,q.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 flex flex-col gap-3`,children:[e.length>0?(0,q.jsx)(`section`,{"aria-label":`Notifications`,className:`flex flex-col gap-2`,children:e.map(e=>(0,q.jsxs)(`article`,{className:`flex items-start gap-3 rounded-card border p-4 ${e.level===`warning`?`border-orange-soft bg-orange-soft`:`border-accent/25 bg-accent-soft`}`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-caption font-semibold text-text-primary`,children:e.title}),(0,q.jsx)(`span`,{className:`mt-1 block text-badge text-text-secondary`,children:e.message})]}),e.href?e.kind===`update-available`?(0,q.jsx)(`button`,{type:`button`,className:`shrink-0 text-badge font-semibold text-accent`,onClick:t,children:`Update`}):(0,q.jsx)(`a`,{className:`shrink-0 text-badge font-semibold text-accent`,href:e.href,target:`_blank`,rel:`noreferrer`,children:`Open`}):null]},e.id))}):(0,q.jsx)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4 text-badge text-text-secondary`,children:`No active memory or update alerts.`}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ut,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:u}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:d})]})]}),(0,q.jsxs)(`dl`,{"aria-label":`Runtime metrics`,className:`grid grid-cols-2 gap-2`,children:[(0,q.jsx)(Xo,{icon:b,label:`Local time`,value:qo.format(i)}),(0,q.jsx)(Xo,{icon:ce,label:`UTC`,value:Jo.format(i)}),(0,q.jsx)(Xo,{icon:mt,label:`Uptime`,value:c?ie(c.uptime_seconds):`Unavailable`,detail:c&&Number.isFinite(c.uptime_seconds)&&c.uptime_seconds>=0?`Gateway process running`:void 0}),(0,q.jsx)(Xo,{icon:nt,label:`Process RSS`,value:c?Yo(c.memory_bytes):`Unavailable`,detail:f,title:`Process resident set size; percentage is share of system RAM.`}),(0,q.jsx)(Xo,{icon:Xe,label:`CPU load`,value:m&&p!==void 0?`${p.toFixed(1)}%`:`Unavailable`,detail:h,title:`One-minute load average normalized by the number of CPU cores.`}),(0,q.jsx)(Xo,{icon:it,label:`Runtime`,value:c?.platform?.trim()||`Unavailable`,detail:c?.platform?.trim()?`Gateway host platform`:void 0,title:c?.platform?.trim()||`Runtime platform unavailable`})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ct,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:zo}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`High-performance AI Gateway & Protocol Orchestrator.`})]})]})]})]})]}),document.body):null]})}function Qo({group:e,pathname:t,onIntent:n}){return(0,q.jsxs)(`div`,{className:`nav-group-section`,children:[(0,q.jsx)(`p`,{className:`nav-group-title`,children:e.label}),(0,q.jsx)($o,{items:e.items,pathname:t,onIntent:n})]})}function $o({items:e,pathname:t,onIntent:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)({top:0,height:0,opacity:0}),[o,s]=(0,L.useState)(()=>new Set);return(0,L.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[data-active="true"]`);if(!t){a(e=>({...e,opacity:0}));return}let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();a({top:i.top-n.top,height:i.height,opacity:1})},[t,e]),(0,q.jsxs)(`div`,{ref:r,className:`nav-items-container`,children:[(0,q.jsx)(`div`,{className:`sidebar-active-indicator`,style:{transform:`translateY(${i.top}px)`,height:`${i.height}px`,opacity:i.opacity},"aria-hidden":`true`}),e.map(e=>{if(e.children!==void 0){let t=o.has(e.path??e.label);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,"aria-expanded":t,onClick:()=>s(t=>{let n=new Set(t),r=e.path??e.label;return n.has(r)?n.delete(r):n.add(r),n}),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(Je,{size:14,className:`ml-auto shrink-0 transition-transform ${t?`rotate-180`:``}`,"aria-hidden":`true`})]}),t?(0,q.jsx)(`div`,{className:`ml-6 border-l border-inner-border pl-2`,children:e.children.map(e=>(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,disabled:e.disabled===!0,title:e.label,children:[(0,q.jsx)(e.icon,{size:15,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},e.path??e.label))}):null]},e.path??e.label)}if(e.disabled)return(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full cursor-not-allowed opacity-55`,disabled:!0,"aria-label":`${e.label} — unavailable`,title:`Coming soon`,children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(`span`,{className:`nav-link-badge`,children:`Soon`})]},e.path??e.label);if(e.path===void 0)return null;let r=e.path,i=r===`/`?t===`/`:t===r||t.startsWith(`${r}/`);return(0,q.jsxs)(li,{to:r,end:r===`/`,"data-active":i?`true`:void 0,className:`nav-link-item ${i?`active`:``}`,onMouseEnter:()=>n(r),onFocus:()=>n(r),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},r)})]})}function es({user:e,children:t}){let n=Yn(),r=G(),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),_=async()=>{m(!0),g(null);try{await N(`/updates/apply`,{method:`POST`})}catch(e){m(!1),g(typeof e==`object`&&e&&`message`in e?String(e.message):`The update could not be started.`);return}let e=e=>{e.preventDefault()};window.addEventListener(`beforeunload`,e);let t=C,n=()=>{window.clearInterval(r),window.removeEventListener(`beforeunload`,e)},r=window.setInterval(async()=>{try{let e=await(await fetch(`/console/api/updates/status`)).json();if(e.status===`failed`){n(),m(!1),g(`The install failed${e.stderrTail?`: ${e.stderrTail}`:`. See update.log in the config directory.`}`);return}if(e.status===`success`){n();try{let e=await(await fetch(`/console/api/system/health`)).json();if(e.version!==void 0&&t!==void 0&&e.version===t){window.location.reload();return}}catch{}window.location.reload();return}}catch{try{let e=await(await fetch(`/console/api/updates/release`)).json();t!==void 0&&e.tag_name!==void 0&&e.tag_name!==t&&(n(),window.location.reload())}catch{}}},3e3)},v=Go(),y=Ka(),b=Ua(),x=v.data?.version??Ro,S=b.find(e=>e.kind===`update-available`),C=S?.version??y.data?.tag_name?.replace(/^v/,``),ee=S!==void 0||Fa(x,C),w=$a(/^\/providers\/[^/]+\/?$/.test(r.pathname)),te=(0,L.useRef)(null);(0,L.useEffect)(()=>{ee&&C!==void 0&&ga()!==C&&te.current!==C&&(te.current=C,f(!0))},[ee,C]);let ne=e=>{Ba(Q,e)};(0,L.useEffect)(()=>{a(!1)},[r.pathname]),(0,L.useEffect)(()=>{let e=()=>a(!1);return window.addEventListener(`cartethyia:overlay-open`,e),()=>window.removeEventListener(`cartethyia:overlay-open`,e)},[]),(0,L.useLayoutEffect)(()=>{window.scrollTo(0,0)},[r.pathname]);let T=async()=>{s(!0);try{await N(`/auth/logout`,{method:`POST`})}finally{Q.clear(),Ma(),n(`/login`,{replace:!0})}};(0,L.useEffect)(()=>(document.documentElement.dataset.glassEnabled=`true`,na(ta()),()=>{delete document.documentElement.dataset.glassEnabled}),[]);let E=Wo(r.pathname,w.data??[]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`app-bg`,"aria-hidden":`true`}),(0,q.jsx)(da,{}),(0,q.jsx)(`div`,{className:`app-shell-frame`,children:(0,q.jsxs)(`div`,{className:`app-shell-root`,"data-drawer":i?`open`:void 0,"data-page-scroll":r.pathname===`/console-log`?`contained`:void 0,onClick:e=>{i&&e.target.closest(`.app-main-column`)&&a(!1)},children:[(0,q.jsxs)(`aside`,{className:`glass app-sidebar ${i?`is-open`:``}`,"aria-label":`Dashboard navigation`,children:[(0,q.jsxs)(`div`,{className:`brand-header`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`brand-icon overflow-hidden p-0`,children:(0,q.jsx)(`img`,{src:`/assets/brand/sidebar_ico.webp`,alt:`Cartethyia`,onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=`/assets/brand/sidebar_ico.webp`},className:`w-full h-full object-cover block`})}),(0,q.jsxs)(`div`,{className:`brand-meta`,children:[(0,q.jsx)(`div`,{className:`brand-name`,children:(0,q.jsx)(`span`,{children:`Cartethyia`})}),(0,q.jsxs)(`div`,{className:`brand-version-badge`,children:[(0,q.jsx)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`brand-version-link`,children:zo}),ee?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:`brand-update-badge`,title:C===void 0?`A newer Cartethyia release is available`:`Update available: v${C} — how to install it`,children:[(0,q.jsx)(ct,{size:9,className:`shrink-0`,"aria-hidden":`true`}),C===void 0?`update`:`Update v${C}`]}):null]})]})]}),(0,q.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-0`,children:Uo.map(e=>(0,q.jsx)(Qo,{group:e,pathname:r.pathname,onIntent:ne},e.label))}),(0,q.jsx)(`div`,{className:`sidebar-user-card`,children:(0,q.jsxs)(`div`,{className:`user-card-content`,children:[(0,q.jsx)(`div`,{className:`user-avatar`,"aria-hidden":`true`,children:(e.displayName??e.email).slice(0,2).toUpperCase()}),(0,q.jsxs)(`div`,{className:`user-info`,children:[(0,q.jsx)(`p`,{className:`user-name`,children:e.displayName||`Admin`}),(0,q.jsx)(`p`,{className:`user-role`,children:e.email})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(!0),disabled:o,"aria-label":`Sign out`,title:`Sign out`,className:`topbar-icon-button w-15 h-15 rounded-inset`,children:(0,q.jsx)(tt,{size:14})})]})})]}),(0,q.jsxs)(`div`,{className:`app-main-column`,children:[(0,q.jsxs)(`header`,{className:`glass app-topbar`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,className:`topbar-menu-btn`,onClick:()=>a(!0),children:(0,q.jsx)(rt,{size:18})}),(0,q.jsxs)(`div`,{className:`topbar-meta`,children:[(0,q.jsxs)(`h1`,{className:`topbar-title`,children:[(0,q.jsx)(E.icon,{className:`topbar-title-icon`,size:16,"aria-hidden":`true`}),E.title]}),(0,q.jsx)(`p`,{className:`topbar-subtitle`,children:E.sub})]}),(0,q.jsxs)(`div`,{className:`topbar-actions`,children:[(0,q.jsx)(Ei,{}),(0,q.jsx)(Ko,{}),(0,q.jsx)(Zo,{notifications:b,onOpenUpdate:()=>f(!0)})]})]}),(0,q.jsx)(`main`,{className:`route-enter w-full min-w-0`,children:t})]})]})}),(0,q.jsx)(fa,{open:c,onClose:()=>l(!1),onConfirm:T,title:`Sign out?`,message:`You will need to sign in again to open the console.`,confirmLabel:`Sign out`,danger:!0}),(0,q.jsx)(ya,{open:d,onClose:()=>f(!1),currentVersion:x,...C===void 0?{}:{latestVersion:C},...(S?.href??y.data?.html_url)===void 0?{}:{releaseUrl:S?.href??y.data?.html_url},...C===void 0?{}:{onDismissVersion:()=>_a(C)},onUpdateNow:_,updating:p,...h===null?{}:{error:h}})]})}var ts=f.filter(e=>e.id!==`github-alt`&&e.id!==`gitlab`);function ns({title:e,description:t,icon:n,logoClassName:r=``,children:i}){return(0,q.jsxs)(`main`,{className:`auth-viewport`,children:[(0,q.jsx)(`div`,{className:`auth-image-col`,role:`presentation`,"aria-hidden":`true`}),(0,q.jsx)(`section`,{className:`auth-form-col`,children:(0,q.jsxs)(`div`,{className:`auth-form-inner`,children:[(0,q.jsxs)(`div`,{className:`auth-brand-head`,children:[(0,q.jsx)(`div`,{className:`auth-logo ${r}`.trim(),"aria-hidden":`true`,children:n}),(0,q.jsx)(`h1`,{className:`auth-title`,children:e}),(0,q.jsx)(`p`,{className:`auth-desc`,children:t})]}),(0,q.jsx)(`div`,{className:`auth-form-body`,children:i}),(0,q.jsxs)(`nav`,{className:`auth-hero-links`,"aria-label":`Public source and distribution links`,children:[(0,q.jsx)(`span`,{className:`auth-brand-links-label`,children:`Get Cartethyia`}),(0,q.jsx)(`div`,{className:`auth-brand-links-grid`,children:ts.map(e=>(0,q.jsxs)(`a`,{className:`auth-brand-link`,href:e.href,target:`_blank`,rel:`noreferrer`,title:e.hint,children:[(0,q.jsx)(d,{id:e.id,size:15}),(0,q.jsx)(`span`,{children:e.label})]},e.id))})]})]})})]})}var rs=class extends L.Component{state={error:null,componentStack:null};static getDerivedStateFromError(e){return{error:e,componentStack:null}}componentDidCatch(e,t){console.error(`[console] route render failed:`,e,t.componentStack),this.setState({componentStack:t.componentStack??null})}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){if(this.state.error===null)return this.props.children;let e=this.state.componentStack?.trim(),t=this.state.error.stack?.trim(),n=e!==void 0&&e.length>0?e:t!==void 0&&t.length>0?t:null;return(0,q.jsxs)(ns,{title:`Console view failed`,description:`This view could not be rendered.`,children:[(0,q.jsxs)(`div`,{className:`rounded-panel border border-inner-border bg-surface-2 p-7 leading-normal text-caption text-text-secondary`,children:[(0,q.jsx)(`strong`,{className:`block text-text-primary mb-2`,children:`Rendering error`}),(0,q.jsx)(`span`,{className:`select-text break-words`,children:this.state.error.message}),n===null?null:(0,q.jsx)(`pre`,{className:`mt-4 max-h-80 overflow-auto whitespace-pre-wrap break-words text-badge text-text-tertiary`,children:n})]}),(0,q.jsx)(`button`,{type:`button`,className:`btn btn-primary inline-flex w-full items-center justify-center rounded-control bg-accent font-semibold text-accent-foreground mt-3 h-20 text-caption`,onClick:()=>window.location.reload(),children:`Reload console`})]})}},is=3e5;function as(e){return`cartethyia:lazy-retry:${e}`}function os(e,t){if(e===null)return!0;let n=Number(e);return!Number.isFinite(n)||t-n>is}function ss(){try{return typeof sessionStorage>`u`?void 0:sessionStorage}catch{return}}function $(e,t,n={}){let r=n.storage??ss(),i=n.reload??(()=>{window.location.reload()}),a=n.now??(()=>Date.now()),o=as(t);return(0,L.lazy)(async()=>{try{let t=await e();try{r?.removeItem(o)}catch{}return t}catch(e){let t=null;try{t=r?.getItem(o)??null}catch{t=null}if(os(t,a())){try{r?.setItem(o,String(a()))}catch{}return i(),new Promise(()=>{})}throw e}})}function cs(){return(0,q.jsxs)(`div`,{role:`status`,"aria-label":`Loading console`,className:`min-h-dvh flex flex-col items-center justify-center gap-6 text-text-tertiary`,children:[(0,q.jsx)(x,{size:22,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-caption`,children:`Loading console…`})]})}var ls=$(()=>i(()=>import(`./LoginPage-CgoPc5B9.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`login`),us=$(()=>i(()=>import(`./SetupPage-febLU4r1.js`),__vite__mapDeps([10,1,2,3,4,6,7,8,9,11,12])),`setup`),ds=$(()=>i(()=>import(`./BannedPage-Cc0vKpMG.js`),__vite__mapDeps([13,1])),`banned`),fs=$(()=>i(()=>import(`./OverviewPage-B_p4tL8k.js`),__vite__mapDeps([14,1,15,16,17,18,2,3,4,19,20,9,21,22,23,24,25,26,27,28,29,30,6,31,32,33,34,35,7,8,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,11,59,60])),`overview`),ps=$(()=>i(()=>import(`./UsagePage-nyeuRqz9.js`),__vite__mapDeps([61,1,15,16,17,2,3,4,62,63,30,6,55,36,44,8,9,64,21,5,24,65,51,66,67,68,33,54,38,39,57,31,32,11,40,69,70,71])),`usage`),ms=$(()=>i(()=>import(`./ProviderDetailPage-rs5E2rxv.js`),__vite__mapDeps([72,1,15,73,74,18,2,3,4,75,62,76,63,30,6,55,36,8,9,45,64,21,46,22,24,23,25,26,49,50,77,27,28,29,67,33,54,34,35,7,37,38,39,57,31,32,59,60,40,43,78,79,80,11,69,70])),`provider-detail`),hs=$(()=>i(()=>import(`./ProvidersPage-CLI2bJTK.js`),__vite__mapDeps([81,1,2,3,4,8,9,21,23,24,26,29,6,82,33,34,35,7,36,37,38,39,41,42,19,78,69])),`providers`),gs=$(()=>i(()=>import(`./CombosPage-BeLpJ4ma.js`),__vite__mapDeps([83,1,84,2,3,4,20,9,21,22,23,24,25,26,27,28,29,30,6,31,32,33,34,35,7,8,36,37,38,39,40,41,42,19,43,76,64,51,82,48,56,55,60,78,70])),`combos`),_s=$(()=>i(()=>import(`./QuotaPage-DA-a1iSN.js`),__vite__mapDeps([85,1,15,2,3,4,42,19,8,21,23,24,50,77,29,86,6,33,34,35,36,37,38,39,11,59,80,30,31,32])),`quota`),vs=$(()=>i(()=>import(`./ProxyPage-BwNC_-Cx.js`),__vite__mapDeps([87,1,15,2,3,4,8,9,45,21,23,24,25,26,49,77,52,29,30,6,33,54,34,35,7,36,38,39,11,79,31,32,69,71])),`proxy`),ys=$(()=>i(()=>import(`./SettingsPage-CctTga2C.js`),__vite__mapDeps([88,1,15,2,3,4,44,9,21,22,23,24,53,29,86,30,6,31,32,33,54,34,7,8,36,38,60,40,12])),`settings`),bs=$(()=>i(()=>import(`./CliToolsPage-CXsaOAO2.js`),__vite__mapDeps([89,1,15,21,2,3,4,33,35,38,39,58,30,6,31,32,90,11])),`cli-tools`),xs=$(()=>i(()=>import(`./CliToolDetailPage-Bqj2aa1T.js`),__vite__mapDeps([91,1,73,2,3,4,62,9,21,23,24,26,27,28,6,33,54,34,35,7,8,36,56,51,30,55,37,38,39,57,31,32,58,90])),`cli-tool-detail`),Ss=$(()=>i(()=>import(`./ConsoleLogPage-DnV0uZ3m.js`),__vite__mapDeps([92,1,2,3,4,21,50,27,52,29,6,33,35,7,8,9,11])),`console-log`),Cs=$(()=>i(()=>import(`./CustomizationPage-CBxAjo63.js`),__vite__mapDeps([93,1,2,3,4,64,22,77,33,34,36,38,39])),`customization`),ws=$(()=>i(()=>import(`./StudioPage-M6fvR5Wz.js`),__vite__mapDeps([94,1,16,74,2,3,4,75,45,24,95,23,65,25,77,67,33,7,8,9,36,56,51,27,30,6,55,35,37,57,31,32])),`studio`);function Ts(){let e=Yn(),t=G();return(0,L.useEffect)(()=>(Le(n=>{if(Q.clear(),Ma(),n===`banned`){e(`/banned`,{replace:!0});return}e(`/login?returnTo=${encodeURIComponent(t.pathname)}`,{replace:!0})}),()=>Le(void 0)),[e,t.pathname]),null}function Es(){let e=G();return(0,q.jsx)(rs,{resetKey:`${e.pathname}${e.search}`,children:(0,q.jsx)(L.Suspense,{fallback:(0,q.jsx)(cs,{}),children:(0,q.jsxs)(xr,{children:[(0,q.jsx)(K,{path:`/login`,element:(0,q.jsx)(ls,{})}),(0,q.jsx)(K,{path:`/setup`,element:(0,q.jsx)(us,{})}),(0,q.jsx)(K,{path:`/banned`,element:(0,q.jsx)(ds,{})}),(0,q.jsx)(K,{path:`/*`,element:(0,q.jsx)(Ds,{})})]})})})}function Ds(){let[e,t]=(0,L.useState)({kind:`loading`}),n=G(),r=Yn(),[i]=(0,L.useState)(()=>n.pathname);return(0,L.useEffect)(()=>{let e=new AbortController;return Q.fetchQuery({queryKey:P.session.current,queryFn:()=>Ie(),staleTime:6e4}).then(n=>{if(!e.signal.aborted){if(n){Q.setQueryData(P.session.current,n),t({kind:`ready`,user:n}),n.isFirstBoot&&i!==`/setup`&&r(`/setup`,{replace:!0});return}Q.removeQueries({queryKey:P.session.current}),N(`/auth/first-boot`,{signal:e.signal}).then(n=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:n.requires_setup})}).catch(()=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:!1})})}}).catch(n=>{e.signal.aborted||(typeof n==`object`&&n&&`status`in n&&n.status===403?t({kind:`blocked`}):t({kind:`unauthenticated`,needsSetup:!1}))}),()=>e.abort()},[i,r]),e.kind===`loading`?null:e.kind===`blocked`?(0,q.jsx)(yr,{to:`/banned`,replace:!0}):e.kind===`unauthenticated`?(0,q.jsx)(yr,{to:e.needsSetup?`/setup`:`/login?returnTo=${encodeURIComponent(n.pathname)}`,replace:!0}):(0,q.jsx)(es,{user:e.user,children:(0,q.jsxs)(xr,{children:[Vo.map(e=>{switch(e.key){case`overview`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(fs,{})},e.key);case`usage`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ps,{})},e.key);case`providers`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(hs,{})},e.key);case`provider-detail`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ms,{})},e.key);case`combos`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(gs,{})},e.key);case`quota`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(_s,{})},e.key);case`proxy`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(vs,{})},e.key);case`console-log`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(Ss,{})},e.key);case`customization`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(Cs,{})},e.key);case`model-lab`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ws,{})},e.key);case`cli-tools`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(bs,{})},e.key);case`cli-tool-detail`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(xs,{})},e.key);case`settings`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ys,{})},e.key)}}),(0,q.jsx)(K,{path:`*`,element:(0,q.jsx)(yr,{to:`/`,replace:!0})})]})})}function Os(){return(0,q.jsx)(pe,{client:Q,children:(0,q.jsxs)(si,{basename:`/console`,children:[(0,q.jsx)(Ts,{}),(0,q.jsx)(Es,{}),(0,q.jsx)(C,{position:`top-right`,offset:{top:`6rem`,right:`1rem`},mobileOffset:{top:`6rem`,left:`1rem`,right:`1rem`},visibleToasts:2,richColors:!0,duration:5e3,toastOptions:{className:`toast-surface select-text`,descriptionClassName:`select-text`,classNames:{title:`select-text`},style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`,userSelect:`text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]})})}function ks(e){document.title=`Cartethyia Console`,ja().finally(()=>{Na(),(0,bi.createRoot)(e).render((0,q.jsx)(L.StrictMode,{children:(0,q.jsx)(Os,{})}))})}export{ji as $,Ao as A,Za as B,$a as C,oo as D,no as E,ho as F,fa as G,qa as H,Qa as I,Xi as J,oa as K,Wa as L,ko as M,so as N,So as O,Oo as P,Hi as Q,Ya as R,fo as S,yo as T,Q as U,Xa as V,ma as W,aa as X,ia as Y,Vi as Z,ao as _,Do as a,ci as at,eo as b,jo as c,mi as ct,No as d,ut as dt,Li as et,Fo as f,lt as ft,Lo as g,Je as gt,Eo as h,Ze as ht,Co as i,Ii as it,io as j,wo as k,Po as l,mt as lt,To as m,ks as mountConsole,$e as mt,go as n,Fi as nt,po as o,Yn as ot,xo as p,et as pt,Y as q,Io as r,Bi as rt,mo as s,Zn as st,ns as t,Wi as tt,co as u,ft as ut,ro as v,bo as w,to as x,lo as y,Ja as z};
|
|
4
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=G(),d;if(t){let e=typeof t==`string`?It(t):t;R(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):zt(e,{pathname:p});z(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),z(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=sr(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:H([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:H([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?L.createElement(Rn.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function tr(){let e=mr(),t=vn(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=L.createElement(L.Fragment,null,L.createElement(`p`,null,`💿 Hey developer 👋`),L.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,L.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,L.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),L.createElement(L.Fragment,null,L.createElement(`h2`,null,`Unexpected Application Error!`),L.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?L.createElement(`pre`,{style:i},n):null,o)}var nr=L.createElement(tr,null),rr=class extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=Wn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:L.createElement(W.Provider,{value:this.props.routeContext},L.createElement(zn.Provider,{value:e,children:this.props.component}));return this.context?L.createElement(ar,{error:e},t):t}};rr.contextType=Nn;var ir=new WeakMap;function ar({children:e,error:t}){let{basename:n,navigator:r}=L.useContext(U);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Un(t.digest);if(e){let i=ir.get(t);if(i)throw i;let a=xn(e.location,n),o=a.absoluteURL||a.to;if(En(e.location,o,Cn(r),`allow-explicit`),An(o))throw Error(`Invalid redirect location`);if(bn&&!ir.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw ir.set(t,n),n}}return L.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function or({routeContext:e,match:t,children:n}){let r=L.useContext(jn);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),L.createElement(W.Provider,{value:e},n)}function sr(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);R(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:yn(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||nr,o&&(s<0&&c===0?(_r(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?L.createElement(n.route.Component,null):n.route.element?n.route.element:e,L.createElement(or,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?L.createElement(rr,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function cr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lr(e){let t=L.useContext(jn);return R(t,cr(e)),t}function ur(e){let t=L.useContext(Mn);return R(t,cr(e)),t}function dr(e){let t=L.useContext(W);return R(t,cr(e)),t}function fr(e){let t=dr(e),n=t.matches[t.matches.length-1];return R(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pr(){return fr(`useRouteId`)}function mr(){let e=L.useContext(zn),t=ur(`useRouteError`),n=fr(`useRouteError`);return e===void 0?t.errors?.[n]:e}function hr(){let{router:e}=lr(`useNavigate`),t=fr(`useNavigate`),n=L.useRef(!1);return Jn(()=>{n.current=!0}),L.useCallback(async(r,i={})=>{z(n.current,qn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var gr={};function _r(e,t,n){!t&&!gr[e]&&(gr[e]=!0,z(!1,n))}L.memo(vr);function vr({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return er(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function yr({to:e,replace:t,state:n,relative:r}){R(Kn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=L.useContext(U);z(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=L.useContext(W),{pathname:s}=G(),c=Yn(),l=dn(e,un(o),s,r===`path`);En(typeof e==`string`?e:B(e),a.createHref(l),Cn(a),`reject`);let u=JSON.stringify(l);return L.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function K(e){R(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function br({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){R(!Kn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=L.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=It(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=L.useMemo(()=>{let e=V(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return z(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:L.createElement(U.Provider,{value:c},L.createElement(Rn.Provider,{children:t,value:h}))}function xr({children:e,location:t}){return $n(Sr(e),t)}L.Component;function Sr(e,t=[]){let n=[];return L.Children.forEach(e,(e,r)=>{if(!L.isValidElement(e))return;let i=[...t,r];if(e.type===L.Fragment){n.push.apply(n,Sr(e.props.children,i));return}R(e.type===K,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),R(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Sr(e.props.children,i)),n.push(a)}),n}var Cr=`get`,wr=`application/x-www-form-urlencoded`;function Tr(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Er(e){return Tr(e)&&e.tagName.toLowerCase()===`button`}function Dr(e){return Tr(e)&&e.tagName.toLowerCase()===`form`}function Or(e){return Tr(e)&&e.tagName.toLowerCase()===`input`}function kr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ar(e,t){return e.button===0&&(!t||t===`_self`)&&!kr(e)}function jr(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Mr(e,t){let n=jr(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Nr=null;function Pr(){if(Nr===null)try{new FormData(document.createElement(`form`),0),Nr=!1}catch{Nr=!0}return Nr}var Fr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Ir(e){return e!=null&&!Fr.has(e)?(z(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wr}"`),null):e}function Lr(e,t){let n,r,i,a,o;if(Dr(e)){let o=e.getAttribute(`action`);r=o?V(o,t):null,n=e.getAttribute(`method`)||Cr,i=Ir(e.getAttribute(`enctype`))||wr,a=new FormData(e)}else if(Er(e)||Or(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?V(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Cr,i=Ir(e.getAttribute(`formenctype`))||Ir(o.getAttribute(`enctype`))||wr,a=new FormData(o,e),!Pr()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tr(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Cr,r=null,i=wr,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Rr(e,t){if(e===!1||e==null)throw Error(t)}function zr(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&V(i.pathname,t)===`/`?`${pn(t)}/_root.${r}`:`${pn(i.pathname)}.${r}`,i}async function Br(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Vr(e){return e!=null&&typeof e.page==`string`}function Hr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Ur(e,t,n){return Jr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Br(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Hr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Wr(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Gr(e,t,{includeHydrateFallback:n}={}){return Kr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Kr(e){return[...new Set(e)]}function qr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Jr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Vr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(qr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Yr(){let e=L.useContext(jn);return Rr(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Xr(){let e=L.useContext(Mn);return Rr(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Zr=L.createContext(void 0);Zr.displayName=`FrameworkContext`;function Qr(){let e=L.useContext(Zr);return Rr(e,`You must render this element inside a <HydratedRouter> element`),e}function $r(e,t){let n=L.useContext(Zr),[r,i]=L.useState(!1),[a,o]=L.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=L.useRef(null);L.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),L.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:ei(s,p),onBlur:ei(c,m),onMouseEnter:ei(l,p),onMouseLeave:ei(u,m),onTouchStart:ei(d,p)}]:[a,f,{}]:[!1,f,{}]}function ei(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ti({page:e,...t}){let n=Pn(),{nonce:r}=Qr(),{router:i}=Yr(),a=L.useMemo(()=>zt(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?L.createElement(ri,{page:e,matches:a,...t}):L.createElement(ii,{page:e,matches:a,...t})):null}function ni(e){let{manifest:t,routeModules:n}=Qr(),[r,i]=L.useState([]);return L.useEffect(()=>{let r=!1;return Ur(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function ri({page:e,matches:t,...n}){let r=G(),{future:i}=Qr(),{basename:a}=Yr(),o=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=zr(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return L.createElement(L.Fragment,null,o.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ii({page:e,matches:t,...n}){let r=G(),{future:i,manifest:a,routeModules:o}=Qr(),{basename:s}=Yr(),{loaderData:c,matches:l}=Xr(),u=L.useMemo(()=>Wr(e,t,l,a,r,`data`),[e,t,l,a,r]),d=L.useMemo(()=>Wr(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=L.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=zr(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=L.useMemo(()=>Gr(d,a),[d,a]),m=ni(d);return L.createElement(L.Fragment,null,f.map(e=>L.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>L.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>L.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function ai(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}L.Component;var oi=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{oi&&(window.__reactRouterVersion=`7.18.3`)}catch{}function si({basename:e,children:t,useTransitions:n,window:r}){let i=L.useRef();i.current??=Mt({window:r,v5Compat:!0});let a=i.current,[o,s]=L.useState({action:a.action,location:a.location}),c=L.useCallback(e=>{n===!1?s(e):L.startTransition(()=>s(e))},[n]);return L.useLayoutEffect(()=>a.listen(c),[a,c]),L.createElement(br,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var ci=L.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=L.useContext(U),v=typeof l==`string`&&Dt.test(l),y=xn(l,h);l=y.to;let b=Gn(l,{relative:r}),x=G(),S=null;if(o){let e=dn(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:H([h,e.pathname])),S=g.createHref(e)}let[C,ee,w]=$r(n,p),te=pi(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ne(t){e&&e(t),t.defaultPrevented||te(t)}let T=!(y.isExternal||i),E=L.createElement(`a`,{...p,...w,href:(T?S:void 0)||y.absoluteURL||b,onClick:T?ne:e,ref:ai(m,ee),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?L.createElement(L.Fragment,null,E,L.createElement(ti,{page:b})):E});ci.displayName=`Link`;var li=L.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Qn(a,{relative:c.relative}),d=G(),f=L.useContext(Mn),{navigator:p,basename:m}=L.useContext(U),h=f!=null&&yi(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=V(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,ee;ee=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let w=typeof i==`function`?i(S):i;return L.createElement(ci,{...c,"aria-current":C,className:ee,ref:l,style:w,to:a,viewTransition:o},typeof s==`function`?s(S):s)});li.displayName=`NavLink`;var ui=L.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Cr,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=L.useContext(U),g=_i(),_=vi(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Dt.test(s);return L.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?L.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});ui.displayName=`Form`;function di(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function fi(e){let t=L.useContext(jn);return R(t,di(e)),t}function pi(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=Yn(),d=G(),f=Qn(e,{relative:o});return L.useCallback(p=>{if(Ar(p,t)){p.preventDefault();let t=n===void 0?B(d)===B(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?L.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function mi(e){z(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=L.useRef(jr(e)),n=L.useRef(!1),r=G(),i=L.useMemo(()=>Mr(r.search,n.current?null:t.current),[r.search]),a=Yn();return[i,L.useCallback((e,t)=>{let r=jr(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var hi=0,gi=()=>`__${String(++hi)}__`;function _i(){let{router:e}=fi(`useSubmit`),{basename:t}=L.useContext(U),n=pr(),r=e.fetch,i=e.navigate;return L.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Lr(e,t);if(a.navigate===!1){let e=a.fetcherKey||gi();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function vi(e,{relative:t}={}){let{basename:n}=L.useContext(U),r=L.useContext(W);R(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Qn(e||`.`,{relative:t})},o=G();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:H([n,a.pathname])),B(a)}function yi(e,{relative:t}={}){let n=L.useContext(Fn);R(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=fi(`useViewTransitionState`),i=Qn(e,{relative:t});if(!n.isTransitioning)return!1;let a=V(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=V(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tn(i.pathname,o)!=null||tn(i.pathname,a)!=null}var bi=s(),q=r(),xi=`https://saweria.co/risuncode`,Si=`/donation/qris-risun-marke.webp`,Ci=[{id:`en`,label:`EN`,name:`English`},{id:`id`,label:`ID`,name:`Bahasa Indonesia`},{id:`zh`,label:`中文`,name:`简体中文`},{id:`ja`,label:`日本語`,name:`日本語`}];function wi(){let[e,t]=(0,L.useState)(!1),[n,r]=(0,L.useState)(`en`),i=(0,L.useRef)(null);(0,L.useEffect)(()=>{if(!e)return;let n=e=>{i.current?.contains(e.target)||t(!1)},r=e=>{e.key===`Escape`&&t(!1)};return document.addEventListener(`mousedown`,n),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,n),document.removeEventListener(`keydown`,r)}},[e]);let a=Ci.find(e=>e.id===n)??Ci[0];return(0,q.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,q.jsx)(`button`,{type:`button`,className:`topbar-icon-button`,"aria-haspopup":`menu`,"aria-expanded":e,"aria-label":`Change language — ${a.name}`,title:`Change language (coming soon)`,onClick:()=>t(e=>!e),children:(0,q.jsx)($e,{size:14,"aria-hidden":`true`})}),e?(0,q.jsxs)(`div`,{role:`menu`,className:`app-topbar-popover popout-enter glass absolute right-0 top-full z-popover mt-2 min-w-44 rounded-sidebar border border-inner-border bg-popover-bg p-2 shadow-popout`,children:[Ci.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex w-full items-center justify-between gap-3 rounded-inset px-3 py-2 text-left text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,onClick:()=>{r(e.id),t(!1)},children:[(0,q.jsx)(`span`,{children:e.name}),e.id===n?(0,q.jsx)(`span`,{className:`text-accent-text`,children:`✓`}):null]},e.id)),(0,q.jsx)(`p`,{className:`px-3 pb-1 pt-2 text-badge leading-snug text-text-tertiary`,children:`Translations are not wired up yet — the console stays in English for now.`})]}):null]})}function Ti({open:e,onClose:t}){return(0,q.jsx)(fe,{open:e,onClose:t,title:`Buy me a coffee`,description:`Support Cartethyia development via QRIS or Saweria.`,size:`lg`,footer:(0,q.jsxs)(Ke,{children:[(0,q.jsxs)(`a`,{href:Si,download:`qris-risun-marke.webp`,className:`flex items-center gap-1.5 rounded-inset border border-inner-border px-3 py-2 text-body text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[(0,q.jsx)(y,{size:14,"aria-hidden":`true`}),`Save QR`]}),(0,q.jsxs)(`a`,{href:xi,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-1.5 rounded-inset bg-accent-bg px-4 py-2 text-body font-semibold text-accent-text hover:opacity-90`,children:[(0,q.jsx)(Ye,{size:14,"aria-hidden":`true`}),`Donate via Saweria`,(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`})]})]}),children:(0,q.jsxs)(`div`,{className:`grid grid-cols-1 gap-5 sm:gap-6 donate-qr-grid`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-2`,children:[(0,q.jsx)(`img`,{src:Si,alt:`QRIS payment code for RISUN`,className:`aspect-square w-full donate-qr-image rounded-inset border border-inner-border bg-white object-contain p-2`}),(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-badge text-text-tertiary`,children:[(0,q.jsx)(st,{size:12,"aria-hidden":`true`}),`Scan with any QRIS app`]})]}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-body leading-relaxed text-text-secondary`,children:`Cartethyia is built in the spare hours between everything else — late nights, weekends, and a suspicious number of energy drinks. If it saved you an afternoon of fighting with rate limits, or made your proxy pool behave, a coffee genuinely helps keep the lights on and the commits coming.`}),(0,q.jsxs)(`ul`,{className:`mt-3 flex flex-col gap-1.5 text-caption text-text-secondary`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(m,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Keeps late-night debugging sessions fuelled.`})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(_,{size:14,className:`mt-0.5 shrink-0 text-accent-text`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`Funds the coffee that funds the next release.`})]})]}),(0,q.jsxs)(`div`,{className:`mt-4 border-t border-inner-border pt-3`,children:[(0,q.jsx)(`p`,{className:`text-badge font-bold uppercase tracking-label text-text-tertiary`,children:`Other ways to support`}),(0,q.jsx)(`ul`,{className:`mt-2 grid grid-cols-1 gap-1.5 sm:grid-cols-2`,children:f.map(e=>(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer noopener`,className:`flex items-center gap-2 rounded-inset border border-inner-border px-3 py-2 text-caption text-text-secondary hover:bg-hover-bg hover:text-text-primary`,children:[e.id===`github-alt`?(0,q.jsx)(pt,{size:12,className:`shrink-0 text-accent-text`,"aria-hidden":`true`}):(0,q.jsx)(Ze,{size:12,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-micro text-text-tertiary`,children:e.hint})]})},e.id))})]}),(0,q.jsx)(`p`,{className:`mt-3 text-badge leading-relaxed text-text-tertiary`,children:`No obligation, no paywall, no nagging — the project stays free either way. Thank you for using it. 💙`})]})]})})}function Ei(){let[e,t]=(0,L.useState)(!1);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`topbar-donate-button`,"aria-label":`Support the project`,title:`Buy me a coffee`,onClick:()=>t(!0),children:[(0,q.jsx)(`span`,{className:`text-badge font-bold tracking-wide`,children:`Donate`}),(0,q.jsx)(Qe,{size:14,"aria-hidden":`true`})]}),(0,q.jsx)(wi,{}),(0,q.jsx)(Ti,{open:e,onClose:()=>t(!1)})]})}var Di=t(c(),1),Oi=`cartethyia.customization`,J=`media`,ki=`background`,Ai=1,ji=`/console-backgrounds.webp`;function Mi(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(Oi,Ai);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(J)||e.createObjectStore(J)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the media database.`)),e}function Ni(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The media database rejected the request.`)),t}function Pi(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}async function Fi(){let e=await Mi();try{let t=await Ni(e.transaction(J,`readonly`).objectStore(J).get(ki));if(!t||!t.blob)return null;let n=t;return{blob:n.blob,kind:n.kind,url:URL.createObjectURL(n.blob)}}finally{e.close()}}async function Ii(e,t){let n=await Mi();try{let r=n.transaction(J,`readwrite`);r.objectStore(J).put({blob:e,kind:t},ki),await Pi(r,`Could not store the background.`)}finally{n.close()}}async function Li(){let e=await Mi();try{let t=e.transaction(J,`readwrite`);t.objectStore(J).delete(ki),await Pi(t,`Could not remove the background.`)}finally{e.close()}}var Ri=2560,zi=.85;async function Bi(e){let t=await createImageBitmap(e).catch(()=>null);if(!t)return e;try{let n=Math.max(t.width,t.height),r=Math.min(1,Ri/n),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t.width*r)),i.height=Math.max(1,Math.round(t.height*r));let a=i.getContext(`2d`);return a?(a.drawImage(t,0,0,i.width,i.height),await Ui(i)??e):e}finally{t.close()}}var Vi=4294967296,Hi=268435456;function Ui(e){let{promise:t,resolve:n}=Promise.withResolvers();return e.toBlob(e=>n(e),`image/webp`,zi),t}function Wi(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:null}var Gi=[`none`,`frosted`,`vibrancy`,`heavy`],Ki=[`off`,`pretty`,`extreme`];function qi(e){return typeof e==`string`&&Ki.includes(e)}var Y={backgroundSet:!1,backgroundEnabled:!0,backgroundRevision:0,backgroundOpacity:20,backgroundScale:100,backgroundX:0,backgroundY:0,backgroundBlur:5,blurCards:`frosted`,blurChrome:`frosted`,blurCardsAmount:45,blurCardsDepth:20,blurChromeAmount:25,blurChromeDepth:10,blurCardsEnabled:!0,blurChromeEnabled:!0,renderMode:`off`,emptyOutline:!1},Ji=`cartethyia.customization`,Yi=`cartethyia-customization-change`,Xi={pretty:{cards:{amount:90,depth:0},chrome:{amount:80,depth:80}},extreme:{cards:{amount:90,depth:0},chrome:{amount:90,depth:0}}},Zi=[`cards`,`chrome`];function Qi(e){return typeof e==`string`&&Gi.includes(e)}function X(e,t,n,r){let i=typeof e==`number`?e:Number(e);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function $i(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{backgroundSet:t.backgroundSet===!0,backgroundRevision:X(t.backgroundRevision,0,2**53-1,0),backgroundEnabled:typeof t.backgroundEnabled==`boolean`?t.backgroundEnabled:Y.backgroundEnabled,backgroundOpacity:X(t.backgroundOpacity,0,100,Y.backgroundOpacity),backgroundScale:X(t.backgroundScale,100,180,Y.backgroundScale),backgroundX:X(t.backgroundX,-100,100,Y.backgroundX),backgroundY:X(t.backgroundY,-100,100,Y.backgroundY),backgroundBlur:X(t.backgroundBlur,0,100,Y.backgroundBlur),blurCards:Qi(t.blurCards)?t.blurCards:Y.blurCards,blurChrome:Qi(t.blurChrome)?t.blurChrome:Y.blurChrome,blurCardsAmount:X(t.blurCardsAmount,0,100,Y.blurCardsAmount),blurChromeAmount:X(t.blurChromeAmount,0,100,Y.blurChromeAmount),blurCardsDepth:X(t.blurCardsDepth,0,100,Y.blurCardsDepth),blurChromeDepth:X(t.blurChromeDepth,0,100,Y.blurChromeDepth),blurCardsEnabled:t.blurCardsEnabled!==!1,blurChromeEnabled:t.blurChromeEnabled!==!1,renderMode:qi(t.renderMode)?t.renderMode:`off`,emptyOutline:t.emptyOutline===!0}}var ea=null;function ta(){if(ea)return ea;if(typeof window>`u`)return Y;try{ea=$i(JSON.parse(window.localStorage.getItem(Ji)??`null`))}catch{ea={...Y}}return ea}function na(e){if(typeof document>`u`)return;let t=document.documentElement;t.dataset.blurCards=e.blurCards,t.dataset.blurChrome=e.blurChrome;let n=t=>{let n=t===`chrome`,r=n?{amount:e.blurChromeAmount,depth:e.blurChromeDepth}:{amount:e.blurCardsAmount,depth:e.blurCardsDepth};return e.renderMode===`off`?r:Xi[e.renderMode][n?`chrome`:`cards`]},r=n(`cards`),i=n(`chrome`);t.style.setProperty(`--blur-cards`,`${r.amount}`),t.style.setProperty(`--blur-chrome`,`${i.amount}`),t.style.setProperty(`--blur-cards-depth`,`${r.depth}`),t.style.setProperty(`--blur-chrome-depth`,`${i.depth}`),t.dataset.blurCardsOn=e.blurCardsEnabled||e.renderMode===`extreme`?`true`:e.renderMode===`pretty`?`false`:`true`,t.dataset.renderMode=e.renderMode,t.dataset.emptyOutline=e.emptyOutline?`true`:`false`,t.dataset.bgActive=e.backgroundEnabled?`true`:`false`,t.style.setProperty(`--bg-opacity`,(e.backgroundOpacity/100).toFixed(2)),t.style.setProperty(`--bg-scale`,(e.backgroundScale/100).toFixed(2)),t.style.setProperty(`--bg-x`,`${e.backgroundX}%`),t.style.setProperty(`--bg-y`,`${e.backgroundY}%`),t.style.setProperty(`--bg-blur`,`${Math.round(e.backgroundBlur*.4)}px`)}function ra(e){try{window.localStorage.setItem(Ji,JSON.stringify(e))}catch{}}function ia(e){let t=$i({...ta(),...e});return ea=t,typeof window<`u`&&(ra(t),na(t),window.dispatchEvent(new CustomEvent(Yi))),t}function aa(){let[e,t]=(0,L.useState)(ta);return(0,L.useEffect)(()=>{let e=()=>t(ta());return window.addEventListener(Yi,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Yi,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>t(ia(e))]}var oa=Zi,sa=`(max-width: 767px)`,ca=`(prefers-reduced-motion: reduce)`;function la(e){let[t,n]=(0,L.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,L.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function ua(){let[e,t]=(0,L.useState)(()=>typeof document>`u`||!document.hidden);return(0,L.useEffect)(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function da(){let[e]=aa(),[t,n]=(0,L.useState)(null),r=la(sa),i=la(ca),a=ua();(0,L.useEffect)(()=>{if(!e.backgroundSet){n(e=>(e&&URL.revokeObjectURL(e.url),{blob:new Blob,kind:`image`,url:ji}));return}let t=!1,r=null;return Fi().then(e=>{if(t){e&&URL.revokeObjectURL(e.url);return}r=e,n(e)}).catch(()=>{t||n(null)}),()=>{t=!0,r&&URL.revokeObjectURL(r.url)}},[e.backgroundSet,e.backgroundRevision]);let o=(0,L.useRef)(null),s=t?.kind===`video`&&!r&&!i&&a;return(0,L.useEffect)(()=>{let e=o.current;if(e){if(s){e.play().catch(()=>{});return}e.pause()}},[s]),!t||!e.backgroundEnabled?null:(0,q.jsx)(`div`,{className:`custom-background`,"data-kind":t.kind,"data-playing":s?`true`:`false`,"aria-hidden":`true`,children:t.kind===`video`?(0,q.jsx)(`video`,{ref:o,className:`custom-background-media`,src:t.url,autoPlay:s,loop:!0,muted:!0,playsInline:!0,preload:r?`metadata`:`auto`}):(0,q.jsx)(`img`,{className:`custom-background-media`,src:t.url,alt:``})})}function fa({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:a=`Confirm`,cancelLabel:o=`Cancel`,danger:s,children:c}){let[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{e&&(u(null),f(!1))},[e]),(0,q.jsx)(fe,{open:e,onClose:t,title:r,description:i,children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsx)(`p`,{className:`text-body text-text-secondary leading-normal`,children:i}),c,l?(0,q.jsx)(`p`,{role:`alert`,className:`text-caption text-red`,children:l}):null,(0,q.jsxs)(Ke,{children:[(0,q.jsx)(w,{variant:`secondary`,size:`sm`,onClick:t,disabled:d,children:o}),(0,q.jsx)(w,{variant:s?`danger`:`primary`,size:`sm`,onClick:()=>{d||(u(null),f(!0),Promise.resolve().then(()=>n()).then(()=>t()).catch(e=>{u(M(e,`Action failed. Please try again.`)),f(!1)}))},disabled:d,children:d?`Working…`:a})]})]})})}var pa={plain:`code-chip-plain`,muted:`code-chip-muted text-text-secondary bg-surface-muted border border-inner-border px-4 py-1 rounded-chip`,accent:`code-chip-accent text-accent bg-accent-soft px-4 py-1.5 rounded-chip font-bold`};function ma({value:e,tone:t=`muted`,action:n,className:r=``,children:i,...a}){return(0,q.jsxs)(`span`,{className:re(`code-chip inline-flex items-center gap-3 min-w-0 max-w-full font-mono text-caption tabular-nums`,pa[t],r),...a,children:[(0,q.jsx)(`code`,{className:`code-chip-value min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,title:a.title??e,children:e}),n?(0,q.jsx)(`span`,{className:`code-chip-action inline-flex shrink-0`,children:n}):null,i]})}var ha=`cartethyia:update-dismissed`;function ga(){try{return window.localStorage.getItem(ha)}catch{return null}}function _a(e){try{window.localStorage.setItem(ha,e)}catch{}}function va(){let[e,t]=(0,L.useState)(!1);return{copied:e,copy:e=>{navigator.clipboard?.writeText(e),t(!0),window.setTimeout(()=>t(!1),1500)}}}function ya({open:e,onClose:t,currentVersion:n,latestVersion:r,releaseUrl:i,onDismissVersion:s,onUpdateNow:c,updating:u=!1,error:d}){let{copied:f,copy:p}=va(),m=r??`the latest release`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(fe,{open:e,onClose:t,title:`Update available`,description:`Cartethyia ${m} is available; this install runs ${n}.`,size:`md`,footer:(0,q.jsxs)(Ke,{children:[s===void 0?(0,q.jsx)(w,{variant:`ghost`,onClick:t,children:`Later`}):(0,q.jsxs)(w,{variant:`ghost`,onClick:()=>{s?.(),t()},children:[`Don’t show for v`,m]}),c!==void 0&&!d?(0,q.jsxs)(w,{onClick:c,disabled:u,children:[u?(0,q.jsx)(x,{size:14,className:`animate-spin`,"aria-hidden":`true`}):null,u?`Updating…`:`Update now`]}):null,(0,q.jsxs)(w,{onClick:()=>p(l),disabled:u,children:[f?(0,q.jsx)(E,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`}),f?`Copied`:`Copy update command`]})]}),children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-6`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid size-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(at,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`p`,{className:`font-semibold text-caption`,children:[n,` → `,m]}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`Stop the gateway, run the command, then start again.`})]})]}),(0,q.jsxs)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`p`,{className:`text-badge text-text-tertiary`,children:`Run this in a terminal`}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center gap-4 min-w-0`,children:[(0,q.jsx)(ma,{value:l,tone:`muted`,title:l,className:`min-w-0 flex-1 truncate`}),(0,q.jsx)(w,{variant:`ghost`,size:`sm`,className:`shrink-0`,onClick:()=>p(l),"aria-label":`Copy the update command`,children:f?(0,q.jsx)(E,{size:14,"aria-hidden":`true`}):(0,q.jsx)(v,{size:14,"aria-hidden":`true`})})]})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-6 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0 text-text-secondary`,children:(0,q.jsx)(ue,{size:14,"aria-hidden":`true`})}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary min-w-0`,children:`npm cannot replace the package while Cartethyia is running from it, so this cannot update itself the way a single-binary tool can. That is why the console gives you the command instead of a button that installs.`})]}),d?(0,q.jsxs)(`div`,{className:`flex items-start gap-6 rounded-card border border-inner-border bg-surface-2 p-4 text-red-500`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:(0,q.jsx)(ue,{size:14,"aria-hidden":`true`})}),(0,q.jsxs)(`p`,{className:`text-badge min-w-0 break-words`,children:[`Update failed — `,d]})]}):null,(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,q.jsxs)(`a`,{href:i??a,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`}),`What’s new on GitHub`]}),(0,q.jsxs)(`a`,{href:o,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-2 text-badge text-accent hover:underline`,children:[(0,q.jsx)(Ze,{size:12,"aria-hidden":`true`}),`Package on npm`]})]})]})}),u?(0,q.jsx)(`div`,{className:`fixed inset-0 z-toast grid place-items-center bg-black/70 backdrop-blur-sm`,children:(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 text-white`,children:[(0,q.jsx)(x,{size:40,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-lg font-semibold`,children:`Updating Cartethyia…`}),(0,q.jsx)(`p`,{className:`text-sm opacity-80`,children:`Do not refresh or close this page.`})]})}):null]})}var ba=`cartethyia.query-cache`,Z=`client`,xa=`default`,Sa=1;function Ca(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(ba,Sa);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(Z)||e.createObjectStore(Z)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the query cache.`)),e}function wa(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The query cache rejected the request.`)),t}function Ta(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}function Ea(e){if(typeof e!=`object`||!e||!(`version`in e)||!(`state`in e))return!1;let{version:t,state:n}=e;return t===1&&typeof n==`object`&&!!n}async function Da(e){try{let t=await Ca();try{let n=t.transaction(Z,`readwrite`);n.objectStore(Z).put({version:1,state:e},xa),await Ta(n,`Could not store the query cache.`)}finally{t.close()}}catch{}}async function Oa(){try{let e=await Ca();try{let t=await wa(e.transaction(Z,`readonly`).objectStore(Z).get(xa));return Ea(t)?t.state:void 0}finally{e.close()}}catch{return}}async function ka(){try{let e=await Ca();try{let t=e.transaction(Z,`readwrite`);t.objectStore(Z).delete(xa),await Ta(t,`Could not remove the query cache.`)}finally{e.close()}}catch{}}var Q=new Et({defaultOptions:{queries:j,mutations:He}});function Aa(e){let[t,n,r]=e.queryKey;return t===`console`?n===`session`?!0:n===`providers`?r===void 0||e.queryKey[3]===`models`:n===`settings`?r===`runtime`:n===`cli-tools`&&r===`registry`:!1}async function ja(){let e=await Oa();e!==void 0&&St(Q,e)}function Ma(){ka()}function Na(){let e,t=Q.getQueryCache().subscribe(t=>{t.type===`updated`&&(t.action.type===`success`||t.action.type===`error`)&&e===void 0&&(e=setTimeout(()=>{e=void 0,Da(xt(Q,{shouldDehydrateQuery:Aa}))},2e3))});return()=>{e!==void 0&&clearTimeout(e),t()}}function Pa(e){let[t,n]=(e.trim().replace(/^v/i,``).split(`+`,1)[0]??``).split(`-`,2);if(t===void 0||!/^\d+\.\d+\.\d+$/.test(t))return null;let r=t.split(`.`).map(Number);if(r.length!==3||r.some(e=>!Number.isSafeInteger(e)||e<0))return null;let i=n===void 0||n.length===0?[]:n.split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e);return i.some(e=>typeof e==`number`&&(!Number.isSafeInteger(e)||e<0))?null:{core:[r[0]??0,r[1]??0,r[2]??0],prerelease:i}}function Fa(e,t){if(e===void 0||t===void 0)return!1;let n=Pa(e),r=Pa(t);return n===null||r===null?t.trim()!==e.trim():Ia(r,n)>0}function Ia(e,t){for(let n=0;n<e.core.length;n+=1){let r=e.core[n]??0,i=t.core[n]??0;if(r!==i)return r>i?1:-1}if(e.prerelease.length===0&&t.prerelease.length>0)return 1;if(e.prerelease.length>0&&t.prerelease.length===0)return-1;for(let n=0;n<Math.max(e.prerelease.length,t.prerelease.length);n+=1){let r=e.prerelease[n],i=t.prerelease[n];if(r===void 0)return-1;if(i===void 0)return 1;if(r!==i)return typeof r==`number`&&typeof i==`string`?-1:typeof r==`string`&&typeof i==`number`||r>i?1:-1}return 0}var La=5e3,Ra=new WeakMap,za={"/":[{queryKey:P.settings.runtime,read:e=>N(`/settings/runtime`,{signal:e})},{queryKey:P.apiKeys.all,read:e=>N(`/api-keys`,{signal:e}).then(Te)}],"/providers":[{queryKey:P.providers.all,read:e=>N(`/providers`,{signal:e}).then(ge)}],"/proxy":[{queryKey:P.network.pools,read:e=>N(`/network/pools`,{signal:e}).then(he)}]};function Ba(e,t){let n=za[t];if(n===void 0)return Promise.resolve();let r=Date.now(),i=Ra.get(e);if(i!==void 0){if(i>r)return Promise.resolve();Ra.delete(e)}return Promise.allSettled(n.map(t=>e.fetchQuery({queryKey:t.queryKey,queryFn:e=>t.read(k(e)),...j}))).then(t=>{if(t.some(e=>e.status===`rejected`&&!ze(e.reason))){Ra.set(e,Date.now()+La);return}Ra.delete(e)})}var Va=20;function Ha(e){if(typeof e!=`object`||!e)return;let t=e;if(!(typeof t.id!=`string`||typeof t.title!=`string`||typeof t.message!=`string`||typeof t.createdAt!=`string`||t.kind!==`memory-high`&&t.kind!==`memory-growth`&&t.kind!==`update-available`||t.level!==`warning`&&t.level!==`info`))return{id:t.id,kind:t.kind,title:t.title,message:t.message,createdAt:t.createdAt,level:t.level,...t.href===u?{href:t.href}:{},...typeof t.version==`string`&&t.version.length>0?{version:t.version.replace(/^v/,``)}:{}}}function Ua(){let[e,t]=(0,L.useState)([]);return oe({url:`/console/api/notifications/stream`,events:[`notification`],onEvent:(e,n)=>{if(e!==`notification`)return;let r;try{r=JSON.parse(n)}catch{return}let i=Ha(r);i&&t(e=>[i,...e.filter(e=>e.id!==i.id)].slice(0,Va))}}),e}function Wa(){return O({queryKey:P.session.current,queryFn:()=>Ie(),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1})}function Ga(e){return O({queryKey:P.system.health,queryFn:e=>N(`/system/health`,{signal:k(e)}).then(Se),...j,enabled:e?.enabled??!0,refetchInterval:e?.refetchInterval??!1})}function Ka(){return O({queryKey:P.releases.githubLatest,queryFn:e=>N(`/updates/release`,{signal:k(e)}).then(ye),...j,staleTime:18e5,retry:!1})}function qa(e){return O({queryKey:P.usageAnalytics.summary(e),queryFn:t=>N(`/system/usage/summary?period=${encodeURIComponent(e)}`,{signal:k(t)}).then(De),...j,refetchInterval:Pe.status})}function Ja(e){return O({queryKey:P.usageAnalytics.chart(e),queryFn:t=>N(`/system/usage/chart?period=${encodeURIComponent(e)}`,{signal:k(t)}).then(ve),...j,refetchInterval:Pe.status})}function Ya(e,t){return O({queryKey:P.usageAnalytics.by(e,t),queryFn:n=>N(`/system/usage/by-${t}?period=${encodeURIComponent(e)}`,{signal:k(n)}).then(be),...j,refetchInterval:Pe.status})}function Xa(e,t=50,n){let r=n==null?``:`&httpStatus=${encodeURIComponent(String(n))}`;return O({queryKey:P.usageAnalytics.requests(e,t,n),queryFn:n=>N(`/system/usage/requests?period=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${r}`,{signal:k(n)}).then(me),...j,placeholderData:e=>e,refetchInterval:Pe.live})}function Za(e){return O({queryKey:P.usageAnalytics.requestDetail(e??`_`),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Request is required`};return N(`/system/usage/requests/${encodeURIComponent(e)}`,{signal:k(t)}).then(_e)},enabled:e!==null,...j})}function Qa(e){return O({queryKey:P.audit.list(e??{}),queryFn:t=>{let n=new URLSearchParams;e?.action&&n.set(`action`,e.action),e?.actor&&n.set(`actor`,e.actor),e?.cursor&&n.set(`cursor`,e.cursor),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString()?`?${n.toString()}`:``;return N(`/audit${r}`,{signal:k(t)}).then(xe)},...j})}function $a(e=!0){return O({queryKey:P.providers.all,queryFn:e=>N(`/providers`,{signal:k(e)}).then(ge),...j,enabled:e,gcTime:6e5,refetchInterval:e?Pe.catalog:!1})}function eo(e){return O({queryKey:P.providers.detail(e??``),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}`,{signal:k(t)}).then(Ee),enabled:!!e,...j})}function to(e){return O({queryKey:P.providers.models(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return N(`/providers/${encodeURIComponent(e)}/models`,{signal:k(t)}).then(we)},...j,staleTime:3e5,gcTime:6e5,enabled:!!e})}function no(){let e=D();return I({mutationFn:({providerId:e,modelIds:t,wireFamily:n,metadata:r})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`POST`,body:JSON.stringify({modelIds:t,...n?{wireFamily:n}:{},...r?{metadata:r}:{}})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),T.success(`Models registered`,`${n.modelIds.length} model(s) added to ${n.providerId}`)},onError:e=>{T.error(`Failed to register models`,M(e))}})}function ro(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}function io(){return I({mutationFn:e=>N(`/providers/connection-test`,{method:`POST`,body:JSON.stringify(e)})})}function ao(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}function oo(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)})}})}function so(){let e=D();return I({mutationFn:({providerId:e,modelId:t,route:n,metadata:r})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify({modelId:t,route:n,enabled:!0,metadata:r})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),T.success(`Model updated`,`${n.modelId} limits and capabilities saved`)},onError:e=>{T.error(`Failed to update model`,M(e))}})}function co(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/models`,{method:`DELETE`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:P.providers.models(n.providerId)})}})}function lo(e){return O({queryKey:P.providers.accounts(e),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}/accounts`,{signal:k(t)}),enabled:!!e,...j,staleTime:12e4,refetchOnMount:!1,gcTime:6e5})}function uo(e){let t=e,n=Array.isArray(t.rows)?t.rows:[],r=e=>{let t=Number(e??0);return Number.isFinite(t)?t:0};return{days:Math.max(1,Math.trunc(r(t.days))||30),rows:n.map(e=>({day:typeof e.day==`string`?e.day:``,model:typeof e.model==`string`?e.model:null,requests:r(e.requests),inputTokens:r(e.inputTokens),cachedInputTokens:r(e.cachedInputTokens),outputTokens:r(e.outputTokens),costUsd:r(e.costUsd)}))}}function fo(e,t){return O({queryKey:P.providers.usageMatrix(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return N(`/providers/${encodeURIComponent(e)}/usage/matrix`,{signal:k(t)}).then(uo)},...j,enabled:!!e&&t})}function po(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}/accounts`,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function mo(){let e=D();return I({mutationFn:({providerId:e,accounts:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/batch`,{method:`POST`,body:JSON.stringify({accounts:t})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function ho(){let e=D();return I({mutationFn:({providerId:e,accountId:t,request:n})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.all})])}})}function go(e,t){return O({queryKey:P.providers.healthEvents(e,t),queryFn:n=>N(`/providers/${encodeURIComponent(e??``)}/accounts/${encodeURIComponent(t??``)}/health-events`,{signal:k(n)}),enabled:!!e&&!!t,...j,refetchInterval:Pe.status})}async function _o(e,t){await e.invalidateQueries({predicate:e=>{let n=e.queryKey;return n[0]===`console`&&n[1]===`providers`&&n[2]===t&&n[3]===`accounts`&&n[5]===`health-events`}})}async function vo(e,t){await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(t)}),_o(e,t),e.invalidateQueries({queryKey:P.providers.all})])}function yo(){let e=D();return I({mutationFn:({providerId:e,accountId:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/recover`,{method:`POST`,body:`{}`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:P.providers.all})]),T.success(`Account recovered`)},onError:e=>{T.error(`Could not recover the account.`,M(e))}})}function bo(){let e=D();return I({mutationFn:({providerId:e,accountId:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/health-events`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:P.settings.diskUsage})]),T.success(t.deleted===0?`Health log was already empty`:`Purged ${t.deleted} health events`,n.title)},onError:e=>{T.error(`Could not purge the health log.`,M(e))}})}function xo(){return I({mutationFn:({providerId:e,accountIds:t})=>N(`/providers/${encodeURIComponent(e)}/accounts/export`,{method:`POST`,body:JSON.stringify({accountIds:t})})})}function So(){return I({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function Co(){let e=D();return I({mutationFn:({providerId:e,code:t,state:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/callback?${new URLSearchParams({code:t,state:n}).toString()}`),onSuccess:async(t,n)=>{await vo(e,n.providerId)}})}function wo(){return I({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>N(`/providers/${encodeURIComponent(e)}/oauth/device/start`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function To(){let e=D();return I({mutationFn:({providerId:e,credential:t,fields:n,accountLabel:r})=>N(`/providers/${encodeURIComponent(e)}/oauth/import`,{method:`POST`,body:JSON.stringify({credential:t,...n&&Object.keys(n).length>0?{fields:n}:{},...r?{accountLabel:r}:{}})}),onSuccess:async(t,n)=>{await vo(e,n.providerId),await e.invalidateQueries({queryKey:P.quota.all})}})}function Eo(){let e=D();return I({mutationFn:({providerId:e,deviceAuthId:t})=>N(`/providers/${encodeURIComponent(e)}/oauth/device/poll`,{method:`POST`,body:JSON.stringify({deviceAuthId:t})}),onSuccess:async(t,n)=>{t.status===`complete`&&await Promise.all([e.invalidateQueries({queryKey:P.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:P.providers.healthEvents(n.providerId,t.accountId)}),e.invalidateQueries({queryKey:P.quota.all}),vo(e,n.providerId)])}})}function Do(){let e=D();return I({mutationFn:e=>N(`/providers`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.modelRouting.all})]),T.success(`Provider created`,t.label??t.providerId)},onError:e=>{T.error(`Failed to create provider`,M(e))}})}function Oo(){let e=D();return I({mutationFn:({providerId:e,request:t})=>N(`/providers/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.providers.detail(n)})]),T.success(`Provider updated`,n)},onError:e=>{T.error(`Failed to update provider`,M(e))}})}function ko(){let e=D();return I({mutationFn:({providerId:e,enabled:t})=>N(`/providers/platform/global/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.providers.detail(n)})])}})}function Ao(e={}){let t=D();return I({mutationFn:e=>N(`/providers/${encodeURIComponent(e)}/models/sync`,{method:`POST`,body:`{}`}),onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:P.providers.models(r)}),e.silent||T.success(`Models fetched`,n.synced>0?`${n.synced} new model${n.synced===1?``:`s`} added`:`No new models found`)},onError:t=>{e.silent||T.error(`Failed to fetch models`,M(t))}})}function jo(){let e=D();return I({mutationFn:e=>N(`/providers/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.all}),e.invalidateQueries({queryKey:P.quota.all}),e.invalidateQueries({queryKey:P.modelRouting.all})]),T.success(`Provider deleted`,n)},onError:e=>{T.error(`Failed to delete provider`,M(e))}})}function Mo(e,t){let n=D();return I({mutationFn:({providerId:t})=>N(`/providers/${encodeURIComponent(t)}/accounts/actions/${e}`,{method:`POST`,body:`{}`}),onSuccess:async(e,r)=>{let i=e.deleted??[];for(let e of i)n.removeQueries({queryKey:P.quota.account(e),exact:!0});await Promise.all([vo(n,r.providerId),n.invalidateQueries({queryKey:P.quota.all})]);let a=i.length>0?i.length:e.updated;T.success(t,`${a} account${a===1?``:`s`}${e.globalSkipped>0?` · ${e.globalSkipped} shared skipped`:``}`)},onError:e=>{T.error(`${t} failed`,M(e))}})}function No(){return Mo(`disable-cooldowns`,`Cooldown accounts disabled`)}function Po(){return Mo(`delete-banned`,`Banned accounts deleted`)}function Fo(e){return O({queryKey:P.providers.modelDiscovery(e),queryFn:t=>N(`/providers/${encodeURIComponent(e??``)}/models/discover`,{signal:k(t)}).then(Ce),enabled:!!e,staleTime:0,gcTime:0,retry:!1,refetchOnWindowFocus:!1})}function Io(){let e=D();return I({mutationFn:({providerId:e,modelIds:t})=>N(`/providers/${encodeURIComponent(e)}/models/discover/commit`,{method:`POST`,body:JSON.stringify({modelIds:[...t]})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:P.providers.models(n.providerId)}),e.invalidateQueries({queryKey:P.providers.modelDiscovery(n.providerId)})]),T.success(`Models added`,`${t.committed.length} model(s) registered from ${n.providerId}${t.skipped.length>0?` · ${t.skipped.length} skipped`:``}`)},onError:e=>{T.error(`Failed to add models`,M(e))}})}function Lo(){let e=D();return I({mutationFn:({providerId:e,mode:t})=>N(`/providers/${encodeURIComponent(e)}/models/test-models`,{method:`POST`,body:JSON.stringify({mode:t})}),onSettled:async(t,n,r)=>{await vo(e,r.providerId)}})}var Ro={name:`cartethyia`,version:`2.8.1`,description:`A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.`,license:`GPL-3.0-only`,type:`module`,packageManager:`bun@1.4.0`,repository:{type:`git`,url:`git+https://github.com/risunCodex/Cartethyia.git`},homepage:`https://github.com/risunCodex/Cartethyia#readme`,bugs:{url:`https://github.com/risunCodex/Cartethyia/issues`},keywords:[`ai`,`gateway`,`llm`,`bun`,`self-hosted`],bin:{cartethyia:`scripts/cli/bin/cartethyia.cjs`,carte:`scripts/cli/bin/carte.cjs`},files:[`scripts/cli/`,`src/`,`migrations/`,`dist/dashboard/`,`.env.example`,`README.md`],workspaces:[`dashboard`],engines:{bun:`>=1.4.0`},scripts:{dev:`bun run dev:watch`,"dev:watch":`bun run scripts/dev/supervisor.ts`,test:`bun run scripts/test/run.ts`,build:`bun run scripts/build/build.ts`,prepack:`bun run dashboard:build`,setup:`bun run scripts/cli/setup.ts`,start:`bun run scripts/cli/main.ts start`,doctor:`bun run scripts/cli/doctor.ts`,restart:`bun run scripts/build/restart.ts`,"build:aot":`bun run scripts/build/aot.ts`,"dev:stack":`concurrently -n BACKEND,DASHBOARD -c cyan,magenta --kill-others-on-fail "bun run dev:backend" "bun run dashboard:dev"`,typecheck:`tsc --noEmit`,"test:watch":`bun run scripts/test/run.ts --watch`,"test-db:up":`docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dev:backend":`bun run src/main.ts`,"dev:console-auth":`bun run scripts/test/console-session.ts`,"dev:visual-baseline":`bun run scripts/test/visual-baseline.ts`,"build:binary":`bun run scripts/build/compile.ts`,"test:backend":`bun run scripts/test/run.ts --scope backend`,"test:integration":`bun run scripts/test/run.ts --scope integration`,"test-db:down":`docker compose -f docker-compose.test.yml down`,"dashboard:dev":`bun run --cwd dashboard dev`,"test-db:check":`bun run scripts/test/check-db.ts`,"dashboard:test":`bun run scripts/test/run.ts --scope dashboard`,"test-db:reset":`docker compose -f docker-compose.test.yml down -v && docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dashboard:build":`bun run --cwd dashboard build`,"dashboard:typecheck":`bun run --cwd dashboard typecheck`,"check:migrations":`bun run scripts/test/check-migrations.ts`},dependencies:{"@grpc/grpc-js":`^1.14.7`,"@grpc/proto-loader":`^0.8.1`,"drizzle-orm":`0.45.2`,elysia:`2.0.0-beta.16`,enquirer:`^2.4.1`,ioredis:`6.0.0`,jose:`^6.2.12`,jsonrepair:`^3.15.0`,pg:`8.23.0`,pino:`^10.3.1`,protobufjs:`^7.6.5`,"socks-proxy-agent":`^10.1.0`,systray2:`2.1.4`,typebox:`1.3.27`,ws:`8.22.0`},devDependencies:{"@types/pg":`8.11.10`,"@types/ws":`8.18.1`,"bun-types":`1.4.0`,concurrently:`^10.0.5`,"drizzle-kit":`^0.31.11`,"pino-pretty":`^13.1.3`,typescript:`5.9.2`}}.version,zo=`v${Ro.replace(/\.0$/,``)} (Jinhsi)`,Bo={title:`Console`,sub:`Cartethyia AI Gateway Administration`,icon:et},Vo=[{key:`overview`,path:`/`,navGroup:`Main`,navLabel:`Overview`,title:`Overview`,sub:`Gateway health, capacity, and live metrics`,icon:et},{key:`usage`,path:`/usage`,navGroup:`Main`,navLabel:`Usage`,title:`Usage & Metrics`,sub:`Token economics, requests, and cost breakdown`,icon:p},{key:`providers`,path:`/providers`,navGroup:`Main`,navLabel:`Providers`,title:`Provider Catalog`,sub:`Upstream credentials, models, and latency`,icon:ut},{key:`provider-detail`,path:`/providers/:providerId`,title:`Provider`,sub:`Routing, accounts, models, and health`,icon:ut},{key:`model-lab`,path:`/model-lab`,navGroup:`Main`,navLabel:`Model Lab`,title:`Model Lab`,sub:`Chat a routed model without leaving the console`,icon:S},{key:`combos`,path:`/combos`,navGroup:`Control`,navLabel:`Combos & Routes`,title:`Combos & Routing`,sub:`Failover policies, model aliases, and weighted routes`,icon:Xe},{key:`quota`,path:`/quota`,navGroup:`Control`,navLabel:`Quota Management`,title:`Quota Management`,sub:`Rate limits, leases, and tenant quotas`,icon:ft},{key:`proxy`,path:`/proxy`,navGroup:`Control`,navLabel:`Proxy & Requests`,title:`Proxy & Requests`,sub:`Network pools, SOCKS5/HTTP egress, and dispatch`,icon:h},{key:`cli-tools`,path:`/cli-tools`,navGroup:`Control`,navLabel:`CLI Tools`,title:`CLI Tools`,sub:`Claude Code CLI, OpenCode, and local developer tool integrations`,icon:g},{key:`cli-tool-detail`,path:`/cli-tools/:toolId`,title:`CLI Tool`,sub:`Mappings, endpoints, and downloadable config`,icon:g},{key:`customization`,path:`/customization`,navGroup:`System`,navLabel:`Customization`,title:`Customization`,sub:`Background, transparency, and blur`,icon:ot},{key:`console-log`,path:`/console-log`,navGroup:`System`,navLabel:`Console Log`,title:`Console Log`,sub:`Live server logs and audit trail`,icon:lt},{key:`settings`,path:`/settings`,navGroup:`System`,navLabel:`Settings`,title:`Settings`,sub:`Account security, runtime preferences, and state recovery`,icon:dt}],Ho=new Map(Vo.filter(e=>!e.path.includes(`:`)).map(e=>[e.path,{title:e.title,sub:e.sub,icon:e.icon}])),Uo=Array.from(Vo.reduce((e,t)=>{if(!t.navGroup||!t.navLabel)return e;let n=e.get(t.navGroup)??[];return n.push({label:t.navLabel,path:t.path,icon:t.icon}),e.set(t.navGroup,n),e},new Map),([e,t])=>({label:e,items:t}));function Wo(e,t=[]){let n=/^\/providers\/([^/]+)\/?$/.exec(e);if(n?.[1]){let e=decodeURIComponent(n[1]),r=t.find(t=>t.providerId===e);return{title:r?.label||r?.displayName||e,sub:`Routing, accounts, models, and health`,icon:ut}}let r=/^\/cli-tools\/([^/]+)\/?$/.exec(e);return r?.[1]?{title:`CLI Tool`,sub:`${decodeURIComponent(r[1])} — mappings, endpoints, and downloadable config`,icon:g}:Ho.get(e)??Bo}function Go(){try{return Ga()}catch{return{data:void 0,isError:!1,isFetching:!1,isPending:!1}}}function Ko(){let[e,t]=(0,L.useState)(()=>ne()),n=te(e);return(0,L.useEffect)(()=>{let e=()=>t(ne());return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,L.useEffect)(()=>{se(e)},[e]),(0,q.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?`light`:`dark`;t(e),ae(e)},"aria-label":`Toggle theme`,"aria-pressed":n,className:`topbar-icon-button`,title:n?`Switch to light mode`:`Switch to dark mode`,children:(0,q.jsx)(`span`,{className:`grid place-items-center`,children:n?(0,q.jsx)(ee,{size:17}):(0,q.jsx)(le,{size:17})},n?`sun`:`moon`)})}var qo=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),Jo=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,timeZone:`UTC`});function Yo(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=e>=1024**3?{divisor:1024**3,label:`GiB`}:{divisor:1024**2,label:`MiB`};return`${(e/t.divisor).toFixed(1)} ${t.label}`}function Xo({icon:e,label:t,value:n,detail:r,title:i}){return(0,q.jsxs)(`div`,{className:`min-w-0 rounded-control border border-inner-border bg-surface-2 p-3`,title:i,children:[(0,q.jsxs)(`dt`,{className:`flex items-center gap-2 text-micro font-medium text-text-tertiary`,children:[(0,q.jsx)(e,{size:13,strokeWidth:1.8,className:`shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:t})]}),(0,q.jsx)(`dd`,{className:`mt-1 truncate font-mono text-caption font-semibold tabular-nums text-text-primary`,children:n}),r?(0,q.jsx)(`dd`,{className:`mt-1 text-micro text-text-secondary`,children:r}):null]})}function Zo({notifications:e,onOpenUpdate:t}){let[n,r]=(0,L.useState)(!1),[i,a]=(0,L.useState)(()=>new Date),o=(0,L.useRef)(null),s=(0,L.useRef)(null),{data:c}=Ga({enabled:n,refetchInterval:n?Pe.status:!1});(0,L.useEffect)(()=>{if(!n)return;a(new Date);let e=window.setInterval(()=>a(new Date),1e3);return()=>window.clearInterval(e)},[n]),(0,L.useEffect)(()=>{if(!n)return;let e=e=>{let t=e.target;s.current&&!s.current.contains(t)&&o.current&&!o.current.contains(t)&&r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]);let l=[c?c.database_in_process?c.database_healthy?`SQLite in-process, connected.`:`SQLite in-process is not answering.`:c.database_healthy?`Postgres connected.`:`Postgres unreachable.`:void 0,c?c.redis_configured?c.redis_healthy?`Redis connected.`:`Redis unreachable.`:`Redis not configured.`:void 0].filter(Boolean).join(` · `),u=c?c.status===`healthy`?`All systems operational`:c.status===`degraded`?`Gateway degraded`:`Gateway unhealthy`:`System health unavailable`,d=c?c.status===`healthy`?l||`Gateway reported healthy.`:[l,`Check connection logs.`].filter(Boolean).join(` — `):`Live gateway metrics are not available.`,f=c&&[Number.isFinite(c.memory_percent)?`${c.memory_percent.toFixed(1)}% of system RAM`:void 0,c.database_in_process?`In-process DB included`:void 0].filter(Boolean).join(` · `)||void 0,p=c?.cpu_percent??void 0,m=p!==void 0&&Number.isFinite(p),h=c?m?Number.isFinite(c.cpu_cores)&&c.cpu_cores>0?`1-min load · ${c.cpu_cores} cores`:`Normalized 1-min load`:`Not reported on this platform`:void 0;return(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsxs)(`button`,{ref:o,type:`button`,className:`topbar-icon-button`,"aria-label":`Notifications`,"aria-expanded":n,"aria-haspopup":`dialog`,onClick:()=>r(e=>!e),children:[(0,q.jsx)(qe,{size:17}),e.length>0?(0,q.jsx)(`span`,{"aria-label":`${e.length} notifications`,className:`absolute right-1.5 top-1.5 size-2 rounded-full bg-accent`}):null]}),n?(0,Di.createPortal)((0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-floating bg-overlay backdrop-blur-dialog`,onClick:()=>r(!1)}),(0,q.jsxs)(`div`,{ref:s,role:`dialog`,"aria-label":`Notifications`,className:`app-topbar-popover popout-enter glass rounded-sidebar border border-inner-border bg-popover-bg p-5 shadow-popout z-popover`,children:[(0,q.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3 font-bold text-body-lg`,children:[(0,q.jsx)(`span`,{className:`w-13 h-13 rounded-pill bg-accent-soft text-accent grid place-items-center`,children:(0,q.jsx)(qe,{size:13})}),(0,q.jsx)(`span`,{children:`Notifications`})]}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Close notifications`,onClick:()=>r(!1),className:`cursor-pointer border-none bg-transparent p-2 text-caption text-text-tertiary`,children:(0,q.jsx)(de,{size:14})})]}),(0,q.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 flex flex-col gap-3`,children:[e.length>0?(0,q.jsx)(`section`,{"aria-label":`Notifications`,className:`flex flex-col gap-2`,children:e.map(e=>(0,q.jsxs)(`article`,{className:`flex items-start gap-3 rounded-card border p-4 ${e.level===`warning`?`border-orange-soft bg-orange-soft`:`border-accent/25 bg-accent-soft`}`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-caption font-semibold text-text-primary`,children:e.title}),(0,q.jsx)(`span`,{className:`mt-1 block text-badge text-text-secondary`,children:e.message})]}),e.href?e.kind===`update-available`?(0,q.jsx)(`button`,{type:`button`,className:`shrink-0 text-badge font-semibold text-accent`,onClick:t,children:`Update`}):(0,q.jsx)(`a`,{className:`shrink-0 text-badge font-semibold text-accent`,href:e.href,target:`_blank`,rel:`noreferrer`,children:`Open`}):null]},e.id))}):(0,q.jsx)(`div`,{className:`rounded-card border border-inner-border bg-surface-2 p-4 text-badge text-text-secondary`,children:`No active memory or update alerts.`}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ut,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:u}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:d})]})]}),(0,q.jsxs)(`dl`,{"aria-label":`Runtime metrics`,className:`grid grid-cols-2 gap-2`,children:[(0,q.jsx)(Xo,{icon:b,label:`Local time`,value:qo.format(i)}),(0,q.jsx)(Xo,{icon:ce,label:`UTC`,value:Jo.format(i)}),(0,q.jsx)(Xo,{icon:mt,label:`Uptime`,value:c?ie(c.uptime_seconds):`Unavailable`,detail:c&&Number.isFinite(c.uptime_seconds)&&c.uptime_seconds>=0?`Gateway process running`:void 0}),(0,q.jsx)(Xo,{icon:nt,label:`Process RSS`,value:c?Yo(c.memory_bytes):`Unavailable`,detail:f,title:`Process resident set size; percentage is share of system RAM.`}),(0,q.jsx)(Xo,{icon:Xe,label:`CPU load`,value:m&&p!==void 0?`${p.toFixed(1)}%`:`Unavailable`,detail:h,title:`One-minute load average normalized by the number of CPU cores.`}),(0,q.jsx)(Xo,{icon:it,label:`Runtime`,value:c?.platform?.trim()||`Unavailable`,detail:c?.platform?.trim()?`Gateway host platform`:void 0,title:c?.platform?.trim()||`Runtime platform unavailable`})]}),(0,q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,q.jsx)(ct,{size:16,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`font-semibold text-caption`,children:zo}),(0,q.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`High-performance AI Gateway & Protocol Orchestrator.`})]})]})]})]})]}),document.body):null]})}function Qo({group:e,pathname:t,onIntent:n}){return(0,q.jsxs)(`div`,{className:`nav-group-section`,children:[(0,q.jsx)(`p`,{className:`nav-group-title`,children:e.label}),(0,q.jsx)($o,{items:e.items,pathname:t,onIntent:n})]})}function $o({items:e,pathname:t,onIntent:n}){let r=(0,L.useRef)(null),[i,a]=(0,L.useState)({top:0,height:0,opacity:0}),[o,s]=(0,L.useState)(()=>new Set);return(0,L.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[data-active="true"]`);if(!t){a(e=>({...e,opacity:0}));return}let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();a({top:i.top-n.top,height:i.height,opacity:1})},[t,e]),(0,q.jsxs)(`div`,{ref:r,className:`nav-items-container`,children:[(0,q.jsx)(`div`,{className:`sidebar-active-indicator`,style:{transform:`translateY(${i.top}px)`,height:`${i.height}px`,opacity:i.opacity},"aria-hidden":`true`}),e.map(e=>{if(e.children!==void 0){let t=o.has(e.path??e.label);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,"aria-expanded":t,onClick:()=>s(t=>{let n=new Set(t),r=e.path??e.label;return n.has(r)?n.delete(r):n.add(r),n}),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(Je,{size:14,className:`ml-auto shrink-0 transition-transform ${t?`rotate-180`:``}`,"aria-hidden":`true`})]}),t?(0,q.jsx)(`div`,{className:`ml-6 border-l border-inner-border pl-2`,children:e.children.map(e=>(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full`,disabled:e.disabled===!0,title:e.label,children:[(0,q.jsx)(e.icon,{size:15,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},e.path??e.label))}):null]},e.path??e.label)}if(e.disabled)return(0,q.jsxs)(`button`,{type:`button`,className:`nav-link-item w-full cursor-not-allowed opacity-55`,disabled:!0,"aria-label":`${e.label} — unavailable`,title:`Coming soon`,children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(`span`,{className:`nav-link-badge`,children:`Soon`})]},e.path??e.label);if(e.path===void 0)return null;let r=e.path,i=r===`/`?t===`/`:t===r||t.startsWith(`${r}/`);return(0,q.jsxs)(li,{to:r,end:r===`/`,"data-active":i?`true`:void 0,className:`nav-link-item ${i?`active`:``}`,onMouseEnter:()=>n(r),onFocus:()=>n(r),children:[(0,q.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,q.jsx)(`span`,{children:e.label}),e.badge?(0,q.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},r)})]})}function es({user:e,children:t}){let n=Yn(),r=G(),[i,a]=(0,L.useState)(!1),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(!1),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),_=async()=>{m(!0),g(null);try{await N(`/updates/apply`,{method:`POST`})}catch(e){m(!1),g(typeof e==`object`&&e&&`message`in e?String(e.message):`The update could not be started.`);return}let e=e=>{e.preventDefault()};window.addEventListener(`beforeunload`,e);let t=C,n=()=>{window.clearInterval(r),window.removeEventListener(`beforeunload`,e)},r=window.setInterval(async()=>{try{let e=await(await fetch(`/console/api/updates/status`)).json();if(e.status===`failed`){n(),m(!1),g(`The install failed${e.stderrTail?`: ${e.stderrTail}`:`. See update.log in the config directory.`}`);return}if(e.status===`success`){n();try{let e=await(await fetch(`/console/api/system/health`)).json();if(e.version!==void 0&&t!==void 0&&e.version===t){window.location.reload();return}}catch{}window.location.reload();return}}catch{try{let e=await(await fetch(`/console/api/updates/release`)).json();t!==void 0&&e.tag_name!==void 0&&e.tag_name!==t&&(n(),window.location.reload())}catch{}}},3e3)},v=Go(),y=Ka(),b=Ua(),x=v.data?.version??Ro,S=b.find(e=>e.kind===`update-available`),C=S?.version??y.data?.tag_name?.replace(/^v/,``),ee=S!==void 0||Fa(x,C),w=$a(/^\/providers\/[^/]+\/?$/.test(r.pathname)),te=(0,L.useRef)(null);(0,L.useEffect)(()=>{ee&&C!==void 0&&ga()!==C&&te.current!==C&&(te.current=C,f(!0))},[ee,C]);let ne=e=>{Ba(Q,e)};(0,L.useEffect)(()=>{a(!1)},[r.pathname]),(0,L.useEffect)(()=>{let e=()=>a(!1);return window.addEventListener(`cartethyia:overlay-open`,e),()=>window.removeEventListener(`cartethyia:overlay-open`,e)},[]),(0,L.useLayoutEffect)(()=>{window.scrollTo(0,0)},[r.pathname]);let T=async()=>{s(!0);try{await N(`/auth/logout`,{method:`POST`})}finally{Q.clear(),Ma(),n(`/login`,{replace:!0})}};(0,L.useEffect)(()=>(document.documentElement.dataset.glassEnabled=`true`,na(ta()),()=>{delete document.documentElement.dataset.glassEnabled}),[]);let E=Wo(r.pathname,w.data??[]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`app-bg`,"aria-hidden":`true`}),(0,q.jsx)(da,{}),(0,q.jsx)(`div`,{className:`app-shell-frame`,children:(0,q.jsxs)(`div`,{className:`app-shell-root`,"data-drawer":i?`open`:void 0,"data-page-scroll":r.pathname===`/console-log`?`contained`:void 0,onClick:e=>{i&&e.target.closest(`.app-main-column`)&&a(!1)},children:[(0,q.jsxs)(`aside`,{className:`glass app-sidebar ${i?`is-open`:``}`,"aria-label":`Dashboard navigation`,children:[(0,q.jsxs)(`div`,{className:`brand-header`,children:[(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`brand-icon overflow-hidden p-0`,children:(0,q.jsx)(`img`,{src:`/assets/brand/sidebar_ico.webp`,alt:`Cartethyia`,onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=`/assets/brand/sidebar_ico.webp`},className:`w-full h-full object-cover block`})}),(0,q.jsxs)(`div`,{className:`brand-meta`,children:[(0,q.jsx)(`div`,{className:`brand-name`,children:(0,q.jsx)(`span`,{children:`Cartethyia`})}),(0,q.jsxs)(`div`,{className:`brand-version-badge`,children:[(0,q.jsx)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`brand-version-link`,children:zo}),ee?(0,q.jsxs)(`button`,{type:`button`,onClick:()=>f(!0),className:`brand-update-badge`,title:C===void 0?`A newer Cartethyia release is available`:`Update available: v${C} — how to install it`,children:[(0,q.jsx)(ct,{size:9,className:`shrink-0`,"aria-hidden":`true`}),C===void 0?`update`:`Update v${C}`]}):null]})]})]}),(0,q.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-0`,children:Uo.map(e=>(0,q.jsx)(Qo,{group:e,pathname:r.pathname,onIntent:ne},e.label))}),(0,q.jsx)(`div`,{className:`sidebar-user-card`,children:(0,q.jsxs)(`div`,{className:`user-card-content`,children:[(0,q.jsx)(`div`,{className:`user-avatar`,"aria-hidden":`true`,children:(e.displayName??e.email).slice(0,2).toUpperCase()}),(0,q.jsxs)(`div`,{className:`user-info`,children:[(0,q.jsx)(`p`,{className:`user-name`,children:e.displayName||`Admin`}),(0,q.jsx)(`p`,{className:`user-role`,children:e.email})]}),(0,q.jsx)(`button`,{type:`button`,onClick:()=>l(!0),disabled:o,"aria-label":`Sign out`,title:`Sign out`,className:`topbar-icon-button w-15 h-15 rounded-inset`,children:(0,q.jsx)(tt,{size:14})})]})})]}),(0,q.jsxs)(`div`,{className:`app-main-column`,children:[(0,q.jsxs)(`header`,{className:`glass app-topbar`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,className:`topbar-menu-btn`,onClick:()=>a(!0),children:(0,q.jsx)(rt,{size:18})}),(0,q.jsxs)(`div`,{className:`topbar-meta`,children:[(0,q.jsxs)(`h1`,{className:`topbar-title`,children:[(0,q.jsx)(E.icon,{className:`topbar-title-icon`,size:16,"aria-hidden":`true`}),E.title]}),(0,q.jsx)(`p`,{className:`topbar-subtitle`,children:E.sub})]}),(0,q.jsxs)(`div`,{className:`topbar-actions`,children:[(0,q.jsx)(Ei,{}),(0,q.jsx)(Ko,{}),(0,q.jsx)(Zo,{notifications:b,onOpenUpdate:()=>f(!0)})]})]}),(0,q.jsx)(`main`,{className:`route-enter w-full min-w-0`,children:t})]})]})}),(0,q.jsx)(fa,{open:c,onClose:()=>l(!1),onConfirm:T,title:`Sign out?`,message:`You will need to sign in again to open the console.`,confirmLabel:`Sign out`,danger:!0}),(0,q.jsx)(ya,{open:d,onClose:()=>f(!1),currentVersion:x,...C===void 0?{}:{latestVersion:C},...(S?.href??y.data?.html_url)===void 0?{}:{releaseUrl:S?.href??y.data?.html_url},...C===void 0?{}:{onDismissVersion:()=>_a(C)},onUpdateNow:_,updating:p,...h===null?{}:{error:h}})]})}var ts=f.filter(e=>e.id!==`github-alt`&&e.id!==`gitlab`);function ns({title:e,description:t,icon:n,logoClassName:r=``,children:i}){return(0,q.jsxs)(`main`,{className:`auth-viewport`,children:[(0,q.jsx)(`div`,{className:`auth-image-col`,role:`presentation`,"aria-hidden":`true`}),(0,q.jsx)(`section`,{className:`auth-form-col`,children:(0,q.jsxs)(`div`,{className:`auth-form-inner`,children:[(0,q.jsxs)(`div`,{className:`auth-brand-head`,children:[(0,q.jsx)(`div`,{className:`auth-logo ${r}`.trim(),"aria-hidden":`true`,children:n}),(0,q.jsx)(`h1`,{className:`auth-title`,children:e}),(0,q.jsx)(`p`,{className:`auth-desc`,children:t})]}),(0,q.jsx)(`div`,{className:`auth-form-body`,children:i}),(0,q.jsxs)(`nav`,{className:`auth-hero-links`,"aria-label":`Public source and distribution links`,children:[(0,q.jsx)(`span`,{className:`auth-brand-links-label`,children:`Get Cartethyia`}),(0,q.jsx)(`div`,{className:`auth-brand-links-grid`,children:ts.map(e=>(0,q.jsxs)(`a`,{className:`auth-brand-link`,href:e.href,target:`_blank`,rel:`noreferrer`,title:e.hint,children:[(0,q.jsx)(d,{id:e.id,size:15}),(0,q.jsx)(`span`,{children:e.label})]},e.id))})]})]})})]})}var rs=class extends L.Component{state={error:null,componentStack:null};static getDerivedStateFromError(e){return{error:e,componentStack:null}}componentDidCatch(e,t){console.error(`[console] route render failed:`,e,t.componentStack),this.setState({componentStack:t.componentStack??null})}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){if(this.state.error===null)return this.props.children;let e=this.state.componentStack?.trim(),t=this.state.error.stack?.trim(),n=e!==void 0&&e.length>0?e:t!==void 0&&t.length>0?t:null;return(0,q.jsxs)(ns,{title:`Console view failed`,description:`This view could not be rendered.`,children:[(0,q.jsxs)(`div`,{className:`rounded-panel border border-inner-border bg-surface-2 p-7 leading-normal text-caption text-text-secondary`,children:[(0,q.jsx)(`strong`,{className:`block text-text-primary mb-2`,children:`Rendering error`}),(0,q.jsx)(`span`,{className:`select-text break-words`,children:this.state.error.message}),n===null?null:(0,q.jsx)(`pre`,{className:`mt-4 max-h-80 overflow-auto whitespace-pre-wrap break-words text-badge text-text-tertiary`,children:n})]}),(0,q.jsx)(`button`,{type:`button`,className:`btn btn-primary inline-flex w-full items-center justify-center rounded-control bg-accent font-semibold text-accent-foreground mt-3 h-20 text-caption`,onClick:()=>window.location.reload(),children:`Reload console`})]})}},is=3e5;function as(e){return`cartethyia:lazy-retry:${e}`}function os(e,t){if(e===null)return!0;let n=Number(e);return!Number.isFinite(n)||t-n>is}function ss(){try{return typeof sessionStorage>`u`?void 0:sessionStorage}catch{return}}function $(e,t,n={}){let r=n.storage??ss(),i=n.reload??(()=>{window.location.reload()}),a=n.now??(()=>Date.now()),o=as(t);return(0,L.lazy)(async()=>{try{let t=await e();try{r?.removeItem(o)}catch{}return t}catch(e){let t=null;try{t=r?.getItem(o)??null}catch{t=null}if(os(t,a())){try{r?.setItem(o,String(a()))}catch{}return i(),new Promise(()=>{})}throw e}})}function cs(){return(0,q.jsxs)(`div`,{role:`status`,"aria-label":`Loading console`,className:`min-h-dvh flex flex-col items-center justify-center gap-6 text-text-tertiary`,children:[(0,q.jsx)(x,{size:22,className:`animate-spin`,"aria-hidden":`true`}),(0,q.jsx)(`p`,{className:`text-caption`,children:`Loading console…`})]})}var ls=$(()=>i(()=>import(`./LoginPage-CZuI0MAR.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`login`),us=$(()=>i(()=>import(`./SetupPage--s-EfEIL.js`),__vite__mapDeps([10,1,2,3,4,6,7,8,9,11,12])),`setup`),ds=$(()=>i(()=>import(`./BannedPage-Dq530awD.js`),__vite__mapDeps([13,1])),`banned`),fs=$(()=>i(()=>import(`./OverviewPage-0yfhSI1C.js`),__vite__mapDeps([14,1,15,16,17,18,2,3,4,19,20,9,21,22,23,24,25,26,27,28,29,30,6,31,32,33,34,35,7,8,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,11,59,60])),`overview`),ps=$(()=>i(()=>import(`./UsagePage-CP8F8BN7.js`),__vite__mapDeps([61,1,15,16,17,2,3,4,62,63,30,6,55,36,44,8,9,64,21,5,24,65,51,66,67,68,33,54,38,39,57,31,32,11,40,69,70,71])),`usage`),ms=$(()=>i(()=>import(`./ProviderDetailPage-xqTxdQ4c.js`),__vite__mapDeps([72,1,15,73,74,18,2,3,4,75,62,76,63,30,6,55,36,8,9,45,64,21,46,22,24,23,25,26,49,50,77,27,28,29,67,33,54,34,35,7,37,38,39,57,31,32,59,60,40,43,78,79,80,11,69,70])),`provider-detail`),hs=$(()=>i(()=>import(`./ProvidersPage-C3fYuu6i.js`),__vite__mapDeps([81,1,2,3,4,8,9,21,23,24,26,29,6,82,33,34,35,7,36,37,38,39,41,42,19,78,69])),`providers`),gs=$(()=>i(()=>import(`./CombosPage-BlC_xdkX.js`),__vite__mapDeps([83,1,84,2,3,4,20,9,21,22,23,24,25,26,27,28,29,30,6,31,32,33,34,35,7,8,36,37,38,39,40,41,42,19,43,76,64,51,82,48,56,55,60,78,70])),`combos`),_s=$(()=>i(()=>import(`./QuotaPage-D1RV_2BX.js`),__vite__mapDeps([85,1,15,2,3,4,42,19,8,21,23,24,50,77,29,86,6,33,34,35,36,37,38,39,11,59,80,30,31,32])),`quota`),vs=$(()=>i(()=>import(`./ProxyPage-CHtJtZ3u.js`),__vite__mapDeps([87,1,15,2,3,4,8,9,45,21,23,24,25,26,49,77,52,29,30,6,33,54,34,35,7,36,38,39,11,79,31,32,69,71])),`proxy`),ys=$(()=>i(()=>import(`./SettingsPage-BzZAvYSX.js`),__vite__mapDeps([88,1,15,2,3,4,44,9,21,22,23,24,53,29,86,30,6,31,32,33,54,34,7,8,36,38,60,40,12])),`settings`),bs=$(()=>i(()=>import(`./CliToolsPage-DaZZ3cqP.js`),__vite__mapDeps([89,1,15,21,2,3,4,33,35,38,39,58,30,6,31,32,90,11])),`cli-tools`),xs=$(()=>i(()=>import(`./CliToolDetailPage-DZzaS-7S.js`),__vite__mapDeps([91,1,73,2,3,4,62,9,21,23,24,26,27,28,6,33,54,34,35,7,8,36,56,51,30,55,37,38,39,57,31,32,58,90])),`cli-tool-detail`),Ss=$(()=>i(()=>import(`./ConsoleLogPage-D-rqeVtG.js`),__vite__mapDeps([92,1,2,3,4,21,50,27,52,29,6,33,35,7,8,9,11])),`console-log`),Cs=$(()=>i(()=>import(`./CustomizationPage-7xT5yg2E.js`),__vite__mapDeps([93,1,2,3,4,64,22,77,33,34,36,38,39])),`customization`),ws=$(()=>i(()=>import(`./StudioPage-BjXFGSK4.js`),__vite__mapDeps([94,1,16,74,2,3,4,75,45,24,95,23,65,25,77,67,33,7,8,9,36,56,51,27,30,6,55,35,37,57,31,32])),`studio`);function Ts(){let e=Yn(),t=G();return(0,L.useEffect)(()=>(Le(n=>{if(Q.clear(),Ma(),n===`banned`){e(`/banned`,{replace:!0});return}e(`/login?returnTo=${encodeURIComponent(t.pathname)}`,{replace:!0})}),()=>Le(void 0)),[e,t.pathname]),null}function Es(){let e=G();return(0,q.jsx)(rs,{resetKey:`${e.pathname}${e.search}`,children:(0,q.jsx)(L.Suspense,{fallback:(0,q.jsx)(cs,{}),children:(0,q.jsxs)(xr,{children:[(0,q.jsx)(K,{path:`/login`,element:(0,q.jsx)(ls,{})}),(0,q.jsx)(K,{path:`/setup`,element:(0,q.jsx)(us,{})}),(0,q.jsx)(K,{path:`/banned`,element:(0,q.jsx)(ds,{})}),(0,q.jsx)(K,{path:`/*`,element:(0,q.jsx)(Ds,{})})]})})})}function Ds(){let[e,t]=(0,L.useState)({kind:`loading`}),n=G(),r=Yn(),[i]=(0,L.useState)(()=>n.pathname);return(0,L.useEffect)(()=>{let e=new AbortController;return Q.fetchQuery({queryKey:P.session.current,queryFn:()=>Ie(),staleTime:6e4}).then(n=>{if(!e.signal.aborted){if(n){Q.setQueryData(P.session.current,n),t({kind:`ready`,user:n}),n.isFirstBoot&&i!==`/setup`&&r(`/setup`,{replace:!0});return}Q.removeQueries({queryKey:P.session.current}),N(`/auth/first-boot`,{signal:e.signal}).then(n=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:n.requires_setup})}).catch(()=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:!1})})}}).catch(n=>{e.signal.aborted||(typeof n==`object`&&n&&`status`in n&&n.status===403?t({kind:`blocked`}):t({kind:`unauthenticated`,needsSetup:!1}))}),()=>e.abort()},[i,r]),e.kind===`loading`?null:e.kind===`blocked`?(0,q.jsx)(yr,{to:`/banned`,replace:!0}):e.kind===`unauthenticated`?(0,q.jsx)(yr,{to:e.needsSetup?`/setup`:`/login?returnTo=${encodeURIComponent(n.pathname)}`,replace:!0}):(0,q.jsx)(es,{user:e.user,children:(0,q.jsxs)(xr,{children:[Vo.map(e=>{switch(e.key){case`overview`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(fs,{})},e.key);case`usage`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ps,{})},e.key);case`providers`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(hs,{})},e.key);case`provider-detail`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ms,{})},e.key);case`combos`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(gs,{})},e.key);case`quota`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(_s,{})},e.key);case`proxy`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(vs,{})},e.key);case`console-log`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(Ss,{})},e.key);case`customization`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(Cs,{})},e.key);case`model-lab`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ws,{})},e.key);case`cli-tools`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(bs,{})},e.key);case`cli-tool-detail`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(xs,{})},e.key);case`settings`:return(0,q.jsx)(K,{path:e.path,element:(0,q.jsx)(ys,{})},e.key)}}),(0,q.jsx)(K,{path:`*`,element:(0,q.jsx)(yr,{to:`/`,replace:!0})})]})})}function Os(){return(0,q.jsx)(pe,{client:Q,children:(0,q.jsxs)(si,{basename:`/console`,children:[(0,q.jsx)(Ts,{}),(0,q.jsx)(Es,{}),(0,q.jsx)(C,{position:`top-right`,offset:{top:`6rem`,right:`1rem`},mobileOffset:{top:`6rem`,left:`1rem`,right:`1rem`},visibleToasts:2,richColors:!0,duration:5e3,toastOptions:{className:`toast-surface select-text`,descriptionClassName:`select-text`,classNames:{title:`select-text`},style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`,userSelect:`text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]})})}function ks(e){document.title=`Cartethyia Console`,ja().finally(()=>{Na(),(0,bi.createRoot)(e).render((0,q.jsx)(L.StrictMode,{children:(0,q.jsx)(Os,{})}))})}export{ji as $,Ao as A,Za as B,$a as C,oo as D,no as E,ho as F,fa as G,qa as H,Qa as I,Xi as J,oa as K,Wa as L,ko as M,so as N,So as O,Oo as P,Hi as Q,Ya as R,fo as S,yo as T,Q as U,Xa as V,ma as W,aa as X,ia as Y,Vi as Z,ao as _,Do as a,ci as at,eo as b,jo as c,mi as ct,No as d,ut as dt,Li as et,Fo as f,lt as ft,Lo as g,Je as gt,Eo as h,Ze as ht,Co as i,Ii as it,io as j,wo as k,Po as l,mt as lt,To as m,ks as mountConsole,$e as mt,go as n,Fi as nt,po as o,Yn as ot,xo as p,et as pt,Y as q,Io as r,Bi as rt,mo as s,Zn as st,ns as t,Wi as tt,co as u,ft as ut,ro as v,bo as w,to as x,lo as y,Ja as z};
|