@sifxprime/krouter 0.5.166 → 0.5.168
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 +15 -15
- package/app/.next-cli-build/build-manifest.json +5 -5
- package/app/.next-cli-build/prerender-manifest.json +29 -29
- package/app/.next-cli-build/react-loadable-manifest.json +2 -2
- package/app/.next-cli-build/required-server-files.json +16 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- 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 +2 -2
- 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.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.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/environment/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/environment/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.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.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.js +2 -2
- 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.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.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/presidio/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/presidio/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.js +2 -2
- 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.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.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.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.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.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.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.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.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 +15 -11
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +15 -11
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +20 -16
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +3 -1
- package/app/.next-cli-build/server/app/_not-found/page.js +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 +26 -16
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +26 -16
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +32 -22
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +3 -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/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cache/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +6 -6
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- 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 +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +3 -3
- 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 +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- 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 +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +4 -4
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/combos/[id]/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/extras/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/headroom/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/init/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/route.js +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js +1 -1
- 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/media-providers/tts/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mitm/cert/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/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/live/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/live-by-connection/route.js +1 -1
- package/app/.next-cli-build/server/app/api/models/preview/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/models/test/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/auto-import/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/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/auto-import/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/social-authorize/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/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]/models/route.js +2 -2
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/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/health/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/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/suggested-models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/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/providers/zenith/log/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/zenith/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/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js +2 -2
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js +2 -2
- package/app/.next-cli-build/server/app/api/settings/database/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/environment/route.js +1 -1
- package/app/.next-cli-build/server/app/api/settings/presidio/route.js +3 -3
- 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/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tags/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 +2 -2
- package/app/.next-cli-build/server/app/api/translator/load/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/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/tunnel/disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- 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/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/api/chat/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js +2 -2
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/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/messages/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/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/v1/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +2 -2
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js +1 -1
- package/app/.next-cli-build/server/app/callback/page.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 +29 -18
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +29 -18
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +3 -1
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +37 -26
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +38 -26
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +5 -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 +34 -19
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +40 -27
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +34 -19
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +35 -21
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +42 -30
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +35 -21
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +33 -19
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +39 -27
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +33 -19
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/environment.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/environment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/environment.segments/!KGRhc2hib2FyZCk/dashboard/environment/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/environment.segments/_tree.segment.rsc +5 -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 +36 -23
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +44 -32
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +36 -23
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +6 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +33 -18
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +40 -26
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +33 -18
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/presidio.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/presidio.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/presidio.segments/!KGRhc2hib2FyZCk/dashboard/presidio/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/presidio.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/presidio.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +5 -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 +35 -23
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +44 -32
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +35 -23
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +6 -1
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +5 -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 +34 -21
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +38 -26
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +32 -19
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +39 -28
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +32 -19
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js +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 +31 -18
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +40 -27
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +5 -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 +31 -18
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +38 -26
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +31 -18
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +41 -30
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +34 -21
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +5 -1
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +32 -19
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +38 -25
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +32 -19
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +4 -1
- package/app/.next-cli-build/server/app/favicon.ico/route.js +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +24 -15
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +29 -20
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +24 -15
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -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 +30 -18
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +30 -18
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +3 -1
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +38 -26
- 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 +29 -18
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +29 -18
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +3 -1
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +37 -26
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js +2 -2
- package/app/.next-cli-build/server/app/page.js +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 +15 -15
- package/app/.next-cli-build/server/chunks/1220.js +3 -3
- package/app/.next-cli-build/server/chunks/1344.js +2 -2
- package/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/app/.next-cli-build/server/chunks/1450.js +1 -1
- package/app/.next-cli-build/server/chunks/1738.js +1 -1
- package/app/.next-cli-build/server/chunks/1813.js +23 -1
- package/app/.next-cli-build/server/chunks/2430.js +215 -31
- package/app/.next-cli-build/server/chunks/2722.js +6 -6
- package/app/.next-cli-build/server/chunks/2750.js +1 -1
- package/app/.next-cli-build/server/chunks/2970.js +163 -23
- package/app/.next-cli-build/server/chunks/3120.js +2 -2
- package/app/.next-cli-build/server/chunks/369.js +5 -5
- package/app/.next-cli-build/server/chunks/412.js +1 -1
- package/app/.next-cli-build/server/chunks/4161.js +1 -1
- package/app/.next-cli-build/server/chunks/4177.js +1 -1
- package/app/.next-cli-build/server/chunks/4306.js +1 -1
- package/app/.next-cli-build/server/chunks/4315.js +1 -1
- package/app/.next-cli-build/server/chunks/4380.js +1 -1
- package/app/.next-cli-build/server/chunks/4730.js +2 -2
- package/app/.next-cli-build/server/chunks/4884.js +4 -4
- package/app/.next-cli-build/server/chunks/523.js +1 -1
- package/app/.next-cli-build/server/chunks/5330.js +4 -4
- package/app/.next-cli-build/server/chunks/5433.js +1 -1
- package/app/.next-cli-build/server/chunks/5470.js +3 -3
- package/app/.next-cli-build/server/chunks/5573.js +1 -1
- package/app/.next-cli-build/server/chunks/5718.js +1 -1
- package/app/.next-cli-build/server/chunks/595.js +1 -1
- package/app/.next-cli-build/server/chunks/6182.js +2 -2
- package/app/.next-cli-build/server/chunks/7153.js +1 -1
- package/app/.next-cli-build/server/chunks/7774.js +13 -13
- package/app/.next-cli-build/server/chunks/7833.js +1 -1
- package/app/.next-cli-build/server/chunks/8238.js +1 -1
- package/app/.next-cli-build/server/chunks/8895.js +1 -1
- package/app/.next-cli-build/server/chunks/8962.js +1 -1
- package/app/.next-cli-build/server/chunks/9055.js +2 -2
- package/app/.next-cli-build/server/chunks/9958.js +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware-react-loadable-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +186 -24
- 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/server/preview-props.json +5 -0
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/1321-91a272a5139df5f2.js +1 -0
- package/app/.next-cli-build/static/chunks/3794-39f2d5bb0d40336b.js +52 -0
- package/app/.next-cli-build/static/chunks/4bd1b696-8cd12253b448cc13.js +1 -0
- package/app/.next-cli-build/static/chunks/5353-0085e26d68aca1f0.js +1 -0
- package/app/.next-cli-build/static/chunks/{5497-1af4fbf829c885c4.js → 5497-ff8c2e5da835ea40.js} +1 -1
- package/app/.next-cli-build/static/chunks/5772-9e7c7f235304c527.js +3 -0
- package/app/.next-cli-build/static/chunks/6069-31c2febe26d36d92.js +73 -0
- package/app/.next-cli-build/static/chunks/{6357.aa5754cdb37976a7.js → 6357.5f2532e76bf2cc51.js} +1 -1
- package/app/.next-cli-build/static/chunks/7504-5249aa88b6205df1.js +64 -0
- package/app/.next-cli-build/static/chunks/8202.69dace5daa86686d.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-8a99890727166f8a.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-ce0c6b650a822e25.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-589743e8ea1d9673.js +11 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-eacf2780757238ff.js +1 -0
- package/app/.next-cli-build/static/chunks/main-00cd8c01f6f6e461.js +5 -0
- package/app/.next-cli-build/static/chunks/{webpack-53609978799ebbca.js → webpack-cc312041cf710f25.js} +1 -1
- package/app/cli/package.json +1 -1
- package/app/node_modules/@next/env/package.json +1 -1
- package/app/node_modules/nanoid/package.json +3 -3
- package/app/node_modules/next/dist/build/analysis/get-page-static-info.js +58 -76
- package/app/node_modules/next/dist/build/babel/loader/get-config.js +7 -16
- package/app/node_modules/next/dist/build/babel/plugins/next-font-unsupported.js +1 -5
- package/app/node_modules/next/dist/build/babel/plugins/next-page-config.js +5 -25
- package/app/node_modules/next/dist/build/babel/plugins/next-page-disallow-re-export-all-exports.js +1 -5
- package/app/node_modules/next/dist/build/babel/plugins/next-ssg-transform.js +4 -20
- package/app/node_modules/next/dist/build/browser-variant-modules.js +1 -0
- package/app/node_modules/next/dist/build/create-compiler-aliases.js +19 -11
- package/app/node_modules/next/dist/build/define-env.js +12 -18
- package/app/node_modules/next/dist/build/entries.js +132 -8
- package/app/node_modules/next/dist/build/get-babel-loader-config.js +10 -10
- package/app/node_modules/next/dist/build/get-convention-file-base-name.js +29 -0
- package/app/node_modules/next/dist/build/get-static-info-including-layouts.js +0 -1
- package/app/node_modules/next/dist/build/handle-externals.js +1 -5
- package/app/node_modules/next/dist/build/load-jsconfig.js +1 -5
- package/app/node_modules/next/dist/build/lockfile.js +1 -5
- package/app/node_modules/next/dist/build/next-config-ts/transpile-config.js +1 -5
- package/app/node_modules/next/dist/build/nft.js +119 -0
- package/app/node_modules/next/dist/build/normalize-catchall-routes.js +18 -66
- package/app/node_modules/next/dist/build/print-build-errors.js +57 -7
- package/app/node_modules/next/dist/build/route-discovery.js +32 -4
- package/app/node_modules/next/dist/build/segment-config/app/app-segment-config.js +19 -5
- package/app/node_modules/next/dist/build/segment-config/app/app-segments.js +120 -29
- package/app/node_modules/next/dist/build/segment-config/app/collect-root-param-keys.js +1 -5
- package/app/node_modules/next/dist/build/static-paths/app/extract-pathname-route-param-segments-from-loader-tree.js +8 -2
- package/app/node_modules/next/dist/build/static-paths/app.js +230 -133
- package/app/node_modules/next/dist/build/static-paths/pages.js +8 -40
- package/app/node_modules/next/dist/build/static-paths/param-matching.js +200 -0
- package/app/node_modules/next/dist/build/swc/index.js +92 -162
- package/app/node_modules/next/dist/build/utils.js +180 -90
- package/app/node_modules/next/dist/build/webpack/cache-invalidation.js +1 -5
- package/app/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js +7 -35
- package/app/node_modules/next/dist/build/webpack/loaders/css-loader/src/CssSyntaxError.js +0 -5
- package/app/node_modules/next/dist/build/webpack/loaders/css-loader/src/camelcase.js +1 -5
- package/app/node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js +5 -25
- package/app/node_modules/next/dist/build/webpack/loaders/css-loader/src/plugins/postcss-import-parser.js +4 -20
- package/app/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/index.js +3 -16
- package/app/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/interface.js +0 -1
- package/app/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/loader.js +2 -10
- package/app/node_modules/next/dist/build/webpack/loaders/next-flight-css-loader.js +1 -5
- package/app/node_modules/next/dist/build/webpack/loaders/next-flight-loader/index.js +3 -15
- package/app/node_modules/next/dist/build/webpack/loaders/next-route-loader/index.js +3 -15
- package/app/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/Error.js +0 -5
- package/app/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/Warning.js +0 -5
- package/app/node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js +2 -10
- package/app/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/index.js +2 -6
- package/app/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/lib/file-protocol.js +2 -10
- package/app/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/lib/join-function.js +1 -5
- package/app/node_modules/next/dist/build/webpack/loaders/resolve-url-loader/lib/postcss.js +1 -5
- package/app/node_modules/next/dist/build/webpack/plugins/build-manifest-plugin.js +1 -5
- package/app/node_modules/next/dist/build/webpack/plugins/deferred-entries-plugin.js +9 -0
- package/app/node_modules/next/dist/build/webpack/plugins/flight-manifest-plugin.js +2 -6
- package/app/node_modules/next/dist/build/webpack/plugins/middleware-plugin.js +1 -5
- package/app/node_modules/next/dist/build/webpack/plugins/next-trace-entrypoints-plugin.js +2 -10
- package/app/node_modules/next/dist/build/webpack/plugins/next-types-plugin/index.js +3 -1
- package/app/node_modules/next/dist/build/webpack/plugins/slow-module-detection-plugin.js +3 -15
- package/app/node_modules/next/dist/build/webpack/plugins/subresource-integrity-plugin.js +1 -5
- package/app/node_modules/next/dist/build/webpack-config.js +16 -33
- package/app/node_modules/next/dist/cli/next-test.js +4 -0
- package/app/node_modules/next/dist/client/app-call-server.js +16 -18
- package/app/node_modules/next/dist/client/components/app-router-instance.js +43 -187
- package/app/node_modules/next/dist/client/components/{segment-cache/navigation.js → app-router-state.js} +88 -334
- package/app/node_modules/next/dist/client/components/app-router-utils.js +1 -5
- package/app/node_modules/next/dist/client/components/app-router.js +83 -74
- package/app/node_modules/next/dist/client/components/dev-root-http-access-fallback-boundary.js +1 -5
- package/app/node_modules/next/dist/client/components/forbidden.js +2 -10
- package/app/node_modules/next/dist/client/components/handle-isr-error.js +19 -4
- package/app/node_modules/next/dist/client/components/instant-samples.js +4 -11
- package/app/node_modules/next/dist/client/components/links.js +6 -7
- package/app/node_modules/next/dist/client/components/navigation-dynamic-rendering.js +3 -3
- package/app/node_modules/next/dist/client/components/navigation-untracked.js +1 -2
- package/app/node_modules/next/dist/client/components/navigation.js +2 -6
- package/app/node_modules/next/dist/client/components/navigation.react-server.js +1 -5
- package/app/node_modules/next/dist/client/components/navigator.js +73 -0
- package/app/node_modules/next/dist/client/components/not-found.js +1 -5
- package/app/node_modules/next/dist/client/components/prefetch.js +83 -0
- package/app/node_modules/next/dist/client/components/readonly-url-search-params.js +0 -5
- package/app/node_modules/next/dist/client/components/redirect.js +3 -15
- package/app/node_modules/next/dist/client/components/{router-reducer/ppr-navigations.js → render-tree.js} +365 -400
- package/app/node_modules/next/dist/client/components/router-reducer/compute-changed-path.js +13 -5
- package/app/node_modules/next/dist/client/components/router-reducer/create-initial-router-state.js +67 -54
- package/app/node_modules/next/dist/client/components/router-reducer/create-router-cache-key.js +1 -7
- package/app/node_modules/next/dist/client/components/router-reducer/create-segment-key.js +42 -0
- package/app/node_modules/next/dist/client/components/router-reducer/fetch-server-response.js +71 -50
- package/app/node_modules/next/dist/client/components/router-reducer/is-navigating-to-new-root-layout.js +4 -4
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/hmr-refresh-reducer.js +2 -2
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/navigate-reducer.js +5 -5
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/refresh-reducer.js +11 -8
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/restore-reducer.js +12 -9
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/server-action-reducer.js +30 -29
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/server-patch-reducer.js +5 -5
- package/app/node_modules/next/dist/client/components/router-reducer/router-reducer.js +2 -10
- package/app/node_modules/next/dist/client/components/segment-cache/bfcache.js +11 -21
- package/app/node_modules/next/dist/client/components/segment-cache/cache.js +1168 -1181
- package/app/node_modules/next/dist/client/components/segment-cache/decode-server-response.js +419 -0
- package/app/node_modules/next/dist/client/components/segment-cache/navigation-testing-lock.js +1 -1
- package/app/node_modules/next/dist/client/components/segment-cache/optimistic-routes.js +77 -82
- package/app/node_modules/next/dist/client/components/segment-cache/scheduler.js +464 -425
- package/app/node_modules/next/dist/client/components/segment-cache/types.js +12 -3
- package/app/node_modules/next/dist/client/components/segment-cache/vary-path.js +140 -126
- package/app/node_modules/next/dist/client/components/sequential-router-queue.js +163 -0
- package/app/node_modules/next/dist/client/components/unauthorized.js +2 -10
- package/app/node_modules/next/dist/client/components/unstable-rethrow.js +1 -2
- package/app/node_modules/next/dist/client/components/use-action-queue.js +2 -10
- package/app/node_modules/next/dist/client/dev/debug-channel.js +6 -323
- package/app/node_modules/next/dist/client/dev/hot-reloader/app/hot-reloader-app.js +49 -31
- package/app/node_modules/next/dist/client/dev/hot-reloader/app/web-socket.js +14 -21
- package/app/node_modules/next/dist/client/dev/hot-reloader/pages/hot-reloader-pages.js +15 -6
- package/app/node_modules/next/dist/client/dev/hot-reloader/runtime-error-state.js +72 -0
- package/app/node_modules/next/dist/client/flight-data-helpers.js +41 -94
- package/app/node_modules/next/dist/client/route-loader.js +6 -30
- package/app/node_modules/next/dist/client/route-params.js +34 -12
- package/app/node_modules/next/dist/client/router.js +2 -10
- package/app/node_modules/next/dist/client/sequential-call-server.js +45 -0
- package/app/node_modules/next/dist/compiled/@mswjs/interceptors/ClientRequest/index.js +1 -1
- package/app/node_modules/next/dist/compiled/next-devtools/index.js +279 -229
- package/app/node_modules/next/dist/compiled/next-server/app-page-experimental.runtime.prod.js +203 -59
- package/app/node_modules/next/dist/compiled/next-server/app-page-turbo-experimental.runtime.prod.js +203 -59
- package/app/node_modules/next/dist/compiled/next-server/app-page-turbo.runtime.prod.js +203 -59
- package/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js +203 -59
- package/app/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js +5 -3
- package/app/node_modules/next/dist/compiled/next-server/pages-turbo.runtime.prod.js +13 -13
- package/app/node_modules/next/dist/compiled/next-server/pages.runtime.prod.js +13 -13
- package/app/node_modules/next/dist/compiled/react-is/package.json +1 -1
- package/app/node_modules/next/dist/compiled/stacktrace-parser/stack-trace-parser.cjs.js +1 -1
- package/app/node_modules/next/dist/compiled/unistore/unistore.js +1 -1
- package/app/node_modules/next/dist/experimental/testmode/fetch.js +2 -10
- package/app/node_modules/next/dist/export/helpers/create-incremental-cache.js +21 -16
- package/app/node_modules/next/dist/export/utils.js +21 -8
- package/app/node_modules/next/dist/lib/batcher.js +2 -2
- package/app/node_modules/next/dist/lib/dist-dir.js +88 -0
- package/app/node_modules/next/dist/lib/download-swc.js +2 -10
- package/app/node_modules/next/dist/lib/fallback.js +3 -15
- package/app/node_modules/next/dist/lib/find-pages-dir.js +2 -10
- package/app/node_modules/next/dist/lib/helpers/get-cache-directory.js +1 -5
- package/app/node_modules/next/dist/lib/helpers/get-registry.js +1 -5
- package/app/node_modules/next/dist/lib/is-error.js +3 -15
- package/app/node_modules/next/dist/lib/is-serializable-props.js +6 -35
- package/app/node_modules/next/dist/lib/patch-incorrect-lockfile.js +4 -8
- package/app/node_modules/next/dist/lib/picocolors.js +10 -0
- package/app/node_modules/next/dist/lib/recursive-delete.js +50 -11
- package/app/node_modules/next/dist/lib/resolve-from.js +2 -10
- package/app/node_modules/next/dist/lib/static-env.js +1 -5
- package/app/node_modules/next/dist/lib/typescript/getTypeScriptConfiguration.js +3 -15
- package/app/node_modules/next/dist/lib/typescript/missingDependencyError.js +1 -5
- package/app/node_modules/next/dist/lib/typescript/runTypeCheck.js +1 -9
- package/app/node_modules/next/dist/lib/typescript/runTypeCheckCli.js +0 -1
- package/app/node_modules/next/dist/lib/typescript/runTypeScriptCli.js +4 -16
- package/app/node_modules/next/dist/lib/verify-partytown-setup.js +1 -5
- package/app/node_modules/next/dist/lib/warn-missing-react-dependencies.js +33 -0
- package/app/node_modules/next/dist/next-devtools/server/attach-nodejs-debugger-middleware.js +1 -5
- package/app/node_modules/next/dist/next-devtools/server/shared.js +3 -2
- package/app/node_modules/next/dist/next-devtools/shared/console-error.js +1 -5
- package/app/node_modules/next/dist/next-devtools/userspace/app/errors/replay-ssr-only-errors.js +1 -5
- package/app/node_modules/next/dist/next-devtools/userspace/app/errors/runtime-error-metadata.js +39 -0
- package/app/node_modules/next/dist/next-devtools/userspace/app/errors/stitched-error.js +1 -5
- package/app/node_modules/next/dist/next-devtools/userspace/app/errors/use-error-handler.js +48 -19
- package/app/node_modules/next/dist/next-devtools/userspace/app/segment-explorer-node.js +1 -5
- package/app/node_modules/next/dist/server/accept-header.js +3 -15
- package/app/node_modules/next/dist/server/after/after-context.js +5 -25
- package/app/node_modules/next/dist/server/after/awaiter.js +1 -5
- package/app/node_modules/next/dist/server/after/run-with-after.js +2 -2
- package/app/node_modules/next/dist/server/api-utils/index.js +1 -10
- package/app/node_modules/next/dist/server/api-utils/node/parse-body.js +3 -15
- package/app/node_modules/next/dist/server/app-render/action-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/action-handler.js +104 -141
- package/app/node_modules/next/dist/server/app-render/after-task-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/app-render-prerender-utils.js +6 -30
- package/app/node_modules/next/dist/server/app-render/app-render-render-utils.js +1 -5
- package/app/node_modules/next/dist/server/app-render/app-render-scheduling.js +3 -15
- package/app/node_modules/next/dist/server/app-render/app-render.js +1346 -1211
- package/app/node_modules/next/dist/server/app-render/async-local-storage.js +11 -6
- package/app/node_modules/next/dist/server/app-render/blocking-route-messages.js +119 -70
- package/app/node_modules/next/dist/server/app-render/cache-signal.js +61 -35
- package/app/node_modules/next/dist/server/app-render/console-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/create-component-tree.js +136 -160
- package/app/node_modules/next/dist/server/app-render/create-error-handler.js +12 -6
- package/app/node_modules/next/dist/server/app-render/create-transport-tree-from-loader-tree.js +190 -0
- package/app/node_modules/next/dist/server/app-render/debug-channel-server.web.js +1 -5
- package/app/node_modules/next/dist/server/app-render/dev-validation-scheduler.js +4 -5
- package/app/node_modules/next/dist/server/app-render/dev-validation-worker-snapshot.js +3 -1
- package/app/node_modules/next/dist/server/app-render/dynamic-access-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/dynamic-access-async-storage.external.js +26 -3
- package/app/node_modules/next/dist/server/app-render/dynamic-rendering-client.js +124 -0
- package/app/node_modules/next/dist/server/app-render/dynamic-rendering.js +260 -329
- package/app/node_modules/next/dist/server/app-render/encryption-utils.js +1 -5
- package/app/node_modules/next/dist/server/app-render/instant-validation/boundary-tracking.js +2 -2
- package/app/node_modules/next/dist/server/app-render/instant-validation/instant-config.js +4 -12
- package/app/node_modules/next/dist/server/app-render/instant-validation/instant-samples.js +13 -62
- package/app/node_modules/next/dist/server/app-render/instant-validation/stream-utils.js +2 -10
- package/app/node_modules/next/dist/server/app-render/manifests-singleton.js +110 -38
- package/app/node_modules/next/dist/server/app-render/module-loading/track-module-loading.instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/parse-and-validate-flight-router-state.js +3 -15
- package/app/node_modules/next/dist/server/app-render/postponed-state.js +87 -51
- package/app/node_modules/next/dist/server/app-render/prospective-render-utils.js +2 -6
- package/app/node_modules/next/dist/server/app-render/render-in-browser.js +27 -0
- package/app/node_modules/next/dist/server/app-render/required-scripts.js +1 -5
- package/app/node_modules/next/dist/server/app-render/segment-config/ensure-static.js +206 -0
- package/app/node_modules/next/dist/server/app-render/staged-rendering.js +46 -54
- package/app/node_modules/next/dist/server/app-render/stream-ops.node.js +18 -12
- package/app/node_modules/next/dist/server/app-render/stream-ops.web.js +4 -20
- package/app/node_modules/next/dist/server/app-render/sync-io-messages.js +2 -10
- package/app/node_modules/next/dist/server/app-render/types.js +2 -1
- package/app/node_modules/next/dist/server/app-render/use-flight-response.js +4 -17
- package/app/node_modules/next/dist/server/app-render/vary-params.js +12 -11
- package/app/node_modules/next/dist/server/app-render/walk-tree-with-flight-router-state.js +95 -97
- package/app/node_modules/next/dist/server/app-render/work-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/work-unit-async-storage-instance.js +1 -1
- package/app/node_modules/next/dist/server/app-render/work-unit-async-storage.external.js +36 -26
- package/app/node_modules/next/dist/server/async-storage/draft-mode-provider.js +1 -5
- package/app/node_modules/next/dist/server/async-storage/request-store.js +6 -5
- package/app/node_modules/next/dist/server/async-storage/work-store.js +24 -26
- package/app/node_modules/next/dist/server/base-http/node.js +1 -5
- package/app/node_modules/next/dist/server/base-server.js +346 -155
- package/app/node_modules/next/dist/server/client-component-renderer-logger.js +129 -28
- package/app/node_modules/next/dist/server/config-schema.js +61 -9
- package/app/node_modules/next/dist/server/config-shared.js +26 -4
- package/app/node_modules/next/dist/server/config.js +154 -332
- package/app/node_modules/next/dist/server/dev/debug-channel.js +1 -5
- package/app/node_modules/next/dist/server/dev/dev-validation-worker-pool.js +1 -0
- package/app/node_modules/next/dist/server/dev/get-source-map-from-file.js +5 -25
- package/app/node_modules/next/dist/server/dev/hot-middleware.js +27 -1
- package/app/node_modules/next/dist/server/dev/hot-reloader-turbopack.js +338 -200
- package/app/node_modules/next/dist/server/dev/hot-reloader-types.js +3 -0
- package/app/node_modules/next/dist/server/dev/hot-reloader-webpack.js +26 -20
- package/app/node_modules/next/dist/server/dev/messages.js +2 -10
- package/app/node_modules/next/dist/server/dev/middleware-turbopack.js +4 -20
- package/app/node_modules/next/dist/server/dev/middleware-webpack.js +2 -10
- package/app/node_modules/next/dist/server/dev/next-dev-server.js +33 -95
- package/app/node_modules/next/dist/server/dev/node-stack-frames.js +2 -19
- package/app/node_modules/next/dist/server/dev/on-demand-entry-handler.js +12 -12
- package/app/node_modules/next/dist/server/dev/runtime-error-state.js +220 -0
- package/app/node_modules/next/dist/server/dev/serialized-errors.js +1 -5
- package/app/node_modules/next/dist/server/dev/static-paths-worker.js +16 -15
- package/app/node_modules/next/dist/server/dev/turbopack-utils.js +20 -36
- package/app/node_modules/next/dist/server/dev/use-cache-probe-pool.js +1 -0
- package/app/node_modules/next/dist/server/dynamic-rendering-utils.js +298 -55
- package/app/node_modules/next/dist/server/image-optimizer/detect-content-type.js +229 -0
- package/app/node_modules/next/dist/server/image-optimizer/extract-etag.js +53 -0
- package/app/node_modules/next/dist/server/image-optimizer/get-image-size.js +25 -0
- package/app/node_modules/next/dist/server/image-optimizer/get-max-age.js +41 -0
- package/app/node_modules/next/dist/server/image-optimizer/get-previously-cached-image-or-null.js +22 -0
- package/app/node_modules/next/dist/server/image-optimizer/image-error.js +23 -0
- package/app/node_modules/next/dist/server/image-optimizer/image-type.js +86 -0
- package/app/node_modules/next/dist/server/image-optimizer/transform.js +227 -0
- package/app/node_modules/next/dist/server/image-optimizer.js +78 -674
- package/app/node_modules/next/dist/server/lib/app-info-log.js +19 -9
- package/app/node_modules/next/dist/server/lib/cache-handlers/default.js +9 -13
- package/app/node_modules/next/dist/server/lib/chrome-devtools-workspace.js +1 -5
- package/app/node_modules/next/dist/server/lib/dedupe-fetch.js +1 -5
- package/app/node_modules/next/dist/server/lib/dev-bundler-service.js +6 -6
- package/app/node_modules/next/dist/server/lib/generate-agent-files.js +158 -35
- package/app/node_modules/next/dist/server/lib/i18n-provider.js +1 -5
- package/app/node_modules/next/dist/server/lib/incremental-cache/file-system-cache.js +14 -20
- package/app/node_modules/next/dist/server/lib/incremental-cache/index.js +19 -29
- package/app/node_modules/next/dist/server/lib/incremental-cache/memory-cache.external.js +1 -5
- package/app/node_modules/next/dist/server/lib/lru-cache.js +1 -5
- package/app/node_modules/next/dist/server/lib/mock-request.js +24 -120
- package/app/node_modules/next/dist/server/lib/module-loader/node-module-loader.js +1 -5
- package/app/node_modules/next/dist/server/lib/patch-fetch.js +44 -38
- package/app/node_modules/next/dist/server/lib/postponed-request-body.js +1 -5
- package/app/node_modules/next/dist/server/lib/render-server.js +2 -10
- package/app/node_modules/next/dist/server/lib/router-server.js +106 -36
- package/app/node_modules/next/dist/server/lib/router-utils/build-data-route.js +26 -3
- package/app/node_modules/next/dist/server/lib/router-utils/cache-life-type-utils.js +14 -45
- package/app/node_modules/next/dist/server/lib/router-utils/decode-path-params.js +1 -5
- package/app/node_modules/next/dist/server/lib/router-utils/filesystem.js +212 -31
- package/app/node_modules/next/dist/server/lib/router-utils/instrumentation-globals.external.js +61 -1
- package/app/node_modules/next/dist/server/lib/router-utils/instrumentation-node-extensions.js +1 -5
- package/app/node_modules/next/dist/server/lib/router-utils/normalize-catchall-routes.js +320 -0
- package/app/node_modules/next/dist/server/lib/router-utils/proxy-request.js +2 -2
- package/app/node_modules/next/dist/server/lib/router-utils/resolve-routes.js +17 -11
- package/app/node_modules/next/dist/server/lib/router-utils/setup-dev-bundler.js +258 -76
- package/app/node_modules/next/dist/server/lib/router-utils/strict-route-matching-config.js +28 -0
- package/app/node_modules/next/dist/server/lib/router-utils/typegen.js +56 -10
- package/app/node_modules/next/dist/server/lib/start-server.js +48 -38
- package/app/node_modules/next/dist/server/lib/trace/constants.js +40 -0
- package/app/node_modules/next/dist/server/lib/trace/request-insights-identity.js +1 -3
- package/app/node_modules/next/dist/server/lib/trace/tracer.js +10 -10
- package/app/node_modules/next/dist/server/lib/utils.js +66 -15
- package/app/node_modules/next/dist/server/load-components.js +7 -2
- package/app/node_modules/next/dist/server/load-manifest.external.js +16 -17
- package/app/node_modules/next/dist/server/mcp/tools/utils/browser-communication.js +2 -10
- package/app/node_modules/next/dist/server/mcp/tools/utils/format-errors.js +5 -5
- package/app/node_modules/next/dist/server/next-server.js +130 -124
- package/app/node_modules/next/dist/server/next.js +25 -37
- package/app/node_modules/next/dist/server/node-environment-extensions/console-dim.external.js +1 -2
- package/app/node_modules/next/dist/server/node-environment-extensions/fast-set-immediate.external.js +115 -62
- package/app/node_modules/next/dist/server/node-environment-extensions/global-behaviors.js +1 -5
- package/app/node_modules/next/dist/server/node-environment-extensions/io-utils.js +11 -10
- package/app/node_modules/next/dist/server/node-environment-extensions/process-error-handlers.js +0 -9
- package/app/node_modules/next/dist/server/node-environment-extensions/unhandled-rejection.external.js +1 -12
- package/app/node_modules/next/dist/server/normalizers/built/app/app-page-normalizer.js +1 -1
- package/app/node_modules/next/dist/server/normalizers/request/base-path.js +1 -5
- package/app/node_modules/next/dist/server/normalizers/request/next-data.js +1 -5
- package/app/node_modules/next/dist/server/normalizers/request/prefix.js +1 -5
- package/app/node_modules/next/dist/server/patch-error-inspect.js +19 -11
- package/app/node_modules/next/dist/server/pipe-readable.js +42 -30
- package/app/node_modules/next/dist/server/render-result.js +5 -17
- package/app/node_modules/next/dist/server/render.js +37 -183
- package/app/node_modules/next/dist/server/request/fallback-params.js +23 -9
- package/app/node_modules/next/dist/server/response-cache/index.js +54 -32
- package/app/node_modules/next/dist/server/response-cache/utils.js +1 -5
- package/app/node_modules/next/dist/server/resume-data-cache/cache-store.js +18 -0
- package/app/node_modules/next/dist/server/resume-data-cache/resume-data-cache.js +51 -49
- package/app/node_modules/next/dist/server/revalidation-utils.js +15 -13
- package/app/node_modules/next/dist/server/route-modules/app-page/dev-render-context.js +23 -0
- package/app/node_modules/next/dist/server/route-modules/app-page/helpers/prerender-manifest-matcher.js +5 -4
- package/app/node_modules/next/dist/server/route-modules/app-page/module.js +13 -1
- package/app/node_modules/next/dist/server/route-modules/app-page/module.render.js +26 -11
- package/app/node_modules/next/dist/server/route-modules/app-page/parse-request-headers.js +58 -0
- package/app/node_modules/next/dist/server/route-modules/app-page/vendored/rsc/entrypoints.js +1 -5
- package/app/node_modules/next/dist/server/route-modules/app-page/vendored/ssr/entrypoints.js +1 -5
- package/app/node_modules/next/dist/server/route-modules/pages/module.render.js +1 -5
- package/app/node_modules/next/dist/server/route-modules/pages/pages-handler.js +20 -16
- package/app/node_modules/next/dist/server/route-modules/route-module.js +57 -61
- package/app/node_modules/next/dist/server/serve-static.js +1 -5
- package/app/node_modules/next/dist/server/setup-http-agent-env.js +1 -5
- package/app/node_modules/next/dist/server/stream-utils/encoded-tags.js +1 -1
- package/app/node_modules/next/dist/server/stream-utils/node-web-streams-helper.js +7 -11
- package/app/node_modules/next/dist/server/typescript/constant.js +2 -0
- package/app/node_modules/next/dist/server/typescript/rules/config.js +29 -2
- package/app/node_modules/next/dist/server/use-cache/cache-life-profile.js +6 -30
- package/app/node_modules/next/dist/server/use-cache/constants.js +1 -5
- package/app/node_modules/next/dist/server/use-cache/handlers.js +27 -36
- package/app/node_modules/next/dist/server/use-cache/tiered-cache-handler.js +6 -4
- package/app/node_modules/next/dist/server/web/adapter.js +14 -35
- package/app/node_modules/next/dist/server/web/error.js +0 -15
- package/app/node_modules/next/dist/server/web/globals.js +3 -15
- package/app/node_modules/next/dist/server/web/next-url.js +1 -5
- package/app/node_modules/next/dist/server/web/sandbox/context.js +10 -34
- package/app/node_modules/next/dist/server/web/sandbox/sandbox.js +1 -5
- package/app/node_modules/next/dist/server/web/spec-extension/adapters/headers.js +0 -5
- package/app/node_modules/next/dist/server/web/spec-extension/adapters/next-request.js +1 -5
- package/app/node_modules/next/dist/server/web/spec-extension/adapters/request-cookies.js +0 -5
- package/app/node_modules/next/dist/server/web/spec-extension/fetch-event.js +2 -10
- package/app/node_modules/next/dist/server/web/spec-extension/response.js +2 -10
- package/app/node_modules/next/dist/server/web/utils.js +1 -5
- package/app/node_modules/next/dist/server/web/web-on-close.js +2 -10
- package/app/node_modules/next/dist/shared/lib/app-router-types.js +38 -28
- package/app/node_modules/next/dist/shared/lib/constants.js +5 -0
- package/app/node_modules/next/dist/shared/lib/deployment-id.js +1 -1
- package/app/node_modules/next/dist/shared/lib/errors/code-frame.js +3 -2
- package/app/node_modules/next/dist/shared/lib/errors/empty-generate-static-params-error.js +1 -5
- package/app/node_modules/next/dist/shared/lib/errors/ensure-static-gsp-errors.js +30 -0
- package/app/node_modules/next/dist/shared/lib/errors/hard-deprecated-config-error.js +0 -5
- package/app/node_modules/next/dist/shared/lib/errors/incompatible-parallel-route-slots-error.js +36 -0
- package/app/node_modules/next/dist/shared/lib/errors/missing-canonical-interception-routes-error.js +20 -0
- package/app/node_modules/next/dist/shared/lib/errors/unmatched-app-pages-error.js +20 -0
- package/app/node_modules/next/dist/shared/lib/get-rspack.js +1 -5
- package/app/node_modules/next/dist/shared/lib/html-context.shared-runtime.js +1 -5
- package/app/node_modules/next/dist/shared/lib/image-config.js +52 -1
- package/app/node_modules/next/dist/shared/lib/instant-messages.js +2 -10
- package/app/node_modules/next/dist/shared/lib/invariant-error.js +0 -5
- package/app/node_modules/next/dist/shared/lib/lazy-dynamic/react-browser-bailout.js +45 -0
- package/app/node_modules/next/dist/shared/lib/magic-identifier.js +5 -25
- package/app/node_modules/next/dist/shared/lib/match-remote-pattern.js +1 -5
- package/app/node_modules/next/dist/shared/lib/router/router.js +95 -77
- package/app/node_modules/next/dist/shared/lib/router/routes/app.js +3 -15
- package/app/node_modules/next/dist/shared/lib/router/utils/app-paths.js +6 -1
- package/app/node_modules/next/dist/shared/lib/router/utils/get-dynamic-param.js +4 -12
- package/app/node_modules/next/dist/shared/lib/router/utils/interception-routes.js +63 -20
- package/app/node_modules/next/dist/shared/lib/router/utils/parse-relative-url.js +1 -5
- package/app/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js +1 -5
- package/app/node_modules/next/dist/shared/lib/router/utils/querystring.js +31 -0
- package/app/node_modules/next/dist/shared/lib/router/utils/resolve-param-value.js +1 -5
- package/app/node_modules/next/dist/shared/lib/router/utils/route-matcher.js +1 -5
- package/app/node_modules/next/dist/shared/lib/router/utils/sorted-routes.js +11 -55
- package/app/node_modules/next/dist/shared/lib/rsc-transport.js +108 -0
- package/app/node_modules/next/dist/shared/lib/segment-cache/segment-value-encoding.js +0 -13
- package/app/node_modules/next/dist/shared/lib/segment-cache/vary-params-decoding.js +48 -27
- package/app/node_modules/next/dist/shared/lib/segment.js +1 -13
- package/app/node_modules/next/dist/shared/lib/turbopack/compilation-events.js +7 -7
- package/app/node_modules/next/dist/shared/lib/turbopack/internal-error.js +2 -7
- package/app/node_modules/next/dist/shared/lib/turbopack/manifest-loader.js +2 -6
- package/app/node_modules/next/dist/shared/lib/turbopack/utils.js +3 -11
- package/app/node_modules/next/dist/shared/lib/utils.js +2 -11
- package/app/node_modules/next/dist/shared/lib/zod.js +2 -6
- package/app/node_modules/next/dist/telemetry/anonymous-meta.js +1 -1
- package/app/node_modules/next/dist/telemetry/detached-flush.js +8 -15
- package/app/node_modules/next/dist/telemetry/events/build.js +1 -2
- package/app/node_modules/next/dist/telemetry/events/swc-load-failure.js +1 -1
- package/app/node_modules/next/dist/telemetry/events/version.js +2 -2
- package/app/node_modules/next/dist/telemetry/post-telemetry-payload.js +1 -5
- package/app/node_modules/next/dist/telemetry/storage.js +31 -19
- package/app/node_modules/next/dist/trace/report/index.js +5 -2
- package/app/node_modules/next/dist/trace/report/to-json-build.js +4 -2
- package/app/node_modules/next/dist/trace/report/to-json.js +141 -97
- package/app/node_modules/next/dist/trace/trace.js +14 -9
- package/app/node_modules/next/package.json +12 -11
- package/app/package.json +4 -4
- package/app/server.js +1 -1
- package/app/src/mitm/server.js +43 -39
- package/package.json +1 -1
- package/app/.next-cli-build/static/chunks/1321-c5b3011761e0228b.js +0 -1
- package/app/.next-cli-build/static/chunks/3794-83acfce05009cf38.js +0 -52
- package/app/.next-cli-build/static/chunks/4bd1b696-8a4ab4fdf0ae305a.js +0 -1
- package/app/.next-cli-build/static/chunks/5353-d31cc8d476bc534e.js +0 -1
- package/app/.next-cli-build/static/chunks/5772-6cf78180ecf9dce0.js +0 -3
- package/app/.next-cli-build/static/chunks/6069-7e7f824c6e2d4291.js +0 -73
- package/app/.next-cli-build/static/chunks/7504-6f7ca1eab428dd5e.js +0 -64
- package/app/.next-cli-build/static/chunks/8202.1ffc6ce531e066ce.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/basic-chat/page-90b9aed7279ea50e.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/page-eaf6e24edeca4e51.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-2f53d5dd5b247cf1.js +0 -11
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/translator/page-bbc10fd10f7af626.js +0 -1
- package/app/.next-cli-build/static/chunks/main-1eaba0b776683ce7.js +0 -5
- package/app/node_modules/next/dist/build/webpack/loaders/lightningcss-loader/src/minify.js +0 -94
- package/app/node_modules/next/dist/client/components/match-segments.js +0 -32
- package/app/node_modules/next/dist/client/components/router-reducer/reducers/find-head-in-cache.js +0 -63
- package/app/node_modules/next/dist/client/components/segment-cache/prefetch.js +0 -32
- package/app/node_modules/next/dist/compiled/webpack-sources3/index.js +0 -1
- package/app/node_modules/next/dist/compiled/webpack-sources3/package.json +0 -1
- package/app/node_modules/next/dist/lib/detached-promise.js +0 -32
- package/app/node_modules/next/dist/lib/error-telemetry-utils.js +0 -42
- package/app/node_modules/next/dist/next-devtools/server/get-next-error-feedback-middleware.js +0 -42
- package/app/node_modules/next/dist/server/app-render/create-flight-router-state-from-loader-tree.js +0 -154
- package/app/node_modules/next/dist/server/lib/experimental/ppr.js +0 -47
- package/app/node_modules/next/dist/server/lib/params-utils.js +0 -70
- package/app/node_modules/next/dist/server/lib/router-utils/is-postpone.js +0 -16
- package/app/node_modules/next/dist/server/route-matcher-managers/default-route-matcher-manager.js +0 -239
- package/app/node_modules/next/dist/server/route-matcher-managers/dev-route-matcher-manager.js +0 -120
- package/app/node_modules/next/dist/server/route-matcher-providers/app-page-route-matcher-provider.js +0 -55
- package/app/node_modules/next/dist/server/route-matcher-providers/app-route-route-matcher-provider.js +0 -43
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-page-route-matcher-provider.js +0 -91
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/dev-app-route-route-matcher-provider.js +0 -112
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-api-route-matcher-provider.js +0 -77
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/dev-pages-route-matcher-provider.js +0 -77
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/file-cache-route-matcher-provider.js +0 -28
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/batched-file-reader.js +0 -106
- package/app/node_modules/next/dist/server/route-matcher-providers/dev/helpers/file-reader/default-file-reader.js +0 -42
- package/app/node_modules/next/dist/server/route-matcher-providers/helpers/cached-route-matcher-provider.js +0 -30
- package/app/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/node-manifest-loader.js +0 -34
- package/app/node_modules/next/dist/server/route-matcher-providers/helpers/manifest-loaders/server-manifest-loader.js +0 -20
- package/app/node_modules/next/dist/server/route-matcher-providers/manifest-route-matcher-provider.js +0 -21
- package/app/node_modules/next/dist/server/route-matcher-providers/pages-api-route-matcher-provider.js +0 -55
- package/app/node_modules/next/dist/server/route-matcher-providers/pages-route-matcher-provider.js +0 -64
- package/app/node_modules/next/dist/server/route-matchers/app-page-route-matcher.js +0 -18
- package/app/node_modules/next/dist/server/route-matchers/app-route-route-matcher.js +0 -15
- package/app/node_modules/next/dist/server/route-matchers/locale-route-matcher.js +0 -68
- package/app/node_modules/next/dist/server/route-matchers/pages-api-route-matcher.js +0 -30
- package/app/node_modules/next/dist/server/route-matchers/pages-route-matcher.js +0 -30
- package/app/node_modules/next/dist/server/route-matchers/route-matcher.js +0 -54
- package/app/node_modules/next/dist/telemetry/events/error-feedback.js +0 -31
- /package/app/.next-cli-build/static/{i0cMBMqFdYWpbajovDyfY → em-yyr0O7qRIA9N8Clc4I}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{i0cMBMqFdYWpbajovDyfY → em-yyr0O7qRIA9N8Clc4I}/_ssgManifest.js +0 -0
package/app/.next-cli-build/static/chunks/{5497-1af4fbf829c885c4.js → 5497-ff8c2e5da835ea40.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({label:e,options:t=[],value:a,onChange:i,placeholder:l="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:u,selectClassName:x,...p}){return(0,s.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",u),children:[e&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:a,onChange:i,disabled:c,className:(0,r.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",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",x),...p,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:l}),t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},1620:(e,t,a)=>{a.d(t,{D:()=>o});var s=a(12115),r=a(90085);function n(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function l(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:a,initTheme:o}=(0,r.A)(),d=(0,s.useSyncExternalStore)(n,i,l);(0,s.useEffect)(()=>{o()},[o]),(0,s.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>o();return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:a,isDark:c}}},4823:(e,t,a)=>{a.d(t,{default:()=>x});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(84588),o=a(11910),d=a(98),c=a(56061),m=a(52679);let u="__none__";function x({providerId:e}){let[t,a]=(0,r.useState)([]),[n,i]=(0,r.useState)(u),[p,h]=(0,r.useState)(""),[g,f]=(0,r.useState)(!1),[b,v]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),[k,N]=(0,r.useState)(null),w=m.Q2[e],C=w?.searchConfig?.baseUrl||"",S=w?.passthroughModels===!0||!!w?.modelsFetcher,O=async()=>{y(!0),N(null);try{let t=await fetch(`/api/providers/${e}/models`,{cache:"no-store"}),a=t.ok?await t.json():null;t.ok&&Array.isArray(a?.models)?N({kind:"ok",count:a.models.length}):N({kind:"err",message:a?.error||`HTTP ${t.status}`})}catch(e){N({kind:"err",message:e.message})}finally{y(!1),setTimeout(()=>N(null),4e3)}};(0,r.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([s,r])=>{if(t)return;a(s.proxyPools||[]);let n=(r.providerStrategies||{})[e]||{};i(n.proxyPoolId||u),h(n.baseUrl||"")}).catch(()=>{}),()=>{t=!0}},[e]);let F=async t=>{f(!0);try{let a=await fetch("/api/settings",{cache:"no-store"}),s=(a.ok?await a.json():{}).providerStrategies||{},r={...s[e]||{},...t};for(let e of Object.keys(r))(void 0===r[e]||r[e]===u)&&delete r[e];let n={...s};0===Object.keys(r).length?delete n[e]:n[e]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})}),v(!0),setTimeout(()=>v(!1),1500)}catch(e){console.log("Save provider strategy error:",e)}finally{f(!1)}},W=async e=>{i(e),await F({proxyPoolId:e===u?void 0:e})},T=async()=>{let e=p.trim();await F({baseUrl:e||void 0})};return(0,s.jsxs)(l.default,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,s.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."})]}),b&&(0,s.jsx)(c.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,s.jsx)(d.default,{label:"Proxy Pool",value:n,onChange:e=>W(e.target.value),disabled:g,options:[{value:u,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]}),C&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(o.default,{label:"Base URL",placeholder:C,value:p,onChange:e=>h(e.target.value),onBlur:T,disabled:g}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Default: ",C]})]}),S&&(0,s.jsxs)("div",{className:"mt-4 pt-4 border-t border-border",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Live model catalog"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Pulled from upstream. Refresh to pick up new free-promo models the vendor just released."})]}),(0,s.jsxs)("button",{type:"button",onClick:O,disabled:j,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium bg-surface-elevated border border-border hover:bg-surface-hover disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"}),j?"Refreshing...":"Refresh Models"]})]}),k?.kind==="ok"&&(0,s.jsxs)("p",{className:"text-xs text-green-500 mt-2",children:["Found ",k.count," model",1===k.count?"":"s"," from upstream."]}),k?.kind==="err"&&(0,s.jsxs)("p",{className:"text-xs text-red-500 mt-2",children:["Failed: ",k.message]})]})]})}x.propTypes={providerId:i().string.isRequired}},7648:(e,t,a)=>{a.d(t,{default:()=>d});var s=a(95155),r=a(12115),n=a(73321),i=a(65921),l=a(38572),o=a(8823);function d({children:e}){let[t,a]=(0,r.useState)(!1),c=(0,n.usePathname)(),m=(0,i.i)(e=>e.notifications),u=(0,i.i)(e=>e.removeNotification);return(0,s.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,s.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:m.map(e=>{var t;let a="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,s.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${a.wrapper}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:a.icon}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,s.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,s.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,s.jsx)("button",{type:"button",onClick:()=>u(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})}),t&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>a(!1)}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(l.default,{})}),(0,s.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${t?"translate-x-0":"-translate-x-full"}`,children:(0,s.jsx)(l.default,{onClose:()=>a(!1)})}),(0,s.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,s.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),(0,s.jsx)(o.default,{onMenuClick:()=>a(!0)},c),(0,s.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${"/dashboard/basic-chat"===c?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===c?"flex flex-col overflow-hidden":""}`,children:(0,s.jsx)("div",{className:`${"/dashboard/basic-chat"===c?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}},8823:(e,t,a)=>{a.d(t,{default:()=>y});var s=a(95155),r=a(12115),n=a(73321),i=a(98500),l=a.n(i),o=a(14051),d=a.n(o),c=a(57250),m=a(80752),u=a(93308),x=a(38202),p=a(21931);function h(){let[e,t]=(0,r.useState)(!1),[a,n]=(0,r.useState)("en");return(0,r.useEffect)(()=>{n(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${u.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,u.QC)(t)}())},[e]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>t(!0),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Language","data-i18n-skip":"true",children:(0,s.jsx)("span",{className:"text-lg leading-none",children:x.h[a]||"\uD83C\uDF10"})}),(0,s.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),n(e)}})]})}var g=a(38587),f=a(38003),b=a(90620),v=a(52679),j=a(73006);function y({onMenuClick:e,showMenuButton:t=!0}){let a=(0,n.usePathname)(),i=(0,n.useRouter)(),[o,d]=(0,r.useState)(""),[u,x]=(0,r.useState)(""),{title:p,description:f,icon:N,breadcrumbs:w}=(0,r.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],a=t[2],s=v.rj.find(t=>t.id===e),r=v.Q2[a];return{title:r?.name||a,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:s?.label||e,href:`/dashboard/media-providers/${e}`},{label:r?.name||a,image:`/providers/${a}.png`}]}}let a=e.match(/\/media-providers\/([^/]+)$/);if(a){let e=a[1],t=v.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],t=b.zN[e]||b.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through kRouter",icon:"security",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Compress prompts and outputs to save tokens",icon:"savings",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use kRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(a),[a]);(0,r.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let a=await t.json();e||(d(a?.displayName||a?.oidcName||a?.oidcEmail||""),x(a?.loginMethod||""))}catch{e||(d(""),x(""))}}(),()=>{e=!0}},[]);let C=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(i.push("/login"),i.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,s.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,s.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,s.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:w.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:w.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(l(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,s.jsx)("h1",{className:"text-lg lg:text-[28px] lg:leading-9 font-semibold text-text-main tracking-[-0.02em] truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):p?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[N&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl lg:text-[26px]",children:N}),(0,s.jsx)("h1",{className:"text-lg lg:text-[28px] lg:leading-9 font-semibold tracking-[-0.02em] truncate",children:(0,j.Tl)(p)})]}),f&&(0,s.jsx)("p",{className:"hidden lg:block text-[13px] leading-5 text-text-muted truncate mt-0.5",children:(0,j.Tl)(f)})]}):null}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&"OIDC"===u&&(0,s.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,s.jsx)("span",{className:"truncate",children:o}),(0,s.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"OIDC"})]}),(0,s.jsx)(k,{}),(0,s.jsx)(g.default,{}),(0,s.jsx)(h,{}),(0,s.jsx)(m.default,{onLogout:C})]})]})}function k(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),a=(0,f.C)(e=>e.placeholder),r=(0,f.C)(e=>e.setQuery);return e?(0,s.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,s.jsx)("input",{type:"text",value:t,onChange:e=>r(e.target.value),placeholder:a,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,s.jsx)("button",{type:"button",onClick:()=>r(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},10319:(e,t,a)=>{a.d(t,{default:()=>M});var s=a(95155),r=a(12115),n=a(73321),i=a(52679),l=a(56061),o=a(84588),d=a(14051),c=a.n(d);let m=e=>new Intl.NumberFormat().format(e||0);function u({stats:e}){let t;return(0,s.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-4 sm:gap-4",children:[(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold",children:m(e.totalRequests)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:m(e.totalPromptTokens)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:m(e.totalCompletionTokens)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,s.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(t=e.totalCost,`$${(t||0).toFixed(2)}`)]}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}u.propTypes={stats:c().object.isRequired};let x=e=>new Intl.NumberFormat().format(e||0),p=e=>`$${(e||0).toFixed(2)}`;function h(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e))/6e4);return t<1?"Just now":t<60?`${t}m ago`:t<1440?`${Math.floor(t/60)}h ago`:new Date(e).toLocaleDateString()}function g({field:e,currentSort:t,currentOrder:a}){return t!==e?(0,s.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,s.jsx)("span",{className:"ml-1",children:"asc"===a?"↑":"↓"})}function f({item:e,viewMode:t,isSummary:a=!1}){return"tokens"===t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.promptTokens?"—":x(e.promptTokens)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.completionTokens?"—":x(e.completionTokens)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:x(e.totalTokens)})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.inputCost?"—":p(e.inputCost)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.outputCost?"—":p(e.outputCost)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:p(e.totalCost||e.cost)})]})}function b({title:e,columns:t,groupedData:a,tableType:n,sortBy:i,sortOrder:l,onToggleSort:d,viewMode:c,storageKey:m,renderDetailCells:u,renderSummaryCells:x,emptyMessage:p}){let[h,v]=(0,r.useState)(new Set);(0,r.useEffect)(()=>{try{let e=localStorage.getItem(m);e&&v(new Set(JSON.parse(e)))}catch(e){console.error(`Failed to load ${m}:`,e)}},[m]),(0,r.useEffect)(()=>{try{localStorage.setItem(m,JSON.stringify([...h]))}catch(e){console.error(`Failed to save ${m}:`,e)}},[h,m]);let j=(0,r.useCallback)(e=>{v(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),y=(0,r.useMemo)(()=>"tokens"===c?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[c]),k=t.length+y.length;return(0,s.jsxs)(o.default,{className:"overflow-hidden",children:[(0,s.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,s.jsx)("h3",{className:"font-semibold",children:e})}),(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,s.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,s.jsxs)("tr",{children:[t.map(e=>(0,s.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===e.align?"text-right":""}`,onClick:()=>d(n,e.field),children:[e.label," ",(0,s.jsx)(g,{field:e.field,currentSort:i,currentOrder:l})]},e.field)),y.map(e=>(0,s.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>d(n,e.field),children:[e.label," ",(0,s.jsx)(g,{field:e.field,currentSort:i,currentOrder:l})]},e.field))]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-border",children:[a.map(e=>(0,s.jsxs)(r.Fragment,{children:[(0,s.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>j(e.groupKey),children:[(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${h.has(e.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,s.jsx)("span",{className:`font-medium transition-colors ${e.summary.pending>0?"text-primary":""}`,children:e.groupKey})]})}),x(e),(0,s.jsx)(f,{item:e.summary,viewMode:c,isSummary:!0})]}),h.has(e.groupKey)&&e.items.map(e=>(0,s.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[u(e),(0,s.jsx)(f,{item:e,viewMode:c})]},`detail-${e.key}`))]},e.groupKey)),0===a.length&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:k,className:"px-6 py-8 text-center text-text-muted",children:p})})]})]})})]})}g.propTypes={field:c().string.isRequired,currentSort:c().string.isRequired,currentOrder:c().string.isRequired},f.propTypes={item:c().object.isRequired,viewMode:c().string.isRequired,isSummary:c().bool},b.propTypes={title:c().string.isRequired,columns:c().arrayOf(c().shape({field:c().string.isRequired,label:c().string.isRequired,align:c().string})).isRequired,groupedData:c().array.isRequired,tableType:c().string.isRequired,sortBy:c().string.isRequired,sortOrder:c().string.isRequired,onToggleSort:c().func.isRequired,viewMode:c().string.isRequired,storageKey:c().string.isRequired,renderDetailCells:c().func.isRequired,renderSummaryCells:c().func.isRequired,emptyMessage:c().string.isRequired};var v=a(37206),j=a(21742),y=a(63346),k=a(28408),N=a(32539),w=a(59656),C=a(55433),S=a(40968);let O=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),F=e=>`$${(e||0).toFixed(4)}`;function W({period:e="7d"}){let[t,a]=(0,r.useState)([]),[n,i]=(0,r.useState)(!0),[l,d]=(0,r.useState)("tokens"),c=(0,r.useCallback)(async()=>{i(!0);try{let t=await fetch(`/api/usage/chart?period=${e}`);if(t.ok){let e=await t.json();a(e)}}catch(e){console.error("Failed to fetch chart data:",e)}finally{i(!1)}},[e]);(0,r.useEffect)(()=>{c()},[c]);let m=t.some(e=>e.tokens>0||e.cost>0);return(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,s.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto sm:self-start",children:[(0,s.jsx)("button",{onClick:()=>d("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===l?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,s.jsx)("button",{onClick:()=>d("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===l?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),n?(0,s.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):m?(0,s.jsx)(j.u,{width:"100%",height:220,children:(0,s.jsxs)(y.Q,{data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,s.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,s.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,s.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,s.jsx)(k.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,s.jsx)(N.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,s.jsx)(w.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===l?O:F,width:50}),(0,s.jsx)(C.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(e,t)=>"tokens"===t?[O(e),"Tokens"]:[F(e),"Cost"]}),"tokens"===l?(0,s.jsx)(S.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,s.jsx)(S.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,s.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function T(e){let t=i.Q2[e];return!t?.serviceKinds||t.serviceKinds.includes("llm")}W.propTypes={period:c().string};let $=(0,v.default)(()=>Promise.all([a.e(2574),a.e(3862),a.e(6357),a.e(3521)]).then(a.bind(a,63521)),{loadableGenerated:{webpack:()=>[63521]},ssr:!1});function I({timestamp:e}){let t,[,a]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,s.jsx)(s.Fragment,{children:(t=Math.floor((Date.now()-new Date(e))/1e3))<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`})}function A({requests:e=[]}){return(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,s.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),e.length?(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,s.jsxs)("tr",{className:"border-b border-border",children:[(0,s.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,s.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,s.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,s.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=!e.status||"ok"===e.status||"success"===e.status;return(0,s.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,s.jsx)("td",{className:"py-1.5",children:(0,s.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${a?"bg-success":"bg-error"}`})}),(0,s.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:e.model,children:e.model}),(0,s.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,s.jsxs)("span",{className:"text-primary",children:[x(e.promptTokens),"↑"]})," ",(0,s.jsxs)("span",{className:"text-success",children:[x(e.completionTokens),"↓"]})]}),(0,s.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,s.jsx)(I,{timestamp:e.timestamp})})]},t)})})]})}):(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function P(e,t={},a,s){return Object.entries(e||{}).map(([e,a])=>{let s=(a.promptTokens||0)+(a.completionTokens||0),r=a.cost||0,n=s>0?(a.promptTokens||0)*(r/s):0,i=s>0?(a.completionTokens||0)*(r/s):0;return{...a,key:e,totalTokens:s,totalCost:r,inputCost:n,outputCost:i,pending:t[e]||0}}).sort((e,t)=>{let r=e[a],n=t[a];return("string"==typeof r&&(r=r.toLowerCase()),"string"==typeof n&&(n=n.toLowerCase()),r<n)?"asc"===s?-1:1:r>n?"asc"===s?1:-1:0})}function E(e,t){if(!Array.isArray(e))return[];let a={};return e.forEach(e=>{let s=function(e,t){switch(t){case"rawModel":return e.rawModel||"Unknown Model";case"accountName":return e.accountName||`Account ${e.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":{let t=e.keyName||"Unknown Key";return e.apiKeyMasked&&e.apiKeyMasked!==t?`${t} (${e.apiKeyMasked})`:t}case"endpoint":return e.endpoint||"Unknown Endpoint";default:return e[t]||"Unknown"}}(e,t);a[s]||(a[s]={groupKey:s,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let r=a[s].summary;r.requests+=e.requests||0,r.promptTokens+=e.promptTokens||0,r.completionTokens+=e.completionTokens||0,r.totalTokens+=e.totalTokens||0,r.cost+=e.cost||0,r.inputCost+=e.inputCost||0,r.outputCost+=e.outputCost||0,r.pending+=e.pending||0,e.lastUsed&&(!r.lastUsed||new Date(e.lastUsed)>new Date(r.lastUsed))&&(r.lastUsed=e.lastUsed),a[s].items.push(e)}),Object.values(a)}let R=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],D=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],z=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],L=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],_=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function M({period:e,setPeriod:t,hidePeriodSelector:a=!1}={}){let o=(0,n.useRouter)(),d=(0,n.useSearchParams)(),c=d.get("sortBy")||"rawModel",m=d.get("sortOrder")||"asc",[p,g]=(0,r.useState)(null),[f,v]=(0,r.useState)(!0),[j,y]=(0,r.useState)(!1),[k,N]=(0,r.useState)("model"),[w,C]=(0,r.useState)("costs"),[S,O]=(0,r.useState)([]),[F,I]=(0,r.useState)("today"),U=(0,r.useRef)(!0),K=(0,r.useRef)(!1),B=e??F,V=t??I;(0,r.useEffect)(()=>{Promise.all([fetch("/api/providers").then(e=>e.ok?e.json():null),fetch("/api/provider-nodes").then(e=>e.ok?e.json():null)]).then(([e,t])=>{let a={};for(let e of t?.nodes||[])a[e.id]=e.name;let s=new Set;O([...(e?.connections||[]).filter(e=>!(!1===e.isActive||!T(e.provider)||i.Q2[e.provider]?.hidden||s.has(e.provider))&&(s.add(e.provider),!0)).map(e=>({...e,nodeName:a[e.provider]||null})),...Object.values(i.IS).filter(e=>e.noAuth&&!e.hidden&&!s.has(e.id)&&T(e.id)).map(e=>({provider:e.id,name:e.name}))])}).catch(()=>{})},[]),(0,r.useEffect)(()=>{U.current?(U.current=!1,v(!0)):y(!0),fetch(`/api/usage/stats?period=${B}`).then(e=>e.ok?e.json():null).then(e=>{e&&(K.current=!0,g(t=>({...t,...e})))}).catch(()=>{}).finally(()=>{v(!1),y(!1)})},[B]),(0,r.useEffect)(()=>{let e=new EventSource("/api/usage/stream");return e.onmessage=e=>{try{let t=JSON.parse(e.data);g(e=>e?{...e,activeRequests:t.activeRequests,recentRequests:t.recentRequests,errorProvider:t.errorProvider,pending:t.pending}:e),K.current&&v(!1)}catch(e){console.error("[SSE CLIENT] parse error:",e)}},e.onerror=()=>v(!1),()=>e.close()},[]);let G=(0,r.useCallback)((e,t)=>{let a=new URLSearchParams(d.toString());a.get("sortBy")===t?a.set("sortOrder","asc"===a.get("sortOrder")?"desc":"asc"):(a.set("sortBy",t),a.set("sortOrder","asc")),o.replace(`?${a.toString()}`,{scroll:!1})},[d,o]),J=(0,r.useMemo)(()=>{if(!p)return null;switch(k){case"model":{let e=p.pending?.byModel||{};return{columns:R,groupedData:E(P(p.byModel,e,c,m),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"account":{let e={};return p?.pending?.byAccount&&Object.entries(p.byAccount||{}).forEach(([t,a])=>{let s=p.pending.byAccount[a.connectionId];if(s){let r=a.provider?`${a.rawModel} (${a.provider})`:a.rawModel;e[t]=s[r]||0}}),{columns:q,groupedData:E(P(p.byAccount,e,c,m),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.accountName||`Account ${e.connectionId?.slice(0,8)}...`}),(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"apiKey":return{columns:D,groupedData:E(P(p.byApiKey,{},c,m),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-xs",children:e.apiKeyMasked||e.keyName}),(0,s.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})};default:return{columns:z,groupedData:E(P(p.byEndpoint,{},c,m),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:e.endpoint}),(0,s.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}},[p,k,c,m]);if(!p&&!f)return(0,s.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let Q=(0,s.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!a&&(0,s.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,s.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:_.map(e=>(0,s.jsx)("button",{onClick:()=>V(e.value),disabled:j,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${B===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:e.label},e.value))}),j&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),f?Q:(0,s.jsx)(u,{stats:p}),f?Q:(0,s.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-2 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]",children:[(0,s.jsx)($,{providers:S,activeRequests:p.activeRequests||[],lastProvider:p.recentRequests?.[0]?.provider||"",errorProvider:p.errorProvider||""}),(0,s.jsx)(A,{requests:p.recentRequests||[]})]}),f?Q:(0,s.jsx)(W,{period:B}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("select",{value:k,onChange:e=>N(e.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:L.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,s.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,s.jsx)("button",{onClick:()=>C("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===w?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,s.jsx)("button",{onClick:()=>C("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===w?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),f?Q:J&&(0,s.jsx)(b,{title:"",columns:J.columns,groupedData:J.groupedData,tableType:k,sortBy:c,sortOrder:m,onToggleSort:G,viewMode:w,storageKey:J.storageKey,renderSummaryCells:J.renderSummaryCells,renderDetailCells:J.renderDetailCells,emptyMessage:J.emptyMessage})]})]})}},11059:(e,t,a)=>{a.d(t,{C:()=>r});var s=a(12115);function r(e=2e3){let[t,a]=(0,s.useState)(null),n=(0,s.useRef)(null);return{copied:t,copy:(0,s.useCallback)((t,s="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),a(s),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{a(null)},e)},[e])}}},11910:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({label:e,type:t="text",placeholder:a,value:i,onChange:l,error:o,hint:d,icon:c,disabled:m=!1,required:u=!1,className:x,inputClassName:p,...h}){return(0,s.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",x),children:[e&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,u&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[c&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,s.jsx)("input",{type:t,placeholder:a,value:i,onChange:l,disabled:m,className:(0,r.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},21931:(e,t,a)=>{a.d(t,{default:()=>d});var s=a(95155),r=a(12115),n=a(47650),i=a(93308),l=a(73006);let o=e=>({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"},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"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:a,hideTrigger:c=!1}){let[m,u]=(0,r.useState)("en"),[x,p]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!1),f=(0,r.useRef)(null),b="boolean"==typeof t,v=b?t:h,j=e=>{b?!e&&a&&a(m):g(e)};(0,r.useEffect)(()=>{u(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[]),(0,r.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&j(!1)}if(v)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let y=async e=>{if(e!==m&&!x){p(!0),j(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,l.wn)(),u(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,s.jsxs)("div",{className:e,children:[!c&&(0,s.jsxs)("button",{onClick:()=>j(!v),disabled:x,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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:o(m).name}),(0,s.jsx)("span",{className:"text-lg",children:o(m).flag})]}),v&&(0,n.createPortal)((0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,s.jsxs)("div",{ref:f,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]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>j(!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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,s.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=m===e,a=o(e);return(0,s.jsxs)("button",{onClick:()=>y(e),disabled:x,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${x?"opacity-70 cursor-wait":""}`,title:a.name,children:[(0,s.jsx)("span",{className:"text-2xl",children:a.flag}),(0,s.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:a.name}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},23615:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(12115),n=a(84588);function i(){let[e,t]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[l,o]=(0,r.useState)(!0);(0,r.useEffect)(()=>{d()},[]),(0,r.useEffect)(()=>{let e;return l&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[l]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let a=await e.json();t(a)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("span",{children:"Auto Refresh (3s)"}),(0,s.jsx)("div",{onClick:()=>o(!l),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${l?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,s.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${l?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,s.jsx)(n.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,s.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:a&&0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,s.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,s.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=e.split(" | ");if(a.length<7)return null;let r=a[6],n=r.includes("PENDING"),i=r.includes("FAILED"),l=r.includes("OK");return(0,s.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${n?"bg-primary/5":""}`,children:[(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:a[0]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:a[1]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:a[2]})}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:a[3],children:a[3]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:a[4]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:a[5]}),(0,s.jsx)("td",{className:`px-3 py-1.5 font-bold ${l?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:r})]},t)})})]})})}),(0,s.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[n,i]=(0,r.useState)(""),[d,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(null),[x,p]=(0,r.useState)(!1),h=async()=>{if(!n.trim())return void u("Please paste your cookie");c(!0),u(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:n.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),g()},1500)}catch(e){u(e.message)}finally{c(!1)}},g=()=>{i(""),u(null),p(!1),a?.()};return(0,s.jsx)(l.aF,{isOpen:e,onClose:g,title:"iFlow Cookie Authentication",children:(0,s.jsx)("div",{className:"space-y-4",children:x?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,s.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,s.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,s.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,s.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,s.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,s.jsx)("li",{children:"Login to your account"}),(0,s.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,s.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,s.jsx)("li",{children:"Paste it below"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,s.jsx)("textarea",{value:n,onChange:e=>i(e.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:d})]}),m&&(0,s.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-error",children:m})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(l.$n,{variant:"secondary",onClick:g,disabled:d,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(l.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,a)=>{a.d(t,{CardSkeleton:()=>o,PageLoading:()=>i,Skeleton:()=>l,Spinner:()=>n,default:()=>d});var s=a(95155),r=a(31474);function n({size:e="md",className:t}){return(0,s.jsx)("span",{className:(0,r.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(n,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function l({className:e,...t}){return(0,s.jsx)("div",{className:(0,r.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,s.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(l,{className:"h-4 w-24"}),(0,s.jsx)(l,{className:"size-10 rounded-[10px]"})]}),(0,s.jsx)(l,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(l,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,s.jsx)(i,{...t});case"skeleton":return(0,s.jsx)(l,{...t});case"card":return(0,s.jsx)(o,{...t});default:return(0,s.jsx)(n,{...t})}}},28058:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(12115),n=a(81127);function i({isOpen:e,onClose:t,onAdd:a,addedNames:l=[]}){let[o,d]=(0,r.useState)([]),[c,m]=(0,r.useState)(!1),[u,x]=(0,r.useState)(""),[p,h]=(0,r.useState)("all"),[g,f]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[j,y]=(0,r.useState)({}),[k,N]=(0,r.useState)({}),[w,C]=(0,r.useState)({});(0,r.useEffect)(()=>{!e||o.length>0||(m(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?f(e.error):d(e.servers||[])}).catch(e=>f(e.message)).finally(()=>m(!1)))},[e]);let S=(0,r.useMemo)(()=>new Set(l),[l]),O=(0,r.useMemo)(()=>{let e=u.trim().toLowerCase();return o.filter(t=>("authless"!==p||!t.oauth)&&("oauth"!==p||!!t.oauth)&&(!e||(t.title||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)))},[o,u,p]),F=async e=>{if(!j[e.url]){N(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),a=await t.json(),s=a.tools||[],r=Array.isArray(e.toolNames)?e.toolNames:[],n=s.length>0?s.map(e=>e.name):r;y(t=>({...t,[e.url]:{tools:s,requiresAuth:!!a.requiresAuth,error:a.error}})),C(t=>({...t,[e.url]:Object.fromEntries(n.map(e=>[e,!0]))}))}catch(t){y(a=>({...a,[e.url]:{tools:[],error:t.message}}))}finally{N(t=>({...t,[e.url]:!1}))}}},W=(e,t)=>{let a=w[e]||{};C(s=>({...s,[e]:Object.fromEntries(Object.keys(a).map(e=>[e,t]))}))};return(0,s.jsx)(n.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,s.jsxs)("select",{value:p,onChange:e=>h(e.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,s.jsx)("option",{value:"all",children:"All"}),(0,s.jsx)("option",{value:"authless",children:"Authless"}),(0,s.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),g&&(0,s.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:g}),c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===O.length&&(0,s.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),O.map(e=>{let t=S.has(e.slug||e.name),r=b===e.url,n=j[e.url],i=k[e.url],l=w[e.url]||{},o=Object.keys(l),d=Object.values(l).filter(Boolean).length;return(0,s.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,s.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,s.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,s.jsx)("button",{onClick:()=>t?null:void(b===e.url?v(null):(v(e.url),F(e))),disabled:t,className:`shrink-0 px-2 py-1 rounded text-[10px] font-medium transition-colors ${t?"bg-green-500/10 text-green-600 cursor-default":r?"bg-surface border border-border text-text-muted hover:bg-black/5":"bg-primary/10 border border-primary/40 text-primary hover:bg-primary/20"}`,children:t?"Added":r?"Cancel":"+ Add"})]}),r&&(0,s.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Probing server for tools..."})]}),!i&&n?.requiresAuth&&(0,s.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&&n?.error&&!n?.requiresAuth&&(0,s.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",n.error]}),!i&&0===o.length&&!n?.requiresAuth&&!n?.error&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{onClick:()=>W(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,s.jsx)("button",{onClick:()=>W(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,s.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,s.jsx)("input",{type:"checkbox",checked:!!l[t],onChange:()=>{var a;return a=e.url,void C(e=>({...e,[a]:{...e[a],[t]:!e[a]?.[t]}}))},className:"size-3"}),(0,s.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,s.jsx)("button",{onClick:()=>{let t,s;return s=Object.keys(t=w[e.url]||{}).filter(e=>t[e]),void(a?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:s}),v(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,s.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[O.length," of ",o.length," servers"]})]})})}},28067:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({options:e=[],value:t,onChange:a,size:i="md",className:l}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,s.jsx)("div",{className:(0,r.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",l),children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>a(e.value),className:(0,r.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28815:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(81127),i=a(92542),l=a(11059);function o({isOpen:e,onClose:t,title:a="Manual Configuration",configs:d=[]}){let{copy:c}=(0,l.C)(),[m,u]=(0,r.useState)(null);return(0,s.jsx)(n.default,{isOpen:e,onClose:t,title:a,size:"xl",children:(0,s.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,s.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var a;return a=e.content,void(c(a,`manualconfig-${t}`),u(t),setTimeout(()=>u(null),2e3))},children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:m===t?"check":"content_copy"}),m===t?"Copied!":"Copy"]})]}),(0,s.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:e.content})]},t))})})}},29366:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(28777),n=a(97677);function i({caps:e,className:t="",colorOverride:a,size:l=16}){if(!e)return null;let o=Object.keys(r.bs).filter(t=>e[t]);return 0===o.length?null:(0,s.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:o.map(e=>(0,s.jsx)(n.default,{text:`${r.bs[e].label} — ${r.bs[e].desc}`,children:(0,s.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${a||r.bs[e].color}`,style:{fontSize:`${l}px`},children:r.bs[e].icon})},e))})}},30815:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[n,i]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,u]=(0,r.useState)(null),[x,p]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!1),[f,b]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),y=async()=>{g(!0),u(null),b(!1),j(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(i(t.accessToken),c(t.machineId),b(!0)):t.windowsManual?j(!0):u(t.error||"Could not auto-detect tokens")}catch(e){u("Failed to auto-detect tokens")}finally{g(!1)}};(0,r.useEffect)(()=>{e&&y()},[e]);let k=async()=>{if(!n.trim())return void u("Please enter an access token");if(!d.trim())return void u("Please enter a machine ID");p(!0),u(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:n.trim(),machineId:d.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t?.(),a()}catch(e){u(e.message)}finally{p(!1)}};return(0,s.jsx)(l.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:a,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,s.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,s.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,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,s.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,s.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,s.jsx)(l.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!m&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("textarea",{value:n,onChange:e=>i(e.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,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(l.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,s.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,s.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:k,fullWidth:!0,disabled:x||!n.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,s.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},31474:(e,t,a)=>{a.d(t,{cn:()=>s});function s(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},35497:(e,t,a)=>{a.d(t,{x0:()=>N.default,Ex:()=>d.default,$n:()=>s.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,uo:()=>l.ConfirmModal,G9:()=>v.default,wI:()=>k.default,vj:()=>y.default,vE:()=>j.default,pd:()=>r.default,Mh:()=>b.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>l.default,rq:()=>u.default,gw:()=>w.default,LF:()=>m.default,Wx:()=>O.default,gM:()=>f.default,Iz:()=>C.default,l6:()=>n.default,lM:()=>c.default,m_:()=>S.default,jK:()=>g.default});var s=a(92542),r=a(11910),n=a(98),i=a(84588),l=a(81127),o=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(38572),a(8823),a(92173);var m=a(90882),u=a(46067),x=a(28815),p=a(45455),h=a(28058),g=a(10319);a(29366),a(21931),a(80752),a(97556);var f=a(23615);a(61500);var b=a(62899);a(94230);var v=a(30815),j=a(23936),y=a(95088),k=a(73579),N=a(96748),w=a(4823),C=a(28067),S=a(97677),O=a(51825);a(7648),a(91450)},38003:(e,t,a)=>{a.d(t,{C:()=>s});let s=(0,a(1934).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},38202:(e,t,a)=>{a.d(t,{h:()=>s});let s={en:"\uD83C\uDDFA\uD83C\uDDF8",vi:"\uD83C\uDDFB\uD83C\uDDF3","zh-CN":"\uD83C\uDDE8\uD83C\uDDF3","zh-TW":"\uD83C\uDDF9\uD83C\uDDFC",ja:"\uD83C\uDDEF\uD83C\uDDF5","pt-BR":"\uD83C\uDDE7\uD83C\uDDF7","pt-PT":"\uD83C\uDDF5\uD83C\uDDF9",ko:"\uD83C\uDDF0\uD83C\uDDF7",es:"\uD83C\uDDEA\uD83C\uDDF8",de:"\uD83C\uDDE9\uD83C\uDDEA",fr:"\uD83C\uDDEB\uD83C\uDDF7",he:"\uD83C\uDDEE\uD83C\uDDF1",ar:"\uD83C\uDDF8\uD83C\uDDE6",ru:"\uD83C\uDDF7\uD83C\uDDFA",pl:"\uD83C\uDDF5\uD83C\uDDF1",cs:"\uD83C\uDDE8\uD83C\uDDFF",nl:"\uD83C\uDDF3\uD83C\uDDF1",tr:"\uD83C\uDDF9\uD83C\uDDF7",uk:"\uD83C\uDDFA\uD83C\uDDE6",tl:"\uD83C\uDDF5\uD83C\uDDED",id:"\uD83C\uDDEE\uD83C\uDDE9",th:"\uD83C\uDDF9\uD83C\uDDED",hi:"\uD83C\uDDEE\uD83C\uDDF3",bn:"\uD83C\uDDE7\uD83C\uDDE9",ur:"\uD83C\uDDF5\uD83C\uDDF0",ro:"\uD83C\uDDF7\uD83C\uDDF4",sv:"\uD83C\uDDF8\uD83C\uDDEA",it:"\uD83C\uDDEE\uD83C\uDDF9",el:"\uD83C\uDDEC\uD83C\uDDF7",hu:"\uD83C\uDDED\uD83C\uDDFA",fi:"\uD83C\uDDEB\uD83C\uDDEE",da:"\uD83C\uDDE9\uD83C\uDDF0",no:"\uD83C\uDDF3\uD83C\uDDF4"}},38572:(e,t,a)=>{a.d(t,{default:()=>F});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(98500),o=a.n(l),d=a(73321),c=a(31474),m=a(90620),u=a(52679),x=a(11059),p=a(92542),h=a(81127);let g="krouter@kodelyth.com",f=[{id:"whatsapp",label:"WhatsApp",detail:"+880 1312 365939",href:"https://wa.me/8801312365939",icon:"whatsapp",tint:"#25D366"},{id:"email",label:"Email",detail:g,href:`mailto:${g}`,icon:"mail",tint:"#2d5bff"}];function b({className:e}){return(0,s.jsx)("svg",{viewBox:"-0.69 -0.69 25.38 25.38",fill:"currentColor","aria-hidden":"true",className:e,children:(0,s.jsx)("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.174.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51l-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.872.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}function v({className:e}){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:[(0,s.jsx)("path",{d:"M0.7 6.1V6A2.8 2.8 0 0 1 3.5 3.2h17a2.8 2.8 0 0 1 2.8 2.8v.14l-11.3 6.68L0.7 6.1Z"}),(0,s.jsx)("path",{d:"M23.3 8.9v9.13a2.8 2.8 0 0 1-2.8 2.8H3.5a2.8 2.8 0 0 1-2.8-2.8V8.9l10.6 6.25c.45.26.99.26 1.44 0L23.3 8.9Z"})]})}function j({className:e}){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3.6"}),(0,s.jsx)("path",{d:"m5.6 5.6 3.85 3.85M14.55 14.55l3.85 3.85M18.4 5.6l-3.85 3.85M9.45 14.55 5.6 18.4"})]})}b.propTypes={className:i().string},v.propTypes={className:i().string},j.propTypes={className:i().string};let y={whatsapp:b,mail:v};function k({className:e}){let[t,a]=(0,r.useState)(!1),n=(0,r.useRef)(null),i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!t)return;let e=e=>{n.current&&!n.current.contains(e.target)&&a(!1)},s=e=>{"Escape"===e.key&&(a(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",s)}},[t]),(0,s.jsxs)("div",{ref:n,className:(0,c.cn)("relative",e),children:[(0,s.jsx)("div",{id:"support-channels",role:"group","aria-label":"Support channels",className:(0,c.cn)("grid transition-all duration-200 ease-out",t?"grid-rows-[1fr] opacity-100 mb-1":"grid-rows-[0fr] opacity-0"),children:(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)("div",{className:"space-y-0.5 pb-1",children:f.map(e=>{let r=y[e.icon];return(0,s.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",onClick:()=>a(!1),tabIndex:t?0:-1,"aria-hidden":!t,className:(0,c.cn)("flex w-full box-border items-center gap-3 px-3 py-2 rounded-lg group","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60","transition-colors"),children:[(0,s.jsx)("span",{className:"flex items-center justify-center size-7 rounded-md shrink-0 transition-colors",style:e.tint?{color:e.tint,backgroundColor:`${e.tint}1a`}:void 0,children:r?(0,s.jsx)(r,{className:"size-4"}):null}),(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block text-[13px] font-medium leading-tight truncate",children:e.label}),(0,s.jsx)("span",{className:"block text-[11px] text-text-muted truncate",children:e.detail})]})]},e.id)})})})}),(0,s.jsxs)("button",{ref:i,type:"button",onClick:()=>a(e=>!e),"aria-expanded":t,"aria-controls":"support-channels",className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-2 rounded-lg group transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",t?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)(j,{className:(0,c.cn)("size-[18px] shrink-0 transition-colors",t?"":"group-hover:text-primary")}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:"Support"}),(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:(0,c.cn)("size-3.5 ml-auto shrink-0 transition-transform duration-200",t?"rotate-180":""),children:(0,s.jsx)("path",{d:"m6 15 6-6 6 6"})})]})]})}k.propTypes={className:i().string};let N=["embedding","image","video","tts","stt"],w="/dashboard/media-providers/web",C=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/pxpipe",label:"PXPIPE",icon:"image"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],S=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],O=[{href:"/dashboard/presidio",label:"Presidio",icon:"admin_panel_settings"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"},{href:"/dashboard/environment",label:"Environment",icon:"tune"}];function F({onClose:e}){let t=(0,d.usePathname)(),[a,n]=(0,r.useState)(!1),[i,l]=(0,r.useState)(!1),[g,f]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),[T,$]=(0,r.useState)(0),[I,A]=(0,r.useState)(!1),{copied:P,copy:E}=(0,x.C)(2e3),R=m.h0.installCmdLatest;(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&A(!0)}).catch(()=>{})},[]),(0,r.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&f(e)}).catch(()=>{})},[]);let q=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),D=async()=>{try{await navigator.clipboard.writeText(R)}catch{}E(R);let e=m.h0.shutdownCountdownSec;$(e);let t=setInterval(()=>{$(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),l(!0))},1e3)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,s.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,s.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3 group",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-9 rounded-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)] transition-transform group-hover:scale-[1.03]",children:(0,s.jsx)("svg",{viewBox:"0 0 400 400",className:"size-[22px]","aria-hidden":"true",children:(0,s.jsxs)("g",{fill:"none",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polyline",{points:"128,104 184,200 128,296",strokeWidth:"28",strokeOpacity:"0.25"}),(0,s.jsx)("polyline",{points:"172,100 260,200 172,300",strokeWidth:"52"})]})})}),(0,s.jsxs)("div",{className:"flex flex-col leading-none",children:[(0,s.jsx)("h1",{className:"text-[17px] font-bold text-text-main",style:{fontFamily:"var(--font-display)",letterSpacing:"-0.01em"},children:m.vQ.name}),(0,s.jsxs)("span",{className:"text-[11px] text-text-muted mt-[3px] font-medium tabular-nums",children:["v",m.vQ.version]})]})]}),g&&(0,s.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",g.latestVersion]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{onClick:()=>v(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,s.jsx)("button",{onClick:()=>E(R),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,s.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:P?"✓ copied!":R})})]})]})]}),(0,s.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[C.map(t=>(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,s.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,s.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:"System"}),(0,s.jsxs)("button",{onClick:()=>n(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,s.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:a?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),a&&(0,s.jsxs)("div",{className:"pl-4",children:[u.rj.filter(e=>N.includes(e.id)).map(a=>(0,s.jsxs)(o(),{href:`/dashboard/media-providers/${a.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${a.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:a.icon}),(0,s.jsx)("span",{className:"text-sm",children:a.label})]},a.id)),(0,s.jsxs)(o(),{href:w,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(w)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,s.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),O.map(t=>(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),S.map(t=>"/dashboard/translator"!==t.href||I?(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,s.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,s.jsx)("div",{className:"px-4 pb-3 pt-2 border-t border-border-subtle",children:(0,s.jsx)(k,{})})]}),(0,s.jsx)(h.ConfirmModal,{isOpen:b,onClose:()=>v(!1),onConfirm:()=>{v(!1),y(!0)},title:"Update kRouter",message:`Show install command for v${g?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(i||j)&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:j?(0,s.jsx)(W,{latestVersion:g?.latestVersion,installCmd:R,copied:P,onCopyAndShutdown:D,onCancel:()=>{y(!1),$(0)},countdown:T,isDisconnected:i}):(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,s.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,s.jsx)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function W({latestVersion:e,installCmd:t,copied:a,onCopyAndShutdown:r,onCancel:n,countdown:i,isDisconnected:l}){let o=i>0;return(0,s.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Update kRouter",e?` to v${e}`:""]}),(0,s.jsx)("p",{className:"text-xs text-white/60",children:l?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${i}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,s.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,s.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,s.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,s.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,s.jsxs)("li",{children:["Click ",(0,s.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,s.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,s.jsxs)("li",{children:["Run ",(0,s.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"krouter"})," again after install."]})]}),l?(0,s.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.default,{variant:"secondary",onClick:n,disabled:o,children:"Cancel"}),(0,s.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:r,disabled:o,children:a?"✓ Copied — shutting down...":o?`Shutting down in ${i}s`:"Copy & Shutdown"})]})]})}F.propTypes={onClose:i().func},W.propTypes={latestVersion:i().string,installCmd:i().string.isRequired,copied:i().bool,onCopyAndShutdown:i().func.isRequired,onCancel:i().func.isRequired,countdown:i().number,isDisconnected:i().bool}},38587:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(1620),n=a(31474);function i({className:e,variant:t="default"}){let{isDark:a,toggleTheme:l}=(0,r.D)(),o={default:(0,n.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,n.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,s.jsx)("button",{onClick:l,className:(0,n.cn)(o[t],e),"aria-label":`Switch to ${a?"light":"dark"} mode`,title:`Switch to ${a?"light":"dark"} mode`,children:(0,s.jsx)("span",{className:(0,n.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:a?"light_mode":"dark_mode"})})}},45455:(e,t,a)=>{a.d(t,{default:()=>m});var s=a(95155),r=a(12115),n=a(81127),i=a(11910),l=a(92542),o=a(46067);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:a,isLast:n,onEdit:i,onMoveUp:l,onMoveDown:o,onRemove:d}){let[m,u]=(0,r.useState)(!1),[x,p]=(0,r.useState)(t),h=()=>{let e=x.trim();e&&e!==t?i(e):p(t),u(!1)};return(0,s.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,s.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,s.jsx)("input",{autoFocus:!0,value:x,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),u(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,s.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:()=>u(!0),title:"Click to edit",children:t}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,s.jsx)("button",{onClick:o,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,s.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:a,onSave:u,activeProviders:x,kindFilter:p=null,forcePrefix:h="",title:g}){let f=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[b,v]=(0,r.useState)(f),[j,y]=(0,r.useState)(t?.models||[]),[k,N]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),[S,O]=(0,r.useState)(""),[F,W]=(0,r.useState)({});(0,r.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&W(e.aliases||{})).catch(()=>{})},[e]);let T=e=>{if(!e.trim())return O("Name is required"),!1;let t=h+e;return d.test(t)?(O(""),!0):(O("Only letters, numbers, -, _ and . allowed"),!1)},$=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),v(t),t?T(t):O("")},I=async()=>{T(b)&&(C(!0),await u({name:h+b.trim(),models:j}),C(!1))},A=!!t;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{isOpen:e,onClose:a,title:g||(A?"Edit Combo":"Create Combo"),children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{children:[h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,s.jsxs)("div",{className:"flex items-stretch",children:[(0,s.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:h}),(0,s.jsx)("input",{value:b,onChange:$,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"})]}),S&&(0,s.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,s.jsx)(i.default,{label:"Combo Name",value:b,onChange:$,placeholder:"my-combo",error:S}),(0,s.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===j.length?(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,s.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:j.map((e,t)=>(0,s.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===j.length-1,onEdit:e=>{let a=[...j];a[t]=e,y(a)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...j];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===j.length-1)return;let t=[...j];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(j.filter((e,a)=>a!==t))},t))}),(0,s.jsxs)("button",{onClick:()=>N(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,s.jsx)(l.default,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(l.default,{onClick:I,fullWidth:!0,size:"sm",disabled:!b.trim()||!!S||w,children:w?"Saving...":A?"Save":"Create"})]})]})}),(0,s.jsx)(o.default,{isOpen:k,onClose:()=>N(!1),onSelect:e=>{j.includes(e.value)||y([...j,e.value])},onDeselect:e=>{y(j.filter(t=>t!==e.value))},activeProviders:x,modelAliases:F,title:"Add Model to Combo",kindFilter:p,addedModelValues:j,closeOnSelect:!1})]})}},46067:(e,t,a)=>{a.d(t,{default:()=>N});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(81127),o=a(57250),d=a(29366);function c(e,t){return RegExp("^"+e.split("*").map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(t)}let m={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,contextWindow:2e5,maxOutput:64e3},u={"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-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:64e3},"claude-sonnet-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-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5":{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",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},...Object.fromEntries(["high","medium","low"].flatMap(e=>[[`claude-opus-5-5-${e}`,{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3}],[`claude-sonnet-5-5-${e}`,{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,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",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},"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}},x=e=>({vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:e,maxOutput:128e3}),p=Object.fromEntries(["gpt-5.6-sol","gpt-5.6-terra","gpt-5.6-luna"].flatMap(e=>["","-thinking","-agentic","-thinking-agentic"].map(t=>[`${e}${t}`,x(272e3)]))),h=Object.fromEntries(Object.entries({"gpt-6-astra":272e3,"gpt-6-sol":272e3,"gpt-6-luna":272e3,"gpt-5.6-sol":372e3,"gpt-5.6-terra":272e3,"gpt-5.6-luna":272e3,"gpt-5.5":4e5,"gpt-5.4":4e5}).flatMap(([e,t])=>[[e,x(t)],[`${e}-review`,x(t)]])),g={kiro:p,kr:p,codex:h,cx:h,"codebuddy-cn":{"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},"glm-5.2":{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},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},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"glm-5.1":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"glm-5.0-turbo":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5v-turbo":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:38e3},"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},"minimax-m2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"kimi-k2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.6":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"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-pro":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"deepseek-v4-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3}},qoder:{ultimate:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},auto:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},performance:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},efficient:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},lite:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},dmodel:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},dfmodel:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},gmodel:{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},gfmodel:{vision:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},kmodel:{vision:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:65536},mmodel:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:512e3},qmodel_latest:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qmodel:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qfmodel:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qmodel_38max:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},"opencode-go":{"claude-haiku-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}}},f=[{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-adaptive",thinkingCanDisable:!1,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*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.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{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*max*",caps:{vision:!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:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:262144}},{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",contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",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",contextWindow:1e6,maxOutput:384e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",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:{reasoning:!0,thinkingFormat:"minimax",contextWindow:1048576,maxOutput:512e3}},{pattern:"*minimax-m2.7*",caps:{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.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,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:"*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}}];function b(e,t){if(!t)return{...m};if(e&&g[e]?.[t])return{...m,...g[e][t]};let a=t.includes("/")?t.split("/").pop():t;if(u[a])return{...m,...u[a]};if(u[t])return{...m,...u[t]};for(let{pattern:e,caps:s}of f)if(c(e,a)||c(e,t))return{...m,...s};return{...m}}var v=a(28777),j=a(52679);let y=[...Object.keys(j.zN),...Object.keys(j.IS),...Object.keys(j.nJ),...Object.keys(j.fg)],k=Object.keys(j.IS).filter(e=>j.IS[e].noAuth&&!j.IS[e].hidden);function N({isOpen:e,onClose:t,onSelect:a,onDeselect:n,selectedModel:i,activeProviders:c=[],title:m="Select Model",modelAliases:u={},kindFilter:x=null,capFilter:p=null,addedModelValues:h=[],closeOnSelect:g=!0}){let f=(0,r.useMemo)(()=>x?c.filter(e=>{let t=j.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(x)}):c,[c,x]),[w,C]=(0,r.useState)(""),[S,O]=(0,r.useState)([]),[F,W]=(0,r.useState)([]),[T,$]=(0,r.useState)([]),[I,A]=(0,r.useState)({}),[P,E]=(0,r.useState)({}),R=async()=>{try{let e=await fetch("/api/combos");if(!e.ok)throw Error(`Failed to fetch combos: ${e.status}`);let t=await e.json();O(t.combos||[])}catch(e){console.error("Error fetching combos:",e),O([])}};(0,r.useEffect)(()=>{e&&R()},[e]);let q=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();W(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),W([])}};(0,r.useEffect)(()=>{e&&q()},[e]);let D=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();$(t.models||[])}catch(e){console.error("Error fetching custom models:",e),$([])}};(0,r.useEffect)(()=>{e&&D()},[e]);let z=async()=>{try{let e=await fetch("/api/models/disabled");if(!e.ok)throw Error(`Failed to fetch disabled models: ${e.status}`);let t=await e.json();A(t.disabled||{})}catch(e){console.error("Error fetching disabled models:",e),A({})}};(0,r.useEffect)(()=>{e&&z()},[e]);let L=async(e,t,{refresh:a=!1}={})=>{E(t=>({...t,[e]:{...t[e]||{},loading:!0,error:null}}));try{let s=new URLSearchParams({provider:e});t&&s.set("connectionId",t),a&&s.set("refresh","1");let r=await fetch(`/api/models/live?${s}`),n=await r.json();E(t=>({...t,[e]:{loading:!1,models:Array.isArray(n.models)?n.models:[],error:n.error||(n.models?.length?null:"No models returned"),source:n.source}}))}catch(t){E(a=>({...a,[e]:{loading:!1,models:[],error:t.message}}))}};(0,r.useEffect)(()=>{if(!e)return;let t=new Set;[...f,...k.map(e=>({provider:e,id:e}))].forEach(e=>{let a=j.Q2[e.provider];if(!a)return;let s=new Set(["kiro","qoder"]);!(!0===a.passthroughModels||a.modelsFetcher||s.has(e.provider))||t.has(e.provider)||(t.add(e.provider),L(e.provider,e.id))})},[e,f.length]);let _=(0,r.useMemo)(()=>({...j.zN,...j.IS,...j.nJ,...j.fg}),[]),M=(0,r.useMemo)(()=>{let e={},t=new Set(["webSearch","webFetch"]),a=new Set(["image","tts","stt","embedding","imageToText"]),s=new Set(["tts","image","webFetch"]);return[...new Set([...f.map(e=>e.provider),...x?k.filter(e=>(j.Q2[e]?.serviceKinds||["llm"]).includes(x)):k])].sort((e,t)=>{let a=y.indexOf(e),s=y.indexOf(t);return(-1===a?999:a)-(-1===s?999:s)}).forEach(r=>{let n=(0,j.wG)(r),i=_[r]||{name:r,color:"#666"},l=(0,j.mq)(r)||(0,j.gb)(r);if(x&&t.has(x)){e[r]={name:i.name,alias:n,color:i.color,models:[{id:r,name:i.name,value:r}]};return}if(i.passthroughModels){let t=Object.entries(u).filter(([,e])=>e.startsWith(`${n}/`)).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:t})),l=P[r],o=new Set(t.map(e=>e.id)),d=[...t,...(l?.models||[]).filter(e=>e?.id&&!o.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isLive:!0}))];x&&a.has(x)&&0===(d=(0,v.KC)(r).filter(e=>e.type===x).map(e=>({id:e.id,name:e.name,value:`${n}/${e.id}`,type:e.type}))).length&&s.has(x)&&(i.serviceKinds||["llm"]).includes(x)&&(d=[{id:r,name:i.name,value:n}]);let c=0===d.length&&(l?.loading||l?.error);if(d.length>0||c){let t=F.find(e=>e.id===r),a=t?.name||i.name;e[r]={name:a,alias:n,color:i.color,models:d,liveStatus:l?{loading:!!l.loading,error:l.error||null,source:l.source,liveCount:(l.models||[]).length}:null}}}else if(l){if(x&&a.has(x))return;let t=c.find(e=>e.provider===r),s=F.find(e=>e.id===r),n=s?.name||t?.name||i.name,l=t?.providerSpecificData?.prefix||s?.prefix||r,o=Object.entries(u).filter(([,e])=>e.startsWith(`${r}/`)).map(([e,t])=>({id:t.replace(`${r}/`,""),name:e,value:`${l}/${t.replace(`${r}/`,"")}`})),d=o.length>0?o:[{id:`__placeholder__${r}`,name:`${l}/model-id`,value:`${l}/model-id`,isPlaceholder:!0}];e[r]={name:n,alias:l,color:i.color,models:d,isCustom:!0,hasModels:o.length>0}}else{var o;let t,l=(0,v.KC)(r),d=new Set(l.map(e=>e.id)),c=l.length>0,m=Object.entries(u).filter(([e,t])=>t.startsWith(`${n}/`)&&(!c||e===t.replace(`${n}/`,""))&&!d.has(t.replace(`${n}/`,""))).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:t,isCustom:!0})),h=new Set(m.map(e=>e.id)),g=T.filter(e=>e.providerAlias===n&&!d.has(e.id)&&!h.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isCustom:!0})),f=new Set([...d,...m.map(e=>e.id),...g.map(e=>e.id)]),j=P[r],y=(j?.models||[]).filter(e=>e?.id&&!f.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isLive:!0})),k=[...l.map(e=>({id:e.id,name:e.name,value:`${n}/${e.id}`,type:e.type})),...m,...g,...y],N=new Set,w=(o=k.filter(e=>!N.has(e.value)&&(N.add(e.value),!0)),t=x?a.has(x)?o.filter(e=>e.isPlaceholder||e.type===x):o:o.filter(e=>e.isPlaceholder||e.isCustom||!e.type||"llm"===e.type),p&&(t=t.filter(e=>{let t=e.value||"",a=t.indexOf("/");return!(a<=0)&&b(t.slice(0,a),t.slice(a+1))?.[p]===!0})),t);0===w.length&&x&&s.has(x)&&(i.serviceKinds||["llm"]).includes(x)&&(w=[{id:r,name:i.name,value:n}]);let C=0===w.length&&(j?.loading||j?.error);(w.length>0||C)&&(e[r]={name:i.name,alias:n,color:i.color,models:w,liveStatus:j?{loading:!!j.loading,error:j.error||null,source:j.source,liveCount:(j.models||[]).length}:null})}}),Object.entries(e).forEach(([t,a])=>{let s=new Set([...I[(0,j.wG)(t)]||[],...I[t]||[]]);0!==s.size&&(a.models=a.models.filter(e=>!s.has(e.id)),0===a.models.length&&delete e[t])}),e},[f,u,_,F,T,I,x,c,P]),U=(0,r.useMemo)(()=>{if(x||p)return[];if(!w.trim())return S;let e=w.toLowerCase();return S.filter(t=>t.name.toLowerCase().includes(e))},[S,w,x,p]),K=(0,r.useMemo)(()=>{let e=w.trim().toLowerCase(),t={};return Object.entries(M).forEach(([a,s])=>{var r;let n=s.models;if(e){let t=s.name.toLowerCase().includes(e);if(0===(n=n.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))).length&&!t)return}t[a]={...s,models:[...(r=n).filter(e=>h.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...r.filter(e=>!h.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}),t},[M,w,h]),B=e=>{let s=e?.value||e?.name||e;h.includes(s)&&n?n(e):a(e),g&&(t(),C(""))};return(0,s.jsxs)(l.default,{isOpen:e,onClose:()=>{t(),C("")},title:m,size:"md",className:"p-4!",footer:null,children:[(0,s.jsxs)("div",{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,s.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,s.jsx)("span",{children:"Click to add, click again to remove. Changes are saved automatically."})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,s.jsx)("input",{type:"text",placeholder:"Search...",value:w,onChange:e=>C(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,s.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[U.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",U.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:U.map(e=>{let t=i===e.name;return(0,s.jsxs)("button",{onClick:()=>B({id:e.name,name:e.name,value:e.name}),className:`
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5497],{98:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({label:e,options:t=[],value:a,onChange:i,placeholder:l="Select an option",error:o,hint:d,disabled:c=!1,required:m=!1,className:u,selectClassName:x,...p}){return(0,s.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",u),children:[e&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,m&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("select",{value:a,onChange:i,disabled:c,className:(0,r.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",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",x),...p,children:[(0,s.jsx)("option",{value:"",disabled:!0,children:l}),t.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,s.jsx)("div",{className:"absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"expand_more"})})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},1620:(e,t,a)=>{a.d(t,{D:()=>o});var s=a(12115),r=a(90085);function n(e){let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}function i(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function l(){return!1}function o(){let{theme:e,setTheme:t,toggleTheme:a,initTheme:o}=(0,r.A)(),d=(0,s.useSyncExternalStore)(n,i,l);(0,s.useEffect)(()=>{o()},[o]),(0,s.useEffect)(()=>{if("system"!==e)return;let t=window.matchMedia("(prefers-color-scheme: dark)"),a=()=>o();return t.addEventListener("change",a),()=>t.removeEventListener("change",a)},[e,o]);let c="dark"===e||"system"===e&&d;return{theme:e,setTheme:t,toggleTheme:a,isDark:c}}},4823:(e,t,a)=>{a.d(t,{default:()=>x});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(84588),o=a(11910),d=a(98),c=a(56061),m=a(52679);let u="__none__";function x({providerId:e}){let[t,a]=(0,r.useState)([]),[n,i]=(0,r.useState)(u),[p,h]=(0,r.useState)(""),[g,f]=(0,r.useState)(!1),[b,v]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),[k,N]=(0,r.useState)(null),w=m.Q2[e],C=w?.searchConfig?.baseUrl||"",S=w?.passthroughModels===!0||!!w?.modelsFetcher,O=async()=>{y(!0),N(null);try{let t=await fetch(`/api/providers/${e}/models`,{cache:"no-store"}),a=t.ok?await t.json():null;t.ok&&Array.isArray(a?.models)?N({kind:"ok",count:a.models.length}):N({kind:"err",message:a?.error||`HTTP ${t.status}`})}catch(e){N({kind:"err",message:e.message})}finally{y(!1),setTimeout(()=>N(null),4e3)}};(0,r.useEffect)(()=>{let t=!1;return Promise.all([fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}).then(e=>e.ok?e.json():{proxyPools:[]}),fetch("/api/settings",{cache:"no-store"}).then(e=>e.ok?e.json():{})]).then(([s,r])=>{if(t)return;a(s.proxyPools||[]);let n=(r.providerStrategies||{})[e]||{};i(n.proxyPoolId||u),h(n.baseUrl||"")}).catch(()=>{}),()=>{t=!0}},[e]);let F=async t=>{f(!0);try{let a=await fetch("/api/settings",{cache:"no-store"}),s=(a.ok?await a.json():{}).providerStrategies||{},r={...s[e]||{},...t};for(let e of Object.keys(r))(void 0===r[e]||r[e]===u)&&delete r[e];let n={...s};0===Object.keys(r).length?delete n[e]:n[e]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:n})}),v(!0),setTimeout(()=>v(!1),1500)}catch(e){console.log("Save provider strategy error:",e)}finally{f(!1)}},W=async e=>{i(e),await F({proxyPoolId:e===u?void 0:e})},T=async()=>{let e=p.trim();await F({baseUrl:e||void 0})};return(0,s.jsxs)(l.default,{children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,s.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."})]}),b&&(0,s.jsx)(c.default,{variant:"success",size:"sm",children:"Saved"})]}),(0,s.jsx)(d.default,{label:"Proxy Pool",value:n,onChange:e=>W(e.target.value),disabled:g,options:[{value:u,label:"None (direct)"},...t.map(e=>({value:e.id,label:e.name}))]}),C&&(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)(o.default,{label:"Base URL",placeholder:C,value:p,onChange:e=>h(e.target.value),onBlur:T,disabled:g}),(0,s.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Default: ",C]})]}),S&&(0,s.jsxs)("div",{className:"mt-4 pt-4 border-t border-border",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{className:"flex-1",children:[(0,s.jsx)("p",{className:"text-sm font-medium",children:"Live model catalog"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"Pulled from upstream. Refresh to pick up new free-promo models the vendor just released."})]}),(0,s.jsxs)("button",{type:"button",onClick:O,disabled:j,className:"inline-flex items-center gap-2 px-3 py-1.5 rounded-md text-xs font-medium bg-surface-elevated border border-border hover:bg-surface-hover disabled:opacity-50",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"refresh"}),j?"Refreshing...":"Refresh Models"]})]}),k?.kind==="ok"&&(0,s.jsxs)("p",{className:"text-xs text-green-500 mt-2",children:["Found ",k.count," model",1===k.count?"":"s"," from upstream."]}),k?.kind==="err"&&(0,s.jsxs)("p",{className:"text-xs text-red-500 mt-2",children:["Failed: ",k.message]})]})]})}x.propTypes={providerId:i().string.isRequired}},7648:(e,t,a)=>{a.d(t,{default:()=>d});var s=a(95155),r=a(12115),n=a(73321),i=a(65921),l=a(38572),o=a(8823);function d({children:e}){let[t,a]=(0,r.useState)(!1),c=(0,n.usePathname)(),m=(0,i.i)(e=>e.notifications),u=(0,i.i)(e=>e.removeNotification);return(0,s.jsxs)("div",{className:"flex h-screen w-full overflow-hidden bg-bg",children:[(0,s.jsx)("div",{className:"fixed top-4 right-4 z-[80] flex w-[min(92vw,380px)] flex-col gap-2",children:m.map(e=>{var t;let a="success"===(t=e.type)?{wrapper:"border-green-500/30 bg-green-500/10 text-green-600 dark:text-green-400",icon:"check_circle"}:"error"===t?{wrapper:"border-red-500/30 bg-red-500/10 text-red-600 dark:text-red-400",icon:"error"}:"warning"===t?{wrapper:"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",icon:"warning"}:{wrapper:"border-blue-500/30 bg-blue-500/10 text-blue-600 dark:text-blue-400",icon:"info"};return(0,s.jsx)("div",{className:`rounded-lg border px-3 py-2 shadow-lg backdrop-blur-sm ${a.wrapper}`,children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px] leading-5",children:a.icon}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[e.title?(0,s.jsx)("p",{className:"text-xs font-semibold mb-0.5",children:e.title}):null,(0,s.jsx)("p",{className:"text-xs whitespace-pre-wrap break-words",children:e.message})]}),e.dismissible?(0,s.jsx)("button",{type:"button",onClick:()=>u(e.id),className:"text-current/70 hover:text-current","aria-label":"Dismiss notification",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})}):null]})},e.id)})}),t&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/20 lg:hidden",onClick:()=>a(!1)}),(0,s.jsx)("div",{className:"hidden lg:flex",children:(0,s.jsx)(l.default,{})}),(0,s.jsx)("div",{className:`fixed inset-y-0 left-0 z-50 transform lg:hidden transition-transform duration-300 ease-in-out ${t?"translate-x-0":"-translate-x-full"}`,children:(0,s.jsx)(l.default,{onClose:()=>a(!1)})}),(0,s.jsxs)("main",{className:"flex flex-col flex-1 h-full min-w-0 relative transition-colors duration-300 isolate",children:[(0,s.jsx)("div",{className:"landing-grid absolute inset-0 pointer-events-none -z-10","aria-hidden":"true"}),(0,s.jsx)(o.default,{onMenuClick:()=>a(!0)},c),(0,s.jsx)("div",{className:`flex-1 overflow-y-auto custom-scrollbar ${"/dashboard/basic-chat"===c?"":"p-6 lg:p-10"} ${"/dashboard/basic-chat"===c?"flex flex-col overflow-hidden":""}`,children:(0,s.jsx)("div",{className:`${"/dashboard/basic-chat"===c?"flex-1 w-full h-full flex flex-col":"max-w-7xl mx-auto"}`,children:e})})]})]})}},8823:(e,t,a)=>{a.d(t,{default:()=>y});var s=a(95155),r=a(12115),n=a(73321),i=a(98500),l=a.n(i),o=a(14051),d=a.n(o),c=a(57250),m=a(80752),u=a(93308),x=a(38202),p=a(21931);function h(){let[e,t]=(0,r.useState)(!1),[a,n]=(0,r.useState)("en");return(0,r.useEffect)(()=>{n(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${u.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,u.QC)(t)}())},[e]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>t(!0),className:"flex items-center justify-center p-2 rounded-lg text-text-muted hover:text-text-main hover:bg-black/5 dark:hover:bg-white/5 transition-all",title:"Language","data-i18n-skip":"true",children:(0,s.jsx)("span",{className:"text-lg leading-none",children:x.h[a]||"\uD83C\uDF10"})}),(0,s.jsx)(p.default,{hideTrigger:!0,isOpen:e,onClose:e=>{t(!1),n(e)}})]})}var g=a(38587),f=a(38003),b=a(90620),v=a(52679),j=a(73006);function y({onMenuClick:e,showMenuButton:t=!0}){let a=(0,n.usePathname)(),i=(0,n.useRouter)(),[o,d]=(0,r.useState)(""),[u,x]=(0,r.useState)(""),{title:p,description:f,icon:N,breadcrumbs:w}=(0,r.useMemo)(()=>(e=>{if(!e)return{title:"",description:"",breadcrumbs:[]};let t=e.match(/\/media-providers\/([^/]+)\/([^/]+)$/);if(t){let e=t[1],a=t[2],s=v.rj.find(t=>t.id===e),r=v.Q2[a];return{title:r?.name||a,description:"",breadcrumbs:[{label:"Media Providers",href:`/dashboard/media-providers/${e}`},{label:s?.label||e,href:`/dashboard/media-providers/${e}`},{label:r?.name||a,image:`/providers/${a}.png`}]}}let a=e.match(/\/media-providers\/([^/]+)$/);if(a){let e=a[1],t=v.rj.find(t=>t.id===e);return{title:t?.label||e,description:`Manage your ${t?.label||e} providers`,icon:t?.icon||"perm_media",breadcrumbs:[]}}let s=e.match(/\/providers\/([^/]+)$/);if(s){let e=s[1],t=b.zN[e]||b.fg[e];if(t)return{title:t.name,description:"",breadcrumbs:[{label:"Providers",href:"/dashboard/providers"},{label:t.name,image:`/providers/${t.id}.png`}]}}return e.includes("/providers")&&!e.includes("/media-providers")?{title:"Providers",description:"Manage your AI provider connections",icon:"dns",breadcrumbs:[]}:e.includes("/combos")?{title:"Combos",description:"Model combos with fallback",icon:"layers",breadcrumbs:[]}:e.includes("/usage")?{title:"Usage & Analytics",description:"Monitor your API usage, token consumption, and request logs",icon:"bar_chart",breadcrumbs:[]}:e.includes("/auth-files")?{title:"Auth Files",description:"Map provider credentials stored in the local database",icon:"vpn_key",breadcrumbs:[]}:e.includes("/quota")?{title:"Quota Tracker",description:"Track and manage your API quota limits",icon:"data_usage",breadcrumbs:[]}:e.includes("/mitm")?{title:"MITM Proxy",description:"Intercept CLI tool traffic and route through kRouter",icon:"security",breadcrumbs:[]}:e.includes("/token-saver")?{title:"Token Saver",description:"Compress prompts and outputs to save tokens",icon:"savings",breadcrumbs:[]}:e.includes("/cli-tools")?{title:"CLI Tools",description:"Configure CLI tools",icon:"terminal",breadcrumbs:[]}:e.includes("/proxy-pools")?{title:"Proxy Pools",description:"Manage your proxy pool configurations",icon:"lan",breadcrumbs:[]}:e.includes("/skills")?{title:"Agent Skills",description:"Copy a link and paste to your AI to use kRouter — no install needed",icon:"extension",breadcrumbs:[]}:e.includes("/endpoint")?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:e.includes("/profile")?{title:"Settings",description:"Manage your preferences",icon:"settings",breadcrumbs:[]}:e.includes("/translator")?{title:"Translator",description:"Debug translation flow between formats",icon:"translate",breadcrumbs:[]}:e.includes("/console-log")?{title:"Console Log",description:"Live server console output",icon:"monitor",breadcrumbs:[]}:"/dashboard"===e?{title:"Endpoint",description:"API endpoint configuration",icon:"api",breadcrumbs:[]}:{title:"",description:"",breadcrumbs:[]}})(a),[a]);(0,r.useEffect)(()=>{let e=!1;return async function(){try{let t=await fetch("/api/auth/status",{cache:"no-store"});if(!t.ok)return;let a=await t.json();e||(d(a?.displayName||a?.oidcName||a?.oidcEmail||""),x(a?.loginMethod||""))}catch{e||(d(""),x(""))}}(),()=>{e=!0}},[]);let C=async()=>{try{(await fetch("/api/auth/logout",{method:"POST"})).ok&&(i.push("/login"),i.refresh())}catch(e){console.error("Failed to logout:",e)}};return(0,s.jsxs)("header",{className:"shrink-0 flex items-center justify-between gap-3 px-4 lg:px-8 pt-3 pb-2 border-b border-border-subtle bg-surface/60 backdrop-blur-xl lg:bg-transparent lg:backdrop-blur-none z-20",children:[(0,s.jsx)("div",{className:"flex items-center gap-3 lg:hidden shrink-0",children:t&&(0,s.jsx)("button",{onClick:e,className:"text-text-main hover:text-primary transition-colors",children:(0,s.jsx)("span",{className:"material-symbols-outlined",children:"menu"})})}),(0,s.jsx)("div",{className:"flex flex-col min-w-0 flex-1",children:w.length>0?(0,s.jsx)("div",{className:"flex items-center gap-2",children:w.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[t>0&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-base",children:"chevron_right"}),e.href?(0,s.jsx)(l(),{href:e.href,className:"text-text-muted hover:text-primary transition-colors",children:e.label}):(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.image&&(0,s.jsx)(c.A,{src:e.image,alt:e.label,size:28,className:"object-contain rounded max-w-[28px] max-h-[28px]",fallbackText:e.label.slice(0,2).toUpperCase()}),(0,s.jsx)("h1",{className:"text-lg lg:text-[28px] lg:leading-9 font-semibold text-text-main tracking-[-0.02em] truncate",children:(0,j.Tl)(e.label)})]})]},`${e.label}-${e.href||"current"}`))}):p?(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[N&&(0,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl lg:text-[26px]",children:N}),(0,s.jsx)("h1",{className:"text-lg lg:text-[28px] lg:leading-9 font-semibold tracking-[-0.02em] truncate",children:(0,j.Tl)(p)})]}),f&&(0,s.jsx)("p",{className:"hidden lg:block text-[13px] leading-5 text-text-muted truncate mt-0.5",children:(0,j.Tl)(f)})]}):null}),(0,s.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[o&&"OIDC"===u&&(0,s.jsxs)("div",{className:"hidden sm:flex items-center max-w-[220px] px-3 py-1.5 rounded-full border border-border bg-surface/70 text-xs text-text-muted truncate",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1.5 text-primary",children:"person"}),(0,s.jsx)("span",{className:"truncate",children:o}),(0,s.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"OIDC"})]}),(0,s.jsx)(k,{}),(0,s.jsx)(g.default,{}),(0,s.jsx)(h,{}),(0,s.jsx)(m.default,{onLogout:C})]})]})}function k(){let e=(0,f.C)(e=>e.visible),t=(0,f.C)(e=>e.query),a=(0,f.C)(e=>e.placeholder),r=(0,f.C)(e=>e.setQuery);return e?(0,s.jsxs)("div",{className:"relative w-[160px] sm:w-[220px]",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2 top-1/2 -translate-y-1/2 text-text-muted text-[16px] pointer-events-none",children:"search"}),(0,s.jsx)("input",{type:"text",value:t,onChange:e=>r(e.target.value),placeholder:a,className:"w-full h-8 pl-7 pr-7 rounded-lg border border-border bg-surface/60 text-sm focus:outline-none focus:border-primary/50 transition-colors"}),t&&(0,s.jsx)("button",{type:"button",onClick:()=>r(""),className:"absolute right-1 top-1/2 -translate-y-1/2 text-text-muted hover:text-text-main p-0.5 rounded","aria-label":"Clear search",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"close"})})]}):null}y.propTypes={onMenuClick:d().func,showMenuButton:d().bool}},10319:(e,t,a)=>{a.d(t,{default:()=>M});var s=a(95155),r=a(12115),n=a(73321),i=a(52679),l=a(56061),o=a(84588),d=a(14051),c=a.n(d);let m=e=>new Intl.NumberFormat().format(e||0);function u({stats:e}){let t;return(0,s.jsxs)("div",{className:"grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-4 sm:gap-4",children:[(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Requests"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold",children:m(e.totalRequests)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Total Input Tokens"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold text-primary",children:m(e.totalPromptTokens)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Output Tokens"}),(0,s.jsx)("span",{className:"truncate text-2xl font-bold text-success",children:m(e.totalCompletionTokens)})]}),(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-1 px-4 py-3",children:[(0,s.jsx)("span",{className:"text-text-muted text-sm uppercase font-semibold",children:"Est. Cost"}),(0,s.jsxs)("span",{className:"truncate text-2xl font-bold text-warning",children:["~",(t=e.totalCost,`$${(t||0).toFixed(2)}`)]}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"Estimated, not actual billing"})]})]})}u.propTypes={stats:c().object.isRequired};let x=e=>new Intl.NumberFormat().format(e||0),p=e=>`$${(e||0).toFixed(2)}`;function h(e){if(!e)return"Never";let t=Math.floor((Date.now()-new Date(e))/6e4);return t<1?"Just now":t<60?`${t}m ago`:t<1440?`${Math.floor(t/60)}h ago`:new Date(e).toLocaleDateString()}function g({field:e,currentSort:t,currentOrder:a}){return t!==e?(0,s.jsx)("span",{className:"ml-1 opacity-20",children:"↕"}):(0,s.jsx)("span",{className:"ml-1",children:"asc"===a?"↑":"↓"})}function f({item:e,viewMode:t,isSummary:a=!1}){return"tokens"===t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.promptTokens?"—":x(e.promptTokens)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.completionTokens?"—":x(e.completionTokens)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right font-medium",children:x(e.totalTokens)})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.inputCost?"—":p(e.inputCost)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted",children:a&&void 0===e.outputCost?"—":p(e.outputCost)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right font-medium text-warning",children:p(e.totalCost||e.cost)})]})}function b({title:e,columns:t,groupedData:a,tableType:n,sortBy:i,sortOrder:l,onToggleSort:d,viewMode:c,storageKey:m,renderDetailCells:u,renderSummaryCells:x,emptyMessage:p}){let[h,v]=(0,r.useState)(new Set);(0,r.useEffect)(()=>{try{let e=localStorage.getItem(m);e&&v(new Set(JSON.parse(e)))}catch(e){console.error(`Failed to load ${m}:`,e)}},[m]),(0,r.useEffect)(()=>{try{localStorage.setItem(m,JSON.stringify([...h]))}catch(e){console.error(`Failed to save ${m}:`,e)}},[h,m]);let j=(0,r.useCallback)(e=>{v(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),y=(0,r.useMemo)(()=>"tokens"===c?[{field:"promptTokens",label:"Input Tokens"},{field:"completionTokens",label:"Output Tokens"},{field:"totalTokens",label:"Total Tokens"}]:[{field:"promptTokens",label:"Input Cost"},{field:"completionTokens",label:"Output Cost"},{field:"cost",label:"Total Cost"}],[c]),k=t.length+y.length;return(0,s.jsxs)(o.default,{className:"overflow-hidden",children:[(0,s.jsx)("div",{className:"p-4 border-b border-border bg-bg-subtle/50",children:(0,s.jsx)("h3",{className:"font-semibold",children:e})}),(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"w-full text-sm text-left",children:[(0,s.jsx)("thead",{className:"bg-bg-subtle/30 text-text-muted uppercase text-xs",children:(0,s.jsxs)("tr",{children:[t.map(e=>(0,s.jsxs)("th",{className:`px-6 py-3 cursor-pointer hover:bg-bg-subtle/50 ${"right"===e.align?"text-right":""}`,onClick:()=>d(n,e.field),children:[e.label," ",(0,s.jsx)(g,{field:e.field,currentSort:i,currentOrder:l})]},e.field)),y.map(e=>(0,s.jsxs)("th",{className:"px-6 py-3 text-right cursor-pointer hover:bg-bg-subtle/50",onClick:()=>d(n,e.field),children:[e.label," ",(0,s.jsx)(g,{field:e.field,currentSort:i,currentOrder:l})]},e.field))]})}),(0,s.jsxs)("tbody",{className:"divide-y divide-border",children:[a.map(e=>(0,s.jsxs)(r.Fragment,{children:[(0,s.jsxs)("tr",{className:"group-summary cursor-pointer hover:bg-bg-subtle/50 transition-colors",onClick:()=>j(e.groupKey),children:[(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:`material-symbols-outlined text-[18px] text-text-muted transition-transform ${h.has(e.groupKey)?"rotate-90":""}`,children:"chevron_right"}),(0,s.jsx)("span",{className:`font-medium transition-colors ${e.summary.pending>0?"text-primary":""}`,children:e.groupKey})]})}),x(e),(0,s.jsx)(f,{item:e.summary,viewMode:c,isSummary:!0})]}),h.has(e.groupKey)&&e.items.map(e=>(0,s.jsxs)("tr",{className:"group-detail hover:bg-bg-subtle/20 transition-colors",children:[u(e),(0,s.jsx)(f,{item:e,viewMode:c})]},`detail-${e.key}`))]},e.groupKey)),0===a.length&&(0,s.jsx)("tr",{children:(0,s.jsx)("td",{colSpan:k,className:"px-6 py-8 text-center text-text-muted",children:p})})]})]})})]})}g.propTypes={field:c().string.isRequired,currentSort:c().string.isRequired,currentOrder:c().string.isRequired},f.propTypes={item:c().object.isRequired,viewMode:c().string.isRequired,isSummary:c().bool},b.propTypes={title:c().string.isRequired,columns:c().arrayOf(c().shape({field:c().string.isRequired,label:c().string.isRequired,align:c().string})).isRequired,groupedData:c().array.isRequired,tableType:c().string.isRequired,sortBy:c().string.isRequired,sortOrder:c().string.isRequired,onToggleSort:c().func.isRequired,viewMode:c().string.isRequired,storageKey:c().string.isRequired,renderDetailCells:c().func.isRequired,renderSummaryCells:c().func.isRequired,emptyMessage:c().string.isRequired};var v=a(37206),j=a(21742),y=a(63346),k=a(28408),N=a(32539),w=a(59656),C=a(55433),S=a(40968);let O=e=>e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e||0),F=e=>`$${(e||0).toFixed(4)}`;function W({period:e="7d"}){let[t,a]=(0,r.useState)([]),[n,i]=(0,r.useState)(!0),[l,d]=(0,r.useState)("tokens"),c=(0,r.useCallback)(async()=>{i(!0);try{let t=await fetch(`/api/usage/chart?period=${e}`);if(t.ok){let e=await t.json();a(e)}}catch(e){console.error("Failed to fetch chart data:",e)}finally{i(!1)}},[e]);(0,r.useEffect)(()=>{c()},[c]);let m=t.some(e=>e.tokens>0||e.cost>0);return(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col gap-3 p-3 sm:p-4",children:[(0,s.jsxs)("div",{className:"grid w-full grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:w-auto sm:self-start",children:[(0,s.jsx)("button",{onClick:()=>d("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===l?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"}),(0,s.jsx)("button",{onClick:()=>d("cost"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"cost"===l?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Cost"})]}),n?(0,s.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"Loading..."}):m?(0,s.jsx)(j.u,{width:"100%",height:220,children:(0,s.jsxs)(y.Q,{data:t,margin:{top:4,right:8,left:0,bottom:0},children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"gradTokens",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"5%",stopColor:"#6366f1",stopOpacity:.25}),(0,s.jsx)("stop",{offset:"95%",stopColor:"#6366f1",stopOpacity:0})]}),(0,s.jsxs)("linearGradient",{id:"gradCost",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"5%",stopColor:"#f59e0b",stopOpacity:.25}),(0,s.jsx)("stop",{offset:"95%",stopColor:"#f59e0b",stopOpacity:0})]})]}),(0,s.jsx)(k.d,{strokeDasharray:"3 3",strokeOpacity:.1}),(0,s.jsx)(N.W,{dataKey:"label",tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,interval:"preserveStartEnd"}),(0,s.jsx)(w.h,{tick:{fontSize:10,fill:"currentColor",fillOpacity:.5},tickLine:!1,axisLine:!1,tickFormatter:"tokens"===l?O:F,width:50}),(0,s.jsx)(C.m,{contentStyle:{backgroundColor:"var(--color-bg)",border:"1px solid var(--color-border)",borderRadius:"8px",fontSize:"12px"},formatter:(e,t)=>"tokens"===t?[O(e),"Tokens"]:[F(e),"Cost"]}),"tokens"===l?(0,s.jsx)(S.Gk,{type:"monotone",dataKey:"tokens",stroke:"#6366f1",strokeWidth:2,fill:"url(#gradTokens)",dot:!1,activeDot:{r:4}}):(0,s.jsx)(S.Gk,{type:"monotone",dataKey:"cost",stroke:"#f59e0b",strokeWidth:2,fill:"url(#gradCost)",dot:!1,activeDot:{r:4}})]})}):(0,s.jsx)("div",{className:"h-48 flex items-center justify-center text-text-muted text-sm",children:"No data for this period"})]})}function T(e){let t=i.Q2[e];return!t?.serviceKinds||t.serviceKinds.includes("llm")}W.propTypes={period:c().string};let $=(0,v.default)(()=>Promise.all([a.e(2574),a.e(3862),a.e(6357),a.e(3521)]).then(a.bind(a,63521)),{loadableGenerated:{webpack:()=>[63521]},ssr:!1});function I({timestamp:e}){let t,[,a]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=setInterval(()=>a(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,s.jsx)(s.Fragment,{children:(t=Math.floor((Date.now()-new Date(e))/1e3))<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`})}function A({requests:e=[]}){return(0,s.jsxs)(o.default,{className:"flex min-w-0 flex-col overflow-hidden",padding:"sm",style:{height:480},children:[(0,s.jsx)("div",{className:"px-1 py-2 border-b border-border shrink-0",children:(0,s.jsx)("span",{className:"text-xs font-semibold text-text-muted uppercase tracking-wide",children:"Recent Requests"})}),e.length?(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-[300px] border-collapse text-xs",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg z-10",children:(0,s.jsxs)("tr",{className:"border-b border-border",children:[(0,s.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted w-2"}),(0,s.jsx)("th",{className:"py-1.5 text-left font-semibold text-text-muted",children:"Model"}),(0,s.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted whitespace-nowrap",children:"In / Out"}),(0,s.jsx)("th",{className:"py-1.5 text-right font-semibold text-text-muted",children:"When"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=!e.status||"ok"===e.status||"success"===e.status;return(0,s.jsxs)("tr",{className:"hover:bg-bg-subtle transition-colors",children:[(0,s.jsx)("td",{className:"py-1.5",children:(0,s.jsx)("span",{className:`block w-1.5 h-1.5 rounded-full ${a?"bg-success":"bg-error"}`})}),(0,s.jsx)("td",{className:"py-1.5 font-mono truncate max-w-[120px]",title:e.model,children:e.model}),(0,s.jsxs)("td",{className:"py-1.5 text-right whitespace-nowrap",children:[(0,s.jsxs)("span",{className:"text-primary",children:[x(e.promptTokens),"↑"]})," ",(0,s.jsxs)("span",{className:"text-success",children:[x(e.completionTokens),"↓"]})]}),(0,s.jsx)("td",{className:"py-1.5 text-right text-text-muted whitespace-nowrap",children:(0,s.jsx)(I,{timestamp:e.timestamp})})]},t)})})]})}):(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center text-text-muted text-sm",children:"No requests yet."})]})}function P(e,t={},a,s){return Object.entries(e||{}).map(([e,a])=>{let s=(a.promptTokens||0)+(a.completionTokens||0),r=a.cost||0,n=s>0?(a.promptTokens||0)*(r/s):0,i=s>0?(a.completionTokens||0)*(r/s):0;return{...a,key:e,totalTokens:s,totalCost:r,inputCost:n,outputCost:i,pending:t[e]||0}}).sort((e,t)=>{let r=e[a],n=t[a];return("string"==typeof r&&(r=r.toLowerCase()),"string"==typeof n&&(n=n.toLowerCase()),r<n)?"asc"===s?-1:1:r>n?"asc"===s?1:-1:0})}function E(e,t){if(!Array.isArray(e))return[];let a={};return e.forEach(e=>{let s=function(e,t){switch(t){case"rawModel":return e.rawModel||"Unknown Model";case"accountName":return e.accountName||`Account ${e.connectionId?.slice(0,8)}...`||"Unknown Account";case"keyName":{let t=e.keyName||"Unknown Key";return e.apiKeyMasked&&e.apiKeyMasked!==t?`${t} (${e.apiKeyMasked})`:t}case"endpoint":return e.endpoint||"Unknown Endpoint";default:return e[t]||"Unknown"}}(e,t);a[s]||(a[s]={groupKey:s,summary:{requests:0,promptTokens:0,completionTokens:0,totalTokens:0,cost:0,inputCost:0,outputCost:0,lastUsed:null,pending:0},items:[]});let r=a[s].summary;r.requests+=e.requests||0,r.promptTokens+=e.promptTokens||0,r.completionTokens+=e.completionTokens||0,r.totalTokens+=e.totalTokens||0,r.cost+=e.cost||0,r.inputCost+=e.inputCost||0,r.outputCost+=e.outputCost||0,r.pending+=e.pending||0,e.lastUsed&&(!r.lastUsed||new Date(e.lastUsed)>new Date(r.lastUsed))&&(r.lastUsed=e.lastUsed),a[s].items.push(e)}),Object.values(a)}let R=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],q=[{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"accountName",label:"Account"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],D=[{field:"keyName",label:"API Key Name"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],z=[{field:"endpoint",label:"Endpoint"},{field:"rawModel",label:"Model"},{field:"provider",label:"Provider"},{field:"requests",label:"Requests",align:"right"},{field:"lastUsed",label:"Last Used",align:"right"}],L=[{value:"model",label:"Usage by Model"},{value:"account",label:"Usage by Account"},{value:"apiKey",label:"Usage by API Key"},{value:"endpoint",label:"Usage by Endpoint"}],_=[{value:"today",label:"Today"},{value:"24h",label:"24h"},{value:"7d",label:"7D"},{value:"30d",label:"30D"},{value:"60d",label:"60D"}];function M({period:e,setPeriod:t,hidePeriodSelector:a=!1}={}){let o=(0,n.useRouter)(),d=(0,n.useSearchParams)(),c=d.get("sortBy")||"rawModel",m=d.get("sortOrder")||"asc",[p,g]=(0,r.useState)(null),[f,v]=(0,r.useState)(!0),[j,y]=(0,r.useState)(!1),[k,N]=(0,r.useState)("model"),[w,C]=(0,r.useState)("costs"),[S,O]=(0,r.useState)([]),[F,I]=(0,r.useState)("today"),U=(0,r.useRef)(!0),K=(0,r.useRef)(!1),B=e??F,V=t??I;(0,r.useEffect)(()=>{Promise.all([fetch("/api/providers").then(e=>e.ok?e.json():null),fetch("/api/provider-nodes").then(e=>e.ok?e.json():null)]).then(([e,t])=>{let a={};for(let e of t?.nodes||[])a[e.id]=e.name;let s=new Set;O([...(e?.connections||[]).filter(e=>!(!1===e.isActive||!T(e.provider)||i.Q2[e.provider]?.hidden||s.has(e.provider))&&(s.add(e.provider),!0)).map(e=>({...e,nodeName:a[e.provider]||null})),...Object.values(i.IS).filter(e=>e.noAuth&&!e.hidden&&!s.has(e.id)&&T(e.id)).map(e=>({provider:e.id,name:e.name}))])}).catch(()=>{})},[]),(0,r.useEffect)(()=>{U.current?(U.current=!1,v(!0)):y(!0),fetch(`/api/usage/stats?period=${B}`).then(e=>e.ok?e.json():null).then(e=>{e&&(K.current=!0,g(t=>({...t,...e})))}).catch(()=>{}).finally(()=>{v(!1),y(!1)})},[B]),(0,r.useEffect)(()=>{let e=new EventSource("/api/usage/stream");return e.onmessage=e=>{try{let t=JSON.parse(e.data);g(e=>e?{...e,activeRequests:t.activeRequests,recentRequests:t.recentRequests,errorProvider:t.errorProvider,pending:t.pending}:e),K.current&&v(!1)}catch(e){console.error("[SSE CLIENT] parse error:",e)}},e.onerror=()=>v(!1),()=>e.close()},[]);let G=(0,r.useCallback)((e,t)=>{let a=new URLSearchParams(d.toString());a.get("sortBy")===t?a.set("sortOrder","asc"===a.get("sortOrder")?"desc":"asc"):(a.set("sortBy",t),a.set("sortOrder","asc")),o.replace(`?${a.toString()}`,{scroll:!1})},[d,o]),J=(0,r.useMemo)(()=>{if(!p)return null;switch(k){case"model":{let e=p.pending?.byModel||{};return{columns:R,groupedData:E(P(p.byModel,e,c,m),"rawModel"),storageKey:"usage-stats:expanded-models",emptyMessage:"No usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"account":{let e={};return p?.pending?.byAccount&&Object.entries(p.byAccount||{}).forEach(([t,a])=>{let s=p.pending.byAccount[a.connectionId];if(s){let r=a.provider?`${a.rawModel} (${a.provider})`:a.rawModel;e[t]=s[r]||0}}),{columns:q,groupedData:E(P(p.byAccount,e,c,m),"accountName"),storageKey:"usage-stats:expanded-accounts",emptyMessage:"No account-specific usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.accountName||`Account ${e.connectionId?.slice(0,8)}...`}),(0,s.jsx)("td",{className:`px-6 py-3 font-medium transition-colors ${e.pending>0?"text-primary":""}`,children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:e.pending>0?"primary":"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}case"apiKey":return{columns:D,groupedData:E(P(p.byApiKey,{},c,m),"keyName"),storageKey:"usage-stats:expanded-apikeys",emptyMessage:"No API key usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-xs",children:e.apiKeyMasked||e.keyName}),(0,s.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})};default:return{columns:z,groupedData:E(P(p.byEndpoint,{},c,m),"endpoint"),storageKey:"usage-stats:expanded-endpoints",emptyMessage:"No endpoint usage recorded yet.",renderSummaryCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-text-muted",children:"—"}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.summary.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.summary.lastUsed)})]}),renderDetailCells:e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("td",{className:"px-6 py-3 font-medium font-mono text-sm",children:e.endpoint}),(0,s.jsx)("td",{className:"px-6 py-3",children:e.rawModel}),(0,s.jsx)("td",{className:"px-6 py-3",children:(0,s.jsx)(l.default,{variant:"neutral",size:"sm",children:e.provider})}),(0,s.jsx)("td",{className:"px-6 py-3 text-right",children:x(e.requests)}),(0,s.jsx)("td",{className:"px-6 py-3 text-right text-text-muted whitespace-nowrap",children:h(e.lastUsed)})]})}}},[p,k,c,m]);if(!p&&!f)return(0,s.jsx)("div",{className:"text-text-muted",children:"Failed to load usage statistics."});let Q=(0,s.jsx)("div",{className:"flex items-center justify-center py-12 text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[32px] animate-spin",children:"progress_activity"})});return(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-6",children:[!a&&(0,s.jsxs)("div",{className:"flex w-full items-center gap-2 sm:w-auto sm:self-end",children:[(0,s.jsx)("div",{className:"grid flex-1 grid-cols-5 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex sm:flex-none",children:_.map(e=>(0,s.jsx)("button",{onClick:()=>V(e.value),disabled:j,className:`rounded-md px-3 py-1 text-sm font-medium transition-colors ${B===e.value?"bg-primary text-white shadow-sm":"text-text-muted hover:bg-bg-hover hover:text-text"}`,children:e.label},e.value))}),j&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted animate-spin",children:"progress_activity"})]}),f?Q:(0,s.jsx)(u,{stats:p}),f?Q:(0,s.jsxs)("div",{className:"grid min-w-0 grid-cols-1 items-stretch gap-2 lg:grid-cols-[minmax(0,2fr)_minmax(280px,1fr)]",children:[(0,s.jsx)($,{providers:S,activeRequests:p.activeRequests||[],lastProvider:p.recentRequests?.[0]?.provider||"",errorProvider:p.errorProvider||""}),(0,s.jsx)(A,{requests:p.recentRequests||[]})]}),f?Q:(0,s.jsx)(W,{period:B}),(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("select",{value:k,onChange:e=>N(e.target.value),className:"w-full rounded-lg border border-border bg-surface px-3 py-1.5 text-sm font-medium text-text-main focus:outline-none focus:ring-2 focus:ring-primary/50 sm:w-auto",style:{colorScheme:"auto"},children:L.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,s.jsxs)("div",{className:"grid grid-cols-2 items-center gap-1 rounded-lg border border-border bg-bg-subtle p-1 sm:flex",children:[(0,s.jsx)("button",{onClick:()=>C("costs"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"costs"===w?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Costs"}),(0,s.jsx)("button",{onClick:()=>C("tokens"),className:`px-3 py-1 rounded-md text-sm font-medium transition-colors ${"tokens"===w?"bg-primary text-white shadow-sm":"text-text-muted hover:text-text hover:bg-bg-hover"}`,children:"Tokens"})]})]}),f?Q:J&&(0,s.jsx)(b,{title:"",columns:J.columns,groupedData:J.groupedData,tableType:k,sortBy:c,sortOrder:m,onToggleSort:G,viewMode:w,storageKey:J.storageKey,renderSummaryCells:J.renderSummaryCells,renderDetailCells:J.renderDetailCells,emptyMessage:J.emptyMessage})]})]})}},11059:(e,t,a)=>{a.d(t,{C:()=>r});var s=a(12115);function r(e=2e3){let[t,a]=(0,s.useState)(null),n=(0,s.useRef)(null);return{copied:t,copy:(0,s.useCallback)((t,s="default")=>{(async()=>{if(navigator?.clipboard?.writeText)await navigator.clipboard.writeText(t);else{let e=document.createElement("textarea");e.value=t,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}})(),a(s),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{a(null)},e)},[e])}}},11910:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({label:e,type:t="text",placeholder:a,value:i,onChange:l,error:o,hint:d,icon:c,disabled:m=!1,required:u=!1,className:x,inputClassName:p,...h}){return(0,s.jsxs)("div",{className:(0,r.cn)("flex flex-col gap-1.5",x),children:[e&&(0,s.jsxs)("label",{className:"text-sm font-medium text-text-main",children:[e,u&&(0,s.jsx)("span",{className:"text-red-500 ml-1",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[c&&(0,s.jsx)("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-text-muted",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:c})}),(0,s.jsx)("input",{type:t,placeholder:a,value:i,onChange:l,disabled:m,className:(0,r.cn)("w-full py-2.5 px-3 text-sm text-text-main bg-surface-2 rounded-[10px]","border border-transparent placeholder-text-muted/70","focus:outline-none focus:ring-2 focus:ring-brand-500/30 focus:border-brand-500/40","transition-all duration-150 ease-out disabled:opacity-50 disabled:cursor-not-allowed","text-[16px] sm:text-sm",c&&"pl-10",o&&"ring-1 ring-red-500 focus:ring-2 focus:ring-red-500/40 border-red-500/40",p),...h})]}),o&&(0,s.jsxs)("p",{className:"text-xs text-red-500 flex items-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),o]}),d&&!o&&(0,s.jsx)("p",{className:"text-xs text-text-muted",children:d})]})}},21931:(e,t,a)=>{a.d(t,{default:()=>d});var s=a(95155),r=a(12115),n=a(47650),i=a(93308),l=a(73006);let o=e=>({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"},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"}})[e]||{name:e,flag:"\uD83C\uDF10"};function d({className:e="",isOpen:t,onClose:a,hideTrigger:c=!1}){let[m,u]=(0,r.useState)("en"),[x,p]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!1),f=(0,r.useRef)(null),b="boolean"==typeof t,v=b?t:h,j=e=>{b?!e&&a&&a(m):g(e)};(0,r.useEffect)(()=>{u(function(){if("u"<typeof document)return"en";let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${i.CL}=`)),t=e?decodeURIComponent(e.split("=")[1]):"en";return(0,i.QC)(t)}())},[]),(0,r.useEffect)(()=>{function e(e){f.current&&!f.current.contains(e.target)&&j(!1)}if(v)return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[v]);let y=async e=>{if(e!==m&&!x){p(!0),j(!1);try{await fetch("/api/locale",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({locale:e})}),await (0,l.wn)(),u(e)}catch(e){console.error("Failed to set locale:",e)}finally{p(!1)}}};return(0,s.jsxs)("div",{className:e,children:[!c&&(0,s.jsxs)("button",{onClick:()=>j(!v),disabled:x,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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"language"}),(0,s.jsx)("span",{className:"text-sm font-medium",children:o(m).name}),(0,s.jsx)("span",{className:"text-lg",children:o(m).flag})]}),v&&(0,n.createPortal)((0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4","data-i18n-skip":"true",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:()=>j(!1)}),(0,s.jsxs)("div",{ref:f,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]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 border-b border-black/5 dark:border-white/5",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-text-main",children:"Select Language"}),(0,s.jsx)("button",{onClick:()=>j(!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,s.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"close"})})]}),(0,s.jsx)("div",{className:"p-6 overflow-y-auto flex-1",children:(0,s.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(100px,1fr))] gap-2",children:i.YZ.map(e=>{let t=m===e,a=o(e);return(0,s.jsxs)("button",{onClick:()=>y(e),disabled:x,className:`flex flex-col items-center justify-start gap-1 px-2 py-3 rounded-lg text-xs font-medium transition-colors w-full ${t?"bg-primary/15 text-primary ring-2 ring-primary":"text-text-main hover:bg-black/5 dark:hover:bg-white/5"} ${x?"opacity-70 cursor-wait":""}`,title:a.name,children:[(0,s.jsx)("span",{className:"text-2xl",children:a.flag}),(0,s.jsx)("span",{className:"text-center leading-tight line-clamp-2 h-8 flex items-center",children:a.name}),t&&(0,s.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check"})]},e)})})})]})]}),document.body)]})}},23615:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(12115),n=a(84588);function i(){let[e,t]=(0,r.useState)([]),[a,i]=(0,r.useState)(!0),[l,o]=(0,r.useState)(!0);(0,r.useEffect)(()=>{d()},[]),(0,r.useEffect)(()=>{let e;return l&&(e=setInterval(()=>{d(!1)},3e3)),()=>clearInterval(e)},[l]);let d=async(e=!0)=>{e&&i(!0);try{let e=await fetch("/api/usage/request-logs");if(e.ok){let a=await e.json();t(a)}}catch(e){console.error("Failed to fetch logs:",e)}finally{e&&i(!1)}};return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold",children:"Request Logs"}),(0,s.jsx)("div",{className:"flex items-center gap-2",children:(0,s.jsxs)("label",{className:"text-sm font-medium text-text-muted flex items-center gap-2 cursor-pointer",children:[(0,s.jsx)("span",{children:"Auto Refresh (3s)"}),(0,s.jsx)("div",{onClick:()=>o(!l),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none ${l?"bg-primary":"bg-bg-subtle border border-border"}`,children:(0,s.jsx)("span",{className:`inline-block h-3 w-3 transform rounded-full bg-white transition-transform ${l?"translate-x-5":"translate-x-1"}`})})]})})]}),(0,s.jsx)(n.default,{className:"overflow-hidden bg-black/5 dark:bg-black/20",children:(0,s.jsx)("div",{className:"p-0 overflow-x-auto max-h-[600px] overflow-y-auto font-mono text-xs",children:a&&0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"Loading logs..."}):0===e.length?(0,s.jsx)("div",{className:"p-8 text-center text-text-muted",children:"No logs recorded yet."}):(0,s.jsxs)("table",{className:"w-full text-left border-collapse whitespace-nowrap",children:[(0,s.jsx)("thead",{className:"sticky top-0 bg-bg-subtle border-b border-border z-10",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"DateTime"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Model"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Provider"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Account"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"In"}),(0,s.jsx)("th",{className:"px-3 py-2 border-r border-border",children:"Out"}),(0,s.jsx)("th",{className:"px-3 py-2",children:"Status"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-border/50",children:e.map((e,t)=>{let a=e.split(" | ");if(a.length<7)return null;let r=a[6],n=r.includes("PENDING"),i=r.includes("FAILED"),l=r.includes("OK");return(0,s.jsxs)("tr",{className:`hover:bg-primary/5 transition-colors ${n?"bg-primary/5":""}`,children:[(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-text-muted",children:a[0]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border font-medium",children:a[1]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border",children:(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded bg-bg-subtle border border-border text-[10px] uppercase font-bold",children:a[2]})}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border truncate max-w-[150px]",title:a[3],children:a[3]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-primary",children:a[4]}),(0,s.jsx)("td",{className:"px-3 py-1.5 border-r border-border text-right text-success",children:a[5]}),(0,s.jsx)("td",{className:`px-3 py-1.5 font-bold ${l?"text-success":i?"text-error":"text-primary animate-pulse"}`,children:r})]},t)})})]})})}),(0,s.jsx)("div",{className:"text-[10px] text-text-muted italic",children:"Logs are loaded from the request history database."})]})}},23936:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[n,i]=(0,r.useState)(""),[d,c]=(0,r.useState)(!1),[m,u]=(0,r.useState)(null),[x,p]=(0,r.useState)(!1),h=async()=>{if(!n.trim())return void u("Please paste your cookie");c(!0),u(null);try{let e=await fetch("/api/oauth/iflow/cookie",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cookie:n.trim()})}),a=await e.json();if(!e.ok)throw Error(a.error||"Authentication failed");p(!0),setTimeout(()=>{t?.(),g()},1500)}catch(e){u(e.message)}finally{c(!1)}},g=()=>{i(""),u(null),p(!1),a?.()};return(0,s.jsx)(l.aF,{isOpen:e,onClose:g,title:"iFlow Cookie Authentication",children:(0,s.jsx)("div",{className:"space-y-4",children:x?(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("div",{className:"text-6xl mb-4",children:"✅"}),(0,s.jsx)("p",{className:"text-lg font-medium text-text-primary",children:"Authentication Successful!"}),(0,s.jsx)("p",{className:"text-sm text-text-muted mt-2",children:"Fresh API key obtained"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-sm text-text-muted",children:["To get a fresh API key, paste your browser cookie from"," ",(0,s.jsx)("a",{href:"https://platform.iflow.cn",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"platform.iflow.cn"})]}),(0,s.jsxs)("div",{className:"bg-surface-secondary p-3 rounded-lg text-xs space-y-2",children:[(0,s.jsx)("p",{className:"font-medium text-text-primary",children:"How to get cookie:"}),(0,s.jsxs)("ol",{className:"list-decimal list-inside space-y-1 text-text-muted",children:[(0,s.jsx)("li",{children:"Open platform.iflow.cn in your browser"}),(0,s.jsx)("li",{children:"Login to your account"}),(0,s.jsx)("li",{children:"Open DevTools (F12) → Application/Storage → Cookies"}),(0,s.jsx)("li",{children:"Copy the entire cookie string (must include BXAuth)"}),(0,s.jsx)("li",{children:"Paste it below"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-text-primary",children:"Cookie String"}),(0,s.jsx)("textarea",{value:n,onChange:e=>i(e.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:d})]}),m&&(0,s.jsx)("div",{className:"p-3 bg-error/10 border border-error/20 rounded-lg",children:(0,s.jsx)("p",{className:"text-sm text-error",children:m})}),(0,s.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,s.jsx)(l.$n,{variant:"secondary",onClick:g,disabled:d,fullWidth:!0,children:"Cancel"}),(0,s.jsx)(l.$n,{onClick:h,loading:d,fullWidth:!0,children:"Authenticate"})]})]})})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func}},25086:(e,t,a)=>{a.d(t,{CardSkeleton:()=>o,PageLoading:()=>i,Skeleton:()=>l,Spinner:()=>n,default:()=>d});var s=a(95155),r=a(31474);function n({size:e="md",className:t}){return(0,s.jsx)("span",{className:(0,r.cn)("material-symbols-outlined animate-spin text-brand-500",{sm:"size-4",md:"size-6",lg:"size-8",xl:"size-12"}[e],t),children:"progress_activity"})}function i({message:e="Loading..."}){return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center bg-bg",children:[(0,s.jsx)(n,{size:"xl"}),(0,s.jsx)("p",{className:"mt-4 text-text-muted",children:e})]})}function l({className:e,...t}){return(0,s.jsx)("div",{className:(0,r.cn)("animate-pulse rounded-[10px] bg-surface-2",e),...t})}function o(){return(0,s.jsxs)("div",{className:"p-6 rounded-[14px] border border-border-subtle bg-surface shadow-[var(--shadow-soft)]",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,s.jsx)(l,{className:"h-4 w-24"}),(0,s.jsx)(l,{className:"size-10 rounded-[10px]"})]}),(0,s.jsx)(l,{className:"h-8 w-16 mb-2"}),(0,s.jsx)(l,{className:"h-3 w-20"})]})}function d({type:e="spinner",...t}){switch(e){case"page":return(0,s.jsx)(i,{...t});case"skeleton":return(0,s.jsx)(l,{...t});case"card":return(0,s.jsx)(o,{...t});default:return(0,s.jsx)(n,{...t})}}},28058:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(12115),n=a(81127);function i({isOpen:e,onClose:t,onAdd:a,addedNames:l=[]}){let[o,d]=(0,r.useState)([]),[c,m]=(0,r.useState)(!1),[u,x]=(0,r.useState)(""),[p,h]=(0,r.useState)("all"),[g,f]=(0,r.useState)(null),[b,v]=(0,r.useState)(null),[j,y]=(0,r.useState)({}),[k,N]=(0,r.useState)({}),[w,C]=(0,r.useState)({});(0,r.useEffect)(()=>{!e||o.length>0||(m(!0),fetch("/api/cli-tools/cowork-mcp-registry").then(e=>e.json()).then(e=>{e.error?f(e.error):d(e.servers||[])}).catch(e=>f(e.message)).finally(()=>m(!1)))},[e]);let S=(0,r.useMemo)(()=>new Set(l),[l]),O=(0,r.useMemo)(()=>{let e=u.trim().toLowerCase();return o.filter(t=>("authless"!==p||!t.oauth)&&("oauth"!==p||!!t.oauth)&&(!e||(t.title||"").toLowerCase().includes(e)||(t.description||"").toLowerCase().includes(e)||(t.name||"").toLowerCase().includes(e)))},[o,u,p]),F=async e=>{if(!j[e.url]){N(t=>({...t,[e.url]:!0}));try{let t=await fetch("/api/cli-tools/cowork-mcp-tools",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e.url})}),a=await t.json(),s=a.tools||[],r=Array.isArray(e.toolNames)?e.toolNames:[],n=s.length>0?s.map(e=>e.name):r;y(t=>({...t,[e.url]:{tools:s,requiresAuth:!!a.requiresAuth,error:a.error}})),C(t=>({...t,[e.url]:Object.fromEntries(n.map(e=>[e,!0]))}))}catch(t){y(a=>({...a,[e.url]:{tools:[],error:t.message}}))}finally{N(t=>({...t,[e.url]:!1}))}}},W=(e,t)=>{let a=w[e]||{};C(s=>({...s,[e]:Object.fromEntries(Object.keys(a).map(e=>[e,t]))}))};return(0,s.jsx)(n.default,{isOpen:e,onClose:t,title:"Browse MCP Marketplace",size:"lg",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"text",value:u,onChange:e=>x(e.target.value),placeholder:"Search by name or description...",className:"flex-1 px-2 py-1.5 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,s.jsxs)("select",{value:p,onChange:e=>h(e.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,s.jsx)("option",{value:"all",children:"All"}),(0,s.jsx)("option",{value:"authless",children:"Authless"}),(0,s.jsx)("option",{value:"oauth",children:"OAuth"})]})]}),g&&(0,s.jsx)("div",{className:"px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:g}),c&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-xs py-4 justify-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[18px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Loading registry..."})]}),!c&&(0,s.jsxs)("div",{className:"flex flex-col gap-1 max-h-[60vh] overflow-y-auto",children:[0===O.length&&(0,s.jsx)("div",{className:"text-center text-xs text-text-muted py-6",children:"No servers match filter"}),O.map(e=>{let t=S.has(e.slug||e.name),r=b===e.url,n=j[e.url],i=k[e.url],l=w[e.url]||{},o=Object.keys(l),d=Object.values(l).filter(Boolean).length;return(0,s.jsxs)("div",{className:"rounded border border-transparent hover:border-border",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 px-2 py-2 hover:bg-black/5 dark:hover:bg-white/5",children:[e.iconUrl?(0,s.jsx)("img",{src:e.iconUrl,alt:"",className:"size-7 rounded shrink-0 object-contain",onError:e=>{e.target.style.display="none"}}):(0,s.jsx)("div",{className:"size-7 rounded bg-surface shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[(0,s.jsx)("span",{className:"font-medium text-xs",children:e.title}),e.oauth?(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-amber-500/10 text-amber-600",children:"OAuth"}):(0,s.jsx)("span",{className:"px-1 py-0.5 text-[9px] rounded bg-green-500/10 text-green-600",children:"Authless"}),e.toolCount>0&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[e.toolCount," tools"]})]}),e.description&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted line-clamp-2 mt-0.5",children:e.description})]}),(0,s.jsx)("button",{onClick:()=>t?null:void(b===e.url?v(null):(v(e.url),F(e))),disabled:t,className:`shrink-0 px-2 py-1 rounded text-[10px] font-medium transition-colors ${t?"bg-green-500/10 text-green-600 cursor-default":r?"bg-surface border border-border text-text-muted hover:bg-black/5":"bg-primary/10 border border-primary/40 text-primary hover:bg-primary/20"}`,children:t?"Added":r?"Cancel":"+ Add"})]}),r&&(0,s.jsxs)("div",{className:"px-3 py-2 bg-surface/40 border-t border-border flex flex-col gap-2",children:[i&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-text-muted text-[10px] py-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined animate-spin text-[14px]",children:"progress_activity"}),(0,s.jsx)("span",{children:"Probing server for tools..."})]}),!i&&n?.requiresAuth&&(0,s.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&&n?.error&&!n?.requiresAuth&&(0,s.jsxs)("p",{className:"text-[10px] text-red-600 bg-red-500/10 px-2 py-1 rounded",children:["Probe failed: ",n.error]}),!i&&0===o.length&&!n?.requiresAuth&&!n?.error&&(0,s.jsx)("p",{className:"text-[10px] text-text-muted",children:"No tools advertised by server."}),!i&&o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:[d,"/",o.length," tools enabled"]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{onClick:()=>W(e.url,!0),className:"text-[10px] text-primary hover:underline",children:"All"}),(0,s.jsx)("span",{className:"text-[10px] text-text-muted",children:"\xb7"}),(0,s.jsx)("button",{onClick:()=>W(e.url,!1),className:"text-[10px] text-primary hover:underline",children:"None"})]})]}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-1 max-h-40 overflow-y-auto",children:o.map(t=>(0,s.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,s.jsx)("input",{type:"checkbox",checked:!!l[t],onChange:()=>{var a;return a=e.url,void C(e=>({...e,[a]:{...e[a],[t]:!e[a]?.[t]}}))},className:"size-3"}),(0,s.jsx)("span",{className:"truncate",children:t})]},t))})]}),(0,s.jsx)("button",{onClick:()=>{let t,s;return s=Object.keys(t=w[e.url]||{}).filter(e=>t[e]),void(a?.({name:e.slug||e.name,title:e.title,description:e.description,url:e.url,transport:e.transport,oauth:e.oauth,toolNames:s}),v(null))},className:"self-end px-2 py-1 rounded text-[10px] font-medium bg-primary text-white hover:bg-primary/90",children:"✓ Confirm Add"})]})]},e.url)})]}),(0,s.jsxs)("div",{className:"text-[10px] text-text-muted text-right",children:[O.length," of ",o.length," servers"]})]})})}},28067:(e,t,a)=>{a.d(t,{default:()=>n});var s=a(95155),r=a(31474);function n({options:e=[],value:t,onChange:a,size:i="md",className:l}){let o={sm:"h-7 text-xs",md:"h-9 text-sm",lg:"h-11 text-base"};return(0,s.jsx)("div",{className:(0,r.cn)("inline-flex items-center p-1 rounded-[10px] overflow-x-auto","bg-surface-2",l),children:e.map(e=>(0,s.jsxs)("button",{onClick:()=>a(e.value),className:(0,r.cn)("shrink-0 px-4 rounded-[8px] font-medium transition-all",o[i],t===e.value?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[e.icon&&(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px] mr-1.5",children:e.icon}),e.label]},e.value))})}},28815:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(81127),i=a(92542),l=a(11059);function o({isOpen:e,onClose:t,title:a="Manual Configuration",configs:d=[]}){let{copy:c}=(0,l.C)(),[m,u]=(0,r.useState)(null);return(0,s.jsx)(n.default,{isOpen:e,onClose:t,title:a,size:"xl",children:(0,s.jsx)("div",{className:"flex flex-col gap-4",children:d.map((e,t)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-text-main",children:e.filename}),(0,s.jsxs)(i.default,{variant:"ghost",size:"sm",onClick:()=>{var a;return a=e.content,void(c(a,`manualconfig-${t}`),u(t),setTimeout(()=>u(null),2e3))},children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:m===t?"check":"content_copy"}),m===t?"Copied!":"Copy"]})]}),(0,s.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:e.content})]},t))})})}},29366:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(28777),n=a(97677);function i({caps:e,className:t="",colorOverride:a,size:l=16}){if(!e)return null;let o=Object.keys(r.bs).filter(t=>e[t]);return 0===o.length?null:(0,s.jsx)("span",{className:`inline-flex items-center gap-0.5 ${t}`,children:o.map(e=>(0,s.jsx)(n.default,{text:`${r.bs[e].label} — ${r.bs[e].desc}`,children:(0,s.jsx)("span",{className:`material-symbols-outlined leading-none cursor-help ${a||r.bs[e].color}`,style:{fontSize:`${l}px`},children:r.bs[e].icon})},e))})}},30815:(e,t,a)=>{a.d(t,{default:()=>o});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(35497);function o({isOpen:e,onSuccess:t,onClose:a}){let[n,i]=(0,r.useState)(""),[d,c]=(0,r.useState)(""),[m,u]=(0,r.useState)(null),[x,p]=(0,r.useState)(!1),[h,g]=(0,r.useState)(!1),[f,b]=(0,r.useState)(!1),[v,j]=(0,r.useState)(!1),y=async()=>{g(!0),u(null),b(!1),j(!1);try{let e=await fetch("/api/oauth/cursor/auto-import"),t=await e.json();t.found?(i(t.accessToken),c(t.machineId),b(!0)):t.windowsManual?j(!0):u(t.error||"Could not auto-detect tokens")}catch(e){u("Failed to auto-detect tokens")}finally{g(!1)}};(0,r.useEffect)(()=>{e&&y()},[e]);let k=async()=>{if(!n.trim())return void u("Please enter an access token");if(!d.trim())return void u("Please enter a machine ID");p(!0),u(null);try{let e=await fetch("/api/oauth/cursor/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accessToken:n.trim(),machineId:d.trim()})}),s=await e.json();if(!e.ok)throw Error(s.error||"Import failed");t?.(),a()}catch(e){u(e.message)}finally{p(!1)}};return(0,s.jsx)(l.aF,{isOpen:e,title:"Connect Cursor IDE",onClose:a,children:(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[h&&(0,s.jsxs)("div",{className:"text-center py-6",children:[(0,s.jsx)("div",{className:"size-16 mx-auto mb-4 rounded-full bg-primary/10 flex items-center justify-center",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary animate-spin",children:"progress_activity"})}),(0,s.jsx)("h3",{className:"text-lg font-semibold mb-2",children:"Auto-detecting tokens..."}),(0,s.jsx)("p",{className:"text-sm text-text-muted",children:"Reading from Cursor IDE database"})]}),!h&&(0,s.jsxs)(s.Fragment,{children:[f&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-green-600 dark:text-green-400",children:"check_circle"}),(0,s.jsx)("p",{className:"text-sm text-green-800 dark:text-green-200",children:"Tokens auto-detected from Cursor IDE successfully!"})]})}),v&&(0,s.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,s.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-amber-600 dark:text-amber-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:"Could not read Cursor database automatically."})]}),(0,s.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,s.jsx)("strong",{children:"Retry"}),". If the problem persists, paste your tokens manually below."]}),(0,s.jsx)(l.$n,{onClick:y,variant:"outline",fullWidth:!0,children:"Retry"})]}),!f&&!v&&!m&&(0,s.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,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"info"}),(0,s.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:"Cursor IDE not detected. Please paste your tokens manually."})]})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Access Token ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)("textarea",{value:n,onChange:e=>i(e.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,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"block text-sm font-medium mb-2",children:["Machine ID ",(0,s.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,s.jsx)(l.pd,{value:d,onChange:e=>c(e.target.value),placeholder:"Machine ID will be auto-filled...",className:"font-mono text-sm"})]}),m&&(0,s.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,s.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:m})}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(l.$n,{onClick:k,fullWidth:!0,disabled:x||!n.trim()||!d.trim(),children:x?"Importing...":"Import Token"}),(0,s.jsx)(l.$n,{onClick:a,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})]})})}o.propTypes={isOpen:i().bool.isRequired,onSuccess:i().func,onClose:i().func.isRequired}},31474:(e,t,a)=>{a.d(t,{cn:()=>s});function s(...e){return e.filter(Boolean).join(" ").replace(/\s+/g," ").trim()}},35497:(e,t,a)=>{a.d(t,{x0:()=>N.default,Ex:()=>d.default,$n:()=>s.default,Zp:()=>i.default,Qv:()=>o.CardSkeleton,CK:()=>p.default,uo:()=>l.ConfirmModal,G9:()=>v.default,wI:()=>k.default,vj:()=>y.default,vE:()=>j.default,pd:()=>r.default,Mh:()=>b.default,uR:()=>x.default,Nf:()=>h.default,aF:()=>l.default,rq:()=>u.default,gw:()=>w.default,LF:()=>m.default,Wx:()=>O.default,gM:()=>f.default,Iz:()=>C.default,l6:()=>n.default,lM:()=>c.default,m_:()=>S.default,jK:()=>g.default});var s=a(92542),r=a(11910),n=a(98),i=a(84588),l=a(81127),o=a(25086);a(56319);var d=a(56061),c=a(98542);a(38587),a(21110),a(38572),a(8823),a(92173);var m=a(90882),u=a(46067),x=a(28815),p=a(45455),h=a(28058),g=a(10319);a(29366),a(21931),a(80752),a(97556);var f=a(23615);a(61500);var b=a(62899);a(94230);var v=a(30815),j=a(23936),y=a(95088),k=a(73579),N=a(96748),w=a(4823),C=a(28067),S=a(97677),O=a(51825);a(7648),a(91450)},38003:(e,t,a)=>{a.d(t,{C:()=>s});let s=(0,a(1934).v)(e=>({query:"",placeholder:"",visible:!1,setQuery:t=>e({query:t}),register:(t="Search...")=>e({visible:!0,placeholder:t,query:""}),unregister:()=>e({visible:!1,placeholder:"",query:""})}))},38202:(e,t,a)=>{a.d(t,{h:()=>s});let s={en:"\uD83C\uDDFA\uD83C\uDDF8",vi:"\uD83C\uDDFB\uD83C\uDDF3","zh-CN":"\uD83C\uDDE8\uD83C\uDDF3","zh-TW":"\uD83C\uDDF9\uD83C\uDDFC",ja:"\uD83C\uDDEF\uD83C\uDDF5","pt-BR":"\uD83C\uDDE7\uD83C\uDDF7","pt-PT":"\uD83C\uDDF5\uD83C\uDDF9",ko:"\uD83C\uDDF0\uD83C\uDDF7",es:"\uD83C\uDDEA\uD83C\uDDF8",de:"\uD83C\uDDE9\uD83C\uDDEA",fr:"\uD83C\uDDEB\uD83C\uDDF7",he:"\uD83C\uDDEE\uD83C\uDDF1",ar:"\uD83C\uDDF8\uD83C\uDDE6",ru:"\uD83C\uDDF7\uD83C\uDDFA",pl:"\uD83C\uDDF5\uD83C\uDDF1",cs:"\uD83C\uDDE8\uD83C\uDDFF",nl:"\uD83C\uDDF3\uD83C\uDDF1",tr:"\uD83C\uDDF9\uD83C\uDDF7",uk:"\uD83C\uDDFA\uD83C\uDDE6",tl:"\uD83C\uDDF5\uD83C\uDDED",id:"\uD83C\uDDEE\uD83C\uDDE9",th:"\uD83C\uDDF9\uD83C\uDDED",hi:"\uD83C\uDDEE\uD83C\uDDF3",bn:"\uD83C\uDDE7\uD83C\uDDE9",ur:"\uD83C\uDDF5\uD83C\uDDF0",ro:"\uD83C\uDDF7\uD83C\uDDF4",sv:"\uD83C\uDDF8\uD83C\uDDEA",it:"\uD83C\uDDEE\uD83C\uDDF9",el:"\uD83C\uDDEC\uD83C\uDDF7",hu:"\uD83C\uDDED\uD83C\uDDFA",fi:"\uD83C\uDDEB\uD83C\uDDEE",da:"\uD83C\uDDE9\uD83C\uDDF0",no:"\uD83C\uDDF3\uD83C\uDDF4"}},38572:(e,t,a)=>{a.d(t,{default:()=>F});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(98500),o=a.n(l),d=a(73321),c=a(31474),m=a(90620),u=a(52679),x=a(11059),p=a(92542),h=a(81127);let g="krouter@kodelyth.com",f=[{id:"whatsapp",label:"WhatsApp",detail:"+880 1312 365939",href:"https://wa.me/8801312365939",icon:"whatsapp",tint:"#25D366"},{id:"email",label:"Email",detail:g,href:`mailto:${g}`,icon:"mail",tint:"#2d5bff"}];function b({className:e}){return(0,s.jsx)("svg",{viewBox:"-0.69 -0.69 25.38 25.38",fill:"currentColor","aria-hidden":"true",className:e,children:(0,s.jsx)("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.174.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51l-.57-.01c-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.71.306 1.263.489 1.694.625.712.227 1.36.195 1.872.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}function v({className:e}){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:[(0,s.jsx)("path",{d:"M0.7 6.1V6A2.8 2.8 0 0 1 3.5 3.2h17a2.8 2.8 0 0 1 2.8 2.8v.14l-11.3 6.68L0.7 6.1Z"}),(0,s.jsx)("path",{d:"M23.3 8.9v9.13a2.8 2.8 0 0 1-2.8 2.8H3.5a2.8 2.8 0 0 1-2.8-2.8V8.9l10.6 6.25c.45.26.99.26 1.44 0L23.3 8.9Z"})]})}function j({className:e}){return(0,s.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:e,children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3.6"}),(0,s.jsx)("path",{d:"m5.6 5.6 3.85 3.85M14.55 14.55l3.85 3.85M18.4 5.6l-3.85 3.85M9.45 14.55 5.6 18.4"})]})}b.propTypes={className:i().string},v.propTypes={className:i().string},j.propTypes={className:i().string};let y={whatsapp:b,mail:v};function k({className:e}){let[t,a]=(0,r.useState)(!1),n=(0,r.useRef)(null),i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!t)return;let e=e=>{n.current&&!n.current.contains(e.target)&&a(!1)},s=e=>{"Escape"===e.key&&(a(!1),i.current?.focus())};return document.addEventListener("mousedown",e),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",s)}},[t]),(0,s.jsxs)("div",{ref:n,className:(0,c.cn)("relative",e),children:[(0,s.jsx)("div",{id:"support-channels",role:"group","aria-label":"Support channels",className:(0,c.cn)("grid transition-all duration-200 ease-out",t?"grid-rows-[1fr] opacity-100 mb-1":"grid-rows-[0fr] opacity-0"),children:(0,s.jsx)("div",{className:"overflow-hidden",children:(0,s.jsx)("div",{className:"space-y-0.5 pb-1",children:f.map(e=>{let r=y[e.icon];return(0,s.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",onClick:()=>a(!1),tabIndex:t?0:-1,"aria-hidden":!t,className:(0,c.cn)("flex w-full box-border items-center gap-3 px-3 py-2 rounded-lg group","text-text-muted hover:bg-surface-2 hover:text-text-main","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60","transition-colors"),children:[(0,s.jsx)("span",{className:"flex items-center justify-center size-7 rounded-md shrink-0 transition-colors",style:e.tint?{color:e.tint,backgroundColor:`${e.tint}1a`}:void 0,children:r?(0,s.jsx)(r,{className:"size-4"}):null}),(0,s.jsxs)("span",{className:"min-w-0",children:[(0,s.jsx)("span",{className:"block text-[13px] font-medium leading-tight truncate",children:e.label}),(0,s.jsx)("span",{className:"block text-[11px] text-text-muted truncate",children:e.detail})]})]},e.id)})})})}),(0,s.jsxs)("button",{ref:i,type:"button",onClick:()=>a(e=>!e),"aria-expanded":t,"aria-controls":"support-channels",className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-2 rounded-lg group transition-all","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",t?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)(j,{className:(0,c.cn)("size-[18px] shrink-0 transition-colors",t?"":"group-hover:text-primary")}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:"Support"}),(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:(0,c.cn)("size-3.5 ml-auto shrink-0 transition-transform duration-200",t?"rotate-180":""),children:(0,s.jsx)("path",{d:"m6 15 6-6 6 6"})})]})]})}k.propTypes={className:i().string};let N=["embedding","image","video","tts","stt"],w="/dashboard/media-providers/web",C=[{href:"/dashboard/endpoint",label:"Endpoint",icon:"api"},{href:"/dashboard/providers",label:"Providers",icon:"dns"},{href:"/dashboard/combos",label:"Combos",icon:"layers"},{href:"/dashboard/usage",label:"Usage",icon:"bar_chart"},{href:"/dashboard/quota",label:"Quota Tracker",icon:"data_usage"},{href:"/dashboard/mitm",label:"MITM",icon:"security"},{href:"/dashboard/token-saver",label:"Token Saver",icon:"savings"},{href:"/dashboard/pxpipe",label:"PXPIPE",icon:"image"},{href:"/dashboard/cli-tools",label:"CLI Tools",icon:"terminal"}],S=[{href:"/dashboard/console-log",label:"Console Log",icon:"terminal"},{href:"/dashboard/translator",label:"Translator",icon:"translate"}],O=[{href:"/dashboard/presidio",label:"Presidio",icon:"admin_panel_settings"},{href:"/dashboard/proxy-pools",label:"Proxy Pools",icon:"lan"},{href:"/dashboard/skills",label:"Skills",icon:"extension"},{href:"/dashboard/environment",label:"Environment",icon:"tune"}];function F({onClose:e}){let t=(0,d.usePathname)(),[a,n]=(0,r.useState)(!1),[i,l]=(0,r.useState)(!1),[g,f]=(0,r.useState)(null),[b,v]=(0,r.useState)(!1),[j,y]=(0,r.useState)(!1),[T,$]=(0,r.useState)(0),[I,A]=(0,r.useState)(!1),{copied:P,copy:E}=(0,x.C)(2e3),R=m.h0.installCmdLatest;(0,r.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{e.enableTranslator&&A(!0)}).catch(()=>{})},[]),(0,r.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>{e.hasUpdate&&f(e)}).catch(()=>{})},[]);let q=e=>"/dashboard/endpoint"===e?"/dashboard"===t||t.startsWith("/dashboard/endpoint"):t.startsWith(e),D=async()=>{try{await navigator.clipboard.writeText(R)}catch{}E(R);let e=m.h0.shutdownCountdownSec;$(e);let t=setInterval(()=>{$(e-=1),e<=0&&(clearInterval(t),fetch("/api/version/shutdown",{method:"POST"}).catch(()=>{}),l(!0))},1e3)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("aside",{className:"flex w-72 flex-col border-r border-border-subtle bg-vibrancy backdrop-blur-xl transition-colors duration-300 min-h-full",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-6 pt-5 pb-2",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FF5F56]"}),(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#FFBD2E]"}),(0,s.jsx)("div",{className:"w-3 h-3 rounded-full bg-[#27C93F]"})]}),(0,s.jsxs)("div",{className:"px-6 py-4 flex flex-col gap-2",children:[(0,s.jsxs)(o(),{href:"/dashboard",className:"flex items-center gap-3 group",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-9 rounded-[10px] bg-gradient-to-br from-brand-500 to-brand-700 shadow-[var(--shadow-warm)] transition-transform group-hover:scale-[1.03]",children:(0,s.jsx)("svg",{viewBox:"0 0 400 400",className:"size-[22px]","aria-hidden":"true",children:(0,s.jsxs)("g",{fill:"none",stroke:"#ffffff",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polyline",{points:"128,104 184,200 128,296",strokeWidth:"28",strokeOpacity:"0.25"}),(0,s.jsx)("polyline",{points:"172,100 260,200 172,300",strokeWidth:"52"})]})})}),(0,s.jsxs)("div",{className:"flex flex-col leading-none",children:[(0,s.jsx)("h1",{className:"text-[17px] font-bold text-text-main",style:{fontFamily:"var(--font-display)",letterSpacing:"-0.01em"},children:m.vQ.name}),(0,s.jsxs)("span",{className:"text-[11px] text-text-muted mt-[3px] font-medium tabular-nums",children:["v",m.vQ.version]})]})]}),g&&(0,s.jsxs)("div",{className:"flex flex-col gap-1.5 rounded p-1 -m-1",children:[(0,s.jsxs)("span",{className:"text-xs font-semibold text-green-600 dark:text-amber-500",children:["↑ New version available: v",g.latestVersion]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{onClick:()=>v(!0),className:"px-2 py-1 rounded bg-green-600 hover:bg-green-700 dark:bg-amber-500 dark:hover:bg-amber-600 text-white text-[11px] font-semibold transition-colors cursor-pointer",children:"Update now"}),(0,s.jsx)("button",{onClick:()=>E(R),title:"Copy install command",className:"flex-1 text-left hover:opacity-80 transition-opacity cursor-pointer min-w-0",children:(0,s.jsx)("code",{className:"block text-[10px] text-green-600/80 dark:text-amber-400/70 font-mono truncate",children:P?"✓ copied!":R})})]})]})]}),(0,s.jsxs)("nav",{className:"flex-1 px-4 py-2 space-y-0.5 overflow-y-auto custom-scrollbar",children:[C.map(t=>(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),(0,s.jsxs)("div",{className:"pt-3 mt-2 space-y-0.5",children:[(0,s.jsx)("p",{className:"px-4 text-xs font-semibold text-text-muted uppercase tracking-wider mb-2",children:"System"}),(0,s.jsxs)("button",{onClick:()=>n(e=>!e),className:(0,c.cn)("w-full flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",t.startsWith("/dashboard/media-providers")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"perm_media"}),(0,s.jsx)("span",{className:"text-[13px] font-medium flex-1 text-left",children:"Media Providers"}),(0,s.jsx)("span",{className:"material-symbols-outlined text-[14px] transition-transform",style:{transform:a?"rotate(180deg)":"rotate(0deg)"},children:"expand_more"})]}),a&&(0,s.jsxs)("div",{className:"pl-4",children:[u.rj.filter(e=>N.includes(e.id)).map(a=>(0,s.jsxs)(o(),{href:`/dashboard/media-providers/${a.id}`,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(`/dashboard/media-providers/${a.id}`)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:a.icon}),(0,s.jsx)("span",{className:"text-sm",children:a.label})]},a.id)),(0,s.jsxs)(o(),{href:w,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-4 py-1 rounded-lg transition-all group",t.startsWith(w)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"travel_explore"}),(0,s.jsx)("span",{className:"text-sm",children:"Web Fetch & Search"})]},"web")]}),O.map(t=>(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href)),S.map(t=>"/dashboard/translator"!==t.href||I?(0,s.jsxs)(o(),{href:t.href,onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q(t.href)?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q(t.href)?"fill-1":"group-hover:text-primary transition-colors"),children:t.icon}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:t.label})]},t.href):null),(0,s.jsxs)(o(),{href:"/dashboard/profile",onClick:e,className:(0,c.cn)("flex items-center gap-3 px-3 py-1 rounded-lg transition-all group",q("/dashboard/profile")?"bg-primary/10 text-primary":"text-text-muted hover:bg-surface-2 hover:text-text-main"),children:[(0,s.jsx)("span",{className:(0,c.cn)("material-symbols-outlined text-[18px]",q("/dashboard/profile")?"fill-1":"group-hover:text-primary transition-colors"),children:"settings"}),(0,s.jsx)("span",{className:"text-[13px] font-medium",children:"Settings"})]})]})]}),(0,s.jsx)("div",{className:"px-4 pb-3 pt-2 border-t border-border-subtle",children:(0,s.jsx)(k,{})})]}),(0,s.jsx)(h.ConfirmModal,{isOpen:b,onClose:()=>v(!1),onConfirm:()=>{v(!1),y(!0)},title:"Update kRouter",message:`Show install command for v${g?.latestVersion||""}? You can copy it and shutdown to install manually.`,confirmText:"Show Command",cancelText:"Cancel",variant:"primary"}),(i||j)&&(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 backdrop-blur-sm p-6",children:j?(0,s.jsx)(W,{latestVersion:g?.latestVersion,installCmd:R,copied:P,onCopyAndShutdown:D,onCancel:()=>{y(!1),$(0)},countdown:T,isDisconnected:i}):(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"power_off"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-white mb-2",children:"Server Disconnected"}),(0,s.jsx)("p",{className:"text-text-muted mb-6",children:"The proxy server has been stopped."}),(0,s.jsx)(p.default,{variant:"secondary",onClick:()=>globalThis.location.reload(),children:"Reload Page"})]})})]})}function W({latestVersion:e,installCmd:t,copied:a,onCopyAndShutdown:r,onCancel:n,countdown:i,isDisconnected:l}){let o=i>0;return(0,s.jsxs)("div",{className:"w-full max-w-lg rounded-xl bg-neutral-900/95 border border-white/10 p-6 text-white",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 mb-4",children:[(0,s.jsx)("div",{className:"flex items-center justify-center size-11 rounded-full bg-amber-500/20 text-amber-400",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[24px]",children:"content_copy"})}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("h2",{className:"text-lg font-semibold",children:["Update kRouter",e?` to v${e}`:""]}),(0,s.jsx)("p",{className:"text-xs text-white/60",children:l?"Server stopped. Paste the command into a terminal to install.":o?`Command copied. Server will stop in ${i}s...`:"Click the button below to copy the install command and shutdown."})]})]}),(0,s.jsx)("p",{className:"text-sm text-white/80 mb-2",children:"Install command:"}),(0,s.jsx)("div",{className:"w-full px-3 py-2 rounded bg-white/5 mb-4",children:(0,s.jsx)("code",{className:"text-xs font-mono text-amber-400 break-all",children:t})}),(0,s.jsxs)("ol",{className:"text-xs text-white/70 space-y-1 list-decimal list-inside mb-4",children:[(0,s.jsxs)("li",{children:["Click ",(0,s.jsx)("strong",{children:"Copy & Shutdown"})," below."]}),(0,s.jsx)("li",{children:"Paste the command into your terminal and press Enter."}),(0,s.jsxs)("li",{children:["Run ",(0,s.jsx)("code",{className:"px-1 rounded bg-white/10 text-green-400",children:"krouter"})," again after install."]})]}),l?(0,s.jsx)(p.default,{variant:"secondary",fullWidth:!0,onClick:()=>globalThis.location.reload(),children:"Reload Page"}):(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(p.default,{variant:"secondary",onClick:n,disabled:o,children:"Cancel"}),(0,s.jsx)(p.default,{variant:"primary",fullWidth:!0,onClick:r,disabled:o,children:a?"✓ Copied — shutting down...":o?`Shutting down in ${i}s`:"Copy & Shutdown"})]})]})}F.propTypes={onClose:i().func},W.propTypes={latestVersion:i().string,installCmd:i().string.isRequired,copied:i().bool,onCopyAndShutdown:i().func.isRequired,onCancel:i().func.isRequired,countdown:i().number,isDisconnected:i().bool}},38587:(e,t,a)=>{a.d(t,{default:()=>i});var s=a(95155),r=a(1620),n=a(31474);function i({className:e,variant:t="default"}){let{isDark:a,toggleTheme:l}=(0,r.D)(),o={default:(0,n.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,n.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,s.jsx)("button",{onClick:l,className:(0,n.cn)(o[t],e),"aria-label":`Switch to ${a?"light":"dark"} mode`,title:`Switch to ${a?"light":"dark"} mode`,children:(0,s.jsx)("span",{className:(0,n.cn)("material-symbols-outlined text-[22px]","card"===t&&"transition-transform duration-300 group-hover:rotate-12"),children:a?"light_mode":"dark_mode"})})}},45455:(e,t,a)=>{a.d(t,{default:()=>m});var s=a(95155),r=a(12115),n=a(81127),i=a(11910),l=a(92542),o=a(46067);let d=/^[a-zA-Z0-9_.\-]+$/;function c({index:e,model:t,isFirst:a,isLast:n,onEdit:i,onMoveUp:l,onMoveDown:o,onRemove:d}){let[m,u]=(0,r.useState)(!1),[x,p]=(0,r.useState)(t),h=()=>{let e=x.trim();e&&e!==t?i(e):p(t),u(!1)};return(0,s.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,s.jsx)("span",{className:"text-[10px] font-medium text-text-muted w-3 text-center shrink-0",children:e+1}),m?(0,s.jsx)("input",{autoFocus:!0,value:x,onChange:e=>p(e.target.value),onBlur:h,onKeyDown:e=>{"Enter"===e.key&&h(),"Escape"===e.key&&(p(t),u(!1))},className:"min-w-0 flex-1 rounded border border-primary/40 bg-white px-1.5 py-0.5 font-mono text-xs text-text-main outline-none dark:bg-black/20"}):(0,s.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:()=>u(!0),title:"Click to edit",children:t}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,s.jsx)("button",{onClick:l,disabled:a,className:`p-0.5 rounded ${a?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move up",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_upward"})}),(0,s.jsx)("button",{onClick:o,disabled:n,className:`p-0.5 rounded ${n?"text-text-muted/20 cursor-not-allowed":"text-text-muted hover:text-primary hover:bg-black/5 dark:hover:bg-white/5"}`,title:"Move down",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"arrow_downward"})})]}),(0,s.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 transition-all",title:"Remove",children:(0,s.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]})}function m({isOpen:e,combo:t,onClose:a,onSave:u,activeProviders:x,kindFilter:p=null,forcePrefix:h="",title:g}){let f=t?.name?h&&t.name.startsWith(h)?t.name.slice(h.length):t.name:"",[b,v]=(0,r.useState)(f),[j,y]=(0,r.useState)(t?.models||[]),[k,N]=(0,r.useState)(!1),[w,C]=(0,r.useState)(!1),[S,O]=(0,r.useState)(""),[F,W]=(0,r.useState)({});(0,r.useEffect)(()=>{e&&fetch("/api/models/alias").then(e=>e.ok?e.json():null).then(e=>e&&W(e.aliases||{})).catch(()=>{})},[e]);let T=e=>{if(!e.trim())return O("Name is required"),!1;let t=h+e;return d.test(t)?(O(""),!0):(O("Only letters, numbers, -, _ and . allowed"),!1)},$=e=>{let t=e.target.value;h&&t.startsWith(h)&&(t=t.slice(h.length)),v(t),t?T(t):O("")},I=async()=>{T(b)&&(C(!0),await u({name:h+b.trim(),models:j}),C(!1))},A=!!t;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.default,{isOpen:e,onClose:a,title:g||(A?"Edit Combo":"Create Combo"),children:(0,s.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,s.jsxs)("div",{children:[h?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1 block",children:"Combo Name"}),(0,s.jsxs)("div",{className:"flex items-stretch",children:[(0,s.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:h}),(0,s.jsx)("input",{value:b,onChange:$,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"})]}),S&&(0,s.jsx)("p",{className:"text-[11px] text-red-500 mt-0.5",children:S})]}):(0,s.jsx)(i.default,{label:"Combo Name",value:b,onChange:$,placeholder:"my-combo",error:S}),(0,s.jsxs)("p",{className:"text-[10px] text-text-muted mt-0.5",children:[h?`Auto-prefixed with "${h}". `:"","Only letters, numbers, -, _ and . allowed"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Models"}),0===j.length?(0,s.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,s.jsx)("span",{className:"material-symbols-outlined text-text-muted text-xl mb-1",children:"layers"}),(0,s.jsx)("p",{className:"text-xs text-text-muted",children:"No models added yet"})]}):(0,s.jsx)("div",{className:"flex max-h-[55vh] min-w-0 flex-col gap-1 overflow-y-auto sm:max-h-[350px]",children:j.map((e,t)=>(0,s.jsx)(c,{index:t,model:e,isFirst:0===t,isLast:t===j.length-1,onEdit:e=>{let a=[...j];a[t]=e,y(a)},onMoveUp:()=>(e=>{if(0===e)return;let t=[...j];[t[e-1],t[e]]=[t[e],t[e-1]],y(t)})(t),onMoveDown:()=>(e=>{if(e===j.length-1)return;let t=[...j];[t[e],t[e+1]]=[t[e+1],t[e]],y(t)})(t),onRemove:()=>y(j.filter((e,a)=>a!==t))},t))}),(0,s.jsxs)("button",{onClick:()=>N(!0),className:"w-full mt-2 py-2 border border-dashed border-black/10 dark:border-white/10 rounded-lg text-xs text-primary font-medium hover:text-primary hover:border-primary/50 transition-colors flex items-center justify-center gap-1",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add Model"]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2 pt-1 sm:flex-row",children:[(0,s.jsx)(l.default,{onClick:a,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,s.jsx)(l.default,{onClick:I,fullWidth:!0,size:"sm",disabled:!b.trim()||!!S||w,children:w?"Saving...":A?"Save":"Create"})]})]})}),(0,s.jsx)(o.default,{isOpen:k,onClose:()=>N(!1),onSelect:e=>{j.includes(e.value)||y([...j,e.value])},onDeselect:e=>{y(j.filter(t=>t!==e.value))},activeProviders:x,modelAliases:F,title:"Add Model to Combo",kindFilter:p,addedModelValues:j,closeOnSelect:!1})]})}},46067:(e,t,a)=>{a.d(t,{default:()=>N});var s=a(95155),r=a(12115),n=a(14051),i=a.n(n),l=a(81127),o=a(57250),d=a(29366);function c(e,t){return RegExp("^"+e.split("*").map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*")+"$","i").test(t)}let m={vision:!1,pdf:!1,audioInput:!1,videoInput:!1,imageOutput:!1,audioOutput:!1,search:!1,tools:!0,reasoning:!1,thinkingFormat:null,thinkingCanDisable:!0,thinkingRange:null,contextWindow:2e5,maxOutput:64e3},u={"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-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:64e3},"claude-sonnet-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-8":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-opus-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5":{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",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},"claude-sonnet-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},...Object.fromEntries(["high","medium","low"].flatMap(e=>[[`claude-opus-5-5-${e}`,{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3}],[`claude-sonnet-5-5-${e}`,{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,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",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},"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}},x=e=>({vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:e,maxOutput:128e3}),p=Object.fromEntries(["gpt-5.6-sol","gpt-5.6-terra","gpt-5.6-luna"].flatMap(e=>["","-thinking","-agentic","-thinking-agentic"].map(t=>[`${e}${t}`,x(272e3)]))),h=Object.fromEntries(Object.entries({"gpt-6-astra":272e3,"gpt-6-sol":272e3,"gpt-6-luna":272e3,"gpt-5.6-sol":372e3,"gpt-5.6-terra":272e3,"gpt-5.6-luna":272e3,"gpt-5.5":4e5,"gpt-5.4":4e5}).flatMap(([e,t])=>[[e,x(t)],[`${e}-review`,x(t)]])),g={kiro:p,kr:p,codex:h,cx:h,"codebuddy-cn":{"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},"glm-5.2":{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},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},"deepseek-v4.1-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"glm-5.1":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5.0":{reasoning:!0,thinkingFormat:"openai",contextWindow:2e5,maxOutput:48e3},"glm-5.0-turbo":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"glm-5v-turbo":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:38e3},"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},"minimax-m2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:2e5,maxOutput:48e3},"kimi-k2.7":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"kimi-k2.6":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:32e3},"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-pro":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!0,contextWindow:1e6,maxOutput:393216},"deepseek-v4-flash":{vision:!0,reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:5e4},"deepseek-v3-2-volc":{reasoning:!0,thinkingFormat:"openai",thinkingCanDisable:!1,contextWindow:96e3,maxOutput:32e3}},qoder:{ultimate:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},auto:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},performance:{vision:!0,reasoning:!0,thinkingFormat:"claude-adaptive",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},efficient:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},lite:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},dmodel:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},dfmodel:{reasoning:!0,thinkingFormat:"deepseek",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},gmodel:{reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},gfmodel:{vision:!0,reasoning:!0,thinkingFormat:"zai",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:128e3},kmodel:{vision:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:256e3,maxOutput:65536},mmodel:{reasoning:!0,thinkingFormat:"minimax",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:512e3},qmodel_latest:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qmodel:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qfmodel:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536},qmodel_38max:{vision:!0,reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:1e6,maxOutput:65536}},ollama:{"deepseek-v4.1-flash:cloud":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:1e6,maxOutput:384e3}},"opencode-go":{"claude-haiku-5-5":{vision:!0,pdf:!0,reasoning:!0,search:!0,thinkingFormat:"claude-adaptive",contextWindow:1e6,maxOutput:128e3}},opencode:{"deepseek-v4.1-flash-free":{vision:!0,reasoning:!0,thinkingFormat:"deepseek",contextWindow:33e4,maxOutput:128e3}}},f=[{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-adaptive",thinkingCanDisable:!1,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*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.7*",caps:{vision:!0,reasoning:!0,search:!0,thinkingFormat:"openai",contextWindow:5e5,maxOutput:5e5}},{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*max*",caps:{vision:!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:"*qwen*coder*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:1e6}},{pattern:"*qwq*",caps:{reasoning:!0,thinkingFormat:"qwen",thinkingCanDisable:!1,contextWindow:131072}},{pattern:"*qwen*",caps:{reasoning:!0,thinkingFormat:"qwen",contextWindow:262144}},{pattern:"*kimi*k2.7*code*",caps:{vision:!0,reasoning:!0,thinkingFormat:"kimi",thinkingCanDisable:!1,contextWindow:262144,maxOutput:262144}},{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",contextWindow:1e6,maxOutput:128e3}},{pattern:"*glm-5.2*",caps:{reasoning:!0,thinkingFormat:"zai",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",contextWindow:1e6,maxOutput:384e3}},{pattern:"*deepseek-v4*",caps:{reasoning:!0,thinkingFormat:"deepseek",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:{reasoning:!0,thinkingFormat:"minimax",contextWindow:1048576,maxOutput:512e3}},{pattern:"*minimax-m2.7*",caps:{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.5*",caps:{vision:!0,audioInput:!0,videoInput:!0,contextWindow:1048576,maxOutput:131072}},{pattern:"*mimo*omni*",caps:{vision:!0,audioInput:!0,contextWindow:262144,maxOutput:131072}},{pattern:"*mimo*",caps:{vision:!0,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:"*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}}];function b(e,t){if(!t)return{...m};if(e&&g[e]?.[t])return{...m,...g[e][t]};let a=t.includes("/")?t.split("/").pop():t;if(u[a])return{...m,...u[a]};if(u[t])return{...m,...u[t]};for(let{pattern:e,caps:s}of f)if(c(e,a)||c(e,t))return{...m,...s};return{...m}}var v=a(28777),j=a(52679);let y=[...Object.keys(j.zN),...Object.keys(j.IS),...Object.keys(j.nJ),...Object.keys(j.fg)],k=Object.keys(j.IS).filter(e=>j.IS[e].noAuth&&!j.IS[e].hidden);function N({isOpen:e,onClose:t,onSelect:a,onDeselect:n,selectedModel:i,activeProviders:c=[],title:m="Select Model",modelAliases:u={},kindFilter:x=null,capFilter:p=null,addedModelValues:h=[],closeOnSelect:g=!0}){let f=(0,r.useMemo)(()=>x?c.filter(e=>{let t=j.Q2[e.provider];return(t?.serviceKinds||["llm"]).includes(x)}):c,[c,x]),[w,C]=(0,r.useState)(""),[S,O]=(0,r.useState)([]),[F,W]=(0,r.useState)([]),[T,$]=(0,r.useState)([]),[I,A]=(0,r.useState)({}),[P,E]=(0,r.useState)({}),R=async()=>{try{let e=await fetch("/api/combos");if(!e.ok)throw Error(`Failed to fetch combos: ${e.status}`);let t=await e.json();O(t.combos||[])}catch(e){console.error("Error fetching combos:",e),O([])}};(0,r.useEffect)(()=>{e&&R()},[e]);let q=async()=>{try{let e=await fetch("/api/provider-nodes");if(!e.ok)throw Error(`Failed to fetch provider nodes: ${e.status}`);let t=await e.json();W(t.nodes||[])}catch(e){console.error("Error fetching provider nodes:",e),W([])}};(0,r.useEffect)(()=>{e&&q()},[e]);let D=async()=>{try{let e=await fetch("/api/models/custom");if(!e.ok)throw Error(`Failed to fetch custom models: ${e.status}`);let t=await e.json();$(t.models||[])}catch(e){console.error("Error fetching custom models:",e),$([])}};(0,r.useEffect)(()=>{e&&D()},[e]);let z=async()=>{try{let e=await fetch("/api/models/disabled");if(!e.ok)throw Error(`Failed to fetch disabled models: ${e.status}`);let t=await e.json();A(t.disabled||{})}catch(e){console.error("Error fetching disabled models:",e),A({})}};(0,r.useEffect)(()=>{e&&z()},[e]);let L=async(e,t,{refresh:a=!1}={})=>{E(t=>({...t,[e]:{...t[e]||{},loading:!0,error:null}}));try{let s=new URLSearchParams({provider:e});t&&s.set("connectionId",t),a&&s.set("refresh","1");let r=await fetch(`/api/models/live?${s}`),n=await r.json();E(t=>({...t,[e]:{loading:!1,models:Array.isArray(n.models)?n.models:[],error:n.error||(n.models?.length?null:"No models returned"),source:n.source}}))}catch(t){E(a=>({...a,[e]:{loading:!1,models:[],error:t.message}}))}};(0,r.useEffect)(()=>{if(!e)return;let t=new Set;[...f,...k.map(e=>({provider:e,id:e}))].forEach(e=>{let a=j.Q2[e.provider];if(!a)return;let s=new Set(["kiro","qoder"]);!(!0===a.passthroughModels||a.modelsFetcher||s.has(e.provider))||t.has(e.provider)||(t.add(e.provider),L(e.provider,e.id))})},[e,f.length]);let _=(0,r.useMemo)(()=>({...j.zN,...j.IS,...j.nJ,...j.fg}),[]),M=(0,r.useMemo)(()=>{let e={},t=new Set(["webSearch","webFetch"]),a=new Set(["image","tts","stt","embedding","imageToText"]),s=new Set(["tts","image","webFetch"]);return[...new Set([...f.map(e=>e.provider),...x?k.filter(e=>(j.Q2[e]?.serviceKinds||["llm"]).includes(x)):k])].sort((e,t)=>{let a=y.indexOf(e),s=y.indexOf(t);return(-1===a?999:a)-(-1===s?999:s)}).forEach(r=>{let n=(0,j.wG)(r),i=_[r]||{name:r,color:"#666"},l=(0,j.mq)(r)||(0,j.gb)(r);if(x&&t.has(x)){e[r]={name:i.name,alias:n,color:i.color,models:[{id:r,name:i.name,value:r}]};return}if(i.passthroughModels){let t=Object.entries(u).filter(([,e])=>e.startsWith(`${n}/`)).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:t})),l=P[r],o=new Set(t.map(e=>e.id)),d=[...t,...(l?.models||[]).filter(e=>e?.id&&!o.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isLive:!0}))];x&&a.has(x)&&0===(d=(0,v.KC)(r).filter(e=>e.type===x).map(e=>({id:e.id,name:e.name,value:`${n}/${e.id}`,type:e.type}))).length&&s.has(x)&&(i.serviceKinds||["llm"]).includes(x)&&(d=[{id:r,name:i.name,value:n}]);let c=0===d.length&&(l?.loading||l?.error);if(d.length>0||c){let t=F.find(e=>e.id===r),a=t?.name||i.name;e[r]={name:a,alias:n,color:i.color,models:d,liveStatus:l?{loading:!!l.loading,error:l.error||null,source:l.source,liveCount:(l.models||[]).length}:null}}}else if(l){if(x&&a.has(x))return;let t=c.find(e=>e.provider===r),s=F.find(e=>e.id===r),n=s?.name||t?.name||i.name,l=t?.providerSpecificData?.prefix||s?.prefix||r,o=Object.entries(u).filter(([,e])=>e.startsWith(`${r}/`)).map(([e,t])=>({id:t.replace(`${r}/`,""),name:e,value:`${l}/${t.replace(`${r}/`,"")}`})),d=o.length>0?o:[{id:`__placeholder__${r}`,name:`${l}/model-id`,value:`${l}/model-id`,isPlaceholder:!0}];e[r]={name:n,alias:l,color:i.color,models:d,isCustom:!0,hasModels:o.length>0}}else{var o;let t,l=(0,v.KC)(r),d=new Set(l.map(e=>e.id)),c=l.length>0,m=Object.entries(u).filter(([e,t])=>t.startsWith(`${n}/`)&&(!c||e===t.replace(`${n}/`,""))&&!d.has(t.replace(`${n}/`,""))).map(([e,t])=>({id:t.replace(`${n}/`,""),name:e,value:t,isCustom:!0})),h=new Set(m.map(e=>e.id)),g=T.filter(e=>e.providerAlias===n&&!d.has(e.id)&&!h.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isCustom:!0})),f=new Set([...d,...m.map(e=>e.id),...g.map(e=>e.id)]),j=P[r],y=(j?.models||[]).filter(e=>e?.id&&!f.has(e.id)).map(e=>({id:e.id,name:e.name||e.id,value:`${n}/${e.id}`,isLive:!0})),k=[...l.map(e=>({id:e.id,name:e.name,value:`${n}/${e.id}`,type:e.type})),...m,...g,...y],N=new Set,w=(o=k.filter(e=>!N.has(e.value)&&(N.add(e.value),!0)),t=x?a.has(x)?o.filter(e=>e.isPlaceholder||e.type===x):o:o.filter(e=>e.isPlaceholder||e.isCustom||!e.type||"llm"===e.type),p&&(t=t.filter(e=>{let t=e.value||"",a=t.indexOf("/");return!(a<=0)&&b(t.slice(0,a),t.slice(a+1))?.[p]===!0})),t);0===w.length&&x&&s.has(x)&&(i.serviceKinds||["llm"]).includes(x)&&(w=[{id:r,name:i.name,value:n}]);let C=0===w.length&&(j?.loading||j?.error);(w.length>0||C)&&(e[r]={name:i.name,alias:n,color:i.color,models:w,liveStatus:j?{loading:!!j.loading,error:j.error||null,source:j.source,liveCount:(j.models||[]).length}:null})}}),Object.entries(e).forEach(([t,a])=>{let s=new Set([...I[(0,j.wG)(t)]||[],...I[t]||[]]);0!==s.size&&(a.models=a.models.filter(e=>!s.has(e.id)),0===a.models.length&&delete e[t])}),e},[f,u,_,F,T,I,x,c,P]),U=(0,r.useMemo)(()=>{if(x||p)return[];if(!w.trim())return S;let e=w.toLowerCase();return S.filter(t=>t.name.toLowerCase().includes(e))},[S,w,x,p]),K=(0,r.useMemo)(()=>{let e=w.trim().toLowerCase(),t={};return Object.entries(M).forEach(([a,s])=>{var r;let n=s.models;if(e){let t=s.name.toLowerCase().includes(e);if(0===(n=n.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e))).length&&!t)return}t[a]={...s,models:[...(r=n).filter(e=>h.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name)),...r.filter(e=>!h.includes(e.value)).sort((e,t)=>e.name.localeCompare(t.name))]}}),t},[M,w,h]),B=e=>{let s=e?.value||e?.name||e;h.includes(s)&&n?n(e):a(e),g&&(t(),C(""))};return(0,s.jsxs)(l.default,{isOpen:e,onClose:()=>{t(),C("")},title:m,size:"md",className:"p-4!",footer:null,children:[(0,s.jsxs)("div",{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,s.jsx)("span",{className:"material-symbols-outlined text-primary shrink-0",style:{fontSize:"14px"},children:"info"}),(0,s.jsx)("span",{children:"Click to add, click again to remove. Changes are saved automatically."})]}),(0,s.jsx)("div",{className:"mb-3",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)("span",{className:"material-symbols-outlined absolute left-2.5 top-1/2 -translate-y-1/2 text-text-muted text-[16px]",children:"search"}),(0,s.jsx)("input",{type:"text",placeholder:"Search...",value:w,onChange:e=>C(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface border border-border rounded text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"})]})}),(0,s.jsxs)("div",{className:"max-h-[400px] overflow-y-auto space-y-3",children:[U.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)("span",{className:"material-symbols-outlined text-primary text-[14px]",children:"layers"}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:"Combos"}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",U.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:U.map(e=>{let t=i===e.name;return(0,s.jsxs)("button",{onClick:()=>B({id:e.name,name:e.name,value:e.name}),className:`
|
|
2
2
|
px-2 py-1 rounded-xl text-xs font-medium transition-all border hover:cursor-pointer flex items-center gap-1
|
|
3
3
|
${t?"bg-primary text-white border-primary":h.includes(e.name)?"bg-primary border-primary text-white hover:bg-primary-hover":"bg-surface border-border text-text-main hover:border-primary/50 hover:bg-primary/5"}
|
|
4
4
|
`,children:[h.includes(e.name)&&(0,s.jsx)("span",{className:"material-symbols-outlined leading-none",style:{fontSize:"10px"},children:"check"}),e.name]},e.id)})})]}),Object.entries(K).map(([e,t])=>(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5 sticky top-0 bg-surface py-0.5",children:[(0,s.jsx)(o.A,{src:`/providers/${e}.png`,alt:t.name,size:14,fallbackText:(t.name||e).slice(0,2).toUpperCase(),fallbackColor:t.color}),(0,s.jsx)("span",{className:"text-xs font-medium text-primary",children:t.name}),(0,s.jsxs)("span",{className:"text-[10px] text-text-muted",children:["(",t.models.length,")"]}),t.liveStatus&&(0,s.jsxs)("span",{className:"flex items-center gap-1 ml-auto",children:[t.liveStatus.loading&&(0,s.jsxs)("span",{className:"text-[10px] text-text-muted flex items-center gap-1",children:[(0,s.jsx)("span",{className:"inline-block w-2 h-2 border border-text-muted border-t-transparent rounded-full animate-spin"}),"loading"]}),!t.liveStatus.loading&&t.liveStatus.error&&(0,s.jsx)("button",{type:"button",onClick:()=>{let t=f.find(t=>t.provider===e);L(e,t?.id,{refresh:!0})},className:"text-[10px] text-amber-500 hover:text-amber-400 cursor-pointer",title:t.liveStatus.error,children:"⚠ retry"}),!t.liveStatus.loading&&!t.liveStatus.error&&t.liveStatus.liveCount>0&&(0,s.jsx)("button",{type:"button",onClick:()=>{let t=f.find(t=>t.provider===e);L(e,t?.id,{refresh:!0})},className:"text-[10px] text-text-muted hover:text-primary cursor-pointer",title:`${t.liveStatus.liveCount} live models • click to refresh`,children:"↻"})]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:t.models.map(t=>{let a=i===t.value,r=t.isPlaceholder,n=r?null:b(e,t.id||t.value),l=n?{vision:n.vision,pdf:n.pdf,reasoning:n.reasoning}:null;return(0,s.jsx)("button",{onClick:()=>B(t),title:r?"Select to pre-fill, then edit model ID in the input":void 0,className:`
|