@synthever/jrouter 1.0.0 → 1.0.2
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/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +14 -14
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +2 -2
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +9 -9
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/secret/route.js +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js +2 -2
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js +2 -2
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/check/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/check-all/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/config/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/history/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/model/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/run-scheduled/route.js +1 -1
- package/app/.next-cli-build/server/app/api/model-health/summary/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/limits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/connections/keys/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js +2 -2
- package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js +4 -4
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/health.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/health.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/health.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/playground.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing/page.js +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +6 -6
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login/page.js +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js +1 -1
- package/app/.next-cli-build/server/app/manifest.webmanifest.body +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +14 -14
- package/app/.next-cli-build/server/chunks/1133.js +1 -1
- package/app/.next-cli-build/server/chunks/1757.js +2 -2
- package/app/.next-cli-build/server/chunks/2132.js +1 -1
- package/app/.next-cli-build/server/chunks/2524.js +1 -1
- package/app/.next-cli-build/server/chunks/2732.js +1 -1
- package/app/.next-cli-build/server/chunks/2760.js +1 -1
- package/app/.next-cli-build/server/chunks/3192.js +1 -1
- package/app/.next-cli-build/server/chunks/3360.js +1 -1
- package/app/.next-cli-build/server/chunks/3535.js +1 -1
- package/app/.next-cli-build/server/chunks/3966.js +6 -6
- package/app/.next-cli-build/server/chunks/412.js +1 -1
- package/app/.next-cli-build/server/chunks/4123.js +3 -3
- package/app/.next-cli-build/server/chunks/4152.js +1 -1
- package/app/.next-cli-build/server/chunks/436.js +1 -1
- package/app/.next-cli-build/server/chunks/455.js +1 -1
- package/app/.next-cli-build/server/chunks/4642.js +1 -1
- package/app/.next-cli-build/server/chunks/4746.js +1 -1
- package/app/.next-cli-build/server/chunks/4764.js +1 -1
- package/app/.next-cli-build/server/chunks/4827.js +1 -1
- package/app/.next-cli-build/server/chunks/4864.js +6 -6
- package/app/.next-cli-build/server/chunks/5299.js +25 -25
- package/app/.next-cli-build/server/chunks/5330.js +1 -1
- package/app/.next-cli-build/server/chunks/5615.js +2 -2
- package/app/.next-cli-build/server/chunks/6296.js +5 -5
- package/app/.next-cli-build/server/chunks/735.js +1 -1
- package/app/.next-cli-build/server/chunks/7373.js +1 -1
- package/app/.next-cli-build/server/chunks/7716.js +1 -1
- package/app/.next-cli-build/server/chunks/8126.js +1 -1
- package/app/.next-cli-build/server/chunks/8306.js +1 -1
- package/app/.next-cli-build/server/chunks/8432.js +1 -1
- package/app/.next-cli-build/server/chunks/8749.js +1 -1
- package/app/.next-cli-build/server/chunks/9032.js +1 -1
- package/app/.next-cli-build/server/chunks/9046.js +1 -1
- package/app/.next-cli-build/server/chunks/9128.js +1 -1
- package/app/.next-cli-build/server/chunks/9489.js +1 -1
- package/app/.next-cli-build/server/chunks/9609.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +2 -2
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/{1321-b2785838003873e1.js → 1321-9eb7d54c5b900efb.js} +1 -1
- package/app/.next-cli-build/static/chunks/{5497-66e7c2a2b715a638.js → 5497-973a06c94a94aff7.js} +1 -1
- package/app/.next-cli-build/static/chunks/761-1bcb7334763d5645.js +132 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-9f4426c30039c7d5.js → page-3960bffd1fddbbad.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/endpoint/{page-0c7b45a45ba51753.js → page-61b17862582ff807.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/profile/{page-de6dfc43c2687bd8.js → page-1a560f2b5cdf2e31.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-4c6b176d5c59d8a4.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/token-saver/{page-e631d28dd402dc1e.js → page-d0031965cf7eff51.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/landing/{page-431f7e8093b8ca51.js → page-5bc39b166588b878.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/login/{page-80c4e229a5f38a6b.js → page-f2b166590b653d36.js} +1 -1
- package/app/custom-server.js +2 -2
- package/app/package.json +1 -1
- package/app/src/lib/oauth/providers/xiaomi-mimo.js +2 -2
- package/app/src/lib/updater/updater.js +3 -3
- package/app/src/mitm/server.js +10 -10
- package/cli.js +6 -6
- package/hooks/postinstall.js +2 -2
- package/hooks/sqliteRuntime.js +2 -2
- package/hooks/trayRuntime.js +3 -3
- package/package.json +7 -3
- package/src/cli/api/client.js +3 -3
- package/src/cli/commands/connect.js +3 -3
- package/src/cli/commands/connectTools.js +12 -12
- package/src/cli/commands/xaiVideo.js +1 -1
- package/src/cli/menus/cliTools.js +18 -18
- package/src/cli/menus/settings.js +1 -1
- package/src/cli/tray/autostart.js +1 -1
- package/app/.next-cli-build/static/chunks/761-57ed45cdddcf32eb.js +0 -132
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/skills/page-316b3186a841d862.js +0 -1
- /package/app/.next-cli-build/static/{fjLlI_-eBYMOp6J-a-q-6 → MDZXE-9g1sq006f6JNky9}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{fjLlI_-eBYMOp6J-a-q-6 → MDZXE-9g1sq006f6JNky9}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(74429),h=c(51126),i=c(99258);let j=a=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"},fa:{name:"فارسی",flag:"\uD83C\uDDEE\uD83C\uDDF7"}})[a]||{name:a,flag:"\uD83C\uDF10"};function k({className:a="",dialogClassName:b="",isOpen:c,onClose:l,hideTrigger:m=!1}){let n=(0,f.useId)(),[o,p]=(0,f.useState)("en"),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),u=(0,f.useRef)(null),v="boolean"==typeof c,w=v?c:s,x=(a,b=o)=>{v?!a&&l&&l(b):t(a)},y=async a=>{if(a!==o&&!q){r(!0);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,i.wn)(),p(a),x(!1,a)}catch(a){console.error("Failed to set locale:",a)}finally{r(!1)}}};return(0,d.jsxs)("div",{className:a,children:[!m&&(0,d.jsxs)("button",{onClick:()=>x(!w),disabled:q,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)(e.default,{className:"text-[20px]",children:"language"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:j(o).name}),(0,d.jsx)("span",{className:"text-lg",children:j(o).flag})]}),w&&(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>x(!1)}),(0,d.jsxs)("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":n,className:`relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh] ${b}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{id:n,className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,d.jsx)("button",{onClick:()=>x(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,d.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:h.YZ.map(a=>{let b=o===a,c=j(a);return(0,d.jsxs)("button",{onClick:()=>y(a),disabled:q,"aria-pressed":b,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${b?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${q?"opacity-70 cursor-wait":""}`,title:c.name,children:[(0,d.jsx)("span",{className:"text-2xl",children:c.flag}),(0,d.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:c.name}),b&&(0,d.jsx)(e.default,{className:"text-sm",children:"check"})]},a)})})})]})]}),document.body)]})}},3236:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(42118),i=c(11229),j=c(95145),k=c(21707);function l({icon:a,label:b,onClick:c,trailing:e,danger:f}){return(0,d.jsxs)("button",{type:"button",onClick:c,className:`dashboard-header__menu-item ${f?"is-danger":""}`,children:[(0,d.jsx)(k.default,{name:a,className:"text-[16px]"}),(0,d.jsx)("span",{className:"flex-1 text-left",children:b}),e&&(0,d.jsx)("span",{className:"text-base",children:e})]})}function m({onLogout:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),{toggleTheme:r,isDark:s}=(0,h.D)(),t=(0,e.useRef)(null),u=async()=>{q(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(a){}q(!1),o(!1)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"dashboard-header__menu relative",ref:t,children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(a=>!a),className:"dashboard-header__action",title:"Menu","aria-label":"Menu","aria-expanded":b,children:(0,d.jsx)(k.default,{name:"grid_view"})}),b&&(0,d.jsxs)("div",{className:"dashboard-header__dropdown absolute right-0 top-full mt-2 w-60 z-50 overflow-hidden p-1",children:[(0,d.jsx)(l,{icon:"history",label:"Change Log",onClick:()=>{c(!1),g(!0)}}),(0,d.jsx)(l,{icon:s?"light_mode":"dark_mode",label:"Theme",onClick:()=>{r(),c(!1)}}),(0,d.jsx)(l,{icon:"power_settings_new",label:"Shutdown",danger:!0,onClick:()=>{c(!1),o(!0)}}),(0,d.jsx)(l,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{c(!1),a()}})]})]}),(0,d.jsx)(i.default,{isOpen:f,onClose:()=>g(!1)}),(0,d.jsx)(j.ConfirmModal,{isOpen:n,onClose:()=>o(!1),onConfirm:u,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:p})]})}l.propTypes={icon:g().string.isRequired,label:g().string.isRequired,onClick:g().func.isRequired,trailing:g().node,danger:g().bool},m.propTypes={onLogout:g().func.isRequired}},4770:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(71404),f=c(67484),g=c(21707);function h({label:a,options:b=[],value:c,onChange:i,placeholder:j="Select an option",error:k,hint:l,disabled:m=!1,required:n=!1,className:o,selectClassName:p,id:q,...r}){let s=(0,f.useId)(),t=q||s,u=`${t}-message`;return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",o),children:[a&&(0,d.jsxs)("label",{htmlFor:t,className:"text-sm font-medium text-text-main",children:[a,n&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{id:t,"aria-invalid":!!k||void 0,"aria-describedby":k||l?u:void 0,value:c,onChange:i,disabled:m,className:(0,e.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",k&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...r,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:j}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)(g.default,{name:"expand_more",className:"text-[20px]"})})]}),k&&(0,d.jsxs)("p",{id:u,className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)(g.default,{name:"error",className:"text-[14px]"}),k]}),l&&!k&&(0,d.jsx)("p",{id:u,className:"text-xs text-text-muted",children:l})]})}},5291:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(8590),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(0,e.useCallback)((a,b)=>{"builder-id"===a?l("builder-id"):"idc"===a?(l("idc"),p(b)):"social"===a?(l("social"),n(b.provider)):("import"===a||"api-key"===a)&&c?.()},[c]),r=()=>{l(null),n(null),p(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{l(null),p(null),c?.(),f?.()},onClose:r,idcConfig:o}):"social"===g&&m?(0,d.jsx)(j.default,{isOpen:a,provider:m,onSuccess:()=>{l(null),n(null),c?.(),f?.()},onClose:r}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:q,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},8590:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);function j({isOpen:a,onMethodSelect:b,onClose:c}){let[g,h]=(0,f.useState)(null),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)("us-east-1"),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(""),[u,v]=(0,f.useState)("us-east-1"),[w,x]=(0,f.useState)(null),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(null),G=a=>{h(a),x(null)},H=()=>{h(null),x(null)},I=async()=>{if(!o.trim())return void x("Please enter a refresh token");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:o.trim(),...E||{}})}),c=await a.json();if(!a.ok)throw Error(c.error||"Import failed");b("import")}catch(a){x(a.message)}finally{z(!1)}},J=async()=>{if(!q.trim())return void x("Please paste CLIProxyAPI auth JSON");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/import-cli-proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({json:q.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"CLIProxyAPI import failed");b("import-cli-proxy")}catch(a){x(a.message)}finally{z(!1)}},K=async()=>{if(!s.trim())return void x("Please enter an API key");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s.trim(),region:u.trim()||"us-east-1"})}),c=await a.json();if(!a.ok)throw Error(c.error||"Import failed");b("api-key")}catch(a){x(a.message)}finally{z(!1)}},L=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:c,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!g&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("api-key"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"key"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"API Key"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Use a long-lived Kiro/CodeWhisperer API key (headless auth)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("import-cli-proxy"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"data_object"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Import CLIProxyAPI JSON"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Paste external_idp auth JSON from CLIProxyAPI/Kiro Microsoft login."})]})]})})]}),"idc"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:k,onChange:a=>l(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:m,onChange:a=>n(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),w&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{k.trim()?b("idc",{startUrl:k.trim(),region:m}):x("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"api-key"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste a long-lived Kiro/CodeWhisperer API key. It is validated against AWS and stored directly as a bearer credential (no refresh)."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["API Key ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:s,onChange:a=>t(a.target.value),placeholder:"Paste your Kiro API key...",className:"font-mono text-sm"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for the key (default: us-east-1)"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:K,fullWidth:!0,disabled:y||!s.trim(),children:y?"Validating...":"Add API Key"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>L("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>L("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[A&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!A&&(0,d.jsxs)(d.Fragment,{children:[C&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!C&&!w&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:o,onChange:a=>p(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:I,fullWidth:!0,disabled:y||!o.trim(),children:y?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"import-cli-proxy"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste the Kiro CLIProxyAPI auth JSON containing auth_method=external_idp. Only Microsoft login token endpoints are accepted."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["CLIProxyAPI Auth JSON ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:q,onChange:a=>r(a.target.value),placeholder:'{"auth_method":"external_idp","access_token":"...","refresh_token":"...","client_id":"...","token_endpoint":"https://login.microsoftonline.com/.../oauth2/v2.0/token","profile_arn":"...","scopes":"..."}',className:"min-h-40 w-full rounded-md border border-border bg-background p-3 font-mono text-sm outline-none focus:border-primary"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:J,fullWidth:!0,disabled:y||!q.trim(),children:y?"Importing...":"Import CLIProxyAPI JSON"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})})}j.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onClose:h().func.isRequired}},11229:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(74429),h=c(49885),i=c.n(h);function j({isOpen:a,onClose:b}){let[c,h]=(0,f.useState)(""),[i,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(""),n=(0,f.useRef)(null);return!a||"u"<typeof document?null:(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{ref:n,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,d.jsx)("button",{onClick:b,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"close"})})]}),(0,d.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,d.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,d.jsx)(e.default,{className:"animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),l&&(0,d.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",l]}),!i&&!l&&c&&(0,d.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:c}})]})]})]}),document.body)}c(12020),j.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},11633:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(21707),f=c(17660);let g={mode:{label:"Mode",format:a=>a},defaultModel:{label:"Model",format:a=>a,mono:!0},baseUrl:{label:"Endpoint",format:a=>a,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:a=>0===a?"Free":`$${a.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:a=>a},freeMonthlyQuota:{label:"Free quota",format:a=>0===a?"—":a>=999999?"Unlimited":`${a.toLocaleString()} / mo`},searchTypes:{label:"Types",format:a=>a.join(", ")},formats:{label:"Formats",format:a=>a.join(", ")},maxMaxResults:{label:"Max results",format:a=>a},maxCharacters:{label:"Max chars",format:a=>a.toLocaleString()}};function h({config:a,provider:b,title:c="Provider Info"}){if(!a)return null;let i=Object.entries(g).filter(([b])=>void 0!==a[b]&&null!==a[b]&&""!==a[b]).map(([b,c])=>({key:b,label:c.label,value:c.format(a[b]),isLink:c.isLink,mono:c.mono,raw:a[b]})),j=b?.notice?.apiKeyUrl||b?.website,k=b?.notice?.text;return(0,d.jsxs)(f.default,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:c}),j&&(0,d.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[i.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:a.label}),a.isLink?(0,d.jsx)("a",{href:a.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${a.mono?"font-mono":""}`,children:a.value}):(0,d.jsx)("span",{className:`text-sm text-text-main truncate ${a.mono?"font-mono":""}`,children:a.value})]},a.key)),k&&(0,d.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,d.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:k})]})]})]})}},20084:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(95145),h=c(99070),i=c(94541),j=c.n(i);function k({isOpen:a,onClose:b,onAdd:c,addedNames:i=[]}){let[l,m]=(0,f.useState)([]),[n,o]=(0,f.useState)(!1),[p,q]=(0,f.useState)(""),[r,s]=(0,f.useState)("all"),[t,u]=(0,f.useState)(null),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)({}),[z,A]=(0,f.useState)({}),[B,C]=(0,f.useState)({}),D=(0,f.useMemo)(()=>new Set(i),[i]),E=(0,f.useMemo)(()=>{let a=p.trim().toLowerCase();return l.filter(b=>("authless"!==r||!b.oauth)&&("oauth"!==r||!!b.oauth)&&(!a||(b.title||"").toLowerCase().includes(a)||(b.description||"").toLowerCase().includes(a)||(b.name||"").toLowerCase().includes(a)))},[l,p,r]),F=async a=>{if(!x[a.url]){A(b=>({...b,[a.url]:!0}));try{let b=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a.url})}),c=await b.json(),d=c.tools||[],e=Array.isArray(a.toolNames)?a.toolNames:[],f=d.length>0?d.map(a=>a.name):e;y(b=>({...b,[a.url]:{tools:d,requiresAuth:!!c.requiresAuth,error:c.error}})),C(b=>({...b,[a.url]:Object.fromEntries(f.map(a=>[a,!0]))}))}catch(b){y(c=>({...c,[a.url]:{tools:[],error:b.message}}))}finally{A(b=>({...b,[a.url]:!1}))}}},G=(a,b)=>{let c=B[a]||{};C(d=>({...d,[a]:Object.fromEntries(Object.keys(c).map(a=>[a,b]))}))};return(0,d.jsx)(g.default,{isOpen:a,onClose:b,title:"Browse MCP Marketplace",size:"lg",className:j().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:"Search by name or description...",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded text-xs border border-border"}),(0,d.jsxs)("select",{value:r,onChange:a=>s(a.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,d.jsx)("option",{value:"all",children:"All"}),(0,d.jsx)("option",{value:"authless",children:"Authless"}),(0,d.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),t&&(0,d.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:t}),n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,d.jsx)(e.default,{className:"animate-spin text-[18px]",children:"progress_activity"}),(0,d.jsx)("span",{children:"Loading registry..."})]}),!n&&(0,d.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===E.length&&(0,d.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),E.map(a=>{let b=D.has(a.slug||a.name),f=v===a.url,g=x[a.url],i=z[a.url],j=B[a.url]||{},k=Object.keys(j),l=Object.values(j).filter(Boolean).length;return(0,d.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[a.iconUrl?(0,d.jsx)("img",{src:a.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"}):(0,d.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,d.jsx)("span",{className:"font-medium text-xs",children:a.title}),a.oauth?(0,d.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,d.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),a.toolCount>0&&(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:[a.toolCount," tools"]})]}),a.description&&(0,d.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:a.description})]}),(0,d.jsx)(h.default,{variant:"secondary",size:"sm",onClick:()=>b?null:void(v===a.url?w(null):(w(a.url),F(a))),disabled:b,className:"shrink-0",children:b?"Added":f?"Cancel":"+ Add"})]}),f&&(0,d.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,d.jsx)(e.default,{className:"animate-spin text-[14px]",children:"progress_activity"}),(0,d.jsx)("span",{children:"Probing server for tools..."})]}),!i&&g?.requiresAuth&&(0,d.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!i&&g?.error&&!g?.requiresAuth&&(0,d.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",g.error]}),!i&&0===k.length&&!g?.requiresAuth&&!g?.error&&(0,d.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&k.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:[l,"/",k.length," tools enabled"]}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>G(a.url,!0),className:"text-[11px] text-text-muted hover:underline",children:"All"}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,d.jsx)("button",{onClick:()=>G(a.url,!1),className:"text-[11px] text-text-muted hover:underline",children:"None"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:k.map(b=>(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,d.jsx)("input",{type:"checkbox",checked:!!j[b],onChange:()=>{var c;return c=a.url,void C(a=>({...a,[c]:{...a[c],[b]:!a[c]?.[b]}}))},className:"size-3"}),(0,d.jsx)("span",{className:"truncate",children:b})]},b))})]}),(0,d.jsx)(h.default,{size:"sm",onClick:()=>{let b,d;return d=Object.keys(b=B[a.url]||{}).filter(a=>b[a]),void(c?.({name:a.slug||a.name,title:a.title,description:a.description,url:a.url,transport:a.transport,oauth:a.oauth,toolNames:d}),w(null))},className:"self-end",children:"✓ Confirm Add"})]})]},a.url)})]}),(0,d.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[E.length," of ",l.length," servers"]})]})})}},24622:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(99258);let k=[{id:"cn",flag:"\uD83C\uDDE8\uD83C\uDDF3",name:"China (Mainland)",host:"mimo-server-cn"},{id:"sgp",flag:"\uD83C\uDDF8\uD83C\uDDEC",name:"Singapore",host:"mimo-server-sgp"},{id:"ams",flag:"\uD83C\uDDEA\uD83C\uDDFA",name:"Europe \xb7 Amsterdam",host:"mimo-server-ams"},{id:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",name:"Russia",host:"mimo-server-ru"},{id:"in",flag:"\uD83C\uDDEE\uD83C\uDDF3",name:"India",host:"mimo-server-in"}];function l({isOpen:a,onSuccess:b,onClose:c}){let[g,h]=(0,f.useState)("detecting"),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)("cn"),E=(0,f.useRef)(null),F=()=>{E.current&&(clearInterval(E.current),E.current=null),x(!1)},G=async()=>{if(m?.apiKey){h("importing"),r(null);try{let a=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m.apiKey,uid:m.uid,baseUrl:m.baseUrl,mimoPassToken:m.mimoPassToken||null,mimoUserId:m.mimoUserId||null,mimoCUserId:m.mimoCUserId||null})}),d=await a.json();if(!a.ok||!d.success)throw Error(d.error||"Import failed");b?.(d.connection),c()}catch(a){h("found"),r(a.message)}}},H=async a=>{v(!0),z(null),t(!1),D(a);try{let d=await fetch("/api/oauth/xiaomi-mimo/login/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:a})}),e=await d.json();if(!d.ok||!e.pageUrl)throw Error(e.error||"Failed to start login");B(e.pageUrl),window.open(e.pageUrl,"mimo-session-login","width=500,height=760"),x(!0);let f=Date.now();E.current=setInterval(async()=>{if(Date.now()-f>84e4){F(),z("Login timed out. Please retry.");return}try{let a=await fetch(`/api/oauth/xiaomi-mimo/login/status?state=${e.state}`),d=await a.json();if("pending"===d.status)return;if(F(),"done"!==d.status)return void z(d.error||"Login session expired — please retry.");let f=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:"",uid:d.userId||null,mimoPassToken:d.passToken,mimoUserId:d.userId||null,mimoCUserId:d.cUserId||null,region:d.region||C})}),g=await f.json();if(!f.ok||!g.success)throw Error(g.error||"Failed to save credentials");b?.(g.connection),c()}catch(a){F(),z(a.message)}},2500)}catch(a){z(a.message)}finally{v(!1)}},I=()=>(0,d.jsxs)("div",{className:"bg-card p-3 rounded-lg border border-border flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(e.default,{className:"text-primary text-base",children:"login"}),(0,d.jsx)("span",{className:"text-xs sm:text-sm font-semibold",children:"Browser Login"}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"No Desktop required"})]}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"Weekly quota"})]}),w?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)(i.$n,{variant:"outline",size:"sm",fullWidth:!0,disabled:!0,children:"Waiting for login..."}),A&&(0,d.jsx)(i.$n,{onClick:()=>window.open(A,"mimo-session-login","width=500,height=760"),variant:"ghost",size:"sm",fullWidth:!0,children:"Reopen login window"})]}):(0,d.jsx)(i.$n,{onClick:()=>t(!0),variant:"outline",size:"sm",fullWidth:!0,disabled:u,children:u?"Starting...":"Choose cluster & sign in"}),y&&(0,d.jsx)("p",{className:"text-[11px] text-red-500",children:(0,j.Tl)(y)})]});return(0,d.jsx)(i.aF,{isOpen:a,title:(0,j.Tl)("Connect Xiaomi MiMo"),onClose:c,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3.5",children:["detecting"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading local MiMo Desktop credentials..."})]}),"importing"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("p",{className:"text-sm font-medium",children:"Connecting..."})]}),"found"===g&&m&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-muted px-0.5",children:[(0,d.jsx)(e.default,{className:"text-primary text-sm",children:"desktop_windows"}),(0,d.jsx)("span",{children:"Desktop Plan \xb7 Local credentials"})]}),o?(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400 text-lg mt-0.5",children:"check_circle"}),(0,d.jsxs)("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"This account is already connected (no need to import again)"}),(0,d.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",m.uid||"—"," \xb7 Status: ","active"===o.testStatus?"Active":"Untested"]})]})]})}):(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400 text-lg mt-0.5",children:"check_circle"}),(0,d.jsxs)("div",{className:"text-sm text-green-800 dark:text-green-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"Xiaomi MiMo Desktop credentials found!"}),(0,d.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",m.uid||"—"," \xb7 Source: ",m.source?.split(/[\\/]/).pop()]})]})]})}),q&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-2.5 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:(0,j.Tl)(q)})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:G,variant:o?"outline":"default",fullWidth:!0,children:o?"Re-sync local credentials":"Connect with local credentials"}),(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:o?"Close":"Cancel"})]}),(0,d.jsxs)("div",{className:"relative my-1",children:[(0,d.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,d.jsx)("div",{className:"w-full border-t border-border"})}),(0,d.jsx)("div",{className:"relative flex justify-center text-xs text-text-muted",children:(0,d.jsx)("span",{className:"bg-card px-2",children:"or"})})]}),I()]}),"not-found"===g&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400 text-lg mt-0.5",children:"info"}),(0,d.jsxs)("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"No local Desktop credentials found"}),(0,d.jsx)("p",{className:"text-xs mt-0.5 opacity-80",children:"You can still sign in via browser — no Desktop client needed."})]})]})}),I(),(0,d.jsx)("div",{className:"mt-1",children:(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})})]}),s&&(0,d.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-150",children:(0,d.jsxs)("div",{className:"relative w-full max-w-sm bg-surface border border-border-subtle rounded-[14px] shadow-2xl p-5 flex flex-col gap-3.5 animate-in zoom-in-95 duration-150",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.default,{className:"text-primary text-lg",children:"public"}),(0,d.jsx)("h3",{className:"text-sm font-semibold",children:"Select account cluster"})]}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!1),className:"text-text-muted hover:text-text-primary p-1 rounded-md transition-colors cursor-pointer",children:(0,d.jsx)(e.default,{className:"text-lg",children:"close"})})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Choose the region cluster of your Xiaomi account:"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:k.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>H(a.id),className:"p-3 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all text-left flex items-start gap-3 group cursor-pointer",children:[(0,d.jsx)("span",{className:"text-2xl mt-0.5",children:a.flag}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm font-semibold group-hover:text-primary transition-colors",children:a.name}),(0,d.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:a.host})]})]},a.id))}),(0,d.jsx)(i.$n,{onClick:()=>t(!1),variant:"ghost",size:"sm",fullWidth:!0,children:"Cancel"})]})})]})})}l.propTypes={isOpen:h().bool.isRequired,onSuccess:h().func,onClose:h().func.isRequired}},24656:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)("booting"),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(null),[u,v]=(0,f.useState)(!1),w=(0,f.useRef)(null),x=(0,f.useRef)({proxyStarted:!1,stopSent:!1});(0,f.useRef)(!1);let y=(0,f.useRef)(!1),z=(0,f.useRef)(a),A=(0,f.useRef)(c),B=(0,f.useRef)(g),{copied:C,copy:D}=(0,j.C)(),E=(0,f.useCallback)(()=>{let a=x.current;a.proxyStarted&&!a.stopSent&&(a.stopSent=!0,fetch("/api/oauth/zed/stop-proxy").catch(()=>{}))},[]),F=(0,f.useCallback)(()=>{l("success"),A.current?.(),setTimeout(()=>B.current?.(),600)},[]),G=(0,f.useCallback)(async a=>{if(a?.accessToken&&a?.userId){v(!0),t(null),l("importing");try{let b=await fetch("/api/oauth/zed/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:a.accessToken,userId:a.userId,...a.systemId?{systemId:a.systemId}:{}})}),c=await b.json();if(!b.ok)throw Error(c.error||"Import failed");E(),F()}catch(a){t(a.message),l("ide-found")}finally{v(!1)}}},[F,E]);(0,f.useCallback)(async()=>{t(null),p(null),r(""),x.current={proxyStarted:!1,stopSent:!1},y.current=!1;try{let a=await fetch("/api/oauth/zed/start-proxy"),b=await a.json();if(!a.ok||!b.success||!b.callbackUrl)throw Error(b.reason||b.error||"Failed to start Zed callback server");if(x.current.proxyStarted=!0,x.current.stopSent=!1,!z.current)return void E();let c=new URL("/api/oauth/zed/authorize",window.location.origin);c.searchParams.set("redirect_uri",b.callbackUrl);let d=await fetch(c),e=await d.json();if(!d.ok)throw E(),Error(e.error||"Failed to start Zed authorization");if(!z.current)return void E();let f={state:e.state};e.codeVerifier&&(f.codeVerifier=e.codeVerifier),e.systemId&&(f.systemId=e.systemId);let g=await fetch("/api/oauth/zed/register-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),h=null;try{h=await g.json()}catch{h=null}if(!g.ok||h?.success===!1)throw E(),Error(h?.error||"Failed to register Zed login session");if(!z.current)return;p(e),l(a=>"ide-found"===a||"importing"===a?a:"browser"),w.current=window.open(e.authUrl,"oauth_popup_zed","width=600,height=700")}catch(a){if(!z.current)return;t(a.message),l(a=>"ide-found"===a?a:"browser")}},[E]);let H=async()=>{let a=q.trim();if(a){v(!0),t(null);try{let b=await fetch("/api/oauth/zed/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:o?.state,...o?.redirectUri?{redirectUri:o.redirectUri}:{},...o?.codeVerifier?{codeVerifier:o.codeVerifier}:{},...o?.systemId?{systemId:o.systemId}:{}})}),c=await b.json();if(!b.ok)throw Error(c.error||"Exchange failed");y.current=!0,E(),F()}catch(a){t(a.message),l("error")}finally{v(!1)}}},I=()=>{y.current=!0,E(),g()},J=`Connect ${b?.name||"Zed"}`;return(0,d.jsx)(i.aF,{isOpen:a,title:J,onClose:I,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[("booting"===h||"importing"===h)&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"importing"===h?"Importing session from Zed IDE…":"Detecting Zed IDE session…"})]}),"ide-found"===h&&m&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsxs)("p",{className:"text-sm text-green-800 dark:text-green-200",children:["Zed IDE session detected (user ",m.userId,"). Import failed — retry or use browser sign-in below."]})]})}),(0,d.jsx)(i.$n,{onClick:()=>G(m),fullWidth:!0,disabled:u,children:u?"Importing…":"Import from Zed IDE"})]}),"success"===h&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800 text-sm text-green-800 dark:text-green-200",children:"Connected successfully."}),("browser"===h||"error"===h||"ide-found"===h)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:o?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===C?"check":"content_copy",onClick:()=>D(o?.authUrl,"auth_url"),disabled:!o?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser (or the local callback page)."}),(0,d.jsx)(i.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"http://127.0.0.1:.../?user_id=...&access_token=...",className:"font-mono text-xs"})]})]}),s&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:s})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:H,fullWidth:!0,disabled:u||!q.trim()||!o,children:u?"Connecting…":"Connect"}),(0,d.jsx)(i.$n,{onClick:I,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}k.propTypes={isOpen:h().bool.isRequired,providerInfo:h().object,onSuccess:h().func,onClose:h().func.isRequired}},25919:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:g="md",className:h}){let i={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],h),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),h),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},29225:(a,b,c)=>{"use strict";c.d(b,{HY:()=>g,Kw:()=>h});let d={"perplexity-agent":"perplexity","gitlab-duo":"gitlab","vercel-ai-gateway":"vercel","ollama-search":"ollama","minimax-code":"minimax","minimax-code-global":"minimax"},e=new Set;function f(a){return a&&"string"==typeof a?a.trim().toLowerCase():""}function g(a){let b=function(a){let b=f(a);if(!b||e.has(b))return"";let c=d[b]||b;return e.has(c)?"":c}(a);return b?`/providers/${b}.png`:null}function h(a){let b=f(a);b&&e.add(b);let c=d[b];c&&e.add(c)}},29370:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(74429);let h=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function j({isOpen:a,onClose:b}){return a?(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,d.jsx)(e.default,{className:"text-white text-base",children:"terminal"})}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,d.jsx)("button",{onClick:b,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)(e.default,{className:"text-base",children:"close"})})]}),(0,d.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,d.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,d.jsx)(e.default,{className:"text-white text-[30px]",children:"terminal"})}),(0,d.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,d.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,d.jsx)("div",{className:"flex gap-2 w-full",children:h.map(({icon:a,label:b,desc:c})=>(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,d.jsx)(e.default,{className:"text-primary text-[22px]",children:a}),(0,d.jsx)("p",{className:"text-xs font-semibold text-text-main",children:b}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:c})]},b))}),(0,d.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:a,text:b})=>(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(e.default,{className:"flex-shrink-0 text-primary text-[16px]",children:a}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:b})]},a))}),(0,d.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,d.jsx)(e.default,{className:"text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}function k(){let[a,b]=(0,f.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:()=>b(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:"computer"}),(0,d.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,d.jsx)(j,{isOpen:a,onClose:()=>b(!1)})]})}},29476:(a,b,c)=>{"use strict";c.d(b,{y:()=>g});var d=c(67484),e=c(70552),f=c(92592);function g(){let[a,b]=(0,d.useState)(()=>({})),[c,g]=(0,d.useState)(()=>({}));return{getCaps:(0,d.useCallback)(b=>(function(a,b,c){if(!c)return null;if(a[c])return a[c];let d=c.includes("/")?c.slice(c.indexOf("/")+1):c;if(b[d])return b[d];let g=c.includes("/")?c.slice(0,c.indexOf("/")):null,h=g?f.js[g]||g:null,i=(0,e.nl)(h,d);return{vision:i.vision,search:i.search,reasoning:i.reasoning,contextWindow:i.contextWindow,maxOutput:i.maxOutput}})(a,c,b),[a,c])}}},32456:(a,b,c)=>{"use strict";c.d(b,{default:()=>w});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(49885),j=c.n(i),k=c(72738),l=c(21707),m=c(3236),n=c(51126),o=c(99258),p=c(267);function q(){if("u"<typeof document)return"en";let a=document.cookie.split(";").find(a=>a.trim().startsWith(`${n.CL}=`)),b=a?decodeURIComponent(a.split("=")[1]):"en";return(0,n.QC)(b)}function r(){let[a,b]=(0,e.useState)(!1),c=(0,e.useRef)(null),f=(0,e.useSyncExternalStore)(o.oQ,q,()=>"en");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",ref:c,onClick:()=>b(!0),className:"dashboard-header__action",title:"Language","aria-label":`Language (${f})`,"data-i18n-skip":"true",children:(0,d.jsx)("span",{className:"dashboard-header__locale",children:f.split("-")[0].toUpperCase()})}),(0,d.jsx)(p.default,{hideTrigger:!0,isOpen:a,onClose:()=>b(!1)})]})}var s=c(37365),t=c(12020),u=c(92592),v=c(29225);function w({onMenuClick:a,showMenuButton:b=!0}){let c=(0,f.usePathname)(),[g,i]=(0,e.useState)(""),[j,n]=(0,e.useState)(""),{title:p,icon:q,breadcrumbs:s}=(0,e.useMemo)(()=>(a=>{if(!a)return{title:"",breadcrumbs:[]};let b=a.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(b){let a=b[1],c=b[2],d=u.rj.find(b=>b.id===a),e=u.Q2[c];return{title:e?.name||c,breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${a}`},{label:d?.label||a,href:`/dashboard/media-providers/${a}`},{label:e?.name||c,image:(0,v.HY)(c)}]}}let c=a.match(/\/media-providers\/([^/]+)$/);if(c){let a=c[1],b=u.rj.find(b=>b.id===a);return{title:b?.label||a,icon:b?.icon||"perm_media",breadcrumbs:[]}}let d=a.match(/\/providers\/([^/]+)$/);if(d){let a=d[1],b=t.zN[a]||t.fg[a];if(b)return{title:b.name,breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:b.name,image:(0,v.HY)(b.id)}]}}return a.includes("/providers")&&!a.includes("/media-providers")?{title:"Providers",icon:"dns",breadcrumbs:[]}:a.includes("/combos")?{title:"Combos",icon:"layers",breadcrumbs:[]}:a.includes("/health")?{title:"Model Health",icon:"monitoring",breadcrumbs:[]}:a.includes("/usage")?{title:"Usage & Analytics",icon:"bar_chart",breadcrumbs:[]}:a.includes("/auth-files")?{title:"Auth Files",icon:"vpn_key",breadcrumbs:[]}:a.includes("/quota")?{title:"Quota Tracker",icon:"data_usage",breadcrumbs:[]}:a.includes("/mitm")?{title:"MITM Proxy",icon:"security",breadcrumbs:[]}:a.includes("/token-saver")?{title:"Token Saver",icon:"savings",breadcrumbs:[]}:a.includes("/cli-tools")?{title:"CLI Tools",icon:"terminal",breadcrumbs:[]}:a.includes("/proxy-pools")?{title:"Proxy Pools",icon:"lan",breadcrumbs:[]}:a.includes("/skills")?{title:"Agent Skills",icon:"extension",breadcrumbs:[]}:a.includes("/endpoint")?{title:"Endpoint",icon:"api",breadcrumbs:[]}:a.includes("/profile")?{title:"Settings",icon:"settings",breadcrumbs:[]}:a.includes("/translator")?{title:"Translator",icon:"translate",breadcrumbs:[]}:a.includes("/console-log")?{title:"Console Log",icon:"monitor",breadcrumbs:[]}:"/dashboard"===a?{title:"Dashboard",icon:"layout-dashboard",breadcrumbs:[]}:{title:"",breadcrumbs:[]}})(c),[c]),y=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(a){console.error("Failed to logout:",a)}};return(0,d.jsxs)("header",{className:"dashboard-header shrink-0 flex items-center z-20",children:[b&&(0,d.jsx)("div",{className:"dashboard-header__navigation flex items-center shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:a,className:"dashboard-header__action",title:"Toggle sidebar (Ctrl+B)","aria-label":"Toggle sidebar",children:(0,d.jsx)(l.default,{name:"panel-left",className:"text-[18px]"})})}),(0,d.jsx)("div",{className:"dashboard-header__title flex flex-col min-w-0 flex-1",children:s.length>0?(0,d.jsx)("div",{className:"dashboard-header__breadcrumbs flex items-center gap-1.5 sm:gap-2 min-w-0",children:s.map((a,b)=>(0,d.jsxs)("div",{className:`items-center gap-1.5 sm:gap-2 min-w-0 ${b<s.length-1?"hidden sm:flex shrink-0":"flex flex-1"}`,children:[b>0&&(0,d.jsx)(l.default,{name:"chevron_right",className:"text-[var(--text-3)] text-base hidden sm:inline"}),a.href?(0,d.jsx)(h(),{href:a.href,className:"dashboard-header__crumb text-[13px] text-[var(--text-2)] hover:text-[var(--text)] transition-colors truncate",children:a.label}):(0,d.jsxs)("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[a.image&&(0,d.jsx)(k.A,{src:a.image,alt:a.label,size:28,className:"object-contain rounded-[var(--r1)] max-w-[24px] max-h-[24px] sm:max-w-[28px] sm:max-h-[28px] shrink-0",fallbackText:a.label.slice(0,2).toUpperCase()}),(0,d.jsx)("h1",{className:"dashboard-header__heading font-semibold text-[var(--text)] tracking-[-0.02em] leading-tight truncate",children:(0,o.Tl)(a.label)})]})]},`${a.label}-${a.href||"current"}`))}):p?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[q&&(0,d.jsx)(l.default,{name:q,className:"dashboard-header__page-icon"}),(0,d.jsx)("h1",{className:"dashboard-header__heading font-semibold text-[var(--text)] tracking-[-0.02em] leading-tight truncate",children:(0,o.Tl)(p)})]}):null}),(0,d.jsxs)("div",{className:"dashboard-header__actions flex items-center shrink-0",children:[g&&("OIDC"===j||"SAML"===j)&&(0,d.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-2.5 py-1 rounded-[var(--r-full)] border border-[var(--line-2)] bg-[var(--surface-2)] text-xs text-[var(--text-2)] truncate font-mono",title:g,children:[(0,d.jsx)(l.default,{name:"person",className:"text-[14px] mr-1.5 text-[var(--text)]"}),(0,d.jsx)("span",{className:"truncate",children:g}),(0,d.jsx)("span",{className:"ml-2 shrink-0 rounded-[var(--r-full)] bg-[var(--surface)] border border-[var(--line)] px-1.5 py-0.2 text-[10px] font-mono uppercase text-[var(--text-2)]",children:j})]}),(0,d.jsx)(x,{}),(0,d.jsx)(r,{}),(0,d.jsx)(m.default,{onLogout:y})]})]})}function x(){let a=(0,s.C)(a=>a.visible),b=(0,s.C)(a=>a.query),c=(0,s.C)(a=>a.placeholder),e=(0,s.C)(a=>a.setQuery);return a?(0,d.jsxs)("div",{className:"dashboard-header__search relative",children:[(0,d.jsx)(l.default,{name:"search",className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-3)] text-[16px] pointer-events-none"}),(0,d.jsx)("input",{type:"text",value:b,onChange:a=>e(a.target.value),placeholder:c,"aria-label":c,className:"w-full h-9 pl-7 pr-7 rounded-[var(--r1)] border border-[var(--line-2)] bg-[var(--surface-inset)] text-xs text-[var(--text)] placeholder-[var(--text-2)] focus:outline-none focus:border-[var(--accent-line)] transition-colors"}),b&&(0,d.jsx)("button",{type:"button",onClick:()=>e(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[var(--text-3)] hover:text-[var(--text)] p-0.5 rounded cursor-pointer","aria-label":"Clear search",children:(0,d.jsx)(l.default,{name:"close",className:"text-[16px]"})})]}):null}w.propTypes={onMenuClick:j().func,showMenuButton:j().bool}},32971:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(74429);function g({text:a,children:b,position:c="top",color:h}){let i=(0,e.useRef)(null),[j,k]=(0,e.useState)(null);return(0,d.jsxs)("div",{ref:i,className:"relative inline-flex",onMouseEnter:()=>{let a=i.current?.getBoundingClientRect();if(!a)return;let b=a.left+a.width/2,d=a.top+a.height/2;k({position:"fixed",..."bottom"===c?{top:a.bottom+6,left:b,transform:"translateX(-50%)"}:"left"===c?{right:window.innerWidth-a.left+6,top:d,transform:"translateY(-50%)"}:"right"===c?{left:a.right+6,top:d,transform:"translateY(-50%)"}:{bottom:window.innerHeight-a.top+6,left:b,transform:"translateX(-50%)"}})},onMouseLeave:()=>k(null),children:[b,j&&(0,f.createPortal)((0,d.jsx)("div",{className:`pointer-events-none z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug text-white whitespace-normal ${h?"":"bg-gray-900"}`,style:{...j,...h?{backgroundColor:h}:{}},children:a}),document.body)]})}},37365:(a,b,c)=>{"use strict";c.d(b,{C:()=>d});let d=(0,c(31417).v)(a=>({query:"",placeholder:"",visible:!1,setQuery:b=>a({query:b}),register:(b="Search...")=>a({visible:!0,placeholder:b,query:""}),unregister:()=>a({visible:!1,placeholder:"",query:""})}))},38930:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(91431),f=c(32971),g=c(21707);function h({caps:a,className:b="",colorOverride:c,size:i=16}){if(!a)return null;let j=Object.keys(e.bs).filter(b=>a[b]);return 0===j.length?null:(0,d.jsx)("span",{className:`inline-flex items-center gap-0.5 ${b}`,children:j.map(a=>(0,d.jsx)(f.default,{text:`${e.bs[a].label} — ${e.bs[a].desc}`,children:(0,d.jsx)(g.default,{name:e.bs[a].icon,size:i,className:`leading-none cursor-help ${c||e.bs[a].color}`})},a))})}},39645:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(95145),h=c(99070),i=c(50377);function j({isOpen:a,onClose:b,title:c="Manual Configuration",configs:k=[]}){let{copy:l}=(0,i.C)(),[m,n]=(0,f.useState)(null);return(0,d.jsx)(g.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:k.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(h.default,{variant:"ghost",size:"sm",onClick:()=>{var c;return c=a.content,void(l(c,`manualconfig-${b}`),n(b),setTimeout(()=>n(null),2e3))},children:[(0,d.jsx)(e.default,{className:"text-[14px] mr-1",children:m===b?"check":"content_copy"}),m===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},40560:a=>{a.exports={search:"ModelPickerList_search__VuMf4",searchIcon:"ModelPickerList_searchIcon__sqlnD",searchInput:"ModelPickerList_searchInput__DgrSf",scroll:"ModelPickerList_scroll__vZ0nD",group:"ModelPickerList_group__oe9L_",groupHead:"ModelPickerList_groupHead__p8Pfc",groupIcon:"ModelPickerList_groupIcon__Q1JIu",groupName:"ModelPickerList_groupName__O_PPt",groupCount:"ModelPickerList_groupCount__GpmFv",chips:"ModelPickerList_chips__w1jZO",chip:"ModelPickerList_chip__s_jlm",chipTag:"ModelPickerList_chipTag__RiI65",chipLabel:"ModelPickerList_chipLabel__vkF4o",chipCheck:"ModelPickerList_chipCheck__9dCWf",chipHint:"ModelPickerList_chipHint__5A0cj",empty:"ModelPickerList_empty__3LjZK",emptyIcon:"ModelPickerList_emptyIcon__aEoGe"}},41371:(a,b,c)=>{"use strict";c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{"use strict";c.d(b,{default:()=>y});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(92592),n=c(50377);c(91937);var o=c(99070),p=c(95145),q=c(84849),r=c(21707);let s=["embedding","image","video","tts","stt","systemone"],t="/dashboard/media-providers/web",u=[{href:"/dashboard",label:"Dashboard",icon:"layout-dashboard"},{href:"/dashboard/endpoint",label:"Endpoint & Key",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combo & Vision Adapter",icon:"layers"},{href:"/dashboard/playground",label:"Playground",icon:"science"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/health",label:"Health",icon:"monitoring"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],v=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],w=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}],x=a=>(0,k.cn)("dashboard-sidebar__item group",a&&"is-active");function y({onClose:a,onToggleCollapse:b}){let c=(0,j.usePathname)(),f=(0,e.useId)(),[g,h]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(0),[K,L]=(0,e.useState)(!1),{copied:M,copy:N}=(0,n.C)(2e3),O=l.h0.installCmdLatest,P=a=>"/dashboard"===a?"/dashboard"===c:"/dashboard/endpoint"===a?c.startsWith("/dashboard/endpoint"):c.startsWith(a),Q=async()=>{try{await navigator.clipboard.writeText(O)}catch{}N(O);let a=l.h0.shutdownCountdownSec;J(a);let b=setInterval(()=>{J(a-=1),a<=0&&(clearInterval(b),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),B(!0))},1e3)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"dashboard-sidebar flex w-60 flex-col h-full min-h-0",children:[(0,d.jsxs)("div",{className:"dashboard-sidebar__brand shrink-0",children:[(0,d.jsxs)(i(),{href:"/dashboard",onClick:a,className:"dashboard-sidebar__brand-link",children:[(0,d.jsx)(q.A,{size:32,className:"shrink-0"}),(0,d.jsxs)("div",{className:"flex flex-col min-w-0 gap-0.5",children:[(0,d.jsx)("span",{className:"text-[13px] font-semibold tracking-tight text-[var(--text)] truncate",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-[10px] font-mono text-[var(--text-2)] u-tnum",children:["v",l.vQ.version]})]})]}),C&&(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[var(--r1)] p-1.5 bg-[var(--surface-2)] border border-[var(--line)]",children:[(0,d.jsxs)("span",{className:"text-[10px] font-semibold text-[var(--pos)]",children:["↑ New version: v",C.latestVersion]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:()=>F(!0),className:"px-2 py-0.5 rounded-[var(--r1)] bg-[var(--pos)] text-black text-[10px] font-semibold transition-colors cursor-pointer",children:"Update"}),(0,d.jsx)("button",{onClick:()=>N(O),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,d.jsx)("code",{className:"block text-[9px] text-[var(--text-2)] font-mono truncate",children:M?"✓ copied!":O})})]})]})]}),(0,d.jsxs)("nav",{"aria-label":"Main navigation",className:"dashboard-sidebar__nav flex-1 min-h-0 overflow-y-auto no-scrollbar",children:[u.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"dashboard-sidebar__section",children:[(0,d.jsx)("p",{className:"dashboard-sidebar__section-title",children:"System"}),(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>!a),"aria-expanded":g,"aria-controls":f,className:x(c.startsWith("/dashboard/media-providers")),children:[(0,d.jsx)(r.default,{name:"perm_media",className:"text-[16px] text-[var(--text-3)] group-hover:text-[var(--text)]"}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium flex-1 text-left",children:"Media Providers"}),(0,d.jsx)(r.default,{name:"expand_more",className:"text-[14px] transition-transform text-[var(--text-3)]",style:{transform:g?"rotate(180deg)":"rotate(0deg)"}})]}),g&&(0,d.jsxs)("div",{id:f,className:"dashboard-sidebar__subnav",children:[m.rj.filter(a=>s.includes(a.id)).map(b=>(0,d.jsxs)(i(),{href:`/dashboard/media-providers/${b.id}`,onClick:a,"aria-current":c.startsWith(`/dashboard/media-providers/${b.id}`)?"page":void 0,className:x(c.startsWith(`/dashboard/media-providers/${b.id}`)),children:[(0,d.jsx)(r.default,{name:b.icon,className:"text-[15px] text-[var(--text-3)]"}),(0,d.jsx)("span",{className:"text-[12px]",children:b.label})]},b.id)),(0,d.jsxs)(i(),{href:t,onClick:a,"aria-current":c.startsWith(t)?"page":void 0,className:x(c.startsWith(t)),children:[(0,d.jsx)(r.default,{name:"travel_explore",className:"text-[15px] text-[var(--text-3)]"}),(0,d.jsx)("span",{className:"text-[12px]",children:"Web Fetch & Search"})]},"web")]}),w.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href)),v.map(b=>"/dashboard/translator"!==b.href||K?(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href):null),(0,d.jsxs)(i(),{href:"/dashboard/profile",onClick:a,"aria-current":P("/dashboard/profile")?"page":void 0,className:x(P("/dashboard/profile")),children:[(0,d.jsx)(r.default,{name:"settings",className:(0,k.cn)("text-[16px]",P("/dashboard/profile")?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:"Settings"})]})]})]})]}),(0,d.jsx)(p.ConfirmModal,{isOpen:E,onClose:()=>F(!1),onConfirm:()=>{F(!1),H(!0)},title:"Update 9Router",message:`Show install command for v${C?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(A||G)&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:G?(0,d.jsx)(z,{latestVersion:C?.latestVersion,installCmd:O,copied:M,onCopyAndShutdown:Q,onCancel:()=>{H(!1),J(0)},countdown:I,isDisconnected:A}):(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)(r.default,{name:"power_off",className:"text-[32px]"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(o.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function z({latestVersion:a,installCmd:b,copied:c,onCopyAndShutdown:e,onCancel:f,countdown:g,isDisconnected:h}){let i=g>0;return(0,d.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,d.jsx)(r.default,{name:"content_copy",className:"text-[24px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold",children:["Update 9Router",a?` to v${a}`:""]}),(0,d.jsx)("p",{className:"text-xs text-white/60",children:h?"Server stopped. Paste the command into a terminal to install.":i?`Command copied. Server will stop in ${g}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,d.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,d.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,d.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:b})}),(0,d.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,d.jsxs)("li",{children:["Click ",(0,d.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,d.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,d.jsxs)("li",{children:["Run ",(0,d.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"9router"})," again after install."]})]}),h?(0,d.jsx)(o.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(o.default,{variant:"secondary",onClick:f,disabled:i,children:"Cancel"}),(0,d.jsx)(o.default,{variant:"primary",fullWidth:!0,onClick:e,disabled:i,children:c?"✓ Copied — shutting down...":i?`Shutting down in ${g}s`:"Copy & Shutdown"})]})]})}y.propTypes={onClose:g().func},z.propTypes={latestVersion:g().string,installCmd:g().string.isRequired,copied:g().bool,onCopyAndShutdown:g().func.isRequired,onCancel:g().func.isRequired,countdown:g().number,isDisconnected:g().bool}},43182:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);let j="https://gitlab.com";function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(j),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(""),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(null),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(null),C=()=>{l(null),n(j),p(""),r(""),t(""),x(null),v(!1),z(!1),B(null),g()},D=async()=>{if(!s.trim())return void x("Personal Access Token is required");v(!0),x(null);try{let a=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s.trim(),baseUrl:m.trim()||j})}),b=await a.json();if(!a.ok)throw Error(b.error||"Authentication failed");c?.(),C()}catch(a){x(a.message)}finally{v(!1)}};return a?y&&A?(0,d.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:b,oauthMeta:A,onSuccess:()=>{c?.(),C()},onClose:()=>{z(!1),B(null)}}):(0,d.jsx)(i.aF,{isOpen:a,title:"Connect GitLab Duo",onClose:C,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("button",{onClick:()=>l("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,d.jsx)(e.default,{className:"text-2xl text-primary",children:"lock_open"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,d.jsxs)("button",{onClick:()=>l("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,d.jsx)(e.default,{className:"text-2xl text-primary",children:"key"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,d.jsx)("a",{href:`${m.trim()||j}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"http://localhost/callback"})]}),(0,d.jsx)(i.pd,{label:"GitLab Base URL",value:m,onChange:a=>n(a.target.value),placeholder:j}),(0,d.jsx)(i.pd,{label:"Client ID",value:o,onChange:a=>p(a.target.value),placeholder:"Your OAuth application client ID"}),(0,d.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:q,onChange:a=>r(a.target.value),placeholder:"Leave empty for public PKCE app"}),w&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{o.trim()?(x(null),B({baseUrl:m.trim()||j,clientId:o.trim(),clientSecret:q.trim()}),z(!0)):x("Client ID is required")},fullWidth:!0,disabled:!o.trim(),children:"Authorize"}),(0,d.jsx)(i.$n,{onClick:()=>{l(null),x(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,d.jsx)("a",{href:`${m.trim()||j}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,d.jsx)(i.pd,{label:"GitLab Base URL",value:m,onChange:a=>n(a.target.value),placeholder:j}),(0,d.jsx)(i.pd,{label:"Personal Access Token",value:s,onChange:a=>t(a.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),w&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:D,fullWidth:!0,disabled:!s.trim()||u,loading:u,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:()=>{l(null),x(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}k.propTypes={isOpen:h().bool.isRequired,providerInfo:h().shape({name:h().string}),onSuccess:h().func,onClose:h().func.isRequired}},48781:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020),h=c(84849);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],j=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],k=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function l(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)(h.A,{size:28}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:k.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(b);else{let a=document.createElement("textarea");a.value=b,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}})(),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{"use strict";c.d(b,{x0:()=>y.default,Ex:()=>j.default,$n:()=>d.default,nh:()=>D.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,CK:()=>o.default,uo:()=>h.ConfirmModal,G9:()=>s.default,wI:()=>x.default,vj:()=>w.default,vE:()=>v.default,pd:()=>e.default,Mh:()=>r.default,uR:()=>n.default,Nf:()=>p.default,aF:()=>h.default,rq:()=>m.default,gw:()=>z.default,LF:()=>l.default,Wx:()=>C.default,gM:()=>q.default,Iz:()=>A.default,l6:()=>f.default,EA:()=>i.Skeleton,lM:()=>k.default,m_:()=>B.default,LH:()=>u.default,TE:()=>t.default}),c(21707);var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514);c(53845),c(19308),c(42196),c(32456),c(48781);var l=c(79346),m=c(83352),n=c(39645),o=c(62727),p=c(20084);c(267),c(29370),c(3236),c(11229);var q=c(91809);c(8590);var r=c(5291);c(56110);var s=c(51109),t=c(24656),u=c(24622),v=c(79488),w=c(43182),x=c(51585),y=c(67738),z=c(50585),A=c(91099),B=c(32971),C=c(11633),D=c(38930);c(85306),c(53838)},50585:(a,b,c)=>{"use strict";c.d(b,{default:()=>n});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(17660),j=c(4770),k=c(75171);let l="__none__",m=[{value:"none",label:"None (single pool)"},{value:"round-robin",label:"Round-robin"},{value:"random",label:"Random"}];function n({providerId:a}){let[b,c]=(0,f.useState)([]),[g,h]=(0,f.useState)(l),[o,p]=(0,f.useState)("none"),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),u=(0,f.useCallback)(async(b,c)=>{r(!0);try{let d=await fetch("/api/settings",{cache:"no-store"}),e=(d.ok?await d.json():{}).providerStrategies||{},f={...e[a]||{}};b===l?delete f.proxyPoolId:f.proxyPoolId=b,"none"===c?delete f.rotateStrategy:f.rotateStrategy=c;let g={...e};0===Object.keys(f).length?delete g[a]:g[a]=f,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:g})}),t(!0),setTimeout(()=>t(!1),1500)}catch(a){console.log("Save proxy config error:",a)}finally{r(!1)}},[a]),v=b.length>=2,w="none"!==o;return(0,d.jsxs)(i.default,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"lock_open"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),s&&(0,d.jsx)(k.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,d.jsx)(j.default,{label:"Proxy Pool",value:g,onChange:a=>{var b;h(b=a.target.value),u(b,o)},disabled:q||w,options:[{value:l,label:"None (direct)"},...b.map(a=>({value:a.id,label:a.name}))],hint:w?"Pool selector is ignored when rotation is active — all active pools are used.":void 0}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,d.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,d.jsx)("select",{value:o,onChange:a=>{var b;p(b=a.target.value),u(g,b)},disabled:q,className:"py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all disabled:opacity-50",children:m.map(a=>(0,d.jsx)("option",{value:a.value,disabled:"none"!==a.value&&!v,children:a.label},a.value))}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:v?w?"round-robin"===o?`Rotating through all ${b.length} active pools in order. State is in-memory (resets on restart).`:`Picking a random pool from ${b.length} active pools each request.`:"Uses the selected pool above. Set to Round-robin or Random to rotate across all active pools.":"Need at least 2 active proxy pools for rotation."})]})]})}n.propTypes={providerId:h().string.isRequired}},51109:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);function j({isOpen:a,onSuccess:b,onClose:c}){let[g,h]=(0,f.useState)(""),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),w=async()=>{r(!0),n(null),t(!1),v(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(h(b.accessToken),l(b.machineId),t(!0)):b.windowsManual?v(!0):n(b.error||"Could not auto-detect tokens")}catch(a){n("Failed to auto-detect tokens")}finally{r(!1)}},x=async()=>{if(!g.trim())return void n("Please enter an access token");if(!k.trim())return void n("Please enter a machine ID");p(!0),n(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:g.trim(),machineId:k.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){n(a.message)}finally{p(!1)}};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[q&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!q&&(0,d.jsxs)(d.Fragment,{children:[s&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),u&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,d.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,d.jsx)(i.$n,{onClick:w,variant:"outline",fullWidth:!0,children:"Retry"})]}),!s&&!u&&!m&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:g,onChange:a=>h(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:k,onChange:a=>l(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:x,fullWidth:!0,disabled:o||!g.trim()||!k.trim(),children:o?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:h().bool.isRequired,onSuccess:h().func,onClose:h().func.isRequired}},51585:(a,b,c)=>{"use strict";c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(83552),j=c(99070),k=c(98153),l=c(92592),m=c(4770);function n({isOpen:a,connection:b,proxyPools:c,onSave:f,onClose:g}){let[o,p]=(0,e.useState)({name:"",priority:1,apiKey:""}),[q,r]=(0,e.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[s,t]=(0,e.useState)({accountId:""}),[u,v]=(0,e.useState)({profile:"",region:"",accessKeyId:"",sessionToken:""}),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(!1),K=b?.authType==="oauth",L=b?.provider==="azure",M=b?.provider==="cloudflare-ai",N=l.Q2?.[b?.provider]?.credentialForm==="aws",O=!!b&&((0,l.mq)(b.provider)||(0,l.gb)(b.provider)),P=b&&l.Q2?.[b.provider]?.regions||null,Q=()=>{if(P&&y)return{...b?.providerSpecificData||{},region:y}},R=()=>({profile:u.profile.trim(),region:u.region.trim(),accessKeyId:u.accessKeyId.trim(),sessionToken:w?null:u.sessionToken.trim()}),S=async()=>{if(b?.provider){B(!0),D(null);try{let a=await fetch(`/api/providers/${b.id}/test`,{method:"POST"}),c=await a.json();D(c.valid?"success":"failed")}catch{D("failed")}finally{B(!1)}}},T=async()=>{if(b?.provider&&o.apiKey){F(!0),H(null);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b.provider,apiKey:o.apiKey,...L?{providerSpecificData:q}:{},...M?{providerSpecificData:s}:{},...N?{providerSpecificData:R()}:{},...P?{providerSpecificData:Q()}:{}})}),c=await a.json();H(c.valid?"success":"failed")}catch{H("failed")}finally{F(!1)}}},U=async()=>{if(b){J(!0);try{let a={name:o.name,priority:o.priority};if(!K&&o.apiKey){a.apiKey=o.apiKey;let c="success"===G;if(!c)try{F(!0),H(null);let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b.provider,apiKey:o.apiKey,...L?{providerSpecificData:q}:{},...M?{providerSpecificData:s}:{},...N?{providerSpecificData:R()}:{},...P?{providerSpecificData:Q()}:{}})});c=!!(await a.json()).valid,H(c?"success":"failed")}catch{H("failed")}finally{F(!1)}c&&(a.testStatus="active",a.lastError=null,a.lastErrorAt=null)}L&&(a.providerSpecificData={azureEndpoint:q.azureEndpoint,apiVersion:q.apiVersion,deployment:q.deployment,organization:q.organization}),M&&(a.providerSpecificData={accountId:s.accountId}),N&&(a.providerSpecificData=R()),P&&y&&(a.providerSpecificData=Q()),await f(a)}finally{J(!1)}}};return b?(0,d.jsx)(h.default,{isOpen:a,title:"Edit Connection",onClose:g,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(i.default,{label:"Name",value:o.name,onChange:a=>p({...o,name:a.target.value}),placeholder:K?"Account name":"Production Key"}),K&&b.email&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,d.jsx)("p",{className:"font-medium",children:b.email})]}),(0,d.jsx)(i.default,{label:"Priority",type:"number",value:o.priority,onChange:a=>p({...o,priority:Number.parseInt(a.target.value,10)||1})}),!K&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.default,{label:"API Key",type:"password",value:o.apiKey,onChange:a=>p({...o,apiKey:a.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.default,{onClick:T,disabled:!o.apiKey||E||I,variant:"secondary",children:E?"Checking...":"Check"})})]}),G&&(0,d.jsx)(k.A,{variant:"success"===G?"success":"error",children:"success"===G?"Valid":"Invalid"})]}),L&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(i.default,{label:"Azure Endpoint",value:q.azureEndpoint,onChange:a=>r({...q,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,d.jsx)(i.default,{label:"Deployment Name",value:q.deployment,onChange:a=>r({...q,deployment:a.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,d.jsx)(i.default,{label:"API Version",value:q.apiVersion,onChange:a=>r({...q,apiVersion:a.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,d.jsx)(i.default,{label:"Organization",value:q.organization,onChange:a=>r({...q,organization:a.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),N&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(i.default,{label:"AWS Profile (SSO — recommended)",value:u.profile,onChange:a=>v({...u,profile:a.target.value}),placeholder:"my-sso-profile",hint:"Clear this to use static keys instead; a profile takes precedence."}),(0,d.jsx)(i.default,{label:"Region",value:u.region,onChange:a=>v({...u,region:a.target.value}),placeholder:"us-east-1"}),(0,d.jsx)(i.default,{label:"Access Key ID (only for static keys)",value:u.accessKeyId,onChange:a=>v({...u,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(i.default,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:u.sessionToken,onChange:a=>v({...u,sessionToken:a.target.value}),placeholder:"FwoGZXIvYXdz...",hint:"Leave blank to keep the saved token. Enter a new token to replace it.",disabled:w}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("input",{type:"checkbox",checked:w,onChange:a=>{x(a.target.checked),a.target.checked&&v({...u,sessionToken:""})}}),"Remove saved session token"]})]})]}),P&&(0,d.jsx)(m.default,{label:"Region",value:y,onChange:a=>z(a.target.value),options:P.map(a=>({value:a.id,label:a.label}))}),!O&&!L&&!M&&(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(j.default,{onClick:S,variant:"secondary",disabled:A,children:A?"Testing...":"Test Connection"}),C&&(0,d.jsx)(k.A,{variant:"success"===C?"success":"error",children:"success"===C?"Valid":"Failed"})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.default,{onClick:U,variant:"contrast",fullWidth:!0,disabled:I,children:I?"Saving...":"Save"}),(0,d.jsx)(j.default,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}n.propTypes={isOpen:g().bool.isRequired,connection:g().shape({id:g().string,name:g().string,email:g().string,priority:g().number,authType:g().string,provider:g().string,providerSpecificData:g().object}),proxyPools:g().arrayOf(g().shape({id:g().string,name:g().string})),onSave:g().func.isRequired,onClose:g().func.isRequired}},53838:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(42118),f=c(71404),g=c(60525),h=c(10090);function i({className:a,variant:b="default"}){let{isDark:c,toggleTheme:j}=(0,e.D)(),k={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,d.jsx)("button",{onClick:j,className:(0,f.cn)(k[b],a),"aria-label":`Switch to ${c?"light":"dark"} mode`,title:`Switch to ${c?"light":"dark"} mode`,children:c?(0,d.jsx)(g.A,{size:"1em",className:(0,f.cn)("text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12")}):(0,d.jsx)(h.A,{size:"1em",className:(0,f.cn)("text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12")})})}},56110:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);function k({isOpen:a,provider:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)("loading"),[m,n]=(0,f.useState)(""),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(null),{copied:u,copy:v}=(0,j.C)();(0,f.useRef)(!1);let w=async()=>{try{let a;t(null);try{a=new URL(q)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:o.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);l("success"),c?.()}catch(a){t(a.message),l("error")}},x="google"===b?"Google":"GitHub";return(0,d.jsx)(i.aF,{isOpen:a,title:`Connect Kiro via ${x}`,onClose:g,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",x," authentication"]})]}),"input"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===u?"check":"content_copy",onClick:()=>v(m,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(i.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!q,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",x," has been connected."]}),(0,d.jsx)(i.$n,{onClick:g,fullWidth:!0,children:"Done"})]}),"error"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:s}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>l("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(i.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}k.propTypes={isOpen:h().bool.isRequired,provider:h().oneOf(["google","github"]).isRequired,onSuccess:h().func,onClose:h().func.isRequired}},62727:(a,b,c)=>{"use strict";c.d(b,{default:()=>o});var d=c(48249),e=c(21707),f=c(94541),g=c.n(f),h=c(67484),i=c(95145),j=c(83552),k=c(99070),l=c(83352);let m=/^[a-zA-Z0-9_.\-]+$/;function n({index:a,model:b,isFirst:c,isLast:f,onEdit:g,onMoveUp:i,onMoveDown:j,onRemove:k}){let[l,m]=(0,h.useState)(!1),[o,p]=(0,h.useState)(b),q=()=>{let a=o.trim();a&&a!==b?g(a):p(b),m(!1)};return(0,d.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,d.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:a+1}),l?(0,d.jsx)("input",{autoFocus:!0,value:o,onChange:a=>p(a.target.value),onBlur:q,onKeyDown:a=>{"Enter"===a.key&&q(),"Escape"===a.key&&(p(b),m(!1))},className:"min-w-0 flex-1 rounded border border-[var(--line-2)] bg-[var(--surface-2)] px-1.5 py-0.5 font-mono text-xs text-text-main outline-none"}):(0,d.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:b}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:i,disabled:c,className:`p-0.5 rounded ${c?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"arrow_upward"})}),(0,d.jsx)("button",{onClick:j,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"arrow_downward"})})]}),(0,d.jsx)("button",{onClick:k,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"close"})})]})}function o({isOpen:a,combo:b,onClose:c,onSave:f,activeProviders:p,kindFilter:q=null,forcePrefix:r="",title:s}){let t=b?.name?r&&b.name.startsWith(r)?b.name.slice(r.length):b.name:"",[u,v]=(0,h.useState)(t),[w,x]=(0,h.useState)(b?.models||[]),[y,z]=(0,h.useState)(!1),[A,B]=(0,h.useState)(!1),[C,D]=(0,h.useState)(""),[E,F]=(0,h.useState)({}),G=a=>{if(!a.trim())return D("Name is required"),!1;let b=r+a;return m.test(b)?(D(""),!0):(D("Only letters, numbers, -, _ and . allowed"),!1)},H=a=>{let b=a.target.value;r&&b.startsWith(r)&&(b=b.slice(r.length)),v(b),b?G(b):D("")},I=async()=>{G(u)&&(B(!0),await f({name:r+u.trim(),models:w}),B(!1))},J=!!b;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.default,{isOpen:a,onClose:c,title:s||(J?"Edit Combo":"Create Combo"),className:g().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{children:[r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,d.jsxs)("div",{className:"flex items-stretch",children:[(0,d.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:r}),(0,d.jsx)("input",{value:u,onChange:H,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),C&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:C})]}):(0,d.jsx)(j.default,{label:"Combo Name",value:u,onChange:H,placeholder:"my-combo",error:C}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[r?`Auto-prefixed with "${r}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===w.length?(0,d.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,d.jsx)(e.default,{className:"text-text-muted text-xl mb-1",children:"layers"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,d.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:w.map((a,b)=>(0,d.jsx)(n,{index:b,model:a,isFirst:0===b,isLast:b===w.length-1,onEdit:a=>{let c=[...w];c[b]=a,x(c)},onMoveUp:()=>(a=>{if(0===a)return;let b=[...w];[b[a-1],b[a]]=[b[a],b[a-1]],x(b)})(b),onMoveDown:()=>(a=>{if(a===w.length-1)return;let b=[...w];[b[a],b[a+1]]=[b[a+1],b[a]],x(b)})(b),onRemove:()=>x(w.filter((a,c)=>c!==b))},b))}),(0,d.jsxs)(k.default,{onClick:()=>z(!0),variant:"outline",fullWidth:!0,size:"sm",className:"mt-2",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"add"}),"Add Model"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,d.jsx)(k.default,{onClick:c,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(k.default,{onClick:I,fullWidth:!0,size:"sm",disabled:!u.trim()||!!C||A,children:A?"Saving...":J?"Save":"Create"})]})]})}),y&&(0,d.jsx)(l.default,{className:g().modelPicker,isOpen:y,onClose:()=>z(!1),onSelect:a=>{w.includes(a.value)||x([...w,a.value])},onDeselect:a=>{x(w.filter(b=>b!==a.value))},onSelectBatch:a=>{let b=a.map(a=>a?.value||a?.name||a).filter(Boolean);x(a=>[...new Set([...a,...b])])},onDeselectBatch:a=>{let b=new Set(a.map(a=>a?.value||a?.name||a).filter(Boolean));x(a=>a.filter(a=>!b.has(a)))},activeProviders:p,modelAliases:E,title:"Add Model to Combo",kindFilter:q,addedModelValues:w,closeOnSelect:!1})]})}},66691:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(48249),e=c(21707),f=c(49885),g=c.n(f),h=c(72738),i=c(38930),j=c(29476),k=c(40560),l=c.n(k);function m({searchQuery:a,onSearchChange:b,combos:c,groups:f,selectedModel:g,addedModelValues:k=[],onSelect:n,showSearch:o=!0,autoFocusSearch:p=!1,groupLimit:q=0,emptyLabel:r="No models found"}){let{getCaps:s}=(0,j.y)(),t=Object.entries(f),u=q>0?t.slice(0,q):t,v=c.length>0||t.length>0;return(0,d.jsxs)(d.Fragment,{children:[o?(0,d.jsxs)("div",{className:l().search,children:[(0,d.jsx)(e.default,{className:l().searchIcon,children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search models, providers, combos","aria-label":"Search models",value:a,onChange:a=>b(a.target.value),className:l().searchInput,autoFocus:p})]}):null,(0,d.jsxs)("div",{className:l().scroll,"data-model-scroll":!0,children:[c.length>0?(0,d.jsxs)("div",{className:l().group,children:[(0,d.jsxs)("p",{className:l().groupHead,"data-model-group":!0,children:[(0,d.jsx)(e.default,{className:l().groupIcon,children:"layers"}),(0,d.jsx)("span",{className:l().groupName,children:"Combos"}),(0,d.jsx)("span",{className:l().groupCount,children:c.length})]}),(0,d.jsx)("div",{className:l().chips,children:c.map(a=>{let b=g===a.name;return(0,d.jsx)("button",{type:"button","data-model-option":!0,"aria-pressed":b||k.includes(a.name),onClick:()=>n({id:a.name,name:a.name,value:a.name},{providerId:"combo",name:"Combos",isCombo:!0}),className:l().chip,children:(0,d.jsx)("span",{className:l().chipLabel,children:a.name})},a.id||a.name)})})]}):null,u.map(([a,b])=>(0,d.jsxs)("div",{className:l().group,children:[(0,d.jsxs)("p",{className:l().groupHead,"data-model-group":!0,children:[(0,d.jsx)(h.A,{providerId:a,src:`/providers/${a}.png`,alt:b.name,size:14,fallbackText:(b.name||a).slice(0,2).toUpperCase(),fallbackColor:b.color}),(0,d.jsx)("span",{className:l().groupName,children:b.name}),(0,d.jsx)("span",{className:l().groupCount,children:b.models.length})]}),(0,d.jsx)("div",{className:l().chips,children:b.models.map(c=>{let f=g===c.value,h=k.includes(c.value);return(0,d.jsxs)("button",{type:"button","data-model-option":!0,"aria-pressed":f||h,title:c.isPlaceholder?"Select to pre-fill, then edit the model id":void 0,onClick:()=>n(c,{providerId:a,name:b.name,color:b.color}),className:l().chip,children:[h&&!c.isPlaceholder?(0,d.jsx)(e.default,{className:l().chipCheck,children:"check"}):null,c.isPlaceholder?(0,d.jsx)(e.default,{className:l().chipHint,children:"edit"}):null,(0,d.jsx)("span",{className:l().chipLabel,children:c.name}),c.isCustom?(0,d.jsx)("span",{className:l().chipTag,children:"custom"}):null,(0,d.jsx)(i.default,{caps:s(c.value)})]},c.value)})})]},a)),v?null:(0,d.jsxs)("div",{className:l().empty,children:[(0,d.jsx)(e.default,{className:l().emptyIcon,children:"search_off"}),(0,d.jsx)("p",{children:r})]})]})]})}m.propTypes={searchQuery:g().string,onSearchChange:g().func,combos:g().array,groups:g().object,selectedModel:g().string,addedModelValues:g().arrayOf(g().string),onSelect:g().func.isRequired,showSearch:g().bool,autoFocusSearch:g().bool,groupLimit:g().number,emptyLabel:g().string}},67738:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.openai.com/v1"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),w=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-embedding");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom embedding node:",a)}finally{n(!1)}}},x=async()=>{t(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-embedding",modelId:q.trim()||void 0})}),b=await a.json();v(b)}catch{v({valid:!1,error:"Network error"})}finally{t(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Embedding":"Add Custom Embedding",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value)}),(0,d.jsx)(h.pd,{label:"Model ID (for Check)",value:q,onChange:a=>r(a.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:x,disabled:!o||!q.trim()||s||!k.baseUrl.trim(),variant:"secondary",children:s?"Checking...":"Check"}),(()=>{if(!u)return null;let{valid:a,error:b,dimensions:c}=u;return a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Ex,{variant:"success",children:"Valid"}),c&&(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:[c," dims"]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},70552:(a,b,c)=>{"use strict";c.d(b,{Q5:()=>function a(b,c=null,d=null,e=0){if(!b?.length||e>6)return null;let f=b.map(b=>{if(!b.includes("/")&&c?.[b])return a(c[b],c,d,e+1)??d?.(b)??t(null,b);let f=b.indexOf("/"),g=t(-1===f?null:b.slice(0,f),-1===f?b:b.slice(f+1)),h=d?.(b);return h?{...g,...h}:g}),g=f[0];return{vision:f.some(a=>a.vision),pdf:f.some(a=>a.pdf),audioInput:f.some(a=>a.audioInput),videoInput:f.some(a=>a.videoInput),imageOutput:f.some(a=>a.imageOutput),audioOutput:f.some(a=>a.audioOutput),search:f.some(a=>a.search),tools:f.every(a=>a.tools),reasoning:g.reasoning,thinkingFormat:g.thinkingFormat,thinkingCanDisable:g.thinkingCanDisable,thinkingRange:g.thinkingRange,contextWindow:Math.min(...f.map(a=>a.contextWindow)),maxOutput:Math.max(...f.map(a=>a.maxOutput))}},nl:()=>t});var d=c(18982);let e="[-_/:.]",f=RegExp(`(^|${e})(image|img)(${e}|$)|stable-image|gen[0-9]_image|nanobanana|imagine|t2v|i2v|flux|dall|sdxl|diffusion|embed|rerank|guard|moderation|tts|stt|whisper|voice|speech|audio`,"i"),g=RegExp(`(^|${e})(vision|vl|vlm|multimodal|omni|visual)(${e}|$)|[0-9]\\.[0-9]+v(${e}|$)|(^|${e})glm-[0-9]+v(${e}|$)|(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)`,"i"),h={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},i={"claude-fable-5-1":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-high":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-medium":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-low":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.7":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-7":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-high":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-medium":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-low":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"gpt-image-1":{imageOutput:!0,tools:!1},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"vision-model":{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"coder-model":{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},k3:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-for-coding-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"muse-spark-1.2-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"union-alpha":{vision:!0,contextWindow:262144,maxOutput:131072},"space-bunny-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:524288},"space-bunny":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:524288},"big-pickle":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3},"exo-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"fledge-alpha-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"longcat-2.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"longcat-2.0-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"longcat-2.5-preview-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"north-mini-code-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3,maxOutput:64e3},"ring-2.6-1t-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:262e3,maxOutput:66e3},"x-preview-f-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072}},j={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},k={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:372e3,maxOutput:128e3},l={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},m={...l,contextWindow:872e3},n={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},o={nvidia:{"minimaxai/minimax-m2.7":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072},"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"z-ai/glm-5.2":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},"deepseek-ai/deepseek-v4-pro":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536},"deepseek-ai/deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},"opencode-go":{"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"claude-haiku-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},commandcode:{"claude-haiku-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},codex:{"gpt-6-astra":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-sol":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-luna":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-astra[1m]":m,"gpt-6-sol[1m]":m,"gpt-6-luna[1m]":m,"gpt-5.6-sol[1m]":m,"gpt-5.6-terra[1m]":m,"gpt-5.6-luna[1m]":m,"gpt-5.6-sol":k,"gpt-5.6-sol-review":k,"gpt-5.6-terra":l,"gpt-5.6-terra-review":l,"gpt-5.6-luna":l,"gpt-5.6-luna-review":l},kiro:{"gpt-5.6-sol":j,"gpt-5.6-terra":j,"gpt-5.6-luna":j,"gpt-5.6-sol-thinking":j,"gpt-5.6-terra-thinking":j,"gpt-5.6-luna-thinking":j,"gpt-5.6-sol-agentic":j,"gpt-5.6-terra-agentic":j,"gpt-5.6-luna-agentic":j,"gpt-5.6-sol-thinking-agentic":j,"gpt-5.6-terra-thinking-agentic":j,"gpt-5.6-luna-thinking-agentic":j},"devin-cli":{"gpt-5.4-high":n,"gpt-5.4-medium":n,"gpt-5.4-low":n,"gpt-5.5-xhigh":n,"gpt-5.5-high":n,"gpt-5.5-medium":n,"gpt-5.5-low":n},"codebuddy-cn":{"glm-5.2":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"glm-5.1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"glm-4.7":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:524288},"kimi-k2.5":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:164e3,maxOutput:32e3},"hy3-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3},hy3:{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"hy4-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:64e3},"glm-5.3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"glm-5.3-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"kimi-k3-1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:1048576},"kimi-k2.8-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:3e5,maxOutput:131072},"deepseek-v4-pro":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216}},poolside:{"laguna-s-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3},"laguna-xs-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},"minimax-code":{"MiniMax-M3.1-Flash-Preview":{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:128e3},"MiniMax-M3":{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",contextWindow:512e3,maxOutput:128e3},"MiniMax-M2.7":{reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:128e3},"MiniMax-M2.7-highspeed":{reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:128e3}},nous:{"meituan/longcat-2.0:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1048756,maxOutput:262144},"meituan/longcat-2.5-preview:free":{tools:!0,vision:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1048576,maxOutput:131072},"stepfun/step-5-preview:free":{tools:!0,vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1e6,maxOutput:64e3},"upstage/solar-mini4:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:524288,maxOutput:131072},"stepfun/step-3.7-flash:free":{tools:!0,vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:256e3},"poolside/laguna-s-2.1:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:131072},"poolside/laguna-xs-2.1:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:32768},"stealth/missingno":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:131072}}};o["qoder-cn"]=o.qoder,o.cx=o.codex,o.dv=o["devin-cli"],o.devin=o["devin-cli"],o["minimax-code-global"]=o["minimax-code"];let p=[{pattern:"*claude*opus-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*haiku-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*haiku-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*fable*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*mythos*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude-3*",caps:{vision:!0}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3*pro*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65535}},{pattern:"*gemini-3*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*nanobanana*",caps:{vision:!0,imageOutput:!0}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*image*",caps:{imageOutput:!0}},{pattern:"*gpt-5*codex*",caps:{reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-mini*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-nano*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*gpt-oss*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-3*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:131072}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*235b*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*for-coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144,maxOutput:262144}},{pattern:"*kimi*",caps:{reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*glm-5.3*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4.7*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*glm*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*deepseek-v4.*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*minimax*image*",caps:{imageOutput:!0}},{pattern:"*minimax-m3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",contextWindow:1e6,maxOutput:131072}},{pattern:"*minimax-m2.7*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax-m2.5*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax*",caps:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}},{pattern:"*command-a-vision*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*command*",caps:{contextWindow:128e3}},{pattern:"*sonar*",caps:{search:!0,contextWindow:128e3}},{pattern:"*pplx*",caps:{search:!0,contextWindow:128e3}},{pattern:"*perplexity*",caps:{search:!0,contextWindow:128e3}},{pattern:"*laguna-s-2.1*free*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*laguna-s-2.1*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3}},{pattern:"*laguna*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*muse*spark*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072}},{pattern:"*hunyuan*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"hy3*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"*step-*",caps:{reasoning:!0,thinkingFormat:"step",contextWindow:128e3}},{pattern:"*nemotron*",caps:{reasoning:!0,contextWindow:128e3}},{pattern:"*ling-*",caps:{reasoning:!0,contextWindow:128e3}}],q=["vision","pdf","audioInput","videoInput"];function r(a,b,c){let d={...h,...a},e="u"<typeof globalThis?null:globalThis.__9rCatalogSource||null;if(e){let a=e.getModalities(b,c);if(a)for(let b of q)!0===a[b]&&(d[b]=!0);let f=e.getLimits(b,c);f&&(f.contextWindow>0&&(d.contextWindow=f.contextWindow),f.maxOutput>0&&(d.maxOutput=f.maxOutput))}return!d.vision&&function(a){if(!a)return!1;let b=String(a).toLowerCase();return!f.test(b)&&g.test(b)}(c)&&(d.vision=!0),d}let s=new Set(["deepseek/deepseek-v4-pro","deepseek/deepseek-v4-flash","deepseek/deepseek-v4-flash-fast","zai-org/glm-5.3","zai-org/glm-5.2","zai-org/glm-5.2-fast","zai-org/glm-5.1","zai-org/glm-5","minimaxai/minimax-m2.7","minimax/minimax-m2.7-free","minimaxai/minimax-m2.5","xiaomi/mimo-v2.5-pro","qwen/qwen3.6-max-preview","qwen/qwen3.7-max","meituan/longcat-2.0:free","stepfun/step-3.5-flash","tencent/hy4-preview","tencent/hy3","tencent/hy3-paid","nvidia/nemotron-3-ultra-550b-a55b","poolside/laguna-s-2.1-free","inclusionai/ling-3.0-flash-free","inclusionai/ling-3.0-flash-sante:free"]);function t(a,b){var c=function(a,b){if(!b)return{...h};let c=b.includes("/")?b.split("/").pop():b;if("commandcode"===a||"cmc"===a){let a=o.commandcode;return a?.[b]?{...h,...a[b]}:a?.[c]?{...h,...a[c]}:{...h,reasoning:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,vision:!function(a){let b=String(a||"").toLowerCase();if(s.has(b))return!0;for(let a of s){let c=a.includes("/")?a.slice(a.lastIndexOf("/")+1):a;if(b===c||b.endsWith("/"+c))return!0}return!1}(b),contextWindow:1e6,maxOutput:384e3}}if(a){let d=o[a];if(d?.[b])return{...h,...d[b]};if(d?.[c])return{...h,...d[c]}}if(i[c])return r(i[c],a,b);if(i[b])return r(i[b],a,b);for(let{pattern:e,caps:f}of p)if((0,d.gH)(e,c)||(0,d.gH)(e,b))return r(f,a,b);return r(null,a,b)}(a,b);let e=("u"<typeof globalThis?null:globalThis.__9rLimitOverrideSource||null)?.getLimits(a,b);if(!e)return c;let f={...c};return e.contextWindow>0&&(f.contextWindow=e.contextWindow),e.maxOutput>0&&(f.maxOutput=e.maxOutput),f}},72738:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(29225);function i({src:a,providerId:b,alt:c,size:f=32,className:g="",fallbackText:j="?",fallbackColor:k}){let l=function(a,b){if(b)return(0,h.HY)(b);if(!a)return null;let c=String(a).match(/^\/providers\/([^/]+)\.png$/i);return c?(0,h.HY)(c[1]):a}(a,b),[m,n]=(0,e.useState)(!1);return!l||m?(0,d.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${g}`.trim(),style:{width:f,height:f,color:k,fontSize:Math.max(10,Math.floor(.38*f))},children:j}):(0,d.jsx)("img",{src:l,alt:c,width:f,height:f,className:g,loading:"lazy",decoding:"async",onError:()=>{let a=l.match(/^\/providers\/([^/]+)\.png$/i);a&&(0,h.Kw)(a[1]),b&&(0,h.Kw)(b),n(!0)}})}i.propTypes={src:g().string,providerId:g().string,alt:g().string,size:g().number,className:g().string,fallbackText:g().string,fallbackColor:g().string}},74812:(a,b,c)=>{"use strict";c.d(b,{CardSkeleton:()=>j,PageLoading:()=>h,Skeleton:()=>i,Spinner:()=>g,default:()=>k});var d=c(48249),e=c(71404),f=c(69357);function g({size:a="md",className:b}){return(0,d.jsx)(f.A,{className:(0,e.cn)("animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b)})}function h({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(g,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function i({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-[10px] bg-surface-2",a),...b})}function j(){return(0,d.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(i,{className:"h-4 w-24"}),(0,d.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,d.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(i,{className:"h-3 w-20"})]})}function k({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(h,{...b});case"skeleton":return(0,d.jsx)(i,{...b});case"card":return(0,d.jsx)(j,{...b});default:return(0,d.jsx)(g,{...b})}}},75171:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(71404),f=c(21707);let g={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},h={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:a,variant:b="default",size:c="md",dot:j=!1,icon:k,className:l}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",g[b],h[c],l),children:[j&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-brand-500","default"===b&&"bg-gray-500")}),k&&(0,d.jsx)(f.default,{name:k,className:"text-[14px]"}),a]})}},79346:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);let k=new Set(["trae","windsurf","zed"]),l={trae:{label:"Cloud-IDE-JWT",instructions:"Sign in at trae.ai (or solo.trae.ai), open DevTools → Network, copy the Cloud-IDE-JWT token from any request's Authorization header (~14-day lifetime).",placeholder:"Paste Cloud-IDE-JWT here...",ideName:"Trae",ideOptional:!0},windsurf:{label:"Windsurf API key",instructions:'In the Windsurf/VS Code IDE, run the "Windsurf: Provide Auth Token" command, then copy the displayed sk-ws-... key.',placeholder:"Paste sk-ws-... key here...",ideName:"Windsurf",ideOptional:!1}};function m({isOpen:a,provider:b,providerInfo:c,onSuccess:g,onClose:h,oauthMeta:n,idcConfig:o}){let[p,q]=(0,f.useState)("waiting"),[r,s]=(0,f.useState)(null),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(null),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)("browser"),[F,G]=(0,f.useState)(""),[H,I]=(0,f.useState)(null),J=(0,f.useRef)(null),K=(0,f.useRef)(!1);(0,f.useRef)(!1);let L=(0,f.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),M=(0,f.useRef)(g),N=(0,f.useRef)(h),O=(0,f.useRef)(a);(0,f.useRef)(null);let{copied:P,copy:Q}=(0,j.C)(),[R,S]=(0,f.useState)(!1),[T,U]=(0,f.useState)("/callback?code=...");(0,f.useRef)(!1);let V=(0,f.useCallback)(async(a,c)=>{if(r)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:r.redirectUri,codeVerifier:r.codeVerifier,state:c,...r.systemId?{systemId:r.systemId}:{},...n?{meta:n}:{}})}),e=await d.json();if(!d.ok)throw Error(e.error);q("success"),M.current?.()}catch(a){w(a.message),q("error")}},[r,b,n]),W=(0,f.useCallback)(async a=>{if(r?.state)try{let b=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:r.state})}),c=await b.json();if(!b.ok)throw Error(c.error);q("success"),M.current?.()}catch(a){w(a.message),q("error")}},[r]),X=(0,f.useCallback)(async(a,c,d,e,f)=>{K.current=!1,C(!0);let g=Date.now()+(Number.isFinite(f)&&f>0?f:12e4);for(;Date.now()<g;){if(K.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),K.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let f=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),g=await f.json();if(g.success){K.current=!0,q("success"),C(!1),M.current?.();return}if("expired_token"===g.error||"access_denied"===g.error||g.fatal)throw Error(g.errorDescription||g.error);"slow_down"===g.error&&(d=Math.min(d+5,30))}catch(a){w(a.message),q("error"),C(!1);return}}w("Authorization timeout"),q("error"),C(!1)},[b]),Y=(0,f.useCallback)(()=>{let a=L.current;a.proxyStarted&&!a.stopSent&&a.proxyProvider&&(a.stopSent=!0,fetch(`/api/oauth/${a.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),Z=(0,f.useCallback)(async a=>{let b=await fetch(`/api/oauth/${a}/start-proxy`),c=await b.json();if(!b.ok||!c.success||!c.callbackUrl)throw Error(c.reason||c.error||`Failed to start ${a} callback server`);if(L.current.proxyStarted=!0,L.current.proxyProvider=a,L.current.stopSent=!1,!O.current)return void Y();let d=new URL(`/api/oauth/${a}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",c.callbackUrl);let e=await fetch(d),f=await e.json();if(!e.ok)throw Y(),Error(f.error);if(!O.current)return void Y();let g={state:f.state};f.codeVerifier&&(g.codeVerifier=f.codeVerifier),f.systemId&&(g.systemId=f.systemId);let h=await fetch(`/api/oauth/${a}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),i=null;try{i=await h.json()}catch{i=null}if(!h.ok||i?.success===!1)throw Y(),Error(i?.error||"Failed to register login session; please retry");O.current&&(s({...f,proxyProvider:a}),q("waiting"),J.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),J.current||q("input"))},[Y]),$=async()=>{if(b)try{let a;if(w(null),k.has(b)&&"browser"===D)return void await Z(b);if(["github","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","codebuddy-intl","workbuddy","qoder","qoder-cn","grok-cli","muse","glm","minimax-code","minimax-code-global","nous"].includes(b)){y(!0),q("waiting");let a=new URL(`/api/oauth/${b}/device-code`,window.location.origin);"kiro"===b&&o?.startUrl&&(a.searchParams.set("start_url",o.startUrl),o.region&&a.searchParams.set("region",o.region),a.searchParams.set("auth_method","idc"));let c=await fetch(a.toString()),d=await c.json();if(!c.ok)throw Error(d.error);A(d);let e=d.verification_uri_complete||d.verification_uri;e&&window.open(e,"_blank","noopener,noreferrer");let f="kiro"===b?{_clientId:d._clientId,_clientSecret:d._clientSecret,_region:d._region,_authMethod:d._authMethod,_startUrl:d._startUrl}:"qoder"===b||"qoder-cn"===b?{_qoderNonce:d._qoderNonce,_qoderMachineId:d._qoderMachineId,_qoderVerifier:d.codeVerifier}:"kimi"===b||"kimi-coding"===b?{_kimiDeviceId:d._kimiDeviceId}:"glm"===b?{_zcodePollToken:d._zcodePollToken}:"minimax-code"===b||"minimax-code-global"===b?{_minimaxPollByUser:d._minimaxPollByUser}:null;X(d.device_code||d.user_code,d.codeVerifier,d.interval||5,f,Number.isFinite(d.expires_in)&&d.expires_in>0?1e3*d.expires_in:void 0);return}let c=window.location.port||("https:"===window.location.protocol?"443":"80");a="codex"===b?"http://localhost:1455/auth/callback":"xai"===b?"http://127.0.0.1:56121/callback":`http://localhost:${c}/callback`;let d=new URL(`/api/oauth/${b}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",a),n&&Object.entries(n).forEach(([a,b])=>{b&&d.searchParams.set(a,b)});let e=await fetch(d.toString()),f=await e.json();if(!e.ok)throw Error(f.error);let g=!1,h=!1;if("codex"===b)try{let b=new URL("/api/oauth/codex/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();g=e.success,h=!!e.serverSide}catch{g=!1}let i=!1,j=!1;if("xai"===b)try{let b=new URL("/api/oauth/xai/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();if(i=e.success,j=!!e.serverSide,!i&&"port_busy"===e.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(a){if(a?.message)throw a;i=!1}if(s({...f,redirectUri:a,codexServerSide:h,xaiServerSide:j}),("codex"===b&&g||"xai"===b&&i)&&(L.current.proxyStarted=!0,L.current.proxyProvider=b,L.current.stopSent=!1),!f.authUrl){if("device_code"===f.flowType)throw Error(`Provider ${b} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===b&&g||"xai"===b&&i||R&&"codex"!==b&&"xai"!==b?(q("waiting"),J.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),J.current||q("input")):(q("input"),window.open(f.authUrl,"_blank"))}catch(a){w(a.message),q("error")}},_=async()=>{try{if(w(null),"paste-token"===D&&l[b]){let a=F.trim();if(!a)throw Error("Missing token");let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a})}),d=await c.json();if(!c.ok)throw Error(d.error);q("success"),M.current?.();return}let a=t.trim();if(k.has(b)&&a){let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:r?.state,...r?.redirectUri?{redirectUri:r.redirectUri}:{},...r?.codeVerifier?{codeVerifier:r.codeVerifier}:{},...r?.systemId?{systemId:r.systemId}:{}})}),d=await c.json();if(!c.ok)throw Error(d.error);q("success"),M.current?.();return}if(a.startsWith("eyJ")&&a.includes("."))return void await V(a,null);if("xai"===b&&a&&!a.includes("://")&&!a.includes("?")&&!a.includes("code="))return void await W(a);if("kimchi"===b&&a&&!a.includes("://")&&!a.includes("?"))return void await V(a,null);let c=new URL(a),d=c.searchParams.get("code"),e=c.searchParams.get("token"),f=c.searchParams.get("state"),g=c.searchParams.get("error");if(g)throw Error(c.searchParams.get("error_description")||g);if(!d&&!e)throw Error("xai"===b?"Paste the callback URL or copied xAI code":"kimchi"===b?"No Kimchi token found in URL":"No authorization code found in URL");await V(e||d,f)}catch(a){w(a.message),q("error")}},aa=(0,f.useCallback)(()=>{Y(),N.current()},[Y]);if(!b||!c)return null;let ab="xai"===b,ac="kimchi"===b,ad=z?.verification_uri_complete||z?.verification_uri||"",ae=ab?"Connect Grok Build OAuth":`Connect ${c.name}`,af=ab?"http://127.0.0.1:56121/callback?code=... or copied code":ac?`${T.replace("code=...","token=...")} or copied token`:T;return(0,d.jsx)(i.aF,{isOpen:a,title:ae,onClose:aa,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[k.has(b)&&("waiting"===p||"input"===p||"error"===p)&&(0,d.jsxs)(d.Fragment,{children:[l[b]&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{E("browser"),w(null),q("waiting"),$()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===D?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,d.jsx)("button",{type:"button",onClick:()=>{E("paste-token"),w(null),q("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===D?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===D&&(0,d.jsxs)(d.Fragment,{children:["waiting"===p&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===p&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,d.jsx)(i.pd,{value:t,onChange:a=>u(a.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!t,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===D&&l[b]&&(0,d.jsxs)("div",{className:"space-y-3",children:[H&&!H.installed&&(0,d.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${l[b].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[l[b].ideName," IDE not detected.",l[b].ideOptional?" You can still grab the token from DevTools.":` Install ${l[b].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:l[b].instructions}),(0,d.jsx)(i.pd,{value:F,onChange:a=>G(a.target.value),placeholder:l[b].placeholder,className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!F,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===p||"input"===p)&&!x&&!k.has(b)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:ab?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",ab?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:r?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===P?"check":"content_copy",onClick:()=>Q(r?.authUrl,"auth_url"),disabled:!r?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===b?"callback URL or copied code":ac?"callback URL or copied token":"callback URL"," here"]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===b?"If xAI shows a code instead of redirecting, paste that code here.":ac?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,d.jsx)(i.pd,{value:t,onChange:a=>u(a.target.value),placeholder:af,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!t,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===p&&x&&z&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:ad}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===P?"check":"content_copy",onClick:()=>Q(ad,"login_url"),disabled:!ad}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(ad,"_blank","noopener,noreferrer"),disabled:!ad,children:"Open"})]})]}),z.user_code&&(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:z.user_code}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===P?"check":"content_copy",onClick:()=>Q(z.user_code,"user_code")})]})]})]}),B&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)(e.default,{className:"animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(i.$n,{onClick:aa,fullWidth:!0,children:"Done"})]}),"error"===p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:v}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:$,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}m.propTypes={isOpen:h().bool.isRequired,provider:h().string,providerInfo:h().shape({name:h().string}),onSuccess:h().func,onClose:h().func.isRequired,oauthMeta:h().object,idcConfig:h().shape({startUrl:h().string,region:h().string})}},79488:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(49885),g=c.n(f),h=c(95145),i=c(66691),j=c(88535);function k({isOpen:a,onClose:b,onSelect:c,onDeselect:f,selectedModel:g,activeProviders:l=[],title:m="Select Model",modelAliases:n={},kindFilter:o=null,capFilter:p=null,addedModelValues:q=[],closeOnSelect:r=!0,className:s="p-4!",portal:t=!1,notice:u="Click to add, click again to remove. Changes are saved automatically."}){let{visibleGroups:v,filteredCombos:w,searchQuery:x,setSearchQuery:y}=(0,j.c)({isOpen:a,activeProviders:l,modelAliases:n,kindFilter:o,capFilter:p,addedModelValues:q});return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),y("")},title:m,size:"md",className:s,portal:t,footer:null,children:[u?(0,d.jsxs)("div",{"data-model-notice":!0,className:"flex items-center gap-2 mb-3 px-2.5 py-2 bg-primary/8 border border-primary/20 rounded-lg text-xs text-text-muted",children:[(0,d.jsx)(e.default,{className:"text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,d.jsx)("span",{children:u})]}):null,(0,d.jsx)(i.A,{searchQuery:x,onSearchChange:y,combos:w,groups:v,selectedModel:g,addedModelValues:q,onSelect:(a,d)=>{let e=a?.value||a?.name||a,g=q.includes(e),h=d?{...a,providerId:d.providerId,providerName:d.name,providerColor:d.color,isCombo:!0===d.isCombo}:{...a};g&&f?f(h):c(h),r&&(b(),y(""))}})]})}k.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,capFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool,className:g().string,portal:g().bool,notice:g().string}},83552:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(71404),f=c(67484),g=c(21707);function h({label:a,type:b="text",placeholder:c,value:i,onChange:j,error:k,hint:l,icon:m,disabled:n=!1,required:o=!1,className:p,inputClassName:q,hintClassName:r,id:s,...t}){let u=(0,f.useId)(),v=s||u,w=`${v}-message`;return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",p),children:[a&&(0,d.jsxs)("label",{htmlFor:v,className:"text-xs font-mono text-[var(--text-2)] uppercase tracking-wider",children:[a,o&&(0,d.jsx)("span",{className:"text-[var(--danger)] ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[m&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--text-3)]",children:(0,d.jsx)(g.default,{name:m,className:"text-[18px]"})}),(0,d.jsx)("input",{id:v,"aria-invalid":!!k||void 0,"aria-describedby":k||l?w:void 0,type:b,placeholder:c,value:i,onChange:j,disabled:n,className:(0,e.cn)("w-full py-2 px-3 text-xs sm:text-sm text-[var(--text)] bg-[var(--surface-2)] rounded-[var(--r1)]","border border-[var(--line-2)] placeholder-[var(--text-3)]","focus:outline-none focus:border-[var(--accent-line)] focus:ring-1 focus:ring-[var(--accent-line)]","transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed","text-[16px] sm:text-sm",m&&"pl-9",k&&"border-[var(--danger)] focus:border-[var(--danger)] focus:ring-[var(--danger)]/30",q),...t})]}),k&&(0,d.jsxs)("p",{id:w,className:"text-xs text-[var(--danger)] flex items-center gap-1 font-mono",children:[(0,d.jsx)(g.default,{name:"error",className:"text-[14px]"}),k]}),l&&!k&&(0,d.jsx)("p",{id:w,className:(0,e.cn)("text-xs text-[var(--text-3)] font-mono",r),children:l})]})}},84849:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({size:a=36,className:b="",alt:c=""}){return(0,d.jsx)("img",{src:"/brand/jrouter.svg",alt:c,width:a,height:a,className:b,loading:"eager",decoding:"async"})}},85306:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(21707),f=c(67484),g=c(19099),h=c(41371),i=c(71404),j=c(42196),k=c(32456);let l=["/dashboard","/dashboard/endpoint","/dashboard/providers","/dashboard/combos","/dashboard/playground","/dashboard/usage","/dashboard/quota","/dashboard/token-saver","/dashboard/cli-tools","/dashboard/skills"];function m({children:a}){let[b,c]=(0,f.useState)(!1),[n,o]=(0,f.useState)(!1),p=(0,g.usePathname)(),q=(0,h.i)(a=>a.notifications),r=(0,h.i)(a=>a.removeNotification),s=(0,f.useCallback)(()=>{o(a=>{let b=!a;try{localStorage.setItem("9router_sidebar_collapsed",String(b))}catch{}return b})},[]),t="/dashboard/basic-chat"===p||"/dashboard/playground"===p,u=l.includes(p)||p.startsWith("/dashboard/cli-tools/");return(0,d.jsxs)("div",{className:`flex w-full overflow-hidden bg-bg ${"/dashboard/playground"===p?"h-dvh":"h-screen"}`,children:[(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:q.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--pos)]",icon:"check_circle"}:"error"===b?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--danger)]",icon:"error"}:"warning"===b?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--warn)]",icon:"warning"}:{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--text)]",icon:"info"};return(0,d.jsx)("div",{className:`rounded-[var(--r1)] border px-3 py-2.5 shadow-[var(--shadow-pop)] backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(e.default,{className:"text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5 text-[var(--text)]",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words text-[var(--text-2)]",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>r(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)(e.default,{className:"text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-xs lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:(0,i.cn)("hidden lg:flex transition-[width,opacity] duration-200 ease-in-out shrink-0 overflow-hidden",n?"w-0 opacity-0 pointer-events-none":"w-60 opacity-100"),children:(0,d.jsx)(j.default,{onToggleCollapse:s,isCollapsed:n})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(j.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-150 isolate bg-bg",children:[(0,d.jsx)(k.default,{onMenuClick:s,isSidebarCollapsed:n},p),(0,d.jsx)("div",{className:`flex-1 custom-scrollbar ${u?"dashboard-grid-bg":""} ${t?"flex flex-col min-h-0 overflow-hidden":"overflow-y-auto p-6 lg:p-8"}`,children:(0,d.jsx)("div",{className:t?"flex-1 min-h-0 w-full flex flex-col":"page",children:a})})]})]})}},88535:(a,b,c)=>{"use strict";c.d(b,{c:()=>p});var d=c(67484),e=c(92592),f=c(91431),g=c(29476);let h=[...Object.keys(e.zN),...Object.keys(e.IS),...Object.keys(e.nJ),...Object.keys(e.fg)],i=Object.keys(e.IS).filter(a=>e.IS[a].noAuth),j=["cursor","cline","clinepass","zed"],k=new Set(["webSearch","webFetch"]),l=new Set(["image","tts","stt","embedding","imageToText"]),m=new Set(["tts","image","webFetch"]),n=[];function o(a,b,c){let[e,f]=(0,d.useState)([]);return(a?(b??[]).join("|"):"")?e:n}function p({isOpen:a=!0,activeProviders:b=[],modelAliases:c={},kindFilter:n=null,capFilter:q=null,addedModelValues:r=[]}={}){let{getCaps:s}=(0,g.y)(),[t,u]=(0,d.useState)([]),[v,w]=(0,d.useState)([]),[x,y]=(0,d.useState)([]),[z,A]=(0,d.useState)({}),[B,C]=(0,d.useState)(""),D=(0,d.useMemo)(()=>n?b.filter(a=>{let b=e.Q2[a.provider];return(b?.serviceKinds||["llm"]).includes(n)}):b,[b,n]),E=(0,d.useMemo)(()=>{let a=Object.fromEntries(j.map(a=>[a,[]]));for(let c of b)c?.id&&Object.prototype.hasOwnProperty.call(a,c.provider)&&a[c.provider].push(c.id);return a},[b]),F=o(a,E.cursor,"Cursor"),G=o(a,E.cline,"Cline"),H=o(a,E.clinepass,"ClinePass"),I=o(a,E.zed,"Zed"),J=(0,d.useMemo)(()=>({...e.zN,...e.IS,...e.nJ,...e.fg}),[]),K=(0,d.useMemo)(()=>{let a={},d=[...new Set([...D.map(a=>a.provider),...n?i.filter(a=>(e.Q2[a]?.serviceKinds||["llm"]).includes(n)):i,...n?[]:x.map(a=>a.providerAlias).filter(a=>(0,e.mq)(a)||(0,e.gb)(a))])].sort((a,b)=>{let c=h.indexOf(a),d=h.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}),g=Object.entries(c).filter(([,a])=>"string"==typeof a&&a.length>0&&!a.startsWith("/")&&!a.includes("://"));return d.forEach(c=>{let d=(0,e.wG)(c),h=J[c]||{name:c,color:"#666"},i=(0,e.mq)(c)||(0,e.gb)(c);if(n&&k.has(n)){a[c]={name:h.name,alias:d,color:h.color,models:[{id:c,name:h.name,value:c}]};return}if(h.passthroughModels){let b=g.filter(([,a])=>a.startsWith(`${d}/`)).map(([a,b])=>({id:b.replace(`${d}/`,""),name:a,value:b})),e=x.filter(a=>a.providerAlias===d).map(a=>({id:a.id,name:a.name||a.id,value:`${d}/${a.id}`,kind:(0,f.CP)(a),isCustom:!0})),i=b;if(n&&l.has(n)){let a=e.filter(a=>(0,f.CP)(a)===n);0===(i=[...a,...(0,f.KC)(c).filter(a=>(0,f.CP)(a)===n).map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})).filter(b=>!a.some(a=>a.value===b.value))]).length&&m.has(n)&&(h.serviceKinds||["llm"]).includes(n)&&(i=[{id:c,name:h.name,value:d}])}else{let a=e.filter(a=>!(0,f.CP)(a)||"llm"===(0,f.CP)(a)),g=new Set([...b,...a].map(a=>a.value)),h=(0,f.KC)(c).filter(a=>!(0,f.CP)(a)||"llm"===(0,f.CP)(a)).map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})).filter(a=>!g.has(a.value));i=[...a,...b.filter(b=>!a.some(a=>a.value===b.value)),...h]}if(i.length>0){let b=v.find(a=>a.id===c);a[c]={name:b?.name||h.name,alias:d,color:h.color,models:i}}}else if(i){if(n&&l.has(n))return;let d=b.find(a=>a.provider===c),e=v.find(a=>a.id===c),f=e?.name||d?.name||h.name,i=d?.providerSpecificData?.prefix||e?.prefix||c,j=g.filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:`${i}/${b.replace(`${c}/`,"")}`})),k=x.filter(a=>a.providerAlias===c).map(a=>({id:a.id,name:a.name||a.id,value:`${i}/${a.id}`,isCustom:!0})),m=new Set(j.map(a=>a.value)),o=[...j,...k.filter(a=>!m.has(a.value))],p=o.length>0?o:[{id:`__placeholder__${c}`,name:`${i}/model-id`,value:`${i}/model-id`,isPlaceholder:!0}];a[c]={name:f,alias:i,color:h.color,models:p,isCustom:!0,hasModels:o.length>0}}else{var j;let b="cursor"===c?F:"cline"===c?G:"clinepass"===c?H:"zed"===c?I:[],e=b.length>0?b:(0,f.KC)(c),i=new Set(e.map(a=>a.id)),k=e.length>0,o=g.filter(([a,b])=>b.startsWith(`${d}/`)&&(!k||a===b.replace(`${d}/`,""))&&!i.has(b.replace(`${d}/`,""))).map(([a,b])=>({id:b.replace(`${d}/`,""),name:a,value:b,isCustom:!0})),p=new Set(o.map(a=>a.id)),q=x.filter(a=>a.providerAlias===d&&!i.has(a.id)&&!p.has(a.id)).map(a=>({id:a.id,name:a.name||a.id,value:`${d}/${a.id}`,isCustom:!0})),r=[...e.map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})),...o,...q],s=new Set,t=(j=r.filter(a=>!s.has(a.value)&&(s.add(a.value),!0)),n?l.has(n)?j.filter(a=>a.isPlaceholder||(0,f.CP)(a)===n):j:j.filter(a=>a.isPlaceholder||a.isCustom||!(0,f.CP)(a)||"llm"===(0,f.CP)(a)));0===t.length&&n&&m.has(n)&&(h.serviceKinds||["llm"]).includes(n)&&(t=[{id:c,name:h.name,value:d}]),t.length>0&&(a[c]={name:h.name,alias:d,color:h.color,models:t})}}),Object.entries(a).forEach(([b,c])=>{let d=new Set([...z[(0,e.wG)(b)]||[],...z[b]||[]]);0!==d.size&&(c.models=c.models.filter(a=>!d.has(a.id)),0===c.models.length&&delete a[b])}),a},[D,c,J,v,x,z,n,b,F,G,H,I]),L=(0,d.useMemo)(()=>{if(n||q)return[];if(!B.trim())return t;let a=B.toLowerCase();return t.filter(b=>b.name.toLowerCase().includes(a))},[t,B,n,q]),M=(0,d.useMemo)(()=>{let a=B.trim().toLowerCase(),b={};return Object.entries(K).forEach(([c,d])=>{let e=d.models;if(!q||0!==(e=e.filter(a=>s(a.value)?.[q]===!0)).length){var f,g;if(a){let b=d.name.toLowerCase().includes(a);if(0===(e=e.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a))).length&&!b)return}b[c]={...d,models:(f=e,g=r,g?.length?[...f.filter(a=>g.includes(a.value)).sort((a,b)=>a.name.localeCompare(b.name)),...f.filter(a=>!g.includes(a.value)).sort((a,b)=>a.name.localeCompare(b.name))]:[...f].sort((a,b)=>a.name.localeCompare(b.name)))}}}),b},[K,B,q,r,s]);return{groups:K,visibleGroups:M,filteredCombos:L,searchQuery:B,setSearchQuery:C,providerNodes:v,customModels:x}}},91099:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(21707);function g({options:a=[],value:b,onChange:c,size:h="md",className:i,"aria-label":j,...k}){let l={sm:"min-h-7 px-2.5 text-xs",md:"min-h-8 px-3 text-xs",lg:"min-h-10 px-4 text-sm"};return(0,d.jsx)("div",{role:"group","aria-label":j,className:(0,e.cn)("inline-flex max-w-full min-w-0 items-center gap-0.5 overflow-x-auto","rounded-[var(--r1)] bg-[var(--surface-2)] p-0.5",i),...k,children:a.map(a=>{let g=b===a.value;return(0,d.jsxs)("button",{type:"button","aria-pressed":g,title:a.title,onClick:()=>c(a.value),className:(0,e.cn)("inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[var(--r1)]","font-mono font-medium whitespace-nowrap transition-colors duration-150 cursor-pointer",l[h],g?"bg-[var(--surface)] text-[var(--text)] shadow-[var(--shadow-soft)]":"text-[var(--text-2)] hover:text-[var(--text)]"),children:[a.icon&&(0,d.jsx)(f.default,{name:a.icon,className:"text-[14px]"}),a.label]},a.value)})})}},91809:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(50412),h=c(98153);function i(a=""){let b=a.toUpperCase();return b.includes("OK")||b.includes("SUCCESS")?"success":b.includes("PARTIAL")||b.includes("WARN")?"warning":b.includes("FAIL")||b.includes("ERR")?"error":"default"}let j=[{value:"table",label:"Table",icon:"table_rows"},{value:"cards",label:"Cards",icon:"grid_view"}];function k(){let[a,b]=(0,f.useState)([]),[c,k]=(0,f.useState)(!0),[l,m]=(0,f.useState)(!0),[n,o]=(0,f.useState)("table");return(0,f.useCallback)(async()=>{try{let a=await fetch("/api/usage/request-logs");if(a.ok){let c=await a.json();b(c)}}catch(a){console.error("Failed to fetch logs:",a)}},[]),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.default,{className:"text-[18px] text-[var(--text-3)]",children:"list_alt"}),(0,d.jsx)("h2",{className:"text-base sm:text-lg font-semibold tracking-tight text-[var(--text)]",children:"Request Logs"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(g.Iz,{options:j,value:n,onChange:o,size:"sm","aria-label":"Log view"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs font-mono text-[var(--text-2)]",children:[(0,d.jsx)("span",{children:"Auto (3s)"}),(0,d.jsx)(g.lM,{size:"sm",checked:l,onChange:m,"aria-label":"Auto-refresh request logs"})]})]})]}),(0,d.jsx)("div",{className:"rounded-[var(--r3)] bg-[var(--surface)] border border-[var(--line)] shadow-[var(--shadow-card)] overflow-hidden",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-xs font-mono text-[var(--text-3)]",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-xs font-mono text-[var(--text-3)]",children:"No logs recorded yet."}):"cards"===n?(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 p-4",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6];return(0,d.jsxs)("div",{className:"flex flex-col justify-between p-3.5 rounded-[var(--r2)] bg-[var(--surface-2)]/60 border border-[var(--line)] shadow-xs font-mono text-xs",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,d.jsx)("span",{className:"text-[11px] text-[var(--text-3)]",children:c[0]}),(0,d.jsx)(h.A,{variant:i(e),dot:!1,children:e})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 mb-2",children:[(0,d.jsx)("span",{className:"font-semibold text-[var(--text)] truncate",title:c[1],children:c[1]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-[var(--text-3)]",children:[(0,d.jsx)("span",{className:"px-1.5 py-0.2 rounded-[var(--r1)] bg-[var(--surface)] border border-[var(--line)] uppercase",children:c[2]}),(0,d.jsx)("span",{className:"truncate",title:c[3],children:c[3]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-[var(--line)] text-[11px]",children:[(0,d.jsx)("span",{className:"text-[var(--text-3)]",children:"In / Out:"}),(0,d.jsxs)("span",{className:"u-tnum text-[var(--text)]",children:[(0,d.jsx)("span",{className:"text-[var(--text)]",children:c[4]})," ↑ ",(0,d.jsx)("span",{className:"text-[var(--pos)]",children:c[5]})," ↓"]})]})]},b)})}):(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-[var(--surface-2)] border-b border-[var(--line)] z-10 text-[var(--text-3)] text-[11px] uppercase tracking-[0.05em]",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)] text-right",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)] text-right",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-[var(--line)]/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6];return(0,d.jsxs)("tr",{className:"hover:bg-[var(--surface-hover)]/40 transition-colors",children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-[var(--text-3)]",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] font-medium text-[var(--text)]",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)]",children:(0,d.jsx)(h.A,{dot:!1,children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] truncate max-w-[150px] text-[var(--text-2)]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-right u-tnum text-[var(--text)]",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-right u-tnum text-[var(--pos)]",children:c[5]}),(0,d.jsx)("td",{className:"px-3 py-1.5",children:(0,d.jsx)(h.A,{variant:i(e),dot:!1,children:e})})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[11px] font-mono text-[var(--text-3)]",children:"Logs loaded from request history database."})]})}},91937:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(31417),e=c(12020);let f=null,g=(0,d.v)((a,b)=>({settings:null,loading:!1,error:null,lastFetched:0,invalidate:()=>a({lastFetched:0}),fetchSettings:async({force:c=!1}={})=>{let{lastFetched:d,settings:g}=b();return!c&&g&&Date.now()-d<e.U5?g:f||(a({loading:!0,error:null}),f=(async()=>{try{let b=await fetch("/api/settings"),c=await b.json();if(b.ok)return a({settings:c,loading:!1,lastFetched:Date.now()}),c;a({error:c.error,loading:!1})}catch(b){a({error:"Failed to fetch settings",loading:!1})}finally{f=null}return null})())},patchSettings:async c=>{try{let d=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)return null;let e=await d.json();return a({settings:{...b().settings,...e},lastFetched:Date.now()}),e}catch{return null}}}))},94541:a=>{a.exports={dialog:"DashboardControls_dialog__YyPS4",formScope:"DashboardControls_formScope__ID02o",fields:"DashboardControls_fields__IY485",iconButton:"DashboardControls_iconButton__v_EJw",modelPicker:"DashboardControls_modelPicker__BheYV DashboardControls_dialog__YyPS4"}},95145:(a,b,c)=>{"use strict";c.d(b,{ConfirmModal:()=>l,default:()=>k});var d=c(48249),e=c(67484),f=c(74429),g=c(71404),h=c(99070),i=c(32971),j=c(21707);function k({isOpen:a,onClose:b,title:c,children:f,footer:h,size:l="md",closeOnOverlay:m=!0,showTrafficLights:n=!0,className:o,trapFocus:p=!1}){let q=(0,e.useId)(),r=(0,e.useRef)(null);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/72 backdrop-blur-md fade-in",onClick:m?b:void 0}),(0,d.jsxs)("div",{ref:r,tabIndex:p?-1:void 0,role:"dialog","aria-modal":"true","aria-labelledby":c?q:void 0,className:(0,g.cn)("relative w-full bg-[var(--surface)]","border border-[var(--line-2)]","rounded-[var(--r4)] shadow-[var(--shadow-pop)]","fade-in text-[var(--text)]",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[l],o),children:[(c||n)&&(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[var(--line)]",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[n&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4",children:[(0,d.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-3 h-3 rounded-full bg-[#FF5F56]/80 hover:brightness-110 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[8px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]/50 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]/50 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{id:q,className:"text-sm sm:text-base font-semibold text-[var(--text)] tracking-tight",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1 rounded-[var(--r1)] text-[var(--text-3)] hover:bg-[var(--surface-2)] hover:text-[var(--text)] transition-colors cursor-pointer",children:(0,d.jsx)(j.default,{name:"close",className:"text-[18px]"})})]}),(0,d.jsx)("div",{className:"p-5 sm:p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:f}),h&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-2.5 px-5 py-3.5 border-t border-[var(--line)] bg-[var(--surface-2)]/30 rounded-b-[var(--r4)]",children:h})]})]}):null}function l({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:g,confirmText:i="Confirm",cancelText:j="Cancel",variant:m="danger",loading:n=!1,className:o,portal:p=!1}){let q=(0,d.jsx)(k,{isOpen:a,onClose:b,title:e,size:"sm",className:o,footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.default,{variant:"ghost",onClick:b,disabled:n,children:j}),(0,d.jsx)(h.default,{variant:m,onClick:c,loading:n,children:i})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:g})});return p&&"u">typeof document?(0,f.createPortal)(q,document.body):q}},95514:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j,...k}){let l={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",l[i].track,h&&"cursor-not-allowed"),...k,children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?l[i].translate:"translate-x-0.5",l[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},98153:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(48249),e=c(71404);let f={success:"badge-success",warning:"badge-warning",error:"badge-danger",default:"badge-neutral"};function g({children:a,variant:b="default",dot:c=!0,className:h}){return(0,d.jsxs)("span",{className:(0,e.cn)(f[b],h),children:[c&&(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-current","aria-hidden":"true"}),a]})}},99070:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(71404),f=c(21707);let g={primary:"bg-white hover:bg-[#EDEDEE] text-[#0A0A0B] border border-transparent shadow-xs disabled:opacity-40",contrast:"bg-[var(--text)] hover:bg-[var(--text-2)] text-[var(--bg)] border border-transparent shadow-none disabled:opacity-40",secondary:"bg-[var(--surface-2)] hover:bg-[var(--surface-hover)] text-[var(--text)] border border-[var(--line-2)] disabled:opacity-40",outline:"bg-transparent hover:bg-[var(--surface-2)] text-[var(--text)] border border-[var(--line-2)] hover:border-[var(--accent-line)]",ghost:"bg-transparent hover:bg-[var(--surface-2)] text-[var(--text-2)] hover:text-[var(--text)] border border-transparent",danger:"bg-[#281515] hover:bg-[#381a1a] text-[#FF6B6B] border border-[#FF6B6B]/30 disabled:opacity-40",success:"bg-[#14251D] hover:bg-[#1b3327] text-[#34D39A] border border-[#34D39A]/30 disabled:opacity-40"},h={xs:"h-6 px-2.5 text-[11px] rounded-[var(--r1)] font-medium gap-1.5",sm:"h-7 px-2.5 text-xs rounded-[var(--r1)] font-medium",md:"h-8.5 px-3.5 text-xs sm:text-[13px] rounded-[var(--r1)] font-medium",lg:"h-10 px-5 text-sm rounded-[var(--r1)] font-medium"};function i({children:a,variant:b="primary",size:c="md",icon:j,iconRight:k,disabled:l=!1,loading:m=!1,fullWidth:n=!1,className:o,...p}){return(0,d.jsxs)("button",{"data-variant":b,className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",g[b],h[c],n&&"w-full",o),disabled:l||m,...p,children:[m?(0,d.jsx)(f.default,{name:"progress_activity",className:(0,e.cn)("animate-spin","xs"===c?"text-[14px]":"text-[18px]")}):j?(0,d.jsx)(f.default,{name:j,className:"xs"===c?"text-[14px]":"text-[18px]"}):null,a,k&&!m&&(0,d.jsx)(f.default,{name:k,className:"xs"===c?"text-[14px]":"text-[18px]"})]})}}};
|
|
1
|
+
exports.id=412,exports.ids=[412],exports.modules={267:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(74429),h=c(51126),i=c(99258);let j=a=>({en:{name:"English",flag:"\uD83C\uDDFA\uD83C\uDDF8"},vi:{name:"Tiếng Việt",flag:"\uD83C\uDDFB\uD83C\uDDF3"},"zh-CN":{name:"简体中文",flag:"\uD83C\uDDE8\uD83C\uDDF3"},"zh-TW":{name:"繁體中文",flag:"\uD83C\uDDF9\uD83C\uDDFC"},ja:{name:"日本語",flag:"\uD83C\uDDEF\uD83C\uDDF5"},"pt-BR":{name:"Portugu\xeas (Brasil)",flag:"\uD83C\uDDE7\uD83C\uDDF7"},"pt-PT":{name:"Portugu\xeas (Portugal)",flag:"\uD83C\uDDF5\uD83C\uDDF9"},ko:{name:"한국어",flag:"\uD83C\uDDF0\uD83C\uDDF7"},es:{name:"Espa\xf1ol",flag:"\uD83C\uDDEA\uD83C\uDDF8"},de:{name:"Deutsch",flag:"\uD83C\uDDE9\uD83C\uDDEA"},fr:{name:"Fran\xe7ais",flag:"\uD83C\uDDEB\uD83C\uDDF7"},he:{name:"עברית",flag:"\uD83C\uDDEE\uD83C\uDDF1"},ar:{name:"العربية",flag:"\uD83C\uDDF8\uD83C\uDDE6"},ru:{name:"Русский",flag:"\uD83C\uDDF7\uD83C\uDDFA"},pl:{name:"Polski",flag:"\uD83C\uDDF5\uD83C\uDDF1"},cs:{name:"Čeština",flag:"\uD83C\uDDE8\uD83C\uDDFF"},nl:{name:"Nederlands",flag:"\uD83C\uDDF3\uD83C\uDDF1"},tr:{name:"T\xfcrk\xe7e",flag:"\uD83C\uDDF9\uD83C\uDDF7"},uk:{name:"Українська",flag:"\uD83C\uDDFA\uD83C\uDDE6"},tl:{name:"Tagalog",flag:"\uD83C\uDDF5\uD83C\uDDED"},id:{name:"Indonesia",flag:"\uD83C\uDDEE\uD83C\uDDE9"},th:{name:"ไทย",flag:"\uD83C\uDDF9\uD83C\uDDED"},km:{name:"ខ្មែរ",flag:"\uD83C\uDDF0\uD83C\uDDED"},hi:{name:"हिन्दी",flag:"\uD83C\uDDEE\uD83C\uDDF3"},bn:{name:"বাংলা",flag:"\uD83C\uDDE7\uD83C\uDDE9"},ur:{name:"اردو",flag:"\uD83C\uDDF5\uD83C\uDDF0"},ro:{name:"Rom\xe2nă",flag:"\uD83C\uDDF7\uD83C\uDDF4"},sv:{name:"Svenska",flag:"\uD83C\uDDF8\uD83C\uDDEA"},it:{name:"Italiano",flag:"\uD83C\uDDEE\uD83C\uDDF9"},el:{name:"Ελληνικά",flag:"\uD83C\uDDEC\uD83C\uDDF7"},hu:{name:"Magyar",flag:"\uD83C\uDDED\uD83C\uDDFA"},fi:{name:"Suomi",flag:"\uD83C\uDDEB\uD83C\uDDEE"},da:{name:"Dansk",flag:"\uD83C\uDDE9\uD83C\uDDF0"},no:{name:"Norsk",flag:"\uD83C\uDDF3\uD83C\uDDF4"},fa:{name:"فارسی",flag:"\uD83C\uDDEE\uD83C\uDDF7"}})[a]||{name:a,flag:"\uD83C\uDF10"};function k({className:a="",dialogClassName:b="",isOpen:c,onClose:l,hideTrigger:m=!1}){let n=(0,f.useId)(),[o,p]=(0,f.useState)("en"),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),u=(0,f.useRef)(null),v="boolean"==typeof c,w=v?c:s,x=(a,b=o)=>{v?!a&&l&&l(b):t(a)},y=async a=>{if(a!==o&&!q){r(!0);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:a})}),await (0,i.wn)(),p(a),x(!1,a)}catch(a){console.error("Failed to set locale:",a)}finally{r(!1)}}};return(0,d.jsxs)("div",{className:a,children:[!m&&(0,d.jsxs)("button",{onClick:()=>x(!w),disabled:q,className:"flex items-center gap-2 px-3 py-2 rounded-lg text-text-muted hover:text-text-main hover:bg-surface/60 transition-colors",title:"Language","data-i18n-skip":"true",children:[(0,d.jsx)(e.default,{className:"text-[20px]",children:"language"}),(0,d.jsx)("span",{className:"text-sm font-medium",children:j(o).name}),(0,d.jsx)("span",{className:"text-lg",children:j(o).flag})]}),w&&(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>x(!1)}),(0,d.jsxs)("div",{ref:u,role:"dialog","aria-modal":"true","aria-labelledby":n,className:`relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-2xl flex flex-col max-h-[80vh] ${b}`,children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{id:n,className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,d.jsx)("button",{onClick:()=>x(!1),className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"close"})})]}),(0,d.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,d.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:h.YZ.map(a=>{let b=o===a,c=j(a);return(0,d.jsxs)("button",{onClick:()=>y(a),disabled:q,"aria-pressed":b,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${b?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${q?"opacity-70 cursor-wait":""}`,title:c.name,children:[(0,d.jsx)("span",{className:"text-2xl",children:c.flag}),(0,d.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:c.name}),b&&(0,d.jsx)(e.default,{className:"text-sm",children:"check"})]},a)})})})]})]}),document.body)]})}},3236:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(42118),i=c(11229),j=c(95145),k=c(21707);function l({icon:a,label:b,onClick:c,trailing:e,danger:f}){return(0,d.jsxs)("button",{type:"button",onClick:c,className:`dashboard-header__menu-item ${f?"is-danger":""}`,children:[(0,d.jsx)(k.default,{name:a,className:"text-[16px]"}),(0,d.jsx)("span",{className:"flex-1 text-left",children:b}),e&&(0,d.jsx)("span",{className:"text-base",children:e})]})}function m({onLogout:a}){let[b,c]=(0,e.useState)(!1),[f,g]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),[p,q]=(0,e.useState)(!1),{toggleTheme:r,isDark:s}=(0,h.D)(),t=(0,e.useRef)(null),u=async()=>{q(!0);try{await fetch("/api/version/shutdown",{method:"POST"})}catch(a){}q(!1),o(!1)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"dashboard-header__menu relative",ref:t,children:[(0,d.jsx)("button",{type:"button",onClick:()=>c(a=>!a),className:"dashboard-header__action",title:"Menu","aria-label":"Menu","aria-expanded":b,children:(0,d.jsx)(k.default,{name:"grid_view"})}),b&&(0,d.jsxs)("div",{className:"dashboard-header__dropdown absolute right-0 top-full mt-2 w-60 z-50 overflow-hidden p-1",children:[(0,d.jsx)(l,{icon:"history",label:"Change Log",onClick:()=>{c(!1),g(!0)}}),(0,d.jsx)(l,{icon:s?"light_mode":"dark_mode",label:"Theme",onClick:()=>{r(),c(!1)}}),(0,d.jsx)(l,{icon:"power_settings_new",label:"Shutdown",danger:!0,onClick:()=>{c(!1),o(!0)}}),(0,d.jsx)(l,{icon:"logout",label:"Logout",danger:!0,onClick:()=>{c(!1),a()}})]})]}),(0,d.jsx)(i.default,{isOpen:f,onClose:()=>g(!1)}),(0,d.jsx)(j.ConfirmModal,{isOpen:n,onClose:()=>o(!1),onConfirm:u,title:"Close Proxy",message:"Are you sure you want to close the proxy server?",confirmText:"Close",cancelText:"Cancel",variant:"danger",loading:p})]})}l.propTypes={icon:g().string.isRequired,label:g().string.isRequired,onClick:g().func.isRequired,trailing:g().node,danger:g().bool},m.propTypes={onLogout:g().func.isRequired}},4770:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(71404),f=c(67484),g=c(21707);function h({label:a,options:b=[],value:c,onChange:i,placeholder:j="Select an option",error:k,hint:l,disabled:m=!1,required:n=!1,className:o,selectClassName:p,id:q,...r}){let s=(0,f.useId)(),t=q||s,u=`${t}-message`;return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",o),children:[a&&(0,d.jsxs)("label",{htmlFor:t,className:"text-sm font-medium text-text-main",children:[a,n&&(0,d.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[(0,d.jsxs)("select",{id:t,"aria-invalid":!!k||void 0,"aria-describedby":k||l?u:void 0,value:c,onChange:i,disabled:m,className:(0,e.cn)("w-full py-2.5 px-3 pr-10 text-sm text-text-main","bg-surface-2 border border-transparent rounded-[10px] appearance-none","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",k&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...r,children:[(0,d.jsx)("option",{value:"",disabled:!0,children:j}),b.map(a=>(0,d.jsx)("option",{value:a.value,children:a.label},a.value))]}),(0,d.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,d.jsx)(g.default,{name:"expand_more",className:"text-[20px]"})})]}),k&&(0,d.jsxs)("p",{id:u,className:"text-xs text-red-500 flex items-center gap-1",children:[(0,d.jsx)(g.default,{name:"error",className:"text-[14px]"}),k]}),l&&!k&&(0,d.jsx)("p",{id:u,className:"text-xs text-text-muted",children:l})]})}},5291:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(79346),i=c(8590),j=c(56110);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:f}){let[g,l]=(0,e.useState)(null),[m,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(null),q=(0,e.useCallback)((a,b)=>{"builder-id"===a?l("builder-id"):"idc"===a?(l("idc"),p(b)):"social"===a?(l("social"),n(b.provider)):("import"===a||"api-key"===a)&&c?.()},[c]),r=()=>{l(null),n(null),p(null)};return g?"builder-id"===g||"idc"===g?(0,d.jsx)(h.default,{isOpen:a,provider:"kiro",providerInfo:b,onSuccess:()=>{l(null),p(null),c?.(),f?.()},onClose:r,idcConfig:o}):"social"===g&&m?(0,d.jsx)(j.default,{isOpen:a,provider:m,onSuccess:()=>{l(null),n(null),c?.(),f?.()},onClose:r}):null:(0,d.jsx)(i.default,{isOpen:a,onMethodSelect:q,onClose:f})}k.propTypes={isOpen:g().bool.isRequired,providerInfo:g().shape({name:g().string}),onSuccess:g().func,onClose:g().func.isRequired}},8590:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);function j({isOpen:a,onMethodSelect:b,onClose:c}){let[g,h]=(0,f.useState)(null),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)("us-east-1"),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(""),[u,v]=(0,f.useState)("us-east-1"),[w,x]=(0,f.useState)(null),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(!1),[C,D]=(0,f.useState)(!1),[E,F]=(0,f.useState)(null),G=a=>{h(a),x(null)},H=()=>{h(null),x(null)},I=async()=>{if(!o.trim())return void x("Please enter a refresh token");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:o.trim(),...E||{}})}),c=await a.json();if(!a.ok)throw Error(c.error||"Import failed");b("import")}catch(a){x(a.message)}finally{z(!1)}},J=async()=>{if(!q.trim())return void x("Please paste CLIProxyAPI auth JSON");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/import-cli-proxy",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({json:q.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"CLIProxyAPI import failed");b("import-cli-proxy")}catch(a){x(a.message)}finally{z(!1)}},K=async()=>{if(!s.trim())return void x("Please enter an API key");z(!0),x(null);try{let a=await fetch("/api/oauth/kiro/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s.trim(),region:u.trim()||"us-east-1"})}),c=await a.json();if(!a.ok)throw Error(c.error||"Import failed");b("api-key")}catch(a){x(a.message)}finally{z(!1)}},L=a=>{b("social",{provider:a})};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Kiro",onClose:c,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!g&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Choose your authentication method:"}),(0,d.jsx)("button",{onClick:()=>b("builder-id"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"shield"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"AWS Builder ID"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Recommended for most users. Free AWS account required."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("idc"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"business"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"AWS IAM Identity Center"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"For enterprise users with custom AWS IAM Identity Center."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("api-key"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"key"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"API Key"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Use a long-lived Kiro/CodeWhisperer API key (headless auth)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("social-google"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"account_circle"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Google Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your Google account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("social-github"),className:"hidden w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"code"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"GitHub Account"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Login with your GitHub account (manual callback)."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("import"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"file_upload"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Import Token"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Paste refresh token from Kiro IDE."})]})]})}),(0,d.jsx)("button",{onClick:()=>G("import-cli-proxy"),className:"w-full p-4 text-left border border-border rounded-lg hover:bg-sidebar transition-colors",children:(0,d.jsxs)("div",{className:"flex items-start gap-3",children:[(0,d.jsx)(e.default,{className:"text-primary mt-0.5",children:"data_object"}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("h3",{className:"font-semibold mb-1",children:"Import CLIProxyAPI JSON"}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Paste external_idp auth JSON from CLIProxyAPI/Kiro Microsoft login."})]})]})})]}),"idc"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["IDC Start URL ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:k,onChange:a=>l(a.target.value),placeholder:"https://your-org.awsapps.com/start",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"Your organization's AWS IAM Identity Center URL"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:m,onChange:a=>n(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for your Identity Center (default: us-east-1)"})]}),w&&(0,d.jsx)("p",{className:"text-sm text-red-600",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{k.trim()?b("idc",{startUrl:k.trim(),region:m}):x("Please enter your IDC start URL")},fullWidth:!0,children:"Continue"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"api-key"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste a long-lived Kiro/CodeWhisperer API key. It is validated against AWS and stored directly as a bearer credential (no refresh)."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["API Key ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:s,onChange:a=>t(a.target.value),placeholder:"Paste your Kiro API key...",className:"font-mono text-sm"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"block text-sm font-medium mb-2",children:"AWS Region"}),(0,d.jsx)(i.pd,{value:u,onChange:a=>v(a.target.value),placeholder:"us-east-1",className:"font-mono text-sm"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mt-1",children:"AWS region for the key (default: us-east-1)"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:K,fullWidth:!0,disabled:y||!s.trim(),children:y?"Validating...":"Add API Key"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-google"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>L("google"),fullWidth:!0,children:"Continue with Google"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"social-github"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-4 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsxs)("div",{className:"flex-1 text-sm",children:[(0,d.jsx)("p",{className:"font-medium text-amber-900 dark:text-amber-100 mb-1",children:"Manual Callback Required"}),(0,d.jsx)("p",{className:"text-amber-800 dark:text-amber-200",children:"After login, you'll need to copy the callback URL from your browser and paste it back here."})]})]})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>L("github"),fullWidth:!0,children:"Continue with GitHub"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"import"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[A&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting token..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from AWS SSO cache"})]}),!A&&(0,d.jsxs)(d.Fragment,{children:[C&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Token auto-detected from Kiro IDE successfully!"})]})}),!C&&!w&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Kiro IDE not detected. Please paste your refresh token manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Refresh Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:o,onChange:a=>p(a.target.value),placeholder:"Token will be auto-filled...",className:"font-mono text-sm"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:I,fullWidth:!0,disabled:y||!o.trim(),children:y?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]}),"import-cli-proxy"===g&&(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Paste the Kiro CLIProxyAPI auth JSON containing auth_method=external_idp. Only Microsoft login token endpoints are accepted."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["CLIProxyAPI Auth JSON ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:q,onChange:a=>r(a.target.value),placeholder:'{"auth_method":"external_idp","access_token":"...","refresh_token":"...","client_id":"...","token_endpoint":"https://login.microsoftonline.com/.../oauth2/v2.0/token","profile_arn":"...","scopes":"..."}',className:"min-h-40 w-full rounded-md border border-border bg-background p-3 font-mono text-sm outline-none focus:border-primary"})]}),w&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:w})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:J,fullWidth:!0,disabled:y||!q.trim(),children:y?"Importing...":"Import CLIProxyAPI JSON"}),(0,d.jsx)(i.$n,{onClick:H,variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})})}j.propTypes={isOpen:h().bool.isRequired,onMethodSelect:h().func.isRequired,onClose:h().func.isRequired}},11229:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(74429),h=c(49885),i=c.n(h);function j({isOpen:a,onClose:b}){let[c,h]=(0,f.useState)(""),[i,k]=(0,f.useState)(!1),[l,m]=(0,f.useState)(""),n=(0,f.useRef)(null);return!a||"u"<typeof document?null:(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:b}),(0,d.jsxs)("div",{ref:n,className:"relative w-full bg-surface border border-black/10 dark:border-white/10 rounded-xl shadow-2xl animate-in fade-in zoom-in-95 duration-200 max-w-3xl flex flex-col max-h-[85vh]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Change Log"}),(0,d.jsx)("button",{onClick:b,className:"p-1.5 rounded-lg text-text-muted hover:bg-black/5 dark:hover:bg-white/5 transition-colors","aria-label":"Close",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"close"})})]}),(0,d.jsxs)("div",{className:"p-6 overflow-y-auto flex-1",children:[i&&(0,d.jsxs)("div",{className:"flex items-center justify-center py-10 text-text-muted",children:[(0,d.jsx)(e.default,{className:"animate-spin mr-2",children:"progress_activity"}),"Loading..."]}),l&&(0,d.jsxs)("div",{className:"text-red-500 py-4",children:["Failed to load changelog: ",l]}),!i&&!l&&c&&(0,d.jsx)("div",{className:"changelog-body text-text-main",dangerouslySetInnerHTML:{__html:c}})]})]})]}),document.body)}c(12020),j.propTypes={isOpen:i().bool.isRequired,onClose:i().func.isRequired}},11633:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(21707),f=c(17660);let g={mode:{label:"Mode",format:a=>a},defaultModel:{label:"Model",format:a=>a,mono:!0},baseUrl:{label:"Endpoint",format:a=>a,isLink:!0,mono:!0},costPerQuery:{label:"Cost / call",format:a=>0===a?"Free":`$${a.toFixed(4)}`},pricingUrl:{label:"Pricing",format:()=>"View pricing",isLink:!0},freeTier:{label:"Free tier",format:a=>a},freeMonthlyQuota:{label:"Free quota",format:a=>0===a?"—":a>=999999?"Unlimited":`${a.toLocaleString()} / mo`},searchTypes:{label:"Types",format:a=>a.join(", ")},formats:{label:"Formats",format:a=>a.join(", ")},maxMaxResults:{label:"Max results",format:a=>a},maxCharacters:{label:"Max chars",format:a=>a.toLocaleString()}};function h({config:a,provider:b,title:c="Provider Info"}){if(!a)return null;let i=Object.entries(g).filter(([b])=>void 0!==a[b]&&null!==a[b]&&""!==a[b]).map(([b,c])=>({key:b,label:c.label,value:c.format(a[b]),isLink:c.isLink,mono:c.mono,raw:a[b]})),j=b?.notice?.apiKeyUrl||b?.website,k=b?.notice?.text;return(0,d.jsxs)(f.default,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,d.jsx)("h2",{className:"text-lg font-semibold",children:c}),j&&(0,d.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,d.jsx)(e.default,{className:"text-sm",children:"open_in_new"}),"Get API Key"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2",children:[i.map(a=>(0,d.jsxs)("div",{className:"flex items-center gap-3 min-w-0",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0",children:a.label}),a.isLink?(0,d.jsx)("a",{href:a.raw,target:"_blank",rel:"noopener noreferrer",className:`text-sm text-primary hover:underline truncate ${a.mono?"font-mono":""}`,children:a.value}):(0,d.jsx)("span",{className:`text-sm text-text-main truncate ${a.mono?"font-mono":""}`,children:a.value})]},a.key)),k&&(0,d.jsxs)("div",{className:"flex items-start gap-3 min-w-0 sm:col-span-2",children:[(0,d.jsx)("span",{className:"text-xs text-text-muted w-28 shrink-0 mt-0.5",children:"Notice"}),(0,d.jsx)("span",{className:"text-sm text-text-main leading-relaxed",children:k})]})]})]})}},20084:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(95145),h=c(99070),i=c(94541),j=c.n(i);function k({isOpen:a,onClose:b,onAdd:c,addedNames:i=[]}){let[l,m]=(0,f.useState)([]),[n,o]=(0,f.useState)(!1),[p,q]=(0,f.useState)(""),[r,s]=(0,f.useState)("all"),[t,u]=(0,f.useState)(null),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)({}),[z,A]=(0,f.useState)({}),[B,C]=(0,f.useState)({}),D=(0,f.useMemo)(()=>new Set(i),[i]),E=(0,f.useMemo)(()=>{let a=p.trim().toLowerCase();return l.filter(b=>("authless"!==r||!b.oauth)&&("oauth"!==r||!!b.oauth)&&(!a||(b.title||"").toLowerCase().includes(a)||(b.description||"").toLowerCase().includes(a)||(b.name||"").toLowerCase().includes(a)))},[l,p,r]),F=async a=>{if(!x[a.url]){A(b=>({...b,[a.url]:!0}));try{let b=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:a.url})}),c=await b.json(),d=c.tools||[],e=Array.isArray(a.toolNames)?a.toolNames:[],f=d.length>0?d.map(a=>a.name):e;y(b=>({...b,[a.url]:{tools:d,requiresAuth:!!c.requiresAuth,error:c.error}})),C(b=>({...b,[a.url]:Object.fromEntries(f.map(a=>[a,!0]))}))}catch(b){y(c=>({...c,[a.url]:{tools:[],error:b.message}}))}finally{A(b=>({...b,[a.url]:!1}))}}},G=(a,b)=>{let c=B[a]||{};C(d=>({...d,[a]:Object.fromEntries(Object.keys(c).map(a=>[a,b]))}))};return(0,d.jsx)(g.default,{isOpen:a,onClose:b,title:"Browse MCP Marketplace",size:"lg",className:j().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{type:"text",value:p,onChange:a=>q(a.target.value),placeholder:"Search by name or description...",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded text-xs border border-border"}),(0,d.jsxs)("select",{value:r,onChange:a=>s(a.target.value),className:"px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:[(0,d.jsx)("option",{value:"all",children:"All"}),(0,d.jsx)("option",{value:"authless",children:"Authless"}),(0,d.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),t&&(0,d.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:t}),n&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,d.jsx)(e.default,{className:"animate-spin text-[18px]",children:"progress_activity"}),(0,d.jsx)("span",{children:"Loading registry..."})]}),!n&&(0,d.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===E.length&&(0,d.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),E.map(a=>{let b=D.has(a.slug||a.name),f=v===a.url,g=x[a.url],i=z[a.url],j=B[a.url]||{},k=Object.keys(j),l=Object.values(j).filter(Boolean).length;return(0,d.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,d.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[a.iconUrl?(0,d.jsx)("img",{src:a.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:a=>{a.target.style.display="none"},loading:"lazy",decoding:"async"}):(0,d.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,d.jsx)("span",{className:"font-medium text-xs",children:a.title}),a.oauth?(0,d.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,d.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),a.toolCount>0&&(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:[a.toolCount," tools"]})]}),a.description&&(0,d.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:a.description})]}),(0,d.jsx)(h.default,{variant:"secondary",size:"sm",onClick:()=>b?null:void(v===a.url?w(null):(w(a.url),F(a))),disabled:b,className:"shrink-0",children:b?"Added":f?"Cancel":"+ Add"})]}),f&&(0,d.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,d.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,d.jsx)(e.default,{className:"animate-spin text-[14px]",children:"progress_activity"}),(0,d.jsx)("span",{children:"Probing server for tools..."})]}),!i&&g?.requiresAuth&&(0,d.jsx)("p",{className:"text-[10px] text-amber-600 bg-amber-500/10 px-2 py-1 rounded",children:"\uD83D\uDD10 OAuth required. Add now and authenticate after Apply; tool list will be discovered after first connect."}),!i&&g?.error&&!g?.requiresAuth&&(0,d.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",g.error]}),!i&&0===k.length&&!g?.requiresAuth&&!g?.error&&(0,d.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&k.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("span",{className:"text-[10px] text-text-muted",children:[l,"/",k.length," tools enabled"]}),(0,d.jsxs)("div",{className:"flex gap-1",children:[(0,d.jsx)("button",{onClick:()=>G(a.url,!0),className:"text-[11px] text-text-muted hover:underline",children:"All"}),(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,d.jsx)("button",{onClick:()=>G(a.url,!1),className:"text-[11px] text-text-muted hover:underline",children:"None"})]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:k.map(b=>(0,d.jsxs)("label",{className:"flex items-center gap-1.5 text-[10px] cursor-pointer hover:bg-black/5 dark:hover:bg-white/5 px-1 rounded",children:[(0,d.jsx)("input",{type:"checkbox",checked:!!j[b],onChange:()=>{var c;return c=a.url,void C(a=>({...a,[c]:{...a[c],[b]:!a[c]?.[b]}}))},className:"size-3"}),(0,d.jsx)("span",{className:"truncate",children:b})]},b))})]}),(0,d.jsx)(h.default,{size:"sm",onClick:()=>{let b,d;return d=Object.keys(b=B[a.url]||{}).filter(a=>b[a]),void(c?.({name:a.slug||a.name,title:a.title,description:a.description,url:a.url,transport:a.transport,oauth:a.oauth,toolNames:d}),w(null))},className:"self-end",children:"✓ Confirm Add"})]})]},a.url)})]}),(0,d.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[E.length," of ",l.length," servers"]})]})})}},24622:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(99258);let k=[{id:"cn",flag:"\uD83C\uDDE8\uD83C\uDDF3",name:"China (Mainland)",host:"mimo-server-cn"},{id:"sgp",flag:"\uD83C\uDDF8\uD83C\uDDEC",name:"Singapore",host:"mimo-server-sgp"},{id:"ams",flag:"\uD83C\uDDEA\uD83C\uDDFA",name:"Europe \xb7 Amsterdam",host:"mimo-server-ams"},{id:"ru",flag:"\uD83C\uDDF7\uD83C\uDDFA",name:"Russia",host:"mimo-server-ru"},{id:"in",flag:"\uD83C\uDDEE\uD83C\uDDF3",name:"India",host:"mimo-server-in"}];function l({isOpen:a,onSuccess:b,onClose:c}){let[g,h]=(0,f.useState)("detecting"),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(null),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(!1),[y,z]=(0,f.useState)(null),[A,B]=(0,f.useState)(null),[C,D]=(0,f.useState)("cn"),E=(0,f.useRef)(null),F=()=>{E.current&&(clearInterval(E.current),E.current=null),x(!1)},G=async()=>{if(m?.apiKey){h("importing"),r(null);try{let a=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:m.apiKey,uid:m.uid,baseUrl:m.baseUrl,mimoPassToken:m.mimoPassToken||null,mimoUserId:m.mimoUserId||null,mimoCUserId:m.mimoCUserId||null})}),d=await a.json();if(!a.ok||!d.success)throw Error(d.error||"Import failed");b?.(d.connection),c()}catch(a){h("found"),r(a.message)}}},H=async a=>{v(!0),z(null),t(!1),D(a);try{let d=await fetch("/api/oauth/xiaomi-mimo/login/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({region:a})}),e=await d.json();if(!d.ok||!e.pageUrl)throw Error(e.error||"Failed to start login");B(e.pageUrl),window.open(e.pageUrl,"mimo-session-login","width=500,height=760"),x(!0);let f=Date.now();E.current=setInterval(async()=>{if(Date.now()-f>84e4){F(),z("Login timed out. Please retry.");return}try{let a=await fetch(`/api/oauth/xiaomi-mimo/login/status?state=${e.state}`),d=await a.json();if("pending"===d.status)return;if(F(),"done"!==d.status)return void z(d.error||"Login session expired — please retry.");let f=await fetch("/api/oauth/xiaomi-mimo/api-key",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:"",uid:d.userId||null,mimoPassToken:d.passToken,mimoUserId:d.userId||null,mimoCUserId:d.cUserId||null,region:d.region||C})}),g=await f.json();if(!f.ok||!g.success)throw Error(g.error||"Failed to save credentials");b?.(g.connection),c()}catch(a){F(),z(a.message)}},2500)}catch(a){z(a.message)}finally{v(!1)}},I=()=>(0,d.jsxs)("div",{className:"bg-card p-3 rounded-lg border border-border flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)(e.default,{className:"text-primary text-base",children:"login"}),(0,d.jsx)("span",{className:"text-xs sm:text-sm font-semibold",children:"Browser Login"}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"No Desktop required"})]}),(0,d.jsx)("span",{className:"text-[11px] text-text-muted",children:"Weekly quota"})]}),w?(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)(i.$n,{variant:"outline",size:"sm",fullWidth:!0,disabled:!0,children:"Waiting for login..."}),A&&(0,d.jsx)(i.$n,{onClick:()=>window.open(A,"mimo-session-login","width=500,height=760"),variant:"ghost",size:"sm",fullWidth:!0,children:"Reopen login window"})]}):(0,d.jsx)(i.$n,{onClick:()=>t(!0),variant:"outline",size:"sm",fullWidth:!0,disabled:u,children:u?"Starting...":"Choose cluster & sign in"}),y&&(0,d.jsx)("p",{className:"text-[11px] text-red-500",children:(0,j.Tl)(y)})]});return(0,d.jsx)(i.aF,{isOpen:a,title:(0,j.Tl)("Connect Xiaomi MiMo"),onClose:c,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-3.5",children:["detecting"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading local MiMo Desktop credentials..."})]}),"importing"===g&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-12 mx-auto mb-3 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-2xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("p",{className:"text-sm font-medium",children:"Connecting..."})]}),"found"===g&&m&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-muted px-0.5",children:[(0,d.jsx)(e.default,{className:"text-primary text-sm",children:"desktop_windows"}),(0,d.jsx)("span",{children:"Desktop Plan \xb7 Local credentials"})]}),o?(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400 text-lg mt-0.5",children:"check_circle"}),(0,d.jsxs)("div",{className:"text-sm text-blue-800 dark:text-blue-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"This account is already connected (no need to import again)"}),(0,d.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",m.uid||"—"," \xb7 Status: ","active"===o.testStatus?"Active":"Untested"]})]})]})}):(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400 text-lg mt-0.5",children:"check_circle"}),(0,d.jsxs)("div",{className:"text-sm text-green-800 dark:text-green-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"Xiaomi MiMo Desktop credentials found!"}),(0,d.jsxs)("p",{className:"text-xs mt-0.5 opacity-80",children:["UID: ",m.uid||"—"," \xb7 Source: ",m.source?.split(/[\\/]/).pop()]})]})]})}),q&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-2.5 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-xs text-red-600 dark:text-red-400",children:(0,j.Tl)(q)})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:G,variant:o?"outline":"default",fullWidth:!0,children:o?"Re-sync local credentials":"Connect with local credentials"}),(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:o?"Close":"Cancel"})]}),(0,d.jsxs)("div",{className:"relative my-1",children:[(0,d.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,d.jsx)("div",{className:"w-full border-t border-border"})}),(0,d.jsx)("div",{className:"relative flex justify-center text-xs text-text-muted",children:(0,d.jsx)("span",{className:"bg-card px-2",children:"or"})})]}),I()]}),"not-found"===g&&(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800",children:(0,d.jsxs)("div",{className:"flex gap-2.5 items-start",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400 text-lg mt-0.5",children:"info"}),(0,d.jsxs)("div",{className:"text-sm text-amber-800 dark:text-amber-200",children:[(0,d.jsx)("p",{className:"font-medium",children:"No local Desktop credentials found"}),(0,d.jsx)("p",{className:"text-xs mt-0.5 opacity-80",children:"You can still sign in via browser — no Desktop client needed."})]})]})}),I(),(0,d.jsx)("div",{className:"mt-1",children:(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})})]}),s&&(0,d.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center p-4 bg-black/60 backdrop-blur-xs animate-in fade-in duration-150",children:(0,d.jsxs)("div",{className:"relative w-full max-w-sm bg-surface border border-border-subtle rounded-[14px] shadow-2xl p-5 flex flex-col gap-3.5 animate-in zoom-in-95 duration-150",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.default,{className:"text-primary text-lg",children:"public"}),(0,d.jsx)("h3",{className:"text-sm font-semibold",children:"Select account cluster"})]}),(0,d.jsx)("button",{type:"button",onClick:()=>t(!1),className:"text-text-muted hover:text-text-primary p-1 rounded-md transition-colors cursor-pointer",children:(0,d.jsx)(e.default,{className:"text-lg",children:"close"})})]}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Choose the region cluster of your Xiaomi account:"}),(0,d.jsx)("div",{className:"flex flex-col gap-2",children:k.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>H(a.id),className:"p-3 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-all text-left flex items-start gap-3 group cursor-pointer",children:[(0,d.jsx)("span",{className:"text-2xl mt-0.5",children:a.flag}),(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsx)("div",{className:"text-sm font-semibold group-hover:text-primary transition-colors",children:a.name}),(0,d.jsx)("div",{className:"text-xs text-text-muted mt-0.5",children:a.host})]})]},a.id))}),(0,d.jsx)(i.$n,{onClick:()=>t(!1),variant:"ghost",size:"sm",fullWidth:!0,children:"Cancel"})]})})]})})}l.propTypes={isOpen:h().bool.isRequired,onSuccess:h().func,onClose:h().func.isRequired}},24656:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)("booting"),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(null),[u,v]=(0,f.useState)(!1),w=(0,f.useRef)(null),x=(0,f.useRef)({proxyStarted:!1,stopSent:!1});(0,f.useRef)(!1);let y=(0,f.useRef)(!1),z=(0,f.useRef)(a),A=(0,f.useRef)(c),B=(0,f.useRef)(g),{copied:C,copy:D}=(0,j.C)(),E=(0,f.useCallback)(()=>{let a=x.current;a.proxyStarted&&!a.stopSent&&(a.stopSent=!0,fetch("/api/oauth/zed/stop-proxy").catch(()=>{}))},[]),F=(0,f.useCallback)(()=>{l("success"),A.current?.(),setTimeout(()=>B.current?.(),600)},[]),G=(0,f.useCallback)(async a=>{if(a?.accessToken&&a?.userId){v(!0),t(null),l("importing");try{let b=await fetch("/api/oauth/zed/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:a.accessToken,userId:a.userId,...a.systemId?{systemId:a.systemId}:{}})}),c=await b.json();if(!b.ok)throw Error(c.error||"Import failed");E(),F()}catch(a){t(a.message),l("ide-found")}finally{v(!1)}}},[F,E]);(0,f.useCallback)(async()=>{t(null),p(null),r(""),x.current={proxyStarted:!1,stopSent:!1},y.current=!1;try{let a=await fetch("/api/oauth/zed/start-proxy"),b=await a.json();if(!a.ok||!b.success||!b.callbackUrl)throw Error(b.reason||b.error||"Failed to start Zed callback server");if(x.current.proxyStarted=!0,x.current.stopSent=!1,!z.current)return void E();let c=new URL("/api/oauth/zed/authorize",window.location.origin);c.searchParams.set("redirect_uri",b.callbackUrl);let d=await fetch(c),e=await d.json();if(!d.ok)throw E(),Error(e.error||"Failed to start Zed authorization");if(!z.current)return void E();let f={state:e.state};e.codeVerifier&&(f.codeVerifier=e.codeVerifier),e.systemId&&(f.systemId=e.systemId);let g=await fetch("/api/oauth/zed/register-session",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),h=null;try{h=await g.json()}catch{h=null}if(!g.ok||h?.success===!1)throw E(),Error(h?.error||"Failed to register Zed login session");if(!z.current)return;p(e),l(a=>"ide-found"===a||"importing"===a?a:"browser"),w.current=window.open(e.authUrl,"oauth_popup_zed","width=600,height=700")}catch(a){if(!z.current)return;t(a.message),l(a=>"ide-found"===a?a:"browser")}},[E]);let H=async()=>{let a=q.trim();if(a){v(!0),t(null);try{let b=await fetch("/api/oauth/zed/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:o?.state,...o?.redirectUri?{redirectUri:o.redirectUri}:{},...o?.codeVerifier?{codeVerifier:o.codeVerifier}:{},...o?.systemId?{systemId:o.systemId}:{}})}),c=await b.json();if(!b.ok)throw Error(c.error||"Exchange failed");y.current=!0,E(),F()}catch(a){t(a.message),l("error")}finally{v(!1)}}},I=()=>{y.current=!0,E(),g()},J=`Connect ${b?.name||"Zed"}`;return(0,d.jsx)(i.aF,{isOpen:a,title:J,onClose:I,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[("booting"===h||"importing"===h)&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"importing"===h?"Importing session from Zed IDE…":"Detecting Zed IDE session…"})]}),"ide-found"===h&&m&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsxs)("p",{className:"text-sm text-green-800 dark:text-green-200",children:["Zed IDE session detected (user ",m.userId,"). Import failed — retry or use browser sign-in below."]})]})}),(0,d.jsx)(i.$n,{onClick:()=>G(m),fullWidth:!0,disabled:u,children:u?"Importing…":"Import from Zed IDE"})]}),"success"===h&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800 text-sm text-green-800 dark:text-green-200",children:"Connected successfully."}),("browser"===h||"error"===h||"ide-found"===h)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:o?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===C?"check":"content_copy",onClick:()=>D(o?.authUrl,"auth_url"),disabled:!o?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser (or the local callback page)."}),(0,d.jsx)(i.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"http://127.0.0.1:.../?user_id=...&access_token=...",className:"font-mono text-xs"})]})]}),s&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:s})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:H,fullWidth:!0,disabled:u||!q.trim()||!o,children:u?"Connecting…":"Connect"}),(0,d.jsx)(i.$n,{onClick:I,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}k.propTypes={isOpen:h().bool.isRequired,providerInfo:h().object,onSuccess:h().func,onClose:h().func.isRequired}},25919:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({src:a,alt:b="Avatar",name:c,size:g="md",className:h}){let i={xs:"size-6 text-xs",sm:"size-8 text-sm",md:"size-10 text-base",lg:"size-12 text-lg",xl:"size-16 text-xl"};return a?(0,d.jsx)("div",{className:(0,e.cn)("rounded-full bg-cover bg-center bg-no-repeat","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],h),style:{backgroundImage:`url(${a})`},role:"img","aria-label":b}):(0,d.jsx)("div",{className:(0,e.cn)("rounded-full flex items-center justify-center font-semibold text-white","ring-2 ring-white dark:ring-surface-dark shadow-sm",i[g],(a=>{if(!a)return"bg-primary";let b=["bg-red-500","bg-orange-500","bg-amber-500","bg-yellow-500","bg-lime-500","bg-green-500","bg-emerald-500","bg-teal-500","bg-cyan-500","bg-sky-500","bg-blue-500","bg-indigo-500","bg-violet-500","bg-purple-500","bg-fuchsia-500","bg-pink-500","bg-rose-500"],c=a.charCodeAt(0)%b.length;return b[c]})(c),h),role:"img","aria-label":b,children:(a=>{if(!a)return"?";let b=a.split(" ");return b.length>=2?`${b[0][0]}${b[1][0]}`.toUpperCase():a.substring(0,2).toUpperCase()})(c)})}},29225:(a,b,c)=>{"use strict";c.d(b,{HY:()=>g,Kw:()=>h});let d={"perplexity-agent":"perplexity","gitlab-duo":"gitlab","vercel-ai-gateway":"vercel","ollama-search":"ollama","minimax-code":"minimax","minimax-code-global":"minimax"},e=new Set;function f(a){return a&&"string"==typeof a?a.trim().toLowerCase():""}function g(a){let b=function(a){let b=f(a);if(!b||e.has(b))return"";let c=d[b]||b;return e.has(c)?"":c}(a);return b?`/providers/${b}.png`:null}function h(a){let b=f(a);b&&e.add(b);let c=d[b];c&&e.add(c)}},29370:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(74429);let h=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"cast",label:"Desktop",desc:"Screen sharing"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],i=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function j({isOpen:a,onClose:b}){return a?(0,g.createPortal)((0,d.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-[2px] fade-in",onClick:b}),(0,d.jsxs)("div",{className:"relative w-full max-w-sm rounded-[14px] overflow-hidden shadow-[var(--shadow-elev)] fade-in flex flex-col bg-surface border border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border-subtle",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"w-7 h-7 rounded-[8px] flex items-center justify-center bg-primary",children:(0,d.jsx)(e.default,{className:"text-white text-base",children:"terminal"})}),(0,d.jsx)("span",{className:"text-xs font-bold uppercase tracking-wider text-primary font-mono",children:"9Remote"})]}),(0,d.jsx)("button",{onClick:b,className:"p-1.5 rounded-[10px] text-text-muted hover:bg-surface-2 hover:text-text-main transition-colors",children:(0,d.jsx)(e.default,{className:"text-base",children:"close"})})]}),(0,d.jsxs)("div",{className:"px-7 py-7 pb-9 flex flex-col gap-6",children:[(0,d.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[(0,d.jsx)("div",{className:"w-14 h-14 rounded-[14px] flex items-center justify-center mb-1 bg-primary shadow-[var(--shadow-warm)]",children:(0,d.jsx)(e.default,{className:"text-white text-[30px]",children:"terminal"})}),(0,d.jsx)("h1",{className:"text-lg font-bold text-text-main tracking-tight",children:"9Remote"}),(0,d.jsx)("p",{className:"text-xs text-text-muted leading-5 max-w-[220px]",children:"Access your terminal, desktop & files from anywhere"})]}),(0,d.jsx)("div",{className:"flex gap-2 w-full",children:h.map(({icon:a,label:b,desc:c})=>(0,d.jsxs)("div",{className:"flex-1 flex flex-col items-center gap-1.5 py-4 px-1 rounded-[10px] border border-border-subtle bg-surface-2",children:[(0,d.jsx)(e.default,{className:"text-primary text-[22px]",children:a}),(0,d.jsx)("p",{className:"text-xs font-semibold text-text-main",children:b}),(0,d.jsx)("p",{className:"text-[10px] text-text-muted text-center leading-4",children:c})]},b))}),(0,d.jsx)("div",{className:"flex flex-col gap-3 w-full",children:i.map(({icon:a,text:b})=>(0,d.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,d.jsx)(e.default,{className:"flex-shrink-0 text-primary text-[16px]",children:a}),(0,d.jsx)("span",{className:"text-xs text-text-muted",children:b})]},a))}),(0,d.jsxs)("button",{onClick:()=>window.open("https://9remote.cc","_blank"),className:"w-full py-3 flex items-center justify-center gap-2 text-sm font-semibold text-white rounded-[10px] bg-primary hover:bg-primary-hover shadow-[var(--shadow-warm)] active:scale-[0.98] transition-all",children:[(0,d.jsx)(e.default,{className:"text-base",children:"open_in_new"}),"Get 9Remote"]})]})]})]}),document.body):null}function k(){let[a,b]=(0,f.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:()=>b(!0),className:"relative flex items-center gap-1.5 px-2.5 py-1.5 rounded-lg transition-all text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5",title:"9Remote",children:[(0,d.jsx)(e.default,{className:"text-[18px]",children:"computer"}),(0,d.jsx)("span",{className:"text-xs font-medium",children:"Remote"})]}),(0,d.jsx)(j,{isOpen:a,onClose:()=>b(!1)})]})}},29476:(a,b,c)=>{"use strict";c.d(b,{y:()=>g});var d=c(67484),e=c(70552),f=c(92592);function g(){let[a,b]=(0,d.useState)(()=>({})),[c,g]=(0,d.useState)(()=>({}));return{getCaps:(0,d.useCallback)(b=>(function(a,b,c){if(!c)return null;if(a[c])return a[c];let d=c.includes("/")?c.slice(c.indexOf("/")+1):c;if(b[d])return b[d];let g=c.includes("/")?c.slice(0,c.indexOf("/")):null,h=g?f.js[g]||g:null,i=(0,e.nl)(h,d);return{vision:i.vision,search:i.search,reasoning:i.reasoning,contextWindow:i.contextWindow,maxOutput:i.maxOutput}})(a,c,b),[a,c])}}},32456:(a,b,c)=>{"use strict";c.d(b,{default:()=>w});var d=c(48249),e=c(67484),f=c(19099),g=c(2116),h=c.n(g),i=c(49885),j=c.n(i),k=c(72738),l=c(21707),m=c(3236),n=c(51126),o=c(99258),p=c(267);function q(){if("u"<typeof document)return"en";let a=document.cookie.split(";").find(a=>a.trim().startsWith(`${n.CL}=`)),b=a?decodeURIComponent(a.split("=")[1]):"en";return(0,n.QC)(b)}function r(){let[a,b]=(0,e.useState)(!1),c=(0,e.useRef)(null),f=(0,e.useSyncExternalStore)(o.oQ,q,()=>"en");return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("button",{type:"button",ref:c,onClick:()=>b(!0),className:"dashboard-header__action",title:"Language","aria-label":`Language (${f})`,"data-i18n-skip":"true",children:(0,d.jsx)("span",{className:"dashboard-header__locale",children:f.split("-")[0].toUpperCase()})}),(0,d.jsx)(p.default,{hideTrigger:!0,isOpen:a,onClose:()=>b(!1)})]})}var s=c(37365),t=c(12020),u=c(92592),v=c(29225);function w({onMenuClick:a,showMenuButton:b=!0}){let c=(0,f.usePathname)(),[g,i]=(0,e.useState)(""),[j,n]=(0,e.useState)(""),{title:p,icon:q,breadcrumbs:s}=(0,e.useMemo)(()=>(a=>{if(!a)return{title:"",breadcrumbs:[]};let b=a.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(b){let a=b[1],c=b[2],d=u.rj.find(b=>b.id===a),e=u.Q2[c];return{title:e?.name||c,breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${a}`},{label:d?.label||a,href:`/dashboard/media-providers/${a}`},{label:e?.name||c,image:(0,v.HY)(c)}]}}let c=a.match(/\/media-providers\/([^/]+)$/);if(c){let a=c[1],b=u.rj.find(b=>b.id===a);return{title:b?.label||a,icon:b?.icon||"perm_media",breadcrumbs:[]}}let d=a.match(/\/providers\/([^/]+)$/);if(d){let a=d[1],b=t.zN[a]||t.fg[a];if(b)return{title:b.name,breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:b.name,image:(0,v.HY)(b.id)}]}}return a.includes("/providers")&&!a.includes("/media-providers")?{title:"Providers",icon:"dns",breadcrumbs:[]}:a.includes("/combos")?{title:"Combos",icon:"layers",breadcrumbs:[]}:a.includes("/health")?{title:"Model Health",icon:"monitoring",breadcrumbs:[]}:a.includes("/usage")?{title:"Usage & Analytics",icon:"bar_chart",breadcrumbs:[]}:a.includes("/auth-files")?{title:"Auth Files",icon:"vpn_key",breadcrumbs:[]}:a.includes("/quota")?{title:"Quota Tracker",icon:"data_usage",breadcrumbs:[]}:a.includes("/mitm")?{title:"MITM Proxy",icon:"security",breadcrumbs:[]}:a.includes("/token-saver")?{title:"Token Saver",icon:"savings",breadcrumbs:[]}:a.includes("/cli-tools")?{title:"CLI Tools",icon:"terminal",breadcrumbs:[]}:a.includes("/proxy-pools")?{title:"Proxy Pools",icon:"lan",breadcrumbs:[]}:a.includes("/skills")?{title:"Agent Skills",icon:"extension",breadcrumbs:[]}:a.includes("/endpoint")?{title:"Endpoint",icon:"api",breadcrumbs:[]}:a.includes("/profile")?{title:"Settings",icon:"settings",breadcrumbs:[]}:a.includes("/translator")?{title:"Translator",icon:"translate",breadcrumbs:[]}:a.includes("/console-log")?{title:"Console Log",icon:"monitor",breadcrumbs:[]}:"/dashboard"===a?{title:"Dashboard",icon:"layout-dashboard",breadcrumbs:[]}:{title:"",breadcrumbs:[]}})(c),[c]),y=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&window.location.assign("/login")}catch(a){console.error("Failed to logout:",a)}};return(0,d.jsxs)("header",{className:"dashboard-header shrink-0 flex items-center z-20",children:[b&&(0,d.jsx)("div",{className:"dashboard-header__navigation flex items-center shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:a,className:"dashboard-header__action",title:"Toggle sidebar (Ctrl+B)","aria-label":"Toggle sidebar",children:(0,d.jsx)(l.default,{name:"panel-left",className:"text-[18px]"})})}),(0,d.jsx)("div",{className:"dashboard-header__title flex flex-col min-w-0 flex-1",children:s.length>0?(0,d.jsx)("div",{className:"dashboard-header__breadcrumbs flex items-center gap-1.5 sm:gap-2 min-w-0",children:s.map((a,b)=>(0,d.jsxs)("div",{className:`items-center gap-1.5 sm:gap-2 min-w-0 ${b<s.length-1?"hidden sm:flex shrink-0":"flex flex-1"}`,children:[b>0&&(0,d.jsx)(l.default,{name:"chevron_right",className:"text-[var(--text-3)] text-base hidden sm:inline"}),a.href?(0,d.jsx)(h(),{href:a.href,className:"dashboard-header__crumb text-[13px] text-[var(--text-2)] hover:text-[var(--text)] transition-colors truncate",children:a.label}):(0,d.jsxs)("div",{className:"flex items-center gap-1.5 sm:gap-2 min-w-0",children:[a.image&&(0,d.jsx)(k.A,{src:a.image,alt:a.label,size:28,className:"object-contain rounded-[var(--r1)] max-w-[24px] max-h-[24px] sm:max-w-[28px] sm:max-h-[28px] shrink-0",fallbackText:a.label.slice(0,2).toUpperCase()}),(0,d.jsx)("h1",{className:"dashboard-header__heading font-semibold text-[var(--text)] tracking-[-0.02em] leading-tight truncate",children:(0,o.Tl)(a.label)})]})]},`${a.label}-${a.href||"current"}`))}):p?(0,d.jsxs)("div",{className:"flex items-center gap-2.5 min-w-0",children:[q&&(0,d.jsx)(l.default,{name:q,className:"dashboard-header__page-icon"}),(0,d.jsx)("h1",{className:"dashboard-header__heading font-semibold text-[var(--text)] tracking-[-0.02em] leading-tight truncate",children:(0,o.Tl)(p)})]}):null}),(0,d.jsxs)("div",{className:"dashboard-header__actions flex items-center shrink-0",children:[g&&("OIDC"===j||"SAML"===j)&&(0,d.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-2.5 py-1 rounded-[var(--r-full)] border border-[var(--line-2)] bg-[var(--surface-2)] text-xs text-[var(--text-2)] truncate font-mono",title:g,children:[(0,d.jsx)(l.default,{name:"person",className:"text-[14px] mr-1.5 text-[var(--text)]"}),(0,d.jsx)("span",{className:"truncate",children:g}),(0,d.jsx)("span",{className:"ml-2 shrink-0 rounded-[var(--r-full)] bg-[var(--surface)] border border-[var(--line)] px-1.5 py-0.2 text-[10px] font-mono uppercase text-[var(--text-2)]",children:j})]}),(0,d.jsx)(x,{}),(0,d.jsx)(r,{}),(0,d.jsx)(m.default,{onLogout:y})]})]})}function x(){let a=(0,s.C)(a=>a.visible),b=(0,s.C)(a=>a.query),c=(0,s.C)(a=>a.placeholder),e=(0,s.C)(a=>a.setQuery);return a?(0,d.jsxs)("div",{className:"dashboard-header__search relative",children:[(0,d.jsx)(l.default,{name:"search",className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-3)] text-[16px] pointer-events-none"}),(0,d.jsx)("input",{type:"text",value:b,onChange:a=>e(a.target.value),placeholder:c,"aria-label":c,className:"w-full h-9 pl-7 pr-7 rounded-[var(--r1)] border border-[var(--line-2)] bg-[var(--surface-inset)] text-xs text-[var(--text)] placeholder-[var(--text-2)] focus:outline-none focus:border-[var(--accent-line)] transition-colors"}),b&&(0,d.jsx)("button",{type:"button",onClick:()=>e(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-[var(--text-3)] hover:text-[var(--text)] p-0.5 rounded cursor-pointer","aria-label":"Clear search",children:(0,d.jsx)(l.default,{name:"close",className:"text-[16px]"})})]}):null}w.propTypes={onMenuClick:j().func,showMenuButton:j().bool}},32971:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(48249),e=c(67484),f=c(74429);function g({text:a,children:b,position:c="top",color:h}){let i=(0,e.useRef)(null),[j,k]=(0,e.useState)(null);return(0,d.jsxs)("div",{ref:i,className:"relative inline-flex",onMouseEnter:()=>{let a=i.current?.getBoundingClientRect();if(!a)return;let b=a.left+a.width/2,d=a.top+a.height/2;k({position:"fixed",..."bottom"===c?{top:a.bottom+6,left:b,transform:"translateX(-50%)"}:"left"===c?{right:window.innerWidth-a.left+6,top:d,transform:"translateY(-50%)"}:"right"===c?{left:a.right+6,top:d,transform:"translateY(-50%)"}:{bottom:window.innerHeight-a.top+6,left:b,transform:"translateX(-50%)"}})},onMouseLeave:()=>k(null),children:[b,j&&(0,f.createPortal)((0,d.jsx)("div",{className:`pointer-events-none z-50 w-max max-w-56 rounded px-2 py-1 text-[11px] leading-snug text-white whitespace-normal ${h?"":"bg-gray-900"}`,style:{...j,...h?{backgroundColor:h}:{}},children:a}),document.body)]})}},37365:(a,b,c)=>{"use strict";c.d(b,{C:()=>d});let d=(0,c(31417).v)(a=>({query:"",placeholder:"",visible:!1,setQuery:b=>a({query:b}),register:(b="Search...")=>a({visible:!0,placeholder:b,query:""}),unregister:()=>a({visible:!1,placeholder:"",query:""})}))},38930:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(91431),f=c(32971),g=c(21707);function h({caps:a,className:b="",colorOverride:c,size:i=16}){if(!a)return null;let j=Object.keys(e.bs).filter(b=>a[b]);return 0===j.length?null:(0,d.jsx)("span",{className:`inline-flex items-center gap-0.5 ${b}`,children:j.map(a=>(0,d.jsx)(f.default,{text:`${e.bs[a].label} — ${e.bs[a].desc}`,children:(0,d.jsx)(g.default,{name:e.bs[a].icon,size:i,className:`leading-none cursor-help ${c||e.bs[a].color}`})},a))})}},39645:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(95145),h=c(99070),i=c(50377);function j({isOpen:a,onClose:b,title:c="Manual Configuration",configs:k=[]}){let{copy:l}=(0,i.C)(),[m,n]=(0,f.useState)(null);return(0,d.jsx)(g.default,{isOpen:a,onClose:b,title:c,size:"xl",children:(0,d.jsx)("div",{className:"flex flex-col gap-4",children:k.map((a,b)=>(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:a.filename}),(0,d.jsxs)(h.default,{variant:"ghost",size:"sm",onClick:()=>{var c;return c=a.content,void(l(c,`manualconfig-${b}`),n(b),setTimeout(()=>n(null),2e3))},children:[(0,d.jsx)(e.default,{className:"text-[14px] mr-1",children:m===b?"check":"content_copy"}),m===b?"Copied!":"Copy"]})]}),(0,d.jsx)("pre",{className:"px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs overflow-x-auto whitespace-pre-wrap break-all max-h-60 overflow-y-auto border border-border",children:a.content})]},b))})})}},40560:a=>{a.exports={search:"ModelPickerList_search__VuMf4",searchIcon:"ModelPickerList_searchIcon__sqlnD",searchInput:"ModelPickerList_searchInput__DgrSf",scroll:"ModelPickerList_scroll__vZ0nD",group:"ModelPickerList_group__oe9L_",groupHead:"ModelPickerList_groupHead__p8Pfc",groupIcon:"ModelPickerList_groupIcon__Q1JIu",groupName:"ModelPickerList_groupName__O_PPt",groupCount:"ModelPickerList_groupCount__GpmFv",chips:"ModelPickerList_chips__w1jZO",chip:"ModelPickerList_chip__s_jlm",chipTag:"ModelPickerList_chipTag__RiI65",chipLabel:"ModelPickerList_chipLabel__vkF4o",chipCheck:"ModelPickerList_chipCheck__9dCWf",chipHint:"ModelPickerList_chipHint__5A0cj",empty:"ModelPickerList_empty__3LjZK",emptyIcon:"ModelPickerList_emptyIcon__aEoGe"}},41371:(a,b,c)=>{"use strict";c.d(b,{i:()=>f});var d=c(31417);let e=0,f=(0,d.v)((a,b)=>({notifications:[],addNotification:c=>{let d=++e,f={id:d,type:c.type||"info",message:c.message,title:c.title||null,duration:c.duration??5e3,dismissible:c.dismissible??!0,createdAt:Date.now()};return a(a=>({notifications:[...a.notifications,f]})),f.duration>0&&setTimeout(()=>b().removeNotification(d),f.duration),d},removeNotification:b=>{a(a=>({notifications:a.notifications.filter(a=>a.id!==b)}))},clearAll:()=>a({notifications:[]}),success:(a,c)=>b().addNotification({type:"success",message:a,title:c}),error:(a,c)=>b().addNotification({type:"error",message:a,title:c,duration:8e3}),warning:(a,c)=>b().addNotification({type:"warning",message:a,title:c}),info:(a,c)=>b().addNotification({type:"info",message:a,title:c})}))},42118:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484),e=c(13033);function f(a){return()=>{}}function g(){return!1}function h(){return!1}function i(){let{theme:a,setTheme:b,toggleTheme:c,initTheme:i}=(0,e.A)(),j=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,setTheme:b,toggleTheme:c,isDark:"dark"===a||"system"===a&&j}}},42196:(a,b,c)=>{"use strict";c.d(b,{default:()=>y});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(2116),i=c.n(h),j=c(19099),k=c(71404),l=c(12020),m=c(92592),n=c(50377);c(91937);var o=c(99070),p=c(95145),q=c(84849),r=c(21707);let s=["embedding","image","video","tts","stt","systemone"],t="/dashboard/media-providers/web",u=[{href:"/dashboard",label:"Dashboard",icon:"layout-dashboard"},{href:"/dashboard/endpoint",label:"Endpoint & Key",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combo & Vision Adapter",icon:"layers"},{href:"/dashboard/playground",label:"Playground",icon:"science"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/health",label:"Health",icon:"monitoring"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],v=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],w=[{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"}],x=a=>(0,k.cn)("dashboard-sidebar__item group",a&&"is-active");function y({onClose:a,onToggleCollapse:b}){let c=(0,j.usePathname)(),f=(0,e.useId)(),[g,h]=(0,e.useState)(!1),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(!1),[I,J]=(0,e.useState)(0),[K,L]=(0,e.useState)(!1),{copied:M,copy:N}=(0,n.C)(2e3),O=l.h0.installCmdLatest,P=a=>"/dashboard"===a?"/dashboard"===c:"/dashboard/endpoint"===a?c.startsWith("/dashboard/endpoint"):c.startsWith(a),Q=async()=>{try{await navigator.clipboard.writeText(O)}catch{}N(O);let a=l.h0.shutdownCountdownSec;J(a);let b=setInterval(()=>{J(a-=1),a<=0&&(clearInterval(b),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),B(!0))},1e3)};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("aside",{className:"dashboard-sidebar flex w-60 flex-col h-full min-h-0",children:[(0,d.jsxs)("div",{className:"dashboard-sidebar__brand shrink-0",children:[(0,d.jsxs)(i(),{href:"/dashboard",onClick:a,className:"dashboard-sidebar__brand-link",children:[(0,d.jsx)(q.A,{size:32,className:"shrink-0"}),(0,d.jsxs)("div",{className:"flex flex-col min-w-0 gap-0.5",children:[(0,d.jsx)("span",{className:"text-[13px] font-semibold tracking-tight text-[var(--text)] truncate",children:l.vQ.name}),(0,d.jsxs)("span",{className:"text-[10px] font-mono text-[var(--text-2)] u-tnum",children:["v",l.vQ.version]})]})]}),C&&(0,d.jsxs)("div",{className:"flex flex-col gap-1.5 rounded-[var(--r1)] p-1.5 bg-[var(--surface-2)] border border-[var(--line)]",children:[(0,d.jsxs)("span",{className:"text-[10px] font-semibold text-[var(--pos)]",children:["↑ New version: v",C.latestVersion]}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("button",{onClick:()=>F(!0),className:"px-2 py-0.5 rounded-[var(--r1)] bg-[var(--pos)] text-black text-[10px] font-semibold transition-colors cursor-pointer",children:"Update"}),(0,d.jsx)("button",{onClick:()=>N(O),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,d.jsx)("code",{className:"block text-[9px] text-[var(--text-2)] font-mono truncate",children:M?"✓ copied!":O})})]})]})]}),(0,d.jsxs)("nav",{"aria-label":"Main navigation",className:"dashboard-sidebar__nav flex-1 min-h-0 overflow-y-auto no-scrollbar",children:[u.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href)),(0,d.jsxs)("div",{className:"dashboard-sidebar__section",children:[(0,d.jsx)("p",{className:"dashboard-sidebar__section-title",children:"System"}),(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>!a),"aria-expanded":g,"aria-controls":f,className:x(c.startsWith("/dashboard/media-providers")),children:[(0,d.jsx)(r.default,{name:"perm_media",className:"text-[16px] text-[var(--text-3)] group-hover:text-[var(--text)]"}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium flex-1 text-left",children:"Media Providers"}),(0,d.jsx)(r.default,{name:"expand_more",className:"text-[14px] transition-transform text-[var(--text-3)]",style:{transform:g?"rotate(180deg)":"rotate(0deg)"}})]}),g&&(0,d.jsxs)("div",{id:f,className:"dashboard-sidebar__subnav",children:[m.rj.filter(a=>s.includes(a.id)).map(b=>(0,d.jsxs)(i(),{href:`/dashboard/media-providers/${b.id}`,onClick:a,"aria-current":c.startsWith(`/dashboard/media-providers/${b.id}`)?"page":void 0,className:x(c.startsWith(`/dashboard/media-providers/${b.id}`)),children:[(0,d.jsx)(r.default,{name:b.icon,className:"text-[15px] text-[var(--text-3)]"}),(0,d.jsx)("span",{className:"text-[12px]",children:b.label})]},b.id)),(0,d.jsxs)(i(),{href:t,onClick:a,"aria-current":c.startsWith(t)?"page":void 0,className:x(c.startsWith(t)),children:[(0,d.jsx)(r.default,{name:"travel_explore",className:"text-[15px] text-[var(--text-3)]"}),(0,d.jsx)("span",{className:"text-[12px]",children:"Web Fetch & Search"})]},"web")]}),w.map(b=>(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href)),v.map(b=>"/dashboard/translator"!==b.href||K?(0,d.jsxs)(i(),{href:b.href,onClick:a,"aria-current":P(b.href)?"page":void 0,className:x(P(b.href)),children:[(0,d.jsx)(r.default,{name:b.icon,className:(0,k.cn)("text-[16px]",P(b.href)?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:b.label})]},b.href):null),(0,d.jsxs)(i(),{href:"/dashboard/profile",onClick:a,"aria-current":P("/dashboard/profile")?"page":void 0,className:x(P("/dashboard/profile")),children:[(0,d.jsx)(r.default,{name:"settings",className:(0,k.cn)("text-[16px]",P("/dashboard/profile")?"text-[var(--text)]":"text-[var(--text-3)] group-hover:text-[var(--text)] transition-colors")}),(0,d.jsx)("span",{className:"text-[12.5px] font-medium",children:"Settings"})]})]})]})]}),(0,d.jsx)(p.ConfirmModal,{isOpen:E,onClose:()=>F(!1),onConfirm:()=>{F(!1),H(!0)},title:"Update JRouter",message:`Show install command for v${C?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(A||G)&&(0,d.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:G?(0,d.jsx)(z,{latestVersion:C?.latestVersion,installCmd:O,copied:M,onCopyAndShutdown:Q,onCancel:()=>{H(!1),J(0)},countdown:I,isDisconnected:A}):(0,d.jsxs)("div",{className:"text-center p-8",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-16 rounded-full bg-red-500/20 text-red-500 mx-auto mb-4",children:(0,d.jsx)(r.default,{name:"power_off",className:"text-[32px]"})}),(0,d.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,d.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,d.jsx)(o.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function z({latestVersion:a,installCmd:b,copied:c,onCopyAndShutdown:e,onCancel:f,countdown:g,isDisconnected:h}){let i=g>0;return(0,d.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,d.jsx)(r.default,{name:"content_copy",className:"text-[24px]"})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("h2",{className:"text-lg font-semibold",children:["Update JRouter",a?` to v${a}`:""]}),(0,d.jsx)("p",{className:"text-xs text-white/60",children:h?"Server stopped. Paste the command into a terminal to install.":i?`Command copied. Server will stop in ${g}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,d.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,d.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,d.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:b})}),(0,d.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,d.jsxs)("li",{children:["Click ",(0,d.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,d.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,d.jsxs)("li",{children:["Run ",(0,d.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"jrouter"})," again after install."]})]}),h?(0,d.jsx)(o.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(o.default,{variant:"secondary",onClick:f,disabled:i,children:"Cancel"}),(0,d.jsx)(o.default,{variant:"primary",fullWidth:!0,onClick:e,disabled:i,children:c?"✓ Copied — shutting down...":i?`Shutting down in ${g}s`:"Copy & Shutdown"})]})]})}y.propTypes={onClose:g().func},z.propTypes={latestVersion:g().string,installCmd:g().string.isRequired,copied:g().bool,onCopyAndShutdown:g().func.isRequired,onCancel:g().func.isRequired,countdown:g().number,isDisconnected:g().bool}},43182:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);let j="https://gitlab.com";function k({isOpen:a,providerInfo:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)(null),[m,n]=(0,f.useState)(j),[o,p]=(0,f.useState)(""),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(""),[u,v]=(0,f.useState)(!1),[w,x]=(0,f.useState)(null),[y,z]=(0,f.useState)(!1),[A,B]=(0,f.useState)(null),C=()=>{l(null),n(j),p(""),r(""),t(""),x(null),v(!1),z(!1),B(null),g()},D=async()=>{if(!s.trim())return void x("Personal Access Token is required");v(!0),x(null);try{let a=await fetch("/api/oauth/gitlab/pat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s.trim(),baseUrl:m.trim()||j})}),b=await a.json();if(!a.ok)throw Error(b.error||"Authentication failed");c?.(),C()}catch(a){x(a.message)}finally{v(!1)}};return a?y&&A?(0,d.jsx)(i.LF,{isOpen:!0,provider:"gitlab",providerInfo:b,oauthMeta:A,onSuccess:()=>{c?.(),C()},onClose:()=>{z(!1),B(null)}}):(0,d.jsx)(i.aF,{isOpen:a,title:"Connect GitLab Duo",onClose:C,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[!h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Choose how to authenticate with GitLab Duo:"}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,d.jsxs)("button",{onClick:()=>l("oauth"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,d.jsx)(e.default,{className:"text-2xl text-primary",children:"lock_open"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"OAuth App"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab OAuth application"})]})]}),(0,d.jsxs)("button",{onClick:()=>l("pat"),className:"flex flex-col items-center gap-2 p-4 rounded-lg border border-border hover:border-primary hover:bg-primary/5 transition-colors text-left",children:[(0,d.jsx)(e.default,{className:"text-2xl text-primary",children:"key"}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"Personal Access Token"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Use a GitLab PAT with api scope"})]})]})]})]}),"oauth"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Create an OAuth app at"," ",(0,d.jsx)("a",{href:`${m.trim()||j}/-/profile/applications`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Applications"})," ","with redirect URI"," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"http://localhost/callback"})]}),(0,d.jsx)(i.pd,{label:"GitLab Base URL",value:m,onChange:a=>n(a.target.value),placeholder:j}),(0,d.jsx)(i.pd,{label:"Client ID",value:o,onChange:a=>p(a.target.value),placeholder:"Your OAuth application client ID"}),(0,d.jsx)(i.pd,{label:"Client Secret (optional for PKCE)",value:q,onChange:a=>r(a.target.value),placeholder:"Leave empty for public PKCE app"}),w&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>{o.trim()?(x(null),B({baseUrl:m.trim()||j,clientId:o.trim(),clientSecret:q.trim()}),z(!0)):x("Client ID is required")},fullWidth:!0,disabled:!o.trim(),children:"Authorize"}),(0,d.jsx)(i.$n,{onClick:()=>{l(null),x(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]}),"pat"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Create a PAT at"," ",(0,d.jsx)("a",{href:`${m.trim()||j}/-/user_settings/personal_access_tokens`,target:"_blank",rel:"noreferrer",className:"text-primary underline",children:"GitLab Access Tokens"})," ","with scopes: ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"api"}),","," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"read_user"}),", and"," ",(0,d.jsx)("code",{className:"bg-sidebar px-1 rounded text-xs",children:"ai_features"}),"."]}),(0,d.jsx)(i.pd,{label:"GitLab Base URL",value:m,onChange:a=>n(a.target.value),placeholder:j}),(0,d.jsx)(i.pd,{label:"Personal Access Token",value:s,onChange:a=>t(a.target.value),placeholder:"glpat-xxxxxxxxxxxxxxxxxxxx",type:"password"}),w&&(0,d.jsx)("p",{className:"text-sm text-red-500",children:w}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:D,fullWidth:!0,disabled:!s.trim()||u,loading:u,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:()=>{l(null),x(null)},variant:"ghost",fullWidth:!0,children:"Back"})]})]})]})}):null}k.propTypes={isOpen:h().bool.isRequired,providerInfo:h().shape({name:h().string}),onSuccess:h().func,onClose:h().func.isRequired}},48781:(a,b,c)=>{"use strict";c.d(b,{default:()=>l});var d=c(48249),e=c(2116),f=c.n(e),g=c(12020),h=c(84849);let i=[{label:"Features",href:"#features"},{label:"Pricing",href:"#pricing"},{label:"Changelog",href:"#"}],j=[{label:"Documentation",href:"#"},{label:"API Reference",href:"#"},{label:"Help Center",href:"#"}],k=[{label:"About",href:"#"},{label:"Blog",href:"#"},{label:"Contact",href:"#"}];function l(){return(0,d.jsx)("footer",{className:"bg-bg border-t border-border pt-16 pb-12",children:(0,d.jsxs)("div",{className:"container mx-auto px-4 sm:px-6 lg:px-8",children:[(0,d.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-10 mb-12",children:[(0,d.jsxs)("div",{className:"col-span-2 lg:col-span-2",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 mb-6",children:[(0,d.jsx)(h.A,{size:28}),(0,d.jsx)("span",{className:"text-xl font-bold text-text-main",children:g.vQ.name})]}),(0,d.jsx)("p",{className:"text-text-muted mb-6 max-w-sm font-light",children:"The unified interface for modern AI infrastructure. Secure, observable, and scalable."}),(0,d.jsxs)("div",{className:"flex gap-4",children:[(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"Twitter",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M22.46 6c-.77.35-1.6.58-2.46.69.88-.53 1.56-1.37 1.88-2.38-.83.5-1.75.85-2.72 1.05C18.37 4.5 17.26 4 16 4c-2.35 0-4.27 1.92-4.27 4.29 0 .34.04.67.11.98C8.28 9.09 5.11 7.38 3 4.79c-.37.63-.58 1.37-.58 2.15 0 1.49.75 2.81 1.91 3.56-.71 0-1.37-.2-1.95-.5v.03c0 2.08 1.48 3.82 3.44 4.21a4.22 4.22 0 0 1-1.93.07 4.28 4.28 0 0 0 4 2.98 8.521 8.521 0 0 1-5.33 1.84c-.34 0-.68-.02-1.02-.06C3.44 20.29 5.7 21 8.12 21 16 21 20.33 14.46 20.33 8.79c0-.19 0-.37-.01-.56.84-.6 1.56-1.36 2.14-2.23z"})})}),(0,d.jsx)("a",{href:"#",className:"text-gray-400 hover:text-primary transition-colors","aria-label":"GitHub",children:(0,d.jsx)("svg",{className:"w-5 h-5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,d.jsx)("path",{d:"M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12.017C22 6.484 17.522 2 12 2z"})})})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Product"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:i.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Resources"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:j.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("h4",{className:"font-semibold text-text-main mb-4",children:"Company"}),(0,d.jsx)("ul",{className:"flex flex-col gap-3 text-sm text-text-muted font-light",children:k.map(a=>(0,d.jsx)("li",{children:(0,d.jsx)(f(),{href:a.href,className:"hover:text-primary transition-colors",children:a.label})},a.label))})]})]}),(0,d.jsxs)("div",{className:"border-t border-border pt-8 flex flex-col md:flex-row justify-between items-center gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["\xa9 ",new Date().getFullYear()," ",g.vQ.name," Inc. All rights reserved."]}),(0,d.jsxs)("div",{className:"flex gap-6 text-sm text-text-muted",children:[(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Privacy Policy"}),(0,d.jsx)(f(),{href:"#",className:"hover:text-primary transition-colors",children:"Terms of Service"})]})]})]})})}},50377:(a,b,c)=>{"use strict";c.d(b,{C:()=>e});var d=c(67484);function e(a=2e3){let[b,c]=(0,d.useState)(null),f=(0,d.useRef)(null);return{copied:b,copy:(0,d.useCallback)((b,d="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(b);else{let a=document.createElement("textarea");a.value=b,a.style.position="fixed",a.style.opacity="0",document.body.appendChild(a),a.select(),document.execCommand("copy"),document.body.removeChild(a)}})(),c(d),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{c(null)},a)},[a])}}},50412:(a,b,c)=>{"use strict";c.d(b,{x0:()=>y.default,Ex:()=>j.default,$n:()=>d.default,nh:()=>D.default,Zp:()=>g.default,Qv:()=>i.CardSkeleton,CK:()=>o.default,uo:()=>h.ConfirmModal,G9:()=>s.default,wI:()=>x.default,vj:()=>w.default,vE:()=>v.default,pd:()=>e.default,Mh:()=>r.default,uR:()=>n.default,Nf:()=>p.default,aF:()=>h.default,rq:()=>m.default,gw:()=>z.default,LF:()=>l.default,Wx:()=>C.default,gM:()=>q.default,Iz:()=>A.default,l6:()=>f.default,EA:()=>i.Skeleton,lM:()=>k.default,m_:()=>B.default,LH:()=>u.default,TE:()=>t.default}),c(21707);var d=c(99070),e=c(83552),f=c(4770),g=c(17660),h=c(95145),i=c(74812);c(25919);var j=c(75171),k=c(95514);c(53845),c(19308),c(42196),c(32456),c(48781);var l=c(79346),m=c(83352),n=c(39645),o=c(62727),p=c(20084);c(267),c(29370),c(3236),c(11229);var q=c(91809);c(8590);var r=c(5291);c(56110);var s=c(51109),t=c(24656),u=c(24622),v=c(79488),w=c(43182),x=c(51585),y=c(67738),z=c(50585),A=c(91099),B=c(32971),C=c(11633),D=c(38930);c(85306),c(53838)},50585:(a,b,c)=>{"use strict";c.d(b,{default:()=>n});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(17660),j=c(4770),k=c(75171);let l="__none__",m=[{value:"none",label:"None (single pool)"},{value:"round-robin",label:"Round-robin"},{value:"random",label:"Random"}];function n({providerId:a}){let[b,c]=(0,f.useState)([]),[g,h]=(0,f.useState)(l),[o,p]=(0,f.useState)("none"),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),u=(0,f.useCallback)(async(b,c)=>{r(!0);try{let d=await fetch("/api/settings",{cache:"no-store"}),e=(d.ok?await d.json():{}).providerStrategies||{},f={...e[a]||{}};b===l?delete f.proxyPoolId:f.proxyPoolId=b,"none"===c?delete f.rotateStrategy:f.rotateStrategy=c;let g={...e};0===Object.keys(f).length?delete g[a]:g[a]=f,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:g})}),t(!0),setTimeout(()=>t(!1),1500)}catch(a){console.log("Save proxy config error:",a)}finally{r(!1)}},[a]),v=b.length>=2,w="none"!==o;return(0,d.jsxs)(i.default,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,d.jsx)(e.default,{className:"text-[20px]",children:"lock_open"})}),(0,d.jsxs)("div",{className:"flex-1",children:[(0,d.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use. Optionally route requests through a proxy pool to bypass IP-based limits."})]}),s&&(0,d.jsx)(k.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,d.jsx)(j.default,{label:"Proxy Pool",value:g,onChange:a=>{var b;h(b=a.target.value),u(b,o)},disabled:q||w,options:[{value:l,label:"None (direct)"},...b.map(a=>({value:a.id,label:a.name}))],hint:w?"Pool selector is ignored when rotation is active — all active pools are used.":void 0}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 mt-4",children:[(0,d.jsx)("label",{className:"text-sm font-medium text-text-main",children:"Rotation Strategy"}),(0,d.jsx)("select",{value:o,onChange:a=>{var b;p(b=a.target.value),u(g,b)},disabled:q,className:"py-2 px-3 text-sm text-text-main bg-white dark:bg-white/5 border border-black/10 dark:border-white/10 rounded-md focus:ring-1 focus:ring-primary/30 focus:border-primary/50 focus:outline-none transition-all disabled:opacity-50",children:m.map(a=>(0,d.jsx)("option",{value:a.value,disabled:"none"!==a.value&&!v,children:a.label},a.value))}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:v?w?"round-robin"===o?`Rotating through all ${b.length} active pools in order. State is in-memory (resets on restart).`:`Picking a random pool from ${b.length} active pools each request.`:"Uses the selected pool above. Set to Round-robin or Random to rotate across all active pools.":"Need at least 2 active proxy pools for rotation."})]})]})}n.propTypes={providerId:h().string.isRequired}},51109:(a,b,c)=>{"use strict";c.d(b,{default:()=>j});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412);function j({isOpen:a,onSuccess:b,onClose:c}){let[g,h]=(0,f.useState)(""),[k,l]=(0,f.useState)(""),[m,n]=(0,f.useState)(null),[o,p]=(0,f.useState)(!1),[q,r]=(0,f.useState)(!1),[s,t]=(0,f.useState)(!1),[u,v]=(0,f.useState)(!1),w=async()=>{r(!0),n(null),t(!1),v(!1);try{let a=await fetch("/api/oauth/cursor/auto-import"),b=await a.json();b.found?(h(b.accessToken),l(b.machineId),t(!0)):b.windowsManual?v(!0):n(b.error||"Could not auto-detect tokens")}catch(a){n("Failed to auto-detect tokens")}finally{r(!1)}},x=async()=>{if(!g.trim())return void n("Please enter an access token");if(!k.trim())return void n("Please enter a machine ID");p(!0),n(null);try{let a=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:g.trim(),machineId:k.trim()})}),d=await a.json();if(!a.ok)throw Error(d.error||"Import failed");b?.(),c()}catch(a){n(a.message)}finally{p(!1)}};return(0,d.jsx)(i.aF,{isOpen:a,title:"Connect Cursor IDE",onClose:c,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[q&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!q&&(0,d.jsxs)(d.Fragment,{children:[s&&(0,d.jsx)("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-lg border border-green-200 dark:border-green-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-green-600 dark:text-green-400",children:"check_circle"}),(0,d.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),u&&(0,d.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-900/20 p-3 rounded-lg border border-amber-200 dark:border-amber-800 flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,d.jsx)(e.default,{className:"text-amber-600 dark:text-amber-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,d.jsxs)("p",{className:"text-xs text-amber-700 dark:text-amber-300",children:["Make sure Cursor IDE has been opened at least once, then click ",(0,d.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,d.jsx)(i.$n,{onClick:w,variant:"outline",fullWidth:!0,children:"Retry"})]}),!s&&!u&&!m&&(0,d.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-3 rounded-lg border border-blue-200 dark:border-blue-800",children:(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(e.default,{className:"text-blue-600 dark:text-blue-400",children:"info"}),(0,d.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)("textarea",{value:g,onChange:a=>h(a.target.value),placeholder:"Access token will be auto-filled...",rows:3,className:"w-full px-3 py-2 text-sm font-mono border border-border rounded-lg bg-background focus:outline-none focus:border-primary resize-none"})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,d.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,d.jsx)(i.pd,{value:k,onChange:a=>l(a.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,d.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-lg border border-red-200 dark:border-red-800",children:(0,d.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:x,fullWidth:!0,disabled:o||!g.trim()||!k.trim(),children:o?"Importing...":"Import Token"}),(0,d.jsx)(i.$n,{onClick:c,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}j.propTypes={isOpen:h().bool.isRequired,onSuccess:h().func,onClose:h().func.isRequired}},51585:(a,b,c)=>{"use strict";c.d(b,{default:()=>n});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(95145),i=c(83552),j=c(99070),k=c(98153),l=c(92592),m=c(4770);function n({isOpen:a,connection:b,proxyPools:c,onSave:f,onClose:g}){let[o,p]=(0,e.useState)({name:"",priority:1,apiKey:""}),[q,r]=(0,e.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[s,t]=(0,e.useState)({accountId:""}),[u,v]=(0,e.useState)({profile:"",region:"",accessKeyId:"",sessionToken:""}),[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)(""),[A,B]=(0,e.useState)(!1),[C,D]=(0,e.useState)(null),[E,F]=(0,e.useState)(!1),[G,H]=(0,e.useState)(null),[I,J]=(0,e.useState)(!1),K=b?.authType==="oauth",L=b?.provider==="azure",M=b?.provider==="cloudflare-ai",N=l.Q2?.[b?.provider]?.credentialForm==="aws",O=!!b&&((0,l.mq)(b.provider)||(0,l.gb)(b.provider)),P=b&&l.Q2?.[b.provider]?.regions||null,Q=()=>{if(P&&y)return{...b?.providerSpecificData||{},region:y}},R=()=>({profile:u.profile.trim(),region:u.region.trim(),accessKeyId:u.accessKeyId.trim(),sessionToken:w?null:u.sessionToken.trim()}),S=async()=>{if(b?.provider){B(!0),D(null);try{let a=await fetch(`/api/providers/${b.id}/test`,{method:"POST"}),c=await a.json();D(c.valid?"success":"failed")}catch{D("failed")}finally{B(!1)}}},T=async()=>{if(b?.provider&&o.apiKey){F(!0),H(null);try{let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b.provider,apiKey:o.apiKey,...L?{providerSpecificData:q}:{},...M?{providerSpecificData:s}:{},...N?{providerSpecificData:R()}:{},...P?{providerSpecificData:Q()}:{}})}),c=await a.json();H(c.valid?"success":"failed")}catch{H("failed")}finally{F(!1)}}},U=async()=>{if(b){J(!0);try{let a={name:o.name,priority:o.priority};if(!K&&o.apiKey){a.apiKey=o.apiKey;let c="success"===G;if(!c)try{F(!0),H(null);let a=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:b.provider,apiKey:o.apiKey,...L?{providerSpecificData:q}:{},...M?{providerSpecificData:s}:{},...N?{providerSpecificData:R()}:{},...P?{providerSpecificData:Q()}:{}})});c=!!(await a.json()).valid,H(c?"success":"failed")}catch{H("failed")}finally{F(!1)}c&&(a.testStatus="active",a.lastError=null,a.lastErrorAt=null)}L&&(a.providerSpecificData={azureEndpoint:q.azureEndpoint,apiVersion:q.apiVersion,deployment:q.deployment,organization:q.organization}),M&&(a.providerSpecificData={accountId:s.accountId}),N&&(a.providerSpecificData=R()),P&&y&&(a.providerSpecificData=Q()),await f(a)}finally{J(!1)}}};return b?(0,d.jsx)(h.default,{isOpen:a,title:"Edit Connection",onClose:g,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(i.default,{label:"Name",value:o.name,onChange:a=>p({...o,name:a.target.value}),placeholder:K?"Account name":"Production Key"}),K&&b.email&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-3 rounded-lg",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-1",children:"Email"}),(0,d.jsx)("p",{className:"font-medium",children:b.email})]}),(0,d.jsx)(i.default,{label:"Priority",type:"number",value:o.priority,onChange:a=>p({...o,priority:Number.parseInt(a.target.value,10)||1})}),!K&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.default,{label:"API Key",type:"password",value:o.apiKey,onChange:a=>p({...o,apiKey:a.target.value}),placeholder:"Enter new API key",hint:"Leave blank to keep the current API key.",className:"flex-1"}),(0,d.jsx)("div",{className:"pt-6",children:(0,d.jsx)(j.default,{onClick:T,disabled:!o.apiKey||E||I,variant:"secondary",children:E?"Checking...":"Check"})})]}),G&&(0,d.jsx)(k.A,{variant:"success"===G?"success":"error",children:"success"===G?"Valid":"Invalid"})]}),L&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(i.default,{label:"Azure Endpoint",value:q.azureEndpoint,onChange:a=>r({...q,azureEndpoint:a.target.value}),placeholder:"https://your-resource.openai.azure.com",hint:"Your Azure OpenAI resource endpoint URL"}),(0,d.jsx)(i.default,{label:"Deployment Name",value:q.deployment,onChange:a=>r({...q,deployment:a.target.value}),placeholder:"gpt-4",hint:"The deployment name in your Azure resource"}),(0,d.jsx)(i.default,{label:"API Version",value:q.apiVersion,onChange:a=>r({...q,apiVersion:a.target.value}),placeholder:"2024-10-01-preview",hint:"Azure OpenAI API version to use"}),(0,d.jsx)(i.default,{label:"Organization",value:q.organization,onChange:a=>r({...q,organization:a.target.value}),placeholder:"Organization ID",hint:"Required for billing"})]})]}),N&&(0,d.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,d.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"AWS Bedrock Credentials"}),(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsx)(i.default,{label:"AWS Profile (SSO — recommended)",value:u.profile,onChange:a=>v({...u,profile:a.target.value}),placeholder:"my-sso-profile",hint:"Clear this to use static keys instead; a profile takes precedence."}),(0,d.jsx)(i.default,{label:"Region",value:u.region,onChange:a=>v({...u,region:a.target.value}),placeholder:"us-east-1"}),(0,d.jsx)(i.default,{label:"Access Key ID (only for static keys)",value:u.accessKeyId,onChange:a=>v({...u,accessKeyId:a.target.value}),placeholder:"AKIA..."}),(0,d.jsx)(i.default,{label:"Session Token (only for temporary ASIA… keys)",type:"password",value:u.sessionToken,onChange:a=>v({...u,sessionToken:a.target.value}),placeholder:"FwoGZXIvYXdz...",hint:"Leave blank to keep the saved token. Enter a new token to replace it.",disabled:w}),(0,d.jsxs)("label",{className:"flex items-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)("input",{type:"checkbox",checked:w,onChange:a=>{x(a.target.checked),a.target.checked&&v({...u,sessionToken:""})}}),"Remove saved session token"]})]})]}),P&&(0,d.jsx)(m.default,{label:"Region",value:y,onChange:a=>z(a.target.value),options:P.map(a=>({value:a.id,label:a.label}))}),!O&&!L&&!M&&(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(j.default,{onClick:S,variant:"secondary",disabled:A,children:A?"Testing...":"Test Connection"}),C&&(0,d.jsx)(k.A,{variant:"success"===C?"success":"error",children:"success"===C?"Valid":"Failed"})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(j.default,{onClick:U,variant:"contrast",fullWidth:!0,disabled:I,children:I?"Saving...":"Save"}),(0,d.jsx)(j.default,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}n.propTypes={isOpen:g().bool.isRequired,connection:g().shape({id:g().string,name:g().string,email:g().string,priority:g().number,authType:g().string,provider:g().string,providerSpecificData:g().object}),proxyPools:g().arrayOf(g().shape({id:g().string,name:g().string})),onSave:g().func.isRequired,onClose:g().func.isRequired}},53838:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(49885),f=c.n(e),g=c(53845);function h({children:a}){return(0,d.jsxs)("div",{className:"min-h-screen flex flex-col relative bg-bg transition-colors duration-500 overflow-x-hidden selection:bg-primary/20 selection:text-primary",children:[(0,d.jsx)("div",{className:"fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-[800px] h-[800px] bg-primary/5 dark:bg-primary/5 rounded-full blur-[100px] pointer-events-none z-0"}),(0,d.jsx)("div",{className:"fixed bottom-0 right-0 w-[600px] h-[600px] bg-orange-200/20 dark:bg-orange-900/10 rounded-full blur-[120px] pointer-events-none z-0 translate-y-1/3 translate-x-1/3"}),(0,d.jsx)("div",{className:"absolute top-6 right-6 z-20",children:(0,d.jsx)(g.default,{variant:"card"})}),(0,d.jsx)("main",{className:"flex-1 flex flex-col items-center justify-center p-4 sm:p-6 z-10 w-full h-full",children:a})]})}h.propTypes={children:f().node.isRequired}},53845:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(42118),f=c(71404),g=c(60525),h=c(10090);function i({className:a,variant:b="default"}){let{isDark:c,toggleTheme:j}=(0,e.D)(),k={default:(0,f.cn)("flex items-center justify-center size-10 rounded-full","text-text-muted hover:text-text-main","hover:bg-surface-2 transition-colors"),card:(0,f.cn)("flex items-center justify-center size-11 rounded-full","bg-surface/60 hover:bg-surface","border border-border","backdrop-blur-md shadow-sm hover:shadow-[var(--shadow-warm)]","text-text-muted hover:text-brand-500","transition-all group")};return(0,d.jsx)("button",{onClick:j,className:(0,f.cn)(k[b],a),"aria-label":`Switch to ${c?"light":"dark"} mode`,title:`Switch to ${c?"light":"dark"} mode`,children:c?(0,d.jsx)(g.A,{size:"1em",className:(0,f.cn)("text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12")}):(0,d.jsx)(h.A,{size:"1em",className:(0,f.cn)("text-[22px]","card"===b&&"transition-transform duration-300 group-hover:rotate-12")})})}},56110:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);function k({isOpen:a,provider:b,onSuccess:c,onClose:g}){let[h,l]=(0,f.useState)("loading"),[m,n]=(0,f.useState)(""),[o,p]=(0,f.useState)(null),[q,r]=(0,f.useState)(""),[s,t]=(0,f.useState)(null),{copied:u,copy:v}=(0,j.C)();(0,f.useRef)(!1);let w=async()=>{try{let a;t(null);try{a=new URL(q)}catch(a){throw Error("Invalid callback URL format")}let d=a.searchParams.get("code");a.searchParams.get("state");let e=a.searchParams.get("error");if(e)throw Error(a.searchParams.get("error_description")||e);if(!d)throw Error("No authorization code found in URL");let f=await fetch("/api/oauth/kiro/social-exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,codeVerifier:o.codeVerifier,provider:b})}),g=await f.json();if(!f.ok)throw Error(g.error);l("success"),c?.()}catch(a){t(a.message),l("error")}},x="google"===b?"Google":"GitHub";return(0,d.jsx)(i.aF,{isOpen:a,title:`Connect Kiro via ${x}`,onClose:g,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:["loading"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Initializing..."}),(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Setting up ",x," authentication"]})]}),"input"===h&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 1: Open this URL in your browser"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:m,readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===u?"check":"content_copy",onClick:()=>v(m,"auth_url"),children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("p",{className:"text-sm font-medium mb-2",children:"Step 2: Paste the callback URL here"}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"After authorization, copy the full URL from your browser address bar."}),(0,d.jsx)(i.pd,{value:q,onChange:a=>r(a.target.value),placeholder:"kiro://kiro.kiroAgent/authenticate-success?code=...",className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:w,fullWidth:!0,disabled:!q,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"success"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your Kiro account via ",x," has been connected."]}),(0,d.jsx)(i.$n,{onClick:g,fullWidth:!0,children:"Done"})]}),"error"===h&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:s}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:()=>l("input"),variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(i.$n,{onClick:g,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}k.propTypes={isOpen:h().bool.isRequired,provider:h().oneOf(["google","github"]).isRequired,onSuccess:h().func,onClose:h().func.isRequired}},62727:(a,b,c)=>{"use strict";c.d(b,{default:()=>o});var d=c(48249),e=c(21707),f=c(94541),g=c.n(f),h=c(67484),i=c(95145),j=c(83552),k=c(99070),l=c(83352);let m=/^[a-zA-Z0-9_.\-]+$/;function n({index:a,model:b,isFirst:c,isLast:f,onEdit:g,onMoveUp:i,onMoveDown:j,onRemove:k}){let[l,m]=(0,h.useState)(!1),[o,p]=(0,h.useState)(b),q=()=>{let a=o.trim();a&&a!==b?g(a):p(b),m(!1)};return(0,d.jsxs)("div",{className:"group flex min-w-0 items-center gap-1.5 rounded-md bg-black/[0.02] px-2 py-1 transition-colors hover:bg-black/[0.04] dark:bg-white/[0.02] dark:hover:bg-white/[0.04]",children:[(0,d.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:a+1}),l?(0,d.jsx)("input",{autoFocus:!0,value:o,onChange:a=>p(a.target.value),onBlur:q,onKeyDown:a=>{"Enter"===a.key&&q(),"Escape"===a.key&&(p(b),m(!1))},className:"min-w-0 flex-1 rounded border border-[var(--line-2)] bg-[var(--surface-2)] px-1.5 py-0.5 font-mono text-xs text-text-main outline-none"}):(0,d.jsx)("div",{className:"min-w-0 flex-1 cursor-text truncate rounded px-1.5 py-0.5 font-mono text-xs text-text-main hover:bg-black/5 dark:hover:bg-white/5",onClick:()=>m(!0),title:"Click to edit",children:b}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,d.jsx)("button",{onClick:i,disabled:c,className:`p-0.5 rounded ${c?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"arrow_upward"})}),(0,d.jsx)("button",{onClick:j,disabled:f,className:`p-0.5 rounded ${f?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"arrow_downward"})})]}),(0,d.jsx)("button",{onClick:k,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,d.jsx)(e.default,{className:"text-[12px]",children:"close"})})]})}function o({isOpen:a,combo:b,onClose:c,onSave:f,activeProviders:p,kindFilter:q=null,forcePrefix:r="",title:s}){let t=b?.name?r&&b.name.startsWith(r)?b.name.slice(r.length):b.name:"",[u,v]=(0,h.useState)(t),[w,x]=(0,h.useState)(b?.models||[]),[y,z]=(0,h.useState)(!1),[A,B]=(0,h.useState)(!1),[C,D]=(0,h.useState)(""),[E,F]=(0,h.useState)({}),G=a=>{if(!a.trim())return D("Name is required"),!1;let b=r+a;return m.test(b)?(D(""),!0):(D("Only letters, numbers, -, _ and . allowed"),!1)},H=a=>{let b=a.target.value;r&&b.startsWith(r)&&(b=b.slice(r.length)),v(b),b?G(b):D("")},I=async()=>{G(u)&&(B(!0),await f({name:r+u.trim(),models:w}),B(!1))},J=!!b;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.default,{isOpen:a,onClose:c,title:s||(J?"Edit Combo":"Create Combo"),className:g().dialog,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{children:[r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,d.jsxs)("div",{className:"flex items-stretch",children:[(0,d.jsx)("span",{className:"inline-flex items-center px-2 rounded-l border border-r-0 border-black/10 dark:border-white/10 bg-black/[0.04] dark:bg-white/[0.04] text-text-muted font-mono text-sm",children:r}),(0,d.jsx)("input",{value:u,onChange:H,placeholder:"my-combo",className:"flex-1 min-w-0 rounded-r border border-black/10 dark:border-white/10 bg-white dark:bg-black/20 px-2 py-1.5 font-mono text-sm outline-none focus:border-primary"})]}),C&&(0,d.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:C})]}):(0,d.jsx)(j.default,{label:"Combo Name",value:u,onChange:H,placeholder:"my-combo",error:C}),(0,d.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[r?`Auto-prefixed with "${r}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===w.length?(0,d.jsxs)("div",{className:"text-center py-4 border border-dashed border-black/10 dark:border-white/10 rounded-lg bg-black/[0.01] dark:bg-white/[0.01]",children:[(0,d.jsx)(e.default,{className:"text-text-muted text-xl mb-1",children:"layers"}),(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,d.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:w.map((a,b)=>(0,d.jsx)(n,{index:b,model:a,isFirst:0===b,isLast:b===w.length-1,onEdit:a=>{let c=[...w];c[b]=a,x(c)},onMoveUp:()=>(a=>{if(0===a)return;let b=[...w];[b[a-1],b[a]]=[b[a],b[a-1]],x(b)})(b),onMoveDown:()=>(a=>{if(a===w.length-1)return;let b=[...w];[b[a],b[a+1]]=[b[a+1],b[a]],x(b)})(b),onRemove:()=>x(w.filter((a,c)=>c!==b))},b))}),(0,d.jsxs)(k.default,{onClick:()=>z(!0),variant:"outline",fullWidth:!0,size:"sm",className:"mt-2",children:[(0,d.jsx)(e.default,{className:"text-[16px]",children:"add"}),"Add Model"]})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,d.jsx)(k.default,{onClick:c,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,d.jsx)(k.default,{onClick:I,fullWidth:!0,size:"sm",disabled:!u.trim()||!!C||A,children:A?"Saving...":J?"Save":"Create"})]})]})}),y&&(0,d.jsx)(l.default,{className:g().modelPicker,isOpen:y,onClose:()=>z(!1),onSelect:a=>{w.includes(a.value)||x([...w,a.value])},onDeselect:a=>{x(w.filter(b=>b!==a.value))},onSelectBatch:a=>{let b=a.map(a=>a?.value||a?.name||a).filter(Boolean);x(a=>[...new Set([...a,...b])])},onDeselectBatch:a=>{let b=new Set(a.map(a=>a?.value||a?.name||a).filter(Boolean));x(a=>a.filter(a=>!b.has(a)))},activeProviders:p,modelAliases:E,title:"Add Model to Combo",kindFilter:q,addedModelValues:w,closeOnSelect:!1})]})}},66691:(a,b,c)=>{"use strict";c.d(b,{A:()=>m});var d=c(48249),e=c(21707),f=c(49885),g=c.n(f),h=c(72738),i=c(38930),j=c(29476),k=c(40560),l=c.n(k);function m({searchQuery:a,onSearchChange:b,combos:c,groups:f,selectedModel:g,addedModelValues:k=[],onSelect:n,showSearch:o=!0,autoFocusSearch:p=!1,groupLimit:q=0,emptyLabel:r="No models found"}){let{getCaps:s}=(0,j.y)(),t=Object.entries(f),u=q>0?t.slice(0,q):t,v=c.length>0||t.length>0;return(0,d.jsxs)(d.Fragment,{children:[o?(0,d.jsxs)("div",{className:l().search,children:[(0,d.jsx)(e.default,{className:l().searchIcon,children:"search"}),(0,d.jsx)("input",{type:"text",placeholder:"Search models, providers, combos","aria-label":"Search models",value:a,onChange:a=>b(a.target.value),className:l().searchInput,autoFocus:p})]}):null,(0,d.jsxs)("div",{className:l().scroll,"data-model-scroll":!0,children:[c.length>0?(0,d.jsxs)("div",{className:l().group,children:[(0,d.jsxs)("p",{className:l().groupHead,"data-model-group":!0,children:[(0,d.jsx)(e.default,{className:l().groupIcon,children:"layers"}),(0,d.jsx)("span",{className:l().groupName,children:"Combos"}),(0,d.jsx)("span",{className:l().groupCount,children:c.length})]}),(0,d.jsx)("div",{className:l().chips,children:c.map(a=>{let b=g===a.name;return(0,d.jsx)("button",{type:"button","data-model-option":!0,"aria-pressed":b||k.includes(a.name),onClick:()=>n({id:a.name,name:a.name,value:a.name},{providerId:"combo",name:"Combos",isCombo:!0}),className:l().chip,children:(0,d.jsx)("span",{className:l().chipLabel,children:a.name})},a.id||a.name)})})]}):null,u.map(([a,b])=>(0,d.jsxs)("div",{className:l().group,children:[(0,d.jsxs)("p",{className:l().groupHead,"data-model-group":!0,children:[(0,d.jsx)(h.A,{providerId:a,src:`/providers/${a}.png`,alt:b.name,size:14,fallbackText:(b.name||a).slice(0,2).toUpperCase(),fallbackColor:b.color}),(0,d.jsx)("span",{className:l().groupName,children:b.name}),(0,d.jsx)("span",{className:l().groupCount,children:b.models.length})]}),(0,d.jsx)("div",{className:l().chips,children:b.models.map(c=>{let f=g===c.value,h=k.includes(c.value);return(0,d.jsxs)("button",{type:"button","data-model-option":!0,"aria-pressed":f||h,title:c.isPlaceholder?"Select to pre-fill, then edit the model id":void 0,onClick:()=>n(c,{providerId:a,name:b.name,color:b.color}),className:l().chip,children:[h&&!c.isPlaceholder?(0,d.jsx)(e.default,{className:l().chipCheck,children:"check"}):null,c.isPlaceholder?(0,d.jsx)(e.default,{className:l().chipHint,children:"edit"}):null,(0,d.jsx)("span",{className:l().chipLabel,children:c.name}),c.isCustom?(0,d.jsx)("span",{className:l().chipTag,children:"custom"}):null,(0,d.jsx)(i.default,{caps:s(c.value)})]},c.value)})})]},a)),v?null:(0,d.jsxs)("div",{className:l().empty,children:[(0,d.jsx)(e.default,{className:l().emptyIcon,children:"search_off"}),(0,d.jsx)("p",{children:r})]})]})]})}m.propTypes={searchQuery:g().string,onSearchChange:g().func,combos:g().array,groups:g().object,selectedModel:g().string,addedModelValues:g().arrayOf(g().string),onSelect:g().func.isRequired,showSearch:g().bool,autoFocusSearch:g().bool,groupLimit:g().number,emptyLabel:g().string}},67738:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onClose:b,onCreated:c,onSaved:f,node:g}){let j=!!g,[k,l]=(0,e.useState)({name:"",prefix:"",baseUrl:"https://api.openai.com/v1"}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(""),[s,t]=(0,e.useState)(!1),[u,v]=(0,e.useState)(null),w=async()=>{if(k.name.trim()&&k.prefix.trim()&&k.baseUrl.trim()){n(!0);try{let a=j?`/api/provider-nodes/${g.id}`:"/api/provider-nodes",b={name:k.name,prefix:k.prefix,baseUrl:k.baseUrl};j||(b.type="custom-embedding");let d=await fetch(a,{method:j?"PUT":"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}),e=await d.json();d.ok&&(j?f?.(e.node):c?.(e.node))}catch(a){console.log("Error saving custom embedding node:",a)}finally{n(!1)}}},x=async()=>{t(!0);try{let a=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:k.baseUrl,apiKey:o,type:"custom-embedding",modelId:q.trim()||void 0})}),b=await a.json();v(b)}catch{v({valid:!1,error:"Network error"})}finally{t(!1)}};return(0,d.jsx)(h.aF,{isOpen:a,title:j?"Edit Custom Embedding":"Add Custom Embedding",onClose:b,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)(h.pd,{label:"Name",value:k.name,onChange:a=>l({...k,name:a.target.value}),placeholder:"Voyage AI",hint:"Required. A friendly label for this embedding provider."}),(0,d.jsx)(h.pd,{label:"Prefix",value:k.prefix,onChange:a=>l({...k,prefix:a.target.value}),placeholder:"voyage",hint:"Required. Used as the provider prefix for model IDs (e.g. voyage/voyage-3)."}),(0,d.jsx)(h.pd,{label:"Base URL",value:k.baseUrl,onChange:a=>l({...k,baseUrl:a.target.value}),placeholder:"https://api.voyageai.com/v1",hint:"Most embedding APIs are OpenAI-compatible: Voyage, Cohere, Jina, Mistral, Together..."}),(0,d.jsx)(h.pd,{label:"API Key (for Check)",type:"password",value:o,onChange:a=>p(a.target.value)}),(0,d.jsx)(h.pd,{label:"Model ID (for Check)",value:q,onChange:a=>r(a.target.value),placeholder:"e.g. voyage-3, embed-english-v3.0, text-embedding-3-small",hint:"Required for validation. Will send a test embeddings request."}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(h.$n,{onClick:x,disabled:!o||!q.trim()||s||!k.baseUrl.trim(),variant:"secondary",children:s?"Checking...":"Check"}),(()=>{if(!u)return null;let{valid:a,error:b,dimensions:c}=u;return a?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.Ex,{variant:"success",children:"Valid"}),c&&(0,d.jsxs)("span",{className:"text-sm text-text-muted",children:[c," dims"]})]}):(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsx)(h.Ex,{variant:"error",children:"Invalid"}),b&&(0,d.jsx)("span",{className:"text-sm text-red-500",children:b})]})})()]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.$n,{onClick:w,fullWidth:!0,disabled:!k.name.trim()||!k.prefix.trim()||!k.baseUrl.trim()||m,children:m?j?"Saving...":"Creating...":j?"Save":"Create"}),(0,d.jsx)(h.$n,{onClick:b,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})})}i.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onCreated:g().func,onSaved:g().func,node:g().shape({id:g().string,name:g().string,prefix:g().string,baseUrl:g().string})}},70552:(a,b,c)=>{"use strict";c.d(b,{Q5:()=>function a(b,c=null,d=null,e=0){if(!b?.length||e>6)return null;let f=b.map(b=>{if(!b.includes("/")&&c?.[b])return a(c[b],c,d,e+1)??d?.(b)??t(null,b);let f=b.indexOf("/"),g=t(-1===f?null:b.slice(0,f),-1===f?b:b.slice(f+1)),h=d?.(b);return h?{...g,...h}:g}),g=f[0];return{vision:f.some(a=>a.vision),pdf:f.some(a=>a.pdf),audioInput:f.some(a=>a.audioInput),videoInput:f.some(a=>a.videoInput),imageOutput:f.some(a=>a.imageOutput),audioOutput:f.some(a=>a.audioOutput),search:f.some(a=>a.search),tools:f.every(a=>a.tools),reasoning:g.reasoning,thinkingFormat:g.thinkingFormat,thinkingCanDisable:g.thinkingCanDisable,thinkingRange:g.thinkingRange,contextWindow:Math.min(...f.map(a=>a.contextWindow)),maxOutput:Math.max(...f.map(a=>a.maxOutput))}},nl:()=>t});var d=c(18982);let e="[-_/:.]",f=RegExp(`(^|${e})(image|img)(${e}|$)|stable-image|gen[0-9]_image|nanobanana|imagine|t2v|i2v|flux|dall|sdxl|diffusion|embed|rerank|guard|moderation|tts|stt|whisper|voice|speech|audio`,"i"),g=RegExp(`(^|${e})(vision|vl|vlm|multimodal|omni|visual)(${e}|$)|[0-9]\\.[0-9]+v(${e}|$)|(^|${e})glm-[0-9]+v(${e}|$)|(^|[-_/:.])(llava|pixtral|internvl|cogvlm|minicpm-v|moondream|idefics|fuyu)`,"i"),h={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,thinkingEffortSupported:!1,contextWindow:2e5,maxOutput:64e3},i={"claude-fable-5-1":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5.5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-high":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-medium":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5-5-low":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingCanDisable:!1,forcedToolChoice:!1},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.7":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-7":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4.8-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-4-8-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4.6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-4-6":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-high":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-medium":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5-5-low":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3,thinkingOffType:"between_tools",forcedToolChoice:!1},"claude-sonnet-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-thinking-agentic":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"gpt-image-1":{imageOutput:!0,tools:!1},"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"glm-4.6v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:128e3,maxOutput:32768},"glm-4.5v":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"zai",contextWindow:64e3,maxOutput:16384},"glm-5.2":{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"deepseek-v4-flash-vision-exp":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-v4-1-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"deepseek-flash":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3},"vision-model":{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"coder-model":{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6},"kimi-k3":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},k3:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072},"kimi-for-coding":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-for-coding-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"kimi-k2.7-code-highspeed":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536},"muse-spark-1.2-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"muse-spark-1.3-contributor-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"union-alpha":{vision:!0,contextWindow:262144,maxOutput:131072},"space-bunny-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:524288},"space-bunny":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:524288},"big-pickle":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3},"exo-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"fledge-alpha-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072},"longcat-2.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"longcat-2.0-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"longcat-2.5-preview-free":{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072},"north-mini-code-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3,maxOutput:64e3},"ring-2.6-1t-free":{reasoning:!0,thinkingFormat:"openai",contextWindow:262e3,maxOutput:66e3},"x-preview-f-free":{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:131072}},j={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},k={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:372e3,maxOutput:128e3},l={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},m={...l,contextWindow:872e3},n={vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},o={nvidia:{"minimaxai/minimax-m2.7":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072},"minimaxai/minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:131072},"z-ai/glm-5.2":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:128e3},"deepseek-ai/deepseek-v4-pro":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536},"deepseek-ai/deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:65536}},"opencode-go":{"glm-5.3-flash":{vision:!0,videoInput:!0,pdf:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:131072},"claude-haiku-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},commandcode:{"claude-haiku-5-5":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},codex:{"gpt-6-astra":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-sol":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-luna":{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:272e3,maxOutput:128e3},"gpt-6-astra[1m]":m,"gpt-6-sol[1m]":m,"gpt-6-luna[1m]":m,"gpt-5.6-sol[1m]":m,"gpt-5.6-terra[1m]":m,"gpt-5.6-luna[1m]":m,"gpt-5.6-sol":k,"gpt-5.6-sol-review":k,"gpt-5.6-terra":l,"gpt-5.6-terra-review":l,"gpt-5.6-luna":l,"gpt-5.6-luna-review":l},kiro:{"gpt-5.6-sol":j,"gpt-5.6-terra":j,"gpt-5.6-luna":j,"gpt-5.6-sol-thinking":j,"gpt-5.6-terra-thinking":j,"gpt-5.6-luna-thinking":j,"gpt-5.6-sol-agentic":j,"gpt-5.6-terra-agentic":j,"gpt-5.6-luna-agentic":j,"gpt-5.6-sol-thinking-agentic":j,"gpt-5.6-terra-thinking-agentic":j,"gpt-5.6-luna-thinking-agentic":j},"devin-cli":{"gpt-5.4-high":n,"gpt-5.4-medium":n,"gpt-5.4-low":n,"gpt-5.5-xhigh":n,"gpt-5.5-high":n,"gpt-5.5-medium":n,"gpt-5.5-low":n},"codebuddy-cn":{"glm-5.2":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"glm-5.1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"glm-4.7":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"minimax-m3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:524288},"kimi-k2.5":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:164e3,maxOutput:32e3},"hy3-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"deepseek-v4-flash":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3},hy3:{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:192e3,maxOutput:64e3},"hy4-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:64e3},"glm-5.3":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"glm-5.3-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:131072},"kimi-k3-1":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:1048576},"kimi-k2.8-preview":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:3e5,maxOutput:131072},"deepseek-v4-pro":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216}},poolside:{"laguna-s-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3},"laguna-xs-2.1":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},"minimax-code":{"MiniMax-M3.1-Flash-Preview":{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:512e3,maxOutput:128e3},"MiniMax-M3":{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",contextWindow:512e3,maxOutput:128e3},"MiniMax-M2.7":{reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:128e3},"MiniMax-M2.7-highspeed":{reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:128e3}},nous:{"meituan/longcat-2.0:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1048756,maxOutput:262144},"meituan/longcat-2.5-preview:free":{tools:!0,vision:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1048576,maxOutput:131072},"stepfun/step-5-preview:free":{tools:!0,vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:1e6,maxOutput:64e3},"upstage/solar-mini4:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:524288,maxOutput:131072},"stepfun/step-3.7-flash:free":{tools:!0,vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:256e3},"poolside/laguna-s-2.1:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:131072},"poolside/laguna-xs-2.1:free":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:32768},"stealth/missingno":{tools:!0,reasoning:!0,thinkingFormat:"nous",contextWindow:262144,maxOutput:131072}}};o["qoder-cn"]=o.qoder,o.cx=o.codex,o.dv=o["devin-cli"],o.devin=o["devin-cli"],o["minimax-code-global"]=o["minimax-code"];let p=[{pattern:"*claude*opus-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*sonnet-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*opus-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*opus-4.8*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.6*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*sonnet-4.7*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive"}},{pattern:"*claude*haiku-5*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*haiku-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet-4*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*haiku*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*opus*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*sonnet*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*claude*fable*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude*mythos*",caps:{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget",contextWindow:1e6,maxOutput:128e3}},{pattern:"*claude-3*",caps:{vision:!0}},{pattern:"*claude*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"claude-budget"}},{pattern:"*gemini*image*",caps:{vision:!0,imageOutput:!0,contextWindow:1048576}},{pattern:"*gemini-4*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.8*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3.7*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-3*pro*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65535}},{pattern:"*gemini-3*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-level",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,search:!0,thinkingFormat:"gemini-budget",thinkingRange:{min:0,max:24576},contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini-2*",caps:{vision:!0,audioInput:!0,videoInput:!0,search:!0,contextWindow:1048576,maxOutput:65536}},{pattern:"*gemini*",caps:{vision:!0,search:!0,contextWindow:1048576}},{pattern:"*gemma*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*nanobanana*",caps:{vision:!0,imageOutput:!0}},{pattern:"*gpt-6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*image*",caps:{imageOutput:!0}},{pattern:"*gpt-5*codex*",caps:{reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-mini*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4-nano*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-5.4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:105e4,maxOutput:128e3}},{pattern:"*gpt-5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:4e5,maxOutput:128e3}},{pattern:"*gpt-4o*",caps:{vision:!0,search:!0,contextWindow:128e3,maxOutput:16384}},{pattern:"*gpt-4.1*",caps:{vision:!0,contextWindow:1e6,maxOutput:32768}},{pattern:"*gpt-4-turbo*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*gpt-4*",caps:{contextWindow:128e3}},{pattern:"*gpt-3.5*",caps:{contextWindow:16385,maxOutput:4096}},{pattern:"*gpt-oss*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1-mini*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:128e3}},{pattern:"*o1*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*o4*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:1e5}},{pattern:"*grok*image*",caps:{imageOutput:!0}},{pattern:"*grok-code*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-4.6*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{pattern:"*grok-4.5*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:64e3}},{pattern:"*grok-4*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*grok-3*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:131072}},{pattern:"*grok*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:256e3}},{pattern:"*qwen*vl*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwen*omni*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:262144,maxOutput:65536}},{pattern:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwen*max*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.5*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.6*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen3.7*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*plus*",caps:{vision:!0,reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6,maxOutput:65536}},{pattern:"*qwen*235b*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k3*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*kimi*for-coding*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,videoInput:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:65536}},{pattern:"*kimi*k2*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",contextWindow:262144,maxOutput:262144}},{pattern:"*kimi*",caps:{reasoning:!0,thinkingFormat:"kimi",contextWindow:262144}},{pattern:"*glm-5.3*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4.7*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5,maxOutput:128e3}},{pattern:"*glm-4*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*glm*",caps:{reasoning:!0,thinkingFormat:"zai",contextWindow:2e5}},{pattern:"*deepseek-v4.*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:128e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingEffortSupported:!0,contextWindow:1e6,maxOutput:384e3}},{pattern:"*reasoner*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-r*",caps:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:128e3}},{pattern:"*deepseek-chat*",caps:{contextWindow:128e3}},{pattern:"*deepseek*",caps:{reasoning:!0,thinkingFormat:"deepseek",contextWindow:128e3}},{pattern:"*minimax*image*",caps:{imageOutput:!0}},{pattern:"*minimax-m3*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",contextWindow:1e6,maxOutput:131072}},{pattern:"*minimax-m2.7*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax-m2.5*",caps:{vision:!0,reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:204800,maxOutput:131072}},{pattern:"*minimax*",caps:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:131072}},{pattern:"*mimo*v2.6*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*v2.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:262144,maxOutput:131072}},{pattern:"*llama-4*",caps:{vision:!0,contextWindow:1e6}},{pattern:"*llama*",caps:{contextWindow:128e3}},{pattern:"*codestral*",caps:{contextWindow:256e3}},{pattern:"*mistral-large*",caps:{vision:!0,contextWindow:256e3}},{pattern:"*mistral*",caps:{contextWindow:128e3}},{pattern:"*command-a-vision*",caps:{vision:!0,contextWindow:128e3}},{pattern:"*command*",caps:{contextWindow:128e3}},{pattern:"*sonar*",caps:{search:!0,contextWindow:128e3}},{pattern:"*pplx*",caps:{search:!0,contextWindow:128e3}},{pattern:"*perplexity*",caps:{search:!0,contextWindow:128e3}},{pattern:"*laguna-s-2.1*free*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*laguna-s-2.1*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:1e6,maxOutput:32e3}},{pattern:"*laguna*",caps:{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:32e3}},{pattern:"*muse*spark*",caps:{vision:!0,reasoning:!0,thinkingFormat:"openai",contextWindow:1048576,maxOutput:131072}},{pattern:"*hunyuan*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"hy3*",caps:{reasoning:!0,thinkingFormat:"hunyuan",contextWindow:262144,maxOutput:262144}},{pattern:"*step-*",caps:{reasoning:!0,thinkingFormat:"step",contextWindow:128e3}},{pattern:"*nemotron*",caps:{reasoning:!0,contextWindow:128e3}},{pattern:"*ling-*",caps:{reasoning:!0,contextWindow:128e3}}],q=["vision","pdf","audioInput","videoInput"];function r(a,b,c){let d={...h,...a},e="u"<typeof globalThis?null:globalThis.__9rCatalogSource||null;if(e){let a=e.getModalities(b,c);if(a)for(let b of q)!0===a[b]&&(d[b]=!0);let f=e.getLimits(b,c);f&&(f.contextWindow>0&&(d.contextWindow=f.contextWindow),f.maxOutput>0&&(d.maxOutput=f.maxOutput))}return!d.vision&&function(a){if(!a)return!1;let b=String(a).toLowerCase();return!f.test(b)&&g.test(b)}(c)&&(d.vision=!0),d}let s=new Set(["deepseek/deepseek-v4-pro","deepseek/deepseek-v4-flash","deepseek/deepseek-v4-flash-fast","zai-org/glm-5.3","zai-org/glm-5.2","zai-org/glm-5.2-fast","zai-org/glm-5.1","zai-org/glm-5","minimaxai/minimax-m2.7","minimax/minimax-m2.7-free","minimaxai/minimax-m2.5","xiaomi/mimo-v2.5-pro","qwen/qwen3.6-max-preview","qwen/qwen3.7-max","meituan/longcat-2.0:free","stepfun/step-3.5-flash","tencent/hy4-preview","tencent/hy3","tencent/hy3-paid","nvidia/nemotron-3-ultra-550b-a55b","poolside/laguna-s-2.1-free","inclusionai/ling-3.0-flash-free","inclusionai/ling-3.0-flash-sante:free"]);function t(a,b){var c=function(a,b){if(!b)return{...h};let c=b.includes("/")?b.split("/").pop():b;if("commandcode"===a||"cmc"===a){let a=o.commandcode;return a?.[b]?{...h,...a[b]}:a?.[c]?{...h,...a[c]}:{...h,reasoning:!0,thinkingFormat:"commandcode",thinkingEffortSupported:!0,vision:!function(a){let b=String(a||"").toLowerCase();if(s.has(b))return!0;for(let a of s){let c=a.includes("/")?a.slice(a.lastIndexOf("/")+1):a;if(b===c||b.endsWith("/"+c))return!0}return!1}(b),contextWindow:1e6,maxOutput:384e3}}if(a){let d=o[a];if(d?.[b])return{...h,...d[b]};if(d?.[c])return{...h,...d[c]}}if(i[c])return r(i[c],a,b);if(i[b])return r(i[b],a,b);for(let{pattern:e,caps:f}of p)if((0,d.gH)(e,c)||(0,d.gH)(e,b))return r(f,a,b);return r(null,a,b)}(a,b);let e=("u"<typeof globalThis?null:globalThis.__9rLimitOverrideSource||null)?.getLimits(a,b);if(!e)return c;let f={...c};return e.contextWindow>0&&(f.contextWindow=e.contextWindow),e.maxOutput>0&&(f.maxOutput=e.maxOutput),f}},72738:(a,b,c)=>{"use strict";c.d(b,{A:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(29225);function i({src:a,providerId:b,alt:c,size:f=32,className:g="",fallbackText:j="?",fallbackColor:k}){let l=function(a,b){if(b)return(0,h.HY)(b);if(!a)return null;let c=String(a).match(/^\/providers\/([^/]+)\.png$/i);return c?(0,h.HY)(c[1]):a}(a,b),[m,n]=(0,e.useState)(!1);return!l||m?(0,d.jsx)("span",{className:`inline-flex items-center justify-center font-bold rounded-lg ${g}`.trim(),style:{width:f,height:f,color:k,fontSize:Math.max(10,Math.floor(.38*f))},children:j}):(0,d.jsx)("img",{src:l,alt:c,width:f,height:f,className:g,loading:"lazy",decoding:"async",onError:()=>{let a=l.match(/^\/providers\/([^/]+)\.png$/i);a&&(0,h.Kw)(a[1]),b&&(0,h.Kw)(b),n(!0)}})}i.propTypes={src:g().string,providerId:g().string,alt:g().string,size:g().number,className:g().string,fallbackText:g().string,fallbackColor:g().string}},74812:(a,b,c)=>{"use strict";c.d(b,{CardSkeleton:()=>j,PageLoading:()=>h,Skeleton:()=>i,Spinner:()=>g,default:()=>k});var d=c(48249),e=c(71404),f=c(69357);function g({size:a="md",className:b}){return(0,d.jsx)(f.A,{className:(0,e.cn)("animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[a],b)})}function h({message:a="Loading..."}){return(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,d.jsx)(g,{size:"xl"}),(0,d.jsx)("p",{className:"mt-4 text-text-muted",children:a})]})}function i({className:a,...b}){return(0,d.jsx)("div",{className:(0,e.cn)("animate-pulse rounded-[10px] bg-surface-2",a),...b})}function j(){return(0,d.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,d.jsx)(i,{className:"h-4 w-24"}),(0,d.jsx)(i,{className:"size-10 rounded-[10px]"})]}),(0,d.jsx)(i,{className:"h-8 w-16 mb-2"}),(0,d.jsx)(i,{className:"h-3 w-20"})]})}function k({type:a="spinner",...b}){switch(a){case"page":return(0,d.jsx)(h,{...b});case"skeleton":return(0,d.jsx)(i,{...b});case"card":return(0,d.jsx)(j,{...b});default:return(0,d.jsx)(g,{...b})}}},75171:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(71404),f=c(21707);let g={default:"bg-surface-2 text-text-muted",primary:"bg-brand-500/10 text-brand-600 dark:text-brand-300",success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-red-500/10 text-red-600 dark:text-red-400",info:"bg-blue-500/10 text-blue-600 dark:text-blue-400"},h={sm:"px-2 py-0.5 text-[10px]",md:"px-2.5 py-1 text-xs",lg:"px-3 py-1.5 text-sm"};function i({children:a,variant:b="default",size:c="md",dot:j=!1,icon:k,className:l}){return(0,d.jsxs)("span",{className:(0,e.cn)("inline-flex items-center gap-1.5 rounded-full font-semibold",g[b],h[c],l),children:[j&&(0,d.jsx)("span",{className:(0,e.cn)("size-1.5 rounded-full","success"===b&&"bg-green-500","warning"===b&&"bg-yellow-500","error"===b&&"bg-red-500","info"===b&&"bg-blue-500","primary"===b&&"bg-brand-500","default"===b&&"bg-gray-500")}),k&&(0,d.jsx)(f.default,{name:k,className:"text-[14px]"}),a]})}},79346:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(21707),f=c(67484),g=c(49885),h=c.n(g),i=c(50412),j=c(50377);let k=new Set(["trae","windsurf","zed"]),l={trae:{label:"Cloud-IDE-JWT",instructions:"Sign in at trae.ai (or solo.trae.ai), open DevTools → Network, copy the Cloud-IDE-JWT token from any request's Authorization header (~14-day lifetime).",placeholder:"Paste Cloud-IDE-JWT here...",ideName:"Trae",ideOptional:!0},windsurf:{label:"Windsurf API key",instructions:'In the Windsurf/VS Code IDE, run the "Windsurf: Provide Auth Token" command, then copy the displayed sk-ws-... key.',placeholder:"Paste sk-ws-... key here...",ideName:"Windsurf",ideOptional:!1}};function m({isOpen:a,provider:b,providerInfo:c,onSuccess:g,onClose:h,oauthMeta:n,idcConfig:o}){let[p,q]=(0,f.useState)("waiting"),[r,s]=(0,f.useState)(null),[t,u]=(0,f.useState)(""),[v,w]=(0,f.useState)(null),[x,y]=(0,f.useState)(!1),[z,A]=(0,f.useState)(null),[B,C]=(0,f.useState)(!1),[D,E]=(0,f.useState)("browser"),[F,G]=(0,f.useState)(""),[H,I]=(0,f.useState)(null),J=(0,f.useRef)(null),K=(0,f.useRef)(!1);(0,f.useRef)(!1);let L=(0,f.useRef)({proxyStarted:!1,proxyProvider:null,stopSent:!1}),M=(0,f.useRef)(g),N=(0,f.useRef)(h),O=(0,f.useRef)(a);(0,f.useRef)(null);let{copied:P,copy:Q}=(0,j.C)(),[R,S]=(0,f.useState)(!1),[T,U]=(0,f.useState)("/callback?code=...");(0,f.useRef)(!1);let V=(0,f.useCallback)(async(a,c)=>{if(r)try{let d=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,redirectUri:r.redirectUri,codeVerifier:r.codeVerifier,state:c,...r.systemId?{systemId:r.systemId}:{},...n?{meta:n}:{}})}),e=await d.json();if(!d.ok)throw Error(e.error);q("success"),M.current?.()}catch(a){w(a.message),q("error")}},[r,b,n]),W=(0,f.useCallback)(async a=>{if(r?.state)try{let b=await fetch("/api/oauth/xai/manual-code",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:r.state})}),c=await b.json();if(!b.ok)throw Error(c.error);q("success"),M.current?.()}catch(a){w(a.message),q("error")}},[r]),X=(0,f.useCallback)(async(a,c,d,e,f)=>{K.current=!1,C(!0);let g=Date.now()+(Number.isFinite(f)&&f>0?f:12e4);for(;Date.now()<g;){if(K.current){console.log("[OAuthModal] Polling aborted"),C(!1);return}if(await new Promise(a=>setTimeout(a,1e3*d)),K.current){console.log("[OAuthModal] Polling aborted after sleep"),C(!1);return}try{let f=await fetch(`/api/oauth/${b}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:a,codeVerifier:c,extraData:e})}),g=await f.json();if(g.success){K.current=!0,q("success"),C(!1),M.current?.();return}if("expired_token"===g.error||"access_denied"===g.error||g.fatal)throw Error(g.errorDescription||g.error);"slow_down"===g.error&&(d=Math.min(d+5,30))}catch(a){w(a.message),q("error"),C(!1);return}}w("Authorization timeout"),q("error"),C(!1)},[b]),Y=(0,f.useCallback)(()=>{let a=L.current;a.proxyStarted&&!a.stopSent&&a.proxyProvider&&(a.stopSent=!0,fetch(`/api/oauth/${a.proxyProvider}/stop-proxy`).catch(()=>{}))},[]),Z=(0,f.useCallback)(async a=>{let b=await fetch(`/api/oauth/${a}/start-proxy`),c=await b.json();if(!b.ok||!c.success||!c.callbackUrl)throw Error(c.reason||c.error||`Failed to start ${a} callback server`);if(L.current.proxyStarted=!0,L.current.proxyProvider=a,L.current.stopSent=!1,!O.current)return void Y();let d=new URL(`/api/oauth/${a}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",c.callbackUrl);let e=await fetch(d),f=await e.json();if(!e.ok)throw Y(),Error(f.error);if(!O.current)return void Y();let g={state:f.state};f.codeVerifier&&(g.codeVerifier=f.codeVerifier),f.systemId&&(g.systemId=f.systemId);let h=await fetch(`/api/oauth/${a}/register-session`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),i=null;try{i=await h.json()}catch{i=null}if(!h.ok||i?.success===!1)throw Y(),Error(i?.error||"Failed to register login session; please retry");O.current&&(s({...f,proxyProvider:a}),q("waiting"),J.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),J.current||q("input"))},[Y]),$=async()=>{if(b)try{let a;if(w(null),k.has(b)&&"browser"===D)return void await Z(b);if(["github","kiro","kimi","kimi-coding","kilocode","codebuddy-cn","codebuddy-intl","workbuddy","qoder","qoder-cn","grok-cli","muse","glm","minimax-code","minimax-code-global","nous"].includes(b)){y(!0),q("waiting");let a=new URL(`/api/oauth/${b}/device-code`,window.location.origin);"kiro"===b&&o?.startUrl&&(a.searchParams.set("start_url",o.startUrl),o.region&&a.searchParams.set("region",o.region),a.searchParams.set("auth_method","idc"));let c=await fetch(a.toString()),d=await c.json();if(!c.ok)throw Error(d.error);A(d);let e=d.verification_uri_complete||d.verification_uri;e&&window.open(e,"_blank","noopener,noreferrer");let f="kiro"===b?{_clientId:d._clientId,_clientSecret:d._clientSecret,_region:d._region,_authMethod:d._authMethod,_startUrl:d._startUrl}:"qoder"===b||"qoder-cn"===b?{_qoderNonce:d._qoderNonce,_qoderMachineId:d._qoderMachineId,_qoderVerifier:d.codeVerifier}:"kimi"===b||"kimi-coding"===b?{_kimiDeviceId:d._kimiDeviceId}:"glm"===b?{_zcodePollToken:d._zcodePollToken}:"minimax-code"===b||"minimax-code-global"===b?{_minimaxPollByUser:d._minimaxPollByUser}:null;X(d.device_code||d.user_code,d.codeVerifier,d.interval||5,f,Number.isFinite(d.expires_in)&&d.expires_in>0?1e3*d.expires_in:void 0);return}let c=window.location.port||("https:"===window.location.protocol?"443":"80");a="codex"===b?"http://localhost:1455/auth/callback":"xai"===b?"http://127.0.0.1:56121/callback":`http://localhost:${c}/callback`;let d=new URL(`/api/oauth/${b}/authorize`,window.location.origin);d.searchParams.set("redirect_uri",a),n&&Object.entries(n).forEach(([a,b])=>{b&&d.searchParams.set(a,b)});let e=await fetch(d.toString()),f=await e.json();if(!e.ok)throw Error(f.error);let g=!1,h=!1;if("codex"===b)try{let b=new URL("/api/oauth/codex/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();g=e.success,h=!!e.serverSide}catch{g=!1}let i=!1,j=!1;if("xai"===b)try{let b=new URL("/api/oauth/xai/start-proxy",window.location.origin);b.searchParams.set("app_port",c),b.searchParams.set("state",f.state),b.searchParams.set("code_verifier",f.codeVerifier),b.searchParams.set("redirect_uri",a);let d=await fetch(b.toString()),e=await d.json();if(i=e.success,j=!!e.serverSide,!i&&"port_busy"===e.reason)throw Error("Port 56121 in use; close the conflicting process and retry")}catch(a){if(a?.message)throw a;i=!1}if(s({...f,redirectUri:a,codexServerSide:h,xaiServerSide:j}),("codex"===b&&g||"xai"===b&&i)&&(L.current.proxyStarted=!0,L.current.proxyProvider=b,L.current.stopSent=!1),!f.authUrl){if("device_code"===f.flowType)throw Error(`Provider ${b} uses device-code login but is not wired in the OAuth modal device-code list`);throw Error("No authorization URL returned from OAuth provider")}"codex"===b&&g||"xai"===b&&i||R&&"codex"!==b&&"xai"!==b?(q("waiting"),J.current=window.open(f.authUrl,"oauth_popup","width=600,height=700"),J.current||q("input")):(q("input"),window.open(f.authUrl,"_blank"))}catch(a){w(a.message),q("error")}},_=async()=>{try{if(w(null),"paste-token"===D&&l[b]){let a=F.trim();if(!a)throw Error("Missing token");let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a})}),d=await c.json();if(!c.ok)throw Error(d.error);q("success"),M.current?.();return}let a=t.trim();if(k.has(b)&&a){let c=await fetch(`/api/oauth/${b}/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,state:r?.state,...r?.redirectUri?{redirectUri:r.redirectUri}:{},...r?.codeVerifier?{codeVerifier:r.codeVerifier}:{},...r?.systemId?{systemId:r.systemId}:{}})}),d=await c.json();if(!c.ok)throw Error(d.error);q("success"),M.current?.();return}if(a.startsWith("eyJ")&&a.includes("."))return void await V(a,null);if("xai"===b&&a&&!a.includes("://")&&!a.includes("?")&&!a.includes("code="))return void await W(a);if("kimchi"===b&&a&&!a.includes("://")&&!a.includes("?"))return void await V(a,null);let c=new URL(a),d=c.searchParams.get("code"),e=c.searchParams.get("token"),f=c.searchParams.get("state"),g=c.searchParams.get("error");if(g)throw Error(c.searchParams.get("error_description")||g);if(!d&&!e)throw Error("xai"===b?"Paste the callback URL or copied xAI code":"kimchi"===b?"No Kimchi token found in URL":"No authorization code found in URL");await V(e||d,f)}catch(a){w(a.message),q("error")}},aa=(0,f.useCallback)(()=>{Y(),N.current()},[Y]);if(!b||!c)return null;let ab="xai"===b,ac="kimchi"===b,ad=z?.verification_uri_complete||z?.verification_uri||"",ae=ab?"Connect Grok Build OAuth":`Connect ${c.name}`,af=ab?"http://127.0.0.1:56121/callback?code=... or copied code":ac?`${T.replace("code=...","token=...")} or copied token`:T;return(0,d.jsx)(i.aF,{isOpen:a,title:ae,onClose:aa,size:"lg",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[k.has(b)&&("waiting"===p||"input"===p||"error"===p)&&(0,d.jsxs)(d.Fragment,{children:[l[b]&&(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",onClick:()=>{E("browser"),w(null),q("waiting"),$()},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"browser"===D?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83C\uDF10 Sign in with browser"}),(0,d.jsx)("button",{type:"button",onClick:()=>{E("paste-token"),w(null),q("input")},className:`flex-1 rounded-lg border px-3 py-2 text-sm transition-colors ${"paste-token"===D?"border-primary bg-primary/10 text-primary":"border-border text-text-muted hover:text-primary"}`,children:"\uD83D\uDD11 Paste token"})]}),"browser"===D&&(0,d.jsxs)(d.Fragment,{children:["waiting"===p&&(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:"Waiting for browser authorization…"})]}),"input"===p&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"Popup was blocked. After authorizing in the browser, paste the full callback URL here:"}),(0,d.jsx)(i.pd,{value:t,onChange:a=>u(a.target.value),placeholder:"http://127.0.0.1:.../callback?...",className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!t,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),"paste-token"===D&&l[b]&&(0,d.jsxs)("div",{className:"space-y-3",children:[H&&!H.installed&&(0,d.jsxs)("div",{className:`px-3 py-2 rounded-lg text-sm ${l[b].ideOptional?"bg-blue-500/10 text-blue-700 dark:text-blue-300":"bg-yellow-500/10 text-yellow-700 dark:text-yellow-300"}`,children:[l[b].ideName," IDE not detected.",l[b].ideOptional?" You can still grab the token from DevTools.":` Install ${l[b].ideName} IDE to get the token, or use "Sign in with browser".`]}),(0,d.jsx)("p",{className:"text-sm text-text-muted",children:l[b].instructions}),(0,d.jsx)(i.pd,{value:F,onChange:a=>G(a.target.value),placeholder:l[b].placeholder,className:"font-mono text-xs"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!F,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]}),("waiting"===p||"input"===p)&&!x&&!k.has(b)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 border border-border rounded-lg bg-sidebar/50",children:[(0,d.jsx)(e.default,{className:"text-base text-primary animate-spin",children:"progress_activity"}),(0,d.jsx)("span",{className:"text-sm",children:ab?"Waiting for Grok Build OAuth…":"Waiting for popup authorization…"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3 my-1",children:[(0,d.jsx)("div",{className:"flex-1 h-px bg-border"}),(0,d.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wider",children:"Or paste callback URL manually"}),(0,d.jsx)("div",{className:"flex-1 h-px bg-border"})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 1: Open this ",ab?"Grok Build OAuth URL":"URL"," in your browser"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.pd,{value:r?.authUrl||"",readOnly:!0,className:"flex-1 font-mono text-xs"}),(0,d.jsx)(i.$n,{variant:"secondary",icon:"auth_url"===P?"check":"content_copy",onClick:()=>Q(r?.authUrl,"auth_url"),disabled:!r?.authUrl,children:"Copy"})]})]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("p",{className:"text-sm font-medium mb-2",children:["Step 2: Paste the ","xai"===b?"callback URL or copied code":ac?"callback URL or copied token":"callback URL"," here"]}),(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"xai"===b?"If xAI shows a code instead of redirecting, paste that code here.":ac?"After authorization, copy the full callback URL or token from your browser.":"After authorization, copy the full URL from your browser."}),(0,d.jsx)(i.pd,{value:t,onChange:a=>u(a.target.value),placeholder:af,className:"font-mono text-xs"})]})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:_,fullWidth:!0,disabled:!t,children:"Connect"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]}),"waiting"===p&&x&&z&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"text-center py-4",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Visit the login URL below and authorize:"}),(0,d.jsxs)("div",{className:"bg-sidebar p-4 rounded-lg mb-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Login URL"}),(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("code",{className:"flex-1 text-sm break-all",children:ad}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"login_url"===P?"check":"content_copy",onClick:()=>Q(ad,"login_url"),disabled:!ad}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"open_in_new",onClick:()=>window.open(ad,"_blank","noopener,noreferrer"),disabled:!ad,children:"Open"})]})]}),z.user_code&&(0,d.jsxs)("div",{className:"bg-primary/10 p-4 rounded-lg",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-1",children:"Your Code"}),(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,d.jsx)("p",{className:"text-2xl font-mono font-bold text-primary",children:z.user_code}),(0,d.jsx)(i.$n,{size:"sm",variant:"ghost",icon:"user_code"===P?"check":"content_copy",onClick:()=>Q(z.user_code,"user_code")})]})]})]}),B&&(0,d.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm text-text-muted",children:[(0,d.jsx)(e.default,{className:"animate-spin",children:"progress_activity"}),"Waiting for authorization..."]})]}),"success"===p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-green-600",children:"check_circle"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connected Successfully!"}),(0,d.jsxs)("p",{className:"text-sm text-text-muted mb-4",children:["Your ",c.name," account has been connected."]}),(0,d.jsx)(i.$n,{onClick:aa,fullWidth:!0,children:"Done"})]}),"error"===p&&(0,d.jsxs)("div",{className:"text-center py-6",children:[(0,d.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",children:(0,d.jsx)(e.default,{className:"text-3xl text-red-600",children:"error"})}),(0,d.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Connection Failed"}),(0,d.jsx)("p",{className:"text-sm text-red-600 mb-4",children:v}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(i.$n,{onClick:$,variant:"secondary",fullWidth:!0,children:"Try Again"}),(0,d.jsx)(i.$n,{onClick:aa,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}m.propTypes={isOpen:h().bool.isRequired,provider:h().string,providerInfo:h().shape({name:h().string}),onSuccess:h().func,onClose:h().func.isRequired,oauthMeta:h().object,idcConfig:h().shape({startUrl:h().string,region:h().string})}},79488:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412);function i({isOpen:a,onSuccess:b,onClose:c}){let[f,g]=(0,e.useState)(""),[j,k]=(0,e.useState)(!1),[l,m]=(0,e.useState)(null),[n,o]=(0,e.useState)(!1),p=async()=>{if(!f.trim())return void m("Please paste your cookie");k(!0),m(null);try{let a=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:f.trim()})}),c=await a.json();if(!a.ok)throw Error(c.error||"Authentication failed");o(!0),setTimeout(()=>{b?.(),q()},1500)}catch(a){m(a.message)}finally{k(!1)}},q=()=>{g(""),m(null),o(!1),c?.()};return(0,d.jsx)(h.aF,{isOpen:a,onClose:q,title:"iFlow Cookie Authentication",children:(0,d.jsx)("div",{className:"space-y-4",children:n?(0,d.jsxs)("div",{className:"text-center py-8",children:[(0,d.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,d.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,d.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,d.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,d.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,d.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,d.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,d.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,d.jsx)("li",{children:"Login to your account"}),(0,d.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,d.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,d.jsx)("li",{children:"Paste it below"})]})]})]}),(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,d.jsx)("textarea",{value:f,onChange:a=>g(a.target.value),placeholder:"BXAuth=xxx; ...",className:"w-full px-3 py-2 bg-surface-secondary border border-border rounded-lg text-sm text-text-primary placeholder-text-muted focus:outline-none focus:ring-2 focus:ring-primary resize-none",rows:4,disabled:j})]}),l&&(0,d.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,d.jsx)("p",{className:"text-sm text-error",children:l})}),(0,d.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:q,disabled:j,fullWidth:!0,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:p,loading:j,fullWidth:!0,children:"Authenticate"})]})]})})})}i.propTypes={isOpen:g().bool.isRequired,onSuccess:g().func,onClose:g().func}},83352:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(49885),g=c.n(f),h=c(95145),i=c(66691),j=c(88535);function k({isOpen:a,onClose:b,onSelect:c,onDeselect:f,selectedModel:g,activeProviders:l=[],title:m="Select Model",modelAliases:n={},kindFilter:o=null,capFilter:p=null,addedModelValues:q=[],closeOnSelect:r=!0,className:s="p-4!",portal:t=!1,notice:u="Click to add, click again to remove. Changes are saved automatically."}){let{visibleGroups:v,filteredCombos:w,searchQuery:x,setSearchQuery:y}=(0,j.c)({isOpen:a,activeProviders:l,modelAliases:n,kindFilter:o,capFilter:p,addedModelValues:q});return(0,d.jsxs)(h.default,{isOpen:a,onClose:()=>{b(),y("")},title:m,size:"md",className:s,portal:t,footer:null,children:[u?(0,d.jsxs)("div",{"data-model-notice":!0,className:"flex items-center gap-2 mb-3 px-2.5 py-2 bg-primary/8 border border-primary/20 rounded-lg text-xs text-text-muted",children:[(0,d.jsx)(e.default,{className:"text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,d.jsx)("span",{children:u})]}):null,(0,d.jsx)(i.A,{searchQuery:x,onSearchChange:y,combos:w,groups:v,selectedModel:g,addedModelValues:q,onSelect:(a,d)=>{let e=a?.value||a?.name||a,g=q.includes(e),h=d?{...a,providerId:d.providerId,providerName:d.name,providerColor:d.color,isCombo:!0===d.isCombo}:{...a};g&&f?f(h):c(h),r&&(b(),y(""))}})]})}k.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSelect:g().func.isRequired,onDeselect:g().func,selectedModel:g().string,activeProviders:g().arrayOf(g().shape({provider:g().string.isRequired})),title:g().string,modelAliases:g().object,kindFilter:g().string,capFilter:g().string,addedModelValues:g().arrayOf(g().string),closeOnSelect:g().bool,className:g().string,portal:g().bool,notice:g().string}},83552:(a,b,c)=>{"use strict";c.d(b,{default:()=>h});var d=c(48249),e=c(71404),f=c(67484),g=c(21707);function h({label:a,type:b="text",placeholder:c,value:i,onChange:j,error:k,hint:l,icon:m,disabled:n=!1,required:o=!1,className:p,inputClassName:q,hintClassName:r,id:s,...t}){let u=(0,f.useId)(),v=s||u,w=`${v}-message`;return(0,d.jsxs)("div",{className:(0,e.cn)("flex flex-col gap-1.5",p),children:[a&&(0,d.jsxs)("label",{htmlFor:v,className:"text-xs font-mono text-[var(--text-2)] uppercase tracking-wider",children:[a,o&&(0,d.jsx)("span",{className:"text-[var(--danger)] ml-1",children:"*"})]}),(0,d.jsxs)("div",{className:"relative",children:[m&&(0,d.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[var(--text-3)]",children:(0,d.jsx)(g.default,{name:m,className:"text-[18px]"})}),(0,d.jsx)("input",{id:v,"aria-invalid":!!k||void 0,"aria-describedby":k||l?w:void 0,type:b,placeholder:c,value:i,onChange:j,disabled:n,className:(0,e.cn)("w-full py-2 px-3 text-xs sm:text-sm text-[var(--text)] bg-[var(--surface-2)] rounded-[var(--r1)]","border border-[var(--line-2)] placeholder-[var(--text-3)]","focus:outline-none focus:border-[var(--accent-line)] focus:ring-1 focus:ring-[var(--accent-line)]","transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed","text-[16px] sm:text-sm",m&&"pl-9",k&&"border-[var(--danger)] focus:border-[var(--danger)] focus:ring-[var(--danger)]/30",q),...t})]}),k&&(0,d.jsxs)("p",{id:w,className:"text-xs text-[var(--danger)] flex items-center gap-1 font-mono",children:[(0,d.jsx)(g.default,{name:"error",className:"text-[14px]"}),k]}),l&&!k&&(0,d.jsx)("p",{id:w,className:(0,e.cn)("text-xs text-[var(--text-3)] font-mono",r),children:l})]})}},84849:(a,b,c)=>{"use strict";c.d(b,{A:()=>e});var d=c(48249);function e({size:a=36,className:b="",alt:c=""}){return(0,d.jsx)("img",{src:"/brand/jrouter.svg",alt:c,width:a,height:a,className:b,loading:"eager",decoding:"async"})}},85306:(a,b,c)=>{"use strict";c.d(b,{default:()=>m});var d=c(48249),e=c(21707),f=c(67484),g=c(19099),h=c(41371),i=c(71404),j=c(42196),k=c(32456);let l=["/dashboard","/dashboard/endpoint","/dashboard/providers","/dashboard/combos","/dashboard/playground","/dashboard/usage","/dashboard/quota","/dashboard/token-saver","/dashboard/cli-tools","/dashboard/skills"];function m({children:a}){let[b,c]=(0,f.useState)(!1),[n,o]=(0,f.useState)(!1),p=(0,g.usePathname)(),q=(0,h.i)(a=>a.notifications),r=(0,h.i)(a=>a.removeNotification),s=(0,f.useCallback)(()=>{o(a=>{let b=!a;try{localStorage.setItem("jrouter_sidebar_collapsed",String(b))}catch{}return b})},[]),t="/dashboard/basic-chat"===p||"/dashboard/playground"===p,u=l.includes(p)||p.startsWith("/dashboard/cli-tools/");return(0,d.jsxs)("div",{className:`flex w-full overflow-hidden bg-bg ${"/dashboard/playground"===p?"h-dvh":"h-screen"}`,children:[(0,d.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:q.map(a=>{var b;let c="success"===(b=a.type)?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--pos)]",icon:"check_circle"}:"error"===b?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--danger)]",icon:"error"}:"warning"===b?{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--warn)]",icon:"warning"}:{wrapper:"border-[var(--line-2)] bg-[var(--surface)] text-[var(--text)]",icon:"info"};return(0,d.jsx)("div",{className:`rounded-[var(--r1)] border px-3 py-2.5 shadow-[var(--shadow-pop)] backdrop-blur-sm ${c.wrapper}`,children:(0,d.jsxs)("div",{className:"flex items-start gap-2",children:[(0,d.jsx)(e.default,{className:"text-[18px] leading-5",children:c.icon}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[a.title?(0,d.jsx)("p",{className:"text-xs font-semibold mb-0.5 text-[var(--text)]",children:a.title}):null,(0,d.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words text-[var(--text-2)]",children:a.message})]}),a.dismissible?(0,d.jsx)("button",{type:"button",onClick:()=>r(a.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,d.jsx)(e.default,{className:"text-[16px]",children:"close"})}):null]})},a.id)})}),b&&(0,d.jsx)("div",{className:"fixed inset-0 z-40 bg-black/50 backdrop-blur-xs lg:hidden",onClick:()=>c(!1)}),(0,d.jsx)("div",{className:(0,i.cn)("hidden lg:flex transition-[width,opacity] duration-200 ease-in-out shrink-0 overflow-hidden",n?"w-0 opacity-0 pointer-events-none":"w-60 opacity-100"),children:(0,d.jsx)(j.default,{onToggleCollapse:s,isCollapsed:n})}),(0,d.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${b?"translate-x-0":"-translate-x-full"}`,children:(0,d.jsx)(j.default,{onClose:()=>c(!1)})}),(0,d.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-150 isolate bg-bg",children:[(0,d.jsx)(k.default,{onMenuClick:s,isSidebarCollapsed:n},p),(0,d.jsx)("div",{className:`flex-1 custom-scrollbar ${u?"dashboard-grid-bg":""} ${t?"flex flex-col min-h-0 overflow-hidden":"overflow-y-auto p-6 lg:p-8"}`,children:(0,d.jsx)("div",{className:t?"flex-1 min-h-0 w-full flex flex-col":"page",children:a})})]})]})}},88535:(a,b,c)=>{"use strict";c.d(b,{c:()=>p});var d=c(67484),e=c(92592),f=c(91431),g=c(29476);let h=[...Object.keys(e.zN),...Object.keys(e.IS),...Object.keys(e.nJ),...Object.keys(e.fg)],i=Object.keys(e.IS).filter(a=>e.IS[a].noAuth),j=["cursor","cline","clinepass","zed"],k=new Set(["webSearch","webFetch"]),l=new Set(["image","tts","stt","embedding","imageToText"]),m=new Set(["tts","image","webFetch"]),n=[];function o(a,b,c){let[e,f]=(0,d.useState)([]);return(a?(b??[]).join("|"):"")?e:n}function p({isOpen:a=!0,activeProviders:b=[],modelAliases:c={},kindFilter:n=null,capFilter:q=null,addedModelValues:r=[]}={}){let{getCaps:s}=(0,g.y)(),[t,u]=(0,d.useState)([]),[v,w]=(0,d.useState)([]),[x,y]=(0,d.useState)([]),[z,A]=(0,d.useState)({}),[B,C]=(0,d.useState)(""),D=(0,d.useMemo)(()=>n?b.filter(a=>{let b=e.Q2[a.provider];return(b?.serviceKinds||["llm"]).includes(n)}):b,[b,n]),E=(0,d.useMemo)(()=>{let a=Object.fromEntries(j.map(a=>[a,[]]));for(let c of b)c?.id&&Object.prototype.hasOwnProperty.call(a,c.provider)&&a[c.provider].push(c.id);return a},[b]),F=o(a,E.cursor,"Cursor"),G=o(a,E.cline,"Cline"),H=o(a,E.clinepass,"ClinePass"),I=o(a,E.zed,"Zed"),J=(0,d.useMemo)(()=>({...e.zN,...e.IS,...e.nJ,...e.fg}),[]),K=(0,d.useMemo)(()=>{let a={},d=[...new Set([...D.map(a=>a.provider),...n?i.filter(a=>(e.Q2[a]?.serviceKinds||["llm"]).includes(n)):i,...n?[]:x.map(a=>a.providerAlias).filter(a=>(0,e.mq)(a)||(0,e.gb)(a))])].sort((a,b)=>{let c=h.indexOf(a),d=h.indexOf(b);return(-1===c?999:c)-(-1===d?999:d)}),g=Object.entries(c).filter(([,a])=>"string"==typeof a&&a.length>0&&!a.startsWith("/")&&!a.includes("://"));return d.forEach(c=>{let d=(0,e.wG)(c),h=J[c]||{name:c,color:"#666"},i=(0,e.mq)(c)||(0,e.gb)(c);if(n&&k.has(n)){a[c]={name:h.name,alias:d,color:h.color,models:[{id:c,name:h.name,value:c}]};return}if(h.passthroughModels){let b=g.filter(([,a])=>a.startsWith(`${d}/`)).map(([a,b])=>({id:b.replace(`${d}/`,""),name:a,value:b})),e=x.filter(a=>a.providerAlias===d).map(a=>({id:a.id,name:a.name||a.id,value:`${d}/${a.id}`,kind:(0,f.CP)(a),isCustom:!0})),i=b;if(n&&l.has(n)){let a=e.filter(a=>(0,f.CP)(a)===n);0===(i=[...a,...(0,f.KC)(c).filter(a=>(0,f.CP)(a)===n).map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})).filter(b=>!a.some(a=>a.value===b.value))]).length&&m.has(n)&&(h.serviceKinds||["llm"]).includes(n)&&(i=[{id:c,name:h.name,value:d}])}else{let a=e.filter(a=>!(0,f.CP)(a)||"llm"===(0,f.CP)(a)),g=new Set([...b,...a].map(a=>a.value)),h=(0,f.KC)(c).filter(a=>!(0,f.CP)(a)||"llm"===(0,f.CP)(a)).map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})).filter(a=>!g.has(a.value));i=[...a,...b.filter(b=>!a.some(a=>a.value===b.value)),...h]}if(i.length>0){let b=v.find(a=>a.id===c);a[c]={name:b?.name||h.name,alias:d,color:h.color,models:i}}}else if(i){if(n&&l.has(n))return;let d=b.find(a=>a.provider===c),e=v.find(a=>a.id===c),f=e?.name||d?.name||h.name,i=d?.providerSpecificData?.prefix||e?.prefix||c,j=g.filter(([,a])=>a.startsWith(`${c}/`)).map(([a,b])=>({id:b.replace(`${c}/`,""),name:a,value:`${i}/${b.replace(`${c}/`,"")}`})),k=x.filter(a=>a.providerAlias===c).map(a=>({id:a.id,name:a.name||a.id,value:`${i}/${a.id}`,isCustom:!0})),m=new Set(j.map(a=>a.value)),o=[...j,...k.filter(a=>!m.has(a.value))],p=o.length>0?o:[{id:`__placeholder__${c}`,name:`${i}/model-id`,value:`${i}/model-id`,isPlaceholder:!0}];a[c]={name:f,alias:i,color:h.color,models:p,isCustom:!0,hasModels:o.length>0}}else{var j;let b="cursor"===c?F:"cline"===c?G:"clinepass"===c?H:"zed"===c?I:[],e=b.length>0?b:(0,f.KC)(c),i=new Set(e.map(a=>a.id)),k=e.length>0,o=g.filter(([a,b])=>b.startsWith(`${d}/`)&&(!k||a===b.replace(`${d}/`,""))&&!i.has(b.replace(`${d}/`,""))).map(([a,b])=>({id:b.replace(`${d}/`,""),name:a,value:b,isCustom:!0})),p=new Set(o.map(a=>a.id)),q=x.filter(a=>a.providerAlias===d&&!i.has(a.id)&&!p.has(a.id)).map(a=>({id:a.id,name:a.name||a.id,value:`${d}/${a.id}`,isCustom:!0})),r=[...e.map(a=>({id:a.id,name:a.name,value:`${d}/${a.id}`,kind:(0,f.CP)(a)})),...o,...q],s=new Set,t=(j=r.filter(a=>!s.has(a.value)&&(s.add(a.value),!0)),n?l.has(n)?j.filter(a=>a.isPlaceholder||(0,f.CP)(a)===n):j:j.filter(a=>a.isPlaceholder||a.isCustom||!(0,f.CP)(a)||"llm"===(0,f.CP)(a)));0===t.length&&n&&m.has(n)&&(h.serviceKinds||["llm"]).includes(n)&&(t=[{id:c,name:h.name,value:d}]),t.length>0&&(a[c]={name:h.name,alias:d,color:h.color,models:t})}}),Object.entries(a).forEach(([b,c])=>{let d=new Set([...z[(0,e.wG)(b)]||[],...z[b]||[]]);0!==d.size&&(c.models=c.models.filter(a=>!d.has(a.id)),0===c.models.length&&delete a[b])}),a},[D,c,J,v,x,z,n,b,F,G,H,I]),L=(0,d.useMemo)(()=>{if(n||q)return[];if(!B.trim())return t;let a=B.toLowerCase();return t.filter(b=>b.name.toLowerCase().includes(a))},[t,B,n,q]),M=(0,d.useMemo)(()=>{let a=B.trim().toLowerCase(),b={};return Object.entries(K).forEach(([c,d])=>{let e=d.models;if(!q||0!==(e=e.filter(a=>s(a.value)?.[q]===!0)).length){var f,g;if(a){let b=d.name.toLowerCase().includes(a);if(0===(e=e.filter(b=>b.name.toLowerCase().includes(a)||b.id.toLowerCase().includes(a))).length&&!b)return}b[c]={...d,models:(f=e,g=r,g?.length?[...f.filter(a=>g.includes(a.value)).sort((a,b)=>a.name.localeCompare(b.name)),...f.filter(a=>!g.includes(a.value)).sort((a,b)=>a.name.localeCompare(b.name))]:[...f].sort((a,b)=>a.name.localeCompare(b.name)))}}}),b},[K,B,q,r,s]);return{groups:K,visibleGroups:M,filteredCombos:L,searchQuery:B,setSearchQuery:C,providerNodes:v,customModels:x}}},91099:(a,b,c)=>{"use strict";c.d(b,{default:()=>g});var d=c(48249),e=c(71404),f=c(21707);function g({options:a=[],value:b,onChange:c,size:h="md",className:i,"aria-label":j,...k}){let l={sm:"min-h-7 px-2.5 text-xs",md:"min-h-8 px-3 text-xs",lg:"min-h-10 px-4 text-sm"};return(0,d.jsx)("div",{role:"group","aria-label":j,className:(0,e.cn)("inline-flex max-w-full min-w-0 items-center gap-0.5 overflow-x-auto","rounded-[var(--r1)] bg-[var(--surface-2)] p-0.5",i),...k,children:a.map(a=>{let g=b===a.value;return(0,d.jsxs)("button",{type:"button","aria-pressed":g,title:a.title,onClick:()=>c(a.value),className:(0,e.cn)("inline-flex shrink-0 items-center justify-center gap-1.5 rounded-[var(--r1)]","font-mono font-medium whitespace-nowrap transition-colors duration-150 cursor-pointer",l[h],g?"bg-[var(--surface)] text-[var(--text)] shadow-[var(--shadow-soft)]":"text-[var(--text-2)] hover:text-[var(--text)]"),children:[a.icon&&(0,d.jsx)(f.default,{name:a.icon,className:"text-[14px]"}),a.label]},a.value)})})}},91809:(a,b,c)=>{"use strict";c.d(b,{default:()=>k});var d=c(48249),e=c(21707),f=c(67484),g=c(50412),h=c(98153);function i(a=""){let b=a.toUpperCase();return b.includes("OK")||b.includes("SUCCESS")?"success":b.includes("PARTIAL")||b.includes("WARN")?"warning":b.includes("FAIL")||b.includes("ERR")?"error":"default"}let j=[{value:"table",label:"Table",icon:"table_rows"},{value:"cards",label:"Cards",icon:"grid_view"}];function k(){let[a,b]=(0,f.useState)([]),[c,k]=(0,f.useState)(!0),[l,m]=(0,f.useState)(!0),[n,o]=(0,f.useState)("table");return(0,f.useCallback)(async()=>{try{let a=await fetch("/api/usage/request-logs");if(a.ok){let c=await a.json();b(c)}}catch(a){console.error("Failed to fetch logs:",a)}},[]),(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)(e.default,{className:"text-[18px] text-[var(--text-3)]",children:"list_alt"}),(0,d.jsx)("h2",{className:"text-base sm:text-lg font-semibold tracking-tight text-[var(--text)]",children:"Request Logs"})]}),(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)(g.Iz,{options:j,value:n,onChange:o,size:"sm","aria-label":"Log view"}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-xs font-mono text-[var(--text-2)]",children:[(0,d.jsx)("span",{children:"Auto (3s)"}),(0,d.jsx)(g.lM,{size:"sm",checked:l,onChange:m,"aria-label":"Auto-refresh request logs"})]})]})]}),(0,d.jsx)("div",{className:"rounded-[var(--r3)] bg-[var(--surface)] border border-[var(--line)] shadow-[var(--shadow-card)] overflow-hidden",children:c&&0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-xs font-mono text-[var(--text-3)]",children:"Loading logs..."}):0===a.length?(0,d.jsx)("div",{className:"p-8 text-center text-xs font-mono text-[var(--text-3)]",children:"No logs recorded yet."}):"cards"===n?(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 p-4",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6];return(0,d.jsxs)("div",{className:"flex flex-col justify-between p-3.5 rounded-[var(--r2)] bg-[var(--surface-2)]/60 border border-[var(--line)] shadow-xs font-mono text-xs",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-2",children:[(0,d.jsx)("span",{className:"text-[11px] text-[var(--text-3)]",children:c[0]}),(0,d.jsx)(h.A,{variant:i(e),dot:!1,children:e})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-1 mb-2",children:[(0,d.jsx)("span",{className:"font-semibold text-[var(--text)] truncate",title:c[1],children:c[1]}),(0,d.jsxs)("div",{className:"flex items-center gap-2 text-[11px] text-[var(--text-3)]",children:[(0,d.jsx)("span",{className:"px-1.5 py-0.2 rounded-[var(--r1)] bg-[var(--surface)] border border-[var(--line)] uppercase",children:c[2]}),(0,d.jsx)("span",{className:"truncate",title:c[3],children:c[3]})]})]}),(0,d.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t border-[var(--line)] text-[11px]",children:[(0,d.jsx)("span",{className:"text-[var(--text-3)]",children:"In / Out:"}),(0,d.jsxs)("span",{className:"u-tnum text-[var(--text)]",children:[(0,d.jsx)("span",{className:"text-[var(--text)]",children:c[4]})," ↑ ",(0,d.jsx)("span",{className:"text-[var(--pos)]",children:c[5]})," ↓"]})]})]},b)})}):(0,d.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:(0,d.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,d.jsx)("thead",{className:"sticky top-0 bg-[var(--surface-2)] border-b border-[var(--line)] z-10 text-[var(--text-3)] text-[11px] uppercase tracking-[0.05em]",children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"DateTime"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Model"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Provider"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)]",children:"Account"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)] text-right",children:"In"}),(0,d.jsx)("th",{className:"px-3 py-2 border-r border-[var(--line)] text-right",children:"Out"}),(0,d.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,d.jsx)("tbody",{className:"divide-y divide-[var(--line)]/50",children:a.map((a,b)=>{let c=a.split(" | ");if(c.length<7)return null;let e=c[6];return(0,d.jsxs)("tr",{className:"hover:bg-[var(--surface-hover)]/40 transition-colors",children:[(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-[var(--text-3)]",children:c[0]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] font-medium text-[var(--text)]",children:c[1]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)]",children:(0,d.jsx)(h.A,{dot:!1,children:c[2]})}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] truncate max-w-[150px] text-[var(--text-2)]",title:c[3],children:c[3]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-right u-tnum text-[var(--text)]",children:c[4]}),(0,d.jsx)("td",{className:"px-3 py-1.5 border-r border-[var(--line)] text-right u-tnum text-[var(--pos)]",children:c[5]}),(0,d.jsx)("td",{className:"px-3 py-1.5",children:(0,d.jsx)(h.A,{variant:i(e),dot:!1,children:e})})]},b)})})]})})}),(0,d.jsx)("div",{className:"text-[11px] font-mono text-[var(--text-3)]",children:"Logs loaded from request history database."})]})}},91937:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(31417),e=c(12020);let f=null,g=(0,d.v)((a,b)=>({settings:null,loading:!1,error:null,lastFetched:0,invalidate:()=>a({lastFetched:0}),fetchSettings:async({force:c=!1}={})=>{let{lastFetched:d,settings:g}=b();return!c&&g&&Date.now()-d<e.U5?g:f||(a({loading:!0,error:null}),f=(async()=>{try{let b=await fetch("/api/settings"),c=await b.json();if(b.ok)return a({settings:c,loading:!1,lastFetched:Date.now()}),c;a({error:c.error,loading:!1})}catch(b){a({error:"Failed to fetch settings",loading:!1})}finally{f=null}return null})())},patchSettings:async c=>{try{let d=await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)});if(!d.ok)return null;let e=await d.json();return a({settings:{...b().settings,...e},lastFetched:Date.now()}),e}catch{return null}}}))},94541:a=>{a.exports={dialog:"DashboardControls_dialog__YyPS4",formScope:"DashboardControls_formScope__ID02o",fields:"DashboardControls_fields__IY485",iconButton:"DashboardControls_iconButton__v_EJw",modelPicker:"DashboardControls_modelPicker__BheYV DashboardControls_dialog__YyPS4"}},95145:(a,b,c)=>{"use strict";c.d(b,{ConfirmModal:()=>l,default:()=>k});var d=c(48249),e=c(67484),f=c(74429),g=c(71404),h=c(99070),i=c(32971),j=c(21707);function k({isOpen:a,onClose:b,title:c,children:f,footer:h,size:l="md",closeOnOverlay:m=!0,showTrafficLights:n=!0,className:o,trapFocus:p=!1}){let q=(0,e.useId)(),r=(0,e.useRef)(null);return a?(0,d.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,d.jsx)("div",{className:"absolute inset-0 bg-black/72 backdrop-blur-md fade-in",onClick:m?b:void 0}),(0,d.jsxs)("div",{ref:r,tabIndex:p?-1:void 0,role:"dialog","aria-modal":"true","aria-labelledby":c?q:void 0,className:(0,g.cn)("relative w-full bg-[var(--surface)]","border border-[var(--line-2)]","rounded-[var(--r4)] shadow-[var(--shadow-pop)]","fade-in text-[var(--text)]",{sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-4xl"}[l],o),children:[(c||n)&&(0,d.jsxs)("div",{className:"flex items-center justify-between px-5 py-3.5 border-b border-[var(--line)]",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[n&&(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2 mr-4",children:[(0,d.jsx)(i.default,{text:"Close",position:"top",color:"#FF5F56",children:(0,d.jsx)("button",{onClick:b,"aria-label":"Close",title:"Close",className:"w-3 h-3 rounded-full bg-[#FF5F56]/80 hover:brightness-110 transition-all cursor-pointer flex items-center justify-center group/dot",children:(0,d.jsx)("span",{className:"text-[8px] font-bold text-white opacity-0 group-hover/dot:opacity-100 transition-opacity leading-none",children:"✕"})})}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]/50 cursor-not-allowed"}),(0,d.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]/50 cursor-not-allowed"})]}),c&&(0,d.jsx)("h2",{id:q,className:"text-sm sm:text-base font-semibold text-[var(--text)] tracking-tight",children:c})]}),(0,d.jsx)("button",{onClick:b,"aria-label":"Close",className:"md:hidden p-1 rounded-[var(--r1)] text-[var(--text-3)] hover:bg-[var(--surface-2)] hover:text-[var(--text)] transition-colors cursor-pointer",children:(0,d.jsx)(j.default,{name:"close",className:"text-[18px]"})})]}),(0,d.jsx)("div",{className:"p-5 sm:p-6 max-h-[calc(85vh-100px)] overflow-y-auto custom-scrollbar",children:f}),h&&(0,d.jsx)("div",{className:"flex items-center justify-end gap-2.5 px-5 py-3.5 border-t border-[var(--line)] bg-[var(--surface-2)]/30 rounded-b-[var(--r4)]",children:h})]})]}):null}function l({isOpen:a,onClose:b,onConfirm:c,title:e="Confirm",message:g,confirmText:i="Confirm",cancelText:j="Cancel",variant:m="danger",loading:n=!1,className:o,portal:p=!1}){let q=(0,d.jsx)(k,{isOpen:a,onClose:b,title:e,size:"sm",className:o,footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.default,{variant:"ghost",onClick:b,disabled:n,children:j}),(0,d.jsx)(h.default,{variant:m,onClick:c,loading:n,children:i})]}),children:(0,d.jsx)("p",{className:"text-text-muted",children:g})});return p&&"u">typeof document?(0,f.createPortal)(q,document.body):q}},95514:(a,b,c)=>{"use strict";c.d(b,{default:()=>f});var d=c(48249),e=c(71404);function f({checked:a=!1,onChange:b,label:c,description:g,disabled:h=!1,size:i="md",className:j,...k}){let l={sm:{track:"w-8 h-4",thumb:"size-3",translate:"translate-x-4"},md:{track:"w-11 h-6",thumb:"size-5",translate:"translate-x-5"},lg:{track:"w-14 h-7",thumb:"size-6",translate:"translate-x-7"}};return(0,d.jsxs)("div",{className:(0,e.cn)("flex items-center gap-3",h&&"opacity-50 cursor-not-allowed",j),children:[(0,d.jsx)("button",{type:"button",role:"switch","aria-checked":a,disabled:h,onClick:()=>{!h&&b&&b(!a)},className:(0,e.cn)("relative inline-flex shrink-0 cursor-pointer rounded-full","transition-colors duration-200 ease-in-out","focus:outline-none focus:ring-2 focus:ring-brand-500/30",a?"bg-brand-500":"bg-surface-3",l[i].track,h&&"cursor-not-allowed"),...k,children:(0,d.jsx)("span",{className:(0,e.cn)("pointer-events-none inline-block rounded-full bg-white shadow-sm","transform transition duration-200 ease-in-out",a?l[i].translate:"translate-x-0.5",l[i].thumb,"mt-0.5")})}),(c||g)&&(0,d.jsxs)("div",{className:"flex flex-col",children:[c&&(0,d.jsx)("span",{className:"text-sm font-medium text-text-main",children:c}),g&&(0,d.jsx)("span",{className:"text-xs text-text-muted",children:g})]})]})}},98153:(a,b,c)=>{"use strict";c.d(b,{A:()=>g});var d=c(48249),e=c(71404);let f={success:"badge-success",warning:"badge-warning",error:"badge-danger",default:"badge-neutral"};function g({children:a,variant:b="default",dot:c=!0,className:h}){return(0,d.jsxs)("span",{className:(0,e.cn)(f[b],h),children:[c&&(0,d.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-current","aria-hidden":"true"}),a]})}},99070:(a,b,c)=>{"use strict";c.d(b,{default:()=>i});var d=c(48249),e=c(71404),f=c(21707);let g={primary:"bg-white hover:bg-[#EDEDEE] text-[#0A0A0B] border border-transparent shadow-xs disabled:opacity-40",contrast:"bg-[var(--text)] hover:bg-[var(--text-2)] text-[var(--bg)] border border-transparent shadow-none disabled:opacity-40",secondary:"bg-[var(--surface-2)] hover:bg-[var(--surface-hover)] text-[var(--text)] border border-[var(--line-2)] disabled:opacity-40",outline:"bg-transparent hover:bg-[var(--surface-2)] text-[var(--text)] border border-[var(--line-2)] hover:border-[var(--accent-line)]",ghost:"bg-transparent hover:bg-[var(--surface-2)] text-[var(--text-2)] hover:text-[var(--text)] border border-transparent",danger:"bg-[#281515] hover:bg-[#381a1a] text-[#FF6B6B] border border-[#FF6B6B]/30 disabled:opacity-40",success:"bg-[#14251D] hover:bg-[#1b3327] text-[#34D39A] border border-[#34D39A]/30 disabled:opacity-40"},h={xs:"h-6 px-2.5 text-[11px] rounded-[var(--r1)] font-medium gap-1.5",sm:"h-7 px-2.5 text-xs rounded-[var(--r1)] font-medium",md:"h-8.5 px-3.5 text-xs sm:text-[13px] rounded-[var(--r1)] font-medium",lg:"h-10 px-5 text-sm rounded-[var(--r1)] font-medium"};function i({children:a,variant:b="primary",size:c="md",icon:j,iconRight:k,disabled:l=!1,loading:m=!1,fullWidth:n=!1,className:o,...p}){return(0,d.jsxs)("button",{"data-variant":b,className:(0,e.cn)("inline-flex items-center justify-center gap-2 font-semibold transition-all duration-150 ease-out cursor-pointer","active:scale-[0.97] disabled:opacity-50 disabled:cursor-not-allowed disabled:active:scale-100",g[b],h[c],n&&"w-full",o),disabled:l||m,...p,children:[m?(0,d.jsx)(f.default,{name:"progress_activity",className:(0,e.cn)("animate-spin","xs"===c?"text-[14px]":"text-[18px]")}):j?(0,d.jsx)(f.default,{name:j,className:"xs"===c?"text-[14px]":"text-[18px]"}):null,a,k&&!m&&(0,d.jsx)(f.default,{name:k,className:"xs"===c?"text-[14px]":"text-[18px]"})]})}}};
|