9router 0.4.18 → 0.4.19
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/BUILD_ID +1 -1
- package/app/.next/app-path-routes-manifest.json +9 -6
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/routes-manifest.json +18 -0
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js +3 -3
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/skills/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js +2 -2
- package/app/.next/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error/page.js +3 -3
- package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_global-error.html +1 -1
- package/app/.next/server/app/_global-error.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/_not-found/page.js +2 -2
- package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/api/auth/login/route.js +1 -1
- package/app/.next/server/app/api/auth/logout/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/antigravity-mitm/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/codex-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -0
- package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -0
- package/app/.next/server/app/api/cli-tools/cowork-mcp-registry/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/hermes-settings/route.js +1 -1
- package/app/.next/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next/server/app/api/cloud/auth/route.js +1 -1
- package/app/.next/server/app/api/cloud/credentials/update/route.js +1 -1
- package/app/.next/server/app/api/cloud/model/resolve/route.js +1 -1
- package/app/.next/server/app/api/cloud/models/alias/route.js +1 -1
- package/app/.next/server/app/api/combos/[id]/route.js +1 -1
- package/app/.next/server/app/api/combos/route.js +1 -1
- package/app/.next/server/app/api/health/route.js +1 -1
- package/app/.next/server/app/api/init/route.js +1 -1
- package/app/.next/server/app/api/keys/[id]/route.js +1 -1
- package/app/.next/server/app/api/keys/route.js +1 -1
- package/app/.next/server/app/api/locale/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/deepgram/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/elevenlabs/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/inworld/voices/route.js +1 -1
- package/app/.next/server/app/api/media-providers/tts/voices/route.js +1 -1
- package/app/.next/server/app/api/models/alias/route.js +1 -1
- package/app/.next/server/app/api/models/availability/route.js +1 -1
- package/app/.next/server/app/api/models/custom/route.js +1 -1
- package/app/.next/server/app/api/models/disabled/route.js +1 -1
- package/app/.next/server/app/api/models/route.js +1 -1
- package/app/.next/server/app/api/models/test/route.js +1 -1
- package/app/.next/server/app/api/oauth/[provider]/[action]/route.js +2 -2
- package/app/.next/server/app/api/oauth/cursor/auto-import/route.js +2 -2
- package/app/.next/server/app/api/oauth/cursor/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/gitlab/pat/route.js +1 -1
- package/app/.next/server/app/api/oauth/iflow/cookie/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/auto-import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/import/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-authorize/route.js +1 -1
- package/app/.next/server/app/api/oauth/kiro/social-exchange/route.js +1 -1
- package/app/.next/server/app/api/pricing/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/[id]/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/route.js +1 -1
- package/app/.next/server/app/api/provider-nodes/validate/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/providers/[id]/test-models/route.js +1 -1
- package/app/.next/server/app/api/providers/client/route.js +1 -1
- package/app/.next/server/app/api/providers/kilo/free-models/route.js +1 -1
- package/app/.next/server/app/api/providers/route.js +1 -1
- package/app/.next/server/app/api/providers/suggested-models/route.js +1 -1
- package/app/.next/server/app/api/providers/test-batch/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/[id]/test/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/route.js +1 -1
- package/app/.next/server/app/api/proxy-pools/vercel-deploy/route.js +2 -2
- package/app/.next/server/app/api/settings/database/route.js +1 -1
- package/app/.next/server/app/api/settings/proxy-test/route.js +1 -1
- package/app/.next/server/app/api/settings/require-login/route.js +1 -1
- package/app/.next/server/app/api/settings/route.js +1 -1
- package/app/.next/server/app/api/shutdown/route.js +1 -1
- package/app/.next/server/app/api/tags/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/route.js +1 -1
- package/app/.next/server/app/api/translator/console-logs/stream/route.js +2 -2
- package/app/.next/server/app/api/translator/load/route.js +1 -1
- package/app/.next/server/app/api/translator/save/route.js +1 -1
- package/app/.next/server/app/api/translator/send/route.js +1 -1
- package/app/.next/server/app/api/translator/translate/route.js +1 -1
- package/app/.next/server/app/api/tunnel/disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/status/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-check/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-disable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-enable/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/app/.next/server/app/api/tunnel/tailscale-login/route.js +1 -1
- package/app/.next/server/app/api/tunnel/tailscale-start-daemon/route.js +2 -2
- package/app/.next/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next/server/app/api/usage/chart/route.js +1 -1
- package/app/.next/server/app/api/usage/history/route.js +1 -1
- package/app/.next/server/app/api/usage/providers/route.js +1 -1
- package/app/.next/server/app/api/usage/request-details/route.js +1 -1
- package/app/.next/server/app/api/usage/request-logs/route.js +1 -1
- package/app/.next/server/app/api/usage/stats/route.js +1 -1
- package/app/.next/server/app/api/usage/stream/route.js +2 -2
- package/app/.next/server/app/api/v1/api/chat/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/speech/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/transcriptions/route.js +1 -1
- package/app/.next/server/app/api/v1/audio/voices/route.js +1 -0
- package/app/.next/server/app/api/v1/audio/voices/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v1/audio/voices/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/v1/chat/completions/route.js +1 -1
- package/app/.next/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next/server/app/api/v1/images/generations/route.js +2 -2
- package/app/.next/server/app/api/v1/messages/count_tokens/route.js +1 -1
- package/app/.next/server/app/api/v1/messages/route.js +1 -1
- package/app/.next/server/app/api/v1/models/[kind]/route.js +1 -1
- package/app/.next/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/models/info/route.js +1 -0
- package/app/.next/server/app/api/v1/models/info/route.js.nft.json +1 -0
- package/app/.next/server/app/api/v1/models/info/route_client-reference-manifest.js +1 -0
- package/app/.next/server/app/api/v1/models/route.js +1 -1
- package/app/.next/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/responses/compact/route.js +1 -1
- package/app/.next/server/app/api/v1/responses/route.js +1 -1
- package/app/.next/server/app/api/v1/route.js +1 -1
- package/app/.next/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next/server/app/api/v1/search/route.js +1 -1
- package/app/.next/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/[...path]/route.js +1 -1
- package/app/.next/server/app/api/v1beta/models/route.js +1 -1
- package/app/.next/server/app/api/version/route.js +1 -1
- package/app/.next/server/app/api/version/update/route.js +1 -1
- package/app/.next/server/app/callback/page.js +2 -2
- package/app/.next/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +4 -4
- package/app/.next/server/app/callback.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/callback.segments/callback/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/callback.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next/server/app/dashboard/basic-chat.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/basic-chat.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/basic-chat.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/basic-chat.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/cli-tools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/cli-tools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/combos.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/endpoint.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/media-providers/web.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/media-providers/web.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/mitm.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/profile.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers/new.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers/new.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/providers.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/proxy-pools.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/quota.segments/_full.segment.rsc +7 -7
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page.js +2 -2
- package/app/.next/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard/settings.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/settings/pricing.segments/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/skills.html +1 -1
- package/app/.next/server/app/dashboard/skills.rsc +6 -6
- package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/skills.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/skills.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/skills.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/translator.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard/usage.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/!KGRhc2hib2FyZCk.segment.rsc +2 -2
- package/app/.next/server/app/dashboard.segments/_full.segment.rsc +6 -6
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/favicon.ico/route.js +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +4 -4
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing/page.js +2 -2
- package/app/.next/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/landing.html +1 -1
- package/app/.next/server/app/landing.rsc +4 -4
- package/app/.next/server/app/landing.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/landing.segments/landing/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/landing.segment.rsc +1 -1
- package/app/.next/server/app/login/page.js +2 -2
- package/app/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +5 -5
- package/app/.next/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/app/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/app/.next/server/app/manifest.webmanifest/route.js +2 -2
- package/app/.next/server/app/page.js +2 -2
- package/app/.next/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +9 -6
- package/app/.next/server/chunks/126.js +1 -1
- package/app/.next/server/chunks/2049.js +1 -1
- package/app/.next/server/chunks/21.js +1 -1
- package/app/.next/server/chunks/253.js +1 -1
- package/app/.next/server/chunks/450.js +6 -6
- package/app/.next/server/chunks/5053.js +1 -1
- package/app/.next/server/chunks/514.js +3 -3
- package/app/.next/server/chunks/6782.js +1 -0
- package/app/.next/server/chunks/6890.js +23 -0
- package/app/.next/server/chunks/8035.js +1 -1
- package/app/.next/server/chunks/8202.js +4 -4
- package/app/.next/server/chunks/8515.js +1 -0
- package/app/.next/server/middleware-build-manifest.js +1 -1
- package/app/.next/server/pages/404.html +1 -1
- package/app/.next/server/pages/500.html +1 -1
- package/app/.next/server/server-reference-manifest.js +1 -1
- package/app/.next/server/server-reference-manifest.json +1 -1
- package/app/.next/static/9OjWTX0ytTCDd5CT8o5t1/_buildManifest.js +1 -0
- package/app/.next/static/chunks/1939-b2a5b6699b8bf3d5.js +23 -0
- package/app/.next/static/chunks/4156-cc8090a3b79e0545.js +7 -0
- package/app/.next/static/chunks/{505-cc19e0fe00f6ff66.js → 505-3794c7277120b05a.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-c8bd4fbe3e45d124.js → page-a6fe1644188a6348.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/combos/{page-24f203d25ad3f861.js → page-4e109bbbffbc2e16.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/media-providers/combo/[id]/{page-d994f22741fa26ed.js → page-29ce6662637d64e4.js} +2 -2
- package/app/.next/static/chunks/app/(dashboard)/dashboard/mitm/{page-e40dca387669f457.js → page-bad9a5af75575018.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-b150970e241c5c7b.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-6c6bb4f9b3b7e5f8.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/layout-14ad56e827498f3d.js +1 -0
- package/app/.next/static/chunks/app/_global-error/page-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/auth/login/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/auth/logout/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cowork-mcp-registry/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/auth/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/combos/[id]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/combos/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/health/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/init/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/keys/[id]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/keys/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/locale/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/alias/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/availability/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/custom/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/disabled/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/models/test/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/pricing/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/client/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/suggested-models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/test-batch/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/providers/validate/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/settings/database/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/settings/require-login/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/settings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/shutdown/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tags/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/load/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/save/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/send/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/translator/translate/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/disable/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/enable/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/status/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/chart/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/history/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/providers/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-details/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/request-logs/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stats/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/usage/stream/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/api/chat/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/audio/voices/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/embeddings/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/images/generations/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/messages/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/[kind]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/info/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/compact/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/responses/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/search/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1/web/fetch/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/v1beta/models/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/version/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/api/version/update/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/manifest.webmanifest/route-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/app/page-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/c6123951-b42288d628b452ba.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-23420dc99d53d479.js +1 -0
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-23420dc99d53d479.js +1 -0
- package/app/.next/static/css/085ed641ab718f9b.css +1 -0
- package/app/package.json +1 -1
- package/package.json +1 -1
- package/app/.next/server/chunks/2372.js +0 -23
- package/app/.next/server/chunks/8565.js +0 -1
- package/app/.next/server/chunks/9534.js +0 -1
- package/app/.next/static/chunks/4156-34c517ee5f198889.js +0 -7
- package/app/.next/static/chunks/4496-228f5725c9fc96f5.js +0 -23
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0161829206939ffe.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-b864d9416f014ad6.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/layout-2b41c9c888e0223f.js +0 -1
- package/app/.next/static/chunks/app/_global-error/page-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/auth/login/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/auth/logout/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/alias/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/antigravity-mitm/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/claude-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/codex-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/copilot-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/cowork-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/droid-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/hermes-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/openclaw-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cli-tools/opencode-settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/auth/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/credentials/update/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/model/resolve/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/cloud/models/alias/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/combos/[id]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/combos/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/health/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/init/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/keys/[id]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/keys/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/locale/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/deepgram/voices/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/elevenlabs/voices/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/inworld/voices/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/media-providers/tts/voices/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/alias/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/availability/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/custom/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/disabled/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/models/test/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/[provider]/[action]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/auto-import/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/cursor/import/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/gitlab/pat/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/iflow/cookie/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/auto-import/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/import/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-authorize/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/oauth/kiro/social-exchange/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/pricing/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/[id]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/provider-nodes/validate/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/[id]/test-models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/client/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/kilo/free-models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/suggested-models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/test-batch/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/providers/validate/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/[id]/test/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/proxy-pools/vercel-deploy/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/settings/database/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/settings/proxy-test/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/settings/require-login/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/settings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/shutdown/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tags/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/console-logs/stream/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/load/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/save/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/send/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/translator/translate/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/disable/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/enable/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/status/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-check/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-disable/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-enable/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-install/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-login/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/tunnel/tailscale-start-daemon/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/[connectionId]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/chart/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/history/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/providers/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-details/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/request-logs/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stats/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/usage/stream/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/api/chat/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/speech/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/audio/transcriptions/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/chat/completions/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/embeddings/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/images/generations/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/count_tokens/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/messages/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/[kind]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/compact/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/responses/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/search/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1/web/fetch/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/[...path]/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/v1beta/models/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/version/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/api/version/update/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/manifest.webmanifest/route-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/app/page-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/c6123951-462cab681f34bf85.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/app-error-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/forbidden-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/not-found-ab0bb075b650e476.js +0 -1
- package/app/.next/static/chunks/next/dist/client/components/builtin/unauthorized-ab0bb075b650e476.js +0 -1
- package/app/.next/static/css/63a1213af8e77ffe.css +0 -1
- package/app/.next/static/r-Jcjpzy4CWuaVq-r3ozi/_buildManifest.js +0 -1
- /package/app/.next/static/{r-Jcjpzy4CWuaVq-r3ozi → 9OjWTX0ytTCDd5CT8o5t1}/_ssgManifest.js +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4496],{45219:(e,t,s)=>{s.d(t,{Tk:()=>x,Ah:()=>u,Q6:()=>_,a7:()=>j,ZM:()=>h,RF:()=>y,gY:()=>P,tA:()=>A,kn:()=>M,yZ:()=>g,qO:()=>N});var l=s(73365),a=s(1521),r=s(74156),i=s(58872);let n="9router.cliToolEndpointPresets";function o(e){return Array.isArray(e)?e.filter(e=>e?.name&&e?.baseUrl&&e?.apiKey):[]}function d(e){window.localStorage.setItem(n,JSON.stringify(o(e)))}function c({baseUrl:e,apiKey:t,onBaseUrlChange:s,onApiKeyChange:r}){let[i,m]=(0,a.useState)([]),[x,u]=(0,a.useState)("");(0,a.useEffect)(()=>{m(function(){try{return o(JSON.parse(window.localStorage.getItem(n)||"[]"))}catch{return[]}}())},[]);let p=(0,a.useMemo)(()=>i.find(e=>e.name===x)||null,[i,x]);return(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right",children:"Preset"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsxs)("select",{value:x,onChange:e=>{var t;let l;return u(t=e.target.value),void((l=i.find(e=>e.name===t))&&(s(l.baseUrl),r(l.apiKey)))},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",children:[(0,l.jsx)("option",{value:"",children:"Manual / current endpoint"}),i.map(e=>{var t;return(0,l.jsxs)("option",{value:e.name,children:[e.name," - ",e.baseUrl," (",(t=e.apiKey)?t.length<=12?`${t.slice(0,4)}...`:`${t.slice(0,8)}...${t.slice(-4)}`:"No API key",")"]},e.name)})]}),(0,l.jsx)("button",{type:"button",onClick:()=>{let s=(e||"").trim(),l=(t||"").trim();if(!s||!l)return;let a=p?.name||s;try{a=p?.name||new URL(s).host}catch{a=p?.name||s}let r=window.prompt("Preset name",a);if(!r?.trim())return;let n={name:r.trim(),baseUrl:s,apiKey:l},o=[...i.filter(e=>e.name!==n.name),n].sort((e,t)=>e.name.localeCompare(t.name));m(o),u(n.name),d(o)},disabled:!e||!t,className:"px-2 py-1.5 rounded border text-xs bg-surface border-border text-text-main hover:border-primary disabled:opacity-50 disabled:cursor-not-allowed shrink-0",title:"Save current Base URL and API key as a browser-local preset",children:"Save"}),p&&(0,l.jsx)("button",{type:"button",onClick:()=>{if(!p)return;let e=i.filter(e=>e.name!==p.name);m(e),u(""),d(e)},className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Delete selected preset",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"delete"})})]})}let m=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,activeProviders:n,modelMappings:o,onModelMappingChange:d,baseUrl:u,hasActiveProviders:p,apiKeys:h,cloudEnabled:g,initialStatus:f}){let y,b,[j,N]=(0,a.useState)(f||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[_,S]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[M,O]=(0,a.useState)(!1),[I,P]=(0,a.useState)(!1),[R,T]=(0,a.useState)(null),[$,U]=(0,a.useState)(""),[K,L]=(0,a.useState)({}),[z,D]=(0,a.useState)(!1),[F,B]=(0,a.useState)(""),[H,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),J=(()=>{if(!j?.installed)return null;let e=j.settings?.env?.ANTHROPIC_BASE_URL;if(!e)return"not_configured";let t=e.includes("localhost")||e.includes("127.0.0.1"),s=g&&m&&e.startsWith(m),l=u&&e.startsWith(u);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{h?.length>0&&!$&&U(h[0].key)},[h,$]),(0,a.useEffect)(()=>{f&&N(f)},[f]),(0,a.useEffect)(()=>{t&&!j&&(Z(),Y()),t&&Y()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let G=async e=>{let t=e.target.checked;q(t),await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({ccFilterNaming:t})}).catch(()=>{})},Y=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&L(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(j?.installed&&!W.current){W.current=!0;let t=j.settings?.env||{};e.defaultModels.forEach(e=>{if(e.envKey){let s=t[e.envKey]||e.defaultValue||"";s&&d(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&h?.some(e=>e.key===s)&&U(s)}},[j,h,e.defaultModels,d]);let Z=async()=>{w(!0);try{let e=await fetch("/api/cli-tools/claude-settings"),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{w(!1)}},V=()=>{let e=F||u;return e.endsWith("/v1")?e:`${e}/v1`},Q=()=>{let e=F||u;return e.endsWith("/v1")?e:`${e}/v1`},X=$&&!h.some(e=>e.key===$),ee=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(h?.length>0?h[0].key:null)||(g?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=o[e.alias];s&&e.envKey&&(t[e.envKey]=s)});let l=await fetch("/api/cli-tools/claude-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:t})}),a=await l.json();l.ok?(E({type:"success",text:"Settings applied successfully!"}),N(e=>({...e,hasBackup:!0,settings:{...e?.settings,env:t}}))):E({type:"error",text:a.error||"Failed to apply settings"})}catch(e){E({type:"error",text:e.message})}finally{C(!1)}},et=async()=>{S(!0),E(null);try{let t=await fetch("/api/cli-tools/claude-settings",{method:"DELETE"}),s=await t.json();t.ok?(E({type:"success",text:"Settings reset successfully!"}),e.defaultModels.forEach(e=>d(e.alias,e.defaultValue||"")),U("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({type:"error",text:e.message})}finally{S(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/claude.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[v&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude CLI..."})]}),!v&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>D(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>O(!M),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:M?"expand_less":"help"}),M?"Hide":"How to Install"]})]})]}),M&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @anthropic-ai/claude-code"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"claude"})," to verify."]})]})]})]}),!v&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.settings?.env?.ANTHROPIC_BASE_URL&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(0,l.jsx)(c,{baseUrl:Q(),apiKey:$,onBaseUrlChange:B,onApiKeyChange:U}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:Q(),onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),F&&F!==u&&(0,l.jsx)("button",{onClick:()=>B(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),h.length>0||$?(0,l.jsxs)("select",{value:$,onChange:e=>U(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[X&&(0,l.jsx)("option",{value:$,children:$}),h.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:g?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:o[e.alias]||"",onChange:t=>d(e.alias,t.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),o[e.alias]&&(0,l.jsx)("button",{onClick:()=>d(e.alias,""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{T(e.alias),P(!0)},disabled:!p,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]},e.alias)),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[(0,l.jsx)("input",{type:"checkbox",checked:H,onChange:G,className:"w-3.5 h-3.5 accent-primary cursor-pointer"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"Filter naming requests"})]}),(0,l.jsx)(r.m_,{text:"Intercepts Claude Code's topic-naming requests and returns a fake response locally, saving API tokens.",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] cursor-help",children:"info"})})]})]}),A&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===A.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===A.type?"check_circle":"error"}),(0,l.jsx)("span",{children:A.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:!p,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!j?.has9Router,loading:_,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>D(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>P(!1),onSelect:e=>{R&&d(R,e.value)},selectedModel:R?o[R]:null,activeProviders:n,modelAliases:K,title:`Select model for ${R}`}),(0,l.jsx)(r.uR,{isOpen:z,onClose:()=>D(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:g?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=o[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({hasCompletedOnboarding:!0,env:b},null,2)}])})]})}function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:m,initialStatus:x}){let p,h,g,f,[y,b]=(0,a.useState)(x||null),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[_,S]=(0,a.useState)(null),[A,E]=(0,a.useState)(!1),[M,O]=(0,a.useState)(""),[I,P]=(0,a.useState)(""),[R,T]=(0,a.useState)(""),[$,U]=(0,a.useState)(!1),[K,L]=(0,a.useState)(!1),[z,D]=(0,a.useState)({}),[F,B]=(0,a.useState)(!1),[H,q]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!M&&O(o[0].key)},[o,M]),(0,a.useEffect)(()=>{x&&b(x)},[x]),(0,a.useEffect)(()=>{t&&!y&&(V(),W()),t&&W()},[t]);let W=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&D(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(y?.config){let e=y.config.match(/^model\s*=\s*"([^"]+)"/m);e&&P(e[1]);let t=y.config.match(/\[agents\.subagent\]\s*\n\s*model\s*=\s*"([^"]+)"/m);t&&T(t[1])}},[y]);let J=y?.installed?y.config?y.config.includes(n)||y.config.includes("localhost")||y.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,G=()=>{let e=H||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},Y=()=>H||`${n}/v1`,Z=M&&!o.some(e=>e.key===M),V=async()=>{N(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{N(!1)}},Q=async()=>{w(!0),S(null);try{let e=M&&M.trim()||m?M:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:G(),apiKey:e,model:I,subagentModel:R||I})}),s=await t.json();t.ok?(S({type:"success",text:"Settings applied successfully!"}),V()):S({type:"error",text:s.error||"Failed to apply settings"})}catch(e){S({type:"error",text:e.message})}finally{w(!1)}},X=async()=>{C(!0),S(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(S({type:"success",text:"Settings reset successfully!"}),P(""),T(""),V()):S({type:"error",text:t.error||"Failed to reset settings"})}catch(e){S({type:"error",text:e.message})}finally{C(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/codex.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===J&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Codex CLI..."})]}),!j&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Codex CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>B(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>E(!A),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:A?"expand_less":"help"}),A?"Hide":"How to Install"]})]})]}),A&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g @openai/codex"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"codex"})," to verify."]}),(0,l.jsx)("div",{className:"pt-2 border-t border-border",children:(0,l.jsxs)("p",{className:"text-text-muted text-xs",children:["Codex uses ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"~/.codex/auth.json"})," with ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"OPENAI_API_KEY"}),'. Click "Apply" to auto-configure.']})})]})]})]}),!j&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.config&&((h=(p=y.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h})]}):null),(0,l.jsx)(c,{baseUrl:Y(),apiKey:M,onBaseUrlChange:q,onApiKeyChange:O}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:Y(),onChange:e=>q(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),H&&H!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>q(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),o.length>0||M?(0,l.jsxs)("select",{value:M,onChange:e=>O(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[Z&&(0,l.jsx)("option",{value:M,children:M}),o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:m?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:I,onChange:e=>P(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),I&&(0,l.jsx)("button",{onClick:()=>P(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>U(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:R,onChange:e=>T(e.target.value),placeholder:I||"provider/model-id (defaults to main model)",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),R&&(0,l.jsx)("button",{onClick:()=>T(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>L(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"})]})]}),_&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===_.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===_.type?"check_circle":"error"}),(0,l.jsx)("span",{children:_.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Q,disabled:!M&&m&&o.length>0||!I,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:X,disabled:k,loading:k,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>B(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:$,onClose:()=>U(!1),onSelect:e=>{P(e.value),R||T(e.value),U(!1)},selectedModel:I,activeProviders:d,modelAliases:z,title:"Select Model for Codex"}),(0,l.jsx)(r.rq,{isOpen:K,onClose:()=>L(!1),onSelect:e=>{T(e.value),L(!1)},selectedModel:R,activeProviders:d,modelAliases:z,title:"Select Subagent Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:F,onClose:()=>B(!1),title:"Codex CLI - Manual Configuration",configs:(g=M&&M.trim()?M:m?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f=R||I,[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
|
|
2
|
-
model = "${I}"
|
|
3
|
-
model_provider = "9router"
|
|
4
|
-
|
|
5
|
-
[model_providers.9router]
|
|
6
|
-
name = "9Router"
|
|
7
|
-
base_url = "${G()}"
|
|
8
|
-
wire_api = "responses"
|
|
9
|
-
|
|
10
|
-
[agents.subagent]
|
|
11
|
-
model = "${f}"
|
|
12
|
-
`},{filename:"~/.codex/auth.json",content:JSON.stringify({auth_mode:"apikey",OPENAI_API_KEY:g},null,2)}])})]})}let p=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function h({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:x,initialStatus:u}){let g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,_]=(0,a.useState)(!1),[S,A]=(0,a.useState)(null),[E,M]=(0,a.useState)(""),[O,I]=(0,a.useState)([]),[P,R]=(0,a.useState)(""),[T,$]=(0,a.useState)(!1),[U,K]=(0,a.useState)({}),[L,z]=(0,a.useState)(!1),[D,F]=(0,a.useState)(!1),[B,H]=(0,a.useState)(""),q=(0,a.useRef)(!1),W=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"));if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=x&&p&&e.baseUrl?.startsWith(p),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&M(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(G(),J()),t&&J()},[t]);let J=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&K(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!q.current){q.current=!0;let e=(b.settings?.customModels||[]).filter(e=>e.id?.startsWith("custom:9Router")).sort((e,t)=>(e.index||0)-(t.index||0)).map(e=>e.model);if(e.length>0)I(e);else{let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e?.model&&I([e.model])}}},[b]);let G=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/droid-settings"),t=await e.json();j(t)}catch(e){j({installed:!1,error:e.message})}finally{v(!1)}},Y=()=>{let e=B||n;return e.endsWith("/v1")?e:`${e}/v1`},Z=()=>{let e=B||n;return e.endsWith("/v1")?e:`${e}/v1`},V=E&&!d.some(e=>e.key===E),Q=()=>{let e=P.trim();!e||O.includes(e)||(I(t=>[...t,e]),R(""))},X=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:Y(),apiKey:e,models:O,activeModel:O[0]||""})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),G()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},ee=async()=>{_(!0),A(null);try{let e=await fetch("/api/cli-tools/droid-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),I([]),G()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/droid.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===W&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[N&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Factory Droid CLI..."})]}),!N&&b&&!b.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Factory Droid CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>z(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>F(!D),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:D?"expand_less":"help"}),D?"Hide":"How to Install"]})]})]}),D&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux / Windows:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"curl -fsSL https://app.factory.ai/cli | sh"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"droid"})," to verify."]})]})]})]}),!N&&b?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[b?.settings?.customModels?.find(e=>e.id?.startsWith("custom:9Router"))?.baseUrl&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:b.settings.customModels.find(e=>e.id?.startsWith("custom:9Router")).baseUrl})]}),(0,l.jsx)(c,{baseUrl:Z(),apiKey:E,onBaseUrlChange:H,onApiKeyChange:M}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:Z(),onChange:e=>H(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),B&&B!==n&&(0,l.jsx)("button",{onClick:()=>H(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),d.length>0||E?(0,l.jsxs)("select",{value:E,onChange:e=>M(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[V&&(0,l.jsx)("option",{value:E,children:E}),d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsxs)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:["Models ",O.length>0&&(0,l.jsxs)("span",{className:"text-primary",children:["(",O.length,")"]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-1",children:[O.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-0.5 mb-1",children:O.map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1 bg-bg-secondary rounded border border-border",children:[(0,l.jsx)("span",{className:"flex-1 text-xs font-mono truncate",children:e}),(0,l.jsx)("button",{onClick:()=>I(t=>t.filter(t=>t!==e)),className:"text-text-muted hover:text-red-500 transition-colors shrink-0",title:"Remove",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,l.jsx)("input",{type:"text",value:P,onChange:e=>R(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),Q())},placeholder:"provider/model-id",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,l.jsx)("button",{onClick:()=>$(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs shrink-0 ${o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),(0,l.jsx)("button",{onClick:Q,disabled:!P.trim(),className:"px-2 py-1.5 rounded border bg-surface border-border hover:border-primary text-xs shrink-0 disabled:opacity-50",title:"Add model",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"})})]})]})]})]}),S&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,disabled:0===O.length,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ee,disabled:!b?.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>z(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:T,onClose:()=>$(!1),onSelect:e=>{!e.value||O.includes(e.value)||(I(t=>[...t,e.value]),$(!1))},selectedModel:null,activeProviders:m,modelAliases:U,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>z(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:O.map((e,t)=>({model:e,id:`custom:9Router-${t}`,index:t,baseUrl:Y(),apiKey:g,displayName:e,maxOutputTokens:131072,noImageSupport:!1,provider:"openai"}))},y="u">typeof navigator&&navigator.platform,[{filename:y?.toLowerCase().includes("win")?"%USERPROFILE%\\.factory\\settings.json":"~/.factory/settings.json",content:JSON.stringify(f,null,2)}])})]})}function g({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:x,initialStatus:u}){let p,[h,f]=(0,a.useState)(u||null),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),[_,S]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[M,O]=(0,a.useState)({}),[I,P]=(0,a.useState)(null),[R,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)({}),[K,L]=(0,a.useState)(!1),[z,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),B=(()=>{if(!h?.installed)return null;let e=h.settings?.models?.providers?.["9router"];if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1")||e.baseUrl?.includes("0.0.0.0"),s=n&&e.baseUrl?.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!_&&S(d[0].key)},[d,_]),(0,a.useEffect)(()=>{u&&f(u)},[u]),(0,a.useEffect)(()=>{t&&!h&&(q(),H()),t&&H()},[t]);let H=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&U(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(h?.installed&&!F.current){F.current=!0;let e=h.settings?.models?.providers?.["9router"];if(e){let t=h.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&S(e.apiKey)}let t=h.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),O(s)}},[h,d]);let q=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/openclaw-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},W=()=>window.location.origin.replace("://localhost","://127.0.0.1"),J=()=>{let e=z||W();return e.endsWith("/v1")?e:`${e}/v1`},G=()=>{let e=z||W();return e.endsWith("/v1")?e:`${e}/v1`},Y=_&&!d.some(e=>e.key===_),Z=async()=>{N(!0),C(null);try{let e=_?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch("/api/cli-tools/openclaw-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:J(),apiKey:e,model:A,agentModels:M})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),q()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},V=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/openclaw-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),E(""),S(""),q()):C({type:"error",text:t.error||"Failed to reset settings"})}catch(e){C({type:"error",text:e.message})}finally{w(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/openclaw.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===B&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===B&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===B&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Open Claw CLI..."})]}),!y&&h&&!h.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Open Claw CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsx)("div",{className:"flex items-center gap-2 pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>L(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!y&&h?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[h?.settings?.models?.providers?.["9router"]?.baseUrl&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.models.providers["9router"].baseUrl})]}),(0,l.jsx)(c,{baseUrl:G(),apiKey:_,onBaseUrlChange:D,onApiKeyChange:S}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:G(),onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),z&&z!==n&&(0,l.jsx)("button",{onClick:()=>D(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),d.length>0||_?(0,l.jsxs)("select",{value:_,onChange:e=>S(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[Y&&(0,l.jsx)("option",{value:_,children:_}),d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{P(null),T(!0)},disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]}),(h.agents||[]).filter(e=>e.agentDir).map(e=>(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-4",children:[(0,l.jsxs)("span",{className:"w-32 shrink-0 text-xs text-primary text-right truncate",title:e.name||e.id,children:["Agent ",e.name||e.id]}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:M[e.id]||"",onChange:t=>O(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${A||"provider/model-id"})`,className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),M[e.id]&&(0,l.jsx)("button",{onClick:()=>O(t=>({...t,[e.id]:""})),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{P(e.id),T(!0)},disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},e.id))]}),k&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===k.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===k.type?"check_circle":"error"}),(0,l.jsx)("span",{children:k.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:Z,disabled:!A,loading:j,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:V,disabled:!h?.has9Router,loading:v,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>L(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:R,onClose:()=>T(!1),onSelect:e=>{I?(O(t=>({...t,[I]:e.value})),P(null)):E(e.value),T(!1)},selectedModel:A,activeProviders:m,modelAliases:$,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:K,onClose:()=>L(!1),title:"Open Claw - Manual Configuration",configs:(p=_&&_.trim()?_:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.openclaw/openclaw.json",content:JSON.stringify({agents:{defaults:{model:{primary:`9router/${A||"provider/model-id"}`}}},models:{providers:{"9router":{baseUrl:J(),apiKey:p,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}let f="/api/cli-tools/hermes-settings";function y({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:x,initialStatus:u}){let p,[h,g]=(0,a.useState)(u||null),[b,j]=(0,a.useState)(!1),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,_]=(0,a.useState)(null),[S,A]=(0,a.useState)(""),[E,M]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[P,R]=(0,a.useState)({}),[T,$]=(0,a.useState)(!1),[U,K]=(0,a.useState)(""),L=(0,a.useRef)(!1),z=(()=>{if(!h?.installed)return null;let e=h.settings?.model;if(!e?.base_url)return"not_configured";let t=/localhost|127\.0\.0\.1|0\.0\.0\.0/.test(e.base_url),s=n&&e.base_url.startsWith(n);return t||s?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!S&&A(d[0].key)},[d,S]),(0,a.useEffect)(()=>{u&&g(u)},[u]),(0,a.useEffect)(()=>{t&&!h&&(F(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&R(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(h?.installed&&!L.current){L.current=!0;let e=h.settings?.model;e?.default&&M(e.default)}},[h]);let F=async()=>{j(!0);try{let e=await fetch(f),t=await e.json();g(t)}catch(e){g({installed:!1,error:e.message})}finally{j(!1)}},B=()=>{let e=U||window.location.origin.replace("://localhost","://127.0.0.1");return e.endsWith("/v1")?e:`${e}/v1`},H=S&&!d.some(e=>e.key===S),q=async()=>{v(!0),_(null);try{let e=S?.trim()||(d?.length>0?d[0].key:null)||(x?null:"sk_9router"),t=await fetch(f,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:B(),apiKey:e,model:E})}),s=await t.json();t.ok?(_({type:"success",text:"Settings applied successfully!"}),F()):_({type:"error",text:s.error||"Failed to apply settings"})}catch(e){_({type:"error",text:e.message})}finally{v(!1)}},W=async()=>{k(!0),_(null);try{let e=await fetch(f,{method:"DELETE"}),t=await e.json();e.ok?(_({type:"success",text:"Settings reset successfully!"}),M(""),F()):_({type:"error",text:t.error||"Failed to reset settings"})}catch(e){_({type:"error",text:e.message})}finally{k(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/hermes.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===z&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[b&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Hermes Agent..."})]}),!b&&h&&!h.installed&&(0,l.jsx)("div",{className:"flex flex-col gap-4",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Hermes Agent not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Install: curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"})]})]}),(0,l.jsx)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 pl-0 sm:pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>$(!0),className:"w-full sm:w-auto !bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]})}),!b&&h?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[h?.settings?.model?.base_url&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:h.settings.model.base_url})]}),(0,l.jsx)(c,{baseUrl:B(),apiKey:S,onBaseUrlChange:K,onApiKeyChange:A}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:B(),onChange:e=>K(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),U&&U!==n&&(0,l.jsx)("button",{onClick:()=>K(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),d.length>0||S?(0,l.jsxs)("select",{value:S,onChange:e=>A(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[H&&(0,l.jsx)("option",{value:S,children:S}),d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:E,onChange:e=>M(e.target.value),placeholder:"provider/model-id",className:"w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),E&&(0,l.jsx)("button",{onClick:()=>M(""),className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!o,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]})]}),C&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===C.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===C.type?"check_circle":"error"}),(0,l.jsx)("span",{children:C.text})]}),(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:q,disabled:!E,loading:N,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:W,disabled:!h?.has9Router,loading:w,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>$(!0),className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:O,onClose:()=>I(!1),onSelect:e=>{M(e.value),I(!1)},selectedModel:E,activeProviders:m,modelAliases:P,title:"Select Model for Hermes Agent"}),(0,l.jsx)(r.uR,{isOpen:T,onClose:()=>$(!1),title:"Hermes Agent - Manual Configuration",configs:(p=S&&S.trim()?S:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.hermes/config.yaml",content:`model:
|
|
13
|
-
default: "${E||"provider/model-id"}"
|
|
14
|
-
provider: "custom"
|
|
15
|
-
base_url: "${B()}"
|
|
16
|
-
`},{filename:"~/.hermes/.env",content:`OPENAI_API_KEY=${p}
|
|
17
|
-
`}])})]})}var b=s(96459);function j({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:m=!1,tunnelEnabled:x=!1}){let[u,p]=(0,a.useState)(null),[h,g]=(0,a.useState)(!1),[f,y]=(0,a.useState)(""),[N,v]=(0,a.useState)(()=>d?.length>0?d[0].key:""),w=e=>{let t=N&&N.trim()?N:m?"your-api-key":"sk_9router",s=o||"http://localhost:20128",l=s.endsWith("/v1")?s:`${s}/v1`;return e.replace(/\{\{baseUrl\}\}/g,l).replace(/\{\{apiKey\}\}/g,t).replace(/\{\{model\}\}/g,f||"provider/model-id")},{copy:k}=(0,b.C)(),C=async(e,t)=>{await k(w(e),`toolcard-${t}`),p(t),setTimeout(()=>p(null),2e3)},_=c.length>0,S=()=>(!t.requiresExternalUrl||!!m||!!x)&&(!t.requiresCloud||!!m);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden overflow-x-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:n,children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 rounded-lg flex items-center justify-center shrink-0",children:t.image?(0,l.jsx)(i.default,{src:t.image,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}}):t.icon?(0,l.jsx)("span",{className:"material-symbols-outlined text-xl",style:{color:t.color},children:t.icon}):(0,l.jsx)(i.default,{src:`/providers/${e}.png`,alt:t.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:t.name}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:t.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${s?"rotate-180":""}`,children:"expand_more"})]}),s&&(0,l.jsx)("div",{className:"mt-6 pt-6 border-t border-border",children:t.guideSteps?(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[t.notes&&0!==t.notes.length?(0,l.jsx)("div",{className:"flex flex-col gap-2 mb-4",children:t.notes.map((e,t)=>{if("cloudCheck"===e.type&&(m||x))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!m&&!x,r="bg-blue-500/10 border-blue-500/30",i="text-blue-600 dark:text-blue-400",n="text-blue-500",o="info";return s?(r="bg-yellow-500/10 border-yellow-500/30",i="text-yellow-600 dark:text-yellow-400",n="text-yellow-500",o="warning"):a&&(r="bg-red-500/10 border-red-500/30",i="text-red-600 dark:text-red-400",n="text-red-500",o="error"),(0,l.jsxs)("div",{className:`flex items-start gap-3 p-3 rounded-lg border ${r}`,children:[(0,l.jsx)("span",{className:`material-symbols-outlined text-lg ${n}`,children:o}),(0,l.jsx)("p",{className:`text-sm ${i}`,children:e.text})]},t)})}):null,S()&&t.guideSteps.map(e=>(0,l.jsxs)("div",{className:"flex items-start gap-4",children:[(0,l.jsx)("div",{className:"size-8 rounded-full flex items-center justify-center shrink-0 text-sm font-semibold text-white",style:{backgroundColor:t.color},children:e.step}),(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"font-medium text-text",children:e.title}),e.desc&&(0,l.jsx)("p",{className:"text-sm text-text-muted mt-0.5",children:e.desc}),"apiKeySelector"===e.type&&(0,l.jsx)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:N,onChange:e=>v(e.target.value),className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50",children:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}),(0,l.jsx)("button",{onClick:()=>C(N,"apiKey"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"apiKey"===u?"check":"content_copy"})})]}):(0,l.jsx)("span",{className:"text-sm text-text-muted",children:m?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:f,onChange:e=>y(e.target.value),placeholder:"provider/model-id",className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm border border-border focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>g(!0),disabled:!_,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${_?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),f&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>C(f,"model"),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"model"===u?"check":"content_copy"})}),(0,l.jsx)("button",{onClick:()=>y(""),className:"p-2 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:"close"})})]})]}),e.value&&(0,l.jsxs)("div",{className:"mt-2 flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsx)("code",{className:"w-full sm:w-auto flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:w(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>C(e.value,`${e.step}-${e.title}`),className:"shrink-0 px-3 py-2 bg-bg-secondary hover:bg-bg-tertiary rounded-lg border border-border transition-colors",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-lg",children:u===`${e.step}-${e.title}`?"check":"content_copy"})})]})]})]},e.step)),S()&&t.codeBlock&&(0,l.jsxs)("div",{className:"mt-2",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,l.jsx)("span",{className:"text-xs text-text-muted uppercase tracking-wide",children:t.codeBlock.language}),(0,l.jsxs)("button",{onClick:()=>C(t.codeBlock.code,"codeblock"),className:"flex items-center gap-1 px-2 py-1 text-xs bg-bg-secondary hover:bg-bg-tertiary rounded border border-border transition-colors",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-sm",children:"codeblock"===u?"check":"content_copy"}),"codeblock"===u?"Copied!":"Copy"]})]}),(0,l.jsx)("pre",{className:"p-4 bg-bg-secondary rounded-lg border border-border overflow-x-auto",children:(0,l.jsx)("code",{className:"text-sm font-mono whitespace-pre",children:w(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:h,onClose:()=>g(!1),onSelect:e=>{y(e.value)},selectedModel:f,activeProviders:c,title:"Select Model"})]})}function N({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:m,initialStatus:x}){let u,p,h,g,f,[y,b]=(0,a.useState)(x||null),[j,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,_]=(0,a.useState)(!1),[S,A]=(0,a.useState)(null),[E,M]=(0,a.useState)(!1),[O,I]=(0,a.useState)(""),[P,R]=(0,a.useState)(""),[T,$]=(0,a.useState)(""),[U,K]=(0,a.useState)(!1),[L,z]=(0,a.useState)(!1),[D,F]=(0,a.useState)({}),[B,H]=(0,a.useState)(!1),[q,W]=(0,a.useState)(""),[J,G]=(0,a.useState)([]),[Y,Z]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!O&&I(o[0].key)},[o,O]),(0,a.useEffect)(()=>{x&&b(x)},[x]),(0,a.useEffect)(()=>{t&&!y&&(es(),V()),t&&V()},[t]),(0,a.useEffect)(()=>{y?.opencode?.models&&G(y.opencode.models),y?.opencode?.activeModel&&Z(y.opencode.activeModel),y?.config?.agent?.explorer?.model?.startsWith("9router/")&&$(y.config.agent.explorer.model.replace("9router/",""))},[y]);let V=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&F(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},Q=(()=>{if(!y?.installed)return null;if(!y.config)return"not_configured";let e=y.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return y.has9Router&&(t||e.includes(n))?"configured":y.has9Router?"other":"not_configured"})(),X=()=>{let e=q||n;return e.endsWith("/v1")?e:`${e}/v1`},ee=()=>q||`${n}/v1`,et=O&&!o.some(e=>e.key===O),es=async()=>{v(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();b(t)}catch(e){b({installed:!1,error:e.message})}finally{v(!1)}},el=async()=>{k(!0),A(null);try{let e=O&&O.trim()||m?O:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:X(),apiKey:e,models:J,activeModel:""===Y?"":Y||J[0],subagentModel:T})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),es()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},ea=async()=>{_(!0),A(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(A({type:"success",text:"Settings reset successfully!"}),R(""),$(""),G([]),Z(""),es()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({type:"error",text:e.message})}finally{_(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:"/providers/opencode.png",alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"other"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking OpenCode CLI..."})]}),!j&&y&&!y.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"OpenCode CLI not detected locally"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Manual configuration is still available if 9router is deployed on a remote server."})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 pl-9",children:[(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>H(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>M(!E),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:E?"expand_less":"help"}),E?"Hide":"How to Install"]})]})]}),E&&(0,l.jsxs)("div",{className:"p-4 bg-surface border border-border rounded-lg",children:[(0,l.jsx)("h4",{className:"font-medium mb-3",children:"Installation Guide"}),(0,l.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-text-muted mb-1",children:"macOS / Linux:"}),(0,l.jsx)("code",{className:"block px-3 py-2 bg-black/5 dark:bg-white/5 rounded font-mono text-xs",children:"npm install -g opencode-ai"})]}),(0,l.jsxs)("p",{className:"text-text-muted",children:["After installation, run ",(0,l.jsx)("code",{className:"px-1 bg-black/5 dark:bg-white/5 rounded",children:"opencode"})," to verify."]})]})]})]}),!j&&y?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[y?.config?.provider?.["9router"]?.options?.baseURL&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:y.config.provider["9router"].options.baseURL})]}),(0,l.jsx)(c,{baseUrl:ee(),apiKey:O,onBaseUrlChange:W,onApiKeyChange:I}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:ee(),onChange:e=>W(e.target.value),placeholder:"https://.../v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),q&&q!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>W(""),className:"p-1 text-text-muted hover:text-primary rounded transition-colors",title:"Reset to default",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"restart_alt"})})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),o.length>0||O?(0,l.jsxs)("select",{value:O,onChange:e=>I(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[et&&(0,l.jsx)("option",{value:O,children:O}),o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:m?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===J.length?(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):J.map(e=>(0,l.jsxs)("span",{onClick:async()=>{if(e===Y)try{(await fetch("/api/cli-tools/opencode-settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({clearActiveModel:!0})})).ok&&(Z(""),es())}catch(e){console.log("Error clearing active model:",e)}else Z(e)},className:`inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs cursor-pointer transition-colors ${e===Y?"bg-primary/10 text-primary border border-primary":"bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border"}`,title:e===Y?"Click to clear active model":"Click to set as active",children:[e===Y&&(0,l.jsx)("span",{className:"material-symbols-outlined text-[10px]",children:"star"}),e,(0,l.jsx)("button",{onClick:async t=>{t.stopPropagation();try{if((await fetch(`/api/cli-tools/opencode-settings?model=${encodeURIComponent(e)}`,{method:"DELETE"})).ok){let t=J.filter(t=>t!==e);G(t),Y===e&&Z(""),es()}}catch(e){console.log("Error removing model:",e)}},className:"ml-0.5 hover:text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("button",{onClick:()=>K(!0),disabled:!d?.length,className:`px-2 py-1 rounded border text-xs transition-colors ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"}),(0,l.jsx)("span",{className:"text-xs text-text-muted",children:J.length>0&&Y?(0,l.jsxs)(l.Fragment,{children:["Active: ",(0,l.jsx)("span",{className:"text-primary",children:Y})]}):J.length>0?(0,l.jsx)("span",{className:"text-yellow-500",children:"Click a model to set/clear active"}):"Select models to add"})]})]})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Subagent Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:T,onChange:e=>$(e.target.value),placeholder:P||"provider/model-id (defaults to main model)",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"}),(0,l.jsx)("button",{onClick:()=>z(!0),disabled:!d?.length,className:`w-full sm:w-auto rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 whitespace-nowrap sm:shrink-0 ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),T&&(0,l.jsx)("button",{onClick:()=>$(""),className:"p-1 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear (will use main model)",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]})]}),S&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===S.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===S.type?"check_circle":"error"}),(0,l.jsx)("span",{children:S.text})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:el,disabled:0===J.length,loading:w,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:ea,disabled:!y.has9Router,loading:C,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>H(!0),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:U,onClose:()=>K(!1),onSelect:e=>{!J.includes(e.value)&&(G([...J,e.value]),Y||Z(e.value)),K(!1)},selectedModel:null,activeProviders:d,modelAliases:D,title:"Add Model for OpenCode"}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>z(!1),onSelect:e=>{$(e.value),z(!1)},selectedModel:T,activeProviders:d,modelAliases:D,title:"Select Subagent Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:B,onClose:()=>H(!1),title:"OpenCode - Manual Configuration",configs:(u=O&&O.trim()?O:m?"<API_KEY_FROM_DASHBOARD>":"sk_9router",p=J.length>0?J:["provider/model-id"],h=Y||J[0]||p[0],g=T||h,f={},p.forEach(e=>{f[e]={name:e}}),[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:X(),apiKey:u},models:f}},model:`9router/${h}`,agent:{explorer:{description:"Fast explorer subagent for codebase exploration",mode:"subagent",model:`9router/${g}`}}},null,2)}])})]})}let v="/api/cli-tools/cowork-settings",w=e=>/localhost|127\.0\.0\.1|0\.0\.0\.0/i.test(e||""),k=e=>(e||"").replace(/\/v1\/?$/,""),C=e=>{let t=(e||"").replace(/\/+$/,"");return t?/\/v1$/.test(t)?t:`${t}/v1`:""};function _({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,hasActiveProviders:c,cloudEnabled:m,cloudUrl:x,tunnelEnabled:u,tunnelPublicUrl:p,tailscaleEnabled:h,tailscaleUrl:g,initialStatus:f}){let y,b,[j,N]=(0,a.useState)(f||null),[S,A]=(0,a.useState)(!1),[E,M]=(0,a.useState)(!1),[O,I]=(0,a.useState)(!1),[P,R]=(0,a.useState)(null),[T,$]=(0,a.useState)(""),[U,K]=(0,a.useState)([]),[L,z]=(0,a.useState)(!1),[D,F]=(0,a.useState)({}),[B,H]=(0,a.useState)(!1),[q,W]=(0,a.useState)("custom"),[J,G]=(0,a.useState)(""),Y=(0,a.useMemo)(()=>{let e=[];return u&&p&&e.push({value:"tunnel",label:`Tunnel - ${p}`,url:C(p)}),h&&g&&e.push({value:"tailscale",label:`Tailscale - ${g}`,url:C(g)}),m&&x&&e.push({value:"cloud",label:`Cloud - ${x}`,url:C(x)}),e.push({value:"custom",label:"Custom URL (VPS / public host)",url:""}),e},[u,p,h,g,m,x]);(0,a.useEffect)(()=>{o?.length>0&&!T&&$(o[0].key)},[o,T]),(0,a.useEffect)(()=>{f&&N(f)},[f]),(0,a.useEffect)(()=>{t&&!j&&(V(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{j?.cowork?.models?.length&&K(j.cowork.models),j?.cowork?.baseUrl&&!J&&(G(k(j.cowork.baseUrl)),W("custom"))},[j]),(0,a.useEffect)(()=>{!J&&Y[0]?.url&&(W(Y[0].value),G(k(Y[0].url)))},[Y]);let Z=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&F(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},V=async()=>{A(!0);try{let e=await fetch(v),t=await e.json();N(t)}catch(e){N({installed:!1,error:e.message})}finally{A(!1)}},Q=(()=>{if(!j?.installed)return null;let e=j?.cowork?.baseUrl;return e?w(e)?"invalid":j.has9Router?"configured":"other":"not_configured"})(),X=T&&!o.some(e=>e.key===T),ee=async()=>{R(null);let e=C(J);if(w(e))return void R({type:"error",text:"Localhost is not allowed. Enable Tunnel/Tailscale or use VPS."});if(0===U.length)return void R({type:"error",text:"Please select at least one model"});M(!0);try{let t=T?.trim()||(o?.length>0?o[0].key:null)||(m?null:"sk_9router"),s=await fetch(v,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:e,apiKey:t,models:U})}),l=await s.json();s.ok?(R({type:"success",text:"Settings applied. Quit & reopen Claude Desktop to load."}),V()):R({type:"error",text:l.error||"Failed to apply settings"})}catch(e){R({type:"error",text:e.message})}finally{M(!1)}},et=async()=>{I(!0),R(null);try{let e=await fetch(v,{method:"DELETE"}),t=await e.json();e.ok?(R({type:"success",text:"Settings reset successfully"}),K([]),V()):R({type:"error",text:t.error||"Failed to reset"})}catch(e){R({type:"error",text:e.message})}finally{I(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-green-500/10 text-green-600 dark:text-green-400 rounded-full",children:"Connected"}),"not_configured"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-yellow-500/10 text-yellow-600 dark:text-yellow-400 rounded-full",children:"Not configured"}),"invalid"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-red-500/10 text-red-600 dark:text-red-400 rounded-full",children:"Localhost (invalid)"}),"other"===Q&&(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-blue-500/10 text-blue-600 dark:text-blue-400 rounded-full",children:"Other"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-start gap-2 p-3 bg-blue-500/10 border border-blue-500/30 rounded-lg text-xs text-blue-700 dark:text-blue-300",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px] mt-0.5",children:"info"}),(0,l.jsxs)("span",{children:["Claude Cowork runs in a sandboxed VM and ",(0,l.jsx)("b",{children:"cannot reach localhost"}),". Use Tunnel, Tailscale, or VPS public URL."]})]}),S&&(0,l.jsxs)("div",{className:"flex items-center gap-2 text-text-muted",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin",children:"progress_activity"}),(0,l.jsx)("span",{children:"Checking Claude Cowork..."})]}),!S&&j&&!j.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500",children:"warning"}),(0,l.jsxs)("div",{className:"flex-1",children:[(0,l.jsx)("p",{className:"font-medium text-yellow-600 dark:text-yellow-400",children:"Claude Desktop (Cowork mode) not detected"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Open Claude Desktop → Help → Troubleshooting → Enable Developer mode → Configure third-party inference, then return here."})]})]}),(0,l.jsx)("div",{className:"pl-9",children:(0,l.jsxs)(r.$n,{variant:"secondary",size:"sm",onClick:()=>H(!0),className:"!bg-yellow-500/20 !border-yellow-500/40 !text-yellow-700 dark:!text-yellow-300 hover:!bg-yellow-500/30",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:"content_copy"}),"Manual Config"]})})]}),!S&&j?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[j?.cowork?.baseUrl&&(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("span",{className:"min-w-0 truncate rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:j.cowork.baseUrl})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Endpoint Mode"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("select",{value:q,onChange:e=>{var t;let s;return W(t=e.target.value),s=Y.find(e=>e.value===t),void(s?.url?G(k(s.url)):G(""))},className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:Y.map(e=>(0,l.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:C(J),onChange:e=>G(k(e.target.value)),placeholder:"https://your-host.com/v1",className:"w-full min-w-0 px-2 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),o.length>0||T?(0,l.jsxs)("select",{value:T,onChange:e=>$(e.target.value),className:"w-full min-w-0 px-2 py-2 bg-surface rounded text-xs border border-border focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5",children:[X&&(0,l.jsx)("option",{value:T,children:T}),o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))]}):(0,l.jsx)("span",{className:"min-w-0 rounded bg-surface/40 px-2 py-2 text-xs text-text-muted sm:py-1.5",children:m?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[8rem_auto_1fr] sm:items-start sm:gap-2",children:[(0,l.jsx)("span",{className:"w-32 shrink-0 text-sm font-semibold text-text-main text-right pt-1",children:"Models"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px] mt-1.5",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"flex-1 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"flex flex-wrap gap-1.5 min-h-[28px] px-2 py-1.5 bg-surface rounded border border-border",children:0===U.length?(0,l.jsx)("span",{className:"text-xs text-text-muted",children:"No models selected"}):U.map(e=>(0,l.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs bg-black/5 dark:bg-white/5 text-text-muted border border-transparent hover:border-border",children:[e,(0,l.jsx)("button",{onClick:()=>K(t=>t.filter(t=>t!==e)),className:"ml-0.5 hover:text-red-500",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:"close"})})]},e))}),(0,l.jsx)("button",{onClick:()=>z(!0),disabled:!c,className:`self-start px-2 py-1 rounded border text-xs transition-colors ${c?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Add Model"})]})]})]}),P&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===P.type?"bg-green-500/10 text-green-600":"bg-red-500/10 text-red-600"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"success"===P.type?"check_circle":"error"}),(0,l.jsx)("span",{children:P.text})]}),(0,l.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:ee,disabled:0===U.length,loading:E,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"save"}),"Apply"]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:et,disabled:!j.has9Router,loading:O,className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"restore"}),"Reset"]}),(0,l.jsxs)(r.$n,{variant:"ghost",size:"sm",onClick:()=>H(!0),className:"w-full sm:w-auto",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mr-1",children:"content_copy"}),"Manual Config"]})]})]})]}),(0,l.jsx)(r.rq,{isOpen:L,onClose:()=>z(!1),onSelect:e=>{U.includes(e.value)||K([...U,e.value]),z(!1)},selectedModel:null,activeProviders:d,modelAliases:D,title:"Add Model for Claude Cowork"}),(0,l.jsx)(r.uR,{isOpen:B,onClose:()=>H(!1),title:"Claude Cowork - Manual Configuration",configs:(y=T&&T.trim()?T:m?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b=U.length>0?U:["provider/model-id"],[{filename:"~/Library/Application Support/Claude-3p/configLibrary/<appliedId>.json",content:JSON.stringify({inferenceProvider:"gateway",inferenceGatewayBaseUrl:C(J)||"https://your-public-host/v1",inferenceGatewayApiKey:y,inferenceModels:b.map(e=>({name:e}))},null,2)}])})]})}let S="http://localhost:20128";function A({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,m]=(0,a.useState)(!1),[x,u]=(0,a.useState)(""),[p,h]=(0,a.useState)(()=>e?.[0]?.key||""),[g,f]=(0,a.useState)(null),[y,b]=(0,a.useState)(null),[j,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(S),[k,C]=(0,a.useState)(null),_=i?.isWin===!0,E=_||i?.hasCachedPassword||i?.needsSudoPassword===!1,M=i?.isAdmin!==!1;!M&&(_||i?.hasCachedPassword||i?.needsSudoPassword);let O=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/cli-tools/antigravity-mitm");if(e.ok){let t=await e.json();n(t),t.mitmRouterBaseUrl&&w(t.mitmRouterBaseUrl),s?.(t)}}catch{n({running:!1,certExists:!1,dnsStatus:{}})}},[s]);(0,a.useEffect)(()=>{queueMicrotask(()=>{O()})},[O]);let I=e=>{N(null),i&&(E?P(e,""):(f(e),m(!0),b(null)))},P=async(s,l,a=!1)=>{d(!0),N(null);try{let r;if("trust-cert"===s)r=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"trust-cert",sudoPassword:l})});else if("start"===s){let s=p?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");r=await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:v.trim()||S,forceKillPort443:a})})}else r=await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});if(!r.ok){let e=await r.json().catch(()=>({}));if("PORT_443_BUSY"===e.code&&e.portOwner){m(!1),C({owner:e.portOwner,password:l});return}N(e.error||`Failed to ${s} MITM server`);return}m(!1),u(""),C(null),await O()}catch(e){N(e.message||"Network error")}finally{d(!1),f(null)}},R=()=>{x.trim()?P(g,x):b("Sudo password is required")},T=i?.running;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Zp,{padding:"sm",className:"border-primary/20 bg-primary/5",children:(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,l.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"security"}),(0,l.jsx)("span",{className:"font-semibold text-sm text-text-main",children:"MITM Server"}),T?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Running"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Stopped"})]}),(0,l.jsx)("div",{className:"flex flex-wrap items-center gap-1 text-xs text-text-muted","data-i18n-skip":"true",children:[{label:"Cert",ok:i?.certExists},{label:"Trusted",ok:i?.certTrusted},{label:"Server",ok:T}].map(({label:e,ok:t})=>(0,l.jsxs)("span",{className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded ${t?"text-green-600":"text-text-muted"}`,children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[12px]",children:t?"check_circle":"cancel"}),e]},e))})]}),(0,l.jsxs)("div",{className:"px-2 py-2 rounded-lg bg-surface/50 border border-border/50 flex flex-col gap-2",children:[(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"Purpose:"})," Use Antigravity IDE & GitHub Copilot → with ANY provider/model from 9Router"]}),(0,l.jsxs)("p",{className:"text-[11px] text-text-muted leading-relaxed",children:[(0,l.jsx)("span",{className:"font-medium text-text-main",children:"How it works:"})," Antigravity/Copilot IDE request → DNS redirect to localhost:443 → MITM proxy intercepts → 9Router → response to Antigravity/Copilot"]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:v,onChange:e=>w(e.target.value),placeholder:S,disabled:T,className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50 disabled:opacity-50"})]}),!T&&(0,l.jsxs)("div",{className:"grid gap-1 sm:grid-cols-[8rem_auto_1fr] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right sm:text-sm",children:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",list:"mitm-api-keys",value:p,onChange:e=>h(e.target.value),placeholder:t?"Enter or pick API key":"sk_9router (default)",className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded border border-border text-xs text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50"}),e?.length>0&&(0,l.jsx)("datalist",{id:"mitm-api-keys",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.name||e.key},e.id))})]})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>I("trust-cert"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-medium text-yellow-600 transition-colors hover:bg-yellow-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),T?(0,l.jsxs)("button",{onClick:()=>I("stop"),disabled:o,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>I("start"),disabled:o||!i||_&&!M,title:_&&!M?"Administrator required":void 0,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),T&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),j&&(0,l.jsxs)("div",{className:"flex items-start gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 dark:text-red-400 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px] mt-0.5 shrink-0",children:"error"}),(0,l.jsx)("span",{children:j})]}),_&&!M&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600 border border-red-500/20",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"shield_lock"}),(0,l.jsx)("span",{children:"Administrator required — restart 9Router as Administrator to use MITM"})]})]})}),c&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required for SSL certificate and server startup"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:x,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||R()}}),y&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:y})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{m(!1),u(""),b(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:R,loading:o,children:"Confirm"})]})]})}),k&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-md flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Port 443 Already In Use"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsxs)("div",{className:"flex flex-col gap-1 text-xs text-text-muted",children:[(0,l.jsx)("p",{children:"Port 443 đang bị process kh\xe1c chiếm:"}),(0,l.jsxs)("p",{className:"font-mono text-text-main","data-i18n-skip":"true",children:[k.owner.name," (PID ",k.owner.pid,")"]}),(0,l.jsx)("p",{children:"Kill process n\xe0y để chạy MITM Server?"})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{C(null),d(!1)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:()=>{P("start",k?.password||"",!0)},loading:o,children:"Kill & Start"})]})]})})]})}var E=s(45727);function M({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,needsSudoPassword:c,isWin:m,apiKeys:x,activeProviders:u,hasActiveProviders:p,modelAliases:h={},cloudEnabled:g,onDnsChange:f}){let[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(""),[_,S]=(0,a.useState)(null),[A,O]=(0,a.useState)(null),[I,P]=(0,a.useState)({}),[R,T]=(0,a.useState)(!1),[$,U]=(0,a.useState)(null),K=E.TOOL_HOSTS[e.id]??[],L=m||d||!1===c;(0,a.useEffect)(()=>{t&&z()},[t]);let z=async()=>{try{let t=await fetch(`/api/cli-tools/antigravity-mitm/alias?tool=${e.id}`);if(t.ok){let e=await t.json();Object.keys(e.aliases||{}).length>0&&P(e.aliases)}}catch{}},D=(0,a.useCallback)(async t=>{try{await fetch("/api/cli-tools/antigravity-mitm/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,mappings:t})})}catch{}},[e.id]),F=(e,t)=>{P(s=>({...s,[e]:t}))},B=()=>{if(!n)return;let e=o?"disable":"enable";L?H(e,""):(S(e),w(!0),O(null))},H=async(t,s)=>{b(!0),N(null);try{let l=await fetch("/api/cli-tools/antigravity-mitm",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({tool:e.id,action:t,sudoPassword:s})}),a=await l.json();if(!l.ok)throw Error(a.error||"Failed to toggle DNS");"enable"===t&&N(`Restart ${e.name} to apply changes`),w(!1),C(""),f?.(a)}catch{}finally{b(!1),S(null)}},q=()=>{k.trim()?H(_,k):O("Sudo password is required")};return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-start justify-between gap-3 hover:cursor-pointer sm:items-center",onClick:s,children:[(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),n?o?(0,l.jsx)(r.Ex,{variant:"success",size:"sm",children:"Active"}):(0,l.jsx)(r.Ex,{variant:"warning",size:"sm",children:"DNS off"}):(0,l.jsx)(r.Ex,{variant:"default",size:"sm",children:"Server off"})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted sm:truncate",children:["Intercept ",e.name," requests via MITM proxy"]})]})]}),(0,l.jsx)("span",{className:`material-symbols-outlined text-text-muted text-[20px] transition-transform ${t?"rotate-180":""}`,children:"expand_more"})]}),t&&(0,l.jsxs)("div",{className:"mt-4 pt-4 border-t border-border flex flex-col gap-4",children:[K.length>0&&(0,l.jsxs)("div",{className:"mt-2 rounded-md border border-border bg-surface/50 px-2 py-1.5",children:[(0,l.jsx)("p",{className:"text-[10px] font-medium tracking-wide text-text-main/80 mb-1",children:"Edit hosts file manually to add the following entries:"}),(0,l.jsx)("ul",{className:"list-none space-y-0.5 font-mono text-[10px] text-text-muted break-all",children:K.map(e=>(0,l.jsxs)("li",{children:["127.0.0.1 ",e]},e))})]}),(0,l.jsxs)("div",{className:"flex flex-col gap-0.5 text-[11px] text-text-muted px-1",children:[(0,l.jsxs)("p",{children:["Toggle DNS to redirect ",e.name," traffic through 9Router via MITM."]}),!o&&(0,l.jsx)("p",{className:"text-amber-600 text-[10px] mt-1",children:"⚠️ Enable DNS to edit model mappings"})]}),e.defaultModels?.length>0&&(0,l.jsx)("div",{className:"flex flex-col gap-2",children:e.defaultModels.map(e=>(0,l.jsxs)("div",{className:"grid grid-cols-1 gap-1.5 sm:grid-cols-[9rem_auto_1fr_auto] sm:items-center sm:gap-2",children:[(0,l.jsx)("span",{className:"text-xs font-semibold text-text-main sm:text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined hidden text-text-muted text-[14px] sm:inline",children:"arrow_forward"}),(0,l.jsxs)("div",{className:"relative w-full min-w-0",children:[(0,l.jsx)("input",{type:"text",value:I[e.alias]||"",onChange:t=>F(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void D({...I,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`w-full min-w-0 pl-2 pr-7 py-2 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 sm:py-1.5 ${!o?"opacity-50 cursor-not-allowed":""}`}),I[e.alias]&&(0,l.jsx)("button",{onClick:()=>{F(e.alias,""),D({...I,[e.alias]:""})},className:"absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-text-muted hover:text-red-500 rounded transition-colors",title:"Clear",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"close"})})]}),(0,l.jsx)("button",{onClick:()=>{U(e.alias),T(!0)},disabled:!p||!o,className:`rounded border px-2 py-2 text-xs transition-colors sm:py-1.5 ${p&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"})]},e.alias))}),e.defaultModels?.length===0&&(0,l.jsx)("p",{className:"text-xs text-text-muted px-1",children:"Model mappings will be available soon."}),(0,l.jsxs)("div",{className:"flex flex-col gap-2 sm:items-start",children:[o?(0,l.jsxs)("button",{onClick:B,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-medium text-red-500 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:B,disabled:!n||y,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-primary/30 bg-primary/10 px-4 py-2 text-xs font-medium text-primary transition-colors hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50 sm:w-auto sm:py-1.5",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),j&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs text-amber-500",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"warning"}),(0,l.jsx)("span",{children:j})]})]})]})]}),v&&(0,l.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",children:(0,l.jsxs)("div",{className:"mx-4 flex w-full max-w-sm flex-col gap-4 rounded-xl border border-border bg-surface p-5 shadow-xl sm:p-6",children:[(0,l.jsx)("h3",{className:"font-semibold text-text-main",children:"Sudo Password Required"}),(0,l.jsxs)("div",{className:"flex items-start gap-3 p-3 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-yellow-500 text-[20px]",children:"warning"}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Required to modify /etc/hosts and flush DNS cache"})]}),(0,l.jsx)(r.pd,{type:"password",placeholder:"Enter sudo password",value:k,onChange:e=>C(e.target.value),onKeyDown:e=>{"Enter"!==e.key||y||q()}}),A&&(0,l.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs bg-red-500/10 text-red-600",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"error"}),(0,l.jsx)("span",{children:A})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{w(!1),C(""),O(null)},disabled:y,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:q,loading:y,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:R,onClose:()=>T(!1),onSelect:e=>{if(!$||e.isPlaceholder)return;let t={...I,[$]:e.value};P(t),D(t)},selectedModel:$?I[$]:null,activeProviders:u,modelAliases:h,title:`Select model for ${$}`})]})}var O=s(99568),I=s.n(O);function P({tool:e}){return(0,l.jsx)(I(),{href:"/dashboard/mitm",className:"block",children:(0,l.jsx)(r.Zp,{padding:"sm",className:"overflow-hidden hover:border-primary/50 transition-colors cursor-pointer",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3",children:[(0,l.jsx)("div",{className:"size-8 flex items-center justify-center shrink-0",children:(0,l.jsx)(i.default,{src:e.image,alt:e.name,width:32,height:32,className:"size-8 object-contain rounded-lg",sizes:"32px",onError:e=>{e.target.style.display="none"}})}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),(0,l.jsx)("span",{className:"px-1.5 py-0.5 text-[10px] font-medium bg-purple-500/10 text-purple-600 dark:text-purple-400 rounded-full",children:"MITM"})]}),(0,l.jsx)("p",{className:"text-xs text-text-muted truncate",children:e.description})]})]}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[20px]",children:"chevron_right"})]})})})}},45727:e=>{e.exports={TOOL_HOSTS:{antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh"]}}},97990:(e,t,s)=>{s.d(t,{dM:()=>a,wn:()=>l});let l={antigravity:{id:"antigravity",name:"Antigravity",image:"/providers/antigravity.png",color:"#4285F4",description:"Google Antigravity IDE with MITM",configType:"mitm",mitmDomain:"daily-cloudcode-pa.googleapis.com",modelAliases:["claude-opus-4-6-thinking","claude-sonnet-4-6","gemini-3-flash","gpt-oss-120b-medium","gemini-3-pro-high","gemini-3-pro-low"],defaultModels:[{id:"gemini-3.1-pro-high",name:"Gemini 3.1 Pro High",alias:"gemini-3.1-pro-high"},{id:"gemini-3.1-pro-low",name:"Gemini 3.1 Pro Low",alias:"gemini-3.1-pro-low"},{id:"gemini-3-flash",name:"Gemini 3 Flash / Default",alias:"gemini-3-flash"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6",alias:"claude-sonnet-4-6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking",alias:"claude-opus-4-6-thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium",alias:"gpt-oss-120b-medium"}]},copilot:{id:"copilot",name:"GitHub Copilot",image:"/providers/copilot.png",color:"#1F6FEB",description:"GitHub Copilot IDE with MITM",configType:"mitm",mitmDomain:"api.individual.githubcopilot.com",modelAliases:["gpt-4o-mini","claude-haiku-4.5","gpt-4o","gpt-5-mini"],defaultModels:[{id:"gpt-4o",name:"GPT-4o",alias:"gpt-4o"},{id:"gpt-4.1",name:"GPT-4.1",alias:"gpt-4.1"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"}]},kiro:{id:"kiro",name:"Kiro",image:"/providers/kiro.png",color:"#FF6B00",description:"Kiro IDE with MITM",configType:"mitm",mitmDomain:"q.us-east-1.amazonaws.com",defaultModels:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5",alias:"claude-sonnet-4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4",alias:"claude-sonnet-4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",alias:"claude-haiku-4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2",alias:"deepseek-3.2"},{id:"minimax-m2.1",name:"MiniMax M2.1",alias:"minimax-m2.1"},{id:"simple-task",name:"Qwen3 Coder Next",alias:"simple-task"}]}},a={claude:{id:"claude",name:"Claude Code",icon:"terminal",color:"#D97757",description:"Anthropic Claude Code CLI",configType:"env",envVars:{baseUrl:"ANTHROPIC_BASE_URL",model:"ANTHROPIC_MODEL",opusModel:"ANTHROPIC_DEFAULT_OPUS_MODEL",sonnetModel:"ANTHROPIC_DEFAULT_SONNET_MODEL",haikuModel:"ANTHROPIC_DEFAULT_HAIKU_MODEL"},modelAliases:["default","sonnet","opus","haiku","opusplan"],settingsFile:"~/.claude/settings.json",defaultModels:[{id:"opus",name:"Claude Opus",alias:"opus",envKey:"ANTHROPIC_DEFAULT_OPUS_MODEL",defaultValue:"cc/claude-opus-4-6"},{id:"sonnet",name:"Claude Sonnet",alias:"sonnet",envKey:"ANTHROPIC_DEFAULT_SONNET_MODEL",defaultValue:"cc/claude-sonnet-4-6"},{id:"haiku",name:"Claude Haiku",alias:"haiku",envKey:"ANTHROPIC_DEFAULT_HAIKU_MODEL",defaultValue:"cc/claude-haiku-4-5-20251001"}]},openclaw:{id:"openclaw",name:"Open Claw",image:"/providers/openclaw.png",color:"#FF6B35",description:"Open Claw AI Assistant",configType:"custom"},codex:{id:"codex",name:"OpenAI Codex CLI",image:"/providers/codex.png",color:"#10A37F",description:"OpenAI Codex CLI",configType:"custom"},opencode:{id:"opencode",name:"OpenCode",image:"/providers/opencode.png",color:"#E87040",description:"OpenCode AI Terminal Assistant",configType:"custom"},cowork:{id:"cowork",name:"Claude Cowork",image:"/providers/claude.png",color:"#D97757",description:"Claude Desktop Cowork (third-party inference)",configType:"custom"},hermes:{id:"hermes",name:"Hermes Agent",image:"/providers/hermes.png",color:"#8B5CF6",description:"Nous Research self-improving AI agent",configType:"custom"},droid:{id:"droid",name:"Factory Droid",image:"/providers/droid.png",color:"#00D4FF",description:"Factory Droid AI Assistant",configType:"custom"},cursor:{id:"cursor",name:"Cursor",image:"/providers/cursor.png",color:"#000000",description:"Cursor AI Code Editor",configType:"guide",requiresExternalUrl:!0,notes:[{type:"warning",text:"Requires Cursor Pro account to use this feature."},{type:"cloudCheck",text:"Cursor routes requests through its own server, so local endpoint is not supported. Please enable Tunnel or Cloud Endpoint in Settings."}],guideSteps:[{step:1,title:"Open Settings",desc:"Go to Settings → Models"},{step:2,title:"Enable OpenAI API",desc:'Enable "OpenAI API key" option'},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Add Custom Model",desc:'Click "View All Model" → "Add Custom Model"'},{step:6,title:"Select Model",type:"modelSelector"}]},cline:{id:"cline",name:"Cline",image:"/providers/cline.png",color:"#00D1B2",description:"Cline AI Coding Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Cline Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},kilo:{id:"kilo",name:"Kilo Code",image:"/providers/kilocode.png",color:"#FF6B6B",description:"Kilo Code AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Kilo Code Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → OpenAI Compatible"},{step:3,title:"Base URL",value:"{{baseUrl}}/v1",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},roo:{id:"roo",name:"Roo",image:"/providers/roo.png",color:"#FF6B6B",description:"Roo AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Settings",desc:"Go to Roo Settings panel"},{step:2,title:"Select Provider",desc:"Choose API Provider → Ollama"},{step:3,title:"Base URL",value:"{{baseUrl}}",copyable:!0},{step:4,title:"API Key",type:"apiKeySelector"},{step:5,title:"Select Model",type:"modelSelector"}]},continue:{id:"continue",name:"Continue",image:"/providers/continue.png",color:"#7C3AED",description:"Continue AI Assistant",configType:"guide",guideSteps:[{step:1,title:"Open Config",desc:"Open Continue configuration file"},{step:2,title:"API Key",type:"apiKeySelector"},{step:3,title:"Select Model",type:"modelSelector"},{step:4,title:"Add Model Config",desc:"Add the following configuration to your models array:"}],codeBlock:{language:"json",code:`{
|
|
18
|
-
"apiBase": "{{baseUrl}}",
|
|
19
|
-
"title": "{{model}}",
|
|
20
|
-
"model": "{{model}}",
|
|
21
|
-
"provider": "openai",
|
|
22
|
-
"apiKey": "{{apiKey}}"
|
|
23
|
-
}`}}}}}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-0161829206939ffe.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7207:(e,t,s)=>{Promise.resolve().then(s.bind(s,60717))},60717:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var i=s(73365),a=s(1521),l=s(29717),r=s(99568),o=s.n(r),n=s(58872),d=s(74156),c=s(82495),p=s(69633),m=s(96459);let x=new Map;async function u(e){if(!e?.url||!e?.type)return[];let t=x.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=new URLSearchParams({url:e.url,type:e.type}),s=await fetch(`/api/providers/suggested-models?${t}`);if(!s.ok)return[];let i=(await s.json()).data??[];return x.set(e.url,{data:i,expiresAt:Date.now()+6e5}),i}catch{return[]}}var h=s(86447),f=s.n(h);function y({model:e,fullModel:t,alias:s,copied:a,onCopy:l,testStatus:r,isCustom:o,isFree:n,onDeleteAlias:d,onTest:c,isTesting:p,onDisable:m}){let x="ok"===r?"#22c55e":"error"===r?"#ef4444":void 0;return(0,i.jsx)("div",{className:`group min-w-0 max-w-full rounded-lg border px-3 py-2 ${"ok"===r?"border-green-500/40":"error"===r?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,i.jsxs)("div",{className:"flex min-w-0 items-start gap-2 sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base",style:x?{color:x}:void 0,children:"ok"===r?"check_circle":"error"===r?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,i.jsx)("code",{className:"max-w-[72vw] truncate rounded bg-sidebar px-1.5 py-0.5 font-mono text-xs text-text-muted sm:max-w-[360px]",children:t}),e.name&&(0,i.jsx)("span",{className:"truncate pl-1 text-[9px] italic text-text-muted/70",children:e.name})]}),c&&(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:c,disabled:p,className:`rounded p-0.5 text-text-muted transition-opacity hover:bg-sidebar hover:text-primary ${p?"opacity-100":"opacity-100 sm:opacity-0 sm:group-hover:opacity-100"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:p?{animation:"spin 1s linear infinite"}:void 0,children:p?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:p?"Testing...":"Test"})]}),(0,i.jsxs)("div",{className:"relative shrink-0 group/btn",children:[(0,i.jsx)("button",{onClick:()=>l(t,`model-${e.id}`),className:"rounded p-0.5 text-text-muted hover:bg-sidebar hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:a===`model-${e.id}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute mt-1 top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:a===`model-${e.id}`?"Copied!":"Copy"})]}),o?(0,i.jsx)("button",{onClick:d,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Remove custom model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):m?(0,i.jsx)("button",{onClick:m,className:"ml-auto rounded p-0.5 text-text-muted opacity-100 transition-opacity hover:bg-red-500/10 hover:text-red-500 sm:opacity-0 sm:group-hover:opacity-100",title:"Disable this model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})}):null]})})}function g({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:l,onTest:r,testStatus:o,isTesting:n}){let d="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base text-text-muted",style:d?{color:d}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:e}),(0,i.jsxs)("div",{className:"flex items-center gap-1 mt-1",children:[(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:()=>a(t,`model-${e}`),className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:s===`model-${e}`?"check":"content_copy"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:s===`model-${e}`?"Copied!":"Copy"})]}),r&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:r,disabled:n,className:"p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-colors",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",style:n?{animation:"spin 1s linear infinite"}:void 0,children:n?"progress_activity":"science"})}),(0,i.jsx)("span",{className:"pointer-events-none absolute top-5 left-1/2 -translate-x-1/2 text-[10px] text-text-muted whitespace-nowrap opacity-0 group-hover/btn:opacity-100 transition-opacity",children:n?"Testing...":"Test"})]})]})]}),(0,i.jsx)("button",{onClick:l,className:"p-1 hover:bg-red-50 rounded text-red-500",title:"Remove model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"delete"})})]})}function b({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:l,onCopy:r,onSetAlias:o,onDeleteAlias:n,connections:c,isAnthropic:p}){let[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(!1),[v,j]=(0,a.useState)(null),[N,w]=(0,a.useState)({}),k=async t=>{if(!v){j(t);try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e}/${t}`})}),i=await s.json();w(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{w(e=>({...e,[t]:"error"}))}finally{j(null)}}},C=Object.entries(s).filter(([,t])=>t.startsWith(`${e}/`)).map(([t,s])=>({modelId:s.replace(`${e}/`,""),fullModel:s,alias:t})),S=i=>{let a,l=`${e}/${i}`;if(Object.values(s).includes(l))return null;let r=(a=i.split("/"))[a.length-1];if(!s[r])return r;let o=`${t}-${r}`;return s[o]?null:o},A=async()=>{if(!m.trim()||u)return;let t=m.trim(),s=S(t);if(!s)return void alert("All suggested aliases already exist. Please choose a different model or remove conflicting aliases.");h(!0);try{await o(t,s,e),x("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},$=async()=>{if(f)return;let t=c.find(e=>!1!==e.isActive);if(t){y(!0);try{let s=await fetch(`/api/providers/${t.id}/models`),i=await s.json();if(!s.ok)return void alert(i.error||"Failed to import models");let a=i.models||[];if(0===a.length)return void alert("No models returned from /models.");let l=0;for(let t of a){let s=t.id||t.name||t.model;if(!s)continue;let i=S(s);i&&(await o(s,i,e),l+=1)}0===l&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{y(!1)}}},T=c.some(e=>!1!==e.isActive);return(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:["Add ",p?"Anthropic":"OpenAI","-compatible models manually or import them from the /models endpoint."]}),(0,i.jsxs)("div",{className:"flex items-end gap-2 flex-wrap",children:[(0,i.jsxs)("div",{className:"flex-1 min-w-[240px]",children:[(0,i.jsx)("label",{htmlFor:"new-compatible-model-input",className:"text-xs text-text-muted mb-1 block",children:"Model ID"}),(0,i.jsx)("input",{id:"new-compatible-model-input",type:"text",value:m,onChange:e=>x(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:p?"claude-3-opus-20240229":"gpt-4o",className:"w-full px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary"})]}),(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:A,disabled:!m.trim()||u,children:u?"Adding...":"Add"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!T||f,children:f?"Importing...":"Import from /models"})]}),!T&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Add a connection to enable importing models."}),C.length>0&&(0,i.jsx)("div",{className:"flex flex-col gap-3",children:C.map(({modelId:e,fullModel:s,alias:a})=>(0,i.jsx)(g,{modelId:e,fullModel:`${t}/${e}`,copied:l,onCopy:r,onDeleteAlias:()=>n(a),onTest:c.length>0?()=>k(e):void 0,testStatus:N[e],isTesting:v===e},s))})]})}function v({until:e}){let[t,s]=(0,a.useState)("");return((0,a.useEffect)(()=>{let t=()=>{let t=new Date(e).getTime()-Date.now();if(t<=0)return void s("");let i=Math.floor(t/1e3);if(i<60)s(`${i}s`);else if(i<3600)s(`${Math.floor(i/60)}m ${i%60}s`);else{let e=Math.floor(i/3600),t=Math.floor(i%3600/60);s(`${e}h ${t}m`)}};t();let i=setInterval(t,1e3);return()=>clearInterval(i)},[e]),t)?(0,i.jsxs)("span",{className:"text-xs text-orange-500 font-mono",children:["⏱ ",t]}):null}function j({connection:e,proxyPools:t,isOAuth:s,isFirst:l,isLast:r,onMoveUp:o,onMoveDown:n,onToggleActive:c,onUpdateProxy:p,onEdit:m,onDelete:x}){let[u,h]=(0,a.useState)(!1),[f,y]=(0,a.useState)(!1),g=(0,a.useRef)(null),b=new Map((t||[]).map(e=>[e.id,e])),N=e.providerSpecificData?.proxyPoolId||null,w=N?b.get(N):null,k=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!N||k,S=w?`Pool: ${w.name}`:N?`Pool: ${N} (inactive/missing)`:k?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=w?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let $=w?.noProxy||e.providerSpecificData?.connectionNoProxy||"",T="default";w?.isActive===!0?T="success":(N||k)&&(T="error"),(0,a.useEffect)(()=>{if(!u)return;let e=e=>{g.current&&!g.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[u]);let P=async e=>{y(!0);try{await p("__none__"===e?null:e)}finally{y(!1),h(!1)}},O=e=>"string"==typeof e&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e),E=s?O(e.email)?e.email:O(e.name)?e.name:e.name||e.email||e.displayName||"OAuth Account":e.name,[I,R]=(0,a.useState)(!1),_=Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>!!e).sort()[0]||null;(0,a.useEffect)(()=>{let t=()=>{R(!!Object.entries(e).filter(([e])=>e.startsWith("modelLock_")).map(([,e])=>e).filter(e=>e&&new Date(e).getTime()>Date.now()).sort()[0])};t();let s=_?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[_]);let U="unavailable"!==e.testStatus||I?e.testStatus:"active";return(0,i.jsxs)("div",{className:`group flex min-w-0 flex-col gap-3 rounded-lg p-2 transition-colors hover:bg-black/[0.02] dark:hover:bg-white/[0.02] sm:flex-row sm:items-center sm:justify-between ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-2 sm:items-center sm:gap-3",children:[(0,i.jsxs)("div",{className:"flex shrink-0 flex-col",children:[(0,i.jsx)("button",{onClick:o,disabled:l,className:`p-0.5 rounded ${l?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_up"})}),(0,i.jsx)("button",{onClick:n,disabled:r,className:`p-0.5 rounded ${r?"text-text-muted/30 cursor-not-allowed":"hover:bg-sidebar text-text-muted hover:text-primary"}`,children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"keyboard_arrow_down"})})]}),(0,i.jsx)("span",{className:"material-symbols-outlined shrink-0 text-base text-text-muted",children:s?"lock":"key"}),(0,i.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,i.jsx)("p",{className:"text-sm font-medium truncate",children:E}),(0,i.jsxs)("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-1.5 sm:gap-2",children:[(0,i.jsx)(d.Ex,{variant:!1===e.isActive?"default":"active"===U||"success"===U?"success":"error"===U||"expired"===U||"unavailable"===U?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":U||"Unknown"}),C&&(0,i.jsx)(d.Ex,{variant:T,size:"sm",children:"Proxy"}),I&&!1!==e.isActive&&(0,i.jsx)(v,{until:_}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"max-w-full truncate text-xs text-red-500 sm:max-w-[300px]",title:e.lastError,children:e.lastError}),(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["#",e.priority]}),e.globalPriority&&(0,i.jsxs)("span",{className:"text-xs text-text-muted",children:["Auto: ",e.globalPriority]})]}),C&&(0,i.jsxs)("div",{className:"mt-1 flex items-center gap-2 flex-wrap",children:[(0,i.jsx)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[420px]",title:S,children:S}),A&&(0,i.jsx)("code",{className:"max-w-full truncate rounded bg-black/5 px-1 py-0.5 font-mono text-[10px] text-text-muted dark:bg-white/5 sm:max-w-[260px]",children:A}),$&&(0,i.jsxs)("span",{className:"max-w-full truncate text-[11px] text-text-muted sm:max-w-[320px]",title:$,children:["no_proxy: ",$]})]})]})]}),(0,i.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-end",children:[(0,i.jsxs)("div",{className:"grid flex-1 grid-cols-3 gap-1 sm:flex sm:flex-none",children:[(t||[]).length>0&&(0,i.jsxs)("div",{className:"relative",ref:g,children:[(0,i.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex w-full flex-col items-center rounded px-2 py-1 transition-colors hover:bg-black/5 dark:hover:bg-white/5 ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:f,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:f?"progress_activity":"lan"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Proxy"})]}),u&&(0,i.jsxs)("div",{className:"absolute right-0 top-full z-50 mt-1 max-w-[78vw] min-w-[160px] rounded-lg border border-border bg-bg py-1 shadow-lg",children:[(0,i.jsx)("button",{onClick:()=>P("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!N?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,i.jsx)("button",{onClick:()=>P(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${N===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,i.jsxs)("button",{onClick:m,className:"flex flex-col items-center rounded px-2 py-1 text-text-muted hover:bg-black/5 hover:text-primary dark:hover:bg-white/5",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"edit"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Edit"})]}),(0,i.jsxs)("button",{onClick:x,className:"flex flex-col items-center rounded px-2 py-1 text-red-500 hover:bg-red-500/10",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"}),(0,i.jsx)("span",{className:"text-[10px] leading-tight",children:"Delete"})]})]}),(0,i.jsx)(d.lM,{size:"sm",checked:e.isActive??!0,onChange:c,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}function N({isOpen:e,provider:t,providerName:s,isCompatible:l,isAnthropic:r,authType:o,authHint:n,website:c,proxyPools:p,onSave:m,onClose:x}){let u="__none__",h="ollama-local"===t,f="cookie"===o,y=f?"Cookie Value":"API Key",g="azure"===t,b="cloudflare-ai"===t,[v,j]=(0,a.useState)({name:"",apiKey:"",priority:1,proxyPoolId:u,ollamaHostUrl:""}),[w,k]=(0,a.useState)({azureEndpoint:"",apiVersion:"2024-10-01-preview",deployment:"",organization:""}),[C,S]=(0,a.useState)({accountId:""}),[A,$]=(0,a.useState)(!1),[T,P]=(0,a.useState)(null),[O,E]=(0,a.useState)(!1),I=()=>h&&v.ollamaHostUrl.trim()?{baseUrl:v.ollamaHostUrl.trim()}:g?{azureEndpoint:w.azureEndpoint,apiVersion:w.apiVersion,deployment:w.deployment,organization:w.organization}:b?{accountId:C.accountId}:void 0,R=async()=>{$(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:v.apiKey,providerSpecificData:I()})}),s=await e.json();P(s.valid?"success":"failed")}catch{P("failed")}finally{$(!1)}},_=async()=>{if(t&&(h||v.apiKey)&&(h||v.name)){E(!0);try{let e=!1;try{$(!0),P(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:v.apiKey,providerSpecificData:I()})});e=!!(await s.json()).valid,P(e?"success":"failed")}catch{P("failed")}finally{$(!1)}await m({name:v.name||(h?"Ollama Local":""),apiKey:v.apiKey,priority:v.priority,proxyPoolId:v.proxyPoolId===u?null:v.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:I()})}finally{E(!1)}}};return t?(0,i.jsx)(d.aF,{isOpen:e,title:`Add ${s||t} ${y}`,onClose:x,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.pd,{label:"Name",value:v.name,onChange:e=>j({...v,name:e.target.value}),placeholder:h?"Ollama Local":"Production Key"}),h&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:"Ollama Host URL",value:v.ollamaHostUrl,onChange:e=>j({...v,ollamaHostUrl:e.target.value}),placeholder:"http://localhost:11434",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:R,disabled:A||O,variant:"secondary",children:A?"Checking...":"Check"})})]}),!h&&(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:y,type:f?"text":"password",value:v.apiKey,onChange:e=>j({...v,apiKey:e.target.value}),placeholder:f?"grok-web"===t?"sso=xxxxx... or just the raw value":"eyJhbGciOi...":"",className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:R,disabled:!v.apiKey||A||O,variant:"secondary",children:A?"Checking...":"Check"})})]}),f&&n&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:[n,c&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsxs)("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:["Open ",c.replace(/^https?:\/\//,"")]})]})]}),h&&(0,i.jsxs)("p",{className:"text-xs text-text-muted",children:["Leave blank to use ",(0,i.jsx)("code",{children:"http://localhost:11434"}),". For remote Ollama, enter the full host URL (e.g. ",(0,i.jsx)("code",{children:"http://192.168.1.10:11434"}),")."]}),T&&(0,i.jsx)(d.Ex,{variant:"success"===T?"success":"error",children:"success"===T?"Valid":"Invalid"}),l&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:r?`Validation checks ${s||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${s||"OpenAI Compatible"} via /models on your base URL.`}),b&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Cloudflare Workers AI"}),(0,i.jsx)(d.pd,{label:"Account ID",value:C.accountId,onChange:e=>S({...C,accountId:e.target.value}),placeholder:"abc123def456..."}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-2",children:["Find your Account ID in the right sidebar of ",(0,i.jsx)("a",{href:"https://dash.cloudflare.com",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"dash.cloudflare.com"})]})]}),g&&(0,i.jsxs)("div",{className:"bg-sidebar/50 p-4 rounded-lg border border-accent/20",children:[(0,i.jsx)("h3",{className:"font-semibold mb-3 text-sm",children:"Azure OpenAI Configuration"}),(0,i.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,i.jsx)(d.pd,{label:"Azure Endpoint",value:w.azureEndpoint,onChange:e=>k({...w,azureEndpoint:e.target.value}),placeholder:"https://your-resource.openai.azure.com"}),(0,i.jsx)(d.pd,{label:"Deployment Name",value:w.deployment,onChange:e=>k({...w,deployment:e.target.value}),placeholder:"gpt-4"}),(0,i.jsx)(d.pd,{label:"API Version",value:w.apiVersion,onChange:e=>k({...w,apiVersion:e.target.value}),placeholder:"2024-10-01-preview"}),(0,i.jsx)(d.pd,{label:"Organization",value:w.organization,onChange:e=>k({...w,organization:e.target.value}),placeholder:"Organization ID"})]})]}),(0,i.jsx)(d.pd,{label:"Priority",type:"number",value:v.priority,onChange:e=>j({...v,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(d.l6,{label:"Proxy Pool",value:v.proxyPoolId,onChange:e=>j({...v,proxyPoolId:e.target.value}),options:[{value:u,label:"None"},...(p||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(p||[]).length&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"No active proxy pools available. Create one in Proxy Pools page first."}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Legacy manual proxy fields are still accepted by API for backward compatibility."}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.$n,{onClick:_,fullWidth:!0,disabled:O||!h&&(!v.name||!v.apiKey)||g&&(!w.azureEndpoint||!w.deployment||!w.organization)||b&&!C.accountId,children:O?"Saving...":"Save"}),(0,i.jsx)(d.$n,{onClick:x,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function w({isOpen:e,node:t,onSave:s,onClose:l,isAnthropic:r}){let[o,n]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[c,p]=(0,a.useState)(!1),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[f,y]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&n({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(r?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,r]);let v=async()=>{if(o.name.trim()&&o.prefix.trim()&&o.baseUrl.trim()){p(!0);try{let e={name:o.name,prefix:o.prefix,baseUrl:o.baseUrl};r||(e.apiType=o.apiType),await s(e)}finally{p(!1)}}},j=async()=>{y(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:o.baseUrl,apiKey:m,type:r?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{y(!1)}};return t?(0,i.jsx)(d.aF,{isOpen:e,title:`Edit ${r?"Anthropic":"OpenAI"} Compatible`,onClose:l,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.pd,{label:"Name",value:o.name,onChange:e=>n({...o,name:e.target.value}),placeholder:`${r?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(d.pd,{label:"Prefix",value:o.prefix,onChange:e=>n({...o,prefix:e.target.value}),placeholder:r?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!r&&(0,i.jsx)(d.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:o.apiType,onChange:e=>n({...o,apiType:e.target.value})}),(0,i.jsx)(d.pd,{label:"Base URL",value:o.baseUrl,onChange:e=>n({...o,baseUrl:e.target.value}),placeholder:r?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${r?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.pd,{label:"API Key (for Check)",type:"password",value:m,onChange:e=>x(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(d.$n,{onClick:j,disabled:!m||f||!o.baseUrl.trim(),variant:"secondary",children:f?"Checking...":"Check"})})]}),(0,i.jsx)(d.pd,{label:"Model ID (optional)",value:u,onChange:e=>h(e.target.value),placeholder:"e.g. my-model-id",hint:"If provider lacks /models endpoint, enter a model ID to validate via chat/completions instead."}),g&&(0,i.jsx)(d.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(d.$n,{onClick:v,fullWidth:!0,disabled:!o.name.trim()||!o.prefix.trim()||!o.baseUrl.trim()||c,children:c?"Saving...":"Save"}),(0,i.jsx)(d.$n,{onClick:l,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function k({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:l,onClose:r}){let[o,n]=(0,a.useState)(""),[c,p]=(0,a.useState)(null),[m,x]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(n(""),p(null),x(""))},[e]);let f=e=>{let s=`${t}/`;return e.startsWith(s)?e.slice(s.length):e},y=async()=>{let e=f(o.trim());if(e){p("testing"),x("");try{let s=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${e}`})}),i=await s.json();p(i.ok?"ok":"error"),x(i.error||"")}catch(e){p("error"),x(e.message)}}},g=async()=>{let e=f(o.trim());if(e&&!u){h(!0);try{await l(e)}finally{h(!1)}}};return(0,i.jsx)(d.aF,{isOpen:e,onClose:r,title:"Add Custom Model",children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("label",{className:"text-sm font-medium mb-1.5 block",children:"Model ID"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)("input",{type:"text",value:o,onChange:e=>{n(e.target.value),p(null),x("")},onKeyDown:e=>{"Enter"===e.key&&y()},placeholder:"e.g. claude-opus-4-5",className:"flex-1 px-3 py-2 text-sm border border-border rounded-lg bg-background focus:outline-none focus:border-primary",autoFocus:!0}),(0,i.jsx)(d.$n,{variant:"secondary",icon:"science",loading:"testing"===c,onClick:y,disabled:!o.trim()||"testing"===c,children:"testing"===c?"Testing...":"Test"})]}),(0,i.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Sent to provider as: ",(0,i.jsx)("code",{className:"font-mono bg-sidebar px-1 rounded",children:f(o.trim())||"model-id"})]})]}),"ok"===c&&(0,i.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-600",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",children:"check_circle"}),"Model is reachable"]}),"error"===c&&(0,i.jsxs)("div",{className:"flex items-start gap-2 text-sm text-red-500",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base shrink-0",children:"cancel"}),(0,i.jsx)("span",{children:m||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(d.$n,{onClick:r,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(d.$n,{onClick:g,fullWidth:!0,size:"sm",disabled:!o.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}function C(){let e,t=(0,l.useParams)(),s=(0,l.useRouter)(),r=t.id,[x,h]=(0,a.useState)([]),[f,g]=(0,a.useState)(!0),[v,C]=(0,a.useState)(null),[S,A]=(0,a.useState)([]),[$,T]=(0,a.useState)(!1),[P,O]=(0,a.useState)(!1),[E,I]=(0,a.useState)(!1),[R,_]=(0,a.useState)(!1),[U,D]=(0,a.useState)(!1),[q,z]=(0,a.useState)(!1),[L,M]=(0,a.useState)(null),[K,F]=(0,a.useState)({}),[J,W]=(0,a.useState)(!1),[V,H]=(0,a.useState)({}),[G,B]=(0,a.useState)(""),[Q,Z]=(0,a.useState)(null),[X,Y]=(0,a.useState)(!1),[ee,et]=(0,a.useState)([]),[es,ei]=(0,a.useState)("__none__"),[ea,el]=(0,a.useState)(!1),[er,eo]=(0,a.useState)(null),[en,ed]=(0,a.useState)(""),[ec,ep]=(0,a.useState)("auto"),[em,ex]=(0,a.useState)([]),[eu,eh]=(0,a.useState)([]),[ef,ey]=(0,a.useState)([]),{copied:eg,copy:eb}=(0,m.C)(),ev=v?{id:v.id,name:v.name||("anthropic-compatible"===v.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===v.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===v.type?"AC":"OC",apiType:v.apiType,baseUrl:v.baseUrl,type:v.type}:c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r]||c.br[r],ej=!!c.zN[r]||!!c.IS[r],eN=!!c.IS[r]?.noAuth,ew=(0,p.KC)(r),ek=(0,c.wG)(r),eC=(0,c.mq)(r),eS=(0,c.gb)(r),eA=eC||eS;c.Q2[r]?.thinkingConfig||c.s9.extended;let e$=eA?r:ek,eT=eA?v?.prefix||r:ek,eP=(0,a.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(e$)}`,{cache:"no-store"}),t=await e.json();e.ok&&ey(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[e$]),eO=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:e$,ids:[e]})})).ok&&await eP()}catch(e){console.log("Error disabling model:",e)}},eE=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(e$)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eP()}catch(e){console.log("Error enabling model:",e)}},eI=async e=>{if(e.length&&confirm(`Disable all ${e.length} model(s)?`))try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:e$,ids:e})})).ok&&await eP()}catch(e){console.log("Error disabling all models:",e)}},eR=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(e$)}`,{method:"DELETE"})).ok&&await eP()}catch(e){console.log("Error enabling all models:",e)}},e_=(0,a.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&F(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,a.useEffect)(()=>{"kilocode"===r&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&eh(e.models)}).catch(()=>{})},[r]);let eU=(0,a.useCallback)(async()=>{try{let[e,t,s,i]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),a=await e.json(),l=await t.json(),o=await s.json(),n=i.ok?await i.json():{};if(e.ok){let e=(a.connections||[]).filter(e=>e.provider===r);h(e)}s.ok&&A(o.proxyPools||[]);let d=(n.providerStrategies||{})[r]||{};eo(d.fallbackStrategy||null),ed(null!=d.stickyRoundRobinLimit?String(d.stickyRoundRobinLimit):"1");let c=(n.providerThinking||{})[r]||{};if(ep(c.mode||"auto"),t.ok){let e=(l.nodes||[]).find(e=>e.id===r)||null;if(!e&&eA)for(let t=0;t<3;t+=1){await new Promise(e=>setTimeout(e,150));let t=await fetch("/api/provider-nodes",{cache:"no-store"});if(t.ok&&(e=((await t.json()).nodes||[]).find(e=>e.id===r)||null))break}C(e)}}catch(e){console.log("Error fetching connections:",e)}finally{g(!1)}},[r,eA]),eD=async e=>{try{let t=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(C(s.node),await eU(),D(!1))}catch(e){console.log("Error updating provider node:",e)}},eq=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),i=(s.ok?await s.json():{}).providerStrategies||{},a={};e&&(a.fallbackStrategy=e),"round-robin"===e&&""!==t&&(a.stickyRoundRobinLimit=Number(t)||3);let l={...i};0===Object.keys(a).length?delete l[r]:l[r]=a,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:l})})}catch(e){console.log("Error saving provider strategy:",e)}};(0,a.useEffect)(()=>{eU(),e_(),eP()},[eU,e_,eP]),(0,a.useEffect)(()=>{let e=(c.zN[r]||c.fg[r]||c.IS[r]||c.nJ[r])?.modelsFetcher;e&&u(e).then(ex)},[r]);let ez=async(e,t,s=ek)=>{let i=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:i,alias:t})});if(e.ok)await e_();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eL=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await e_()}catch(e){console.log("Error deleting alias:",e)}},eM=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&h(x.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},eK=()=>{eU(),T(!1)},eF=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...e})})).ok&&(await eU(),I(!1))}catch(e){console.log("Error saving connection:",e)}},eJ=async e=>{try{(await fetch(`/api/providers/${L.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eU(),_(!1))}catch(e){console.log("Error updating connection:",e)}},eW=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&h(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},eV=async(e,t)=>{let s=[...x];[s[e],s[t]]=[s[t],s[e]],h(s);try{await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t})})])}catch(e){console.log("Error swapping priority:",e),await eU()}},eH=x.filter(e=>ee.includes(e.id));x.length>0&&(ee.length,x.length),(0,a.useEffect)(()=>{et(e=>e.filter(e=>x.some(t=>t.id===e)))},[x]);let eG=(()=>{if(0===eH.length)return"";let e=new Set(eH.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=S.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),eB=()=>{ea||z(!1)},eQ=async()=>{if(0===ee.length)return;let e="__none__"===es?null:es;el(!0);try{let t=[];for(let s of ee)try{let i=await fetch(`/api/providers/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:e})});t.push(i.ok)}catch(e){console.log("Error applying bulk proxy pool for",s,e),t.push(!1)}let s=t.filter(e=>!e).length;s>0&&alert(`Updated with ${s} failed request(s).`),await eU(),et([]),ei("__none__"),z(!1)}catch(e){console.log("Error applying bulk proxy pool:",e)}finally{el(!1)}},eZ=(0,i.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:x.map((e,t)=>(0,i.jsx)("div",{className:"flex min-w-0 items-stretch",children:(0,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(j,{connection:e,proxyPools:S,isOAuth:ej,isFirst:0===t,isLast:t===x.length-1,onMoveUp:()=>eV(t,t-1),onMoveDown:()=>eV(t,t+1),onToggleActive:t=>eW(e.id,t),onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&h(s=>s.map(s=>s.id===e.id?{...s,providerSpecificData:{...s.providerSpecificData,proxyPoolId:t||null}}:s))}catch(e){console.log("Error updating proxy:",e)}},onEdit:()=>{M(e),_(!0)},onDelete:()=>eM(e.id)})})},e.id))}),eX=[{value:"__none__",label:"None"},...S.map(e=>({value:e.id,label:e.name}))],eY=0===ee.length?"Select one or more connections, then click Proxy Action.":eG,e0=ee.length>0&&!ea,e1=(0,i.jsx)(d.aF,{isOpen:q,onClose:eB,title:`Proxy Action (${ee.length} selected)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(d.l6,{label:"Proxy Pool",value:es,onChange:e=>ei(e.target.value),options:eX,placeholder:"None"}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:eY}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"Selecting None will unbind selected connections from proxy pool."}),(0,i.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,i.jsx)(d.$n,{onClick:eQ,fullWidth:!0,disabled:!e0,children:ea?"Applying...":"Apply"}),(0,i.jsx)(d.$n,{onClick:eB,variant:"ghost",fullWidth:!0,disabled:ea,children:"Cancel"})]})]})}),e2=async e=>{if(!Q){Z(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${e$}/${e}`})}),s=await t.json();H(t=>({...t,[e]:s.ok?"ok":"error"})),B(s.ok?"":s.error||"Model not reachable")}catch{H(t=>({...t,[e]:"error"})),B("Network error")}finally{Z(null)}}};return f?(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(d.Qv,{}),(0,i.jsx)(d.Qv,{})]}):ev?(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)(o(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,i.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${ev.color}15`},children:J?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:ev.color},children:ev.textIcon||ev.id.slice(0,2).toUpperCase()}):(0,i.jsx)(n.default,{src:eC&&ev.apiType?"responses"===ev.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":eS?"/providers/anthropic-m.png":`/providers/${ev.id}.png`,alt:ev.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>W(!0)})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,i.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:ev.name}),(ev.notice?.apiKeyUrl||ev.notice?.signupUrl||ev.website)&&(0,i.jsxs)("a",{href:ev.notice?.apiKeyUrl||ev.notice?.signupUrl||ev.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),ev.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,i.jsxs)("p",{className:"text-text-muted",children:[x.length," connection",1===x.length?"":"s"]})]})]})]}),ev.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,i.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:ev.deprecationNotice})]}),ev.notice?.text&&!ev.deprecated&&(0,i.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:ev.notice.text}),ev.notice.apiKeyUrl&&(0,i.jsx)("a",{href:ev.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),eA&&v&&(0,i.jsxs)(d.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:eS?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[eS?"Messages API":"responses"===v.apiType?"Responses API":"Chat Completions"," \xb7 ",(v.baseUrl||"").replace(/\/$/,""),"/",eS?"messages":"responses"===v.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>I(!0),disabled:x.length>0,className:"w-full sm:w-auto",children:"Add"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>D(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${eS?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},className:"w-full sm:w-auto",children:"Delete"})]})]}),x.length>0&&(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"Only one connection is allowed per compatible node. Add another node if you need more connections."})]}),eN?(0,i.jsx)(d.gw,{providerId:r}):(0,i.jsxs)(d.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,i.jsx)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(d.lM,{checked:"round-robin"===er,onChange:e=>{let t=e?"round-robin":null,s=e?en||"1":en;e&&!en&&ed("1"),eo(t),eq(t,s)}}),"round-robin"===er&&(0,i.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,i.jsx)("input",{type:"number",min:1,value:en,onChange:e=>{var t;ed(t=e.target.value),eq("round-robin",t)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})})]}),0===x.length?(0,i.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:ej?"lock":"key"})}),(0,i.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"})]}),!eA&&(0,i.jsxs)("div",{className:"flex gap-2",children:["iflow"===r&&(0,i.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>O(!0),children:"Cookie"}),(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>ej?T(!0):I(!0),children:"iflow"===r?"OAuth":"Add Connection"})]})]}):(0,i.jsxs)(i.Fragment,{children:[eZ,!eA&&(0,i.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:["iflow"===r&&(0,i.jsx)(d.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>O(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),(0,i.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>ej?T(!0):I(!0),className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,i.jsxs)(d.Zp,{children:[(0,i.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),!eA&&(e=[...ew,...eu.filter(e=>!ew.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!ef.includes(e)),(0,i.jsxs)("div",{className:"flex gap-2",children:[ef.length>0&&(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:eR,children:"Active All"}),e.length>0&&(0,i.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>eI(e),children:"Disable All"})]}))]}),!!G&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:G}),(()=>{let e,t,s;if(eA)return(0,i.jsx)(b,{providerStorageAlias:e$,providerDisplayAlias:eT,modelAliases:K,copied:eg,onCopy:eb,onSetAlias:ez,onDeleteAlias:eL,connections:x,isAnthropic:eS});let a=[...ew,...eu.filter(e=>!ew.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),l=new Set(ef),o=a.filter(e=>!l.has(e.id)),n=a.filter(e=>l.has(e.id)),d=Object.entries(K).filter(([e,t])=>{let s=`${e$}/`;if(!t.startsWith(s))return!1;let i=t.slice(s.length);return ev.passthroughModels?!ew.some(e=>e.id===i):!ew.some(e=>e.id===i)&&e===i}).map(([e,t])=>({id:t.slice(`${e$}/`.length),alias:e,fullModel:t}));return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[d.map(e=>(0,i.jsx)(y,{model:{id:e.id},fullModel:`${eT}/${e.id}`,alias:e.alias,copied:eg,onCopy:eb,onSetAlias:()=>{},onDeleteAlias:()=>eL(e.alias),testStatus:V[e.id],onTest:x.length>0||eN?()=>e2(e.id):void 0,isTesting:Q===e.id,isCustom:!0,isFree:!1},e.id)),o.map(e=>{let t=`${e$}/${e.id}`,s=`${r}/${e.id}`,a=Object.entries(K).find(([,e])=>e===t||e===s)?.[0];return(0,i.jsx)(y,{model:e,fullModel:`${eT}/${e.id}`,alias:a,copied:eg,onCopy:eb,onSetAlias:t=>ez(e.id,t,e$),onDeleteAlias:()=>eL(a),testStatus:V[e.id],onTest:x.length>0||eN?()=>e2(e.id):void 0,isTesting:Q===e.id,isFree:e.isFree,onDisable:()=>eO(e.id)},e.id)}),(0,i.jsxs)("button",{onClick:()=>Y(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),em.length>0&&(e=new Set(Object.values(K)),t=new Set(ew.map(e=>e.id)),0===(s=em.filter(s=>!e.has(`${e$}/${s.id}`)&&!t.has(s.id))).length?null:(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,i.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await ez(e.id,t,e$)},className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:`${e.name} \xb7 ${(e.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),n.length>0&&(0,i.jsxs)("div",{className:"w-full mt-2",children:[(0,i.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",n.length,"):"]}),(0,i.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,i.jsxs)("button",{onClick:()=>eE(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),e1,"kiro"===r?(0,i.jsx)(d.Mh,{isOpen:$,providerInfo:ev,onSuccess:eK,onClose:()=>T(!1)}):"cursor"===r?(0,i.jsx)(d.G9,{isOpen:$,onSuccess:eK,onClose:()=>T(!1)}):"gitlab"===r?(0,i.jsx)(d.vj,{isOpen:$,providerInfo:ev,onSuccess:eK,onClose:()=>T(!1)}):(0,i.jsx)(d.LF,{isOpen:$,provider:r,providerInfo:ev,onSuccess:eK,onClose:()=>T(!1)}),"iflow"===r&&(0,i.jsx)(d.vE,{isOpen:P,onSuccess:()=>{eU(),O(!1)},onClose:()=>O(!1)}),(0,i.jsx)(N,{isOpen:E,provider:r,providerName:ev.name,isCompatible:eA,isAnthropic:eS,authType:ev?.authType,authHint:ev?.authHint,website:ev?.website,proxyPools:S,onSave:eF,onClose:()=>I(!1)}),(0,i.jsx)(d.wI,{isOpen:R,connection:L,proxyPools:S,onSave:eJ,onClose:()=>_(!1)}),eA&&(0,i.jsx)(w,{isOpen:U,node:v,onSave:eD,onClose:()=>D(!1),isAnthropic:eS}),!eA&&(0,i.jsx)(k,{isOpen:X,providerAlias:e$,providerDisplayAlias:eT,onSave:async e=>{let t=ev?.passthroughModels?e.split("/").pop():e;await ez(e,t,e$),Y(!1)},onClose:()=>Y(!1)})]}):(0,i.jsxs)("div",{className:"text-center py-20",children:[(0,i.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,i.jsx)(o(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}y.propTypes={model:f().shape({id:f().string.isRequired}).isRequired,fullModel:f().string.isRequired,alias:f().string,copied:f().string,onCopy:f().func.isRequired,testStatus:f().oneOf(["ok","error"]),isCustom:f().bool,isFree:f().bool,onDeleteAlias:f().func,onTest:f().func,isTesting:f().bool,onDisable:f().func},f().string.isRequired,f().string.isRequired,f().string,f().func.isRequired,f().func.isRequired,f().func,f().oneOf(["ok","error"]),f().bool,f().string.isRequired,f().object.isRequired,f().string,f().func.isRequired,f().func.isRequired,f().func.isRequired,b.propTypes={providerStorageAlias:f().string.isRequired,providerDisplayAlias:f().string.isRequired,modelAliases:f().object.isRequired,copied:f().string,onCopy:f().func.isRequired,onSetAlias:f().func.isRequired,onDeleteAlias:f().func.isRequired,connections:f().arrayOf(f().shape({id:f().string,isActive:f().bool})).isRequired,isAnthropic:f().bool},v.propTypes={until:f().string.isRequired},j.propTypes={connection:f().shape({id:f().string,name:f().string,email:f().string,displayName:f().string,modelLockUntil:f().string,testStatus:f().string,isActive:f().bool,lastError:f().string,priority:f().number,globalPriority:f().number}).isRequired,proxyPools:f().arrayOf(f().shape({id:f().string,name:f().string,proxyUrl:f().string,noProxy:f().string,isActive:f().bool})),isOAuth:f().bool.isRequired,isFirst:f().bool.isRequired,isLast:f().bool.isRequired,onMoveUp:f().func.isRequired,onMoveDown:f().func.isRequired,onToggleActive:f().func.isRequired,onUpdateProxy:f().func,onEdit:f().func.isRequired,onDelete:f().func.isRequired},N.propTypes={isOpen:f().bool.isRequired,provider:f().string,providerName:f().string,isCompatible:f().bool,isAnthropic:f().bool,authType:f().string,authHint:f().string,website:f().string,proxyPools:f().arrayOf(f().shape({id:f().string,name:f().string})),onSave:f().func.isRequired,onClose:f().func.isRequired},w.propTypes={isOpen:f().bool.isRequired,node:f().shape({id:f().string,name:f().string,prefix:f().string,apiType:f().string,baseUrl:f().string}),onSave:f().func.isRequired,onClose:f().func.isRequired,isAnthropic:f().bool},k.propTypes={isOpen:f().bool.isRequired,providerAlias:f().string.isRequired,providerDisplayAlias:f().string.isRequired,onSave:f().func.isRequired,onClose:f().func.isRequired}}},e=>{e.O(0,[7848,4335,6795,8872,505,4156,2347,5158,7358],()=>e(e.s=7207)),_N_E=e.O()}]);
|