9router 0.3.76 → 0.3.79
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 +3 -3
- package/app/.next/build-manifest.json +2 -2
- package/app/.next/prerender-manifest.json +3 -3
- 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_client-reference-manifest.js +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_client-reference-manifest.js +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_client-reference-manifest.js +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/mitm/page_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/[id]/page.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/providers/page.js +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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +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_client-reference-manifest.js +1 -1
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/_not-found.html +1 -1
- package/app/.next/server/app/_not-found.rsc +3 -3
- package/app/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/_not-found.segments/_index.segment.rsc +3 -3
- 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 +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 +3 -3
- package/app/.next/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next/server/app/api/cli-tools/droid-settings/route.js +2 -2
- 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/provider-nodes/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]/test-models/route.js +1 -1
- package/app/.next/server/app/api/providers/validate/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/usage/providers/route.js +1 -1
- package/app/.next/server/app/api/v1/models/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/callback/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app/callback.html +1 -1
- package/app/.next/server/app/callback.rsc +3 -3
- package/app/.next/server/app/callback.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/callback.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/callback.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/callback.segments/_tree.segment.rsc +1 -1
- 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 +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next/server/app/dashboard/cli-tools.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.html +1 -1
- package/app/.next/server/app/dashboard/combos.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/combos.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/combos.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.html +1 -1
- package/app/.next/server/app/dashboard/endpoint.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/endpoint.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/endpoint.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.html +1 -1
- package/app/.next/server/app/dashboard/mitm.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/mitm.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/mitm.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.html +1 -1
- package/app/.next/server/app/dashboard/profile.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/profile.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/profile.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers/new.html +1 -1
- package/app/.next/server/app/dashboard/providers/new.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.html +1 -1
- package/app/.next/server/app/dashboard/providers.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/providers.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/providers.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next/server/app/dashboard/proxy-pools.rsc +5 -5
- 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 +5 -5
- 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 +3 -3
- package/app/.next/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.html +2 -2
- package/app/.next/server/app/dashboard/quota.rsc +6 -6
- 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 +6 -6
- package/app/.next/server/app/dashboard/quota.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/quota.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- 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 +3 -3
- package/app/.next/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- package/app/.next/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- 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/translator.html +1 -1
- package/app/.next/server/app/dashboard/translator.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/translator.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/translator.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.html +1 -1
- package/app/.next/server/app/dashboard/usage.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard/usage.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard/usage.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.html +1 -1
- package/app/.next/server/app/dashboard.rsc +5 -5
- 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 +5 -5
- package/app/.next/server/app/dashboard.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/dashboard.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/app/.next/server/app/index.html +1 -1
- package/app/.next/server/app/index.rsc +3 -3
- package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/index.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- 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 +3 -3
- package/app/.next/server/app/landing.segments/_full.segment.rsc +3 -3
- package/app/.next/server/app/landing.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/landing.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/landing.segments/_tree.segment.rsc +1 -1
- 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_client-reference-manifest.js +1 -1
- package/app/.next/server/app/login.html +1 -1
- package/app/.next/server/app/login.rsc +4 -4
- package/app/.next/server/app/login.segments/_full.segment.rsc +4 -4
- package/app/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/app/.next/server/app/login.segments/_index.segment.rsc +3 -3
- package/app/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- 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/page_client-reference-manifest.js +1 -1
- package/app/.next/server/app-paths-manifest.json +3 -3
- package/app/.next/server/chunks/1021.js +1 -1
- package/app/.next/server/chunks/1574.js +1 -1
- package/app/.next/server/chunks/2049.js +1 -1
- package/app/.next/server/chunks/242.js +1 -1
- package/app/.next/server/chunks/3159.js +1 -1
- package/app/.next/server/chunks/3437.js +1 -1
- package/app/.next/server/chunks/450.js +3 -3
- package/app/.next/server/chunks/4891.js +1 -1
- package/app/.next/server/chunks/6502.js +1 -1
- package/app/.next/server/chunks/8202.js +3 -3
- package/app/.next/server/chunks/9489.js +1 -1
- 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/chunks/{4156-3f71ff6f6ba6ba05.js → 4156-95873d034d9be208.js} +3 -3
- package/app/.next/static/chunks/505-5dea9cf33d2883b7.js +1 -0
- package/app/.next/static/chunks/7400-944f5945f4b469ce.js +15 -0
- package/app/.next/static/chunks/{8035-20ab85a50b665aaf.js → 8035-d85b135ff3c41e36.js} +1 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-d099eadbb0522614.js +1 -0
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-09e7d6bd4d08202c.js +1 -0
- package/app/package.json +1 -1
- package/app/src/mitm/server.js +1 -1
- package/package.json +1 -1
- package/app/.next/static/chunks/505-a36fddd76f7e8527.js +0 -1
- package/app/.next/static/chunks/7400-a5c928f6fdd4565c.js +0 -15
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-48b389fbdc1f0080.js +0 -1
- package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/page-9d13181d51f5e656.js +0 -1
- /package/app/.next/static/{U9bncx-XOFYaNG7IeViVS → _1cT7G6qqsI_sqV4bRUa6}/_buildManifest.js +0 -0
- /package/app/.next/static/{U9bncx-XOFYaNG7IeViVS → _1cT7G6qqsI_sqV4bRUa6}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[505],{43202:(e,i,a)=>{a.d(i,{Q2:()=>n.Q2,fg:()=>n.fg,vQ:()=>t,MA:()=>n.MA,UY:()=>r,zN:()=>n.zN,B2:()=>o});var n=a(82495);a(69633);let t={name:"Endpoint Proxy",description:"AI Infrastructure Management",version:"0.3.79"},o={storageKey:"theme",defaultTheme:"system"},r={maxLines:200,pollIntervalMs:1e3}},55348:(e,i,a)=>{a.d(i,{CL:()=>o,QC:()=>r,Xn:()=>t,YZ:()=>n});let n=["en","vi","zh-CN","zh-TW","ja","pt-BR","pt-PT","ko","es","de","fr","he","ar","ru","pl","cs","nl","tr","uk","tl","id","th","hi","bn","ur","ro","sv","it","el","hu","fi","da","no"],t="en",o="locale";function r(e){return"zh"===e||"zh-CN"===e?"zh-CN":"en"===e?"en":"vi"===e?"vi":"zh-TW"===e?"zh-TW":"ja"===e?"ja":"pt-BR"===e?"pt-BR":"pt-PT"===e?"pt-PT":"ko"===e?"ko":"es"===e?"es":"de"===e?"de":"fr"===e?"fr":"he"===e?"he":"ar"===e?"ar":"ru"===e?"ru":"pl"===e?"pl":"cs"===e?"cs":"nl"===e?"nl":"tr"===e?"tr":"uk"===e?"uk":"tl"===e?"tl":"id"===e?"id":"th"===e?"th":"hi"===e?"hi":"bn"===e?"bn":"ur"===e?"ur":"ro"===e?"ro":"sv"===e?"sv":"it"===e?"it":"el"===e?"el":"hu"===e?"hu":"fi"===e?"fi":"da"===e?"da":"no"===e?"no":t}},69633:(e,i,a)=>{a.d(i,{KC:()=>n.KC,Xg:()=>n.Xg});var n=a(94718);Object.entries(a(82495).Q2).filter(([,e])=>e.passthroughModels).map(([e])=>e),Object.entries(n.vq).flatMap(([e,i])=>i.map(i=>({provider:e,model:i.id,name:i.name})))},82495:(e,i,a)=>{a.d(i,{DI:()=>d,IS:()=>n,JH:()=>m,MA:()=>h,Q2:()=>p,fg:()=>r,gb:()=>c,mq:()=>l,nJ:()=>t,o5:()=>b,rj:()=>s,wG:()=>g,wb:()=>f,zN:()=>o,zt:()=>u});let n={kiro:{id:"kiro",alias:"kr",name:"Kiro AI",icon:"psychology_alt",color:"#FF6B35"},qwen:{id:"qwen",alias:"qw",name:"Qwen Code",icon:"psychology",color:"#10B981"},"gemini-cli":{id:"gemini-cli",alias:"gc",name:"Gemini CLI",icon:"terminal",color:"#4285F4",deprecated:!0,deprecationNotice:"Google has tightened Gemini CLI abuse detection and restricted Pro models to paid accounts (Mar 25, 2026). Using this provider may violate ToS and risk account bans."},iflow:{id:"iflow",alias:"if",name:"iFlow AI",icon:"water_drop",color:"#6366F1"},opencode:{id:"opencode",alias:"oc",name:"OpenCode",icon:"terminal",color:"#E87040",textIcon:"OC",noAuth:!0}},t={openrouter:{id:"openrouter",alias:"openrouter",name:"OpenRouter",icon:"router",color:"#F97316",textIcon:"OR",website:"https://openrouter.ai",notice:{text:"Free tier: 27+ free models, no credit card needed, 200 req/day. After $10 credit: 1,000 req/day.",apiKeyUrl:"https://openrouter.ai/settings/keys"},modelsFetcher:{url:"https://openrouter.ai/api/v1/models",type:"openrouter-free"}},nvidia:{id:"nvidia",alias:"nvidia",name:"NVIDIA NIM",icon:"developer_board",color:"#76B900",textIcon:"NV",website:"https://developer.nvidia.com/nim",notice:{text:"Free access for NVIDIA Developer Program members (prototyping & testing).",apiKeyUrl:"https://build.nvidia.com/settings/api-keys"}},ollama:{id:"ollama",alias:"ollama",name:"Ollama Cloud",icon:"cloud",color:"#ffffffff",textIcon:"OL",website:"https://ollama.com",notice:{text:"Free tier: light usage, 1 cloud model at a time (limits reset every 5h & 7d). Pro $20/mo \xb7 Max $100/mo.",apiKeyUrl:"https://ollama.com/settings/keys"}},vertex:{id:"vertex",alias:"vx",name:"Vertex AI",icon:"cloud",color:"#4285F4",textIcon:"VX",website:"https://cloud.google.com/vertex-ai",notice:{text:"New Google Cloud accounts get $300 free credits. Requires GCP project + Service Account with Vertex AI API enabled.",apiKeyUrl:"https://console.cloud.google.com/iam-admin/serviceaccounts"}}},o={claude:{id:"claude",alias:"cc",name:"Claude Code",icon:"smart_toy",color:"#D97757"},antigravity:{id:"antigravity",alias:"ag",name:"Antigravity",icon:"rocket_launch",color:"#F59E0B",deprecated:!0,deprecationNotice:"Antigravity has tightened abuse detection and restricted model access. Using this provider may violate ToS and risk account bans."},codex:{id:"codex",alias:"cx",name:"OpenAI Codex",icon:"code",color:"#3B82F6"},github:{id:"github",alias:"gh",name:"GitHub Copilot",icon:"code",color:"#333333"},cursor:{id:"cursor",alias:"cu",name:"Cursor IDE",icon:"edit_note",color:"#00D4AA"},kilocode:{id:"kilocode",alias:"kc",name:"Kilo Code",icon:"code",color:"#FF6B35",textIcon:"KC"},cline:{id:"cline",alias:"cl",name:"Cline",icon:"smart_toy",color:"#5B9BD5",textIcon:"CL"}},r={glm:{id:"glm",alias:"glm",name:"GLM Coding",icon:"code",color:"#2563EB",textIcon:"GL",website:"https://open.bigmodel.cn"},"glm-cn":{id:"glm-cn",alias:"glm-cn",name:"GLM (China)",icon:"code",color:"#DC2626",textIcon:"GC",website:"https://open.bigmodel.cn"},kimi:{id:"kimi",alias:"kimi",name:"Kimi",icon:"psychology",color:"#1E3A8A",textIcon:"KM",website:"https://kimi.moonshot.cn"},minimax:{id:"minimax",alias:"minimax",name:"Minimax Coding",icon:"memory",color:"#7C3AED",textIcon:"MM",website:"https://www.minimaxi.com"},"minimax-cn":{id:"minimax-cn",alias:"minimax-cn",name:"Minimax (China)",icon:"memory",color:"#DC2626",textIcon:"MC",website:"https://www.minimaxi.com"},alicode:{id:"alicode",alias:"alicode",name:"Alibaba",icon:"cloud",color:"#FF6A00",textIcon:"ALi"},"alicode-intl":{id:"alicode-intl",alias:"alicode-intl",name:"Alibaba Intl",icon:"cloud",color:"#FF6A00",textIcon:"ALi"},openai:{id:"openai",alias:"openai",name:"OpenAI",icon:"auto_awesome",color:"#10A37F",textIcon:"OA",website:"https://platform.openai.com",serviceKinds:["llm","embedding","tts"]},anthropic:{id:"anthropic",alias:"anthropic",name:"Anthropic",icon:"smart_toy",color:"#D97757",textIcon:"AN",website:"https://console.anthropic.com",serviceKinds:["llm"]},gemini:{id:"gemini",alias:"gemini",name:"Gemini",icon:"diamond",color:"#4285F4",textIcon:"GE",website:"https://ai.google.dev",serviceKinds:["llm","embedding"]},deepseek:{id:"deepseek",alias:"ds",name:"DeepSeek",icon:"bolt",color:"#4D6BFE",textIcon:"DS",website:"https://deepseek.com"},groq:{id:"groq",alias:"groq",name:"Groq",icon:"speed",color:"#F55036",textIcon:"GQ",website:"https://groq.com"},xai:{id:"xai",alias:"xai",name:"xAI (Grok)",icon:"auto_awesome",color:"#1DA1F2",textIcon:"XA",website:"https://x.ai"},mistral:{id:"mistral",alias:"mistral",name:"Mistral",icon:"air",color:"#FF7000",textIcon:"MI",website:"https://mistral.ai"},perplexity:{id:"perplexity",alias:"pplx",name:"Perplexity",icon:"search",color:"#20808D",textIcon:"PP",website:"https://www.perplexity.ai"},together:{id:"together",alias:"together",name:"Together AI",icon:"group_work",color:"#0F6FFF",textIcon:"TG",website:"https://www.together.ai"},fireworks:{id:"fireworks",alias:"fireworks",name:"Fireworks AI",icon:"local_fire_department",color:"#7B2EF2",textIcon:"FW",website:"https://fireworks.ai"},cerebras:{id:"cerebras",alias:"cerebras",name:"Cerebras",icon:"memory",color:"#FF4F00",textIcon:"CB",website:"https://www.cerebras.ai"},cohere:{id:"cohere",alias:"cohere",name:"Cohere",icon:"hub",color:"#39594D",textIcon:"CO",website:"https://cohere.com"},nebius:{id:"nebius",alias:"nebius",name:"Nebius AI",icon:"cloud",color:"#6C5CE7",textIcon:"NB",website:"https://nebius.com"},siliconflow:{id:"siliconflow",alias:"siliconflow",name:"SiliconFlow",icon:"cloud_queue",color:"#5B6EF5",textIcon:"SF",website:"https://cloud.siliconflow.com"},hyperbolic:{id:"hyperbolic",alias:"hyp",name:"Hyperbolic",icon:"bolt",color:"#00D4FF",textIcon:"HY",website:"https://hyperbolic.xyz"},deepgram:{id:"deepgram",alias:"dg",name:"Deepgram",icon:"mic",color:"#13EF93",textIcon:"DG",website:"https://deepgram.com",serviceKinds:["stt"]},assemblyai:{id:"assemblyai",alias:"aai",name:"AssemblyAI",icon:"record_voice_over",color:"#0062FF",textIcon:"AA",website:"https://assemblyai.com",serviceKinds:["stt"]},nanobanana:{id:"nanobanana",alias:"nb",name:"NanoBanana",icon:"image",color:"#FFD700",textIcon:"NB",website:"https://nanobananaapi.ai",serviceKinds:["image"]},elevenlabs:{id:"elevenlabs",alias:"el",name:"ElevenLabs",icon:"record_voice_over",color:"#6C47FF",textIcon:"EL",website:"https://elevenlabs.io",serviceKinds:["tts"]},cartesia:{id:"cartesia",alias:"cartesia",name:"Cartesia",icon:"spatial_audio",color:"#FF4F8B",textIcon:"CA",website:"https://cartesia.ai",serviceKinds:["tts"]},playht:{id:"playht",alias:"playht",name:"PlayHT",icon:"play_circle",color:"#00B4D8",textIcon:"PH",website:"https://play.ht",serviceKinds:["tts"]},sdwebui:{id:"sdwebui",alias:"sdwebui",name:"SD WebUI",icon:"brush",color:"#FF7043",textIcon:"SD",website:"https://github.com/AUTOMATIC1111/stable-diffusion-webui",serviceKinds:["image"]},comfyui:{id:"comfyui",alias:"comfyui",name:"ComfyUI",icon:"account_tree",color:"#4CAF50",textIcon:"CF",website:"https://github.com/comfyanonymous/ComfyUI",serviceKinds:["image"]},huggingface:{id:"huggingface",alias:"hf",name:"HuggingFace",icon:"face",color:"#FFD21E",textIcon:"HF",website:"https://huggingface.co",serviceKinds:["embedding","image","tts"]},chutes:{id:"chutes",alias:"ch",name:"Chutes AI",icon:"water_drop",color:"#ffffffff",textIcon:"CH",website:"https://chutes.ai"},"ollama-local":{id:"ollama-local",alias:"ollama-local",name:"Ollama Local",icon:"cloud",color:"#ffffffff",textIcon:"OL",website:"https://ollama.com"},"vertex-partner":{id:"vertex-partner",alias:"vxp",name:"Vertex Partner",icon:"cloud",color:"#34A853",textIcon:"VP",website:"https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models"}},s=[{id:"embedding",label:"Embedding",icon:"data_array",endpoint:{method:"POST",path:"/v1/embeddings"}},{id:"image",label:"Image",icon:"image",endpoint:{method:"POST",path:"/v1/images/generations"}},{id:"tts",label:"TTS",icon:"record_voice_over",endpoint:{method:"POST",path:"/v1/audio/speech"}},{id:"stt",label:"STT",icon:"mic",endpoint:{method:"POST",path:"/v1/audio/transcriptions"}},{id:"video",label:"Video",icon:"movie",endpoint:{method:"POST",path:"/v1/video/generations"}},{id:"music",label:"Music",icon:"music_note",endpoint:{method:"POST",path:"/v1/audio/music"}}],m="openai-compatible-",d="anthropic-compatible-";function l(e){return"string"==typeof e&&e.startsWith(m)}function c(e){return"string"==typeof e&&e.startsWith(d)}let p={...n,...t,...o,...r},h={oauth:{id:"oauth",name:"OAuth",icon:"lock"},apikey:{id:"apikey",name:"API Key",icon:"key"}};function u(e){for(let i of Object.values(p))if(i.alias===e||i.id===e)return i;return null}function g(e){let i=p[e];return i?.alias||e}function b(e){return Object.values(p).filter(i=>(i.serviceKinds??["llm"]).includes(e))}Object.values(p).reduce((e,i)=>(e[i.alias]=i.id,e),{}),Object.values(p).reduce((e,i)=>(e[i.id]=i.alias,e),{});let f=["claude","antigravity","kiro","github","codex","kimi-coding"]},83789:(e,i,a)=>{a.d(i,{A:()=>s});var n=a(2074),t=a(11472),o=a(43202);function r(e){let i=document.documentElement,a=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";"dark"===("system"===e?a:e)?i.classList.add("dark"):i.classList.remove("dark")}let s=(0,n.v)((0,t.Zr)((e,i)=>({theme:o.B2.defaultTheme,setTheme:i=>{e({theme:i}),r(i)},toggleTheme:()=>{let a="dark"===i().theme?"light":"dark";e({theme:a}),r(a)},initTheme:()=>{r(i().theme)}}),{name:o.B2.storageKey}))},84502:(e,i,a)=>{a.d(i,{FE:()=>p,Tl:()=>d,wn:()=>h});var n=a(55348);let t={},o=n.Xn,r=[];function s(){if("u"<typeof document)return n.Xn;let e=document.cookie.split(";").find(e=>e.trim().startsWith(`${n.CL}=`)),i=e?decodeURIComponent(e.split("=")[1]):n.Xn;return(0,n.QC)(i)}async function m(e){if("en"===e){t={};return}try{let i=await fetch(`/i18n/literals/${e}.json`);t=await i.json()}catch(e){console.error("Failed to load translations:",e),t={}}}function d(e){if(!e||"string"!=typeof e)return e;let i=e.trim();return i&&"en"!==o&&t[i]||e}function l(e){if(!e.nodeValue||!e.nodeValue.trim())return;let i=e.parentElement;if(!i)return;let a=i;for(;a;){if(a.hasAttribute&&a.hasAttribute("data-i18n-skip"))return;a=a.parentElement}if(["script","style","code","pre","colgroup","table","thead","tbody","tfoot","tr","select","datalist","optgroup"].includes(i.tagName?.toLowerCase()))return;e._originalText||(e._originalText=e.nodeValue);let n=d(e._originalText);n!==e.nodeValue&&(e.nodeValue=n)}function c(e){let i;if(!e)return;let a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),n=[];for(;i=a.nextNode();)n.push(i);n.forEach(l)}async function p(){o=s(),await m(o),c(document.body),new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{e.nodeType===Node.ELEMENT_NODE?c(e):e.nodeType===Node.TEXT_NODE&&l(e)})})}).observe(document.body,{childList:!0,subtree:!0})}async function h(){o=s(),await m(o),r.forEach(e=>e()),c(document.body)}},94718:(e,i,a)=>{a.d(i,{Xg:()=>l,vq:()=>m,KC:()=>c});var n=a(390),t=a(89651);let o={"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,interleaved-thinking-2025-05-14"},r="https://api.kimi.com/coding/v1/messages",s={claude:{baseUrl:"https://api.anthropic.com/v1/messages",format:"claude",retry:{429:0},headers:{"Anthropic-Version":"2023-06-01","Anthropic-Beta":"claude-code-20250219,oauth-2025-04-20,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28","Anthropic-Dangerous-Direct-Browser-Access":"true","User-Agent":"claude-cli/2.1.92 (external, sdk-cli)","X-App":"cli","X-Stainless-Helper-Method":"stream","X-Stainless-Retry-Count":"0","X-Stainless-Runtime-Version":"v24.14.0","X-Stainless-Package-Version":"0.80.0","X-Stainless-Runtime":"node","X-Stainless-Lang":"js","X-Stainless-Arch":function(){switch((0,n.arch)()){case"x64":return"x64";case"arm64":return"arm64";case"ia32":return"x86";default:return`other::${(0,n.arch)()}`}}(),"X-Stainless-Os":function(){switch((0,n.platform)()){case"darwin":return"MacOS";case"win32":return"Windows";case"linux":return"Linux";case"freebsd":return"FreeBSD";default:return`Other::${(0,n.platform)()}`}}(),"X-Stainless-Timeout":"600"},clientId:"9d1c250a-e61b-44d9-88ed-5944d1962f5e",tokenUrl:"https://api.anthropic.com/v1/oauth/token"},gemini:{baseUrl:"https://generativelanguage.googleapis.com/v1beta/models",format:"gemini",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},"gemini-cli":{baseUrl:"https://cloudcode-pa.googleapis.com/v1internal",format:"gemini-cli",clientId:"681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",clientSecret:"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"},codex:{baseUrl:"https://chatgpt.com/backend-api/codex/responses",format:"openai-responses",headers:{originator:"codex-cli","User-Agent":"codex-cli/1.0.18 (macOS; arm64)"},clientId:"app_EMoamEEZ73f0CkXaXp7hrann",clientSecret:"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",tokenUrl:"https://auth.openai.com/oauth/token"},qwen:{baseUrl:"https://portal.qwen.ai/v1/chat/completions",format:"openai",clientId:"f0304373b74a44d2b584a3fb70ca9e56",tokenUrl:"https://chat.qwen.ai/api/v1/oauth2/token",authUrl:"https://chat.qwen.ai/api/v1/oauth2/device/code"},iflow:{baseUrl:"https://apis.iflow.cn/v1/chat/completions",format:"openai",headers:{"User-Agent":"iFlow-Cli"},clientId:"10009311001",clientSecret:"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",tokenUrl:"https://iflow.cn/oauth/token",authUrl:"https://iflow.cn/oauth"},qoder:{baseUrl:"https://api.qoder.com/v1/chat/completions",format:"openai",headers:{"User-Agent":"Qoder-Cli"},clientId:t.env.QODER_OAUTH_CLIENT_ID||"10009311001",clientSecret:t.env.QODER_OAUTH_CLIENT_SECRET||"4Z3YjXycVsQvyGF1etiNlIBB4RsqSDtW",tokenUrl:"https://api.qoder.com/oauth/token",authUrl:"https://qoder.com/oauth/authorize"},antigravity:{baseUrls:["https://daily-cloudcode-pa.googleapis.com","https://daily-cloudcode-pa.sandbox.googleapis.com"],format:"antigravity",headers:{"User-Agent":`antigravity/1.107.0 ${(0,n.platform)()}/${(0,n.arch)()}`},clientId:"1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com",clientSecret:"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"},openrouter:{baseUrl:"https://openrouter.ai/api/v1/chat/completions",format:"openai",headers:{"HTTP-Referer":"https://endpoint-proxy.local","X-Title":"Endpoint Proxy"}},openai:{baseUrl:"https://api.openai.com/v1/chat/completions",format:"openai"},glm:{baseUrl:"https://api.z.ai/api/anthropic/v1/messages",format:"claude",headers:{...o}},"glm-cn":{baseUrl:"https://open.bigmodel.cn/api/coding/paas/v4/chat/completions",format:"openai",headers:{}},kimi:{baseUrl:r,format:"claude",headers:{...o}},minimax:{baseUrl:"https://api.minimax.io/anthropic/v1/messages",format:"claude",headers:{...o}},"minimax-cn":{baseUrl:"https://api.minimaxi.com/anthropic/v1/messages",format:"claude",headers:{...o}},alicode:{baseUrl:"https://coding.dashscope.aliyuncs.com/v1/chat/completions",format:"openai",headers:{}},"alicode-intl":{baseUrl:"https://coding-intl.dashscope.aliyuncs.com/v1/chat/completions",format:"openai",headers:{}},github:{baseUrl:"https://api.githubcopilot.com/chat/completions",responsesUrl:"https://api.githubcopilot.com/responses",format:"openai",headers:{"copilot-integration-id":"vscode-chat","editor-version":"vscode/1.110.0","editor-plugin-version":"copilot-chat/0.38.0","user-agent":"GitHubCopilotChat/0.38.0","openai-intent":"conversation-panel","x-github-api-version":"2025-04-01","x-vscode-user-agent-library-version":"electron-fetch","X-Initiator":"user",Accept:"application/json","Content-Type":"application/json"},clientId:"Iv1.b507a08c87ecfe98"},kiro:{baseUrl:"https://codewhisperer.us-east-1.amazonaws.com/generateAssistantResponse",format:"kiro",headers:{"Content-Type":"application/json",Accept:"application/vnd.amazon.eventstream","X-Amz-Target":"AmazonCodeWhispererStreamingService.GenerateAssistantResponse","User-Agent":"AWS-SDK-JS/3.0.0 kiro-ide/1.0.0","X-Amz-User-Agent":"aws-sdk-js/3.0.0 kiro-ide/1.0.0"},tokenUrl:"https://prod.us-east-1.auth.desktop.kiro.dev/refreshToken",authUrl:"https://prod.us-east-1.auth.desktop.kiro.dev"},cursor:{baseUrl:"https://api2.cursor.sh",chatPath:"/aiserver.v1.ChatService/StreamUnifiedChatWithTools",format:"cursor",headers:{"connect-accept-encoding":"gzip","connect-protocol-version":"1","Content-Type":"application/connect+proto","User-Agent":"connect-es/1.6.1"},clientVersion:"1.1.3"},"kimi-coding":{baseUrl:r,format:"claude",headers:{...o},clientId:"17e5f671-d194-4dfb-9706-5516cb48c098",tokenUrl:"https://auth.kimi.com/api/oauth/token",refreshUrl:"https://auth.kimi.com/api/oauth/token"},kilocode:{baseUrl:"https://api.kilo.ai/api/openrouter/chat/completions",format:"openai",headers:{}},opencode:{baseUrl:"http://localhost:4096/v1/chat/completions",format:"openai",headers:{}},cline:{baseUrl:"https://api.cline.bot/api/v1/chat/completions",format:"openai",headers:{"HTTP-Referer":"https://cline.bot","X-Title":"Cline"},tokenUrl:"https://api.cline.bot/api/v1/auth/token",refreshUrl:"https://api.cline.bot/api/v1/auth/refresh"},nvidia:{baseUrl:"https://integrate.api.nvidia.com/v1/chat/completions",format:"openai"},anthropic:{baseUrl:"https://api.anthropic.com/v1/messages",format:"claude",headers:{...o}},deepseek:{baseUrl:"https://api.deepseek.com/chat/completions",format:"openai"},groq:{baseUrl:"https://api.groq.com/openai/v1/chat/completions",format:"openai"},xai:{baseUrl:"https://api.x.ai/v1/chat/completions",format:"openai"},mistral:{baseUrl:"https://api.mistral.ai/v1/chat/completions",format:"openai"},perplexity:{baseUrl:"https://api.perplexity.ai/chat/completions",format:"openai"},together:{baseUrl:"https://api.together.xyz/v1/chat/completions",format:"openai"},fireworks:{baseUrl:"https://api.fireworks.ai/inference/v1/chat/completions",format:"openai"},cerebras:{baseUrl:"https://api.cerebras.ai/v1/chat/completions",format:"openai"},cohere:{baseUrl:"https://api.cohere.ai/v1/chat/completions",format:"openai"},nebius:{baseUrl:"https://api.studio.nebius.ai/v1/chat/completions",format:"openai"},siliconflow:{baseUrl:"https://api.siliconflow.cn/v1/chat/completions",format:"openai"},hyperbolic:{baseUrl:"https://api.hyperbolic.xyz/v1/chat/completions",format:"openai"},deepgram:{baseUrl:"https://api.deepgram.com/v1/listen",format:"openai"},assemblyai:{baseUrl:"https://api.assemblyai.com/v1/audio/transcriptions",format:"openai"},nanobanana:{baseUrl:"https://api.nanobananaapi.ai/v1/chat/completions",format:"openai"},chutes:{baseUrl:"https://llm.chutes.ai/v1/chat/completions",format:"openai"},ollama:{baseUrl:"https://ollama.com/api/chat",format:"ollama"},"ollama-local":{baseUrl:"http://localhost:11434/api/chat",format:"ollama"},vertex:{baseUrl:"https://aiplatform.googleapis.com",format:"vertex"},"vertex-partner":{baseUrl:"https://aiplatform.googleapis.com",format:"openai"},gitlab:{baseUrl:"https://gitlab.com/api/v4/chat/completions",format:"openai"},codebuddy:{baseUrl:"https://copilot.tencent.com/v1/chat/completions",format:"openai"},opencode:{baseUrl:"https://opencode.ai",format:"openai",headers:{"x-opencode-client":"desktop"}}},m={cc:[{id:"claude-opus-4-6",name:"Claude Opus 4.6"},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-5-20251101",name:"Claude 4.5 Opus"},{id:"claude-sonnet-4-5-20250929",name:"Claude 4.5 Sonnet"},{id:"claude-haiku-4-5-20251001",name:"Claude 4.5 Haiku"}],cx:[{id:"gpt-5.4",name:"GPT 5.4"},{id:"gpt-5.3-codex",name:"GPT 5.3 Codex"},{id:"gpt-5.3-codex-xhigh",name:"GPT 5.3 Codex (xHigh)"},{id:"gpt-5.3-codex-high",name:"GPT 5.3 Codex (High)"},{id:"gpt-5.3-codex-low",name:"GPT 5.3 Codex (Low)"},{id:"gpt-5.3-codex-none",name:"GPT 5.3 Codex (None)"},{id:"gpt-5.3-codex-spark",name:"GPT 5.3 Codex Spark"},{id:"gpt-5.1-codex-mini",name:"GPT 5.1 Codex Mini"},{id:"gpt-5.1-codex-mini-high",name:"GPT 5.1 Codex Mini (High)"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.1-codex-max",name:"GPT 5.1 Codex Max"},{id:"gpt-5.1-codex",name:"GPT 5.1 Codex"},{id:"gpt-5.1",name:"GPT 5.1"},{id:"gpt-5-codex",name:"GPT 5 Codex"},{id:"gpt-5-codex-mini",name:"GPT 5 Codex Mini"}],gc:[{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro Preview"}],qw:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-coder-flash",name:"Qwen3 Coder Flash"},{id:"vision-model",name:"Qwen3 Vision Model"},{id:"coder-model",name:"Qwen3.5 Coder Model"}],if:[{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"qwen3-max",name:"Qwen3 Max"},{id:"qwen3-vl-plus",name:"Qwen3 VL Plus"},{id:"qwen3-max-preview",name:"Qwen3 Max Preview"},{id:"qwen3-235b",name:"Qwen3 235B A22B"},{id:"qwen3-235b-a22b-instruct",name:"Qwen3 235B A22B Instruct"},{id:"qwen3-235b-a22b-thinking-2507",name:"Qwen3 235B A22B Thinking"},{id:"qwen3-32b",name:"Qwen3 32B"},{id:"kimi-k2",name:"Kimi K2"},{id:"deepseek-v3.2",name:"DeepSeek V3.2 Exp"},{id:"deepseek-v3.1",name:"DeepSeek V3.1 Terminus"},{id:"deepseek-v3",name:"DeepSeek V3 671B"},{id:"deepseek-r1",name:"DeepSeek R1"},{id:"glm-4.7",name:"GLM 4.7"},{id:"iflow-rome-30ba3b",name:"iFlow ROME"}],ag:[{id:"gemini-3.1-pro-high",name:"Gemini 3 Pro High"},{id:"gemini-3.1-pro-low",name:"Gemini 3 Pro Low"},{id:"gemini-3-flash",name:"Gemini 3 Flash",thinking:!1},{id:"claude-sonnet-4-6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4-6-thinking",name:"Claude Opus 4.6 Thinking"},{id:"gpt-oss-120b-medium",name:"GPT OSS 120B Medium"}],gh:[{id:"gpt-3.5-turbo",name:"GPT-3.5 Turbo"},{id:"gpt-4",name:"GPT-4"},{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o mini"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5-codex",name:"GPT-5 Codex"},{id:"gpt-5.1",name:"GPT-5.1"},{id:"gpt-5.1-codex",name:"GPT-5.1 Codex"},{id:"gpt-5.1-codex-mini",name:"GPT-5.1 Codex Mini"},{id:"gpt-5.1-codex-max",name:"GPT-5.1 Codex Max"},{id:"gpt-5.2",name:"GPT-5.2"},{id:"gpt-5.2-codex",name:"GPT-5.2 Codex"},{id:"gpt-5.3-codex",name:"GPT-5.3 Codex"},{id:"gpt-5.4",name:"GPT-5.4"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"},{id:"claude-opus-4.1",name:"Claude Opus 4.1"},{id:"claude-opus-4.5",name:"Claude Opus 4.5"},{id:"claude-sonnet-4",name:"Claude Sonnet 4"},{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6"},{id:"claude-opus-4.6",name:"Claude Opus 4.6"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash"},{id:"gemini-3-pro-preview",name:"Gemini 3 Pro"},{id:"grok-code-fast-1",name:"Grok Code Fast 1"},{id:"oswe-vscode-prime",name:"Raptor Mini"}],kr:[{id:"claude-sonnet-4.5",name:"Claude Sonnet 4.5"},{id:"claude-haiku-4.5",name:"Claude Haiku 4.5"},{id:"deepseek-3.2",name:"DeepSeek 3.2"},{id:"deepseek-3.1",name:"DeepSeek 3.1"},{id:"qwen3-coder-next",name:"Qwen3 Coder Next"}],cu:[{id:"default",name:"Auto (Server Picks)"},{id:"claude-4.5-opus-high-thinking",name:"Claude 4.5 Opus High Thinking"},{id:"claude-4.5-opus-high",name:"Claude 4.5 Opus High"},{id:"claude-4.5-sonnet-thinking",name:"Claude 4.5 Sonnet Thinking"},{id:"claude-4.5-sonnet",name:"Claude 4.5 Sonnet"},{id:"claude-4.5-haiku",name:"Claude 4.5 Haiku"},{id:"claude-4.5-opus",name:"Claude 4.5 Opus"},{id:"gpt-5.2-codex",name:"GPT 5.2 Codex"},{id:"claude-4.6-opus-max",name:"Claude 4.6 Opus Max"},{id:"claude-4.6-sonnet-medium-thinking",name:"Claude 4.6 Sonnet Medium Thinking"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gpt-5.2",name:"GPT 5.2"},{id:"gpt-5.3-codex",name:"GPT 5.3 Codex"}],kmc:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],kc:[{id:"anthropic/claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"anthropic/claude-opus-4-20250514",name:"Claude Opus 4"},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"openai/gpt-4.1",name:"GPT-4.1"},{id:"openai/o3",name:"o3"},{id:"deepseek/deepseek-chat",name:"DeepSeek Chat"},{id:"deepseek/deepseek-reasoner",name:"DeepSeek Reasoner"}],oc:[{id:"nemotron-3-super-free",name:"Nemotron 3 Super"},{id:"qwen3.6-plus-free",name:"Qwen 3.6 Plus"},{id:"minimax-m2.5-free",name:"MiniMax M2.5",targetFormat:"claude"}],cl:[{id:"anthropic/claude-sonnet-4.6",name:"Claude Sonnet 4.6"},{id:"anthropic/claude-opus-4.6",name:"Claude Opus 4.6"},{id:"openai/gpt-5.3-codex",name:"GPT-5.3 Codex"},{id:"openai/gpt-5.4",name:"GPT-5.4"},{id:"google/gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview"},{id:"google/gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview"},{id:"kwaipilot/kat-coder-pro",name:"KAT Coder Pro"}],openai:[{id:"gpt-5.4",name:"GPT-5.4"},{id:"gpt-5.4-mini",name:"GPT-5.4 Mini"},{id:"gpt-5.4-nano",name:"GPT-5.4 Nano"},{id:"gpt-5.2",name:"GPT-5.2"},{id:"gpt-5.1",name:"GPT-5.1"},{id:"gpt-5",name:"GPT-5"},{id:"gpt-5-mini",name:"GPT-5 Mini"},{id:"gpt-5-nano",name:"GPT-5 Nano"},{id:"gpt-4o",name:"GPT-4o"},{id:"gpt-4o-mini",name:"GPT-4o Mini"},{id:"gpt-4-turbo",name:"GPT-4 Turbo"},{id:"gpt-4.1",name:"GPT-4.1"},{id:"gpt-4.1-mini",name:"GPT-4.1 Mini"},{id:"gpt-4.1-nano",name:"GPT-4.1 Nano"},{id:"o3",name:"O3"},{id:"o3-mini",name:"O3 Mini"},{id:"o3-pro",name:"O3 Pro"},{id:"o4-mini",name:"O4 Mini"},{id:"o1",name:"O1"},{id:"o1-mini",name:"O1 Mini"},{id:"text-embedding-3-large",name:"Text Embedding 3 Large",type:"embedding"},{id:"text-embedding-3-small",name:"Text Embedding 3 Small",type:"embedding"},{id:"text-embedding-ada-002",name:"Text Embedding Ada 002",type:"embedding"},{id:"tts-1",name:"TTS-1",type:"tts"},{id:"tts-1-hd",name:"TTS-1 HD",type:"tts"},{id:"gpt-4o-mini-tts",name:"GPT-4o Mini TTS",type:"tts"}],anthropic:[{id:"claude-sonnet-4-20250514",name:"Claude Sonnet 4"},{id:"claude-opus-4-20250514",name:"Claude Opus 4"},{id:"claude-3-5-sonnet-20241022",name:"Claude 3.5 Sonnet"}],gemini:[{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview"},{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview"},{id:"gemini-3.1-flash-image-preview",name:"Gemini 3.1 Flash Image Preview"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-2.5-pro",name:"Gemini 2.5 Pro"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"},{id:"gemini-2.5-flash-lite",name:"Gemini 2.5 Flash Lite"},{id:"gemini-2.0-flash",name:"Gemini 2.0 Flash"},{id:"gemini-2.0-flash-lite",name:"Gemini 2.0 Flash Lite"},{id:"gemini-embedding-2-preview",name:"Gemini Embedding 2 Preview",type:"embedding"},{id:"gemini-embedding-001",name:"Gemini Embedding 001",type:"embedding"},{id:"text-embedding-005",name:"Text Embedding 005",type:"embedding"},{id:"text-embedding-004",name:"Text Embedding 004 (Legacy)",type:"embedding"}],openrouter:[],glm:[{id:"glm-5.1",name:"GLM 5.1"},{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM 4.7"},{id:"glm-4.6v",name:"GLM 4.6V (Vision)"}],"glm-cn":[{id:"glm-5.1",name:"GLM 5.1"},{id:"glm-5",name:"GLM 5"},{id:"glm-4.7",name:"GLM-4.7"},{id:"glm-4.6",name:"GLM-4.6"},{id:"glm-4.5-air",name:"GLM-4.5-Air"}],kimi:[{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"kimi-k2.5-thinking",name:"Kimi K2.5 Thinking"},{id:"kimi-latest",name:"Kimi Latest"}],minimax:[{id:"MiniMax-M2.7",name:"MiniMax M2.7"},{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],"minimax-cn":[{id:"MiniMax-M2.7",name:"MiniMax M2.7"},{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"MiniMax-M2.1",name:"MiniMax M2.1"}],alicode:[{id:"qwen3.5-plus",name:"Qwen3.5 Plus"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"glm-5",name:"GLM 5"},{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"qwen3-max-2026-01-23",name:"Qwen3 Max"},{id:"qwen3-coder-next",name:"Qwen3 Coder Next"},{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"glm-4.7",name:"GLM 4.7"}],"alicode-intl":[{id:"qwen3.5-plus",name:"Qwen3.5 Plus"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"glm-5",name:"GLM 5"},{id:"MiniMax-M2.5",name:"MiniMax M2.5"},{id:"qwen3-coder-next",name:"Qwen3 Coder Next"},{id:"qwen3-coder-plus",name:"Qwen3 Coder Plus"},{id:"glm-4.7",name:"GLM 4.7"}],deepseek:[{id:"deepseek-chat",name:"DeepSeek V3.2 Chat"},{id:"deepseek-reasoner",name:"DeepSeek V3.2 Reasoner"}],groq:[{id:"llama-3.3-70b-versatile",name:"Llama 3.3 70B"},{id:"meta-llama/llama-4-maverick-17b-128e-instruct",name:"Llama 4 Maverick"},{id:"qwen/qwen3-32b",name:"Qwen3 32B"},{id:"openai/gpt-oss-120b",name:"GPT-OSS 120B"}],xai:[{id:"grok-4",name:"Grok 4"},{id:"grok-4-fast-reasoning",name:"Grok 4 Fast Reasoning"},{id:"grok-code-fast-1",name:"Grok Code Fast"},{id:"grok-3",name:"Grok 3"}],mistral:[{id:"mistral-large-latest",name:"Mistral Large 3"},{id:"codestral-latest",name:"Codestral"},{id:"mistral-medium-latest",name:"Mistral Medium 3"}],perplexity:[{id:"sonar-pro",name:"Sonar Pro"},{id:"sonar",name:"Sonar"}],together:[{id:"meta-llama/Llama-3.3-70B-Instruct-Turbo",name:"Llama 3.3 70B Turbo"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B",name:"Qwen3 235B"},{id:"meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8",name:"Llama 4 Maverick"}],fireworks:[{id:"accounts/fireworks/models/deepseek-v3p1",name:"DeepSeek V3.1"},{id:"accounts/fireworks/models/llama-v3p3-70b-instruct",name:"Llama 3.3 70B"},{id:"accounts/fireworks/models/qwen3-235b-a22b",name:"Qwen3 235B"}],cerebras:[{id:"gpt-oss-120b",name:"GPT OSS 120B"},{id:"zai-glm-4.7",name:"ZAI GLM 4.7"},{id:"llama-3.3-70b",name:"Llama 3.3 70B"},{id:"llama-4-scout-17b-16e-instruct",name:"Llama 4 Scout"},{id:"qwen-3-235b-a22b-instruct-2507",name:"Qwen3 235B A22B"},{id:"qwen-3-32b",name:"Qwen3 32B"}],cohere:[{id:"command-r-plus-08-2024",name:"Command R+ (Aug 2024)"},{id:"command-r-08-2024",name:"Command R (Aug 2024)"},{id:"command-a-03-2025",name:"Command A (Mar 2025)"}],nvidia:[{id:"moonshotai/kimi-k2.5",name:"Kimi K2.5"},{id:"z-ai/glm4.7",name:"GLM 4.7"}],nebius:[{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B Instruct"}],siliconflow:[{id:"deepseek-ai/DeepSeek-V3.2",name:"DeepSeek V3.2"},{id:"deepseek-ai/DeepSeek-V3.1",name:"DeepSeek V3.1"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"Qwen/Qwen3-235B-A22B-Instruct-2507",name:"Qwen3 235B"},{id:"Qwen/Qwen3-Coder-480B-A35B-Instruct",name:"Qwen3 Coder 480B"},{id:"Qwen/Qwen3-32B",name:"Qwen3 32B"},{id:"moonshotai/Kimi-K2.5",name:"Kimi K2.5"},{id:"zai-org/GLM-4.7",name:"GLM 4.7"},{id:"openai/gpt-oss-120b",name:"GPT OSS 120B"},{id:"baidu/ERNIE-4.5-300B-A47B",name:"ERNIE 4.5 300B"}],hyperbolic:[{id:"Qwen/QwQ-32B",name:"QwQ 32B"},{id:"deepseek-ai/DeepSeek-R1",name:"DeepSeek R1"},{id:"deepseek-ai/DeepSeek-V3",name:"DeepSeek V3"},{id:"meta-llama/Llama-3.3-70B-Instruct",name:"Llama 3.3 70B"},{id:"meta-llama/Llama-3.2-3B-Instruct",name:"Llama 3.2 3B"},{id:"Qwen/Qwen2.5-72B-Instruct",name:"Qwen 2.5 72B"},{id:"Qwen/Qwen2.5-Coder-32B-Instruct",name:"Qwen 2.5 Coder 32B"},{id:"NousResearch/Hermes-3-Llama-3.1-70B",name:"Hermes 3 70B"}],ollama:[{id:"gpt-oss:120b",name:"GPT OSS 120B"},{id:"kimi-k2.5",name:"Kimi K2.5"},{id:"glm-5",name:"GLM 5"},{id:"minimax-m2.5",name:"MiniMax M2.5"},{id:"glm-4.7-flash",name:"GLM 4.7 Flash"},{id:"qwen3.5",name:"Qwen3.5"}],vertex:[{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview"},{id:"gemini-3.1-flash-lite-preview",name:"Gemini 3.1 Flash Lite Preview"},{id:"gemini-3-flash-preview",name:"Gemini 3 Flash Preview"},{id:"gemini-2.5-flash",name:"Gemini 2.5 Flash"}],"vertex-partner":[{id:"deepseek-ai/deepseek-v3.2-maas",name:"DeepSeek V3.2 (Vertex)"},{id:"qwen/qwen3-next-80b-a3b-thinking-maas",name:"Qwen3 Next 80B Thinking (Vertex)"},{id:"qwen/qwen3-next-80b-a3b-instruct-maas",name:"Qwen3 Next 80B Instruct (Vertex)"},{id:"zai-org/glm-5-maas",name:"GLM-5 (Vertex)"}]},d={claude:"cc",codex:"cx","gemini-cli":"gc",qwen:"qw",iflow:"if",antigravity:"ag",github:"gh",kiro:"kr",cursor:"cu","kimi-coding":"kmc",kilocode:"kc",cline:"cl",opencode:"oc",vertex:"vertex","vertex-partner":"vertex-partner"},l=Object.fromEntries(Object.keys(s).map(e=>[e,d[e]||e]));function c(e){return m[l[e]||e]||[]}},98814:(e,i,a)=>{a.d(i,{ThemeProvider:()=>r});var n=a(73365),t=a(1521),o=a(83789);function r({children:e}){let{initTheme:i}=(0,o.A)();return(0,t.useEffect)(()=>{i()},[i]),(0,n.jsx)(n.Fragment,{children:e})}}}]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7400],{37403:(e,t,s)=>{s.d(t,{Tk:()=>o,Ah:()=>d,a7:()=>p,ZM:()=>x,tA:()=>g,kn:()=>f,yZ:()=>m,qO:()=>u});var l=s(73365),a=s(1521),r=s(74156),i=s(58872);let n=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function o({tool:e,isExpanded:t,onToggle:s,activeProviders:d,modelMappings:c,onModelMappingChange:x,baseUrl:m,hasActiveProviders:p,apiKeys:u,cloudEnabled:h,initialStatus:g}){let f,y,b,[j,N]=(0,a.useState)(g||null),[v,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(!1),[A,E]=(0,a.useState)(null),[O,I]=(0,a.useState)(!1),[R,M]=(0,a.useState)(!1),[P,T]=(0,a.useState)(null),[$,L]=(0,a.useState)(""),[U,K]=(0,a.useState)({}),[D,F]=(0,a.useState)(!1),[z,B]=(0,a.useState)(""),[H,q]=(0,a.useState)(!1),W=(0,a.useRef)(!1),G=(()=>{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=h&&n&&e.startsWith(n),l=m&&e.startsWith(m);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{u?.length>0&&!$&&L(u[0].key)},[u,$]),(0,a.useEffect)(()=>{g&&N(g)},[g]),(0,a.useEffect)(()=>{t&&!j&&(Y(),Z()),t&&Z()},[t]),(0,a.useEffect)(()=>{fetch("/api/settings").then(e=>e.json()).then(e=>{q(!!e.ccFilterNaming)}).catch(()=>{})},[]);let J=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(()=>{})},Z=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(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&&x(e.alias,s)}});let s=t.ANTHROPIC_AUTH_TOKEN;s&&u?.some(e=>e.key===s)&&L(s)}},[j,u,e.defaultModels,x]);let Y=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=z||m;return e.endsWith("/v1")?e:`${e}/v1`},X=async()=>{C(!0),E(null);try{let t={ANTHROPIC_BASE_URL:V()},s=$?.trim()||(u?.length>0?u[0].key:null)||(h?null:"sk_9router");s&&(t.ANTHROPIC_AUTH_TOKEN=s),e.defaultModels.forEach(e=>{let s=c[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)}},Q=async()=>{_(!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=>x(e.alias,e.defaultValue||"")),L("")):E({type:"error",text:s.error||"Failed to reset settings"})}catch(e){E({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-center justify-between hover:cursor-pointer",onClick:s,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:"/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 items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===G&&(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"===G&&(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"===G&&(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 items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",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 installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Claude CLI to use this feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>I(!O),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:O?"expand_less":"help"}),O?"Hide":"How to Install"]})]}),O&&(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:"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:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:j.settings.env.ANTHROPIC_BASE_URL})]}),(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:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(f=z||m).endsWith("/v1")?f:`${f}/v1`,onChange:e=>B(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),z&&z!==m&&(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:"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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),u.length>0?(0,l.jsx)("select",{value:$,onChange:e=>L(e.target.value),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:u.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:h?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),e.defaultModels.map(e=>(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:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:c[e.alias]||"",onChange:t=>x(e.alias,t.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{T(e.alias),M(!0)},disabled:!p,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${p?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),c[e.alias]&&(0,l.jsx)("button",{onClick:()=>x(e.alias,""),className:"p-1 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"})})]},e.alias)),(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:"Filter naming"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",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:J,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:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:X,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:Q,disabled:!j?.has9Router,loading:S,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:()=>F(!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:()=>M(!1),onSelect:e=>{P&&x(P,e.value)},selectedModel:P?c[P]:null,activeProviders:d,modelAliases:U,title:`Select model for ${P}`}),(0,l.jsx)(r.uR,{isOpen:D,onClose:()=>F(!1),title:"Claude CLI - Manual Configuration",configs:(y=$&&$.trim()?$:h?"<API_KEY_FROM_DASHBOARD>":"sk_9router",b={ANTHROPIC_BASE_URL:V(),ANTHROPIC_AUTH_TOKEN:y},e.defaultModels.forEach(e=>{let t=c[e.alias];t&&e.envKey&&(b[e.envKey]=t)}),[{filename:"~/.claude/settings.json",content:JSON.stringify({env:b},null,2)}])})]})}function d({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:c,cloudEnabled:x,initialStatus:m}){let p,u,h,[g,f]=(0,a.useState)(m||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)(!1),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(""),[R,M]=(0,a.useState)(!1),[P,T]=(0,a.useState)({}),[$,L]=(0,a.useState)(!1),[U,K]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!A&&E(o[0].key)},[o,A]),(0,a.useEffect)(()=>{m&&f(m)},[m]),(0,a.useEffect)(()=>{t&&!g&&(B(),D()),t&&D()},[t]);let D=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&T(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(g?.config){let e=g.config.match(/^model\s*=\s*"([^"]+)"/m);e&&I(e[1])}},[g]);let F=g?.installed?g.config?g.config.includes(n)||g.config.includes("localhost")||g.config.includes("127.0.0.1")?"configured":"other":"not_configured":null,z=()=>{let e=U||`${n}/v1`;return e.endsWith("/v1")?e:`${e}/v1`},B=async()=>{b(!0);try{let e=await fetch("/api/cli-tools/codex-settings"),t=await e.json();f(t)}catch(e){f({installed:!1,error:e.message})}finally{b(!1)}},H=async()=>{N(!0),C(null);try{let e=A&&A.trim()||x?A:"sk_9router",t=await fetch("/api/cli-tools/codex-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:z(),apiKey:e,model:O})}),s=await t.json();t.ok?(C({type:"success",text:"Settings applied successfully!"}),B()):C({type:"error",text:s.error||"Failed to apply settings"})}catch(e){C({type:"error",text:e.message})}finally{N(!1)}},q=async()=>{w(!0),C(null);try{let e=await fetch("/api/cli-tools/codex-settings",{method:"DELETE"}),t=await e.json();e.ok?(C({type:"success",text:"Settings reset successfully!"}),I(""),B()):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-center justify-between hover:cursor-pointer",onClick:s,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:"/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 items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===F&&(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"===F&&(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"===F&&(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 Codex CLI..."})]}),!y&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",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 installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Codex CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>_(!S),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:S?"expand_less":"help"}),S?"Hide":"How to Install"]})]}),S&&(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.']})})]})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.config&&((u=(p=g.config.match(/base_url\s*=\s*"([^"]+)"/))?p[1]:null)?(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:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:u})]}):null),(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:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:U||`${n}/v1`,onChange:e=>K(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),U&&U!==`${n}/v1`&&(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:"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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:A,onChange:e=>E(e.target.value),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:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(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:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O,onChange:e=>I(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>M(!0),disabled:!c?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${c?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),O&&(0,l.jsx)("button",{onClick:()=>I(""),className:"p-1 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"})})]})]}),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:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:H,disabled:!A||!O,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:q,disabled:!g.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:()=>M(!1),onSelect:e=>{I(e.value),M(!1)},selectedModel:O,activeProviders:c,modelAliases:P,title:"Select Model for Codex"}),(0,l.jsx)(r.uR,{isOpen:$,onClose:()=>L(!1),title:"Codex CLI - Manual Configuration",configs:(h=A&&A.trim()?A:x?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.codex/config.toml",content:`# 9Router Configuration for Codex CLI
|
|
2
|
+
model = "${O}"
|
|
3
|
+
model_provider = "9router"
|
|
4
|
+
|
|
5
|
+
[model_providers.9router]
|
|
6
|
+
name = "9Router"
|
|
7
|
+
base_url = "${z()}"
|
|
8
|
+
wire_api = "responses"
|
|
9
|
+
`},{filename:"~/.codex/auth.json",content:JSON.stringify({OPENAI_API_KEY:h},null,2)}])})]})}let c=s(89651).env.NEXT_PUBLIC_CLOUD_URL;function x({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:m,cloudEnabled:p,initialStatus:u}){let h,g,f,y,[b,j]=(0,a.useState)(u||null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)(""),[I,R]=(0,a.useState)(""),[M,P]=(0,a.useState)(!1),[T,$]=(0,a.useState)({}),[L,U]=(0,a.useState)(!1),[K,D]=(0,a.useState)(""),F=(0,a.useRef)(!1),z=(()=>{if(!b?.installed)return null;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);if(!e)return"not_configured";let t=e.baseUrl?.includes("localhost")||e.baseUrl?.includes("127.0.0.1"),s=p&&c&&e.baseUrl?.startsWith(c),l=n&&e.baseUrl?.startsWith(n);return t||s||l?"configured":"other"})();(0,a.useEffect)(()=>{d?.length>0&&!E&&O(d[0].key)},[d,E]),(0,a.useEffect)(()=>{u&&j(u)},[u]),(0,a.useEffect)(()=>{t&&!b&&(H(),B()),t&&B()},[t]);let B=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&$(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}};(0,a.useEffect)(()=>{if(b?.installed&&!F.current){F.current=!0;let e=b.settings?.customModels?.find(e=>"custom:9Router-0"===e.id);e&&(e.model&&R(e.model),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&O(e.apiKey))}},[b,d]);let H=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)}},q=()=>{let e=K||n;return e.endsWith("/v1")?e:`${e}/v1`},W=async()=>{k(!0),A(null);try{let e=E?.trim()||(d?.length>0?d[0].key:null)||(p?null:"sk_9router"),t=await fetch("/api/cli-tools/droid-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:q(),apiKey:e,model:I})}),s=await t.json();t.ok?(A({type:"success",text:"Settings applied successfully!"}),H()):A({type:"error",text:s.error||"Failed to apply settings"})}catch(e){A({type:"error",text:e.message})}finally{k(!1)}},G=async()=>{S(!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!"}),R(""),O(""),H()):A({type:"error",text:t.error||"Failed to reset settings"})}catch(e){A({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-center justify-between hover:cursor-pointer",onClick:s,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:"/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 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:[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 items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",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 installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Factory Droid CLI to use this feature."})]})]}),!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=>"custom:9Router-0"===e.id)?.baseUrl&&(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:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:b.settings.customModels.find(e=>"custom:9Router-0"===e.id).baseUrl})]}),(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:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(h=K||n).endsWith("/v1")?h:`${h}/v1`,onChange:e=>D(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),K&&K!==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:"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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:E,onChange:e=>O(e.target.value),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:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:p?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(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:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:I,onChange:e=>R(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>P(!0),disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),I&&(0,l.jsx)("button",{onClick:()=>R(""),className:"p-1 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.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:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:W,disabled:!I,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:G,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:()=>U(!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:M,onClose:()=>P(!1),onSelect:e=>{R(e.value),P(!1)},selectedModel:I,activeProviders:m,modelAliases:T,title:"Select Model for Factory Droid"}),(0,l.jsx)(r.uR,{isOpen:L,onClose:()=>U(!1),title:"Factory Droid - Manual Configuration",configs:(g=E&&E.trim()?E:p?"<API_KEY_FROM_DASHBOARD>":"sk_9router",f={customModels:[{model:I||"provider/model-id",id:"custom:9Router-0",index:0,baseUrl:q(),apiKey:g,displayName:I||"provider/model-id",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 m({tool:e,isExpanded:t,onToggle:s,baseUrl:n,hasActiveProviders:o,apiKeys:d,activeProviders:c,cloudEnabled:x,initialStatus:p}){let u,h,[g,f]=(0,a.useState)(p||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)(""),[O,I]=(0,a.useState)({}),[R,M]=(0,a.useState)(null),[P,T]=(0,a.useState)(!1),[$,L]=(0,a.useState)({}),[U,K]=(0,a.useState)(!1),[D,F]=(0,a.useState)(""),z=(0,a.useRef)(!1),B=(()=>{if(!g?.installed)return null;let e=g.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,S]),(0,a.useEffect)(()=>{p&&f(p)},[p]),(0,a.useEffect)(()=>{t&&!g&&(q(),H()),t&&H()},[t]);let H=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(g?.installed&&!z.current){z.current=!0;let e=g.settings?.models?.providers?.["9router"];if(e){let t=g.settings?.agents?.defaults?.model?.primary;t&&E(t.replace("9router/","")),e.apiKey&&d?.some(t=>t.key===e.apiKey)&&_(e.apiKey)}let t=g.agents||[],s={};t.forEach(e=>{e.currentModel&&(s[e.id]=e.currentModel)}),I(s)}},[g,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"),G=()=>{let e=D||W();return e.endsWith("/v1")?e:`${e}/v1`},J=async()=>{N(!0),C(null);try{let e=S?.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:G(),apiKey:e,model:A,agentModels:O})}),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)}},Z=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(""),_(""),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-center justify-between hover:cursor-pointer",onClick:s,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:"/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 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&&g&&!g.installed&&(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",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 installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install Open Claw CLI to use this feature."})]})]}),!y&&g?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[g?.settings?.models?.providers?.["9router"]?.baseUrl&&(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:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:g.settings.models.providers["9router"].baseUrl})]}),(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:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:(u=D||W()).endsWith("/v1")?u:`${u}/v1`,onChange:e=>F(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),D&&D!==n&&(0,l.jsx)("button",{onClick:()=>F(""),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:"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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),d.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),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:d.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:x?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(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:"Default Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{M(null),T(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 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"})})]}),(g.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 text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:O[e.id]||"",onChange:t=>I(s=>({...s,[e.id]:t.target.value})),placeholder:`default (${A||"provider/model-id"})`,className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>{M(e.id),T(!0)},disabled:!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${o?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),O[e.id]&&(0,l.jsx)("button",{onClick:()=>I(t=>({...t,[e.id]:""})),className:"p-1 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"})})]},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:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:J,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:Z,disabled:!g?.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:()=>K(!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:P,onClose:()=>T(!1),onSelect:e=>{R?(I(t=>({...t,[R]:e.value})),M(null)):E(e.value),T(!1)},selectedModel:A,activeProviders:c,modelAliases:$,title:"Select Model for Open Claw"}),(0,l.jsx)(r.uR,{isOpen:U,onClose:()=>K(!1),title:"Open Claw - Manual Configuration",configs:(h=S&&S.trim()?S: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:G(),apiKey:h,api:"openai-completions",models:[{id:A||"provider/model-id",name:(A||"provider/model-id").split("/").pop()}]}}}},null,2)}])})]})}function p({toolId:e,tool:t,isExpanded:s,onToggle:n,baseUrl:o,apiKeys:d,activeProviders:c=[],cloudEnabled:x=!1,tunnelEnabled:m=!1}){let[u,h]=(0,a.useState)(null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(""),[j,N]=(0,a.useState)(()=>d?.length>0?d[0].key:""),v=e=>{let t=j&&j.trim()?j:x?"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,y||"provider/model-id")},w=async(e,t)=>{await navigator.clipboard.writeText(v(e)),h(t),setTimeout(()=>h(null),2e3)},k=c.length>0,C=()=>(!t.requiresExternalUrl||!!x||!!m)&&(!t.requiresCloud||!!x);return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-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&&(x||m))return null;let s="warning"===e.type,a="cloudCheck"===e.type&&!x&&!m,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,C()&&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 items-center gap-2",children:d&&d.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("select",{value:j,onChange:e=>N(e.target.value),className:"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:()=>w(j,"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:x?"No API keys - Create one in Keys page":"sk_9router"})}),"modelSelector"===e.type&&(0,l.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,l.jsx)("input",{type:"text",value:y,onChange:e=>b(e.target.value),placeholder:"provider/model-id",className:"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:()=>f(!0),disabled:!k,className:`shrink-0 px-3 py-2 rounded-lg border text-sm transition-colors ${k?"bg-bg-secondary border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),y&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("button",{onClick:()=>w(y,"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:()=>b(""),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 items-center gap-2",children:[(0,l.jsx)("code",{className:"flex-1 px-3 py-2 bg-bg-secondary rounded-lg text-sm font-mono border border-border truncate",children:v(e.value)}),e.copyable&&(0,l.jsx)("button",{onClick:()=>w(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)),C()&&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:()=>w(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:v(t.codeBlock.code)})})]})]}):(0,l.jsx)("p",{className:"text-text-muted text-sm",children:"Coming soon..."})}),(0,l.jsx)(r.rq,{isOpen:g,onClose:()=>f(!1),onSelect:e=>{b(e.value)},selectedModel:y,activeProviders:c,title:"Select Model"})]})}function u({tool:e,isExpanded:t,onToggle:s,baseUrl:n,apiKeys:o,activeProviders:d,cloudEnabled:c,initialStatus:x}){let m,[p,h]=(0,a.useState)(x||null),[g,f]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[j,N]=(0,a.useState)(!1),[v,w]=(0,a.useState)(null),[k,C]=(0,a.useState)(!1),[S,_]=(0,a.useState)(""),[A,E]=(0,a.useState)(""),[O,I]=(0,a.useState)(!1),[R,M]=(0,a.useState)({}),[P,T]=(0,a.useState)(!1),[$,L]=(0,a.useState)("");(0,a.useEffect)(()=>{o?.length>0&&!S&&_(o[0].key)},[o,S]),(0,a.useEffect)(()=>{x&&h(x)},[x]),(0,a.useEffect)(()=>{t&&!p&&(F(),U()),t&&U()},[t]),(0,a.useEffect)(()=>{p?.config?.model?.startsWith("9router/")&&E(p.config.model.replace("9router/",""))},[p]);let U=async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&M(t.aliases||{})}catch(e){console.log("Error fetching model aliases:",e)}},K=(()=>{if(!p?.installed)return null;if(!p.config)return"not_configured";let e=p.config?.provider?.["9router"]?.options?.baseURL||"",t=e.includes("localhost")||e.includes("127.0.0.1");return p.has9Router&&(t||e.includes(n))?"configured":p.has9Router?"other":"not_configured"})(),D=()=>{let e=$||n;return e.endsWith("/v1")?e:`${e}/v1`},F=async()=>{f(!0);try{let e=await fetch("/api/cli-tools/opencode-settings"),t=await e.json();h(t)}catch(e){h({installed:!1,error:e.message})}finally{f(!1)}},z=async()=>{b(!0),w(null);try{let e=S&&S.trim()||c?S:"sk_9router",t=await fetch("/api/cli-tools/opencode-settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:D(),apiKey:e,model:A})}),s=await t.json();t.ok?(w({type:"success",text:"Settings applied successfully!"}),F()):w({type:"error",text:s.error||"Failed to apply settings"})}catch(e){w({type:"error",text:e.message})}finally{b(!1)}},B=async()=>{N(!0),w(null);try{let e=await fetch("/api/cli-tools/opencode-settings",{method:"DELETE"}),t=await e.json();e.ok?(w({type:"success",text:"Settings reset successfully!"}),E(""),F()):w({type:"error",text:t.error||"Failed to reset settings"})}catch(e){w({type:"error",text:e.message})}finally{N(!1)}};return(0,l.jsxs)(r.Zp,{padding:"xs",className:"overflow-hidden",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between hover:cursor-pointer",onClick:s,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:"/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 items-center gap-2",children:[(0,l.jsx)("h3",{className:"font-medium text-sm",children:e.name}),"configured"===K&&(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"===K&&(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"===K&&(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:[g&&(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..."})]}),!g&&p&&!p.installed&&(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"flex items-center gap-3 p-4 bg-yellow-500/10 border border-yellow-500/30 rounded-lg",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 installed"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Please install OpenCode CLI to use auto-apply feature."})]}),(0,l.jsxs)(r.$n,{variant:"outline",size:"sm",onClick:()=>C(!k),children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px] mr-1",children:k?"expand_less":"help"}),k?"Hide":"How to Install"]})]}),k&&(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."]})]})]})]}),!g&&p?.installed&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[p?.config?.provider?.["9router"]?.options?.baseURL&&(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:"Current"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted truncate",children:p.config.provider["9router"].options.baseURL})]}),(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:"Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:$||`${n}/v1`,onChange:e=>L(e.target.value),placeholder:"https://.../v1",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),$&&$!==`${n}/v1`&&(0,l.jsx)("button",{onClick:()=>L(""),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:"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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),o.length>0?(0,l.jsx)("select",{value:S,onChange:e=>_(e.target.value),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:o.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 text-xs text-text-muted px-2 py-1.5",children:c?"No API keys - Create one in Keys page":"sk_9router (default)"})]}),(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:"Model"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:A,onChange:e=>E(e.target.value),placeholder:"provider/model-id",className:"flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50"}),(0,l.jsx)("button",{onClick:()=>I(!0),disabled:!d?.length,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 whitespace-nowrap ${d?.length?"bg-surface border-border text-text-main hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select Model"}),A&&(0,l.jsx)("button",{onClick:()=>E(""),className:"p-1 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"})})]})]}),v&&(0,l.jsxs)("div",{className:`flex items-center gap-2 px-2 py-1.5 rounded text-xs ${"success"===v.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"===v.type?"check_circle":"error"}),(0,l.jsx)("span",{children:v.text})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsxs)(r.$n,{variant:"primary",size:"sm",onClick:z,disabled:!A,loading:y,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:B,disabled:!p.has9Router,loading:j,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:()=>T(!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:O,onClose:()=>I(!1),onSelect:e=>{E(e.value),I(!1)},selectedModel:A,activeProviders:d,modelAliases:R,title:"Select Model for OpenCode"}),(0,l.jsx)(r.uR,{isOpen:P,onClose:()=>T(!1),title:"OpenCode - Manual Configuration",configs:(m=S&&S.trim()?S:c?"<API_KEY_FROM_DASHBOARD>":"sk_9router",[{filename:"~/.config/opencode/opencode.json",content:JSON.stringify({provider:{"9router":{npm:"@ai-sdk/openai-compatible",options:{baseURL:D(),apiKey:m},models:{[A||"provider/model-id"]:{name:A||"provider/model-id"}}}},model:`9router/${A||"provider/model-id"}`},null,2)}])})]})}let h="http://localhost:20128";function g({apiKeys:e,cloudEnabled:t,onStatusChange:s}){let[i,n]=(0,a.useState)(null),[o,d]=(0,a.useState)(!1),[c,x]=(0,a.useState)(!1),[m,p]=(0,a.useState)(""),[u,f]=(0,a.useState)(""),[y,b]=(0,a.useState)(null),[j,N]=(0,a.useState)(null),[v,w]=(0,a.useState)(h),k="u">typeof navigator&&navigator.userAgent?.includes("Windows"),C=i?.isAdmin!==!1;(0,a.useEffect)(()=>{e?.length>0&&!u&&f(e[0].key)},[e,u]),(0,a.useEffect)(()=>{S()},[]);let S=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:{}})}},_=e=>{k||i?.hasCachedPassword?A(e,""):(b(e),x(!0),N(null))},A=async(s,l)=>{d(!0);try{if("trust-cert"===s)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=u?.trim()||(e?.length>0?e[0].key:null)||(t?null:"sk_9router");await fetch("/api/cli-tools/antigravity-mitm",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({apiKey:s,sudoPassword:l,mitmRouterBaseUrl:v.trim()||h})})}else await fetch("/api/cli-tools/antigravity-mitm",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({sudoPassword:l})});x(!1),p(""),await S()}catch{}finally{d(!1),b(null)}},E=()=>{m.trim()?A(y,m):N("Sudo password is required")},O=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 items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex 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"}),O?(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 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:O}].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:"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:"9Router Base URL"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:v,onChange:e=>w(e.target.value),placeholder:h,disabled:O,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"})]}),!O&&(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:"API Key"}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),e?.length>0?(0,l.jsx)("select",{value:u,onChange:e=>f(e.target.value),className:"flex-1 min-w-0 px-2 py-1.5 bg-surface rounded text-xs border border-border text-text-main focus:outline-none focus:ring-1 focus:ring-primary/50",children:e.map(e=>(0,l.jsx)("option",{value:e.key,children:e.key},e.id))}):(0,l.jsx)("span",{className:"flex-1 px-2 py-1.5 text-xs text-text-muted",children:t?"No API keys — create one in Keys page":"sk_9router (default)"})]})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2 flex-wrap","data-i18n-skip":"true",children:[i?.certExists&&!i?.certTrusted&&(0,l.jsxs)("button",{onClick:()=>_("trust-cert"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-yellow-500/10 border border-yellow-500/30 text-yellow-600 font-medium text-xs flex items-center gap-1.5 hover:bg-yellow-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"verified_user"}),"Trust Cert"]}),O?(0,l.jsxs)("button",{onClick:()=>_("stop"),disabled:o,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop Server"]}):(0,l.jsxs)("button",{onClick:()=>_("start"),disabled:o||k&&!C,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start Server"]}),O&&(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Enable DNS per tool below to activate interception"})]}),k&&!C&&(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:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",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:m,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"!==e.key||o||E()}}),j&&(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:j})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{x(!1),p(""),N(null)},disabled:o,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:E,loading:o,children:"Confirm"})]})]})})]})}function f({tool:e,isExpanded:t,onToggle:s,serverRunning:n,dnsActive:o,hasCachedPassword:d,apiKeys:c,activeProviders:x,hasActiveProviders:m,modelAliases:p={},cloudEnabled:u,onDnsChange:h}){let[g,y]=(0,a.useState)(!1),[b,j]=(0,a.useState)(null),[N,v]=(0,a.useState)(!1),[w,k]=(0,a.useState)(""),[C,S]=(0,a.useState)(null),[_,A]=(0,a.useState)(null),[E,O]=(0,a.useState)({}),[I,R]=(0,a.useState)(!1),[M,P]=(0,a.useState)(null),T="u">typeof navigator&&navigator.userAgent?.includes("Windows");(0,a.useEffect)(()=>{t&&$()},[t]);let $=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&&O(e.aliases)}}catch{}},L=(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]),U=(e,t)=>{O(s=>({...s,[e]:t}))},K=()=>{if(!n)return;let e=o?"disable":"enable";T||d?D(e,""):(S(e),v(!0),A(null))},D=async(t,s)=>{y(!0),j(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&&j(`Restart ${e.name} to apply changes`),v(!1),k(""),h?.(a)}catch{}finally{y(!1),S(null)}},F=()=>{w.trim()?D(C,w):A("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-center justify-between hover:cursor-pointer",onClick:s,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}),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",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:[(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:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"w-36 shrink-0 text-xs font-semibold text-text-main text-right",children:e.name}),(0,l.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[14px]",children:"arrow_forward"}),(0,l.jsx)("input",{type:"text",value:E[e.alias]||"",onChange:t=>U(e.alias,t.target.value),onBlur:t=>{var s,l;return s=e.alias,l=t.target.value,void L({...E,[s]:l})},placeholder:"provider/model-id",disabled:!o,className:`flex-1 px-2 py-1.5 bg-surface rounded border border-border text-xs focus:outline-none focus:ring-1 focus:ring-primary/50 ${!o?"opacity-50 cursor-not-allowed":""}`}),(0,l.jsx)("button",{onClick:()=>{P(e.alias),R(!0)},disabled:!m||!o,className:`px-2 py-1.5 rounded border text-xs transition-colors shrink-0 ${m&&o?"bg-surface border-border hover:border-primary cursor-pointer":"opacity-50 cursor-not-allowed border-border"}`,children:"Select"}),E[e.alias]&&(0,l.jsx)("button",{onClick:()=>{U(e.alias,""),L({...E,[e.alias]:""})},className:"p-1 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"})})]},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 items-start",children:[o?(0,l.jsxs)("button",{onClick:K,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-red-500/10 border border-red-500/30 text-red-500 font-medium text-xs flex items-center gap-1.5 hover:bg-red-500/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"stop_circle"}),"Stop DNS"]}):(0,l.jsxs)("button",{onClick:K,disabled:!n||g,className:"px-4 py-1.5 rounded-lg bg-primary/10 border border-primary/30 text-primary font-medium text-xs flex items-center gap-1.5 hover:bg-primary/20 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"play_circle"}),"Start DNS"]}),b&&(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:b})]})]})]})]}),N&&(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:"bg-surface border border-border rounded-xl p-6 w-full max-w-sm flex flex-col gap-4 shadow-xl",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:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||g||F()}}),_&&(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:_})]}),(0,l.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,l.jsx)(r.$n,{variant:"ghost",size:"sm",onClick:()=>{v(!1),k(""),A(null)},disabled:g,children:"Cancel"}),(0,l.jsx)(r.$n,{variant:"primary",size:"sm",onClick:F,loading:g,children:"Confirm"})]})]})}),(0,l.jsx)(r.rq,{isOpen:I,onClose:()=>R(!1),onSelect:e=>{if(!M||e.isPlaceholder)return;let t={...E,[M]:e.value};O(t),L(t)},selectedModel:M?E[M]:null,activeProviders:x,modelAliases:p,title:`Select model for ${M}`})]})}},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",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"},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:`{
|
|
10
|
+
"apiBase": "{{baseUrl}}",
|
|
11
|
+
"title": "{{model}}",
|
|
12
|
+
"model": "{{model}}",
|
|
13
|
+
"provider": "openai",
|
|
14
|
+
"apiKey": "{{apiKey}}"
|
|
15
|
+
}`}}}}}]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8035],{64795:(e,t,s)=>{"use strict";s.d(t,{default:()=>c});var l=s(73365),a=s(1521),r=s(86447),i=s.n(r),n=s(74156),o=s(96459);let d=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}];function c({machineId:e}){let[t,s]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),[m,x]=(0,a.useState)(!1),[h,u]=(0,a.useState)(""),[p,y]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[f,j]=(0,a.useState)(!1),[k,v]=(0,a.useState)(""),[N,w]=(0,a.useState)(""),[C,S]=(0,a.useState)(""),[T,A]=(0,a.useState)(!1),[E,P]=(0,a.useState)(""),[$,_]=(0,a.useState)(null),[I,O]=(0,a.useState)(!1),[U,D]=(0,a.useState)(!1),[K,R]=(0,a.useState)(new Set),{copied:q,copy:W}=(0,o.C)();(0,a.useEffect)(()=>{J(),F()},[]);let F=async()=>{try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status")]);if(e.ok){let t=await e.json();g(t.requireApiKey||!1)}if(t.ok){let e=await t.json();j(e.enabled||!1),v(e.tunnelUrl||""),w(e.publicUrl||""),S(e.shortId||"")}}catch(e){console.log("Error loading settings:",e)}},L=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:e})})).ok&&g(e)}catch(e){console.log("Error updating requireApiKey:",e)}},J=async()=>{try{let e=await fetch("/api/keys"),t=await e.json();e.ok&&s(t.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{i(!1)}},z=async()=>{D(!1),A(!0),_(null),P("Connecting to server...");let e=[{delay:2e3,msg:"Creating tunnel..."},{delay:5e3,msg:"Starting cloudflared..."},{delay:15e3,msg:"Establishing connections..."},{delay:3e4,msg:"Waiting for tunnel ready..."}].map(({delay:e,msg:t})=>setTimeout(()=>P(t),e));try{let t=new AbortController,s=setTimeout(()=>t.abort(),9e4),l=await fetch("/api/tunnel/enable",{method:"POST",signal:t.signal});clearTimeout(s),e.forEach(clearTimeout);let a=await l.json();l.ok?(j(!0),v(a.tunnelUrl||""),w(a.publicUrl||""),S(a.shortId||""),_({type:"success",message:"Tunnel connected!"})):_({type:"error",message:a.error||"Failed to enable tunnel"})}catch(t){e.forEach(clearTimeout),_({type:"error",message:t?.name==="AbortError"?"Tunnel creation timed out":t.message})}finally{A(!1),P("")}},H=async()=>{A(!0),_(null);try{let e=await fetch("/api/tunnel/disable",{method:"POST"}),t=await e.json();e.ok?(j(!1),v(""),w(""),_({type:"success",message:"Tunnel disabled"}),O(!1)):_({type:"error",message:t.error||"Failed to disable tunnel"})}catch(e){_({type:"error",message:e.message})}finally{A(!1)}},M=async()=>{if(h.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})}),t=await e.json();e.ok&&(y(t.key),await J(),u(""),x(!1))}catch(e){console.log("Error creating key:",e)}},Q=async e=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&(s(t.filter(t=>t.id!==e)),R(t=>{let s=new Set(t);return s.delete(e),s}))}catch(e){console.log("Error deleting key:",e)}},Z=async(e,t)=>{try{(await fetch(`/api/keys/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&s(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error toggling key:",e)}},[B,G]=(0,a.useState)("/v1");if((0,a.useEffect)(()=>{G(`${window.location.origin}/v1`)},[]),r)return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsx)(n.Qv,{}),(0,l.jsx)(n.Qv,{})]});let V=f&&N?`${N}/v1`:B;return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsxs)(n.Zp,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:f?"Using Tunnel":"Using Local Server"})]}),(0,l.jsx)("div",{className:"flex items-center gap-2",children:f?(0,l.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>O(!0),disabled:T,className:"bg-red-500/10! text-red-500! hover:bg-red-500/20! border-red-500/30!",children:"Disable Tunnel"}):(0,l.jsx)(n.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>{b?D(!0):_({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},disabled:T,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:T?(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),E||"Creating tunnel..."]}):"Enable Tunnel"})})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.pd,{value:V,readOnly:!0,className
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8035],{64795:(e,t,s)=>{"use strict";s.d(t,{default:()=>c});var l=s(73365),a=s(1521),r=s(86447),i=s.n(r),n=s(74156),o=s(96459);let d=[{icon:"public",title:"Access Anywhere",desc:"Use your API from any network"},{icon:"group",title:"Share Endpoint",desc:"Share URL with team members"},{icon:"code",title:"Use in Cursor/Cline",desc:"Connect AI tools remotely"},{icon:"lock",title:"Encrypted",desc:"End-to-end TLS via Cloudflare"}];function c({machineId:e}){let[t,s]=(0,a.useState)([]),[r,i]=(0,a.useState)(!0),[m,x]=(0,a.useState)(!1),[h,u]=(0,a.useState)(""),[p,y]=(0,a.useState)(null),[b,g]=(0,a.useState)(!1),[f,j]=(0,a.useState)(!1),[k,v]=(0,a.useState)(""),[N,w]=(0,a.useState)(""),[C,S]=(0,a.useState)(""),[T,A]=(0,a.useState)(!1),[E,P]=(0,a.useState)(""),[$,_]=(0,a.useState)(null),[I,O]=(0,a.useState)(!1),[U,D]=(0,a.useState)(!1),[K,R]=(0,a.useState)(new Set),{copied:q,copy:W}=(0,o.C)();(0,a.useEffect)(()=>{J(),F()},[]);let F=async()=>{try{let[e,t]=await Promise.all([fetch("/api/settings"),fetch("/api/tunnel/status")]);if(e.ok){let t=await e.json();g(t.requireApiKey||!1)}if(t.ok){let e=await t.json();j(e.enabled||!1),v(e.tunnelUrl||""),w(e.publicUrl||""),S(e.shortId||"")}}catch(e){console.log("Error loading settings:",e)}},L=async e=>{try{(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireApiKey:e})})).ok&&g(e)}catch(e){console.log("Error updating requireApiKey:",e)}},J=async()=>{try{let e=await fetch("/api/keys"),t=await e.json();e.ok&&s(t.keys||[])}catch(e){console.log("Error fetching data:",e)}finally{i(!1)}},z=async()=>{D(!1),A(!0),_(null),P("Connecting to server...");let e=[{delay:2e3,msg:"Creating tunnel..."},{delay:5e3,msg:"Starting cloudflared..."},{delay:15e3,msg:"Establishing connections..."},{delay:3e4,msg:"Waiting for tunnel ready..."}].map(({delay:e,msg:t})=>setTimeout(()=>P(t),e));try{let t=new AbortController,s=setTimeout(()=>t.abort(),9e4),l=await fetch("/api/tunnel/enable",{method:"POST",signal:t.signal});clearTimeout(s),e.forEach(clearTimeout);let a=await l.json();l.ok?(j(!0),v(a.tunnelUrl||""),w(a.publicUrl||""),S(a.shortId||""),_({type:"success",message:"Tunnel connected!"})):_({type:"error",message:a.error||"Failed to enable tunnel"})}catch(t){e.forEach(clearTimeout),_({type:"error",message:t?.name==="AbortError"?"Tunnel creation timed out":t.message})}finally{A(!1),P("")}},H=async()=>{A(!0),_(null);try{let e=await fetch("/api/tunnel/disable",{method:"POST"}),t=await e.json();e.ok?(j(!1),v(""),w(""),_({type:"success",message:"Tunnel disabled"}),O(!1)):_({type:"error",message:t.error||"Failed to disable tunnel"})}catch(e){_({type:"error",message:e.message})}finally{A(!1)}},M=async()=>{if(h.trim())try{let e=await fetch("/api/keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:h})}),t=await e.json();e.ok&&(y(t.key),await J(),u(""),x(!1))}catch(e){console.log("Error creating key:",e)}},Q=async e=>{if(confirm("Delete this API key?"))try{(await fetch(`/api/keys/${e}`,{method:"DELETE"})).ok&&(s(t.filter(t=>t.id!==e)),R(t=>{let s=new Set(t);return s.delete(e),s}))}catch(e){console.log("Error deleting key:",e)}},Z=async(e,t)=>{try{(await fetch(`/api/keys/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&s(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error toggling key:",e)}},[B,G]=(0,a.useState)("/v1");if((0,a.useEffect)(()=>{G(`${window.location.origin}/v1`)},[]),r)return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsx)(n.Qv,{}),(0,l.jsx)(n.Qv,{})]});let V=f&&N?`${N}/v1`:B;return(0,l.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,l.jsxs)(n.Zp,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"API Endpoint"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:f?"Using Tunnel":"Using Local Server"})]}),(0,l.jsx)("div",{className:"flex items-center gap-2",children:f?(0,l.jsx)(n.$n,{size:"sm",variant:"secondary",icon:"cloud_off",onClick:()=>O(!0),disabled:T,className:"bg-red-500/10! text-red-500! hover:bg-red-500/20! border-red-500/30!",children:"Disable Tunnel"}):(0,l.jsx)(n.$n,{variant:"primary",icon:"cloud_upload",onClick:()=>{b?D(!0):_({type:"error",message:'Security required: Enable "Require API key" before activating the tunnel.'})},disabled:T,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600",children:T?(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),E||"Creating tunnel..."]}):"Enable Tunnel"})})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.pd,{value:V,readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,l.jsx)(n.$n,{variant:"secondary",icon:"endpoint_url"===q?"check":"content_copy",onClick:()=>W(V,"endpoint_url"),children:"endpoint_url"===q?"Copied!":"Copy"})]}),$&&(0,l.jsx)("div",{className:`mt-3 p-2 rounded text-sm ${"success"===$.type?"bg-green-500/10 text-green-600 dark:text-green-400":"warning"===$.type?"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400":"bg-red-500/10 text-red-600 dark:text-red-400"}`,children:$.message})]}),(0,l.jsxs)(n.Zp,{children:[(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsx)("h2",{className:"text-lg font-semibold",children:"API Keys"}),(0,l.jsx)(n.$n,{icon:"add",onClick:()=>x(!0),children:"Create Key"})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between pb-4 mb-4 border-b border-border",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"font-medium",children:"Require API key"}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Requests without a valid key will be rejected"})]}),(0,l.jsx)(n.lM,{checked:b,onChange:()=>L(!b)})]}),0===t.length?(0,l.jsxs)("div",{className:"text-center py-12",children:[(0,l.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:"vpn_key"})}),(0,l.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No API keys yet"}),(0,l.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Create your first API key to get started"}),(0,l.jsx)(n.$n,{icon:"add",onClick:()=>x(!0),children:"Create Key"})]}):(0,l.jsx)("div",{className:"flex flex-col",children:t.map(e=>{var t;return(0,l.jsxs)("div",{className:`group flex items-center justify-between py-3 border-b border-black/[0.03] dark:border-white/[0.03] last:border-b-0 ${!1===e.isActive?"opacity-60":""}`,children:[(0,l.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,l.jsx)("p",{className:"text-sm font-medium",children:e.name}),(0,l.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,l.jsx)("code",{className:"text-xs text-text-muted font-mono",children:K.has(e.id)?e.key:(t=e.key)?t.length>8?t.slice(0,8)+"...":t:""}),(0,l.jsx)("button",{onClick:()=>{var t;return t=e.id,void R(e=>{let s=new Set(e);return s.has(t)?s.delete(t):s.add(t),s})},className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",title:K.has(e.id)?"Hide key":"Show key",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:K.has(e.id)?"visibility_off":"visibility"})}),(0,l.jsx)("button",{onClick:()=>W(e.key,e.id),className:"p-1 hover:bg-black/5 dark:hover:bg-white/5 rounded text-text-muted hover:text-primary opacity-0 group-hover:opacity-100 transition-all",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:q===e.id?"check":"content_copy"})})]}),(0,l.jsxs)("p",{className:"text-xs text-text-muted mt-1",children:["Created ",new Date(e.createdAt).toLocaleDateString()]}),!1===e.isActive&&(0,l.jsx)("p",{className:"text-xs text-orange-500 mt-1",children:"Paused"})]}),(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[(0,l.jsx)(n.lM,{size:"sm",checked:e.isActive??!0,onChange:t=>{e.isActive&&!t?confirm(`Pause API key "${e.name}"?
|
|
2
2
|
|
|
3
3
|
This key will stop working immediately but can be resumed later.`)&&Z(e.id,t):Z(e.id,t)},title:e.isActive?"Pause key":"Resume key"}),(0,l.jsx)("button",{onClick:()=>Q(e.id),className:"p-2 hover:bg-red-500/10 rounded text-red-500 opacity-0 group-hover:opacity-100 transition-all",children:(0,l.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]})]},e.id)})})]}),(0,l.jsx)(n.aF,{isOpen:m,title:"Create API Key",onClose:()=>{x(!1),u("")},children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)(n.pd,{label:"Key Name",value:h,onChange:e=>u(e.target.value),placeholder:"Production Key"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.$n,{onClick:M,fullWidth:!0,disabled:!h.trim(),children:"Create"}),(0,l.jsx)(n.$n,{onClick:()=>{x(!1),u("")},variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,l.jsx)(n.aF,{isOpen:!!p,title:"API Key Created",onClose:()=>y(null),children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsxs)("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4",children:[(0,l.jsx)("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 mb-2 font-medium",children:"Save this key now!"}),(0,l.jsx)("p",{className:"text-sm text-yellow-700 dark:text-yellow-300",children:"This is the only time you will see this key. Store it securely."})]}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.pd,{value:p||"",readOnly:!0,className:"flex-1 font-mono text-sm"}),(0,l.jsx)(n.$n,{variant:"secondary",icon:"created_key"===q?"check":"content_copy",onClick:()=>W(p,"created_key"),children:"created_key"===q?"Copied!":"Copy"})]}),(0,l.jsx)(n.$n,{onClick:()=>y(null),fullWidth:!0,children:"Done"})]})}),(0,l.jsx)(n.aF,{isOpen:U,title:"Enable Tunnel",onClose:()=>D(!1),children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-blue-600 dark:text-blue-400",children:"cloud_upload"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium mb-1",children:"Cloudflare Tunnel"}),(0,l.jsx)("p",{className:"text-sm text-blue-700 dark:text-blue-300",children:"Expose your local 9Router to the internet. No port forwarding, no static IP needed. Share endpoint URL with your team or use it in Cursor, Cline, and other AI tools from anywhere."})]})]})}),(0,l.jsx)("div",{className:"grid grid-cols-2 gap-3",children:d.map(e=>(0,l.jsxs)("div",{className:"flex flex-col items-center text-center p-3 rounded-lg bg-sidebar/50",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-xl text-primary mb-1",children:e.icon}),(0,l.jsx)("p",{className:"text-xs font-semibold",children:e.title}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:e.desc})]},e.title))}),(0,l.jsx)("p",{className:"text-xs text-text-muted",children:"Requires outbound port 7844 (TCP/UDP). Connection may take 10-30s."}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.$n,{onClick:z,fullWidth:!0,className:"bg-linear-to-r from-primary to-blue-500 hover:from-primary-hover hover:to-blue-600 text-white!",children:"Start Tunnel"}),(0,l.jsx)(n.$n,{onClick:()=>D(!1),variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}),(0,l.jsx)(n.aF,{isOpen:I,title:"Disable Tunnel",onClose:()=>!T&&O(!1),children:(0,l.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,l.jsx)("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-4",children:(0,l.jsxs)("div",{className:"flex items-start gap-3",children:[(0,l.jsx)("span",{className:"material-symbols-outlined text-red-600 dark:text-red-400",children:"warning"}),(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium mb-1",children:"Warning"}),(0,l.jsx)("p",{className:"text-sm text-red-700 dark:text-red-300",children:"The tunnel will be disconnected. Remote access will stop working."})]})]})}),(0,l.jsx)("p",{className:"text-sm text-text-muted",children:"Are you sure you want to disable the tunnel?"}),(0,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)(n.$n,{onClick:H,fullWidth:!0,disabled:T,className:"bg-red-500! hover:bg-red-600! text-white!",children:T?(0,l.jsxs)("span",{className:"flex items-center gap-2",children:[(0,l.jsx)("span",{className:"material-symbols-outlined animate-spin text-sm",children:"progress_activity"}),"Disabling..."]}):"Disable Tunnel"}),(0,l.jsx)(n.$n,{onClick:()=>O(!1),variant:"ghost",fullWidth:!0,disabled:T,children:"Cancel"})]})]})})]})}c.propTypes={machineId:i().string.isRequired}},78035:(e,t,s)=>{Promise.resolve().then(s.bind(s,64795))}}]);
|
package/app/.next/static/chunks/app/(dashboard)/dashboard/providers/[id]/page-d099eadbb0522614.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2134],{7207:(e,t,s)=>{Promise.resolve().then(s.bind(s,31660))},31660:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>g});var i=s(73365),a=s(1521),r=s(86447),o=s.n(r),n=s(29717),l=s(99568),d=s.n(l),c=s(58872),p=s(74156),x=s(82495),m=s(69633),u=s(96459);let h=new Map,y={"openrouter-free":e=>e.filter(e=>e.pricing?.prompt==="0"&&e.pricing?.completion==="0"&&e.context_length>=2e5).map(e=>({id:e.id,name:e.name,contextLength:e.context_length})).sort((e,t)=>t.contextLength-e.contextLength)};async function f(e){if(!e?.url||!e?.type)return[];let t=h.get(e.url);if(t&&Date.now()<t.expiresAt)return t.data;try{let t=await fetch(e.url);if(!t.ok)return[];let s=await t.json(),i=s.data??s.models??s,a=y[e.type],r=a?a(Array.isArray(i)?i:[]):[];return h.set(e.url,{data:r,expiresAt:Date.now()+6e5}),r}catch{return[]}}function g(){let e=(0,n.useParams)(),t=(0,n.useRouter)(),s=e.id,[r,o]=(0,a.useState)([]),[l,h]=(0,a.useState)(!0),[y,g]=(0,a.useState)(null),[v,N]=(0,a.useState)([]),[A,$]=(0,a.useState)(!1),[P,T]=(0,a.useState)(!1),[O,_]=(0,a.useState)(!1),[R,E]=(0,a.useState)(!1),[I,D]=(0,a.useState)(!1),[U,q]=(0,a.useState)(!1),[M,L]=(0,a.useState)(null),[K,F]=(0,a.useState)({}),[z,J]=(0,a.useState)(!1),[W,V]=(0,a.useState)({}),[Z,B]=(0,a.useState)(""),[G,Q]=(0,a.useState)(null),[H,X]=(0,a.useState)(!1),[Y,ee]=(0,a.useState)([]),[et,es]=(0,a.useState)("__none__"),[ei,ea]=(0,a.useState)(!1),[er,eo]=(0,a.useState)(null),[en,el]=(0,a.useState)(""),[ed,ec]=(0,a.useState)([]),[ep,ex]=(0,a.useState)([]),{copied:em,copy:eu}=(0,u.C)(),eh=y?{id:y.id,name:y.name||("anthropic-compatible"===y.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===y.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===y.type?"AC":"OC",apiType:y.apiType,baseUrl:y.baseUrl,type:y.type}:x.zN[s]||x.fg[s]||x.IS[s]||x.nJ[s],ey=!!x.zN[s]||!!x.IS[s],ef=!!x.IS[s]?.noAuth,eg=(0,m.KC)(s),eb=(0,x.wG)(s),ev=(0,x.mq)(s),ej=(0,x.gb)(s),eN=ev||ej,ek=eN?s:eb,ew=eN?y?.prefix||s:eb,eC=(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"===s&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ex(e.models)}).catch(()=>{})},[s]);let eS=(0,a.useCallback)(async()=>{try{let[e,t,i,a]=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"})]),r=await e.json(),n=await t.json(),l=await i.json(),d=a.ok?await a.json():{};if(e.ok){let e=(r.connections||[]).filter(e=>e.provider===s);o(e)}i.ok&&N(l.proxyPools||[]);let c=(d.providerStrategies||{})[s]||{};if(eo(c.fallbackStrategy||null),el(null!=c.stickyRoundRobinLimit?String(c.stickyRoundRobinLimit):"1"),t.ok){let e=(n.nodes||[]).find(e=>e.id===s)||null;if(!e&&eN)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===s)||null))break}g(e)}}catch(e){console.log("Error fetching connections:",e)}finally{h(!1)}},[s,eN]),eA=async e=>{try{let t=await fetch(`/api/provider-nodes/${s}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),i=await t.json();t.ok&&(g(i.node),await eS(),D(!1))}catch(e){console.log("Error updating provider node:",e)}},e$=async(e,t)=>{try{let i=await fetch("/api/settings",{cache:"no-store"}),a=(i.ok?await i.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let o={...a};0===Object.keys(r).length?delete o[s]:o[s]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:o})})}catch(e){console.log("Error saving provider strategy:",e)}};(0,a.useEffect)(()=>{eS(),eC()},[eS,eC]),(0,a.useEffect)(()=>{let e=(x.zN[s]||x.fg[s]||x.IS[s]||x.nJ[s])?.modelsFetcher;e&&f(e).then(ec)},[s]);let eP=async(e,t,s=eb)=>{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 eC();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},eT=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await eC()}catch(e){console.log("Error deleting alias:",e)}},eO=async e=>{if(confirm("Delete this connection?"))try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&o(r.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}},e_=()=>{eS(),$(!1)},eR=async e=>{try{(await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:s,...e})})).ok&&(await eS(),_(!1))}catch(e){console.log("Error saving connection:",e)}},eE=async e=>{try{(await fetch(`/api/providers/${M.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await eS(),E(!1))}catch(e){console.log("Error updating connection:",e)}},eI=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})})).ok&&o(s=>s.map(s=>s.id===e?{...s,isActive:t}:s))}catch(e){console.log("Error updating connection status:",e)}},eD=async(e,t)=>{let s=[...r];[s[e],s[t]]=[s[t],s[e]],o(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 eS()}},eU=r.filter(e=>Y.includes(e.id));r.length>0&&(Y.length,r.length),(0,a.useEffect)(()=>{ee(e=>e.filter(e=>r.some(t=>t.id===e)))},[r]);let eq=(()=>{if(0===eU.length)return"";let e=new Set(eU.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=v.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),eM=()=>{ei||q(!1)},eL=async()=>{if(0===Y.length)return;let e="__none__"===et?null:et;ea(!0);try{let t=[];for(let s of Y)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 eS(),ee([]),es("__none__"),q(!1)}catch(e){console.log("Error applying bulk proxy pool:",e)}finally{ea(!1)}},eK=(0,i.jsx)("div",{className:"flex flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:r.map((e,t)=>(0,i.jsx)("div",{className:"flex items-stretch",children:(0,i.jsx)("div",{className:"flex-1 min-w-0",children:(0,i.jsx)(k,{connection:e,proxyPools:v,isOAuth:ey,isFirst:0===t,isLast:t===r.length-1,onMoveUp:()=>eD(t,t-1),onMoveDown:()=>eD(t,t+1),onToggleActive:t=>eI(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&&o(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:()=>{L(e),E(!0)},onDelete:()=>eO(e.id)})})},e.id))}),eF=[{value:"__none__",label:"None"},...v.map(e=>({value:e.id,label:e.name}))],ez=0===Y.length?"Select one or more connections, then click Proxy Action.":eq,eJ=Y.length>0&&!ei,eW=(0,i.jsx)(p.aF,{isOpen:U,onClose:eM,title:`Proxy Action (${Y.length} selected)`,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(p.l6,{label:"Proxy Pool",value:et,onChange:e=>es(e.target.value),options:eF,placeholder:"None"}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:ez}),(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 gap-2",children:[(0,i.jsx)(p.$n,{onClick:eL,fullWidth:!0,disabled:!eJ,children:ei?"Applying...":"Apply"}),(0,i.jsx)(p.$n,{onClick:eM,variant:"ghost",fullWidth:!0,disabled:ei,children:"Cancel"})]})]})}),eV=async e=>{if(!G){Q(e);try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${ek}/${e}`})}),s=await t.json();V(t=>({...t,[e]:s.ok?"ok":"error"})),B(s.ok?"":s.error||"Model not reachable")}catch{V(t=>({...t,[e]:"error"})),B("Network error")}finally{Q(null)}}};return l?(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsx)(p.Qv,{}),(0,i.jsx)(p.Qv,{})]}):eh?(0,i.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,i.jsxs)("div",{children:[(0,i.jsxs)(d(),{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 items-center gap-4",children:[(0,i.jsx)("div",{className:"rounded-lg flex items-center justify-center",style:{backgroundColor:`${eh.color}15`},children:z?(0,i.jsx)("span",{className:"text-sm font-bold",style:{color:eh.color},children:eh.textIcon||eh.id.slice(0,2).toUpperCase()}):(0,i.jsx)(c.default,{src:ev&&eh.apiType?"responses"===eh.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":ej?"/providers/anthropic-m.png":`/providers/${eh.id}.png`,alt:eh.name,width:48,height:48,className:"object-contain rounded-lg max-w-[48px] max-h-[48px]",sizes:"48px",onError:()=>J(!0)})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("h1",{className:"text-3xl font-semibold tracking-tight",children:eh.name}),(0,i.jsxs)("p",{className:"text-text-muted",children:[r.length," connection",1===r.length?"":"s"]})]})]})]}),eh.deprecated&&(0,i.jsxs)("div",{className:"flex items-start gap-2 px-3 py-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-black/[0.05] dark:border-white/[0.05]",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted mt-0.5 shrink-0",children:"info"}),(0,i.jsx)("p",{className:"text-xs text-text-muted leading-relaxed",children:eh.deprecationNotice})]}),eh.notice&&!eh.deprecated&&(0,i.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-black/[0.02] dark:bg-white/[0.02] border border-black/[0.05] dark:border-white/[0.05]",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0",children:"info"}),(0,i.jsx)("p",{className:"text-xs text-text-muted leading-relaxed",children:eh.notice.text}),eh.notice.apiKeyUrl&&(0,i.jsx)("a",{href:eh.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline shrink-0",children:"Get API Key →"})]}),eN&&y&&(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:ej?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,i.jsxs)("p",{className:"text-sm text-text-muted",children:[ej?"Messages API":"responses"===y.apiType?"Responses API":"Chat Completions"," \xb7 ",(y.baseUrl||"").replace(/\/$/,""),"/",ej?"messages":"responses"===y.apiType?"responses":"chat/completions"]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>_(!0),disabled:r.length>0,children:"Add"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>D(!0),children:"Edit"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{if(confirm(`Delete this ${ej?"Anthropic":"OpenAI"} Compatible node?`))try{(await fetch(`/api/provider-nodes/${s}`,{method:"DELETE"})).ok&&t.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}},children:"Delete"})]})]}),r.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."})]}),ef?(0,i.jsx)(p.Zp,{children:(0,i.jsxs)("div",{className:"flex items-center gap-3",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-10 h-10 rounded-full bg-green-500/10 text-green-500",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:"lock_open"})}),(0,i.jsxs)("div",{children:[(0,i.jsx)("p",{className:"text-sm font-medium",children:"No authentication required"}),(0,i.jsx)("p",{className:"text-xs text-text-muted",children:"This provider is ready to use."})]})]})}):(0,i.jsxs)(p.Zp,{children:[(0,i.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,i.jsx)(p.lM,{checked:"round-robin"===er,onChange:e=>{let t=e?"round-robin":null,s=e?en||"1":en;e&&!en&&el("1"),eo(t),e$(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;el(t=e.target.value),e$("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===r.length?(0,i.jsxs)("div",{className:"text-center py-12",children:[(0,i.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 text-primary mb-4",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-[32px]",children:ey?"lock":"key"})}),(0,i.jsx)("p",{className:"text-text-main font-medium mb-1",children:"No connections yet"}),(0,i.jsx)("p",{className:"text-sm text-text-muted mb-4",children:"Add your first connection to get started"}),!eN&&(0,i.jsxs)("div",{className:"flex gap-2 justify-center",children:["iflow"===s&&(0,i.jsx)(p.$n,{icon:"cookie",variant:"secondary",onClick:()=>T(!0),children:"Cookie Auth"}),(0,i.jsx)(p.$n,{icon:"add",onClick:()=>ey?$(!0):_(!0),children:"iflow"===s?"OAuth":"Add Connection"})]})]}):(0,i.jsxs)(i.Fragment,{children:[eK,!eN&&(0,i.jsxs)("div",{className:"flex gap-2 mt-4",children:["iflow"===s&&(0,i.jsx)(p.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>T(!0),title:"Add connection using browser cookie",children:"Cookie"}),(0,i.jsx)(p.$n,{size:"sm",icon:"add",onClick:()=>ey?$(!0):_(!0),children:"Add"})]})]})]}),(0,i.jsxs)(p.Zp,{children:[(0,i.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,i.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"})}),!!Z&&(0,i.jsx)("p",{className:"text-xs text-red-500 mb-3 break-words",children:Z}),(()=>{let e,t;if(eN)return(0,i.jsx)(j,{providerStorageAlias:ek,providerDisplayAlias:ew,modelAliases:K,copied:em,onCopy:eu,onSetAlias:eP,onDeleteAlias:eT,connections:r,isAnthropic:ej});let a=[...eg,...ep.filter(e=>!eg.some(t=>t.id===e.id))],o=Object.entries(K).filter(([e,t])=>{let s=`${ek}/`;if(!t.startsWith(s))return!1;let i=t.slice(s.length);return eh.passthroughModels?!eg.some(e=>e.id===i):!eg.some(e=>e.id===i)&&e===i}).map(([e,t])=>({id:t.slice(`${ek}/`.length),alias:e,fullModel:t}));return(0,i.jsxs)("div",{className:"flex flex-wrap gap-3",children:[a.map(e=>{let t=`${ek}/${e.id}`,a=`${s}/${e.id}`,o=Object.entries(K).find(([,e])=>e===t||e===a)?.[0];return(0,i.jsx)(b,{model:e,fullModel:`${ew}/${e.id}`,alias:o,copied:em,onCopy:eu,onSetAlias:t=>eP(e.id,t,ek),onDeleteAlias:()=>eT(o),testStatus:W[e.id],onTest:r.length>0||ef?()=>eV(e.id):void 0,isTesting:G===e.id,isFree:e.isFree},e.id)}),o.map(e=>(0,i.jsx)(b,{model:{id:e.id},fullModel:`${ew}/${e.id}`,alias:e.alias,copied:em,onCopy:eu,onSetAlias:()=>{},onDeleteAlias:()=>eT(e.alias),testStatus:W[e.id],onTest:r.length>0||ef?()=>eV(e.id):void 0,isTesting:G===e.id,isCustom:!0,isFree:!1},e.id)),(0,i.jsxs)("button",{onClick:()=>X(!0),className:"flex items-center gap-1.5 px-3 py-2 rounded-lg border border-dashed border-black/15 dark:border-white/15 text-xs text-text-muted hover:text-primary hover:border-primary/40 transition-colors",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),ed.length>0&&(e=new Set(Object.values(K)),0===(t=ed.filter(t=>!e.has(`${ek}/${t.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:t.map(e=>(0,i.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await eP(e.id,t,ek)},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))})]}))]})})()]}),eW,"kiro"===s?(0,i.jsx)(p.Mh,{isOpen:A,providerInfo:eh,onSuccess:e_,onClose:()=>$(!1)}):"cursor"===s?(0,i.jsx)(p.G9,{isOpen:A,onSuccess:e_,onClose:()=>$(!1)}):"gitlab"===s?(0,i.jsx)(p.vj,{isOpen:A,providerInfo:eh,onSuccess:e_,onClose:()=>$(!1)}):(0,i.jsx)(p.LF,{isOpen:A,provider:s,providerInfo:eh,onSuccess:e_,onClose:()=>$(!1)}),"iflow"===s&&(0,i.jsx)(p.vE,{isOpen:P,onSuccess:()=>{eS(),T(!1)},onClose:()=>T(!1)}),(0,i.jsx)(w,{isOpen:O,provider:s,providerName:eh.name,isCompatible:eN,isAnthropic:ej,proxyPools:v,onSave:eR,onClose:()=>_(!1)}),(0,i.jsx)(p.wI,{isOpen:R,connection:M,proxyPools:v,onSave:eE,onClose:()=>E(!1)}),eN&&(0,i.jsx)(C,{isOpen:I,node:y,onSave:eA,onClose:()=>D(!1),isAnthropic:ej}),!eN&&(0,i.jsx)(S,{isOpen:H,providerAlias:ek,providerDisplayAlias:ew,onSave:async e=>{let t=eh?.passthroughModels?e.split("/").pop():e;await eP(e,t,ek),X(!1)},onClose:()=>X(!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)(d(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}function b({model:e,fullModel:t,alias:s,copied:a,onCopy:r,testStatus:o,isCustom:n,isFree:l,onDeleteAlias:d,onTest:c,isTesting:p}){let x="ok"===o?"#22c55e":"error"===o?"#ef4444":void 0;return(0,i.jsx)("div",{className:`group px-3 py-2 rounded-lg border ${"ok"===o?"border-green-500/40":"error"===o?"border-red-500/40":"border-border"} hover:bg-sidebar/50`,children:(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-base",style:x?{color:x}:void 0,children:"ok"===o?"check_circle":"error"===o?"cancel":"smart_toy"}),(0,i.jsx)("code",{className:"text-xs text-text-muted font-mono bg-sidebar px-1.5 py-0.5 rounded",children:t}),c&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:c,disabled:p,className:`p-0.5 hover:bg-sidebar rounded text-text-muted hover:text-primary transition-opacity ${p?"opacity-100":"opacity-0 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 group/btn",children:[(0,i.jsx)("button",{onClick:()=>r(t,`model-${e.id}`),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: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"})]}),n&&(0,i.jsx)("button",{onClick:d,className:"p-0.5 hover:bg-red-500/10 rounded text-text-muted hover:text-red-500 opacity-0 group-hover:opacity-100 transition-opacity ml-auto",title:"Remove custom model",children:(0,i.jsx)("span",{className:"material-symbols-outlined text-sm",children:"close"})})]})})}function v({modelId:e,fullModel:t,copied:s,onCopy:a,onDeleteAlias:r,onTest:o,testStatus:n,isTesting:l}){let d="ok"===n?"#22c55e":"error"===n?"#ef4444":void 0;return(0,i.jsxs)("div",{className:`flex items-center gap-3 p-3 rounded-lg border ${"ok"===n?"border-green-500/40":"error"===n?"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"===n?"check_circle":"error"===n?"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"})]}),o&&(0,i.jsxs)("div",{className:"relative group/btn",children:[(0,i.jsx)("button",{onClick:o,disabled:l,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:l?{animation:"spin 1s linear infinite"}:void 0,children:l?"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:l?"Testing...":"Test"})]})]})]}),(0,i.jsx)("button",{onClick:r,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 j({providerStorageAlias:e,providerDisplayAlias:t,modelAliases:s,copied:r,onCopy:o,onSetAlias:n,onDeleteAlias:l,connections:d,isAnthropic:c}){let[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null),[N,k]=(0,a.useState)({}),w=async t=>{if(!g){b(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();k(e=>({...e,[t]:i.ok?"ok":"error"}))}catch{k(e=>({...e,[t]:"error"}))}finally{b(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,r=`${e}/${i}`;if(Object.values(s).includes(r))return null;let o=(a=i.split("/"))[a.length-1];if(!s[o])return o;let n=`${t}-${o}`;return s[n]?null:n},A=async()=>{if(!x.trim()||u)return;let t=x.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 n(t,s,e),m("")}catch(e){console.log("Error adding model:",e)}finally{h(!1)}},$=async()=>{if(y)return;let t=d.find(e=>!1!==e.isActive);if(t){f(!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 r=0;for(let t of a){let s=t.id||t.name||t.model;if(!s)continue;let i=S(s);i&&(await n(s,i,e),r+=1)}0===r&&alert("No new models were added.")}catch(e){console.log("Error importing models:",e)}finally{f(!1)}}},P=d.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 ",c?"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:x,onChange:e=>m(e.target.value),onKeyDown:e=>"Enter"===e.key&&A(),placeholder:c?"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)(p.$n,{size:"sm",icon:"add",onClick:A,disabled:!x.trim()||u,children:u?"Adding...":"Add"}),(0,i.jsx)(p.$n,{size:"sm",variant:"secondary",icon:"download",onClick:$,disabled:!P||y,children:y?"Importing...":"Import from /models"})]}),!P&&(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)(v,{modelId:e,fullModel:`${t}/${e}`,copied:r,onCopy:o,onDeleteAlias:()=>l(a),onTest:d.length>0?()=>w(e):void 0,testStatus:N[e],isTesting:g===e},s))})]})}function N({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 k({connection:e,proxyPools:t,isOAuth:s,isFirst:r,isLast:o,onMoveUp:n,onMoveDown:l,onToggleActive:d,onUpdateProxy:c,onEdit:x,onDelete:m}){let[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(!1),g=(0,a.useRef)(null),b=new Map((t||[]).map(e=>[e.id,e])),v=e.providerSpecificData?.proxyPoolId||null,j=v?b.get(v):null,w=e.providerSpecificData?.connectionProxyEnabled===!0&&!!e.providerSpecificData?.connectionProxyUrl,C=!!v||w,S=j?`Pool: ${j.name}`:v?`Pool: ${v} (inactive/missing)`:w?`Legacy: ${e.providerSpecificData?.connectionProxyUrl}`:"",A="";if(j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl){let t=j?.proxyUrl||e.providerSpecificData?.connectionProxyUrl;try{let e=new URL(t);A=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`}catch{A=t}}let $=j?.noProxy||e.providerSpecificData?.connectionNoProxy||"",P="default";j?.isActive===!0?P="success":(v||w)&&(P="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 T=async e=>{f(!0);try{await c("__none__"===e?null:e)}finally{f(!1),h(!1)}},O=s?e.name||e.email||e.displayName||"OAuth Account":e.name,[_,R]=(0,a.useState)(!1),E=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=E?setInterval(t,1e3):null;return()=>{s&&clearInterval(s)}},[E]);let I="unavailable"!==e.testStatus||_?e.testStatus:"active";return(0,i.jsxs)("div",{className:`group flex items-center justify-between p-3 rounded-lg hover:bg-black/[0.02] dark:hover:bg-white/[0.02] transition-colors ${!1===e.isActive?"opacity-60":""}`,children:[(0,i.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,i.jsxs)("div",{className:"flex flex-col",children:[(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_up"})}),(0,i.jsx)("button",{onClick:l,disabled:o,className:`p-0.5 rounded ${o?"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 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:O}),(0,i.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,i.jsx)(p.Ex,{variant:!1===e.isActive?"default":"active"===I||"success"===I?"success":"error"===I||"expired"===I||"unavailable"===I?"error":"default",size:"sm",dot:!0,children:!1===e.isActive?"disabled":I||"Unknown"}),C&&(0,i.jsx)(p.Ex,{variant:P,size:"sm",children:"Proxy"}),_&&!1!==e.isActive&&(0,i.jsx)(N,{until:E}),e.lastError&&!1!==e.isActive&&(0,i.jsx)("span",{className:"text-xs text-red-500 truncate 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:"text-[11px] text-text-muted truncate max-w-[420px]",title:S,children:S}),A&&(0,i.jsx)("code",{className:"text-[10px] font-mono bg-black/5 dark:bg-white/5 px-1 py-0.5 rounded text-text-muted",children:A}),$&&(0,i.jsxs)("span",{className:"text-[11px] text-text-muted truncate max-w-[320px]",title:$,children:["no_proxy: ",$]})]})]})]}),(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsxs)("div",{className:"flex gap-1",children:[(t||[]).length>0&&(0,i.jsxs)("div",{className:"relative",ref:g,children:[(0,i.jsxs)("button",{onClick:()=>h(e=>!e),className:`flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 transition-colors ${C?"text-primary":"text-text-muted hover:text-primary"}`,disabled:y,children:[(0,i.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:y?"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 mt-1 z-50 bg-bg border border-border rounded-lg shadow-lg py-1 min-w-[160px]",children:[(0,i.jsx)("button",{onClick:()=>T("__none__"),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${!v?"text-primary font-medium":"text-text-main"}`,children:"None"}),(t||[]).map(e=>(0,i.jsx)("button",{onClick:()=>T(e.id),className:`w-full text-left px-3 py-1.5 text-sm hover:bg-black/5 dark:hover:bg-white/5 ${v===e.id?"text-primary font-medium":"text-text-main"}`,children:e.name},e.id))]})]}),(0,i.jsxs)("button",{onClick:x,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/5 text-text-muted hover:text-primary",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:m,className:"flex flex-col items-center px-2 py-1 rounded hover:bg-red-500/10 text-red-500",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)(p.lM,{size:"sm",checked:e.isActive??!0,onChange:d,title:e.isActive??!0?"Disable connection":"Enable connection"})]})]})}function w({isOpen:e,provider:t,providerName:s,isCompatible:r,isAnthropic:o,proxyPools:n,onSave:l,onClose:d}){let c="__none__",[x,m]=(0,a.useState)({name:"",apiKey:"",priority:1,proxyPoolId:c}),[u,h]=(0,a.useState)(!1),[y,f]=(0,a.useState)(null),[g,b]=(0,a.useState)(!1),v=async()=>{h(!0);try{let e=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:x.apiKey})}),s=await e.json();f(s.valid?"success":"failed")}catch{f("failed")}finally{h(!1)}},j=async()=>{if(t&&x.apiKey){b(!0);try{let e=!1;try{h(!0),f(null);let s=await fetch("/api/providers/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:t,apiKey:x.apiKey})});e=!!(await s.json()).valid,f(e?"success":"failed")}catch{f("failed")}finally{h(!1)}await l({name:x.name,apiKey:x.apiKey,priority:x.priority,proxyPoolId:x.proxyPoolId===c?null:x.proxyPoolId,testStatus:e?"active":"unknown",providerSpecificData:void 0})}finally{b(!1)}}};return t?(0,i.jsx)(p.aF,{isOpen:e,title:`Add ${s||t} API Key`,onClose:d,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(p.pd,{label:"Name",value:x.name,onChange:e=>m({...x,name:e.target.value}),placeholder:"Production Key"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.pd,{label:"API Key",type:"password",value:x.apiKey,onChange:e=>m({...x,apiKey:e.target.value}),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(p.$n,{onClick:v,disabled:!x.apiKey||u||g,variant:"secondary",children:u?"Checking...":"Check"})})]}),y&&(0,i.jsx)(p.Ex,{variant:"success"===y?"success":"error",children:"success"===y?"Valid":"Invalid"}),r&&(0,i.jsx)("p",{className:"text-xs text-text-muted",children:o?`Validation checks ${s||"Anthropic Compatible"} by verifying the API key.`:`Validation checks ${s||"OpenAI Compatible"} via /models on your base URL.`}),(0,i.jsx)(p.pd,{label:"Priority",type:"number",value:x.priority,onChange:e=>m({...x,priority:Number.parseInt(e.target.value)||1})}),(0,i.jsx)(p.l6,{label:"Proxy Pool",value:x.proxyPoolId,onChange:e=>m({...x,proxyPoolId:e.target.value}),options:[{value:c,label:"None"},...(n||[]).map(e=>({value:e.id,label:e.name}))],placeholder:"None"}),0===(n||[]).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)(p.$n,{onClick:j,fullWidth:!0,disabled:!x.name||!x.apiKey||g,children:g?"Saving...":"Save"}),(0,i.jsx)(p.$n,{onClick:d,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function C({isOpen:e,node:t,onSave:s,onClose:r,isAnthropic:o}){let[n,l]=(0,a.useState)({name:"",prefix:"",apiType:"chat",baseUrl:"https://api.openai.com/v1"}),[d,c]=(0,a.useState)(!1),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(""),[y,f]=(0,a.useState)(!1),[g,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&l({name:t.name||"",prefix:t.prefix||"",apiType:t.apiType||"chat",baseUrl:t.baseUrl||(o?"https://api.anthropic.com/v1":"https://api.openai.com/v1")})},[t,o]);let v=async()=>{if(n.name.trim()&&n.prefix.trim()&&n.baseUrl.trim()){c(!0);try{let e={name:n.name,prefix:n.prefix,baseUrl:n.baseUrl};o||(e.apiType=n.apiType),await s(e)}finally{c(!1)}}},j=async()=>{f(!0);try{let e=await fetch("/api/provider-nodes/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({baseUrl:n.baseUrl,apiKey:x,type:o?"anthropic-compatible":"openai-compatible",modelId:u.trim()||void 0})}),t=await e.json();b(t.valid?"success":"failed")}catch{b("failed")}finally{f(!1)}};return t?(0,i.jsx)(p.aF,{isOpen:e,title:`Edit ${o?"Anthropic":"OpenAI"} Compatible`,onClose:r,children:(0,i.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,i.jsx)(p.pd,{label:"Name",value:n.name,onChange:e=>l({...n,name:e.target.value}),placeholder:`${o?"Anthropic":"OpenAI"} Compatible (Prod)`,hint:"Required. A friendly label for this node."}),(0,i.jsx)(p.pd,{label:"Prefix",value:n.prefix,onChange:e=>l({...n,prefix:e.target.value}),placeholder:o?"ac-prod":"oc-prod",hint:"Required. Used as the provider prefix for model IDs."}),!o&&(0,i.jsx)(p.l6,{label:"API Type",options:[{value:"chat",label:"Chat Completions"},{value:"responses",label:"Responses API"}],value:n.apiType,onChange:e=>l({...n,apiType:e.target.value})}),(0,i.jsx)(p.pd,{label:"Base URL",value:n.baseUrl,onChange:e=>l({...n,baseUrl:e.target.value}),placeholder:o?"https://api.anthropic.com/v1":"https://api.openai.com/v1",hint:`Use the base URL (ending in /v1) for your ${o?"Anthropic":"OpenAI"}-compatible API.`}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.pd,{label:"API Key (for Check)",type:"password",value:x,onChange:e=>m(e.target.value),className:"flex-1"}),(0,i.jsx)("div",{className:"pt-6",children:(0,i.jsx)(p.$n,{onClick:j,disabled:!x||y||!n.baseUrl.trim(),variant:"secondary",children:y?"Checking...":"Check"})})]}),(0,i.jsx)(p.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)(p.Ex,{variant:"success"===g?"success":"error",children:"success"===g?"Valid":"Invalid"}),(0,i.jsxs)("div",{className:"flex gap-2",children:[(0,i.jsx)(p.$n,{onClick:v,fullWidth:!0,disabled:!n.name.trim()||!n.prefix.trim()||!n.baseUrl.trim()||d,children:d?"Saving...":"Save"}),(0,i.jsx)(p.$n,{onClick:r,variant:"ghost",fullWidth:!0,children:"Cancel"})]})]})}):null}function S({isOpen:e,providerAlias:t,providerDisplayAlias:s,onSave:r,onClose:o}){let[n,l]=(0,a.useState)(""),[d,c]=(0,a.useState)(null),[x,m]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e&&(l(""),c(null),m(""))},[e]);let y=async()=>{if(n.trim()){c("testing"),m("");try{let e=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${t}/${n.trim()}`})}),s=await e.json();c(s.ok?"ok":"error"),m(s.error||"")}catch(e){c("error"),m(e.message)}}},f=async()=>{if(n.trim()&&!u){h(!0);try{await r(n.trim())}finally{h(!1)}}};return(0,i.jsx)(p.aF,{isOpen:e,onClose:o,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:n,onChange:e=>{l(e.target.value),c(null),m("")},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)(p.$n,{variant:"secondary",icon:"science",loading:"testing"===d,onClick:y,disabled:!n.trim()||"testing"===d,children:"testing"===d?"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:n.trim()||"model-id"})]})]}),"ok"===d&&(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"===d&&(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:x||"Model not reachable"})]}),(0,i.jsxs)("div",{className:"flex gap-2 pt-1",children:[(0,i.jsx)(p.$n,{onClick:o,variant:"ghost",fullWidth:!0,size:"sm",children:"Cancel"}),(0,i.jsx)(p.$n,{onClick:f,fullWidth:!0,size:"sm",disabled:!n.trim()||u,children:u?"Adding...":"Add Model"})]})]})})}b.propTypes={model:o().shape({id:o().string.isRequired}).isRequired,fullModel:o().string.isRequired,alias:o().string,copied:o().string,onCopy:o().func.isRequired,testStatus:o().oneOf(["ok","error"]),isCustom:o().bool,isFree:o().bool,onDeleteAlias:o().func,onTest:o().func,isTesting:o().bool},o().string.isRequired,o().object.isRequired,o().string,o().func.isRequired,o().func.isRequired,o().func.isRequired,v.propTypes={modelId:o().string.isRequired,fullModel:o().string.isRequired,copied:o().string,onCopy:o().func.isRequired,onDeleteAlias:o().func.isRequired,onTest:o().func,testStatus:o().oneOf(["ok","error"]),isTesting:o().bool},j.propTypes={providerStorageAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,modelAliases:o().object.isRequired,copied:o().string,onCopy:o().func.isRequired,onSetAlias:o().func.isRequired,onDeleteAlias:o().func.isRequired,connections:o().arrayOf(o().shape({id:o().string,isActive:o().bool})).isRequired,isAnthropic:o().bool},N.propTypes={until:o().string.isRequired},k.propTypes={connection:o().shape({id:o().string,name:o().string,email:o().string,displayName:o().string,modelLockUntil:o().string,testStatus:o().string,isActive:o().bool,lastError:o().string,priority:o().number,globalPriority:o().number}).isRequired,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string,proxyUrl:o().string,noProxy:o().string,isActive:o().bool})),isOAuth:o().bool.isRequired,isFirst:o().bool.isRequired,isLast:o().bool.isRequired,onMoveUp:o().func.isRequired,onMoveDown:o().func.isRequired,onToggleActive:o().func.isRequired,onUpdateProxy:o().func,onEdit:o().func.isRequired,onDelete:o().func.isRequired},w.propTypes={isOpen:o().bool.isRequired,provider:o().string,providerName:o().string,isCompatible:o().bool,isAnthropic:o().bool,proxyPools:o().arrayOf(o().shape({id:o().string,name:o().string})),onSave:o().func.isRequired,onClose:o().func.isRequired},C.propTypes={isOpen:o().bool.isRequired,node:o().shape({id:o().string,name:o().string,prefix:o().string,apiType:o().string,baseUrl:o().string}),onSave:o().func.isRequired,onClose:o().func.isRequired,isAnthropic:o().bool},S.propTypes={isOpen:o().bool.isRequired,providerAlias:o().string.isRequired,providerDisplayAlias:o().string.isRequired,onSave:o().func.isRequired,onClose:o().func.isRequired}}},e=>{e.O(0,[7848,4335,2599,8872,505,4156,2347,5158,7358],()=>e(e.s=7207)),_N_E=e.O()}]);
|