keyrouter 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +22 -22
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +18 -18
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/prompt-injection/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/acs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/metadata/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/saml/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codewhale-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/crush-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/forge-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-profiles/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/omp-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/smelt-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/presets/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/catalog-sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/grok-cli/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/xiaomi-mimo/login/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/zed/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/prompt-injection/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/overrides/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/web-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/netlify-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/claude-reset/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[...model]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/systemone/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/!KGRhc2hib2FyZCk/dashboard/prompt-injection/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/prompt-injection.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/dashboard/settings/pricing/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +5 -5
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +22 -22
- package/app/.next-cli-build/server/chunks/1051.js +1 -1
- package/app/.next-cli-build/server/chunks/2172.js +1 -1
- package/app/.next-cli-build/server/chunks/412.js +2 -2
- package/app/.next-cli-build/server/chunks/5626.js +1 -0
- package/app/.next-cli-build/server/chunks/8128.js +1 -1
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/9604.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/static/chunks/5497-3add1c35ece30dbf.js +1 -0
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-18c2613dd78ff66f.js +1 -0
- package/app/.next-cli-build/static/chunks/app/layout-5be078fd5da689ca.js +1 -0
- package/app/.next-cli-build/static/css/841943e9a30fe5cd.css +1 -0
- package/app/package.json +1 -1
- package/cli.js +77 -36
- package/package.json +1 -1
- package/app/.next-cli-build/server/chunks/4756.js +0 -1
- package/app/.next-cli-build/static/chunks/5497-54a2c3dfa292cd6f.js +0 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/layout-36c42ca907c9f01d.js +0 -1
- package/app/.next-cli-build/static/chunks/app/layout-47a7f93a93a7249c.js +0 -1
- package/app/.next-cli-build/static/css/40eba1d7174ab2f7.css +0 -1
- /package/app/.next-cli-build/static/{OQlH5Y4fdrzSgUpl8Gw_9 → 7Sq72xYQxt_cCm5BESVbY}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{OQlH5Y4fdrzSgUpl8Gw_9 → 7Sq72xYQxt_cCm5BESVbY}/_ssgManifest.js +0 -0
|
@@ -24,4 +24,4 @@ pt-only-auto-named`:N,[W,X]=(0,e.useState)("single"),[Y,Z]=(0,e.useState)(""),[$
|
|
|
24
24
|
"id_token": "eyJ0eXAiOiJKV1QiLCJhbGci...",
|
|
25
25
|
"email": "account2@example.com"
|
|
26
26
|
}
|
|
27
|
-
]`;function V(a){let b,c=a.trim();if(!c)return[];try{b=JSON.parse(c)}catch(a){try{let a=c;a.startsWith("[")||((a=a.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(a=a.slice(0,-1)),a=`[${a}]`),b=JSON.parse(a)}catch{throw a}}if(Array.isArray(b))return b;if(b&&"object"==typeof b)return Array.isArray(b.accounts)?b.accounts:[b];throw Error("Input must be a JSON object or array of objects")}function W({isOpen:a,onClose:b,onSuccess:c}){let[f,g]=(0,e.useState)(""),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=()=>{h||(g(""),k(""),n(null),r(null),p(!1),b())},u=async a=>{if(!a||0===a.length)return;k("");let b=Array.from(a).filter(a=>a.name.endsWith(".json")||"application/json"===a.type||""===a.type);if(0===b.length)return void k((0,E.Tl)("Please select valid .json files"));try{let a=[];for(let c of b){let b=await c.text(),d=V(b);Array.isArray(d)?a.push(...d):d&&a.push(d)}if(0===a.length)return void k((0,E.Tl)("No accounts found in selected files"));g(JSON.stringify(a,null,2)),r({filesCount:b.length,accountsCount:a.length})}catch(a){k(`${(0,E.Tl)("Error reading files")}: ${a.message}`)}},v=async()=>{let a;k(""),n(null);try{a=V(f)}catch(a){k(`${(0,E.Tl)("Invalid JSON")}: ${a.message}`);return}if(!a||0===a.length)return void k((0,E.Tl)("No accounts found in input"));i(!0);try{let b=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),d=await b.json();if(!b.ok)return void k(d?.error||`Request failed: ${b.status}`);n(d),d.success>0&&"function"==typeof c&&c()}catch(a){k(a.message||(0,E.Tl)("Request failed"))}finally{i(!1)}},w=l?.results?.filter(a=>!a.ok)||[];return(0,d.jsx)(m.aF,{isOpen:a,title:(0,E.Tl)("Bulk Add Grok CLI Accounts"),onClose:t,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,E.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,d.jsx)("input",{ref:s,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:a=>{u(a.target.files),a.target&&(a.target.value="")}}),(0,d.jsx)(m.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>s.current?.click(),disabled:h,children:(0,E.Tl)("Upload JSON Files")})]}),(0,d.jsxs)("div",{onDragOver:a=>{a.preventDefault(),p(!0)},onDragLeave:a=>{a.preventDefault(),p(!1)},onDrop:a=>{a.preventDefault(),p(!1),a.dataTransfer?.files?.length>0&&u(a.dataTransfer.files)},className:`relative rounded border transition-colors ${o?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,d.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:U,value:f,onChange:a=>{g(a.target.value),r(null)},disabled:h}),o&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,d.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,E.Tl)("Drop .json files here")})]})]}),q&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,d.jsxs)("span",{children:[(0,E.Tl)("Loaded")," ",q.accountsCount," ",(0,E.Tl)("account(s) from")," ",q.filesCount," ",(0,E.Tl)("file(s)")]})]}),j&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:j}),l&&l.failed>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",l.failed," ",(0,E.Tl)("failed")]}),w.length>0&&(0,d.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:w.map(a=>(0,d.jsxs)("li",{className:"text-red-400",children:["[",a.index,"] ",a.error]},a.index))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(m.$n,{onClick:v,fullWidth:!0,disabled:h||!f.trim(),children:h?(0,E.Tl)("Importing..."):(0,E.Tl)("Import All")}),(0,d.jsx)(m.$n,{onClick:t,variant:"ghost",fullWidth:!0,disabled:h,children:(0,E.Tl)("Close")})]})]})})}var X=c(41371);let Y=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],Z=/^[A-Za-z0-9-]+$/;function $({providerId:a}){let b=(0,X.i)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)([{name:"",value:""}]),[i,j]=(0,e.useState)({}),[k,l]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),p=(a,b,c)=>{h(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},q=(0,e.useCallback)(async()=>{let c={};for(let a of g.filter(a=>a.name.trim())){let d=a.name.trim();if(!Z.test(d))return void b.error(`Invalid header name: ${d}`);if(Y.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==i[d]&&(c[d]=a.value)}o(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}l(Object.keys(c).length>0),b.success("Custom headers saved")}finally{o(!1)}},[g,i,a,b]);return 0!==Object.keys(i).length||k?(0,d.jsxs)(m.Zp,{padding:"xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,d.jsx)("span",{className:"font-display text-sm font-semibold text-text-main",children:"Custom Headers"}),k&&(0,d.jsx)(m.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:g.map((a,b)=>{let c=a.name.trim()in i&&a.value!==i[a.name.trim()];return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:a.name,onChange:a=>p(b,"name",a.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,d.jsx)("input",{value:a.value,onChange:a=>p(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in i?"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 ${c?"border-amber-400/60":"border-border"}`}),(0,d.jsx)("button",{type:"button",title:"Remove header",onClick:()=>h(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>[...a,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",disabled:n,onClick:()=>{h(Object.entries(i).map(([a,b])=>({name:a,value:b})))},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,d.jsx)("button",{type:"button",disabled:n,onClick:q,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:n?"Saving...":"Save"})]})]})]})]}):null}$.propTypes={providerId:g().string.isRequired};var _=c(56020),aa=c(41365);function ab({providerId:a,onConnected:b,size:c="sm"}){let[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(""),j=async()=>{g(!0),i("");try{let c=await fetch(`/api/oauth/${a}/lease-connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),d=await c.json().catch(()=>({}));if(!c.ok)return void i(d.error||"Could not reach the MiniMax Code desktop app");"function"==typeof b&&b()}catch(a){i(a?.message||"Could not reach the MiniMax Code desktop app")}finally{g(!1)}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.$n,{size:c,icon:"desktop_windows",variant:"secondary",disabled:f,onClick:j,title:(0,E.Tl)("Borrow the signed-in MiniMax Code desktop app's login - no second sign-in, refresh stays with the desktop app"),children:f?(0,E.Tl)("Connecting..."):(0,E.Tl)("Use Desktop App")}),h&&(0,d.jsx)("p",{className:"w-full text-xs text-red-500 break-words",children:h})]})}ab.propTypes={providerId:g().string.isRequired,onConnected:g().func,size:g().oneOf(["sm","md","lg"])};var ac=c(54589);let ad=new Set(["minimax-code","minimax-code-global"]),ae={claude:"claudeAutoPing",codex:"codexAutoPing"};function af(a){let b=Object.entries(a).some(([a,b])=>a.startsWith("modelLock_")&&b&&new Date(b).getTime()>Date.now());return"unavailable"!==a.testStatus||b?a.testStatus:"active"}function ag(){let a,b,c,f,g,i=(0,h.useParams)(),q=(0,h.useRouter)(),r=i.id,{getCaps:s}=(0,D.y)(),[t,u]=(0,e.useState)([]),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)([]),[H,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[N,Q]=(0,e.useState)(!1),[S,U]=(0,e.useState)(!1),[V,X]=(0,e.useState)(""),[Y,Z]=(0,e.useState)(!1),[ag,ai]=(0,e.useState)(!1),[aj,ak]=(0,e.useState)(!1),[al,am]=(0,e.useState)(!1),[an,ao]=(0,e.useState)(!1),[ap,aq]=(0,e.useState)(null),[ar,as]=(0,e.useState)({}),[at,au]=(0,e.useState)([]),[av,aw]=(0,e.useState)(!1),[ax,ay]=(0,e.useState)({}),[az,aA]=(0,e.useState)(""),[aB,aC]=(0,e.useState)(()=>new Set),[aD,aE]=(0,e.useState)(!1),[aF,aG]=(0,e.useState)([]),[aH,aI]=(0,e.useState)("__none__"),[aJ,aK]=(0,e.useState)(!1),[aL,aM]=(0,e.useState)(null),[aN,aO]=(0,e.useState)(""),[aP,aQ]=(0,e.useState)("auto"),[aR,aS]=(0,e.useState)({enabled:!1,connections:{},schedules:{}}),[aT,aU]=(0,e.useState)(null),[aV,aW]=(0,e.useState)([]),[aX,aY]=(0,e.useState)([]),[aZ,a$]=(0,e.useState)(null),[a_,a0]=(0,e.useState)([]),[a1,a2]=(0,e.useState)([]),[a3,a4]=(0,e.useState)(null),[a5,a6]=(0,e.useState)(!1),[a7,a8]=(0,e.useState)(!1),[a9,ba]=(0,e.useState)(!1),[bb,bc]=(0,e.useState)(null),[bd,be]=(0,e.useState)({}),[bf,bg]=(0,e.useState)(null),bh=(0,e.useRef)(!1),[bi,bj]=(0,e.useState)(!1),[bk,bl]=(0,e.useState)(!1),{copied:bm,copy:bn}=(0,C.C)(),bo=()=>{J(!0)},bp=()=>{"xiaomi-mimo"===r?L(!0):bu?bo():(X(""),U(!0))},bq=()=>{X(""),U(!0)},br=()=>{bu?bp():bq()},bs=x?{id:x.id,name:x.name||("anthropic-compatible"===x.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===x.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===x.type?"AC":"OC",apiType:x.apiType,baseUrl:x.baseUrl,type:x.type}:o.zN[r]||o.fg[r]||o.IS[r]||o.nJ[r]||o.br[r],bt=bs?.authModes||[],bu=!!o.zN[r]||!!o.IS[r]||bt.includes("oauth"),bv=!!o.fg[r]||bt.includes("apikey"),bw=!!o.IS[r]?.noAuth,bx=(0,p.KC)(r),by=("cursor"===r||"zed"===r)&&aX.length>0?aX:bx,bz=(0,o.wG)(r),bA=(0,o.mq)(r),bB=(0,o.gb)(r),bC=bA||bB,bD=!bC&&bu&&bv,bE="xai"===r?"Grok Build OAuth":"grok-cli"===r?"Grok CLI Device Login":"kimi"===r?"Kimi Coding OAuth":"OAuth",bF="xai"===r?"xAI API Key":"kimi"===r?"Kimi API Key":"qoder"===r||"qoder-cn"===r?"PAT":"API Key",bG=a=>{if(!aP||"auto"===aP)return null;let b=B(r,a);return b&&b.includes(aP)?aP:null},bH=bC?r:bz,bI=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=B(r,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of by)c(a.id);for(let a of a_)c(a.id);for(let a of at)a.providerAlias===bH&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),bJ=bC?x?.prefix||r:bz,bK=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}`,{cache:"no-store"}),b=await a.json();a.ok&&a2(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[bH]),bL=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bH,ids:[a]})})).ok&&await bK()}catch(a){console.log("Error disabling model:",a)}},bM=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bK()}catch(a){console.log("Error enabling model:",a)}},bN=async a=>{a.length&&a4({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{a4(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bH,ids:a})})).ok&&await bK()}catch(a){console.log("Error disabling all models:",a)}}})},bO=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}`,{method:"DELETE"})).ok&&await bK()}catch(a){console.log("Error enabling all models:",a)}},bP=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&as(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bQ=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&au(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),bR=(0,e.useCallback)(async()=>{try{let[a,b,c,d]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),e=await a.json(),f=await b.json(),g=await c.json(),h=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===r);u(a)}c.ok&&A(g.proxyPools||[]);let i=(h.providerStrategies||{})[r]||{};aM(i.fallbackStrategy||null),aO(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1");let j=(h.providerThinking||{})[r]||{};aQ(j.mode||"auto");let k=ae[r],l=k&&h[k]||{};if(aS({enabled:!0===l.enabled,connections:l.connections||{},schedules:l.schedules||{}}),b.ok){let a=(f.nodes||[]).find(a=>a.id===r)||null;if(!a&&bC)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===r)||null))break}y(a)}}catch(a){console.log("Error fetching connections:",a)}finally{w(!1)}},[r,bC]),bS=async a=>{try{let b=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(y(c.node),await bR(),am(!1))}catch(a){console.log("Error updating provider node:",a)}},bT=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[r]:f[r]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},bU=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[r]={mode:a}:delete c[r],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},bV=async a=>{let b=ae[r];if(b){aS(a);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[b]:a})})}catch(a){console.log("Error saving auto-ping config:",a)}}},bW=async(a,b,c=bz)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bP();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bX=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bP()}catch(a){console.log("Error deleting alias:",a)}},bY=async(a,b="llm",c=bH,d,e)=>{try{let f=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:c,id:a,type:b,...d?{caps:d}:{},...e?{transport:e}:{}})});if(f.ok)await bQ();else{let a=await f.json();alert(a.error||"Failed to add custom model")}}catch(a){console.log("Error adding custom model:",a)}},bZ=async(a,b="llm",c=bH)=>{try{let d=new URLSearchParams({providerAlias:c,id:a,type:b});(await fetch(`/api/models/custom?${d}`,{method:"DELETE"})).ok&&await bQ()}catch(a){console.log("Error deleting custom model:",a)}},b$=async()=>{if(bi)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,E.Tl)("Please add an active Qoder connection first"));bj(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,E.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,E.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^(qoder-cn|qoder)\//,"");at.some(a=>a.providerAlias===bH&&a.id===c&&"llm"===(a.kind||a.type||"llm"))||Object.values(ar).includes(`${bH}/${c}`)||(await bY(c,"llm",bH),e+=1)}0===e?alert((0,E.Tl)("All models already exist, no new models added")):alert((0,E.Tl)("Successfully added")+` ${e} `+(0,E.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,E.Tl)("Error fetching models")+": "+a.message)}finally{bj(!1)}},b_=async()=>{if(bk)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,E.Tl)("Please add an active Cline connection first"));bl(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,E.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,E.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;b&&(at.some(a=>a.providerAlias===bH&&a.id===b&&"llm"===(a.kind||a.type||"llm"))||Object.values(ar).includes(`${bH}/${b}`)||(await bY(b,"llm",bH),e+=1))}0===e?alert((0,E.Tl)("All models already exist, no new models added")):alert((0,E.Tl)("Successfully added")+` ${e} `+(0,E.Tl)("models"))}catch(a){console.log("Error importing Cline models:",a),alert((0,E.Tl)("Error fetching models")+": "+a.message)}finally{bl(!1)}},b0=async()=>{if(a7||0===t.length)return;let a=Object.fromEntries(t.map(a=>[a.id,{state:"queued",error:null}]));bh.current=!1,a8(!0),ba(!1),bc(null),be(a),bg({total:t.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<t.length;a+=1){if(bh.current){bg({total:t.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=t[a];bc(d.id),be(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,be(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,be(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}bg({total:t.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<t.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{bc(null),a8(!1),ba(!1),bh.current=!1}},b1=async a=>{a4({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{a4(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&u(b=>b.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},b2=()=>{bR(),J(!1)},b3=async a=>{X("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bR(),U(!1);return}X(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),X("Failed to save connection")}},b4=async a=>{try{(await fetch(`/api/providers/${ap.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bR(),ak(!1))}catch(a){console.log("Error updating connection:",a)}},b5=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&u(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},b6=async(a,b)=>{let c=[...t];[c[a],c[b]]=[c[b],c[a]],u(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bR()}},b7=t.filter(a=>aF.includes(a.id)),b8=t.length>0&&aF.length===t.length;(()=>{if(0===b7.length)return;let a=new Set(b7.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=z.find(a=>a.id===b);return c?.name}})();let b9=()=>{aJ||ao(!1)},ca=async a=>{aK(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bR(),ao(!1)}finally{aK(!1)}},cb=a=>ca(t.map(b=>({connectionId:b.id,proxyPoolId:a}))),cc=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:t.map((a,b)=>{let c;return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,aF.includes(c)),onChange:()=>{var b;return b=a.id,void aG(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,d.jsx)("div",{className:"flex-1 min-w-0 ml-2 sm:ml-4",children:(0,d.jsx)(M,{connection:a,proxyPools:z,isOAuth:bu,isFirst:0===b,isLast:b===t.length-1,onMoveUp:()=>b6(b,b-1),onMoveDown:()=>b6(b,b+1),onToggleActive:b=>b5(a.id,b),autoPing:ae[r]&&"oauth"===a.authType?{isActive:!0===aR.connections[a.id]||aR.schedules?.[a.id]?.enabled===!0,reactiveOn:!0===aR.connections[a.id],provider:r,scheduleOn:aR.schedules?.[a.id]?.enabled===!0,scheduleSummary:(0,ac.JW)(aR.schedules?.[a.id]).join(" / "),onConfigure:()=>aU(a)}:null,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&u(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{aq(a),ak(!0)},onDelete:()=>b1(a.id),oneByOneStatus:bd[a.id]||null})})]},a.id)})}),cd=z.filter(a=>!0===a.isActive),ce=(0,d.jsx)(m.aF,{isOpen:an,onClose:b9,title:`Apply Proxy (${t.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=z.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):ca(t.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:aJ||0===cd.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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>cb(null),disabled:aJ,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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),z.map(a=>(0,d.jsxs)("button",{onClick:()=>cb(a.id),disabled:aJ||!0!==a.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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),aJ&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(m.$n,{onClick:b9,variant:"ghost",fullWidth:!0,disabled:aJ,children:"Cancel"})]})}),cf=async a=>{if(!aB.has(a)){aC(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${bH}/${a}`})}),c=await b.json();ay(b=>({...b,[a]:c.ok?"ok":"error"})),aA(c.ok?"":c.error||"Model not reachable")}catch{ay(b=>({...b,[a]:"error"})),aA("Network error")}finally{aC(b=>{let c=new Set(b);return c.delete(a),c})}}};if(v)return(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(m.Qv,{}),(0,d.jsx)(m.Qv,{})]});if(!bs)return(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(j(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let cg=()=>bA&&bs.apiType?"responses"===bs.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":bB?"/providers/anthropic-m.png":(0,l.HY)(bs.id),ch={total:t.length,connected:t.filter(a=>{let b=af(a);return"active"===b||"success"===b}).length,errors:t.filter(a=>{let b=af(a);return"error"===b||"expired"===b||"unavailable"===b}).length,active:t.filter(a=>!1!==a.isActive).length};return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(j(),{href:"/dashboard/providers",className:"mb-4 inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface pl-1.5 pr-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsx)("div",{className:"relative overflow-hidden rounded-xl border border-border-subtle bg-surface/60",children:(0,d.jsxs)("div",{className:"flex items-center gap-4 p-4 sm:p-5",children:[(0,d.jsx)("div",{className:"grid size-14 shrink-0 place-items-center rounded-xl border border-border bg-surface-2 sm:size-16",style:{backgroundColor:`${bs.color}12`},children:av||!cg()?(0,d.jsx)("span",{className:"text-lg font-bold sm:text-xl",style:{color:bs.color},children:bs.textIcon||bs.id.slice(0,2).toUpperCase()}):(0,d.jsx)(k.A,{src:cg(),alt:bs.name,width:56,height:56,className:"max-h-14 max-w-14 rounded-lg object-contain sm:max-h-16 sm:max-w-16",sizes:"56px",onError:()=>{(0,l.Kw)(bs.id),aw(!0)},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate font-display text-2xl font-bold tracking-tight sm:text-3xl",children:bs.name}),(0,d.jsx)(m.Ex,{variant:"default",size:"sm",children:bC?"Compatible":bw?"Free":bv&&bu?"Dual Auth":bu?"OAuth":"API Key"})]}),(0,d.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[ch.total," connection",1===ch.total?"":"s",ch.total>0&&` \xb7 ${ch.connected} connected`]}),(bs.notice?.apiKeyUrl||bs.notice?.signupUrl||bs.website)&&(0,d.jsxs)("a",{href:bs.notice?.apiKeyUrl||bs.notice?.signupUrl||bs.website,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),bs.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]})]})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,d.jsx)(ah,{icon:"hub",label:"Total koneksi",value:ch.total}),(0,d.jsx)(ah,{icon:"check_circle",label:"Connected",value:ch.connected,tone:"success"}),(0,d.jsx)(ah,{icon:"error",label:"Error",value:ch.errors,tone:"danger"}),(0,d.jsx)(ah,{icon:"toggle_on",label:"Aktif",value:ch.active,sub:ch.total>0?`dari ${ch.total} koneksi`:null})]}),bs.deprecated&&(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-danger shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-danger leading-relaxed",children:bs.deprecationNotice})]}),bs.notice?.text&&!bs.deprecated&&(0,d.jsxs)("div",{className:"flex flex-col gap-2.5 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5 sm:flex-row sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-text-muted",children:bs.notice.text}),bs.notice.apiKeyUrl&&(0,d.jsx)("a",{href:bs.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-7 items-center justify-center rounded-lg bg-primary px-3 text-xs font-display font-medium text-white transition-colors hover:bg-primary-hover sm:py-0",children:"Get API Key →"})]}),bC&&x&&(0,d.jsx)(m.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:bB?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"mt-0.5 break-all font-mono text-xs text-text-muted",children:[bB?"Messages API":"responses"===x.apiType?"Responses API":"Chat Completions"," \xb7 ",(x.baseUrl||"").replace(/\/$/,""),"/",bB?"messages":"responses"===x.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:()=>{X(""),U(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>am(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{a4({title:"Delete Compatible Node",message:`Delete this ${bB?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{a4(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&q.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),bw?(0,d.jsx)(m.gw,{providerId:r}):(0,d.jsxs)(m.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Connections"}),(0,d.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 font-mono text-[11px] font-semibold text-text-main",children:t.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[t.length>0&&z.length>0&&(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ao(!0),children:"Apply Proxy"}),t.length>0&&(0,d.jsxs)(d.Fragment,{children:[aF.length>0&&(0,d.jsxs)(m.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let a=aF.length;0!==a&&a4({title:`Delete ${a} Connection${a>1?"s":""}`,message:`Delete ${a} connection${a>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{a4(null);let a=0,b=[...aF];for(let c of b)try{(await fetch(`/api/providers/${c}`,{method:"DELETE"})).ok||(a+=1)}catch(b){console.log("Error deleting connection:",b),a+=1}u(a=>a.filter(a=>!b.includes(a.id))),aG([]),a>0&&alert(`Deleted ${b.length-a} connection(s), ${a} failed.`)}})},children:["Delete Selected (",aF.length,")"]}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:b0,disabled:a7,children:a7?"Testing Connection One-by-One...":"Test Connection One-by-One"}),a7&&(0,d.jsx)(m.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{a7&&(bh.current=!0,ba(!0))},disabled:a9,children:a9?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-surface-2/40 px-3 py-2",children:[(0,d.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Round Robin"}),(0,d.jsx)(m.lM,{checked:"round-robin"===aL,onChange:a=>{let b=a?"round-robin":null,c=a?aN||"1":aN;a&&!aN&&aO("1"),aM(b),bT(b,c)}}),"round-robin"===aL&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:aN,onChange:a=>{var b;aO(b=a.target.value),bT("round-robin",b)},placeholder:"1",className:"w-14 rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs text-text-main focus:border-text-subtle focus:outline-none"})]})]})]})]}),0===t.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:bu?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bD&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bE," or ",bF,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:bp,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),bE]}),(0,d.jsxs)("button",{onClick:bq,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),bF]})]}):(0,d.jsxs)(d.Fragment,{children:[!bC&&aa.w.has(r)&&(0,d.jsx)(aa.A,{providerId:r,onConnected:bR}),!bC&&ad.has(r)&&(0,d.jsx)(ab,{providerId:r,onConnected:bR}),!bC&&"iflow"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>Q(!0),children:"Cookie"}),"codex"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Z(!0),children:(0,E.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ai(!0),children:(0,E.Tl)("Bulk Add")}),(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:br,children:bC?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[bf&&(0,d.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,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bf.total]}),(0,d.jsxs)("span",{children:["Completed: ",bf.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bf.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bf.failed]}),bf.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),a7&&bb&&(0,d.jsxs)("span",{children:["Running: ",t.find(a=>a.id===bb)?.name||bb]})]})}),t.length>0&&(0,d.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,d.jsx)("input",{type:"checkbox",checked:b8,onChange:()=>{b8?aG([]):aG(t.map(a=>a.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),cc,!bC&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:[aa.w.has(r)&&(0,d.jsx)(aa.A,{providerId:r,onConnected:bR}),ad.has(r)&&(0,d.jsx)(ab,{providerId:r,onConnected:bR}),"iflow"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>Q(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Z(!0),title:(0,E.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,E.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ai(!0),title:(0,E.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,E.Tl)("Bulk Add")}),bD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:bp,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),bE]}),(0,d.jsxs)("button",{onClick:bq,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),bF]})]}):(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:br,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsx)($,{providerId:r}),(0,d.jsxs)(m.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Available Models"}),(0,d.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Model IDs served by this provider"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[bI&&(0,d.jsx)(n.A,{value:aP,onChange:a=>{aQ(a),bU(a)},options:bI.map(a=>({value:a,label:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`,icon:"psychology"})),buttonClassName:"h-8 rounded-lg pl-3 pr-1.5 font-mono text-xs",menuClassName:"w-64"}),!bC&&(a=[...by,...a_.filter(a=>!by.some(b=>b.id===a.id))].filter(a=>{let b=(0,p.CP)(a);return!b||"llm"===b}).map(a=>a.id).filter(a=>!a1.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[a1.length>0&&(0,d.jsxs)("button",{onClick:bO,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"restart_alt"}),"Activate All"]}),a.length>0&&(0,d.jsxs)("button",{onClick:()=>bN(a),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"block"}),"Disable All"]})]}))]})]}),!!az&&(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:az}),/RegionError|hosted in China|regionNotAllowed/i.test(az)&&(c=(b="string"==typeof az?az:JSON.stringify(az)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),f=b.match(/wrk_[0-9A-Za-z]+/),g=c?c[0].endsWith("/go")?c[0]:`${c[0]}/go`:f?`https://opencode.ai/workspace/${f[0]}/go`:"https://opencode.ai",(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsxs)("a",{href:g,target:"_blank",rel:"noreferrer",className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 text-xs font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{children:"Allow China-hosted models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]})]}),"zed"===r&&!!aZ&&(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,d.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:aZ})]}),(()=>{let a,b,c;if(bC)return(0,d.jsx)(I,{providerStorageAlias:bH,providerDisplayAlias:bJ,modelAliases:ar,customModels:at,copied:bm,onCopy:bn,onSetAlias:bW,onDeleteAlias:bX,onAddCustomModel:a=>bY(a,"llm",bH),onDeleteCustomModel:a=>bZ(a,"llm",bH),connections:t,isAnthropic:bB});let e=[...by,...a_.filter(a=>!by.some(b=>b.id===a.id))].filter(a=>{let b=(0,p.CP)(a);return!b||"llm"===b}),f=new Set(a1),g=e.filter(a=>!f.has(a.id)),h=e.filter(a=>f.has(a.id)),i=F({customModels:at,modelAliases:ar,providerAlias:bH,builtInModels:by,type:"llm"});return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[i.map(a=>(0,d.jsx)(G,{model:{id:a.id,name:a.name},fullModel:`${bJ}/${a.id}`,alias:a.alias,copied:bm,onCopy:bn,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?bZ(a.id,"llm",bH):bX(a.alias)},testStatus:ax[a.id],onTest:t.length>0||bw?()=>cf(a.id):void 0,isTesting:aB.has(a.id),isCustom:!0,isFree:!1,caps:s(`${r}/${a.id}`),thinkingSuffix:bG(a.id)},`${a.source}-${a.fullModel}`)),g.map(a=>{let b=`${bH}/${a.id}`,c=`${r}/${a.id}`,e=Object.entries(ar).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(G,{model:a,fullModel:`${bJ}/${a.id}`,alias:e,copied:bm,onCopy:bn,onSetAlias:b=>bW(a.id,b,bH),onDeleteAlias:()=>bX(e),testStatus:ax[a.id],onTest:t.length>0||bw?()=>cf(a.id):void 0,isTesting:aB.has(a.id),isFree:a.isFree,onDisable:()=>bL(a.id),caps:s(`${r}/${a.id}`),thinkingSuffix:bG(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>aE(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),("qoder"===r||"qoder-cn"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:b$,disabled:bi,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bi?{animation:"spin 1s linear infinite"}:void 0,children:bi?"progress_activity":"download"}),bi?(0,E.Tl)("Fetching..."):(0,E.Tl)("Fetch Qoder Models")]}),("cline"===r||"clinepass"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:b_,disabled:bk,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bk?{animation:"spin 1s linear infinite"}:void 0,children:bk?"progress_activity":"download"}),bk?(0,E.Tl)("Fetching..."):(0,E.Tl)("Import from /models")]}),aV.length>0&&(a=new Set([...Object.values(ar),...i.map(a=>a.fullModel)]),b=new Set(by.map(a=>a.id)),0===(c=aV.filter(c=>!a.has(`${bH}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{await bY(a.id,"llm",bH)},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:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),h.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",h.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:h.map(a=>(0,d.jsxs)("button",{onClick:()=>bM(a.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,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),ce,"kiro"===r?(0,d.jsx)(m.Mh,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):"cursor"===r?(0,d.jsx)(m.G9,{isOpen:H,onSuccess:b2,onClose:()=>J(!1)}):"zed"===r?(0,d.jsx)(m.TE,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):"gitlab"===r?(0,d.jsx)(m.vj,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):(0,d.jsx)(m.LF,{isOpen:H,provider:r,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}),(0,d.jsx)(m.LH,{isOpen:K,onSuccess:b2,onClose:()=>L(!1)}),"iflow"===r&&(0,d.jsx)(m.vE,{isOpen:N,onSuccess:()=>{bR(),Q(!1)},onClose:()=>Q(!1)}),(0,d.jsx)(O,{isOpen:S,provider:r,providerName:bs.name,isCompatible:bC,isAnthropic:bB,authType:bs?.authType,authHint:bs?.authHint,website:bs?.website,proxyPools:z,error:V,existingNames:t.map(a=>a.name).filter(Boolean),onSave:b3,onBulkDone:bR,onClose:()=>{X(""),U(!1)}}),(0,d.jsx)(m.wI,{isOpen:aj,connection:ap,proxyPools:z,onSave:b4,onClose:()=>ak(!1)}),bC&&(0,d.jsx)(P,{isOpen:al,node:x,onSave:bS,onClose:()=>am(!1),isAnthropic:bB}),!bC&&(0,d.jsx)(R,{isOpen:aD,providerAlias:bH,providerDisplayAlias:bJ,onSave:async(a,b,c)=>{await bY(a,b?.stt?"stt":"llm",bH,b,c),aE(!1)},onClose:()=>aE(!1)}),"codex"===r&&(0,d.jsx)(T,{isOpen:Y,onClose:()=>Z(!1),onSuccess:bR}),"grok-cli"===r&&(0,d.jsx)(W,{isOpen:ag,onClose:()=>ai(!1),onSuccess:bR}),aT&&(0,d.jsx)(_.A,{isOpen:!!aT,onClose:()=>aU(null),connection:aT,reactive:!0===aR.connections[aT.id],schedule:aR.schedules?.[aT.id]||null,onSave:a=>((a,{reactive:b,schedule:c})=>{bV({...aR,connections:{...aR.connections,[a]:b},schedules:{...aR.schedules,[a]:c}})})(aT.id,a)}),(0,d.jsx)(m.uo,{isOpen:a5,onClose:()=>a6(!1),onConfirm:()=>{(a6(!1),bu)?bo():bq()},title:"Risk Notice",message:bs?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(m.uo,{isOpen:!!a3,onClose:()=>a4(null),onConfirm:a3?.onConfirm,title:a3?.title||"Confirm",message:a3?.message,variant:"danger"})]})}function ah({icon:a,label:b,value:c,sub:e,tone:f}){return(0,d.jsxs)(m.Zp,{className:"flex items-center gap-3 p-3.5",children:[(0,d.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-surface-2 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:a})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-text-subtle",children:b}),(0,d.jsx)("p",{className:`font-display text-xl font-bold leading-tight ${{default:"text-text-main",success:"text-success",danger:"text-danger",brand:"text-text-main"}[f||"default"]}`,children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px] text-text-muted",children:e})]})]})}ah.propTypes={icon:g().string.isRequired,label:g().string.isRequired,value:g().number.isRequired,sub:g().string,tone:g().string}},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},25519:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/home/keyzakyy/Projects/keyrouter/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{"use strict";a.exports=require("node:child_process")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41365:(a,b,c)=>{"use strict";c.d(b,{A:()=>m,w:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(99258);let j=new Set(["grok-web","chatgpt-web","gemini-web","muse-web","deepseek-web","uc-web"]),k={default:"person",grok:"bolt",work:"work",personal:"home"},l=[{key:"opening",label:"Opening browser window",icon:"open_in_new"},{key:"waiting",label:"Waiting for you to log in",icon:"hourglass_top"},{key:"saving",label:"Saving connection",icon:"save"}];function m({providerId:a,onConnected:b,size:c="sm"}){let[f,g]=(0,e.useState)(!1),[j,n]=(0,e.useState)("idle"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(["default"]),[s,t]=(0,e.useState)("default"),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useCallback)(()=>{u.current&&(clearInterval(u.current),u.current=null)},[]),x=(0,e.useCallback)(a=>{t(a)},[a]),y="opening"===j||"waiting"===j,z=(0,e.useCallback)(()=>{y||(w(),g(!1),"error"===j&&(n("idle"),p("")))},[y,j,w]),A=(0,e.useCallback)(()=>{w(),u.current=setInterval(async()=>{try{let c=await fetch(`/api/providers/web-login?provider=${encodeURIComponent(a)}`,{cache:"no-store"}),d=await c.json();"success"===d.status?(w(),n("success"),p(d.email?`${(0,i.Tl)("Signed in as")} ${d.email}`:"Connection saved"),"function"==typeof b&&b(),v.current=setTimeout(()=>{g(!1),p("")},1500)):"error"===d.status||"timeout"===d.status||"cancelled"===d.status?(w(),n("error"),p(d.error||(0,i.Tl)("Login failed"))):n(a=>"opening"===a?"waiting":a)}catch{}},2e3)},[a,b,w]),B=(0,e.useCallback)(async()=>{n("opening"),p("");try{let b=await fetch("/api/providers/web-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,profile:s})}),c=await b.json();if(!b.ok){n("error"),p(c.error||(0,i.Tl)("Failed to start login"));return}n("waiting"),p((0,i.Tl)("A browser window has opened - log in there, this page updates itself.")),A()}catch(a){n("error"),p(a?.message||(0,i.Tl)("Failed to start login"))}},[a,s,A]),C=(0,e.useCallback)(()=>{fetch(`/api/providers/web-login?provider=${encodeURIComponent(a)}`,{method:"DELETE"}).catch(()=>{}),w(),n("idle"),p("")},[a,w]),D=(0,e.useCallback)(()=>{let a=window.prompt((0,i.Tl)("New browser profile name (e.g. work, personal):"),"");if(!a)return;let b=a.trim().replace(/[^a-zA-Z0-9_-]/g,"-").slice(0,40);b&&(r(a=>a.includes(b)?a:[...a,b]),x(b))},[x]),E="opening"===j?0:"waiting"===j?1:"success"===j?2:-1;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{size:c,icon:"success"===j?"check_circle":"language",variant:"secondary",onClick:()=>{n("idle"),p(""),g(!0)},title:(0,i.Tl)("Open a browser window, log in by hand - the cookie is captured automatically"),children:"success"===j?(0,i.Tl)("Connected"):(0,i.Tl)("Login via Browser")}),(0,d.jsx)(h.aF,{isOpen:f,onClose:z,title:(0,i.Tl)("Login via Browser"),size:"sm",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,i.Tl)("A Chrome window opens on a shared browser profile. Log in there - the session is captured automatically. One Google login in a profile makes every other provider a single “Continue with Google” click.")}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:(0,i.Tl)("Browser profile")}),(0,d.jsxs)("button",{type:"button",onClick:D,disabled:y,className:"flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),(0,i.Tl)("New profile")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:q.map(a=>{let b=a===s;return(0,d.jsxs)("button",{type:"button",disabled:y,onClick:()=>x(a),className:`flex items-center gap-2 rounded border border-accent/30 bg-sidebar p-2 text-left text-sm transition-colors focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 ${b?"border-primary ring-1 ring-primary":"hover:border-accent/60"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:function(a){let b=String(a).toLowerCase();for(let[a,c]of Object.entries(k))if(b.includes(a))return c;return"folder_shared"}(a)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a}),b&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check_circle"})]},a)})})]}),"idle"!==j&&(0,d.jsx)("div",{className:"rounded border border-accent/20 bg-sidebar/50 p-3",children:"success"===j?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),"✓ ",o||(0,i.Tl)("Connection saved")]}):"error"===j?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,i.Tl)("Login failed")]}),o&&(0,d.jsx)("p",{className:"pl-6 text-xs text-red-500 break-words",children:o})]}):(0,d.jsxs)("ol",{className:"flex flex-col gap-2",children:[l.map((a,b)=>{let c=b<E,e=b===E;return(0,d.jsxs)("li",{className:`flex items-center gap-2 text-sm ${c?"text-green-400":e?"text-primary":"text-text-muted opacity-50"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] ${e?"animate-pulse":""}`,children:c?"check_circle":a.icon}),(0,i.Tl)(a.label)]},a.key)}),o&&(0,d.jsx)("li",{className:"pl-6 text-xs text-text-muted",children:o})]})}),(0,d.jsx)("div",{className:"flex gap-2",children:"success"===j?(0,d.jsx)(h.$n,{onClick:z,fullWidth:!0,children:(0,i.Tl)("Done")}):y?(0,d.jsx)(h.$n,{onClick:C,variant:"ghost",fullWidth:!0,children:(0,i.Tl)("Cancel")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{onClick:B,fullWidth:!0,disabled:"error"===j&&!o,children:(0,i.Tl)("Open Browser & Login")}),(0,d.jsx)(h.$n,{onClick:z,variant:"ghost",fullWidth:!0,disabled:y,children:(0,i.Tl)("Close")})]})})]})})]})}m.propTypes={providerId:g().string.isRequired,onConnected:g().func,size:g().oneOf(["sm","md","lg"])}},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},50286:(a,b,c)=>{Promise.resolve().then(c.bind(c,12138))},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},54589:(a,b,c)=>{"use strict";function d(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}c.d(b,{JW:()=>i,Vm:()=>d,fB:()=>f,gy:()=>e,nz:()=>g});let e={anchor:"09:30",timezone:d(),windowHours:5,slotsPerDay:3};function f(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function g(a){return Math.max(1,Math.floor(24/a))}function h(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}function i(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=f(a.anchor)||f(e.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?e.timezone:a.timezone,i=h(a.windowHours,e.windowHours,.5,24),j=Math.round(h(a.slotsPerDay,e.slotsPerDay,1,g(i)));return{enabled:!0,anchor:c,timezone:d,windowHours:i,slotsPerDay:j}}(a);if(!b)return[];let{hour:c,minute:d}=f(b.anchor),i=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(i+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},56020:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(71404),j=c(54589);let k=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function l({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:m=null}){let[n,o]=(0,e.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:m?.anchor||j.gy.anchor,timezone:(0,j.Vm)(),windowHours:String(m?.windowHours??j.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??j.gy.slotsPerDay)})),p=Number(n.windowHours),q=Number(n.slotsPerDay),r=!!(0,j.fB)(n.anchor),s=Number.isFinite(p)&&p>=.5&&p<=24,t=s?(0,j.nz)(p):24,u=Number.isInteger(q)&&q>=1&&q<=t,v=r&&s&&u,w="schedule"!==n.mode||v,x=v?(0,j.JW)({enabled:!0,...n,windowHours:p,slotsPerDay:q}):[],y=x.length&&s?(()=>{let{hour:a,minute:b}=(0,j.fB)(n.anchor),c=Math.round(60*a+b+q*p*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"",z=a=>o(b=>({...b,...a}));return(0,d.jsx)(h.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:()=>{w&&(c({reactive:"reset"===n.mode,schedule:"schedule"===n.mode?{enabled:!0,anchor:n.anchor,timezone:n.timezone,windowHours:p,slotsPerDay:q}:{enabled:!1}}),b())},disabled:!w,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",f?.name?` for ${f.name}`:""," - pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:k.map(a=>{let b=n.mode===a.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>z({mode:a.value}),className:(0,i.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",b?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:a.icon}),(0,d.jsx)("span",{children:a.label})]},a.value)})}),"reset"===n.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===n.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,d.jsx)(h.pd,{label:"Anchor time",type:"time",value:n.anchor,onChange:a=>z({anchor:a.target.value}),error:r?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:n.windowHours,onChange:a=>z({windowHours:a.target.value}),error:s?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Pings per day",type:"number",min:"1",max:String(t),step:"1",value:n.slotsPerDay,onChange:a=>z({slotsPerDay:a.target.value}),error:u?"":`1 – ${t}`,hint:u?`Max ${t}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),x.length>0&&(0,d.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",n.timezone,")"]}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:x.join(" → ")}),(0,d.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",x[0]," – ",y,", then pauses until ",x[0]," next day."]})]})]})]})})}l.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSave:g().func.isRequired,connection:g().object,reactive:g().bool,schedule:g().object}},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64198:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},72271:a=>{"use strict";a.exports=require("@aws-sdk/credential-providers")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},91645:a=>{"use strict";a.exports=require("net")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1260,2430,7678,2760,1220,9100,8499,6070,869,915,6457,4123,2172,6777,412,4756],()=>b(b.s=25519));module.exports=c})();
|
|
27
|
+
]`;function V(a){let b,c=a.trim();if(!c)return[];try{b=JSON.parse(c)}catch(a){try{let a=c;a.startsWith("[")||((a=a.replace(/\}\s*,\s*\{/g,"},{").replace(/\}\s*\{/g,"},{")).endsWith(",")&&(a=a.slice(0,-1)),a=`[${a}]`),b=JSON.parse(a)}catch{throw a}}if(Array.isArray(b))return b;if(b&&"object"==typeof b)return Array.isArray(b.accounts)?b.accounts:[b];throw Error("Input must be a JSON object or array of objects")}function W({isOpen:a,onClose:b,onSuccess:c}){let[f,g]=(0,e.useState)(""),[h,i]=(0,e.useState)(!1),[j,k]=(0,e.useState)(""),[l,n]=(0,e.useState)(null),[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),s=(0,e.useRef)(null),t=()=>{h||(g(""),k(""),n(null),r(null),p(!1),b())},u=async a=>{if(!a||0===a.length)return;k("");let b=Array.from(a).filter(a=>a.name.endsWith(".json")||"application/json"===a.type||""===a.type);if(0===b.length)return void k((0,E.Tl)("Please select valid .json files"));try{let a=[];for(let c of b){let b=await c.text(),d=V(b);Array.isArray(d)?a.push(...d):d&&a.push(d)}if(0===a.length)return void k((0,E.Tl)("No accounts found in selected files"));g(JSON.stringify(a,null,2)),r({filesCount:b.length,accountsCount:a.length})}catch(a){k(`${(0,E.Tl)("Error reading files")}: ${a.message}`)}},v=async()=>{let a;k(""),n(null);try{a=V(f)}catch(a){k(`${(0,E.Tl)("Invalid JSON")}: ${a.message}`);return}if(!a||0===a.length)return void k((0,E.Tl)("No accounts found in input"));i(!0);try{let b=await fetch("/api/oauth/grok-cli/bulk-import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accounts:a})}),d=await b.json();if(!b.ok)return void k(d?.error||`Request failed: ${b.status}`);n(d),d.success>0&&"function"==typeof c&&c()}catch(a){k(a.message||(0,E.Tl)("Request failed"))}finally{i(!1)}},w=l?.results?.filter(a=>!a.ok)||[];return(0,d.jsx)(m.aF,{isOpen:a,title:(0,E.Tl)("Bulk Add Grok CLI Accounts"),onClose:t,children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,E.Tl)("Upload multiple .json files or paste JSON array / object.")}),(0,d.jsx)("input",{ref:s,type:"file",accept:".json,application/json",multiple:!0,className:"hidden",onChange:a=>{u(a.target.files),a.target&&(a.target.value="")}}),(0,d.jsx)(m.$n,{type:"button",size:"sm",variant:"secondary",icon:"upload_file",onClick:()=>s.current?.click(),disabled:h,children:(0,E.Tl)("Upload JSON Files")})]}),(0,d.jsxs)("div",{onDragOver:a=>{a.preventDefault(),p(!0)},onDragLeave:a=>{a.preventDefault(),p(!1)},onDrop:a=>{a.preventDefault(),p(!1),a.dataTransfer?.files?.length>0&&u(a.dataTransfer.files)},className:`relative rounded border transition-colors ${o?"border-primary bg-primary/10 ring-2 ring-primary/30":"border-accent/30 bg-sidebar"}`,children:[(0,d.jsx)("textarea",{className:"w-full rounded bg-transparent p-2.5 text-sm font-mono resize-y min-h-[240px] focus:outline-none focus:ring-1 focus:ring-primary",placeholder:U,value:f,onChange:a=>{g(a.target.value),r(null)},disabled:h}),o&&(0,d.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-sidebar/90 rounded pointer-events-none backdrop-blur-xs",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-3xl text-primary mb-1",children:"upload_file"}),(0,d.jsx)("span",{className:"text-sm font-medium text-primary",children:(0,E.Tl)("Drop .json files here")})]})]}),q&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-green-400 font-medium bg-green-500/10 border border-green-500/20 px-2.5 py-1.5 rounded",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"check_circle"}),(0,d.jsxs)("span",{children:[(0,E.Tl)("Loaded")," ",q.accountsCount," ",(0,E.Tl)("account(s) from")," ",q.filesCount," ",(0,E.Tl)("file(s)")]})]}),j&&(0,d.jsx)("p",{className:"text-xs text-red-500 break-words",children:j}),l&&l.failed>0&&(0,d.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,d.jsxs)("div",{className:"text-sm font-medium text-yellow-400",children:["✗ ",l.failed," ",(0,E.Tl)("failed")]}),w.length>0&&(0,d.jsx)("ul",{className:"rounded border border-accent/20 bg-sidebar/50 p-2 text-xs font-mono max-h-40 overflow-y-auto",children:w.map(a=>(0,d.jsxs)("li",{className:"text-red-400",children:["[",a.index,"] ",a.error]},a.index))})]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(m.$n,{onClick:v,fullWidth:!0,disabled:h||!f.trim(),children:h?(0,E.Tl)("Importing..."):(0,E.Tl)("Import All")}),(0,d.jsx)(m.$n,{onClick:t,variant:"ghost",fullWidth:!0,disabled:h,children:(0,E.Tl)("Close")})]})]})})}var X=c(41371);let Y=["host","content-length","content-type","connection","transfer-encoding","authorization","cookie"],Z=/^[A-Za-z0-9-]+$/;function $({providerId:a}){let b=(0,X.i)(),[c,f]=(0,e.useState)(!1),[g,h]=(0,e.useState)([{name:"",value:""}]),[i,j]=(0,e.useState)({}),[k,l]=(0,e.useState)(!1),[n,o]=(0,e.useState)(!1),p=(a,b,c)=>{h(d=>d.map((d,e)=>e===a?{...d,[b]:c}:d))},q=(0,e.useCallback)(async()=>{let c={};for(let a of g.filter(a=>a.name.trim())){let d=a.name.trim();if(!Z.test(d))return void b.error(`Invalid header name: ${d}`);if(Y.includes(d.toLowerCase()))return void b.error(`Header ${d} cannot be overridden`);if(d in c)return void b.error(`Duplicate header name: ${d}`);a.value!==i[d]&&(c[d]=a.value)}o(!0);try{let d=await fetch(`/api/providers/${a}/overrides`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({headers:c})});if(!d.ok){let a=await d.json().catch(()=>({}));b.error(a.error||"Failed to save");return}l(Object.keys(c).length>0),b.success("Custom headers saved")}finally{o(!1)}},[g,i,a,b]);return 0!==Object.keys(i).length||k?(0,d.jsxs)(m.Zp,{padding:"xs",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>f(a=>!a),className:"flex w-full items-center justify-between text-left",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-primary text-[20px]",children:"tune"}),(0,d.jsx)("span",{className:"font-display text-sm font-semibold text-text-main",children:"Custom Headers"}),k&&(0,d.jsx)(m.Ex,{variant:"success",size:"sm",children:"Active"})]}),(0,d.jsx)("span",{className:"material-symbols-outlined text-text-muted",children:c?"expand_less":"expand_more"})]}),c&&(0,d.jsxs)("div",{className:"mt-3 border-t border-border pt-3",children:[(0,d.jsx)("div",{className:"flex flex-col gap-2",children:g.map((a,b)=>{let c=a.name.trim()in i&&a.value!==i[a.name.trim()];return(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("input",{value:a.name,onChange:a=>p(b,"name",a.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,d.jsx)("input",{value:a.value,onChange:a=>p(b,"value",a.target.value),placeholder:"Value",spellCheck:!1,title:c?"Overridden":a.name.trim()in i?"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 ${c?"border-amber-400/60":"border-border"}`}),(0,d.jsx)("button",{type:"button",title:"Remove header",onClick:()=>h(a=>a.length>1?a.filter((a,c)=>c!==b):[{name:"",value:""}]),className:"shrink-0 text-text-muted hover:text-red-500",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"delete"})})]},b)})}),(0,d.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,d.jsxs)("button",{type:"button",onClick:()=>h(a=>[...a,{name:"",value:""}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"add"}),"Add header"]}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)("button",{type:"button",disabled:n,onClick:()=>{h(Object.entries(i).map(([a,b])=>({name:a,value:b})))},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,d.jsx)("button",{type:"button",disabled:n,onClick:q,className:"rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-white hover:opacity-90 disabled:opacity-50",children:n?"Saving...":"Save"})]})]})]})]}):null}$.propTypes={providerId:g().string.isRequired};var _=c(56020),aa=c(41365);function ab({providerId:a,onConnected:b,size:c="sm"}){let[f,g]=(0,e.useState)(!1),[h,i]=(0,e.useState)(""),j=async()=>{g(!0),i("");try{let c=await fetch(`/api/oauth/${a}/lease-connect`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),d=await c.json().catch(()=>({}));if(!c.ok)return void i(d.error||"Could not reach the MiniMax Code desktop app");"function"==typeof b&&b()}catch(a){i(a?.message||"Could not reach the MiniMax Code desktop app")}finally{g(!1)}};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(m.$n,{size:c,icon:"desktop_windows",variant:"secondary",disabled:f,onClick:j,title:(0,E.Tl)("Borrow the signed-in MiniMax Code desktop app's login - no second sign-in, refresh stays with the desktop app"),children:f?(0,E.Tl)("Connecting..."):(0,E.Tl)("Use Desktop App")}),h&&(0,d.jsx)("p",{className:"w-full text-xs text-red-500 break-words",children:h})]})}ab.propTypes={providerId:g().string.isRequired,onConnected:g().func,size:g().oneOf(["sm","md","lg"])};var ac=c(54589);let ad=new Set(["minimax-code","minimax-code-global"]),ae={claude:"claudeAutoPing",codex:"codexAutoPing"};function af(a){let b=Object.entries(a).some(([a,b])=>a.startsWith("modelLock_")&&b&&new Date(b).getTime()>Date.now());return"unavailable"!==a.testStatus||b?a.testStatus:"active"}function ag(){let a,b,c,f,g,i=(0,h.useParams)(),q=(0,h.useRouter)(),r=i.id,{getCaps:s}=(0,D.y)(),[t,u]=(0,e.useState)([]),[v,w]=(0,e.useState)(!0),[x,y]=(0,e.useState)(null),[z,A]=(0,e.useState)([]),[H,J]=(0,e.useState)(!1),[K,L]=(0,e.useState)(!1),[N,Q]=(0,e.useState)(!1),[S,U]=(0,e.useState)(!1),[V,X]=(0,e.useState)(""),[Y,Z]=(0,e.useState)(!1),[ag,ai]=(0,e.useState)(!1),[aj,ak]=(0,e.useState)(!1),[al,am]=(0,e.useState)(!1),[an,ao]=(0,e.useState)(!1),[ap,aq]=(0,e.useState)(null),[ar,as]=(0,e.useState)({}),[at,au]=(0,e.useState)([]),[av,aw]=(0,e.useState)(!1),[ax,ay]=(0,e.useState)({}),[az,aA]=(0,e.useState)(""),[aB,aC]=(0,e.useState)(()=>new Set),[aD,aE]=(0,e.useState)(!1),[aF,aG]=(0,e.useState)([]),[aH,aI]=(0,e.useState)("__none__"),[aJ,aK]=(0,e.useState)(!1),[aL,aM]=(0,e.useState)(null),[aN,aO]=(0,e.useState)(""),[aP,aQ]=(0,e.useState)("auto"),[aR,aS]=(0,e.useState)({enabled:!1,connections:{},schedules:{}}),[aT,aU]=(0,e.useState)(null),[aV,aW]=(0,e.useState)([]),[aX,aY]=(0,e.useState)([]),[aZ,a$]=(0,e.useState)(null),[a_,a0]=(0,e.useState)([]),[a1,a2]=(0,e.useState)([]),[a3,a4]=(0,e.useState)(null),[a5,a6]=(0,e.useState)(!1),[a7,a8]=(0,e.useState)(!1),[a9,ba]=(0,e.useState)(!1),[bb,bc]=(0,e.useState)(null),[bd,be]=(0,e.useState)({}),[bf,bg]=(0,e.useState)(null),bh=(0,e.useRef)(!1),[bi,bj]=(0,e.useState)(!1),[bk,bl]=(0,e.useState)(!1),{copied:bm,copy:bn}=(0,C.C)(),bo=()=>{J(!0)},bp=()=>{"xiaomi-mimo"===r?L(!0):bu?bo():(X(""),U(!0))},bq=()=>{X(""),U(!0)},br=()=>{bu?bp():bq()},bs=x?{id:x.id,name:x.name||("anthropic-compatible"===x.type?"Anthropic Compatible":"OpenAI Compatible"),color:"anthropic-compatible"===x.type?"#D97757":"#10A37F",textIcon:"anthropic-compatible"===x.type?"AC":"OC",apiType:x.apiType,baseUrl:x.baseUrl,type:x.type}:o.zN[r]||o.fg[r]||o.IS[r]||o.nJ[r]||o.br[r],bt=bs?.authModes||[],bu=!!o.zN[r]||!!o.IS[r]||bt.includes("oauth"),bv=!!o.fg[r]||bt.includes("apikey"),bw=!!o.IS[r]?.noAuth,bx=(0,p.KC)(r),by=("cursor"===r||"zed"===r)&&aX.length>0?aX:bx,bz=(0,o.wG)(r),bA=(0,o.mq)(r),bB=(0,o.gb)(r),bC=bA||bB,bD=!bC&&bu&&bv,bE="xai"===r?"Grok Build OAuth":"grok-cli"===r?"Grok CLI Device Login":"kimi"===r?"Kimi Coding OAuth":"OAuth",bF="xai"===r?"xAI API Key":"kimi"===r?"Kimi API Key":"qoder"===r||"qoder-cn"===r?"PAT":"API Key",bG=a=>{if(!aP||"auto"===aP)return null;let b=B(r,a);return b&&b.includes(aP)?aP:null},bH=bC?r:bz,bI=(()=>{let a=new Set,b=new Set,c=c=>{if(!c||b.has(c))return;b.add(c);let d=B(r,c);d&&d.forEach(b=>{"none"!==b&&a.add(b)})};for(let a of by)c(a.id);for(let a of a_)c(a.id);for(let a of at)a.providerAlias===bH&&"llm"===(a.kind||a.type||"llm")&&c(a.id);return a.size?["auto",...a]:null})(),bJ=bC?x?.prefix||r:bz,bK=(0,e.useCallback)(async()=>{try{let a=await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}`,{cache:"no-store"}),b=await a.json();a.ok&&a2(b.ids||[])}catch(a){console.log("Error fetching disabled models:",a)}},[bH]),bL=async a=>{try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bH,ids:[a]})})).ok&&await bK()}catch(a){console.log("Error disabling model:",a)}},bM=async a=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}&id=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bK()}catch(a){console.log("Error enabling model:",a)}},bN=async a=>{a.length&&a4({title:"Disable All Models",message:`Disable all ${a.length} model(s)?`,onConfirm:async()=>{a4(null);try{(await fetch("/api/models/disabled",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:bH,ids:a})})).ok&&await bK()}catch(a){console.log("Error disabling all models:",a)}}})},bO=async()=>{try{(await fetch(`/api/models/disabled?providerAlias=${encodeURIComponent(bH)}`,{method:"DELETE"})).ok&&await bK()}catch(a){console.log("Error enabling all models:",a)}},bP=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/alias"),b=await a.json();a.ok&&as(b.aliases||{})}catch(a){console.log("Error fetching aliases:",a)}},[]),bQ=(0,e.useCallback)(async()=>{try{let a=await fetch("/api/models/custom",{cache:"no-store"}),b=await a.json();a.ok&&au(b.models||[])}catch(a){console.log("Error fetching custom models:",a)}},[]),bR=(0,e.useCallback)(async()=>{try{let[a,b,c,d]=await Promise.all([fetch("/api/providers",{cache:"no-store"}),fetch("/api/provider-nodes",{cache:"no-store"}),fetch("/api/proxy-pools?isActive=true",{cache:"no-store"}),fetch("/api/settings",{cache:"no-store"})]),e=await a.json(),f=await b.json(),g=await c.json(),h=d.ok?await d.json():{};if(a.ok){let a=(e.connections||[]).filter(a=>a.provider===r);u(a)}c.ok&&A(g.proxyPools||[]);let i=(h.providerStrategies||{})[r]||{};aM(i.fallbackStrategy||null),aO(null!=i.stickyRoundRobinLimit?String(i.stickyRoundRobinLimit):"1");let j=(h.providerThinking||{})[r]||{};aQ(j.mode||"auto");let k=ae[r],l=k&&h[k]||{};if(aS({enabled:!0===l.enabled,connections:l.connections||{},schedules:l.schedules||{}}),b.ok){let a=(f.nodes||[]).find(a=>a.id===r)||null;if(!a&&bC)for(let b=0;b<3;b+=1){await new Promise(a=>setTimeout(a,150));let b=await fetch("/api/provider-nodes",{cache:"no-store"});if(b.ok&&(a=((await b.json()).nodes||[]).find(a=>a.id===r)||null))break}y(a)}}catch(a){console.log("Error fetching connections:",a)}finally{w(!1)}},[r,bC]),bS=async a=>{try{let b=await fetch(`/api/provider-nodes/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),c=await b.json();b.ok&&(y(c.node),await bR(),am(!1))}catch(a){console.log("Error updating provider node:",a)}},bT=async(a,b)=>{try{let c=await fetch("/api/settings",{cache:"no-store"}),d=(c.ok?await c.json():{}).providerStrategies||{},e={};a&&(e.fallbackStrategy=a),"round-robin"===a&&""!==b&&(e.stickyRoundRobinLimit=Number(b)||3);let f={...d};0===Object.keys(e).length?delete f[r]:f[r]=e,await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerStrategies:f})})}catch(a){console.log("Error saving provider strategy:",a)}},bU=async a=>{try{let b=await fetch("/api/settings",{cache:"no-store"}),c={...(b.ok?await b.json():{}).providerThinking||{}};a&&"auto"!==a?c[r]={mode:a}:delete c[r],await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerThinking:c})})}catch(a){console.log("Error saving thinking config:",a)}},bV=async a=>{let b=ae[r];if(b){aS(a);try{await fetch("/api/settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({[b]:a})})}catch(a){console.log("Error saving auto-ping config:",a)}}},bW=async(a,b,c=bz)=>{let d=`${c}/${a}`;try{let a=await fetch("/api/models/alias",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:d,alias:b})});if(a.ok)await bP();else{let b=await a.json();alert(b.error||"Failed to set alias")}}catch(a){console.log("Error setting alias:",a)}},bX=async a=>{try{(await fetch(`/api/models/alias?alias=${encodeURIComponent(a)}`,{method:"DELETE"})).ok&&await bP()}catch(a){console.log("Error deleting alias:",a)}},bY=async(a,b="llm",c=bH,d,e)=>{try{let f=await fetch("/api/models/custom",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({providerAlias:c,id:a,type:b,...d?{caps:d}:{},...e?{transport:e}:{}})});if(f.ok)await bQ();else{let a=await f.json();alert(a.error||"Failed to add custom model")}}catch(a){console.log("Error adding custom model:",a)}},bZ=async(a,b="llm",c=bH)=>{try{let d=new URLSearchParams({providerAlias:c,id:a,type:b});(await fetch(`/api/models/custom?${d}`,{method:"DELETE"})).ok&&await bQ()}catch(a){console.log("Error deleting custom model:",a)}},b$=async()=>{if(bi)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,E.Tl)("Please add an active Qoder connection first"));bj(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,E.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,E.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;if(!b)continue;let c=b.replace(/^(qoder-cn|qoder)\//,"");at.some(a=>a.providerAlias===bH&&a.id===c&&"llm"===(a.kind||a.type||"llm"))||Object.values(ar).includes(`${bH}/${c}`)||(await bY(c,"llm",bH),e+=1)}0===e?alert((0,E.Tl)("All models already exist, no new models added")):alert((0,E.Tl)("Successfully added")+` ${e} `+(0,E.Tl)("models"))}catch(a){console.log("Error importing Qoder models:",a),alert((0,E.Tl)("Error fetching models")+": "+a.message)}finally{bj(!1)}},b_=async()=>{if(bk)return;let a=t.find(a=>!1!==a.isActive);if(!a)return void alert((0,E.Tl)("Please add an active Cline connection first"));bl(!0);try{let b=await fetch(`/api/providers/${a.id}/models`),c=await b.json();if(!b.ok)return void alert(c.error||(0,E.Tl)("Failed to fetch models"));let d=c.models||[];if(0===d.length)return void alert((0,E.Tl)("No models returned"));let e=0;for(let a of d){let b=a.id||a.name;b&&(at.some(a=>a.providerAlias===bH&&a.id===b&&"llm"===(a.kind||a.type||"llm"))||Object.values(ar).includes(`${bH}/${b}`)||(await bY(b,"llm",bH),e+=1))}0===e?alert((0,E.Tl)("All models already exist, no new models added")):alert((0,E.Tl)("Successfully added")+` ${e} `+(0,E.Tl)("models"))}catch(a){console.log("Error importing Cline models:",a),alert((0,E.Tl)("Error fetching models")+": "+a.message)}finally{bl(!1)}},b0=async()=>{if(a7||0===t.length)return;let a=Object.fromEntries(t.map(a=>[a.id,{state:"queued",error:null}]));bh.current=!1,a8(!0),ba(!1),bc(null),be(a),bg({total:t.length,completed:0,passed:0,failed:0,stopped:!1});let b=0,c=0;try{for(let a=0;a<t.length;a+=1){if(bh.current){bg({total:t.length,completed:a,passed:b,failed:c,stopped:!0});break}let d=t[a];bc(d.id),be(a=>({...a,[d.id]:{state:"testing",error:null}}));try{let a=await fetch(`/api/providers/${d.id}/test`,{method:"POST"}),e=await a.json(),f=!!e.valid;f?b+=1:c+=1,be(a=>({...a,[d.id]:{state:f?"success":"failed",error:f?null:e.error||null}}))}catch(a){c+=1,be(b=>({...b,[d.id]:{state:"failed",error:a.message||"Test failed"}}))}bg({total:t.length,completed:a+1,passed:b,failed:c,stopped:!1}),a<t.length-1&&await new Promise(a=>setTimeout(a,1e3))}}finally{bc(null),a8(!1),ba(!1),bh.current=!1}},b1=async a=>{a4({title:"Delete Connection",message:"Delete this connection?",onConfirm:async()=>{a4(null);try{(await fetch(`/api/providers/${a}`,{method:"DELETE"})).ok&&u(b=>b.filter(b=>b.id!==a))}catch(a){console.log("Error deleting connection:",a)}}})},b2=()=>{bR(),J(!1)},b3=async a=>{X("");try{let b=await fetch("/api/providers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:r,...a})}),c=null;try{c=await b.json()}catch{c=null}if(b.ok){await bR(),U(!1);return}X(c?.error||"Failed to save connection")}catch(a){console.log("Error saving connection:",a),X("Failed to save connection")}},b4=async a=>{try{(await fetch(`/api/providers/${ap.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok&&(await bR(),ak(!1))}catch(a){console.log("Error updating connection:",a)}},b5=async(a,b)=>{try{(await fetch(`/api/providers/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({isActive:b})})).ok&&u(c=>c.map(c=>c.id===a?{...c,isActive:b}:c))}catch(a){console.log("Error updating connection status:",a)}},b6=async(a,b)=>{let c=[...t];[c[a],c[b]]=[c[b],c[a]],u(c);try{await Promise.all([fetch(`/api/providers/${c[a].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:a})}),fetch(`/api/providers/${c[b].id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({priority:b})})])}catch(a){console.log("Error swapping priority:",a),await bR()}},b7=t.filter(a=>aF.includes(a.id)),b8=t.length>0&&aF.length===t.length;(()=>{if(0===b7.length)return;let a=new Set(b7.map(a=>a.providerSpecificData?.proxyPoolId||"__none__"));if(1===a.size){let b=[...a][0];if("__none__"===b)return;let c=z.find(a=>a.id===b);return c?.name}})();let b9=()=>{aJ||ao(!1)},ca=async a=>{aK(!0);try{let b=0;for(let{connectionId:c,proxyPoolId:d}of a)try{(await fetch(`/api/providers/${c}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:d})})).ok||(b+=1)}catch(a){console.log("Error applying proxy for",c,a),b+=1}b>0&&alert(`Updated with ${b} failed request(s).`),await bR(),ao(!1)}finally{aK(!1)}},cb=a=>ca(t.map(b=>({connectionId:b.id,proxyPoolId:a}))),cc=(0,d.jsx)("div",{className:"flex min-w-0 flex-col divide-y divide-black/[0.03] dark:divide-white/[0.03] max-h-[500px] overflow-y-auto pr-1",children:t.map((a,b)=>{let c;return(0,d.jsxs)("div",{className:"flex min-w-0 items-stretch",children:[(0,d.jsx)("div",{className:"flex shrink-0 items-center pl-1 sm:pl-2",children:(0,d.jsx)("input",{type:"checkbox",checked:(c=a.id,aF.includes(c)),onChange:()=>{var b;return b=a.id,void aG(a=>a.includes(b)?a.filter(a=>a!==b):[...a,b])},className:"h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"})}),(0,d.jsx)("div",{className:"flex-1 min-w-0 ml-2 sm:ml-4",children:(0,d.jsx)(M,{connection:a,proxyPools:z,isOAuth:bu,isFirst:0===b,isLast:b===t.length-1,onMoveUp:()=>b6(b,b-1),onMoveDown:()=>b6(b,b+1),onToggleActive:b=>b5(a.id,b),autoPing:ae[r]&&"oauth"===a.authType?{isActive:!0===aR.connections[a.id]||aR.schedules?.[a.id]?.enabled===!0,reactiveOn:!0===aR.connections[a.id],provider:r,scheduleOn:aR.schedules?.[a.id]?.enabled===!0,scheduleSummary:(0,ac.JW)(aR.schedules?.[a.id]).join(" / "),onConfigure:()=>aU(a)}:null,onUpdateProxy:async b=>{try{(await fetch(`/api/providers/${a.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({proxyPoolId:b||null})})).ok&&u(c=>c.map(c=>c.id===a.id?{...c,providerSpecificData:{...c.providerSpecificData,proxyPoolId:b||null}}:c))}catch(a){console.log("Error updating proxy:",a)}},onEdit:()=>{aq(a),ak(!0)},onDelete:()=>b1(a.id),oneByOneStatus:bd[a.id]||null})})]},a.id)})}),cd=z.filter(a=>!0===a.isActive),ce=(0,d.jsx)(m.aF,{isOpen:an,onClose:b9,title:`Apply Proxy (${t.length} connections)`,children:(0,d.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,d.jsxs)("div",{className:"flex flex-col",children:[(0,d.jsxs)("button",{onClick:()=>{let a=z.filter(a=>!0===a.isActive);return 0===a.length?void alert("No active proxy pools available."):ca(t.map((b,c)=>({connectionId:b.id,proxyPoolId:a[c%a.length].id})))},disabled:aJ||0===cd.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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"sync_alt"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"One-to-one (rotate)"})]}),(0,d.jsxs)("button",{onClick:()=>cb(null),disabled:aJ,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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"link_off"}),(0,d.jsx)("span",{className:"text-sm text-text-main",children:"None (unbind all)"})]}),z.map(a=>(0,d.jsxs)("button",{onClick:()=>cb(a.id),disabled:aJ||!0!==a.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,d.jsx)("span",{className:"material-symbols-outlined text-text-muted text-[18px]",children:"lan"}),(0,d.jsx)("span",{className:"truncate text-sm text-text-main",children:a.name}),!0!==a.isActive&&(0,d.jsx)("span",{className:"text-[10px] text-text-muted",children:"(inactive)"})]},a.id))]}),aJ&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Applying..."}),(0,d.jsx)(m.$n,{onClick:b9,variant:"ghost",fullWidth:!0,disabled:aJ,children:"Cancel"})]})}),cf=async a=>{if(!aB.has(a)){aC(b=>new Set(b).add(a));try{let b=await fetch("/api/models/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({model:`${bH}/${a}`})}),c=await b.json();ay(b=>({...b,[a]:c.ok?"ok":"error"})),aA(c.ok?"":c.error||"Model not reachable")}catch{ay(b=>({...b,[a]:"error"})),aA("Network error")}finally{aC(b=>{let c=new Set(b);return c.delete(a),c})}}};if(v)return(0,d.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,d.jsx)(m.Qv,{}),(0,d.jsx)(m.Qv,{})]});if(!bs)return(0,d.jsxs)("div",{className:"text-center py-20",children:[(0,d.jsx)("p",{className:"text-text-muted",children:"Provider not found"}),(0,d.jsx)(j(),{href:"/dashboard/providers",className:"text-primary mt-4 inline-block",children:"Back to Providers"})]});let cg=()=>bA&&bs.apiType?"responses"===bs.apiType?"/providers/oai-r.png":"/providers/oai-cc.png":bB?"/providers/anthropic-m.png":(0,l.HY)(bs.id),ch={total:t.length,connected:t.filter(a=>{let b=af(a);return"active"===b||"success"===b}).length,errors:t.filter(a=>{let b=af(a);return"error"===b||"expired"===b||"unavailable"===b}).length,active:t.filter(a=>!1!==a.isActive).length};return(0,d.jsxs)("div",{className:"flex min-w-0 flex-col gap-6 px-1 sm:gap-8 sm:px-0",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsxs)(j(),{href:"/dashboard/providers",className:"mb-4 inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface pl-1.5 pr-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px] text-text-muted",children:"arrow_back"}),"Back to Providers"]}),(0,d.jsx)("div",{className:"relative overflow-hidden rounded-xl border border-border-subtle bg-surface/60",children:(0,d.jsxs)("div",{className:"flex items-center gap-4 p-4 sm:p-5",children:[(0,d.jsx)("div",{className:"grid size-14 shrink-0 place-items-center rounded-xl border border-border bg-surface-2 sm:size-16",style:{backgroundColor:`${bs.color}12`},children:av||!cg()?(0,d.jsx)("span",{className:"text-lg font-bold sm:text-xl",style:{color:bs.color},children:bs.textIcon||bs.id.slice(0,2).toUpperCase()}):(0,d.jsx)(k.A,{src:cg(),alt:bs.name,width:56,height:56,className:"max-h-14 max-w-14 rounded-lg object-contain sm:max-h-16 sm:max-w-16",sizes:"56px",onError:()=>{(0,l.Kw)(bs.id),aw(!0)},loading:"lazy",decoding:"async"})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,d.jsx)("h1",{className:"truncate font-display text-2xl font-bold tracking-tight sm:text-3xl",children:bs.name}),(0,d.jsx)(m.Ex,{variant:"default",size:"sm",children:bC?"Compatible":bw?"Free":bv&&bu?"Dual Auth":bu?"OAuth":"API Key"})]}),(0,d.jsxs)("p",{className:"mt-1 text-sm text-text-muted",children:[ch.total," connection",1===ch.total?"":"s",ch.total>0&&` \xb7 ${ch.connected} connected`]}),(bs.notice?.apiKeyUrl||bs.notice?.signupUrl||bs.website)&&(0,d.jsxs)("a",{href:bs.notice?.apiKeyUrl||bs.notice?.signupUrl||bs.website,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"open_in_new"}),bs.notice?.apiKeyUrl?"Get API Key":"Sign up / Learn more"]})]})]})})]}),(0,d.jsxs)("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[(0,d.jsx)(ah,{icon:"hub",label:"Total koneksi",value:ch.total}),(0,d.jsx)(ah,{icon:"check_circle",label:"Connected",value:ch.connected,tone:"success"}),(0,d.jsx)(ah,{icon:"error",label:"Error",value:ch.errors,tone:"danger"}),(0,d.jsx)(ah,{icon:"toggle_on",label:"Aktif",value:ch.active,sub:ch.total>0?`dari ${ch.total} koneksi`:null})]}),bs.deprecated&&(0,d.jsxs)("div",{className:"flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-danger shrink-0",children:"warning"}),(0,d.jsx)("p",{className:"text-xs text-danger leading-relaxed",children:bs.deprecationNotice})]}),bs.notice?.text&&!bs.deprecated&&(0,d.jsxs)("div",{className:"flex flex-col gap-2.5 rounded-lg border border-border bg-surface-2/60 px-3 py-2.5 sm:flex-row sm:items-center",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-text-muted shrink-0",children:"info"}),(0,d.jsx)("p",{className:"min-w-0 flex-1 text-xs leading-relaxed text-text-muted",children:bs.notice.text}),bs.notice.apiKeyUrl&&(0,d.jsx)("a",{href:bs.notice.apiKeyUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-7 items-center justify-center rounded-lg bg-primary px-3 text-xs font-display font-medium text-white transition-colors hover:bg-primary-hover sm:py-0",children:"Get API Key →"})]}),bC&&x&&(0,d.jsx)(m.Zp,{children:(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:bB?"Anthropic Compatible Details":"OpenAI Compatible Details"}),(0,d.jsxs)("p",{className:"mt-0.5 break-all font-mono text-xs text-text-muted",children:[bB?"Messages API":"responses"===x.apiType?"Responses API":"Chat Completions"," \xb7 ",(x.baseUrl||"").replace(/\/$/,""),"/",bB?"messages":"responses"===x.apiType?"responses":"chat/completions"]})]}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:()=>{X(""),U(!0)},className:"w-full sm:w-auto",children:"Add API Key"}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"edit",onClick:()=>am(!0),className:"w-full sm:w-auto",children:"Edit"}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"delete",onClick:async()=>{a4({title:"Delete Compatible Node",message:`Delete this ${bB?"Anthropic":"OpenAI"} Compatible node?`,onConfirm:async()=>{a4(null);try{(await fetch(`/api/provider-nodes/${r}`,{method:"DELETE"})).ok&&q.push("/dashboard/providers")}catch(a){console.log("Error deleting provider node:",a)}}})},className:"w-full sm:w-auto",children:"Delete"})]})]})}),bw?(0,d.jsx)(m.gw,{providerId:r}):(0,d.jsxs)(m.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Connections"}),(0,d.jsx)("span",{className:"rounded-full bg-surface-2 px-2 py-0.5 font-mono text-[11px] font-semibold text-text-main",children:t.length})]}),(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4",children:[t.length>0&&z.length>0&&(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"lan",onClick:()=>ao(!0),children:"Apply Proxy"}),t.length>0&&(0,d.jsxs)(d.Fragment,{children:[aF.length>0&&(0,d.jsxs)(m.$n,{size:"sm",variant:"danger",icon:"delete",onClick:()=>{let a=aF.length;0!==a&&a4({title:`Delete ${a} Connection${a>1?"s":""}`,message:`Delete ${a} connection${a>1?"s":""}? This cannot be undone.`,onConfirm:async()=>{a4(null);let a=0,b=[...aF];for(let c of b)try{(await fetch(`/api/providers/${c}`,{method:"DELETE"})).ok||(a+=1)}catch(b){console.log("Error deleting connection:",b),a+=1}u(a=>a.filter(a=>!b.includes(a.id))),aG([]),a>0&&alert(`Deleted ${b.length-a} connection(s), ${a} failed.`)}})},children:["Delete Selected (",aF.length,")"]}),(0,d.jsx)(m.$n,{size:"sm",variant:"secondary",icon:"sync",onClick:b0,disabled:a7,children:a7?"Testing Connection One-by-One...":"Test Connection One-by-One"}),a7&&(0,d.jsx)(m.$n,{size:"sm",variant:"ghost",icon:"stop",onClick:()=>{a7&&(bh.current=!0,ba(!0))},disabled:a9,children:a9?"Stopping...":"Stop"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2.5 rounded-lg border border-border bg-surface-2/40 px-3 py-2",children:[(0,d.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Round Robin"}),(0,d.jsx)(m.lM,{checked:"round-robin"===aL,onChange:a=>{let b=a?"round-robin":null,c=a?aN||"1":aN;a&&!aN&&aO("1"),aM(b),bT(b,c)}}),"round-robin"===aL&&(0,d.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Sticky:"}),(0,d.jsx)("input",{type:"number",min:1,value:aN,onChange:a=>{var b;aO(b=a.target.value),bT("round-robin",b)},placeholder:"1",className:"w-14 rounded-md border border-border bg-surface px-2 py-1 font-mono text-xs text-text-main focus:border-text-subtle focus:outline-none"})]})]})]})]}),0===t.length?(0,d.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center gap-3",children:[(0,d.jsx)("div",{className:"inline-flex items-center justify-center w-9 h-9 rounded-full bg-primary/10 text-primary shrink-0",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:bu?"lock":"key"})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"text-sm text-text-muted",children:"No connections yet"}),bD&&(0,d.jsxs)("p",{className:"text-xs text-text-muted",children:["Choose ",bE," or ",bF,"."]})]})]}),(0,d.jsx)("div",{className:"flex gap-2",children:bD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:bp,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),bE]}),(0,d.jsxs)("button",{onClick:bq,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),bF]})]}):(0,d.jsxs)(d.Fragment,{children:[!bC&&aa.w.has(r)&&(0,d.jsx)(aa.A,{providerId:r,onConnected:bR}),!bC&&ad.has(r)&&(0,d.jsx)(ab,{providerId:r,onConnected:bR}),!bC&&"iflow"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>Q(!0),children:"Cookie"}),"codex"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Z(!0),children:(0,E.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ai(!0),children:(0,E.Tl)("Bulk Add")}),(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:br,children:bC?"Add API Key":"iflow"===r?"OAuth":"Add Connection"})]})})]}):(0,d.jsxs)(d.Fragment,{children:[bf&&(0,d.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,d.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,d.jsxs)("span",{children:["Total: ",bf.total]}),(0,d.jsxs)("span",{children:["Completed: ",bf.completed]}),(0,d.jsxs)("span",{children:["Passed: ",bf.passed]}),(0,d.jsxs)("span",{children:["Failed: ",bf.failed]}),bf.stopped&&(0,d.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Stopped"}),a7&&bb&&(0,d.jsxs)("span",{children:["Running: ",t.find(a=>a.id===bb)?.name||bb]})]})}),t.length>0&&(0,d.jsx)("div",{className:"mb-3 flex items-center gap-2 border-b border-black/[0.03] pb-2 dark:border-white/[0.03]",children:(0,d.jsxs)("label",{className:"flex cursor-pointer items-center gap-1.5 text-xs text-text-muted hover:text-primary",children:[(0,d.jsx)("input",{type:"checkbox",checked:b8,onChange:()=>{b8?aG([]):aG(t.map(a=>a.id))},className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Select All"]})}),cc,!bC&&(0,d.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-2 sm:flex",children:[aa.w.has(r)&&(0,d.jsx)(aa.A,{providerId:r,onConnected:bR}),ad.has(r)&&(0,d.jsx)(ab,{providerId:r,onConnected:bR}),"iflow"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"cookie",variant:"secondary",onClick:()=>Q(!0),title:"Add connection using browser cookie",className:"w-full sm:w-auto",children:"Cookie"}),"codex"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>Z(!0),title:(0,E.Tl)("Bulk import codex accounts from JSON"),className:"w-full sm:w-auto",children:(0,E.Tl)("Bulk Add")}),"grok-cli"===r&&(0,d.jsx)(m.$n,{size:"sm",icon:"playlist_add",variant:"secondary",onClick:()=>ai(!0),title:(0,E.Tl)("Bulk import Grok CLI accounts from JSON"),className:"w-full sm:w-auto",children:(0,E.Tl)("Bulk Add")}),bD?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("button",{onClick:bp,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg border border-border bg-surface px-3.5 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2 w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"lock"}),bE]}),(0,d.jsxs)("button",{onClick:bq,className:"inline-flex h-8 items-center justify-center gap-2 rounded-lg bg-primary px-3.5 text-sm font-display font-medium text-white transition-colors hover:bg-primary-hover w-full sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[17px]",children:"key"}),bF]})]}):(0,d.jsx)(m.$n,{size:"sm",icon:"add",onClick:br,className:"w-full sm:w-auto",children:"Add"})]})]})]}),(0,d.jsx)($,{providerId:r}),(0,d.jsxs)(m.Zp,{children:[(0,d.jsxs)("div",{className:"mb-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,d.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,d.jsx)("h2",{className:"font-display text-lg font-semibold text-text-main",children:"Available Models"}),(0,d.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-wider text-text-subtle",children:"Model IDs served by this provider"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[bI&&(0,d.jsx)(n.A,{value:aP,onChange:a=>{aQ(a),bU(a)},options:bI.map(a=>({value:a,label:`Thinking: ${a.charAt(0).toUpperCase()+a.slice(1)}`,icon:"psychology"})),buttonClassName:"h-8 rounded-lg pl-3 pr-1.5 font-mono text-xs",menuClassName:"w-64"}),!bC&&(a=[...by,...a_.filter(a=>!by.some(b=>b.id===a.id))].filter(a=>{let b=(0,p.CP)(a);return!b||"llm"===b}).map(a=>a.id).filter(a=>!a1.includes(a)),(0,d.jsxs)("div",{className:"flex gap-2",children:[a1.length>0&&(0,d.jsxs)("button",{onClick:bO,className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"restart_alt"}),"Activate All"]}),a.length>0&&(0,d.jsxs)("button",{onClick:()=>bN(a),className:"inline-flex h-8 items-center gap-1.5 rounded-lg border border-border bg-surface px-3 text-sm font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px]",children:"block"}),"Disable All"]})]}))]})]}),!!az&&(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:az}),/RegionError|hosted in China|regionNotAllowed/i.test(az)&&(c=(b="string"==typeof az?az:JSON.stringify(az)).match(/https:\/\/opencode\.ai\/workspace\/[^\s"')]+/),f=b.match(/wrk_[0-9A-Za-z]+/),g=c?c[0].endsWith("/go")?c[0]:`${c[0]}/go`:f?`https://opencode.ai/workspace/${f[0]}/go`:"https://opencode.ai",(0,d.jsx)("div",{className:"mt-2",children:(0,d.jsxs)("a",{href:g,target:"_blank",rel:"noreferrer",className:"inline-flex h-7 items-center gap-1.5 rounded-lg border border-border bg-surface px-2.5 text-xs font-display font-medium text-text-main transition-colors hover:border-text-subtle hover:bg-surface-2",children:[(0,d.jsx)("span",{children:"Allow China-hosted models"}),(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"open_in_new"})]})}))]})]}),"zed"===r&&!!aZ&&(0,d.jsxs)("div",{className:"mb-3 flex items-center gap-2.5 rounded-lg border border-danger/25 bg-danger/5 px-3 py-2.5",children:[(0,d.jsx)("span",{className:"material-symbols-outlined shrink-0 text-[18px] text-danger",children:"error"}),(0,d.jsx)("p",{className:"break-words font-mono text-xs leading-relaxed text-danger",children:aZ})]}),(()=>{let a,b,c;if(bC)return(0,d.jsx)(I,{providerStorageAlias:bH,providerDisplayAlias:bJ,modelAliases:ar,customModels:at,copied:bm,onCopy:bn,onSetAlias:bW,onDeleteAlias:bX,onAddCustomModel:a=>bY(a,"llm",bH),onDeleteCustomModel:a=>bZ(a,"llm",bH),connections:t,isAnthropic:bB});let e=[...by,...a_.filter(a=>!by.some(b=>b.id===a.id))].filter(a=>{let b=(0,p.CP)(a);return!b||"llm"===b}),f=new Set(a1),g=e.filter(a=>!f.has(a.id)),h=e.filter(a=>f.has(a.id)),i=F({customModels:at,modelAliases:ar,providerAlias:bH,builtInModels:by,type:"llm"});return(0,d.jsxs)("div",{className:"flex flex-wrap gap-3",children:[i.map(a=>(0,d.jsx)(G,{model:{id:a.id,name:a.name},fullModel:`${bJ}/${a.id}`,alias:a.alias,copied:bm,onCopy:bn,onSetAlias:()=>{},onDeleteAlias:()=>{"custom"===a.source?bZ(a.id,"llm",bH):bX(a.alias)},testStatus:ax[a.id],onTest:t.length>0||bw?()=>cf(a.id):void 0,isTesting:aB.has(a.id),isCustom:!0,isFree:!1,caps:s(`${r}/${a.id}`),thinkingSuffix:bG(a.id)},`${a.source}-${a.fullModel}`)),g.map(a=>{let b=`${bH}/${a.id}`,c=`${r}/${a.id}`,e=Object.entries(ar).find(([,a])=>a===b||a===c)?.[0];return(0,d.jsx)(G,{model:a,fullModel:`${bJ}/${a.id}`,alias:e,copied:bm,onCopy:bn,onSetAlias:b=>bW(a.id,b,bH),onDeleteAlias:()=>bX(e),testStatus:ax[a.id],onTest:t.length>0||bw?()=>cf(a.id):void 0,isTesting:aB.has(a.id),isFree:a.isFree,onDisable:()=>bL(a.id),caps:s(`${r}/${a.id}`),thinkingSuffix:bG(a.id)},a.id)}),(0,d.jsxs)("button",{onClick:()=>aE(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",children:"add"}),"Add Model"]}),("qoder"===r||"qoder-cn"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:b$,disabled:bi,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bi?{animation:"spin 1s linear infinite"}:void 0,children:bi?"progress_activity":"download"}),bi?(0,E.Tl)("Fetching..."):(0,E.Tl)("Fetch Qoder Models")]}),("cline"===r||"clinepass"===r)&&t.some(a=>!1!==a.isActive)&&(0,d.jsxs)("button",{onClick:b_,disabled:bk,className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-border px-3 py-2 text-xs font-display font-medium text-text-muted transition-colors hover:border-text-subtle hover:bg-surface-2/60 hover:text-text-main sm:w-auto disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-sm",style:bk?{animation:"spin 1s linear infinite"}:void 0,children:bk?"progress_activity":"download"}),bk?(0,E.Tl)("Fetching..."):(0,E.Tl)("Import from /models")]}),aV.length>0&&(a=new Set([...Object.values(ar),...i.map(a=>a.fullModel)]),b=new Set(by.map(a=>a.id)),0===(c=aV.filter(c=>!a.has(`${bH}/${c.id}`)&&!b.has(c.id))).length?null:(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted mb-2",children:"Suggested free models (≥200k context):"}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(a=>(0,d.jsxs)("button",{onClick:async()=>{await bY(a.id,"llm",bH)},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:`${a.name} \xb7 ${(a.contextLength/1e3).toFixed(0)}k ctx`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id.split("/").pop()]},a.id))})]})),h.length>0&&(0,d.jsxs)("div",{className:"w-full mt-2",children:[(0,d.jsxs)("p",{className:"text-xs text-text-muted mb-2",children:["Disabled models (",h.length,"):"]}),(0,d.jsx)("div",{className:"flex flex-wrap gap-2",children:h.map(a=>(0,d.jsxs)("button",{onClick:()=>bM(a.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,d.jsx)("span",{className:"material-symbols-outlined text-[13px]",children:"add"}),a.id]},a.id))})]})]})})()]}),ce,"kiro"===r?(0,d.jsx)(m.Mh,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):"cursor"===r?(0,d.jsx)(m.G9,{isOpen:H,onSuccess:b2,onClose:()=>J(!1)}):"zed"===r?(0,d.jsx)(m.TE,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):"gitlab"===r?(0,d.jsx)(m.vj,{isOpen:H,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}):(0,d.jsx)(m.LF,{isOpen:H,provider:r,providerInfo:bs,onSuccess:b2,onClose:()=>J(!1)}),(0,d.jsx)(m.LH,{isOpen:K,onSuccess:b2,onClose:()=>L(!1)}),"iflow"===r&&(0,d.jsx)(m.vE,{isOpen:N,onSuccess:()=>{bR(),Q(!1)},onClose:()=>Q(!1)}),(0,d.jsx)(O,{isOpen:S,provider:r,providerName:bs.name,isCompatible:bC,isAnthropic:bB,authType:bs?.authType,authHint:bs?.authHint,website:bs?.website,proxyPools:z,error:V,existingNames:t.map(a=>a.name).filter(Boolean),onSave:b3,onBulkDone:bR,onClose:()=>{X(""),U(!1)}}),(0,d.jsx)(m.wI,{isOpen:aj,connection:ap,proxyPools:z,onSave:b4,onClose:()=>ak(!1)}),bC&&(0,d.jsx)(P,{isOpen:al,node:x,onSave:bS,onClose:()=>am(!1),isAnthropic:bB}),!bC&&(0,d.jsx)(R,{isOpen:aD,providerAlias:bH,providerDisplayAlias:bJ,onSave:async(a,b,c)=>{await bY(a,b?.stt?"stt":"llm",bH,b,c),aE(!1)},onClose:()=>aE(!1)}),"codex"===r&&(0,d.jsx)(T,{isOpen:Y,onClose:()=>Z(!1),onSuccess:bR}),"grok-cli"===r&&(0,d.jsx)(W,{isOpen:ag,onClose:()=>ai(!1),onSuccess:bR}),aT&&(0,d.jsx)(_.A,{isOpen:!!aT,onClose:()=>aU(null),connection:aT,reactive:!0===aR.connections[aT.id],schedule:aR.schedules?.[aT.id]||null,onSave:a=>((a,{reactive:b,schedule:c})=>{bV({...aR,connections:{...aR.connections,[a]:b},schedules:{...aR.schedules,[a]:c}})})(aT.id,a)}),(0,d.jsx)(m.uo,{isOpen:a5,onClose:()=>a6(!1),onConfirm:()=>{(a6(!1),bu)?bo():bq()},title:"Risk Notice",message:bs?.deprecationNotice,confirmText:"I Understand, Continue",cancelText:"Cancel",variant:"danger"}),(0,d.jsx)(m.uo,{isOpen:!!a3,onClose:()=>a4(null),onConfirm:a3?.onConfirm,title:a3?.title||"Confirm",message:a3?.message,variant:"danger"})]})}function ah({icon:a,label:b,value:c,sub:e,tone:f}){return(0,d.jsxs)(m.Zp,{className:"flex items-center gap-3 p-3.5",children:[(0,d.jsx)("div",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-surface-2 text-text-muted",children:(0,d.jsx)("span",{className:"material-symbols-outlined text-[20px]",children:a})}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-text-subtle",children:b}),(0,d.jsx)("p",{className:`font-display text-xl font-bold leading-tight ${{default:"text-text-main",success:"text-success",danger:"text-danger",brand:"text-text-main"}[f||"default"]}`,children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px] text-text-muted",children:e})]})]})}ah.propTypes={icon:g().string.isRequired,label:g().string.isRequired,value:g().number.isRequired,sub:g().string,tone:g().string}},14985:a=>{"use strict";a.exports=require("dns")},16698:a=>{"use strict";a.exports=require("node:async_hooks")},19121:a=>{"use strict";a.exports=require("next/dist/server/app-render/action-async-storage.external.js")},21820:a=>{"use strict";a.exports=require("os")},25519:(a,b,c)=>{"use strict";c.r(b),c.d(b,{__next_app__:()=>x,handler:()=>z,routeModule:()=>y});var d=c(21635),e=c(86315),f=c(1020),g=c(61287),h={};for(let a in g)0>["default","__next_app__","routeModule","handler"].indexOf(a)&&(h[a]=()=>g[a]);c.d(b,h);let i=(0,d.p)(()=>Promise.resolve().then(c.bind(c,57529))),j=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),k=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),l=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),m=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),n=(0,d.p)(()=>Promise.resolve().then(c.bind(c,30508))),o=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),p=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,55091,23))),q=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,45270,23))),r=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,28193,23))),s=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),t=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),u=(0,d.p)(()=>Promise.resolve().then(c.t.bind(c,95547,23))),v={children:["",{children:["(dashboard)",{children:["dashboard",{children:["providers",{children:["[id]",{children:["__PAGE__",{},{page:[(0,d.p)(()=>Promise.resolve().then(c.bind(c,93110))),"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js"]}]},{"global-error":[u,"next/dist/client/components/builtin/global-error.js"]},["new"]]},{"global-error":[t,"next/dist/client/components/builtin/global-error.js"]},[]]},{"global-error":[s,"next/dist/client/components/builtin/global-error.js"]},[]]},{layout:[n,"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/layout.js"],"global-error":[o,"next/dist/client/components/builtin/global-error.js"],"not-found":[p,"next/dist/client/components/builtin/not-found.js"],forbidden:[q,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[r,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]},{layout:[i,"/home/keyzakyy/Projects/keyrouter/src/app/layout.js"],"global-error":[j,"next/dist/client/components/builtin/global-error.js"],"not-found":[k,"next/dist/client/components/builtin/not-found.js"],forbidden:[l,"next/dist/client/components/builtin/forbidden.js"],unauthorized:[m,"next/dist/client/components/builtin/unauthorized.js"],metadata:{icon:[async a=>(await (0,d.p)(()=>Promise.resolve().then(c.bind(c,70440)))()).default(a)],apple:[],openGraph:[],twitter:[],manifest:"/manifest.webmanifest"}},[]]}.children,w=(0,e.H)({tree:v,page:"/(dashboard)/dashboard/providers/[id]/page",pathname:"/dashboard/providers/[id]",require:c,loadChunk:()=>Promise.resolve(),interopDefault:f.T}),x=w.__next_app__,y=w.routeModule,z=w.handler},27910:a=>{"use strict";a.exports=require("stream")},28354:a=>{"use strict";a.exports=require("util")},29021:a=>{"use strict";a.exports=require("fs")},29294:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-async-storage.external.js")},31421:a=>{"use strict";a.exports=require("node:child_process")},32467:a=>{"use strict";a.exports=require("node:http2")},33873:a=>{"use strict";a.exports=require("path")},34589:a=>{"use strict";a.exports=require("node:assert")},37067:a=>{"use strict";a.exports=require("node:http")},37540:a=>{"use strict";a.exports=require("node:console")},38522:a=>{"use strict";a.exports=require("node:zlib")},40610:a=>{"use strict";a.exports=require("node:dns")},41025:a=>{"use strict";a.exports=require("next/dist/server/app-render/dynamic-access-async-storage.external.js")},41365:(a,b,c)=>{"use strict";c.d(b,{A:()=>m,w:()=>j});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(99258);let j=new Set(["grok-web","chatgpt-web","gemini-web","muse-web","deepseek-web","uc-web"]),k={default:"person",grok:"bolt",work:"work",personal:"home"},l=[{key:"opening",label:"Opening browser window",icon:"open_in_new"},{key:"waiting",label:"Waiting for you to log in",icon:"hourglass_top"},{key:"saving",label:"Saving connection",icon:"save"}];function m({providerId:a,onConnected:b,size:c="sm"}){let[f,g]=(0,e.useState)(!1),[j,n]=(0,e.useState)("idle"),[o,p]=(0,e.useState)(""),[q,r]=(0,e.useState)(["default"]),[s,t]=(0,e.useState)("default"),u=(0,e.useRef)(null),v=(0,e.useRef)(null),w=(0,e.useCallback)(()=>{u.current&&(clearInterval(u.current),u.current=null)},[]),x=(0,e.useCallback)(a=>{t(a)},[a]),y="opening"===j||"waiting"===j,z=(0,e.useCallback)(()=>{y||(w(),g(!1),"error"===j&&(n("idle"),p("")))},[y,j,w]),A=(0,e.useCallback)(()=>{w(),u.current=setInterval(async()=>{try{let c=await fetch(`/api/providers/web-login?provider=${encodeURIComponent(a)}`,{cache:"no-store"}),d=await c.json();"success"===d.status?(w(),n("success"),p(d.email?`${(0,i.Tl)("Signed in as")} ${d.email}`:"Connection saved"),"function"==typeof b&&b(),v.current=setTimeout(()=>{g(!1),p("")},1500)):"error"===d.status||"timeout"===d.status||"cancelled"===d.status?(w(),n("error"),p(d.error||(0,i.Tl)("Login failed"))):n(a=>"opening"===a?"waiting":a)}catch{}},2e3)},[a,b,w]),B=(0,e.useCallback)(async()=>{n("opening"),p("");try{let b=await fetch("/api/providers/web-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({provider:a,profile:s})}),c=await b.json();if(!b.ok){n("error"),p(c.error||(0,i.Tl)("Failed to start login"));return}n("waiting"),p((0,i.Tl)("A browser window has opened - log in there, this page updates itself.")),A()}catch(a){n("error"),p(a?.message||(0,i.Tl)("Failed to start login"))}},[a,s,A]),C=(0,e.useCallback)(()=>{fetch(`/api/providers/web-login?provider=${encodeURIComponent(a)}`,{method:"DELETE"}).catch(()=>{}),w(),n("idle"),p("")},[a,w]),D=(0,e.useCallback)(()=>{let a=window.prompt((0,i.Tl)("New browser profile name (e.g. work, personal):"),"");if(!a)return;let b=a.trim().replace(/[^a-zA-Z0-9_-]/g,"-").slice(0,40);b&&(r(a=>a.includes(b)?a:[...a,b]),x(b))},[x]),E="opening"===j?0:"waiting"===j?1:"success"===j?2:-1;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{size:c,icon:"success"===j?"check_circle":"language",variant:"secondary",onClick:()=>{n("idle"),p(""),g(!0)},title:(0,i.Tl)("Open a browser window, log in by hand - the cookie is captured automatically"),children:"success"===j?(0,i.Tl)("Connected"):(0,i.Tl)("Login via Browser")}),(0,d.jsx)(h.aF,{isOpen:f,onClose:z,title:(0,i.Tl)("Login via Browser"),size:"sm",children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:(0,i.Tl)("A Chrome window opens on a shared browser profile. Log in there - the session is captured automatically. One Google login in a profile makes every other provider a single “Continue with Google” click.")}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,d.jsx)("span",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:(0,i.Tl)("Browser profile")}),(0,d.jsxs)("button",{type:"button",onClick:D,disabled:y,className:"flex items-center gap-1 text-xs text-primary hover:underline disabled:opacity-50",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[14px]",children:"add"}),(0,i.Tl)("New profile")]})]}),(0,d.jsx)("div",{className:"grid grid-cols-2 gap-2",children:q.map(a=>{let b=a===s;return(0,d.jsxs)("button",{type:"button",disabled:y,onClick:()=>x(a),className:`flex items-center gap-2 rounded border border-accent/30 bg-sidebar p-2 text-left text-sm transition-colors focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-50 ${b?"border-primary ring-1 ring-primary":"hover:border-accent/60"}`,children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px] text-text-muted",children:function(a){let b=String(a).toLowerCase();for(let[a,c]of Object.entries(k))if(b.includes(a))return c;return"folder_shared"}(a)}),(0,d.jsx)("span",{className:"min-w-0 flex-1 truncate",children:a}),b&&(0,d.jsx)("span",{className:"material-symbols-outlined text-[16px] text-primary",children:"check_circle"})]},a)})})]}),"idle"!==j&&(0,d.jsx)("div",{className:"rounded border border-accent/20 bg-sidebar/50 p-3",children:"success"===j?(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-green-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"check_circle"}),"✓ ",o||(0,i.Tl)("Connection saved")]}):"error"===j?(0,d.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-yellow-400",children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[18px]",children:"error"}),(0,i.Tl)("Login failed")]}),o&&(0,d.jsx)("p",{className:"pl-6 text-xs text-red-500 break-words",children:o})]}):(0,d.jsxs)("ol",{className:"flex flex-col gap-2",children:[l.map((a,b)=>{let c=b<E,e=b===E;return(0,d.jsxs)("li",{className:`flex items-center gap-2 text-sm ${c?"text-green-400":e?"text-primary":"text-text-muted opacity-50"}`,children:[(0,d.jsx)("span",{className:`material-symbols-outlined text-[18px] ${e?"animate-pulse":""}`,children:c?"check_circle":a.icon}),(0,i.Tl)(a.label)]},a.key)}),o&&(0,d.jsx)("li",{className:"pl-6 text-xs text-text-muted",children:o})]})}),(0,d.jsx)("div",{className:"flex gap-2",children:"success"===j?(0,d.jsx)(h.$n,{onClick:z,fullWidth:!0,children:(0,i.Tl)("Done")}):y?(0,d.jsx)(h.$n,{onClick:C,variant:"ghost",fullWidth:!0,children:(0,i.Tl)("Cancel")}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{onClick:B,fullWidth:!0,disabled:"error"===j&&!o,children:(0,i.Tl)("Open Browser & Login")}),(0,d.jsx)(h.$n,{onClick:z,variant:"ghost",fullWidth:!0,disabled:y,children:(0,i.Tl)("Close")})]})})]})})]})}m.propTypes={providerId:g().string.isRequired,onConnected:g().func,size:g().oneOf(["sm","md","lg"])}},41692:a=>{"use strict";a.exports=require("node:tls")},41792:a=>{"use strict";a.exports=require("node:querystring")},46060:a=>{"use strict";a.exports=require("next/dist/shared/lib/no-fallback-error.external.js")},46293:a=>{"use strict";a.exports=require("sql.js")},48161:a=>{"use strict";a.exports=require("node:os")},50286:(a,b,c)=>{Promise.resolve().then(c.bind(c,12138))},51455:a=>{"use strict";a.exports=require("node:fs/promises")},53053:a=>{"use strict";a.exports=require("node:diagnostics_channel")},54589:(a,b,c)=>{"use strict";function d(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}c.d(b,{JW:()=>i,Vm:()=>d,fB:()=>f,gy:()=>e,nz:()=>g});let e={anchor:"09:30",timezone:d(),windowHours:5,slotsPerDay:3};function f(a){let b=/^(\d{1,2}):(\d{2})$/.exec(String(a||"").trim());if(!b)return null;let c=Number(b[1]),d=Number(b[2]);return c>23||d>59?null:{hour:c,minute:d}}function g(a){return Math.max(1,Math.floor(24/a))}function h(a,b,c,d){let e="number"==typeof a?a:Number(a);return Number.isFinite(e)?Math.min(d,Math.max(c,e)):b}function i(a){let b=function(a){if(!a||!0!==a.enabled)return null;let b=f(a.anchor)||f(e.anchor),c=`${String(b.hour).padStart(2,"0")}:${String(b.minute).padStart(2,"0")}`,d=!function(a){if(!a||"string"!=typeof a)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:a}),!0}catch{return!1}}(a.timezone)?e.timezone:a.timezone,i=h(a.windowHours,e.windowHours,.5,24),j=Math.round(h(a.slotsPerDay,e.slotsPerDay,1,g(i)));return{enabled:!0,anchor:c,timezone:d,windowHours:i,slotsPerDay:j}}(a);if(!b)return[];let{hour:c,minute:d}=f(b.anchor),i=60*c+d;return Array.from({length:b.slotsPerDay},(a,c)=>{let d=Math.round(i+c*b.windowHours*60)%1440;return`${String(Math.floor(d/60)).padStart(2,"0")}:${String(d%60).padStart(2,"0")}`})}},55511:a=>{"use strict";a.exports=require("crypto")},55591:a=>{"use strict";a.exports=require("https")},56020:(a,b,c)=>{"use strict";c.d(b,{A:()=>l});var d=c(48249),e=c(67484),f=c(49885),g=c.n(f),h=c(50412),i=c(71404),j=c(54589);let k=[{value:"off",label:"Off",icon:"block"},{value:"reset",label:"On reset",icon:"bolt"},{value:"schedule",label:"Schedule",icon:"schedule"}];function l({isOpen:a,onClose:b,onSave:c,connection:f,reactive:g=!1,schedule:m=null}){let[n,o]=(0,e.useState)(()=>({mode:m?.enabled===!0?"schedule":!0===g?"reset":"off",anchor:m?.anchor||j.gy.anchor,timezone:(0,j.Vm)(),windowHours:String(m?.windowHours??j.gy.windowHours),slotsPerDay:String(m?.slotsPerDay??j.gy.slotsPerDay)})),p=Number(n.windowHours),q=Number(n.slotsPerDay),r=!!(0,j.fB)(n.anchor),s=Number.isFinite(p)&&p>=.5&&p<=24,t=s?(0,j.nz)(p):24,u=Number.isInteger(q)&&q>=1&&q<=t,v=r&&s&&u,w="schedule"!==n.mode||v,x=v?(0,j.JW)({enabled:!0,...n,windowHours:p,slotsPerDay:q}):[],y=x.length&&s?(()=>{let{hour:a,minute:b}=(0,j.fB)(n.anchor),c=Math.round(60*a+b+q*p*60)%1440;return`${String(Math.floor(c/60)).padStart(2,"0")}:${String(c%60).padStart(2,"0")}`})():"",z=a=>o(b=>({...b,...a}));return(0,d.jsx)(h.aF,{isOpen:a,onClose:b,title:"Auto-ping settings",size:"lg",footer:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(h.$n,{variant:"secondary",onClick:b,children:"Cancel"}),(0,d.jsx)(h.$n,{onClick:()=>{w&&(c({reactive:"reset"===n.mode,schedule:"schedule"===n.mode?{enabled:!0,anchor:n.anchor,timezone:n.timezone,windowHours:p,slotsPerDay:q}:{enabled:!1}}),b())},disabled:!w,children:"Save"})]}),children:(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsxs)("p",{className:"text-sm text-text-muted",children:["Configure automated quota pings",f?.name?` for ${f.name}`:""," - pick one mode."]}),(0,d.jsx)("div",{className:"grid grid-cols-3 gap-1 rounded-[10px] bg-surface-2 p-1",children:k.map(a=>{let b=n.mode===a.value;return(0,d.jsxs)("button",{type:"button",onClick:()=>z({mode:a.value}),className:(0,i.cn)("flex h-9 items-center justify-center gap-1.5 rounded-[8px] px-3 text-sm font-medium transition-all",b?"bg-surface text-text-main shadow-sm":"text-text-muted hover:text-text-main"),children:[(0,d.jsx)("span",{className:"material-symbols-outlined text-[15px] leading-none",children:a.icon}),(0,d.jsx)("span",{children:a.label})]},a.value)})}),"reset"===n.mode&&(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings right after the 5h quota window resets, so a new window starts immediately."}),"schedule"===n.mode&&(0,d.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,d.jsx)("p",{className:"text-xs text-text-muted",children:"Pings at fixed local times so the 5h windows align with your workday."}),(0,d.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,d.jsx)(h.pd,{label:"Anchor time",type:"time",value:n.anchor,onChange:a=>z({anchor:a.target.value}),error:r?"":"Use HH:MM",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Window (hours)",type:"number",min:"0.5",max:"24",step:"0.5",value:n.windowHours,onChange:a=>z({windowHours:a.target.value}),error:s?"":"0.5 – 24",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"}),(0,d.jsx)(h.pd,{label:"Pings per day",type:"number",min:"1",max:String(t),step:"1",value:n.slotsPerDay,onChange:a=>z({slotsPerDay:a.target.value}),error:u?"":`1 – ${t}`,hint:u?`Max ${t}`:"",inputClassName:"ring-1 ring-black/10 dark:ring-white/15"})]}),x.length>0&&(0,d.jsxs)("div",{className:"rounded-[10px] bg-surface-2 px-3 py-2.5",children:[(0,d.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-text-muted",children:["Daily slots (",n.timezone,")"]}),(0,d.jsx)("p",{className:"mt-1 text-sm font-medium text-text-main",children:x.join(" → ")}),(0,d.jsxs)("p",{className:"mt-1 text-xs text-text-muted",children:["Covers ",x[0]," – ",y,", then pauses until ",x[0]," next day."]})]})]})]})})}l.propTypes={isOpen:g().bool.isRequired,onClose:g().func.isRequired,onSave:g().func.isRequired,connection:g().object,reactive:g().bool,schedule:g().object}},57075:a=>{"use strict";a.exports=require("node:stream")},57975:a=>{"use strict";a.exports=require("node:util")},63033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},64198:(a,b,c)=>{Promise.resolve().then(c.bind(c,93110))},71553:a=>{"use strict";a.exports=require("node:dns/promises")},71622:a=>{"use strict";a.exports=import("open")},72271:a=>{"use strict";a.exports=require("@aws-sdk/credential-providers")},73024:a=>{"use strict";a.exports=require("node:fs")},73136:a=>{"use strict";a.exports=require("node:url")},73429:a=>{"use strict";a.exports=require("node:util/types")},73496:a=>{"use strict";a.exports=require("http2")},74075:a=>{"use strict";a.exports=require("zlib")},75919:a=>{"use strict";a.exports=require("node:worker_threads")},76760:a=>{"use strict";a.exports=require("node:path")},77030:a=>{"use strict";a.exports=require("node:net")},77598:a=>{"use strict";a.exports=require("node:crypto")},78474:a=>{"use strict";a.exports=require("node:events")},79646:a=>{"use strict";a.exports=require("child_process")},79868:a=>{"use strict";a.exports=require("node:sqlite")},81630:a=>{"use strict";a.exports=require("http")},81787:a=>{"use strict";a.exports=require("bun:sqlite")},87550:a=>{"use strict";a.exports=require("better-sqlite3")},87997:a=>{"use strict";a.exports=require("node:timers")},91645:a=>{"use strict";a.exports=require("net")},93110:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/keyzakyy/Projects/keyrouter/src/app/(dashboard)/dashboard/providers/[id]/page.js","default")},94735:a=>{"use strict";a.exports=require("events")}};var b=require("../../../../../webpack-runtime.js");b.C(a);var c=b.X(0,[2970,1260,2430,7678,2760,1220,9100,8499,6070,869,915,6457,4123,2172,6777,412,5626],()=>b(b.s=25519));module.exports=c})();
|