zevairouter 1.1.78 → 1.1.80
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/CHANGELOG.md +13 -0
- package/cli/app/.next-cli-build/BUILD_ID +1 -1
- package/cli/app/.next-cli-build/app-path-routes-manifest.json +24 -24
- package/cli/app/.next-cli-build/build-manifest.json +2 -2
- package/cli/app/.next-cli-build/prerender-manifest.json +3 -3
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/automation/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/context/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/terminal/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/cli/app/.next-cli-build/server/app/_not-found.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/cli/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/dsh-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openbot-settings/route.js +3 -3
- package/cli/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/opencode/discover-models/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/providers/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/cli/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/callback.html +1 -1
- package/cli/app/.next-cli-build/server/app/callback.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/automation.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/!KGRhc2hib2FyZCk/dashboard/automation/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/automation.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/combos.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/context.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/!KGRhc2hib2FyZCk/dashboard/context/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/context.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +3 -3
- package/cli/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/playground.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/profile.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/providers.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/quota.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/skills.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/translator.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard/usage.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/cli/app/.next-cli-build/server/app/dashboard.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/index.html +1 -1
- package/cli/app/.next-cli-build/server/app/index.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/landing.html +1 -1
- package/cli/app/.next-cli-build/server/app/landing.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app/login.html +1 -1
- package/cli/app/.next-cli-build/server/app/login.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +1 -1
- package/cli/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/cli/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/app-paths-manifest.json +24 -24
- package/cli/app/.next-cli-build/server/chunks/1283.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1350.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1757.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/1852.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/267.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/4549.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5626.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5744.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5819.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/5905.js +3 -3
- package/cli/app/.next-cli-build/server/chunks/6166.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6396.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/6936.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7135.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/7319.js +6 -6
- package/cli/app/.next-cli-build/server/chunks/7364.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/8972.js +1 -1
- package/cli/app/.next-cli-build/server/chunks/9548.js +1 -1
- package/cli/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/pages/404.html +1 -1
- package/cli/app/.next-cli-build/server/pages/500.html +1 -1
- package/cli/app/.next-cli-build/server/preview-props.json +3 -3
- package/cli/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/cli/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/620-0f6bd4f59fa0cd33.js +1 -0
- package/cli/app/.next-cli-build/static/chunks/{7001-67d0f2aa165b8767.js → 7001-da01aaca36365276.js} +8 -8
- package/cli/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/providers/[id]/{page-c2b77eabb14f7642.js → page-936f29821afd7d28.js} +1 -1
- package/cli/app/CHANGELOG.md +13 -0
- package/cli/app/package.json +1 -1
- package/cli/app/src/mitm/server.js +1 -1
- package/cli/package.json +1 -1
- package/package.json +1 -1
- package/cli/app/.next-cli-build/static/chunks/620-11311598c4b9e95a.js +0 -1
- /package/cli/app/.next-cli-build/static/{BLnTNheSRSk8U0Uqmnbc4 → Vbe_S3ECwU1yAXUWqmRCl}/_buildManifest.js +0 -0
- /package/cli/app/.next-cli-build/static/{BLnTNheSRSk8U0Uqmnbc4 → Vbe_S3ECwU1yAXUWqmRCl}/_ssgManifest.js +0 -0
|
@@ -12,4 +12,4 @@ sk-key-only-auto-named`;function Z({isOpen:e,provider:t,providerName:s,isCompati
|
|
|
12
12
|
"refresh_token": "rt_...",
|
|
13
13
|
"email": "user@example.com"
|
|
14
14
|
}
|
|
15
|
-
]`;function eP({isOpen:e,onClose:t,onSuccess:s}){let[i,n]=(0,r.useState)(""),[l,o]=(0,r.useState)(!1),[c,m]=(0,r.useState)(null),u=()=>{l||(m(null),t())},p=async()=>{let e;try{e=JSON.parse(i)}catch{m({error:"Paste a JSON account or an array of accounts"});return}o(!0),m(null);try{let t=await fetch("/api/oauth/grok-cli/json-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();m(a.error?{error:a.error}:a),!a.error&&a.success>0&&s?.()}catch(e){m({error:e.message})}finally{o(!1)}},x=c&&!c.error?`Imported ${c.success}. Failed ${c.failed}.`:null;return(0,a.jsxs)(d.aF,{isOpen:e,onClose:u,title:"Import Grok CLI accounts",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:u,disabled:l,children:"Close"}),(0,a.jsx)(d.$n,{onClick:p,disabled:l||!i.trim(),children:l?"Importing...":"Import"})]}),children:[(0,a.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. Snake_case and camelCase are both accepted. A refresh token is refreshed before it is stored. The response never returns the tokens. Line import stays on the automation page."}),(0,a.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:eO,value:i,onChange:e=>n(e.target.value),disabled:l}),c?(0,a.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${c.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:c.error||x}):null]})}eP.propTypes={isOpen:O().bool.isRequired,onClose:O().func.isRequired,onSuccess:O().func};let eI=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],ez=/^[A-Za-z0-9-]+$/;function eE({providerId:e}){let t=(0,$.i)(),[s,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)([{name:"",value:""}]),[o,c]=(0,r.useState)({}),[m,u]=(0,r.useState)(!1),[p,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=!1;return fetch(`/api/providers/${e}/overrides`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{if(t||!e)return;let s=e.builtinHeaders||{},a=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));c(s),l(a.length?a:[{name:"",value:""}]),u(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{l(a=>a.map((a,r)=>r===e?{...a,[t]:s}:a))},b=(0,r.useCallback)(async()=>{let s={};for(let e of n.filter(e=>e.name.trim())){let a=e.name.trim();if(!ez.test(a))return void t.error(`Invalid header name: ${a}`);if(eI.includes(a.toLowerCase()))return void t.error(`Header ${a} cannot be overridden`);if(a in s)return void t.error(`Duplicate header name: ${a}`);e.value!==o[a]&&(s[a]=e.value)}x(!0);try{let a=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!a.ok){let e=await a.json().catch(()=>({}));t.error(e.error||"Failed to save");return}u(Object.keys(s).length>0),t.success("Custom headers saved")}finally{x(!1)}},[n,o,e,t]);return(0,a.jsxs)(d.Zp,{padding:"xs",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),m&&(0,a.jsx)(d.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:n.map((e,t)=>{let s=e.name.trim()in o&&e.value!==o[e.name.trim()];return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:e.name,onChange:e=>h(t,"name",e.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,a.jsx)("input",{value:e.value,onChange:e=>h(t,"value",e.target.value),placeholder:"Value",spellCheck:!1,title:s?"Overridden":e.name.trim()in o?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${s?"border-amber-400/60":"border-border"}`}),(0,a.jsx)("button",{type:"button",title:"Remove header",onClick:()=>l(e=>e.length>1?e.filter((e,s)=>s!==t):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>l(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",disabled:p,onClick:()=>{l(Object.entries(o).map(([e,t])=>({name:e,value:t})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,a.jsx)("button",{type:"button",disabled:p,onClick:b,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:p?"Saving...":"Save"})]})]})]})]})}eE.propTypes={providerId:O().string.isRequired};var eR=s(5539);let eq="$HOME/.zevai/bin/zevai-aistudio-waa",eM=`OUT="${eq}" bash "$(npm root -g)/zevairouter/vendor/aistudio-waa/build.sh"`,eD=`OUT="${eq}" bash vendor/aistudio-waa/build.sh`;function e_({value:e,copied:t,onCopy:s,id:r}){return(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-lg bg-sidebar px-3 py-2",children:[(0,a.jsx)("code",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all text-xs font-mono text-text-main",children:e}),(0,a.jsxs)("button",{type:"button",onClick:()=>s(e,r),className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2 py-1 text-[11px] font-medium text-white hover:bg-primary/90","aria-label":`Copy: ${e}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:t===r?"check":"content_copy"}),t===r?"Copied":"Copy"]})]})}function eU({n:e,title:t,children:s,variant:r="missing"}){return(0,a.jsxs)("li",{className:"flex gap-3",children:[(0,a.jsx)("span",{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${"ready"===r?"bg-emerald-500/15 text-emerald-800 dark:text-emerald-300":"bg-amber-500/15 text-amber-800 dark:text-amber-300"}`,children:e}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,a.jsx)("p",{className:"ready"===r?"text-sm font-medium text-emerald-900 dark:text-emerald-200":"text-sm font-medium text-amber-900 dark:text-amber-200",children:t}),s]})]})}function eL({status:e,copied:t,copy:s,variant:r}){let i=e?.buildCommand||eM,n=e?.npmCommand||eM,l=e?.checkoutCommand||eD,o="ready"===r?"text-xs text-emerald-800/80 dark:text-emerald-300/80":"text-xs text-amber-800 dark:text-amber-300";return(0,a.jsxs)("ol",{className:"space-y-4",children:[(0,a.jsxs)(eU,{n:1,variant:r,title:"Install prerequisites",children:[(0,a.jsx)("p",{className:o,children:"You need Go, git, curl, and a C/C++ compiler, plus about 1 GB of disk. The first build takes several minutes; later builds are much faster."}),(0,a.jsx)("p",{className:o,children:"macOS (git and curl come with the Command Line Tools):"}),(0,a.jsx)(e_,{id:"prereq-mac-clt",copied:t,onCopy:s,value:"xcode-select --install"}),(0,a.jsx)(e_,{id:"prereq-mac-go",copied:t,onCopy:s,value:"brew install go"}),(0,a.jsx)("p",{className:o,children:"Debian / Ubuntu:"}),(0,a.jsx)(e_,{id:"prereq-deb",copied:t,onCopy:s,value:"sudo apt install golang git curl build-essential"})]}),(0,a.jsxs)(eU,{n:2,variant:r,title:"Build the helper",children:[(0,a.jsxs)("p",{className:o,children:["Run this command. It writes the binary to the exact path this router looks for",e?.binPath?(0,a.jsxs)(a.Fragment,{children:[" (",(0,a.jsx)("code",{className:"font-mono",children:e.binPath}),")"]}):null,"."]}),(0,a.jsx)(e_,{id:"build-cmd",copied:t,onCopy:s,value:i}),n!==i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:o,children:"From an npm global install you can also run:"}),(0,a.jsx)(e_,{id:"build-npm",copied:t,onCopy:s,value:n})]}),l!==i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:o,children:"From a git checkout of the repo:"}),(0,a.jsx)(e_,{id:"build-checkout",copied:t,onCopy:s,value:l})]}),!e?.binPath&&(0,a.jsxs)("p",{className:o,children:["If this router uses a custom ",(0,a.jsx)("code",{className:"font-mono",children:"DATA_DIR"}),", set"," ",(0,a.jsx)("code",{className:"font-mono",children:"OUT=$DATA_DIR/bin/zevai-aistudio-waa"}),"."]})]}),(0,a.jsx)(eU,{n:3,variant:r,title:"No router restart needed",children:(0,a.jsx)("p",{className:o,children:"The helper starts on the next AI Studio request. Stay on this page and click Check again after the build finishes."})}),(0,a.jsx)(eU,{n:4,variant:r,title:"Add a connection",children:(0,a.jsxs)("p",{className:o,children:["Use ",(0,a.jsx)("strong",{children:"Login via Browser"}),", or paste the storage-state JSON of a signed-in aistudio.google.com session."]})})]})}function eK(){let[e,t]=(0,r.useState)(null),[s,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)(!0),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)(0),{copied:u,copy:p}=(0,h.C)(2e3);if((0,r.useEffect)(()=>{let e=new AbortController;return fetch("/api/providers/aistudio/helper",{cache:"no-store",signal:e.signal}).then(e=>e.ok?e.json():Promise.reject(Error("bad status"))).then(e=>{i(!1),t({present:!!e?.present,binPath:"string"==typeof e?.binPath?e.binPath:"",buildCommand:"string"==typeof e?.buildCommand?e.buildCommand:"",npmCommand:"string"==typeof e?.npmCommand?e.npmCommand:"",checkoutCommand:"string"==typeof e?.checkoutCommand?e.checkoutCommand:"",restartRequired:!!e?.restartRequired})}).catch(e=>{e?.name!=="AbortError"&&(t(null),i(!0))}).finally(()=>{e.signal.aborted||l(!1)}),()=>e.abort()},[c]),n&&!e&&!s)return null;let x=s||!e?.present;return(0,a.jsx)("div",{className:"space-y-2",children:x?(0,a.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-3",role:"status",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-amber-500",children:"warning"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-amber-900 dark:text-amber-200",children:s?"Could not check the AI Studio helper":"AI Studio helper is not built yet"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-300",children:"The npm package ships the helper source only; the binary is not included. Build it once on this machine before adding a connection."})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>m(e=>e+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-amber-500/40 px-2 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-500/10 dark:text-amber-200",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),(0,a.jsx)(eL,{status:e,copied:u,copy:p,variant:"missing"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-3 py-2",role:"status",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-emerald-500",children:"check_circle"}),(0,a.jsxs)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-emerald-800 dark:text-emerald-300",children:["Helper ready at ",(0,a.jsx)("code",{className:"font-mono",children:e.binPath}),". No rebuild needed unless you update the router."]}),(0,a.jsx)("button",{type:"button",onClick:()=>d(e=>!e),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200","aria-expanded":o,children:o?"Hide setup":"Setup steps"}),(0,a.jsxs)("button",{type:"button",onClick:()=>m(e=>e+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),o&&(0,a.jsx)(eL,{status:e,copied:u,copy:p,variant:"ready"})]})})}e_.propTypes={value:O().string.isRequired,copied:O().string,onCopy:O().func.isRequired,id:O().string.isRequired},eU.propTypes={n:O().number.isRequired,title:O().string.isRequired,children:O().node,variant:O().oneOf(["missing","ready"])},eL.propTypes={status:O().shape({binPath:O().string,buildCommand:O().string,npmCommand:O().string,checkoutCommand:O().string}),copied:O().string,copy:O().func.isRequired,variant:O().oneOf(["missing","ready"])};let eF="kiro-bulk-import-active-job",eB="Bulk import progress expired or was cleared.",eJ={claude:"claudeAutoPing",codex:"codexAutoPing"};function eH(e){return eR.w.has(e)||"codex"===e||"grok-cli"===e}function eW({providerId:e,onWebLoginConnected:t,onBulkImport:s}){let r=[];return(eR.w.has(e)&&r.push((0,a.jsx)(eR.A,{providerId:e,onConnected:t},"web-login")),("codex"===e||"grok-cli"===e)&&r.push((0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:s,className:"w-full sm:w-auto",children:"Bulk Add"},"bulk-add")),r.length)?(0,a.jsx)(a.Fragment,{children:r}):null}function eG(e){return["completed","cancelled","failed"].includes(e)}async function eV(e){if(!e)return null;let t=await fetch(`/api/oauth/kiro/bulk-import/${e}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eQ(e="active"){let t=await fetch(`/api/oauth/kiro/bulk-import/latest?scope=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eZ(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),a=null;try{a=await s.json()}catch{a=null}return{response:s,data:a}}finally{window.clearTimeout(s)}}function eY(){let e,t=(0,i.useParams)(),s=(0,i.useRouter)(),n=t.id,[m,f]=(0,r.useState)([]),[T,O]=(0,r.useState)(!0),[I,z]=(0,r.useState)(""),[R,q]=(0,r.useState)(null),[M,D]=(0,r.useState)([]),[U,L]=(0,r.useState)(!1),[K,F]=(0,r.useState)(!1),[B,J]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[V,Q]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[ei,en]=(0,r.useState)(""),[el,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(!1),[eb,ef]=(0,r.useState)(null),[eg,ey]=(0,r.useState)({}),[ej,ek]=(0,r.useState)([]),[ew,eN]=(0,r.useState)(!1),[eC,eA]=(0,r.useState)({}),[eO,eI]=(0,r.useState)({}),[ez,eR]=(0,r.useState)(()=>new Set),[eq,eM]=(0,r.useState)(!1),[eD,e_]=(0,r.useState)(!1),[eU,eL]=(0,r.useState)(!1),[eY,eX]=(0,r.useState)(!1),[e0,e1]=(0,r.useState)(!1),[e5,e2]=(0,r.useState)(!1),[e3,e4]=(0,r.useState)(!1),[e8,e6]=(0,r.useState)([]),[e7,e9]=(0,r.useState)("__none__"),[te,tt]=(0,r.useState)(!1),[ts,ta]=(0,r.useState)(!1),[tr,ti]=(0,r.useState)(null),[tn,tl]=(0,r.useState)(""),[to,td]=(0,r.useState)("auto"),[tc,tm]=(0,r.useState)({}),[tu,tp]=(0,r.useState)({}),[tx,th]=(0,r.useState)(null),[tb,tf]=(0,r.useState)([]),[tg,ty]=(0,r.useState)([]),[tv,tj]=(0,r.useState)([]),[tk,tw]=(0,r.useState)(null),[tN,tC]=(0,r.useState)(!1),[tS,t$]=(0,r.useState)(null),[tA,tT]=(0,r.useState)(!1),[tO,tP]=(0,r.useState)(!1),[tI,tz]=(0,r.useState)(null),[tE,tR]=(0,r.useState)({}),[tq,tM]=(0,r.useState)(null),tD=(0,r.useRef)(!1),t_=(0,r.useRef)(null),tU=(0,r.useRef)("1"),[tL,tK]=(0,r.useState)(!1),[tF,tB]=(0,r.useState)(null),[tJ,tH]=(0,r.useState)(""),[tW,tG]=(0,r.useState)(1),[tV,tQ]=(0,r.useState)(20),[tZ,tY]=(0,r.useState)("all"),[tX,t0]=(0,r.useState)(""),[t1,t5]=(0,r.useState)(1),[t2,t3]=(0,r.useState)(20),{copied:t4,copy:t8}=(0,h.C)(),t6=(0,r.useRef)(0),t7=(0,r.useRef)([]),t9=(0,r.useRef)(!0),se=(0,r.useRef)(null),st=(0,$.i)(e=>e.error),ss="ag_risk_confirmed",sa=(0,r.useCallback)(()=>{tB(null),tH(""),t6.current=0,window.localStorage.removeItem(eF)},[]),sr=()=>{L(!0)},si=()=>{"kiro"===n&&tF?.jobId&&eG(tF.status)&&sa(),s.push(p(n))},sn=R?{id:R.id,name:R.name||("anthropic-compatible"===R.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===R.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===R.type?"AC":"OC",apiType:R.apiType,baseUrl:R.baseUrl,type:R.type}:c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n]||c.br[n],sl=sn?.authModes||[],so=!!c.zN[n]||!!c.IS[n]||sl.includes("oauth"),sd=!!c.fg[n]||sl.includes("apikey"),sc=!!c.IS[n]?.noAuth,sm=(0,y.F)("kiro"===n),su="aistudio"===n?m.filter(e=>!1!==e.isActive).map(e=>`${e.id}:${e.updatedAt||""}`).join(","):"",sp=(0,v.M)("aistudio"===n,su),sx=(0,v.Q)(n,sp,(0,x.KC)(n)),sh="kiro"===n?sm:sx,sb=(0,c.wG)(n),sf=(0,c.mq)(n),sg=(0,c.gb)(n),sy=sf||sg,sv=u(n),sj=function({providerId:e,providerInfo:t,isOAuth:s,supportsApiKeyAuth:a,isCompatible:r}){if(!t||t.noAuth||t.authModes?.includes("none"))return[];let i=[];for(let n of(s&&S(i,"oauth"),(a||r||"cookie"===t.authType||!s)&&S(i,"apikey"),N[e]||[]))S(i,n);return i.map(t=>{let s=w[t];return s?{...s,...C[e]?.[t]}:null}).filter(Boolean)}({providerId:n,providerInfo:sn,isOAuth:so,supportsApiKeyAuth:sd,isCompatible:sf||sg}),sk=function(e,{specializedChooser:t=!1}={}){return e.length?t?{type:"specialized"}:1===e.length?{type:"method",methodId:e[0].id}:{type:"chooser"}:{type:"none"}}(sj,{specializedChooser:"kiro"===n}),sw=sj.map(e=>"quota-cookie"===e.id&&0===m.length?{...e,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:e),sN=e=>{if(!to||"auto"===to)return null;let t=(0,A.kl)(n,e);return t&&t.includes(to)?to:null},sC=sy?n:sb,sS=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let a=(0,A.kl)(n,s);a&&a.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of sh)s(e.id);for(let e of tg)s(e.id);for(let e of ej)e.providerAlias===sC&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),s$=sy?R?.prefix||n:sb,sA=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sC)}`,{cache:"no-store"}),t=await e.json();e.ok&&tj(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[sC]),sT=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sC,ids:[e]})})).ok&&await sA()}catch(e){console.log("Error disabling model:",e)}},sO=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sC)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sA()}catch(e){console.log("Error enabling model:",e)}},sP=async e=>{e.length&&tw({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{tw(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sC,ids:e})})).ok&&await sA()}catch(e){console.log("Error disabling all models:",e)}}})},sI=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sC)}`,{method:"DELETE"})).ok&&await sA()}catch(e){console.log("Error enabling all models:",e)}},sz=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ek(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]),sE=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ey(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===n&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ty(e.models)}).catch(()=>{})},[n]);let sR=(0,r.useCallback)(async()=>{try{z("");let[e,t,s,a]=await Promise.allSettled([eZ("/api/providers"),eZ("/api/provider-nodes"),eZ("/api/proxy-pools?isActive=true"),eZ("/api/settings")]),r="fulfilled"===e.status?e.value.response:null,i="fulfilled"===e.status?e.value.data:{},l="fulfilled"===t.status?t.value.response:null,o="fulfilled"===t.status?t.value.data:{},d="fulfilled"===s.status?s.value.response:null,m="fulfilled"===s.status?s.value.data:{},u="fulfilled"===a.status?a.value.response:null,p=u?.ok&&a.value.data||{};if(r?.ok){let e=(i.connections||[]).filter(e=>e.provider===n);t7.current=e,f(e)}else z("Connections could not be loaded.");d?.ok&&D(m.proxyPools||[]);let x=(p.providerStrategies||{})[n]||{};ti(x.fallbackStrategy||null),tl(null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1"),tU.current=null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1";let h=(p.providerThinking||{})[n]||{};td(h.mode||"auto");let b=eJ[n];if(tm(b&&p?.[b]?.connections||{}),tp(b&&p?.[b]?.schedules||{}),l?.ok){let e=(o.nodes||[]).find(e=>e.id===n)||null;if(!e&&((0,c.mq)(n)||(0,c.gb)(n)))for(let t=0;t<3;t+=1){if(await new Promise(e=>setTimeout(e,150)),!t9.current)return;let{response:t,data:s}=await eZ("/api/provider-nodes");if(!t9.current)return;if(t.ok&&(e=(s.nodes||[]).find(e=>e.id===n)||null))break}q(e)}}catch(e){console.log("Error fetching connections:",e),t9.current&&z("Connections could not be loaded.")}finally{t9.current&&O(!1)}},[n]),sq=async e=>{try{let t=await fetch(`/api/provider-nodes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(q(s.node),await sR(),em(!1))}catch(e){console.log("Error updating provider node:",e)}},sM=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(r).length?delete i[n]:i[n]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},sD=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[n]={mode:e}:delete s[n],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},s_=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{paidSubscription:t}})})).ok&&f(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,paidSubscription:t}}:s))}catch(e){console.log("Error updating paid flag:",e)}},sU=async(e,t)=>{let s=eJ[n];if(!s)return;let a={...tc,[e]:t};tm(a);try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:a};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})).ok)throw Error("Failed to save auto-ping setting")}catch(e){tm(tc),console.log("Error saving auto-ping config:",e)}},sL=async({reactive:e,schedule:t})=>{let s=eJ[n];if(!tx||!s)return;let a={...tc,[tx.id]:e},r={...tu,[tx.id]:t};tm(a),tp(r);try{let e=await fetch("/api/settings",{cache:"no-store"}),t=e.ok?await e.json():{};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:{...t[s]||{},connections:a,schedules:r}})})).ok)throw Error("Failed to save auto-ping schedule")}catch(e){tm(tc),tp(tu),console.log("Error saving auto-ping schedule:",e)}};(0,r.useEffect)(()=>{sR(),sE(),sz(),sA()},[sR,sE,sz,sA]),(0,r.useEffect)(()=>(t9.current=!0,()=>{t9.current=!1,null!==se.current&&window.cancelAnimationFrame(se.current)}),[]),(0,r.useEffect)(()=>{tw(null),eA({}),eI({}),eR(new Set),tf([]),tR({}),tM(null),tz(null),tT(!1),tP(!1),tD.current=!0,tH("")},[n]),(0,r.useEffect)(()=>{tG(1),t5(1),tY("all"),t0("")},[n]),(0,r.useEffect)(()=>{tG(1)},[tZ,tV,tX]),(0,r.useEffect)(()=>{eN(!1)},[n]),(0,r.useEffect)(()=>{t5(1)},[t2,tv.length,sh.length,tg.length]),(0,r.useEffect)(()=>{if("kiro"!==n)return;let e=window.localStorage.getItem(eF),t=!1;return(async()=>{try{if(tH(""),tF?.jobId)return;let a=await eQ();if(!t&&a.res.ok&&a.data?.job){tB(a.data.job),t6.current=a.data.job.summary?.success||0,window.localStorage.setItem(eF,a.data.job.jobId);return}if(e){var s;let a=await eV(e);if(!t&&a?.res.ok&&a.data?.job&&(s=a.data.job.status,["queued","running","needs_manual"].includes(s))){tB(a.data.job),t6.current=a.data.job.summary?.success||0;return}sa(),tH(eB)}}catch{t||tH(eB)}})(),()=>{t=!0}},[sa,tF?.jobId,n]),(0,r.useEffect)(()=>{if(!("kiro"!==n||!tF?.jobId||eG(tF.status)))return(0,k.M)(async e=>{let t=await eV(tF.jobId);if(!e()){if(t?.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>t6.current&&(t6.current=s,await sR(),e()))return;tH(""),tB(t.data.job);return}if(t?.res.status===404){let t=await eQ();if(e())return;if(t.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>t6.current&&(t6.current=s,await sR(),e()))return;tH(""),tB(t.data.job),window.localStorage.setItem(eF,t.data.job.jobId);return}sa(),tH(eB)}}},2e3)},[sa,sR,tF?.jobId,tF?.status,n]),(0,r.useEffect)(()=>{let e=(c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n])?.modelsFetcher;e&&g(e).then(tf)},[n]);let sK=async(e,t,s=sb)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await sE();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},sF=async(e,t="llm")=>{try{let s=new URLSearchParams({providerAlias:sC,id:e,type:t});(await fetch(`/api/models/custom?${s}`,{method:"DELETE"})).ok&&(await sz(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},sB=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sE()}catch(e){console.log("Error deleting alias:",e)}},sJ=async()=>{if(tL)return;let e=m.find(e=>!1!==e.isActive);if(!e)return void alert((0,b.Tl)("Please add an active Qoder connection first"));tK(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,b.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,b.Tl)("No models returned"));let r={...eg},i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${sC}/${s}`;!Object.values(r).includes(a)&&(r[s]||(await sK(s,s,sC),r[s]=a,i+=1))}0===i?alert((0,b.Tl)("All models already exist, no new models added")):alert((0,b.Tl)("Successfully added")+` ${i} `+(0,b.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,b.Tl)("Error fetching models")+": "+e.message)}finally{tK(!1)}},sH=async()=>{let e=[...m];if(tA||0===e.length)return;let t=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));tD.current=!1,tT(!0),tP(!1),tz(null),tR(t),tM({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let s=0,a=0;try{for(let t=0;t<e.length;t+=1){if(tD.current){tM({total:e.length,completed:t,passed:s,failed:a,stopped:!0});break}let r=e[t];if(!t7.current.some(e=>e.id===r.id)){tR(e=>({...e,[r.id]:{state:"skipped",error:null}})),tM({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1});continue}tz(r.id),tR(e=>({...e,[r.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${r.id}/test`,{method:"POST"}),t=await e.json(),i=!!t.valid;i?s+=1:a+=1,tR(e=>({...e,[r.id]:{state:i?"success":"failed",error:i?t.warning||null:t.error||null}}))}catch(e){a+=1,tR(t=>({...t,[r.id]:{state:"failed",error:e.message||"Test failed"}}))}tM({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,250))}}finally{tz(null),tT(!1),tP(!1),tD.current=!1}},sW=async e=>{tw({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{tw(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&f(m.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},sG=()=>{sR(),L(!1)},sV=(0,r.useCallback)(e=>{(tB(e),tH(""),e?.jobId)?(window.localStorage.setItem(eF,e.jobId),t6.current=Math.max(t6.current,e.summary?.success||0)):sa()},[sa]),sQ=async e=>{en("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await sR(),ea(!1);return}en(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),en("Failed to save connection")}},sZ=async e=>{try{(await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await sR(),ed(!1))}catch(e){console.log("Error updating connection:",e)}},sY=async(e,t)=>{try{let s=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(s.ok){let a=await s.json().catch(()=>null);f(s=>s.map(s=>s.id===e?{...s,isActive:t,...a?.connection||{}}:s))}}catch(e){console.log("Error updating connection status:",e)}},sX=async(e,t)=>{let s=[...m];[s[e],s[t]]=[s[t],s[e]],f(s);try{let[a,r]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);a.ok&&r.ok||(console.log("Priority swap rejected:",a.status,r.status),await sR())}catch(e){console.log("Error swapping priority:",e),await sR()}},s0=(0,r.useMemo)(()=>{let e=tX.trim().toLowerCase();return m.filter(t=>!!(0,j.i2)(t,tZ)&&(!e||[t.name,t.email,t.id,t.account,t.username,t.label,t.authType,t.notes,t.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(e)))},[m,tZ,tX]),s1=(0,r.useMemo)(()=>j.gJ.reduce((e,t)=>(e[t.id]="all"===t.id?m.length:m.filter(e=>(0,j.i2)(e,t.id)).length,e),{}),[m]),s5=e8.filter(e=>m.some(t=>t.id===e)),s2=m.filter(e=>s5.includes(e.id)),s3="codebuddy"===n||"codebuddy-cn"===n?(s2.length>0?s2:m).map(e=>e.id):[],s4=s0.length>0&&s0.every(e=>s5.includes(e.id)),s8=e=>{switch(e){case"oauth":if("antigravity"===n&&"true"!==window.localStorage.getItem(ss)){t$(e),tC(!0);return}sr();return;case"apikey":en(""),ea(!0);return;case"cookie":G(!0);return;case"quota-cookie":m.length>1&&0===s2.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):Q(!0);return;default:st(`Unsupported connection method: ${e}`,"Add Connection")}},s6=e=>{null!==se.current&&window.cancelAnimationFrame(se.current),se.current=window.requestAnimationFrame(()=>{se.current=null,s8(e)})},s7=()=>{"specialized"===sk.type?sr():"method"===sk.type?s8(sk.methodId):"chooser"===sk.type&&et(!0)},s9=e=>{et(!1),s6(e)},ae=(()=>{if(0===s2.length)return"";let e=new Set(s2.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=M.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),at=()=>{te||eh(!1)},as=async e=>{tt(!0);try{let t=0,s=0,a=Array.from({length:Math.min(8,e.length)},async()=>{for(;s<e.length;){let a=s;s+=1;let{connectionId:r,proxyPoolId:i}=e[a];try{(await fetch(`/api/providers/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",r,e),t+=1}}});await Promise.all(a),t>0&&alert(`Updated with ${t} failed request(s).`),await sR(),eh(!1)}finally{tt(!1)}},aa=e=>as(s2.map(t=>({connectionId:t.id,proxyPoolId:e}))),ar=e=>{let t="gsuite"===e?"GSuite (non-Gmail)":"Gmail (@gmail.com)";tw({title:`Delete ${t}`,message:`Delete ALL ${t} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{tw(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:sn?.id||n,emailFilter:e})})).ok&&(e6([]),await sR())}catch(e){console.error("bulk delete error:",e)}}})},ai=Math.max(1,Math.ceil(s0.length/tV)),an=Math.min(tW,ai),al=s0.slice((an-1)*tV,an*tV),ao=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:al.map((e,t)=>{let s,r=m.findIndex(t=>t.id===e.id);return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,s5.includes(s)),onChange:()=>{var t;return t=e.id,void e6(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${e.name||e.email||e.id}`})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(_,{connection:e,proxyPools:M,isOAuth:so,isFirst:0===r,isLast:r===m.length-1,onMoveUp:()=>sX(r,r-1),onMoveDown:()=>sX(r,r+1),onToggleActive:t=>sY(e.id,t),autoPingEnabled:!0===tc[e.id],onToggleAutoPing:eJ[n]&&"oauth"===e.authType?t=>sU(e.id,t):void 0,autoPingScheduled:tu[e.id]?.enabled===!0,onOpenAutoPingSchedule:eJ[n]&&"oauth"===e.authType?()=>th(e):void 0,onTogglePaid:"antigravity"===n?t=>s_(e.id,t):void 0,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&f(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:()=>{ef(e),ed(!0)},onDelete:()=>sW(e.id),oneByOneStatus:tE[e.id]||null})})]},e.id)})}),ad=M.filter(e=>!0===e.isActive),ac=(0,a.jsx)(d.aF,{isOpen:eu,onClose:at,title:`Apply Proxy (${s2.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=M.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):as(s2.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:te||0===ad.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>aa(null),disabled:te,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),M.map(e=>(0,a.jsxs)("button",{onClick:()=>aa(e.id),disabled:te||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),te&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:at,variant:"ghost",fullWidth:!0,disabled:te,children:"Cancel"})]})}),am=async e=>{eR(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${sC}/${e}`})}),s=await t.json();eA(t=>({...t,[e]:s.ok?"ok":"error"})),eI(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{eA(t=>({...t,[e]:"error"})),eI(t=>({...t,[e]:"Network error"}))}finally{eR(t=>{let s=new Set(t);return s.delete(e),s})}};return T?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):sn?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(l(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${sn.color}15`},children:ew?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:sn.color},children:sn.textIcon||sn.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.A,{src:sf&&sn.apiType?"responses"===sn.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":sg?"/providers/anthropic-m.png":`/providers/${sn.id}.png`,alt:sn.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>eN(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:sn.name}),(sn.notice?.apiKeyUrl||sn.notice?.signupUrl||sn.website)&&(0,a.jsxs)("a",{href:sn.notice?.apiKeyUrl||sn.notice?.signupUrl||sn.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),sn.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[m.length," connection",1===m.length?"":"s"]})]})]})]}),sn.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:sn.deprecationNotice})]}),sn.notice?.text&&!sn.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:sn.notice.text}),sn.notice.apiKeyUrl&&(0,a.jsx)("a",{href:sn.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),"aistudio"===n&&(0,a.jsx)(eK,{}),sy&&R&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:sg?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[sg?"Messages API":"responses"===R.apiType?"Responses API":"Chat Completions"," \xb7 ",(R.baseUrl||"").replace(/\/$/,""),"/",sg?"messages":"responses"===R.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{en(""),ea(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>em(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{tw({title:"Delete Compatible Node",message:`Delete this ${sg?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{tw(null);try{(await fetch(`/api/provider-nodes/${n}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),sc?(0,a.jsx)(d.gw,{providerId:n}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[m.length>0&&M.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===s2.length)return;let e=[...new Set(s2.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"))];e9(1===e.length?e[0]:"__none__"),eh(!0)},disabled:0===s2.length,children:"Apply Proxy"}),m.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:sH,disabled:tA,children:tA?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tA&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tA&&(tD.current=!0,tP(!0))},disabled:tO,children:tO?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===tr,onChange:e=>{let t=e?"round-robin":null,s=e?tn||"1":tn;e&&!tn&&tl("1"),tU.current=s,t_.current&&(clearTimeout(t_.current),t_.current=null),ti(t),sM(t,s)}}),"round-robin"===tr&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:tn,onChange:e=>{var t;tl(t=e.target.value),tU.current=t,t_.current&&clearTimeout(t_.current),t_.current=setTimeout(()=>{sM("round-robin",tU.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),m.length>0&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:s4,onChange:()=>{s4?e6(e=>e.filter(e=>!s0.some(t=>t.id===e))):e6(e=>Array.from(new Set([...e,...s0.map(e=>e.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),s4?"Unselect visible":"Select visible"]}),(0,a.jsxs)(d.Ex,{variant:"default",children:[s0.length," visible"]}),s2.length>0&&(0,a.jsxs)(d.Ex,{variant:"default",children:[s2.length," selected"]}),ae&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:ae}),s2.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>{e6([]),e9("__none__")},children:"Clear"}),s2.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==s2.length&&tw({title:"Delete Selected Connections",message:`Delete ${s2.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{tw(null);let e=[],t=0;for(let s of s2)try{(await fetch(`/api/providers/${s.id}`,{method:"DELETE"})).ok?e.push(s.id):t+=1}catch(e){console.log("Error deleting selected connection:",e),t+=1}e6(t=>t.filter(t=>!e.includes(t))),t>0&&alert(`Deleted ${e.length} connection(s); ${t} failed.`),await sR()}})},children:["Delete Selected (",s2.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>ar("gsuite"),children:"Delete GSuite"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>ar("gmail"),children:"Delete Gmail"})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:j.gJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tY(e.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${tZ===e.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[e.label,(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:s1[e.id]||0})]},e.id))}),m.length>=20&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:tX,onChange:e=>t0(e.target.value),placeholder:`Search ${m.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),I?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:I})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{O(!0),sR()},children:"Retry"})]}):0===m.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:so?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),"kiro"!==n&&sj.some(e=>"oauth"===e.id)&&sj.some(e=>"apikey"===e.id)?(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",sj.find(e=>"oauth"===e.id)?.label||"OAuth"," or ",sj.find(e=>"apikey"===e.id)?.label||"API Key","."]}):sj.length>1?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,a.jsx)(e$,{showAutomation:sv,showAddConnection:"none"!==sk.type,onOpenAutomation:si,onAddConnection:s7,methods:"kiro"===n?null:sw,onSelectMethod:"kiro"===n?null:s9,extra:eH(n)?(0,a.jsx)(eW,{providerId:n,onWebLoginConnected:sR,onBulkImport:()=>"codex"===n?F(!0):J(!0)}):null})]}),"kiro"===n&&tF?.jobId&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tF.status," | Success: ",tF.summary?.success||0," | Running: ",tF.summary?.running||0," | Queued: ",tF.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),eG(tF.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:sa,children:"Clear"})]})]}),"kiro"===n&&!tF?.jobId&&tJ&&(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tJ})]}):(0,a.jsxs)(a.Fragment,{children:[tq&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",tq.total]}),(0,a.jsxs)("span",{children:["Completed: ",tq.completed]}),(0,a.jsxs)("span",{children:["Passed: ",tq.passed]}),(0,a.jsxs)("span",{children:["Failed: ",tq.failed]}),tq.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tA&&tI&&(0,a.jsxs)("span",{children:["Running: ",m.find(e=>e.id===tI)?.name||tI]})]})}),"kiro"===n&&tF?.jobId&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tF.status," | Success: ",tF.summary?.success||0," | Running: ",tF.summary?.running||0," | Queued: ",tF.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),eG(tF.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:sa,children:"Clear"})]})]}),"kiro"===n&&!tF?.jobId&&tJ&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tJ}),ao,"kiro"===n&&ai>1&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",an," of ",ai," • Showing ",(an-1)*tV+1,"-",Math.min(an*tV,s0.length)," of ",s0.length," connections"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:an<=1,onClick:()=>tG(e=>Math.max(1,e-1)),children:"Previous"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:an>=ai,onClick:()=>tG(e=>Math.min(ai,e+1)),children:"Next"})]})]}),"kiro"!==n&&s0.length>0&&(0,a.jsx)(d.dK,{currentPage:an,pageSize:tV,totalItems:s0.length,onPageChange:tG,onPageSizeChange:e=>{tQ(e),tG(1)},className:"mt-2"}),m.length>0&&0===s0.length&&(0,a.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(e$,{showAutomation:sv,showAddConnection:"none"!==sk.type,onOpenAutomation:si,onAddConnection:s7,methods:"kiro"===n?null:sw,onSelectMethod:"kiro"===n?null:s9,extra:eH(n)?(0,a.jsx)(eW,{providerId:n,onWebLoginConnected:sR,onBulkImport:()=>"codex"===n?F(!0):J(!0)}):null})})]})]}),(0,a.jsx)(eE,{providerId:n}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),sS&&(0,a.jsx)("select",{value:to,onChange:e=>{var t;td(t=e.target.value),sD(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:sS.map(e=>(0,a.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!sy&&(e=[...sh,...tg.filter(e=>!sh.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type).map(e=>e.id).filter(e=>!tv.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[tv.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:sI,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>sP(e),children:"Disable All"})]}))]}),Object.values(eO).some(Boolean)&&(0,a.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(eO).filter(([,e])=>!!e).map(([e,t])=>(0,a.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[e,": ",t]},e))}),(()=>{let e,t,s;if(sy)return(0,a.jsx)(E,{providerStorageAlias:sC,providerDisplayAlias:s$,modelAliases:eg,copied:t4,onCopy:t8,onSetAlias:sK,onDeleteAlias:sB,onAliasesChanged:sE,connections:m,isAnthropic:sg});let r=[...sh,...tg.filter(e=>!sh.some(t=>t.id===e.id))].filter(e=>!e.type||"llm"===e.type),i=new Set(tv),l=r.filter(e=>!i.has(e.id)),o=r.filter(e=>i.has(e.id)),c=function({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:r="llm",includeLegacyAliases:i=!0}){let n=new Set(a.map(e=>e.id)),l=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(r&&e!==r||n.has(t.id))continue;let a=`${s}/${t.id}`;l.has(a)||(l.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!i)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||n.has(t)||l.has(s)||(l.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:r||"llm"}))}return o}({customModels:ej,modelAliases:eg,providerAlias:sC,builtInModels:sh,type:"llm"}),u=Math.min(t1,Math.max(1,Math.ceil(l.length/t2))),p=l.slice((u-1)*t2,u*t2);return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[c.map(e=>(0,a.jsx)(P,{model:{id:e.id,name:e.name},fullModel:`${s$}/${e.id}`,alias:e.alias,copied:t4,onCopy:t8,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?sF(e.id,e.type||"llm"):sB(e.alias)},testStatus:eC[e.id],onTest:m.length>0||sc?()=>am(e.id):void 0,isTesting:ez.has(e.id),isCustom:!0,isFree:!1,thinkingSuffix:sN(e.id)},`${e.source}-${e.fullModel}`)),p.map(e=>{let t=`${sC}/${e.id}`,s=`${n}/${e.id}`,r=Object.entries(eg).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(P,{model:e,fullModel:`${s$}/${e.id}`,alias:r,copied:t4,onCopy:t8,onSetAlias:t=>sK(e.id,t,sC),onDeleteAlias:()=>sB(r),testStatus:eC[e.id],onTest:m.length>0||sc?()=>am(e.id):void 0,isTesting:ez.has(e.id),isFree:e.isFree,onDisable:()=>sT(e.id),thinkingSuffix:sN(e.id)},e.id)}),l.length>t2&&(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(d.dK,{currentPage:u,pageSize:t2,totalItems:l.length,onPageChange:t5,onPageSizeChange:e=>{t3(e),t5(1)}})}),(0,a.jsxs)("button",{onClick:()=>eM(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===n&&(0,a.jsxs)("button",{onClick:()=>e_(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),("codebuddy-intl"===n||"codebuddy-cn"===n)&&(0,a.jsxs)("button",{onClick:()=>eL(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"openrouter"===n&&(0,a.jsxs)("button",{type:"button",onClick:()=>e1(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"opencode"===n&&(0,a.jsxs)("button",{onClick:()=>eX(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"kiro"===n&&(0,a.jsxs)("button",{onClick:()=>e2(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"cloudflare-ai"===n&&(0,a.jsxs)("button",{onClick:()=>e4(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===n&&m.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:sJ,disabled:tL,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:tL?{animation:"spin 1s linear infinite"}:void 0,children:tL?"progress_activity":"download"}),tL?(0,b.Tl)("Fetching..."):(0,b.Tl)("Fetch Qoder Models")]}),tb.length>0&&(e=new Set(Object.values(eg)),t=new Set(sh.map(e=>e.id)),0===(s=tb.filter(s=>!e.has(`${sC}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await sK(e.id,t,sC)},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,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>sO(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),eu&&ac,ee&&(0,a.jsx)(d.mz,{isOpen:!0,providerName:sn.name,methods:sw,onSelect:s9,onClose:()=>et(!1)}),"codex"===n&&(0,a.jsx)(eT,{isOpen:K,onClose:()=>F(!1),onSuccess:sR}),"grok-cli"===n&&(0,a.jsx)(eP,{isOpen:B,onClose:()=>J(!1),onSuccess:sR}),U&&("kiro"===n?(0,a.jsx)(d.Mh,{isOpen:!0,providerInfo:sn,onSuccess:sG,onRefresh:sR,initialBulkJobId:tF?.jobId||null,onBulkJobChange:sV,onClose:()=>L(!1)}):"cursor"===n?(0,a.jsx)(d.G9,{isOpen:!0,onSuccess:sG,onClose:()=>L(!1)}):"gitlab"===n?(0,a.jsx)(d.vj,{isOpen:!0,providerInfo:sn,onSuccess:sG,onClose:()=>L(!1)}):"xiaomi-mimo"===n?(0,a.jsx)(d.LH,{isOpen:!0,onSuccess:sG,onClose:()=>L(!1)}):(0,a.jsx)(d.LF,{isOpen:!0,provider:n,providerInfo:sn,onSuccess:sG,onClose:()=>L(!1)})),"iflow"===n&&H&&(0,a.jsx)(d.vE,{isOpen:!0,onSuccess:()=>{sR(),G(!1)},onClose:()=>G(!1)}),("codebuddy"===n||"codebuddy-cn"===n)&&V&&(0,a.jsx)(d.xl,{isOpen:!0,connectionIds:s3,endpoint:"codebuddy-cn"===n?"/api/oauth/codebuddy-cn/quota-cookie":"/api/oauth/codebuddy/quota-cookie",onSuccess:()=>{sR(),Q(!1)},onClose:()=>Q(!1)}),es&&(0,a.jsx)(Z,{isOpen:!0,provider:n,providerName:sn.name,isCompatible:sy,isAnthropic:sg,authType:sn?.authType,authHint:sn?.authHint,website:sn?.website,proxyPools:M,existingNames:m.map(e=>e.name).filter(Boolean),error:ei,onSave:sQ,onBulkDone:sR,onClose:()=>{en(""),ea(!1)}}),el&&eb&&(0,a.jsx)(d.wI,{isOpen:!0,connection:eb,proxyPools:M,onSave:sZ,onClose:()=>ed(!1)}),sy&&ec&&(0,a.jsx)(Y,{isOpen:!0,node:R,onSave:sq,onClose:()=>em(!1),isAnthropic:sg}),!sy&&eq&&(0,a.jsx)(X,{isOpen:!0,providerAlias:sC,providerDisplayAlias:s$,onSave:async e=>{let t=sn?.passthroughModels?e.split("/").pop():e;await sK(e,t,sC),eM(!1)},onClose:()=>eM(!1)}),"codebuddy"===n&&eD&&(0,a.jsx)(er,{isOpen:!0,connections:m,onModelsAdded:async e=>{for(let t of e)await sK(t.id,t.id,"cb");await sE(),await sz()},onClose:()=>e_(!1)}),("codebuddy-intl"===n||"codebuddy-cn"===n)&&eU&&(0,a.jsx)(eo,{isOpen:!0,providerId:n,connections:m,onModelsAdded:async e=>{let t="codebuddy-cn"===n?"cb-cn":"cbai";for(let s of e)await sK(s.id,s.id,t);await sE(),await sz()},onClose:()=>eL(!1)}),"openrouter"===n&&e0&&(0,a.jsx)(ex.A,{isOpen:!0,kind:"llm",connections:m,onModelsAdded:async e=>{for(let t of e)await sK(t.id,t.id.split("/").pop(),"openrouter");await sE(),await sz()},onClose:()=>e1(!1)}),"opencode"===n&&eY&&(0,a.jsx)(ep,{isOpen:!0,onModelsAdded:async e=>{for(let t of e)await sK(t.id,t.id,"oc");await sE(),await sz()},onClose:()=>eX(!1)}),"kiro"===n&&e5&&(0,a.jsx)(ev,{isOpen:!0,connections:m,onClose:()=>e2(!1)}),"cloudflare-ai"===n&&e3&&(0,a.jsx)(eS,{isOpen:!0,connections:m,onModelsAdded:async e=>{for(let t of e)await sK(t.id,t.id,sb);await sE()},onClose:()=>e4(!1)}),tx&&(0,a.jsx)(W,{isOpen:!0,connection:tx,reactive:!0===tc[tx.id],schedule:tu[tx.id]||null,onClose:()=>th(null),onSave:sL}),tN&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>tC(!1),onConfirm:()=>{window.localStorage.setItem(ss,"true"),tC(!1),t$(null),s6(tS||"oauth")},title:"Risk Notice",message:sn?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),tk&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>{ts||tw(null)},onConfirm:async()=>{if(ts)return;let e=tk?.onConfirm;if(e){ta(!0);try{await e()}finally{ta(!1)}}},title:tk?.title||"Confirm",message:tk?.message,variant:"danger",loading:ts})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},66331:(e,t,s)=>{Promise.resolve().then(s.bind(s,65219))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>r});let a={"Content-Type":"application/json"};async function r(e,t={}){let{body:s,headers:i,...n}=t,l={...n,headers:{...a,...i}};void 0!==s&&"string"!=typeof s?l.body=JSON.stringify(s):void 0!==s&&(l.body=s);let o=await fetch(e,l),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}r.get=(e,t)=>r(e,{...t,method:"GET"}),r.post=(e,t,s)=>r(e,{...s,method:"POST",body:t}),r.put=(e,t,s)=>r(e,{...s,method:"PUT",body:t}),r.patch=(e,t,s)=>r(e,{...s,method:"PATCH",body:t}),r.del=(e,t)=>r(e,{...t,method:"DELETE"})}},e=>{e.O(0,[2574,3862,3745,3416,9501,620,5497,5153,8441,3794,7358],()=>e(e.s=66331)),_N_E=e.O()}]);
|
|
15
|
+
]`;function eP({isOpen:e,onClose:t,onSuccess:s}){let[i,n]=(0,r.useState)(""),[l,o]=(0,r.useState)(!1),[c,m]=(0,r.useState)(null),u=()=>{l||(m(null),t())},p=async()=>{let e;try{e=JSON.parse(i)}catch{m({error:"Paste a JSON account or an array of accounts"});return}o(!0),m(null);try{let t=await fetch("/api/oauth/grok-cli/json-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await t.json();m(a.error?{error:a.error}:a),!a.error&&a.success>0&&s?.()}catch(e){m({error:e.message})}finally{o(!1)}},x=c&&!c.error?`Imported ${c.success}. Failed ${c.failed}.`:null;return(0,a.jsxs)(d.aF,{isOpen:e,onClose:u,title:"Import Grok CLI accounts",size:"lg",footer:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{variant:"secondary",onClick:u,disabled:l,children:"Close"}),(0,a.jsx)(d.$n,{onClick:p,disabled:l||!i.trim(),children:l?"Importing...":"Import"})]}),children:[(0,a.jsx)("p",{className:"mb-3 text-xs text-text-muted",children:"Paste one account or an array. Snake_case and camelCase are both accepted. A refresh token is refreshed before it is stored. The response never returns the tokens. Line import stays on the automation page."}),(0,a.jsx)("textarea",{className:"w-full rounded-lg border border-border bg-background p-3 font-mono text-xs text-text-main placeholder:text-text-muted focus:border-primary focus:outline-none",rows:8,placeholder:eO,value:i,onChange:e=>n(e.target.value),disabled:l}),c?(0,a.jsx)("div",{className:`mt-3 rounded-lg p-3 text-xs ${c.error?"bg-red-500/10 text-red-400":"bg-green-500/10 text-green-400"}`,children:c.error||x}):null]})}eP.propTypes={isOpen:O().bool.isRequired,onClose:O().func.isRequired,onSuccess:O().func};let eI=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],ez=/^[A-Za-z0-9-]+$/;function eE({providerId:e}){let t=(0,$.i)(),[s,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)([{name:"",value:""}]),[o,c]=(0,r.useState)({}),[m,u]=(0,r.useState)(!1),[p,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let t=!1;return fetch(`/api/providers/${e}/overrides`,{cache:"no-store"}).then(e=>e.ok?e.json():null).then(e=>{if(t||!e)return;let s=e.builtinHeaders||{},a=Object.entries({...s,...e.headers||{}}).map(([e,t])=>({name:e,value:t}));c(s),l(a.length?a:[{name:"",value:""}]),u(Object.keys(e.headers||{}).length>0)}).catch(()=>{}),()=>{t=!0}},[e]);let h=(e,t,s)=>{l(a=>a.map((a,r)=>r===e?{...a,[t]:s}:a))},b=(0,r.useCallback)(async()=>{let s={};for(let e of n.filter(e=>e.name.trim())){let a=e.name.trim();if(!ez.test(a))return void t.error(`Invalid header name: ${a}`);if(eI.includes(a.toLowerCase()))return void t.error(`Header ${a} cannot be overridden`);if(a in s)return void t.error(`Duplicate header name: ${a}`);e.value!==o[a]&&(s[a]=e.value)}x(!0);try{let a=await fetch(`/api/providers/${e}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:s})});if(!a.ok){let e=await a.json().catch(()=>({}));t.error(e.error||"Failed to save");return}u(Object.keys(s).length>0),t.success("Custom headers saved")}finally{x(!1)}},[n,o,e,t]);return(0,a.jsxs)(d.Zp,{padding:"xs",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center justify-between text-left",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,a.jsx)("span",{className:"text-sm font-semibold",children:"Custom Headers"}),m&&(0,a.jsx)(d.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:s?"expand_less":"expand_more"})]}),s&&(0,a.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,a.jsx)("div",{className:"flex flex-col gap-2",children:n.map((e,t)=>{let s=e.name.trim()in o&&e.value!==o[e.name.trim()];return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:e.name,onChange:e=>h(t,"name",e.target.value),placeholder:"Header-Name",spellCheck:!1,className:"w-44 rounded-md border border-border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none"}),(0,a.jsx)("input",{value:e.value,onChange:e=>h(t,"value",e.target.value),placeholder:"Value",spellCheck:!1,title:s?"Overridden":e.name.trim()in o?"Registry default":"",className:`min-w-0 flex-1 rounded-md border bg-background px-2 py-1.5 text-sm focus:border-primary focus:outline-none ${s?"border-amber-400/60":"border-border"}`}),(0,a.jsx)("button",{type:"button",title:"Remove header",onClick:()=>l(e=>e.length>1?e.filter((e,s)=>s!==t):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},t)})}),(0,a.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>l(e=>[...e,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{type:"button",disabled:p,onClick:()=>{l(Object.entries(o).map(([e,t])=>({name:e,value:t})))},className:"rounded-md border border-border px-3 py-1.5 text-xs hover:bg-black/[0.03] dark:hover:bg-white/[0.03] disabled:opacity-50",children:"Reset"}),(0,a.jsx)("button",{type:"button",disabled:p,onClick:b,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:p?"Saving...":"Save"})]})]})]})]})}eE.propTypes={providerId:O().string.isRequired};var eR=s(5539);let eq="$HOME/.zevai/bin/zevai-aistudio-waa",eM=`OUT="${eq}" bash "$(npm root -g)/zevairouter/vendor/aistudio-waa/build.sh"`,eD=`OUT="${eq}" bash vendor/aistudio-waa/build.sh`;function e_({value:e,copied:t,onCopy:s,id:r}){return(0,a.jsxs)("div",{className:"flex items-start gap-2 rounded-lg bg-sidebar px-3 py-2",children:[(0,a.jsx)("code",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all text-xs font-mono text-text-main",children:e}),(0,a.jsxs)("button",{type:"button",onClick:()=>s(e,r),className:"inline-flex shrink-0 items-center gap-1 rounded-md bg-primary px-2 py-1 text-[11px] font-medium text-white hover:bg-primary/90","aria-label":`Copy: ${e}`,children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:t===r?"check":"content_copy"}),t===r?"Copied":"Copy"]})]})}function eU({n:e,title:t,children:s,variant:r="missing"}){return(0,a.jsxs)("li",{className:"flex gap-3",children:[(0,a.jsx)("span",{className:`flex size-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold ${"ready"===r?"bg-emerald-500/15 text-emerald-800 dark:text-emerald-300":"bg-amber-500/15 text-amber-800 dark:text-amber-300"}`,children:e}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-2",children:[(0,a.jsx)("p",{className:"ready"===r?"text-sm font-medium text-emerald-900 dark:text-emerald-200":"text-sm font-medium text-amber-900 dark:text-amber-200",children:t}),s]})]})}function eL({status:e,copied:t,copy:s,variant:r}){let i=e?.buildCommand||eM,n=e?.npmCommand||eM,l=e?.checkoutCommand||eD,o="ready"===r?"text-xs text-emerald-800/80 dark:text-emerald-300/80":"text-xs text-amber-800 dark:text-amber-300";return(0,a.jsxs)("ol",{className:"space-y-4",children:[(0,a.jsxs)(eU,{n:1,variant:r,title:"Install prerequisites",children:[(0,a.jsx)("p",{className:o,children:"You need Go, git, curl, and a C/C++ compiler, plus about 1 GB of disk. The first build takes several minutes; later builds are much faster."}),(0,a.jsx)("p",{className:o,children:"macOS (git and curl come with the Command Line Tools):"}),(0,a.jsx)(e_,{id:"prereq-mac-clt",copied:t,onCopy:s,value:"xcode-select --install"}),(0,a.jsx)(e_,{id:"prereq-mac-go",copied:t,onCopy:s,value:"brew install go"}),(0,a.jsx)("p",{className:o,children:"Debian / Ubuntu:"}),(0,a.jsx)(e_,{id:"prereq-deb",copied:t,onCopy:s,value:"sudo apt install golang git curl build-essential"})]}),(0,a.jsxs)(eU,{n:2,variant:r,title:"Build the helper",children:[(0,a.jsxs)("p",{className:o,children:["Run this command. It writes the binary to the exact path this router looks for",e?.binPath?(0,a.jsxs)(a.Fragment,{children:[" (",(0,a.jsx)("code",{className:"font-mono",children:e.binPath}),")"]}):null,"."]}),(0,a.jsx)(e_,{id:"build-cmd",copied:t,onCopy:s,value:i}),n!==i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:o,children:"From an npm global install you can also run:"}),(0,a.jsx)(e_,{id:"build-npm",copied:t,onCopy:s,value:n})]}),l!==i&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:o,children:"From a git checkout of the repo:"}),(0,a.jsx)(e_,{id:"build-checkout",copied:t,onCopy:s,value:l})]}),!e?.binPath&&(0,a.jsxs)("p",{className:o,children:["If this router uses a custom ",(0,a.jsx)("code",{className:"font-mono",children:"DATA_DIR"}),", set"," ",(0,a.jsx)("code",{className:"font-mono",children:"OUT=$DATA_DIR/bin/zevai-aistudio-waa"}),"."]})]}),(0,a.jsx)(eU,{n:3,variant:r,title:"No router restart needed",children:(0,a.jsx)("p",{className:o,children:"The helper starts on the next AI Studio request. Stay on this page and click Check again after the build finishes."})}),(0,a.jsx)(eU,{n:4,variant:r,title:"Add a connection",children:(0,a.jsxs)("p",{className:o,children:["Use ",(0,a.jsx)("strong",{children:"Login via Browser"}),", or paste the storage-state JSON of a signed-in aistudio.google.com session."]})})]})}function eK(){let[e,t]=(0,r.useState)(null),[s,i]=(0,r.useState)(!1),[n,l]=(0,r.useState)(!0),[o,d]=(0,r.useState)(!1),[c,m]=(0,r.useState)(0),{copied:u,copy:p}=(0,h.C)(2e3);if((0,r.useEffect)(()=>{let e=new AbortController;return fetch("/api/providers/aistudio/helper",{cache:"no-store",signal:e.signal}).then(e=>e.ok?e.json():Promise.reject(Error("bad status"))).then(e=>{i(!1),t({present:!!e?.present,binPath:"string"==typeof e?.binPath?e.binPath:"",buildCommand:"string"==typeof e?.buildCommand?e.buildCommand:"",npmCommand:"string"==typeof e?.npmCommand?e.npmCommand:"",checkoutCommand:"string"==typeof e?.checkoutCommand?e.checkoutCommand:"",restartRequired:!!e?.restartRequired})}).catch(e=>{e?.name!=="AbortError"&&(t(null),i(!0))}).finally(()=>{e.signal.aborted||l(!1)}),()=>e.abort()},[c]),n&&!e&&!s)return null;let x=s||!e?.present;return(0,a.jsx)("div",{className:"space-y-2",children:x?(0,a.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-3",role:"status",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-amber-500",children:"warning"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)("p",{className:"text-xs font-semibold text-amber-900 dark:text-amber-200",children:s?"Could not check the AI Studio helper":"AI Studio helper is not built yet"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed text-amber-800 dark:text-amber-300",children:"The npm package ships the helper source only; the binary is not included. Build it once on this machine before adding a connection."})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>m(e=>e+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-amber-500/40 px-2 py-1 text-[11px] font-medium text-amber-900 hover:bg-amber-500/10 dark:text-amber-200",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),(0,a.jsx)(eL,{status:e,copied:u,copy:p,variant:"missing"})]}):(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-emerald-500/30 bg-emerald-500/10 px-3 py-2",role:"status",children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"material-symbols-outlined mt-0.5 shrink-0 text-[16px] text-emerald-500",children:"check_circle"}),(0,a.jsxs)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-emerald-800 dark:text-emerald-300",children:["Helper ready at ",(0,a.jsx)("code",{className:"font-mono",children:e.binPath}),". No rebuild needed unless you update the router."]}),(0,a.jsx)("button",{type:"button",onClick:()=>d(e=>!e),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200","aria-expanded":o,children:o?"Hide setup":"Setup steps"}),(0,a.jsxs)("button",{type:"button",onClick:()=>m(e=>e+1),className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-emerald-500/40 px-2 py-1 text-[11px] font-medium text-emerald-800 hover:bg-emerald-500/10 dark:text-emerald-200",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"refresh"}),"Check again"]})]}),o&&(0,a.jsx)(eL,{status:e,copied:u,copy:p,variant:"ready"})]})})}e_.propTypes={value:O().string.isRequired,copied:O().string,onCopy:O().func.isRequired,id:O().string.isRequired},eU.propTypes={n:O().number.isRequired,title:O().string.isRequired,children:O().node,variant:O().oneOf(["missing","ready"])},eL.propTypes={status:O().shape({binPath:O().string,buildCommand:O().string,npmCommand:O().string,checkoutCommand:O().string}),copied:O().string,copy:O().func.isRequired,variant:O().oneOf(["missing","ready"])};let eF="kiro-bulk-import-active-job",eB="Bulk import progress expired or was cleared.",eJ={claude:"claudeAutoPing",codex:"codexAutoPing"};function eH(e){return eR.w.has(e)||"codex"===e||"grok-cli"===e}function eW({providerId:e,onWebLoginConnected:t,onBulkImport:s}){let r=[];return(eR.w.has(e)&&r.push((0,a.jsx)(eR.A,{providerId:e,onConnected:t},"web-login")),("codex"===e||"grok-cli"===e)&&r.push((0,a.jsx)(d.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:s,className:"w-full sm:w-auto",children:"Bulk Add"},"bulk-add")),r.length)?(0,a.jsx)(a.Fragment,{children:r}):null}function eG(e){return["completed","cancelled","failed"].includes(e)}async function eV(e){if(!e)return null;let t=await fetch(`/api/oauth/kiro/bulk-import/${e}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eQ(e="active"){let t=await fetch(`/api/oauth/kiro/bulk-import/latest?scope=${encodeURIComponent(e)}`,{cache:"no-store"}),s=await t.json();return{res:t,data:s}}async function eZ(e){let t=new AbortController,s=window.setTimeout(()=>t.abort(),8e3);try{let s=await fetch(e,{cache:"no-store",signal:t.signal}),a=null;try{a=await s.json()}catch{a=null}return{response:s,data:a}}finally{window.clearTimeout(s)}}function eY(){let e,t=(0,i.useParams)(),s=(0,i.useRouter)(),n=t.id,[m,f]=(0,r.useState)([]),[T,O]=(0,r.useState)(!0),[I,z]=(0,r.useState)(""),[R,q]=(0,r.useState)(null),[M,D]=(0,r.useState)([]),[U,L]=(0,r.useState)(!1),[K,F]=(0,r.useState)(!1),[B,J]=(0,r.useState)(!1),[H,G]=(0,r.useState)(!1),[V,Q]=(0,r.useState)(!1),[ee,et]=(0,r.useState)(!1),[es,ea]=(0,r.useState)(!1),[ei,en]=(0,r.useState)(""),[el,ed]=(0,r.useState)(!1),[ec,em]=(0,r.useState)(!1),[eu,eh]=(0,r.useState)(!1),[eb,ef]=(0,r.useState)(null),[eg,ey]=(0,r.useState)({}),[ej,ek]=(0,r.useState)([]),[ew,eN]=(0,r.useState)(!1),[eC,eA]=(0,r.useState)({}),[eO,eI]=(0,r.useState)({}),[ez,eR]=(0,r.useState)(()=>new Set),[eq,eM]=(0,r.useState)(!1),[eD,e_]=(0,r.useState)(!1),[eU,eL]=(0,r.useState)(!1),[eY,eX]=(0,r.useState)(!1),[e0,e1]=(0,r.useState)(!1),[e5,e2]=(0,r.useState)(!1),[e3,e4]=(0,r.useState)(!1),[e8,e6]=(0,r.useState)([]),[e7,e9]=(0,r.useState)("__none__"),[te,tt]=(0,r.useState)(!1),[ts,ta]=(0,r.useState)(!1),[tr,ti]=(0,r.useState)(null),[tn,tl]=(0,r.useState)(""),[to,td]=(0,r.useState)("auto"),[tc,tm]=(0,r.useState)({}),[tu,tp]=(0,r.useState)({}),[tx,th]=(0,r.useState)(null),[tb,tf]=(0,r.useState)([]),[tg,ty]=(0,r.useState)([]),[tv,tj]=(0,r.useState)([]),[tk,tw]=(0,r.useState)(null),[tN,tC]=(0,r.useState)(!1),[tS,t$]=(0,r.useState)(null),[tA,tT]=(0,r.useState)(!1),[tO,tP]=(0,r.useState)(!1),[tI,tz]=(0,r.useState)(null),[tE,tR]=(0,r.useState)({}),[tq,tM]=(0,r.useState)(null),tD=(0,r.useRef)(!1),t_=(0,r.useRef)(null),tU=(0,r.useRef)("1"),[tL,tK]=(0,r.useState)(!1),[tF,tB]=(0,r.useState)(null),[tJ,tH]=(0,r.useState)(""),[tW,tG]=(0,r.useState)(1),[tV,tQ]=(0,r.useState)(20),[tZ,tY]=(0,r.useState)("all"),[tX,t0]=(0,r.useState)(""),[t1,t5]=(0,r.useState)(1),[t2,t3]=(0,r.useState)(20),{copied:t4,copy:t8}=(0,h.C)(),t6=(0,r.useRef)(0),t7=(0,r.useRef)([]),t9=(0,r.useRef)(!0),se=(0,r.useRef)(null),st=(0,$.i)(e=>e.error),ss="ag_risk_confirmed",sa=(0,r.useCallback)(()=>{tB(null),tH(""),t6.current=0,window.localStorage.removeItem(eF)},[]),sr=()=>{L(!0)},si=()=>{"kiro"===n&&tF?.jobId&&eG(tF.status)&&sa(),s.push(p(n))},sn=R?{id:R.id,name:R.name||("anthropic-compatible"===R.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===R.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===R.type?"AC":"OC",apiType:R.apiType,baseUrl:R.baseUrl,type:R.type}:c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n]||c.br[n],sl=!sn||R||(sn.serviceKinds??["llm"]).includes("llm")?sn:null,so=sl?.authModes||[],sd=!!c.zN[n]||!!c.IS[n]||so.includes("oauth"),sc=!!c.fg[n]||so.includes("apikey"),sm=!!c.IS[n]?.noAuth,su=(0,y.F)("kiro"===n),sp="aistudio"===n?m.filter(e=>!1!==e.isActive).map(e=>`${e.id}:${e.updatedAt||""}`).join(","):"",sx=(0,v.M)("aistudio"===n,sp),sh=(0,v.Q)(n,sx,(0,x.KC)(n)),sb="kiro"===n?su:sh,sf=(0,c.wG)(n),sg=(0,c.mq)(n),sy=(0,c.gb)(n),sv=sg||sy,sj=u(n),sk=function({providerId:e,providerInfo:t,isOAuth:s,supportsApiKeyAuth:a,isCompatible:r}){if(!t||t.noAuth||t.authModes?.includes("none"))return[];let i=[];for(let n of(s&&S(i,"oauth"),(a||r||"cookie"===t.authType||!s)&&S(i,"apikey"),N[e]||[]))S(i,n);return i.map(t=>{let s=w[t];return s?{...s,...C[e]?.[t]}:null}).filter(Boolean)}({providerId:n,providerInfo:sl,isOAuth:sd,supportsApiKeyAuth:sc,isCompatible:sg||sy}),sw=function(e,{specializedChooser:t=!1}={}){return e.length?t?{type:"specialized"}:1===e.length?{type:"method",methodId:e[0].id}:{type:"chooser"}:{type:"none"}}(sk,{specializedChooser:"kiro"===n}),sN=sk.map(e=>"quota-cookie"===e.id&&0===m.length?{...e,disabled:!0,description:"Add a CodeBuddy connection before attaching its quota cookie."}:e),sC=e=>{if(!to||"auto"===to)return null;let t=(0,A.kl)(n,e);return t&&t.includes(to)?to:null},sS=sv?n:sf,s$=(()=>{let e=new Set,t=new Set,s=s=>{if(!s||t.has(s))return;t.add(s);let a=(0,A.kl)(n,s);a&&a.forEach(t=>{"none"!==t&&e.add(t)})};for(let e of sb)s(e.id);for(let e of tg)s(e.id);for(let e of ej)e.providerAlias===sS&&"llm"===(e.kind||e.type||"llm")&&s(e.id);return e.size?["auto",...e]:null})(),sA=sv?R?.prefix||n:sf,sT=(0,r.useCallback)(async()=>{try{let e=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sS)}`,{cache:"no-store"}),t=await e.json();e.ok&&tj(t.ids||[])}catch(e){console.log("Error fetching disabled models:",e)}},[sS]),sO=async e=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sS,ids:[e]})})).ok&&await sT()}catch(e){console.log("Error disabling model:",e)}},sP=async e=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sS)}&id=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sT()}catch(e){console.log("Error enabling model:",e)}},sI=async e=>{e.length&&tw({title:"Disable All Models",message:`Disable all ${e.length} model(s)?`,onConfirm:async()=>{tw(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:sS,ids:e})})).ok&&await sT()}catch(e){console.log("Error disabling all models:",e)}}})},sz=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(sS)}`,{method:"DELETE"})).ok&&await sT()}catch(e){console.log("Error enabling all models:",e)}},sE=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/custom",{cache:"no-store"}),t=await e.json();e.ok&&ek(t.models||[])}catch(e){console.log("Error fetching custom models:",e)}},[]),sR=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/models/alias"),t=await e.json();e.ok&&ey(t.aliases||{})}catch(e){console.log("Error fetching aliases:",e)}},[]);(0,r.useEffect)(()=>{"kilocode"===n&&fetch("/api/providers/kilo/free-models").then(e=>e.json()).then(e=>{e.models?.length&&ty(e.models)}).catch(()=>{})},[n]);let sq=(0,r.useCallback)(async()=>{try{z("");let[e,t,s,a]=await Promise.allSettled([eZ("/api/providers"),eZ("/api/provider-nodes"),eZ("/api/proxy-pools?isActive=true"),eZ("/api/settings")]),r="fulfilled"===e.status?e.value.response:null,i="fulfilled"===e.status?e.value.data:{},l="fulfilled"===t.status?t.value.response:null,o="fulfilled"===t.status?t.value.data:{},d="fulfilled"===s.status?s.value.response:null,m="fulfilled"===s.status?s.value.data:{},u="fulfilled"===a.status?a.value.response:null,p=u?.ok&&a.value.data||{};if(r?.ok){let e=(i.connections||[]).filter(e=>e.provider===n);t7.current=e,f(e)}else z("Connections could not be loaded.");d?.ok&&D(m.proxyPools||[]);let x=(p.providerStrategies||{})[n]||{};ti(x.fallbackStrategy||null),tl(null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1"),tU.current=null!=x.stickyRoundRobinLimit?String(x.stickyRoundRobinLimit):"1";let h=(p.providerThinking||{})[n]||{};td(h.mode||"auto");let b=eJ[n];if(tm(b&&p?.[b]?.connections||{}),tp(b&&p?.[b]?.schedules||{}),l?.ok){let e=(o.nodes||[]).find(e=>e.id===n)||null;if(!e&&((0,c.mq)(n)||(0,c.gb)(n)))for(let t=0;t<3;t+=1){if(await new Promise(e=>setTimeout(e,150)),!t9.current)return;let{response:t,data:s}=await eZ("/api/provider-nodes");if(!t9.current)return;if(t.ok&&(e=(s.nodes||[]).find(e=>e.id===n)||null))break}q(e)}}catch(e){console.log("Error fetching connections:",e),t9.current&&z("Connections could not be loaded.")}finally{t9.current&&O(!1)}},[n]),sM=async e=>{try{let t=await fetch(`/api/provider-nodes/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),s=await t.json();t.ok&&(q(s.node),await sq(),em(!1))}catch(e){console.log("Error updating provider node:",e)}},sD=async(e,t)=>{try{let s=await fetch("/api/settings",{cache:"no-store"}),a=(s.ok?await s.json():{}).providerStrategies||{},r={};e&&(r.fallbackStrategy=e),"round-robin"===e&&""!==t&&(r.stickyRoundRobinLimit=Number(t)||3);let i={...a};0===Object.keys(r).length?delete i[n]:i[n]=r,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:i})})}catch(e){console.log("Error saving provider strategy:",e)}},s_=async e=>{try{let t=await fetch("/api/settings",{cache:"no-store"}),s={...(t.ok?await t.json():{}).providerThinking||{}};e&&"auto"!==e?s[n]={mode:e}:delete s[n],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:s})})}catch(e){console.log("Error saving thinking config:",e)}},sU=async(e,t)=>{try{(await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerSpecificData:{paidSubscription:t}})})).ok&&f(s=>s.map(s=>s.id===e?{...s,providerSpecificData:{...s.providerSpecificData,paidSubscription:t}}:s))}catch(e){console.log("Error updating paid flag:",e)}},sL=async(e,t)=>{let s=eJ[n];if(!s)return;let a={...tc,[e]:t};tm(a);try{let e=await fetch("/api/settings",{cache:"no-store"}),t={...(e.ok?await e.json():{})[s]||{},connections:a};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:t})})).ok)throw Error("Failed to save auto-ping setting")}catch(e){tm(tc),console.log("Error saving auto-ping config:",e)}},sK=async({reactive:e,schedule:t})=>{let s=eJ[n];if(!tx||!s)return;let a={...tc,[tx.id]:e},r={...tu,[tx.id]:t};tm(a),tp(r);try{let e=await fetch("/api/settings",{cache:"no-store"}),t=e.ok?await e.json():{};if(!(await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[s]:{...t[s]||{},connections:a,schedules:r}})})).ok)throw Error("Failed to save auto-ping schedule")}catch(e){tm(tc),tp(tu),console.log("Error saving auto-ping schedule:",e)}};(0,r.useEffect)(()=>{sq(),sR(),sE(),sT()},[sq,sR,sE,sT]),(0,r.useEffect)(()=>(t9.current=!0,()=>{t9.current=!1,null!==se.current&&window.cancelAnimationFrame(se.current)}),[]),(0,r.useEffect)(()=>{tw(null),eA({}),eI({}),eR(new Set),tf([]),tR({}),tM(null),tz(null),tT(!1),tP(!1),tD.current=!0,tH("")},[n]),(0,r.useEffect)(()=>{tG(1),t5(1),tY("all"),t0("")},[n]),(0,r.useEffect)(()=>{tG(1)},[tZ,tV,tX]),(0,r.useEffect)(()=>{eN(!1)},[n]),(0,r.useEffect)(()=>{t5(1)},[t2,tv.length,sb.length,tg.length]),(0,r.useEffect)(()=>{if("kiro"!==n)return;let e=window.localStorage.getItem(eF),t=!1;return(async()=>{try{if(tH(""),tF?.jobId)return;let a=await eQ();if(!t&&a.res.ok&&a.data?.job){tB(a.data.job),t6.current=a.data.job.summary?.success||0,window.localStorage.setItem(eF,a.data.job.jobId);return}if(e){var s;let a=await eV(e);if(!t&&a?.res.ok&&a.data?.job&&(s=a.data.job.status,["queued","running","needs_manual"].includes(s))){tB(a.data.job),t6.current=a.data.job.summary?.success||0;return}sa(),tH(eB)}}catch{t||tH(eB)}})(),()=>{t=!0}},[sa,tF?.jobId,n]),(0,r.useEffect)(()=>{if(!("kiro"!==n||!tF?.jobId||eG(tF.status)))return(0,k.M)(async e=>{let t=await eV(tF.jobId);if(!e()){if(t?.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>t6.current&&(t6.current=s,await sq(),e()))return;tH(""),tB(t.data.job);return}if(t?.res.status===404){let t=await eQ();if(e())return;if(t.res.ok&&t.data?.job){let s=t.data.job.summary?.success||0;if(s>t6.current&&(t6.current=s,await sq(),e()))return;tH(""),tB(t.data.job),window.localStorage.setItem(eF,t.data.job.jobId);return}sa(),tH(eB)}}},2e3)},[sa,sq,tF?.jobId,tF?.status,n]),(0,r.useEffect)(()=>{let e=(c.zN[n]||c.fg[n]||c.IS[n]||c.nJ[n])?.modelsFetcher;e&&g(e).then(tf)},[n]);let sF=async(e,t,s=sf)=>{let a=`${s}/${e}`;try{let e=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:a,alias:t})});if(e.ok)await sR();else{let t=await e.json();alert(t.error||"Failed to set alias")}}catch(e){console.log("Error setting alias:",e)}},sB=async(e,t="llm")=>{try{let s=new URLSearchParams({providerAlias:sS,id:e,type:t});(await fetch(`/api/models/custom?${s}`,{method:"DELETE"})).ok&&(await sE(),window.dispatchEvent(new CustomEvent("customModelChanged")))}catch(e){console.log("Error deleting custom model:",e)}},sJ=async e=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(e)}`,{method:"DELETE"})).ok&&await sR()}catch(e){console.log("Error deleting alias:",e)}},sH=async()=>{if(tL)return;let e=m.find(e=>!1!==e.isActive);if(!e)return void alert((0,b.Tl)("Please add an active Qoder connection first"));tK(!0);try{let t=await fetch(`/api/providers/${e.id}/models`),s=await t.json();if(!t.ok)return void alert(s.error||(0,b.Tl)("Failed to fetch models"));let a=s.models||[];if(0===a.length)return void alert((0,b.Tl)("No models returned"));let r={...eg},i=0;for(let e of a){let t=e.id||e.name;if(!t)continue;let s=t.replace(/^qoder\//,""),a=`${sS}/${s}`;!Object.values(r).includes(a)&&(r[s]||(await sF(s,s,sS),r[s]=a,i+=1))}0===i?alert((0,b.Tl)("All models already exist, no new models added")):alert((0,b.Tl)("Successfully added")+` ${i} `+(0,b.Tl)("models"))}catch(e){console.log("Error importing Qoder models:",e),alert((0,b.Tl)("Error fetching models")+": "+e.message)}finally{tK(!1)}},sW=async()=>{let e=[...m];if(tA||0===e.length)return;let t=Object.fromEntries(e.map(e=>[e.id,{state:"queued",error:null}]));tD.current=!1,tT(!0),tP(!1),tz(null),tR(t),tM({total:e.length,completed:0,passed:0,failed:0,stopped:!1});let s=0,a=0;try{for(let t=0;t<e.length;t+=1){if(tD.current){tM({total:e.length,completed:t,passed:s,failed:a,stopped:!0});break}let r=e[t];if(!t7.current.some(e=>e.id===r.id)){tR(e=>({...e,[r.id]:{state:"skipped",error:null}})),tM({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1});continue}tz(r.id),tR(e=>({...e,[r.id]:{state:"testing",error:null}}));try{let e=await fetch(`/api/providers/${r.id}/test`,{method:"POST"}),t=await e.json(),i=!!t.valid;i?s+=1:a+=1,tR(e=>({...e,[r.id]:{state:i?"success":"failed",error:i?t.warning||null:t.error||null}}))}catch(e){a+=1,tR(t=>({...t,[r.id]:{state:"failed",error:e.message||"Test failed"}}))}tM({total:e.length,completed:t+1,passed:s,failed:a,stopped:!1}),t<e.length-1&&await new Promise(e=>setTimeout(e,250))}}finally{tz(null),tT(!1),tP(!1),tD.current=!1}},sG=async e=>{tw({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{tw(null);try{(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok&&f(m.filter(t=>t.id!==e))}catch(e){console.log("Error deleting connection:",e)}}})},sV=()=>{sq(),L(!1)},sQ=(0,r.useCallback)(e=>{(tB(e),tH(""),e?.jobId)?(window.localStorage.setItem(eF,e.jobId),t6.current=Math.max(t6.current,e.summary?.success||0)):sa()},[sa]),sZ=async e=>{en("");try{let t=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:n,...e})}),s=null;try{s=await t.json()}catch{s=null}if(t.ok){await sq(),ea(!1);return}en(s?.error||"Failed to save connection")}catch(e){console.log("Error saving connection:",e),en("Failed to save connection")}},sY=async e=>{try{(await fetch(`/api/providers/${eb.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok&&(await sq(),ed(!1))}catch(e){console.log("Error updating connection:",e)}},sX=async(e,t)=>{try{let s=await fetch(`/api/providers/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:t})});if(s.ok){let a=await s.json().catch(()=>null);f(s=>s.map(s=>s.id===e?{...s,isActive:t,...a?.connection||{}}:s))}}catch(e){console.log("Error updating connection status:",e)}},s0=async(e,t)=>{let s=[...m];[s[e],s[t]]=[s[t],s[e]],f(s);try{let[a,r]=await Promise.all([fetch(`/api/providers/${s[e].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:e+1})}),fetch(`/api/providers/${s[t].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:t+1})})]);a.ok&&r.ok||(console.log("Priority swap rejected:",a.status,r.status),await sq())}catch(e){console.log("Error swapping priority:",e),await sq()}},s1=(0,r.useMemo)(()=>{let e=tX.trim().toLowerCase();return m.filter(t=>!!(0,j.i2)(t,tZ)&&(!e||[t.name,t.email,t.id,t.account,t.username,t.label,t.authType,t.notes,t.proxyPoolId].filter(Boolean).join(" ").toLowerCase().includes(e)))},[m,tZ,tX]),s5=(0,r.useMemo)(()=>j.gJ.reduce((e,t)=>(e[t.id]="all"===t.id?m.length:m.filter(e=>(0,j.i2)(e,t.id)).length,e),{}),[m]),s2=e8.filter(e=>m.some(t=>t.id===e)),s3=m.filter(e=>s2.includes(e.id)),s4="codebuddy"===n||"codebuddy-cn"===n?(s3.length>0?s3:m).map(e=>e.id):[],s8=s1.length>0&&s1.every(e=>s2.includes(e.id)),s6=e=>{switch(e){case"oauth":if("antigravity"===n&&"true"!==window.localStorage.getItem(ss)){t$(e),tC(!0);return}sr();return;case"apikey":en(""),ea(!0);return;case"cookie":G(!0);return;case"quota-cookie":m.length>1&&0===s3.length?alert("Select the CodeBuddy connection(s) that should use this quota cookie first."):Q(!0);return;default:st(`Unsupported connection method: ${e}`,"Add Connection")}},s7=e=>{null!==se.current&&window.cancelAnimationFrame(se.current),se.current=window.requestAnimationFrame(()=>{se.current=null,s6(e)})},s9=()=>{"specialized"===sw.type?sr():"method"===sw.type?s6(sw.methodId):"chooser"===sw.type&&et(!0)},ae=e=>{et(!1),s7(e)},at=(()=>{if(0===s3.length)return"";let e=new Set(s3.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"));if(1===e.size){let t=[...e][0];if("__none__"===t)return"All selected currently unbound";let s=M.find(e=>e.id===t);return`All selected currently bound to ${s?.name||t}`}return"Selected connections have mixed proxy bindings"})(),as=()=>{te||eh(!1)},aa=async e=>{tt(!0);try{let t=0,s=0,a=Array.from({length:Math.min(8,e.length)},async()=>{for(;s<e.length;){let a=s;s+=1;let{connectionId:r,proxyPoolId:i}=e[a];try{(await fetch(`/api/providers/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:i})})).ok||(t+=1)}catch(e){console.log("Error applying proxy for",r,e),t+=1}}});await Promise.all(a),t>0&&alert(`Updated with ${t} failed request(s).`),await sq(),eh(!1)}finally{tt(!1)}},ar=e=>aa(s3.map(t=>({connectionId:t.id,proxyPoolId:e}))),ai=e=>{let t="gsuite"===e?"GSuite (non-Gmail)":"Gmail (@gmail.com)";tw({title:`Delete ${t}`,message:`Delete ALL ${t} accounts for this provider? This cannot be undone.`,onConfirm:async()=>{tw(null);try{(await fetch("/api/providers/bulk-delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:sl?.id||n,emailFilter:e})})).ok&&(e6([]),await sq())}catch(e){console.error("bulk delete error:",e)}}})},an=Math.max(1,Math.ceil(s1.length/tV)),al=Math.min(tW,an),ao=s1.slice((al-1)*tV,al*tV),ad=(0,a.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03]",children:ao.map((e,t)=>{let s,r=m.findIndex(t=>t.id===e.id);return(0,a.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,a.jsx)("label",{className:"flex w-8 shrink-0 items-center justify-center",children:(0,a.jsx)("input",{type:"checkbox",checked:(s=e.id,s2.includes(s)),onChange:()=>{var t;return t=e.id,void e6(e=>e.includes(t)?e.filter(e=>e!==t):[...e,t])},className:"size-4 rounded border-black/20 dark:border-white/20","aria-label":`Select ${e.name||e.email||e.id}`})}),(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(_,{connection:e,proxyPools:M,isOAuth:sd,isFirst:0===r,isLast:r===m.length-1,onMoveUp:()=>s0(r,r-1),onMoveDown:()=>s0(r,r+1),onToggleActive:t=>sX(e.id,t),autoPingEnabled:!0===tc[e.id],onToggleAutoPing:eJ[n]&&"oauth"===e.authType?t=>sL(e.id,t):void 0,autoPingScheduled:tu[e.id]?.enabled===!0,onOpenAutoPingSchedule:eJ[n]&&"oauth"===e.authType?()=>th(e):void 0,onTogglePaid:"antigravity"===n?t=>sU(e.id,t):void 0,onUpdateProxy:async t=>{try{(await fetch(`/api/providers/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:t||null})})).ok&&f(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:()=>{ef(e),ed(!0)},onDelete:()=>sG(e.id),oneByOneStatus:tE[e.id]||null})})]},e.id)})}),ac=M.filter(e=>!0===e.isActive),am=(0,a.jsx)(d.aF,{isOpen:eu,onClose:as,title:`Apply Proxy (${s3.length} selected)`,children:(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsxs)("button",{onClick:()=>{let e=M.filter(e=>!0===e.isActive);return 0===e.length?void alert("No active proxy pools available."):aa(s3.map((t,s)=>({connectionId:t.id,proxyPoolId:e[s%e.length].id})))},disabled:te||0===ac.length,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,a.jsxs)("button",{onClick:()=>ar(null),disabled:te,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,a.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),M.map(e=>(0,a.jsxs)("button",{onClick:()=>ar(e.id),disabled:te||!0!==e.isActive,className:"flex items-center gap-2 rounded-lg px-3 py-2 text-left transition-colors hover:bg-black/[0.04] dark:hover:bg-white/[0.04] disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,a.jsx)("span",{className:"truncate text-sm text-text-main",children:e.name}),!0!==e.isActive&&(0,a.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},e.id))]}),te&&(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,a.jsx)(d.$n,{onClick:as,variant:"ghost",fullWidth:!0,disabled:te,children:"Cancel"})]})}),au=async e=>{eR(t=>new Set(t).add(e));try{let t=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${sS}/${e}`})}),s=await t.json();eA(t=>({...t,[e]:s.ok?"ok":"error"})),eI(t=>({...t,[e]:s.ok?"":s.error||"Model not reachable"}))}catch{eA(t=>({...t,[e]:"error"})),eI(t=>({...t,[e]:"Network error"}))}finally{eR(t=>{let s=new Set(t);return s.delete(e),s})}};return T?(0,a.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,a.jsx)(d.Qv,{}),(0,a.jsx)(d.Qv,{})]}):sl?(0,a.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)(l(),{href:"/dashboard/providers",className:"inline-flex items-center gap-1 text-sm text-text-muted hover:text-primary transition-colors mb-4",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-lg",children:"arrow_back"}),"Back to Providers"]}),(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-3 sm:gap-4",children:[(0,a.jsx)("div",{className:"flex size-12 shrink-0 items-center justify-center rounded-lg",style:{backgroundColor:`${sl.color}15`},children:ew?(0,a.jsx)("span",{className:"text-sm font-bold",style:{color:sl.color},children:sl.textIcon||sl.id.slice(0,2).toUpperCase()}):(0,a.jsx)(o.A,{src:sg&&sl.apiType?"responses"===sl.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":sy?"/providers/anthropic-m.png":`/providers/${sl.id}.png`,alt:sl.name,width:48,height:48,className:"max-h-12 max-w-12 rounded-lg object-contain",sizes:"48px",onError:()=>eN(!0)})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)("h1",{className:"truncate text-2xl font-semibold tracking-tight sm:text-3xl",children:sl.name}),(sl.notice?.apiKeyUrl||sl.notice?.signupUrl||sl.website)&&(0,a.jsxs)("a",{href:sl.notice?.apiKeyUrl||sl.notice?.signupUrl||sl.website,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline inline-flex items-center gap-1",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),sl.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]}),(0,a.jsxs)("p",{className:"text-text-muted",children:[m.length," connection",1===m.length?"":"s"]})]})]})]}),sl.deprecated&&(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg bg-yellow-500/10 border border-yellow-500/30",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-yellow-500 mt-0.5 shrink-0",children:"warning"}),(0,a.jsx)("p",{className:"text-xs text-red-600 dark:text-yellow-400 leading-relaxed",children:sl.deprecationNotice})]}),sl.notice?.text&&!sl.deprecated&&(0,a.jsxs)("div",{className:"flex flex-col gap-2 rounded-lg border border-blue-500/30 bg-blue-500/10 px-3 py-2 sm:flex-row sm:items-center",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[16px] text-blue-500 shrink-0",children:"info"}),(0,a.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-blue-600 dark:text-blue-400",children:sl.notice.text}),sl.notice.apiKeyUrl&&(0,a.jsx)("a",{href:sl.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex justify-center rounded bg-blue-500 px-2 py-1 text-xs font-medium text-white transition-colors hover:bg-blue-600 sm:py-0.5",children:"Get API Key →"})]}),"aistudio"===n&&(0,a.jsx)(eK,{}),sv&&R&&(0,a.jsx)(d.Zp,{children:(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:sy?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,a.jsxs)("p",{className:"break-all text-sm text-text-muted",children:[sy?"Messages API":"responses"===R.apiType?"Responses API":"Chat Completions"," \xb7 ",(R.baseUrl||"").replace(/\/$/,""),"/",sy?"messages":"responses"===R.apiType?"responses":"chat/completions"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"add",onClick:()=>{en(""),ea(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>em(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{tw({title:"Delete Compatible Node",message:`Delete this ${sy?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{tw(null);try{(await fetch(`/api/provider-nodes/${n}`,{method:"DELETE"})).ok&&s.push("/dashboard/providers")}catch(e){console.log("Error deleting provider node:",e)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),sm?(0,a.jsx)(d.gw,{providerId:n}):(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Connections"}),(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[m.length>0&&M.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>{if(0===s3.length)return;let e=[...new Set(s3.map(e=>e.providerSpecificData?.proxyPoolId||"__none__"))];e9(1===e.length?e[0]:"__none__"),eh(!0)},disabled:0===s3.length,children:"Apply Proxy"}),m.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:sW,disabled:tA,children:tA?"Testing Connection One-by-One...":"Test Connection One-by-One"}),tA&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{tA&&(tD.current=!0,tP(!0))},disabled:tO,children:tO?"Stopping...":"Stop"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted font-medium",children:"Round Robin"}),(0,a.jsx)(d.lM,{checked:"round-robin"===tr,onChange:e=>{let t=e?"round-robin":null,s=e?tn||"1":tn;e&&!tn&&tl("1"),tU.current=s,t_.current&&(clearTimeout(t_.current),t_.current=null),ti(t),sD(t,s)}}),"round-robin"===tr&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)("span",{className:"text-xs text-text-muted",children:"Sticky:"}),(0,a.jsx)("input",{type:"number",min:1,value:tn,onChange:e=>{var t;tl(t=e.target.value),tU.current=t,t_.current&&clearTimeout(t_.current),t_.current=setTimeout(()=>{sD("round-robin",tU.current)},500)},placeholder:"1",className:"w-14 px-2 py-1 text-xs border border-border rounded-md bg-background focus:outline-none focus:border-primary"})]})]})]})]}),m.length>0&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-black/5 bg-black/[0.02] p-3 dark:border-white/5 dark:bg-white/[0.02]",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-text-muted",children:[(0,a.jsx)("input",{type:"checkbox",checked:s8,onChange:()=>{s8?e6(e=>e.filter(e=>!s1.some(t=>t.id===e))):e6(e=>Array.from(new Set([...e,...s1.map(e=>e.id)])))},className:"size-4 rounded border-black/20 dark:border-white/20"}),s8?"Unselect visible":"Select visible"]}),(0,a.jsxs)(d.Ex,{variant:"default",children:[s1.length," visible"]}),s3.length>0&&(0,a.jsxs)(d.Ex,{variant:"default",children:[s3.length," selected"]}),at&&(0,a.jsx)("span",{className:"text-xs text-text-muted",children:at}),s3.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",onClick:()=>{e6([]),e9("__none__")},children:"Clear"}),s3.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(d.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:()=>{0!==s3.length&&tw({title:"Delete Selected Connections",message:`Delete ${s3.length} selected connection(s)? This permanently removes the selected accounts.`,onConfirm:async()=>{tw(null);let e=[],t=0;for(let s of s3)try{(await fetch(`/api/providers/${s.id}`,{method:"DELETE"})).ok?e.push(s.id):t+=1}catch(e){console.log("Error deleting selected connection:",e),t+=1}e6(t=>t.filter(t=>!e.includes(t))),t>0&&alert(`Deleted ${e.length} connection(s); ${t} failed.`),await sq()}})},children:["Delete Selected (",s3.length,")"]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"domain",onClick:()=>ai("gsuite"),children:"Delete GSuite"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"mail",onClick:()=>ai("gmail"),children:"Delete Gmail"})]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:j.gJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tY(e.id),className:`rounded-full border px-2.5 py-1 text-xs transition-colors ${tZ===e.id?"border-primary/50 bg-primary/10 text-primary":"border-border text-text-muted hover:border-primary/30 hover:text-text-main"}`,children:[e.label,(0,a.jsx)("span",{className:"ml-1 text-[10px] opacity-70",children:s5[e.id]||0})]},e.id))}),m.length>=20&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("span",{className:"material-symbols-outlined pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-[16px] text-text-subtle",children:"search"}),(0,a.jsx)("input",{type:"search",value:tX,onChange:e=>t0(e.target.value),placeholder:`Search ${m.length} connections (email, name, id)…`,className:"w-full rounded-lg border border-border bg-background py-2 pl-8 pr-3 text-xs text-text-main outline-none placeholder:text-text-subtle focus:border-primary/40"})]})]}),I?(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px] text-red-500",children:"error"}),(0,a.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:I})]}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"refresh",onClick:()=>{O(!0),sq()},children:"Retry"})]}):0===m.length?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,a.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:sd?"lock":"key"})}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),"kiro"!==n&&sk.some(e=>"oauth"===e.id)&&sk.some(e=>"apikey"===e.id)?(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",sk.find(e=>"oauth"===e.id)?.label||"OAuth"," or ",sk.find(e=>"apikey"===e.id)?.label||"API Key","."]}):sk.length>1?(0,a.jsx)("p",{className:"text-xs text-text-muted",children:"Add Connection lists every available authentication method."}):null]})]}),(0,a.jsx)(e$,{showAutomation:sj,showAddConnection:"none"!==sw.type,onOpenAutomation:si,onAddConnection:s9,methods:"kiro"===n?null:sN,onSelectMethod:"kiro"===n?null:ae,extra:eH(n)?(0,a.jsx)(eW,{providerId:n,onWebLoginConnected:sq,onBulkImport:()=>"codex"===n?F(!0):J(!0)}):null})]}),"kiro"===n&&tF?.jobId&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tF.status," | Success: ",tF.summary?.success||0," | Running: ",tF.summary?.running||0," | Queued: ",tF.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),eG(tF.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:sa,children:"Clear"})]})]}),"kiro"===n&&!tF?.jobId&&tJ&&(0,a.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tJ})]}):(0,a.jsxs)(a.Fragment,{children:[tq&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-black/10 bg-black/[0.02] px-3 py-2 text-xs text-text-muted dark:border-white/10 dark:bg-white/[0.03]",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,a.jsxs)("span",{children:["Total: ",tq.total]}),(0,a.jsxs)("span",{children:["Completed: ",tq.completed]}),(0,a.jsxs)("span",{children:["Passed: ",tq.passed]}),(0,a.jsxs)("span",{children:["Failed: ",tq.failed]}),tq.stopped&&(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),tA&&tI&&(0,a.jsxs)("span",{children:["Running: ",m.find(e=>e.id===tI)?.name||tI]})]})}),"kiro"===n&&tF?.jobId&&(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-3 rounded-lg border border-primary/20 bg-primary/[0.06] px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-semibold text-text-main",children:"Bulk import progress is still available"}),(0,a.jsxs)("p",{className:"text-xs text-text-muted",children:["Status: ",tF.status," | Success: ",tF.summary?.success||0," | Running: ",tF.summary?.running||0," | Queued: ",tF.summary?.queued||0]})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",icon:"monitoring",variant:"secondary",onClick:()=>s.push(p("kiro")),children:"Resume Bulk Progress"}),eG(tF.status)&&(0,a.jsx)(d.$n,{size:"sm",variant:"ghost",icon:"close",onClick:sa,children:"Clear"})]})]}),"kiro"===n&&!tF?.jobId&&tJ&&(0,a.jsx)("div",{className:"mb-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-700 dark:border-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:tJ}),ad,"kiro"===n&&an>1&&(0,a.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("p",{className:"text-sm text-text-muted",children:["Page ",al," of ",an," • Showing ",(al-1)*tV+1,"-",Math.min(al*tV,s1.length)," of ",s1.length," connections"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:al<=1,onClick:()=>tG(e=>Math.max(1,e-1)),children:"Previous"}),(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",disabled:al>=an,onClick:()=>tG(e=>Math.min(an,e+1)),children:"Next"})]})]}),"kiro"!==n&&s1.length>0&&(0,a.jsx)(d.dK,{currentPage:al,pageSize:tV,totalItems:s1.length,onPageChange:tG,onPageSizeChange:e=>{tQ(e),tG(1)},className:"mt-2"}),m.length>0&&0===s1.length&&(0,a.jsx)("div",{className:"py-8 text-center text-sm text-text-muted",children:"No connections match this status filter."}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(e$,{showAutomation:sj,showAddConnection:"none"!==sw.type,onOpenAutomation:si,onAddConnection:s9,methods:"kiro"===n?null:sN,onSelectMethod:"kiro"===n?null:ae,extra:eH(n)?(0,a.jsx)(eW,{providerId:n,onWebLoginConnected:sq,onBulkImport:()=>"codex"===n?F(!0):J(!0)}):null})})]})]}),(0,a.jsx)(eE,{providerId:n}),(0,a.jsxs)(d.Zp,{children:[(0,a.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold",children:"Available Models"}),s$&&(0,a.jsx)("select",{value:to,onChange:e=>{var t;td(t=e.target.value),s_(t)},title:"Appends (level) suffix to copied model names",className:"rounded-md border border-border bg-background px-2 py-1 text-xs focus:border-primary focus:outline-none",children:s$.map(e=>(0,a.jsx)("option",{value:e,children:`Thinking: ${e.charAt(0).toUpperCase()+e.slice(1)}`},e))})]}),!sv&&(e=[...sb,...tg.filter(e=>!sb.some(t=>t.id===e.id))].filter(e=>"llm"===(e.kind||e.type||"llm")).map(e=>e.id).filter(e=>!tv.includes(e)),(0,a.jsxs)("div",{className:"flex gap-2",children:[tv.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"restart_alt",onClick:sz,children:"Active All"}),e.length>0&&(0,a.jsx)(d.$n,{size:"sm",variant:"secondary",icon:"block",onClick:()=>sI(e),children:"Disable All"})]}))]}),Object.values(eO).some(Boolean)&&(0,a.jsx)("div",{className:"mb-3 flex flex-col gap-1",children:Object.entries(eO).filter(([,e])=>!!e).map(([e,t])=>(0,a.jsxs)("p",{className:"text-xs text-red-500 break-words",children:[e,": ",t]},e))}),(()=>{let e,t,s;if(sv)return(0,a.jsx)(E,{providerStorageAlias:sS,providerDisplayAlias:sA,modelAliases:eg,copied:t4,onCopy:t8,onSetAlias:sF,onDeleteAlias:sJ,onAliasesChanged:sR,connections:m,isAnthropic:sy});let r=[...sb,...tg.filter(e=>!sb.some(t=>t.id===e.id))].filter(e=>"llm"===(e.kind||e.type||"llm")),i=new Set(tv),l=r.filter(e=>!i.has(e.id)),o=r.filter(e=>i.has(e.id)),c=function({customModels:e=[],modelAliases:t={},providerAlias:s,builtInModels:a=[],type:r="llm",includeLegacyAliases:i=!0}){let n=new Set(a.map(e=>e.id)),l=new Set,o=[];for(let t of e){if(!t?.id||t.providerAlias!==s)continue;let e=t?.kind||t?.type||"llm";if(r&&e!==r||n.has(t.id))continue;let a=`${s}/${t.id}`;l.has(a)||(l.add(a),o.push({id:t.id,name:t.name||t.id,fullModel:a,source:"custom",type:e}))}if(!i)return o;let d=`${s}/`;for(let[e,s]of Object.entries(t||{})){if("string"!=typeof s||!s.startsWith(d))continue;let t=s.slice(d.length);!t||n.has(t)||l.has(s)||(l.add(s),o.push({id:t,alias:e,fullModel:s,source:"legacyAlias",type:r||"llm"}))}return o}({customModels:ej,modelAliases:eg,providerAlias:sS,builtInModels:sb,type:"llm"}),u=Math.min(t1,Math.max(1,Math.ceil(l.length/t2))),p=l.slice((u-1)*t2,u*t2);return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3",children:[c.map(e=>(0,a.jsx)(P,{model:{id:e.id,name:e.name},fullModel:`${sA}/${e.id}`,alias:e.alias,copied:t4,onCopy:t8,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===e.source?sB(e.id,e.type||"llm"):sJ(e.alias)},testStatus:eC[e.id],onTest:m.length>0||sm?()=>au(e.id):void 0,isTesting:ez.has(e.id),isCustom:!0,isFree:!1,thinkingSuffix:sC(e.id)},`${e.source}-${e.fullModel}`)),p.map(e=>{let t=`${sS}/${e.id}`,s=`${n}/${e.id}`,r=Object.entries(eg).find(([,e])=>e===t||e===s)?.[0];return(0,a.jsx)(P,{model:e,fullModel:`${sA}/${e.id}`,alias:r,copied:t4,onCopy:t8,onSetAlias:t=>sF(e.id,t,sS),onDeleteAlias:()=>sJ(r),testStatus:eC[e.id],onTest:m.length>0||sm?()=>au(e.id):void 0,isTesting:ez.has(e.id),isFree:e.isFree,onDisable:()=>sO(e.id),thinkingSuffix:sC(e.id)},e.id)}),l.length>t2&&(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(d.dK,{currentPage:u,pageSize:t2,totalItems:l.length,onPageChange:t5,onPageSizeChange:e=>{t3(e),t5(1)}})}),(0,a.jsxs)("button",{onClick:()=>eM(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-primary/40 px-3 py-2 text-xs text-primary transition-colors hover:border-primary hover:bg-primary/5 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),"codebuddy"===n&&(0,a.jsxs)("button",{onClick:()=>e_(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-cyan-500/50 px-3 py-2 text-xs text-cyan-700 transition-colors hover:border-cyan-500 hover:bg-cyan-500/[0.07] dark:text-cyan-300 sm:w-auto",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Discover Models"]}),("codebuddy-intl"===n||"codebuddy-cn"===n)&&(0,a.jsxs)("button",{onClick:()=>eL(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"openrouter"===n&&(0,a.jsxs)("button",{type:"button",onClick:()=>e1(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"opencode"===n&&(0,a.jsxs)("button",{onClick:()=>eX(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"kiro"===n&&(0,a.jsxs)("button",{onClick:()=>e2(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"cloudflare-ai"===n&&(0,a.jsxs)("button",{onClick:()=>e4(!0),className:"live-probe-button",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",children:"radar"}),"Live Probe Models"]}),"qoder"===n&&m.some(e=>!1!==e.isActive)&&(0,a.jsxs)("button",{onClick:sH,disabled:tL,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-blue-500/40 px-3 py-2 text-xs text-blue-600 dark:text-blue-400 transition-colors hover:border-blue-500 hover:bg-blue-500/5 sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-sm",style:tL?{animation:"spin 1s linear infinite"}:void 0,children:tL?"progress_activity":"download"}),tL?(0,b.Tl)("Fetching..."):(0,b.Tl)("Fetch Qoder Models")]}),tb.length>0&&(e=new Set(Object.values(eg)),t=new Set(sb.map(e=>e.id)),0===(s=tb.filter(s=>!e.has(`${sS}/${s.id}`)&&!t.has(s.id))).length?null:(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:s.map(e=>(0,a.jsxs)("button",{onClick:async()=>{let t=e.id.split("/").pop();await sF(e.id,t,sS)},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,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id.split("/").pop()]},e.id))})]})),o.length>0&&(0,a.jsxs)("div",{className:"w-full mt-2",children:[(0,a.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",o.length,"):"]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.map(e=>(0,a.jsxs)("button",{onClick:()=>sP(e.id),className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg border border-dashed border-black/10 dark:border-white/10 text-xs text-text-muted hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors",title:"Restore model",children:[(0,a.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),e.id]},e.id))})]})]})})()]}),eu&&am,ee&&(0,a.jsx)(d.mz,{isOpen:!0,providerName:sl.name,methods:sN,onSelect:ae,onClose:()=>et(!1)}),"codex"===n&&(0,a.jsx)(eT,{isOpen:K,onClose:()=>F(!1),onSuccess:sq}),"grok-cli"===n&&(0,a.jsx)(eP,{isOpen:B,onClose:()=>J(!1),onSuccess:sq}),U&&("kiro"===n?(0,a.jsx)(d.Mh,{isOpen:!0,providerInfo:sl,onSuccess:sV,onRefresh:sq,initialBulkJobId:tF?.jobId||null,onBulkJobChange:sQ,onClose:()=>L(!1)}):"cursor"===n?(0,a.jsx)(d.G9,{isOpen:!0,onSuccess:sV,onClose:()=>L(!1)}):"gitlab"===n?(0,a.jsx)(d.vj,{isOpen:!0,providerInfo:sl,onSuccess:sV,onClose:()=>L(!1)}):"xiaomi-mimo"===n?(0,a.jsx)(d.LH,{isOpen:!0,onSuccess:sV,onClose:()=>L(!1)}):(0,a.jsx)(d.LF,{isOpen:!0,provider:n,providerInfo:sl,onSuccess:sV,onClose:()=>L(!1)})),"iflow"===n&&H&&(0,a.jsx)(d.vE,{isOpen:!0,onSuccess:()=>{sq(),G(!1)},onClose:()=>G(!1)}),("codebuddy"===n||"codebuddy-cn"===n)&&V&&(0,a.jsx)(d.xl,{isOpen:!0,connectionIds:s4,endpoint:"codebuddy-cn"===n?"/api/oauth/codebuddy-cn/quota-cookie":"/api/oauth/codebuddy/quota-cookie",onSuccess:()=>{sq(),Q(!1)},onClose:()=>Q(!1)}),es&&(0,a.jsx)(Z,{isOpen:!0,provider:n,providerName:sl.name,isCompatible:sv,isAnthropic:sy,authType:sl?.authType,authHint:sl?.authHint,website:sl?.website,proxyPools:M,existingNames:m.map(e=>e.name).filter(Boolean),error:ei,onSave:sZ,onBulkDone:sq,onClose:()=>{en(""),ea(!1)}}),el&&eb&&(0,a.jsx)(d.wI,{isOpen:!0,connection:eb,proxyPools:M,onSave:sY,onClose:()=>ed(!1)}),sv&&ec&&(0,a.jsx)(Y,{isOpen:!0,node:R,onSave:sM,onClose:()=>em(!1),isAnthropic:sy}),!sv&&eq&&(0,a.jsx)(X,{isOpen:!0,providerAlias:sS,providerDisplayAlias:sA,onSave:async e=>{let t=sl?.passthroughModels?e.split("/").pop():e;await sF(e,t,sS),eM(!1)},onClose:()=>eM(!1)}),"codebuddy"===n&&eD&&(0,a.jsx)(er,{isOpen:!0,connections:m,onModelsAdded:async e=>{for(let t of e)await sF(t.id,t.id,"cb");await sR(),await sE()},onClose:()=>e_(!1)}),("codebuddy-intl"===n||"codebuddy-cn"===n)&&eU&&(0,a.jsx)(eo,{isOpen:!0,providerId:n,connections:m,onModelsAdded:async e=>{let t="codebuddy-cn"===n?"cb-cn":"cbai";for(let s of e)await sF(s.id,s.id,t);await sR(),await sE()},onClose:()=>eL(!1)}),"openrouter"===n&&e0&&(0,a.jsx)(ex.A,{isOpen:!0,kind:"llm",connections:m,onModelsAdded:async e=>{for(let t of e)await sF(t.id,t.id.split("/").pop(),"openrouter");await sR(),await sE()},onClose:()=>e1(!1)}),"opencode"===n&&eY&&(0,a.jsx)(ep,{isOpen:!0,onModelsAdded:async e=>{for(let t of e)await sF(t.id,t.id,"oc");await sR(),await sE()},onClose:()=>eX(!1)}),"kiro"===n&&e5&&(0,a.jsx)(ev,{isOpen:!0,connections:m,onClose:()=>e2(!1)}),"cloudflare-ai"===n&&e3&&(0,a.jsx)(eS,{isOpen:!0,connections:m,onModelsAdded:async e=>{for(let t of e)await sF(t.id,t.id,sf);await sR()},onClose:()=>e4(!1)}),tx&&(0,a.jsx)(W,{isOpen:!0,connection:tx,reactive:!0===tc[tx.id],schedule:tu[tx.id]||null,onClose:()=>th(null),onSave:sK}),tN&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>tC(!1),onConfirm:()=>{window.localStorage.setItem(ss,"true"),tC(!1),t$(null),s7(tS||"oauth")},title:"Risk Notice",message:sl?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),tk&&(0,a.jsx)(d.uo,{isOpen:!0,onClose:()=>{ts||tw(null)},onConfirm:async()=>{if(ts)return;let e=tk?.onConfirm;if(e){ta(!0);try{await e()}finally{ta(!1)}}},title:tk?.title||"Confirm",message:tk?.message,variant:"danger",loading:ts})]}):(0,a.jsxs)("div",{className:"text-center py-20",children:[(0,a.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,a.jsx)(l(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]})}},66331:(e,t,s)=>{Promise.resolve().then(s.bind(s,65219))},68211:(e,t,s)=>{"use strict";s.d(t,{fetchJson:()=>r});let a={"Content-Type":"application/json"};async function r(e,t={}){let{body:s,headers:i,...n}=t,l={...n,headers:{...a,...i}};void 0!==s&&"string"!=typeof s?l.body=JSON.stringify(s):void 0!==s&&(l.body=s);let o=await fetch(e,l),d=await o.text(),c=null;if(d)try{c=JSON.parse(d)}catch{let t=Error(`Non-JSON response from ${e} (HTTP ${o.status})`);throw t.status=o.status,t.rawBody=d.slice(0,300),t}if(!o.ok){let e=c&&(c.error?.message||c.error||c.message)||`Request failed (HTTP ${o.status})`,t=Error("string"==typeof e?e:`HTTP ${o.status}`);throw t.status=o.status,t.data=c,t}return c}r.get=(e,t)=>r(e,{...t,method:"GET"}),r.post=(e,t,s)=>r(e,{...s,method:"POST",body:t}),r.put=(e,t,s)=>r(e,{...s,method:"PUT",body:t}),r.patch=(e,t,s)=>r(e,{...s,method:"PATCH",body:t}),r.del=(e,t)=>r(e,{...t,method:"DELETE"})}},e=>{e.O(0,[2574,3862,3745,3416,9501,620,5497,5153,8441,3794,7358],()=>e(e.s=66331)),_N_E=e.O()}]);
|
package/cli/app/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
+
# v1.1.80 (2026-11-18)
|
|
4
|
+
|
|
5
|
+
## Fixes
|
|
6
|
+
- **Muse Web (`muse-web` / `mu`) media-only scope.** Keeps `muse-web` (`muse-image`, `muse-video`) active under Media Providers (`image` and `video`) while removing `muse-chat` and excluding media-only providers from `/dashboard/providers/[id]` chat provider pages.
|
|
7
|
+
|
|
8
|
+
# v1.1.79 (2026-11-18)
|
|
9
|
+
|
|
10
|
+
## Changes
|
|
11
|
+
- **Antigravity (`ag/`/`agy/`) Gemini 4 Carbon and Hydrogen catalog.** Added `gemini-4-carbon-high`, `gemini-4-carbon-medium`, `gemini-4-carbon-low`, `gemini-4-hydrogen-xhigh`, `gemini-4-hydrogen-high`, `gemini-4-hydrogen-medium`, and `gemini-4-hydrogen-low` to the Antigravity OAuth catalog, quota tracking, and MITM tool aliases.
|
|
12
|
+
|
|
13
|
+
## Fixes
|
|
14
|
+
- **OpenCode Free (`oc/`) latest user prompt preservation during compaction.** Prevents `compactOpenCodeFreeMessages()` from evicting the latest `user` message during long 20+ step tool-call turns so autonomous agents do not lose their active instruction or self-continue ping.
|
|
15
|
+
|
|
3
16
|
# v1.1.78 (2026-11-17)
|
|
4
17
|
|
|
5
18
|
## Fixes
|
package/cli/app/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(a){throw t=0,a}};var nr=F((lp,Xn)=>{var $u=require("fs"),Hr=require("path"),jn=require("os"),wa="zevai";function Yn(){return process.platform==="win32"?Hr.join(process.env.APPDATA||Hr.join(jn.homedir(),"AppData","Roaming"),wa):Hr.join(jn.homedir(),`.${wa}`)}function ju(){let e=process.env.DATA_DIR;if(!e)return Yn();try{return $u.mkdirSync(e,{recursive:!0}),e}catch(t){if(t?.code==="EACCES"||t?.code==="EPERM")return console.warn(`[DATA_DIR] '${e}' not writable \u2192 fallback ~/.${wa}`),Yn();throw t}}var Wn=ju(),Yu=Hr.join(Wn,"mitm");Xn.exports={DATA_DIR:Wn,MITM_DIR:Yu}});var xr=F((cp,Zn)=>{var Jn=require("fs"),Wu=process.env.NODE_ENV==="development",Xu=(()=>{if(process.platform==="win32")return null;for(let e of["/usr/sbin/lsof","/usr/bin/lsof","/sbin/lsof"])try{return Jn.accessSync(e,Jn.constants.X_OK),e}catch{}return"lsof"})(),Ju=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","api2.cursor.sh"],Zu={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"]},e0={antigravity:{"gemini-4-argon-high":"gemini-4-argon-high","gemini-4-argon-medium":"gemini-4-argon-medium","gemini-4-argon-low":"gemini-4-argon-low","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-default":"gemini-3.8-flash-medium","claude-sonnet-5-5-high":"claude-sonnet-5-5-high","claude-sonnet-5-5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5-5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5":"claude-sonnet-5-5","claude-sonnet-5.5":"claude-sonnet-5-5","claude-sonnet-5.5-high":"claude-sonnet-5-5-high","claude-sonnet-5.5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5.5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-sonnet-5.5-thinking":"claude-sonnet-5-5","claude-opus-5-5-high":"claude-opus-5-5-high","claude-opus-5-5-medium":"claude-opus-5-5-medium","claude-opus-5-5-low":"claude-opus-5-5-low","claude-opus-5-5":"claude-opus-5-5","claude-opus-5.5":"claude-opus-5-5","claude-opus-5.5-high":"claude-opus-5-5-high","claude-opus-5.5-medium":"claude-opus-5-5-medium","claude-opus-5.5-low":"claude-opus-5-5-low","claude-opus-5-5-thinking":"claude-opus-5-5","claude-opus-5.5-thinking":"claude-opus-5-5"}},t0={antigravity:[{match:/flash.*low|low.*flash/i,alias:"gemini-3.8-flash-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.8-flash-medium"},{match:/flash/i,alias:"gemini-3.8-flash-high"},{match:/opus.*5[.-]5.*high|5[.-]5.*opus.*high/i,alias:"claude-opus-5-5-high"},{match:/opus.*5[.-]5.*medium|5[.-]5.*opus.*medium/i,alias:"claude-opus-5-5-medium"},{match:/opus.*5[.-]5.*low|5[.-]5.*opus.*low/i,alias:"claude-opus-5-5-low"},{match:/sonnet.*5[.-]5.*high|5[.-]5.*sonnet.*high/i,alias:"claude-sonnet-5-5-high"},{match:/sonnet.*5[.-]5.*medium|5[.-]5.*sonnet.*medium/i,alias:"claude-sonnet-5-5-medium"},{match:/sonnet.*5[.-]5.*low|5[.-]5.*sonnet.*low/i,alias:"claude-sonnet-5-5-low"},{match:/opus.*5[.-]5|5[.-]5.*opus/i,alias:"claude-opus-5-5"},{match:/sonnet.*5[.-]5|5[.-]5.*sonnet/i,alias:"claude-sonnet-5-5"},{match:/opus/i,alias:"claude-opus-4-6-thinking"},{match:/sonnet|claude/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"}]},r0={antigravity:[/^tab[_-]/i]},a0=["recordCodeAssistMetrics","recordTrajectoryAnalytics","fetchAdminControls","listExperiments","fetchUserInfo"],n0=new Set(["gemini-3.6-flash-tiered","gemini-3.7-flash-tiered","gemini-3.8-flash-tiered"]);function i0(e,t){let a=String(e||"").replace(/^models\//,"");if(!n0.has(a))return e;try{let r=JSON.parse(Buffer.isBuffer(t)?t.toString():String(t||"")),n=a.includes("3.8")?"3.8":a.includes("3.7")?"3.7":"3.6",s=r?.request?.generationConfig?.thinkingConfig?.thinkingLevel||r?.generationConfig?.thinkingConfig?.thinkingLevel,i=["high","medium","low"].includes(String(s).toLowerCase())?String(s).toLowerCase():"medium";return`gemini-${n}-flash-${i}`}catch{return e}}function s0(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"?"kiro":t==="api2.cursor.sh"?"cursor":null}Zn.exports={IS_DEV:Wu,LSOF_BIN:Xu,TARGET_HOSTS:Ju,URL_PATTERNS:Zu,MODEL_SYNONYMS:e0,MODEL_PATTERNS:t0,MODEL_NO_MAP:r0,LOG_BLACKLIST_URL_PARTS:a0,getToolForHost:s0,extractTieredFlashModel:i0}});var wt=F((fp,ai)=>{var Gt=require("fs"),Gr=require("path"),Na=require("zlib"),{DATA_DIR:o0}=nr(),{LOG_BLACKLIST_URL_PARTS:u0}=xr();function ei(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}var l0=e=>console.log(`[${ei()}] [MITM] ${e}`),c0=e=>console.error(`[${ei()}] \u274C [MITM] ${e}`),zt=Gr.join(o0,"logs","mitm");Gt.existsSync(zt)||Gt.mkdirSync(zt,{recursive:!0});function f0(){try{if(!Gt.existsSync(zt))return;for(let e of Gt.readdirSync(zt))try{Gt.rmSync(Gr.join(zt,e),{recursive:!0,force:!0})}catch{}}catch{}}var d0=/^\s*(\{\s*\}|\[\s*\]|null)?\s*$/;function ti(e,t=80){return String(e).replace(/[^a-zA-Z0-9]/g,"_").substring(0,t)}function ri(e){return e?u0.some(t=>e.includes(t)):!1}function h0(e,t){if(!e||e.length===0)return e;try{let a=(t||"").toLowerCase();if(a.includes("gzip"))return Na.gunzipSync(e);if(a.includes("br"))return Na.brotliDecompressSync(e);if(a.includes("deflate"))return Na.inflateSync(e)}catch{}return e}function p0(e,t,a="raw"){if(ri(e.url))return null;try{let r=new Date().toISOString().replace(/[:.]/g,"-"),n=ti((e.headers.host||"")+e.url),s=Gr.join(zt,`${r}_${a}_${n}.req.json`),i=null;try{i=JSON.parse(t.toString())}catch{}return Gt.writeFileSync(s,JSON.stringify({method:e.method,url:e.url,host:e.headers.host,headers:e.headers,body:i??t.toString("utf8")},null,2)),s}catch{return null}}function g0(e,t="raw"){if(ri(e.url))return null;let a=new Date().toISOString().replace(/[:.]/g,"-"),r=ti((e.headers.host||"")+e.url),n=Gr.join(zt,`${a}_${t}_${r}.res.txt`),s=0,i={},o=[];return{writeHeader:(u,l)=>{s=u,i=l||{}},writeChunk:u=>{u!=null&&o.push(Buffer.isBuffer(u)?u:Buffer.from(u))},end:()=>{try{let u=Buffer.concat(o),l=i["content-encoding"]||i["Content-Encoding"],f=h0(u,l).toString("utf8");if(d0.test(f))return;let v={...i};delete v["content-encoding"],delete v["Content-Encoding"];let y=`STATUS: ${s}
|
|
1
|
+
var F=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(a){throw t=0,a}};var nr=F((lp,Xn)=>{var $u=require("fs"),Hr=require("path"),jn=require("os"),wa="zevai";function Yn(){return process.platform==="win32"?Hr.join(process.env.APPDATA||Hr.join(jn.homedir(),"AppData","Roaming"),wa):Hr.join(jn.homedir(),`.${wa}`)}function ju(){let e=process.env.DATA_DIR;if(!e)return Yn();try{return $u.mkdirSync(e,{recursive:!0}),e}catch(t){if(t?.code==="EACCES"||t?.code==="EPERM")return console.warn(`[DATA_DIR] '${e}' not writable \u2192 fallback ~/.${wa}`),Yn();throw t}}var Wn=ju(),Yu=Hr.join(Wn,"mitm");Xn.exports={DATA_DIR:Wn,MITM_DIR:Yu}});var xr=F((cp,Zn)=>{var Jn=require("fs"),Wu=process.env.NODE_ENV==="development",Xu=(()=>{if(process.platform==="win32")return null;for(let e of["/usr/sbin/lsof","/usr/bin/lsof","/sbin/lsof"])try{return Jn.accessSync(e,Jn.constants.X_OK),e}catch{}return"lsof"})(),Ju=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","api2.cursor.sh"],Zu={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"]},e0={antigravity:{"gemini-4-argon-high":"gemini-4-argon-high","gemini-4-argon-medium":"gemini-4-argon-medium","gemini-4-argon-low":"gemini-4-argon-low","gemini-4-carbon-high":"gemini-4-carbon-high","gemini-4-carbon-medium":"gemini-4-carbon-medium","gemini-4-carbon-low":"gemini-4-carbon-low","gemini-4-hydrogen-xhigh":"gemini-4-hydrogen-xhigh","gemini-4-hydrogen-high":"gemini-4-hydrogen-high","gemini-4-hydrogen-medium":"gemini-4-hydrogen-medium","gemini-4-hydrogen-low":"gemini-4-hydrogen-low","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-default":"gemini-3.8-flash-medium","claude-sonnet-5-5-high":"claude-sonnet-5-5-high","claude-sonnet-5-5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5-5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5":"claude-sonnet-5-5","claude-sonnet-5.5":"claude-sonnet-5-5","claude-sonnet-5.5-high":"claude-sonnet-5-5-high","claude-sonnet-5.5-medium":"claude-sonnet-5-5-medium","claude-sonnet-5.5-low":"claude-sonnet-5-5-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-sonnet-5.5-thinking":"claude-sonnet-5-5","claude-opus-5-5-high":"claude-opus-5-5-high","claude-opus-5-5-medium":"claude-opus-5-5-medium","claude-opus-5-5-low":"claude-opus-5-5-low","claude-opus-5-5":"claude-opus-5-5","claude-opus-5.5":"claude-opus-5-5","claude-opus-5.5-high":"claude-opus-5-5-high","claude-opus-5.5-medium":"claude-opus-5-5-medium","claude-opus-5.5-low":"claude-opus-5-5-low","claude-opus-5-5-thinking":"claude-opus-5-5","claude-opus-5.5-thinking":"claude-opus-5-5"}},t0={antigravity:[{match:/flash.*low|low.*flash/i,alias:"gemini-3.8-flash-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.8-flash-medium"},{match:/flash/i,alias:"gemini-3.8-flash-high"},{match:/opus.*5[.-]5.*high|5[.-]5.*opus.*high/i,alias:"claude-opus-5-5-high"},{match:/opus.*5[.-]5.*medium|5[.-]5.*opus.*medium/i,alias:"claude-opus-5-5-medium"},{match:/opus.*5[.-]5.*low|5[.-]5.*opus.*low/i,alias:"claude-opus-5-5-low"},{match:/sonnet.*5[.-]5.*high|5[.-]5.*sonnet.*high/i,alias:"claude-sonnet-5-5-high"},{match:/sonnet.*5[.-]5.*medium|5[.-]5.*sonnet.*medium/i,alias:"claude-sonnet-5-5-medium"},{match:/sonnet.*5[.-]5.*low|5[.-]5.*sonnet.*low/i,alias:"claude-sonnet-5-5-low"},{match:/opus.*5[.-]5|5[.-]5.*opus/i,alias:"claude-opus-5-5"},{match:/sonnet.*5[.-]5|5[.-]5.*sonnet/i,alias:"claude-sonnet-5-5"},{match:/opus/i,alias:"claude-opus-4-6-thinking"},{match:/sonnet|claude/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"}]},r0={antigravity:[/^tab[_-]/i]},a0=["recordCodeAssistMetrics","recordTrajectoryAnalytics","fetchAdminControls","listExperiments","fetchUserInfo"],n0=new Set(["gemini-3.6-flash-tiered","gemini-3.7-flash-tiered","gemini-3.8-flash-tiered"]);function i0(e,t){let a=String(e||"").replace(/^models\//,"");if(!n0.has(a))return e;try{let r=JSON.parse(Buffer.isBuffer(t)?t.toString():String(t||"")),n=a.includes("3.8")?"3.8":a.includes("3.7")?"3.7":"3.6",s=r?.request?.generationConfig?.thinkingConfig?.thinkingLevel||r?.generationConfig?.thinkingConfig?.thinkingLevel,i=["high","medium","low"].includes(String(s).toLowerCase())?String(s).toLowerCase():"medium";return`gemini-${n}-flash-${i}`}catch{return e}}function s0(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"?"kiro":t==="api2.cursor.sh"?"cursor":null}Zn.exports={IS_DEV:Wu,LSOF_BIN:Xu,TARGET_HOSTS:Ju,URL_PATTERNS:Zu,MODEL_SYNONYMS:e0,MODEL_PATTERNS:t0,MODEL_NO_MAP:r0,LOG_BLACKLIST_URL_PARTS:a0,getToolForHost:s0,extractTieredFlashModel:i0}});var wt=F((fp,ai)=>{var Gt=require("fs"),Gr=require("path"),Na=require("zlib"),{DATA_DIR:o0}=nr(),{LOG_BLACKLIST_URL_PARTS:u0}=xr();function ei(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}var l0=e=>console.log(`[${ei()}] [MITM] ${e}`),c0=e=>console.error(`[${ei()}] \u274C [MITM] ${e}`),zt=Gr.join(o0,"logs","mitm");Gt.existsSync(zt)||Gt.mkdirSync(zt,{recursive:!0});function f0(){try{if(!Gt.existsSync(zt))return;for(let e of Gt.readdirSync(zt))try{Gt.rmSync(Gr.join(zt,e),{recursive:!0,force:!0})}catch{}}catch{}}var d0=/^\s*(\{\s*\}|\[\s*\]|null)?\s*$/;function ti(e,t=80){return String(e).replace(/[^a-zA-Z0-9]/g,"_").substring(0,t)}function ri(e){return e?u0.some(t=>e.includes(t)):!1}function h0(e,t){if(!e||e.length===0)return e;try{let a=(t||"").toLowerCase();if(a.includes("gzip"))return Na.gunzipSync(e);if(a.includes("br"))return Na.brotliDecompressSync(e);if(a.includes("deflate"))return Na.inflateSync(e)}catch{}return e}function p0(e,t,a="raw"){if(ri(e.url))return null;try{let r=new Date().toISOString().replace(/[:.]/g,"-"),n=ti((e.headers.host||"")+e.url),s=Gr.join(zt,`${r}_${a}_${n}.req.json`),i=null;try{i=JSON.parse(t.toString())}catch{}return Gt.writeFileSync(s,JSON.stringify({method:e.method,url:e.url,host:e.headers.host,headers:e.headers,body:i??t.toString("utf8")},null,2)),s}catch{return null}}function g0(e,t="raw"){if(ri(e.url))return null;let a=new Date().toISOString().replace(/[:.]/g,"-"),r=ti((e.headers.host||"")+e.url),n=Gr.join(zt,`${a}_${t}_${r}.res.txt`),s=0,i={},o=[];return{writeHeader:(u,l)=>{s=u,i=l||{}},writeChunk:u=>{u!=null&&o.push(Buffer.isBuffer(u)?u:Buffer.from(u))},end:()=>{try{let u=Buffer.concat(o),l=i["content-encoding"]||i["Content-Encoding"],f=h0(u,l).toString("utf8");if(d0.test(f))return;let v={...i};delete v["content-encoding"],delete v["Content-Encoding"];let y=`STATUS: ${s}
|
|
2
2
|
HEADERS: ${JSON.stringify(v,null,2)}
|
|
3
3
|
---BODY---
|
|
4
4
|
${f}`;Gt.writeFileSync(n,y)}catch{}},file:n}}ai.exports={log:l0,err:c0,dumpRequest:p0,createResponseDumper:g0,clearDumpDir:f0}});var j=F((dp,ni)=>{ni.exports={options:{usePureJavaScript:!1}}});var oi=F((hp,si)=>{var Ra={};si.exports=Ra;var ii={};Ra.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=y0(e,t);else{var n=0,s=t.length,i=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var u=0,l=e[n];u<o.length;++u)l+=o[u]<<8,o[u]=l%s,l=l/s|0;for(;l>0;)o.push(l%s),l=l/s|0}for(n=0;e[n]===0&&n<e.length-1;++n)r+=i;for(n=o.length-1;n>=0;--n)r+=t[o[n]]}if(a){var c=new RegExp(".{1,"+a+"}","g");r=r.match(c).join(`\r
|
package/cli/package.json
CHANGED